PostGIS  2.3.8dev-r@@SVN_REVISION@@

◆ lwgeom_force_sfs()

LWGEOM* lwgeom_force_sfs ( LWGEOM geom,
int  version 
)

Definition at line 757 of file lwgeom.c.

References CIRCSTRINGTYPE, COLLECTIONTYPE, COMPOUNDTYPE, CURVEPOLYTYPE, LWCOLLECTION::geoms, lwcollection_as_lwgeom(), lwgeom_free(), lwgeom_stroke(), lwmpoly_as_lwgeom(), lwpoly_as_lwgeom(), lwpoly_from_lwlines(), MULTICURVETYPE, MULTISURFACETYPE, LWCOLLECTION::ngeoms, POLYHEDRALSURFACETYPE, TINTYPE, TRIANGLETYPE, LWGEOM::type, LWMPOLY::type, and LWCOLLECTION::type.

Referenced by do_geom_test(), do_type_test(), and LWGEOM_force_sfs().

758 {
759  LWCOLLECTION *col;
760  int i;
761  LWGEOM *g;
762 
763  /* SFS 1.2 version */
764  if (version == 120)
765  {
766  switch(geom->type)
767  {
768  /* SQL/MM types */
769  case CIRCSTRINGTYPE:
770  case COMPOUNDTYPE:
771  case CURVEPOLYTYPE:
772  case MULTICURVETYPE:
773  case MULTISURFACETYPE:
774  return lwgeom_stroke(geom, 32);
775 
776  case COLLECTIONTYPE:
777  col = (LWCOLLECTION*)geom;
778  for ( i = 0; i < col->ngeoms; i++ )
779  col->geoms[i] = lwgeom_force_sfs((LWGEOM*)col->geoms[i], version);
780 
781  return lwcollection_as_lwgeom((LWCOLLECTION*)geom);
782 
783  default:
784  return (LWGEOM *)geom;
785  }
786  }
787 
788 
789  /* SFS 1.1 version */
790  switch(geom->type)
791  {
792  /* SQL/MM types */
793  case CIRCSTRINGTYPE:
794  case COMPOUNDTYPE:
795  case CURVEPOLYTYPE:
796  case MULTICURVETYPE:
797  case MULTISURFACETYPE:
798  return lwgeom_stroke(geom, 32);
799 
800  /* SFS 1.2 types */
801  case TRIANGLETYPE:
802  g = lwpoly_as_lwgeom(lwpoly_from_lwlines((LWLINE*)geom, 0, NULL));
803  lwgeom_free(geom);
804  return g;
805 
806  case TINTYPE:
807  col = (LWCOLLECTION*) geom;
808  for ( i = 0; i < col->ngeoms; i++ )
809  {
810  g = lwpoly_as_lwgeom(lwpoly_from_lwlines((LWLINE*)col->geoms[i], 0, NULL));
811  lwgeom_free(col->geoms[i]);
812  col->geoms[i] = g;
813  }
814  col->type = COLLECTIONTYPE;
815  return lwmpoly_as_lwgeom((LWMPOLY*)geom);
816 
818  geom->type = COLLECTIONTYPE;
819  return (LWGEOM *)geom;
820 
821  /* Collection */
822  case COLLECTIONTYPE:
823  col = (LWCOLLECTION*)geom;
824  for ( i = 0; i < col->ngeoms; i++ )
825  col->geoms[i] = lwgeom_force_sfs((LWGEOM*)col->geoms[i], version);
826 
827  return lwcollection_as_lwgeom((LWCOLLECTION*)geom);
828 
829  default:
830  return (LWGEOM *)geom;
831  }
832 }
LWGEOM * lwgeom_stroke(const LWGEOM *geom, uint32_t perQuad)
Definition: lwstroke.c:462
LWGEOM * lwpoly_as_lwgeom(const LWPOLY *obj)
Definition: lwgeom.c:252
#define MULTICURVETYPE
Definition: liblwgeom.h:94
uint8_t type
Definition: liblwgeom.h:502
#define CURVEPOLYTYPE
Definition: liblwgeom.h:93
#define COMPOUNDTYPE
Definition: liblwgeom.h:92
#define TRIANGLETYPE
Definition: liblwgeom.h:97
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:96
LWGEOM * lwmpoly_as_lwgeom(const LWMPOLY *obj)
Definition: lwgeom.c:217
LWGEOM ** geoms
Definition: liblwgeom.h:508
#define TINTYPE
Definition: liblwgeom.h:98
LWGEOM * lwcollection_as_lwgeom(const LWCOLLECTION *obj)
Definition: lwgeom.c:232
LWPOLY * lwpoly_from_lwlines(const LWLINE *shell, uint32_t nholes, const LWLINE **holes)
Definition: lwpoly.c:328
LWGEOM * lwgeom_force_sfs(LWGEOM *geom, int version)
Definition: lwgeom.c:757
#define MULTISURFACETYPE
Definition: liblwgeom.h:95
uint8_t type
Definition: liblwgeom.h:395
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:91
void lwgeom_free(LWGEOM *lwgeom)
Definition: lwgeom.c:1063
#define COLLECTIONTYPE
Definition: liblwgeom.h:90
Here is the call graph for this function:
Here is the caller graph for this function: