PostGIS  2.5.0dev-r@@SVN_REVISION@@
LWGEOM* lwgeom_force_sfs ( LWGEOM geom,
int  version 
)

Definition at line 831 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, and LWCOLLECTION::type.

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

832 {
833  LWCOLLECTION *col;
834  uint32_t i;
835  LWGEOM *g;
836 
837  /* SFS 1.2 version */
838  if (version == 120)
839  {
840  switch(geom->type)
841  {
842  /* SQL/MM types */
843  case CIRCSTRINGTYPE:
844  case COMPOUNDTYPE:
845  case CURVEPOLYTYPE:
846  case MULTICURVETYPE:
847  case MULTISURFACETYPE:
848  return lwgeom_stroke(geom, 32);
849 
850  case COLLECTIONTYPE:
851  col = (LWCOLLECTION*)geom;
852  for ( i = 0; i < col->ngeoms; i++ )
853  col->geoms[i] = lwgeom_force_sfs((LWGEOM*)col->geoms[i], version);
854 
855  return lwcollection_as_lwgeom((LWCOLLECTION*)geom);
856 
857  default:
858  return (LWGEOM *)geom;
859  }
860  }
861 
862 
863  /* SFS 1.1 version */
864  switch(geom->type)
865  {
866  /* SQL/MM types */
867  case CIRCSTRINGTYPE:
868  case COMPOUNDTYPE:
869  case CURVEPOLYTYPE:
870  case MULTICURVETYPE:
871  case MULTISURFACETYPE:
872  return lwgeom_stroke(geom, 32);
873 
874  /* SFS 1.2 types */
875  case TRIANGLETYPE:
876  g = lwpoly_as_lwgeom(lwpoly_from_lwlines((LWLINE*)geom, 0, NULL));
877  lwgeom_free(geom);
878  return g;
879 
880  case TINTYPE:
881  col = (LWCOLLECTION*) geom;
882  for ( i = 0; i < col->ngeoms; i++ )
883  {
884  g = lwpoly_as_lwgeom(lwpoly_from_lwlines((LWLINE*)col->geoms[i], 0, NULL));
885  lwgeom_free(col->geoms[i]);
886  col->geoms[i] = g;
887  }
888  col->type = COLLECTIONTYPE;
889  return lwmpoly_as_lwgeom((LWMPOLY*)geom);
890 
892  geom->type = COLLECTIONTYPE;
893  return (LWGEOM *)geom;
894 
895  /* Collection */
896  case COLLECTIONTYPE:
897  col = (LWCOLLECTION*)geom;
898  for ( i = 0; i < col->ngeoms; i++ )
899  col->geoms[i] = lwgeom_force_sfs((LWGEOM*)col->geoms[i], version);
900 
901  return lwcollection_as_lwgeom((LWCOLLECTION*)geom);
902 
903  default:
904  return (LWGEOM *)geom;
905  }
906 }
LWGEOM * lwgeom_stroke(const LWGEOM *geom, uint32_t perQuad)
Definition: lwstroke.c:714
LWGEOM * lwpoly_as_lwgeom(const LWPOLY *obj)
Definition: lwgeom.c:319
#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
uint32_t ngeoms
Definition: liblwgeom.h:506
unsigned int uint32_t
Definition: uthash.h:78
LWGEOM * lwmpoly_as_lwgeom(const LWMPOLY *obj)
Definition: lwgeom.c:284
LWGEOM ** geoms
Definition: liblwgeom.h:508
#define TINTYPE
Definition: liblwgeom.h:98
LWGEOM * lwcollection_as_lwgeom(const LWCOLLECTION *obj)
Definition: lwgeom.c:299
LWPOLY * lwpoly_from_lwlines(const LWLINE *shell, uint32_t nholes, const LWLINE **holes)
Definition: lwpoly.c:358
LWGEOM * lwgeom_force_sfs(LWGEOM *geom, int version)
Definition: lwgeom.c:831
#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:1137
#define COLLECTIONTYPE
Definition: liblwgeom.h:90

Here is the call graph for this function:

Here is the caller graph for this function: