PostGIS  2.4.9dev-r@@SVN_REVISION@@

◆ lwgeom_force_sfs()

LWGEOM* lwgeom_force_sfs ( LWGEOM geom,
int  version 
)

Definition at line 793 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().

794 {
795  LWCOLLECTION *col;
796  int i;
797  LWGEOM *g;
798 
799  /* SFS 1.2 version */
800  if (version == 120)
801  {
802  switch(geom->type)
803  {
804  /* SQL/MM types */
805  case CIRCSTRINGTYPE:
806  case COMPOUNDTYPE:
807  case CURVEPOLYTYPE:
808  case MULTICURVETYPE:
809  case MULTISURFACETYPE:
810  return lwgeom_stroke(geom, 32);
811 
812  case COLLECTIONTYPE:
813  col = (LWCOLLECTION*)geom;
814  for ( i = 0; i < col->ngeoms; i++ )
815  col->geoms[i] = lwgeom_force_sfs((LWGEOM*)col->geoms[i], version);
816 
817  return lwcollection_as_lwgeom((LWCOLLECTION*)geom);
818 
819  default:
820  return (LWGEOM *)geom;
821  }
822  }
823 
824 
825  /* SFS 1.1 version */
826  switch(geom->type)
827  {
828  /* SQL/MM types */
829  case CIRCSTRINGTYPE:
830  case COMPOUNDTYPE:
831  case CURVEPOLYTYPE:
832  case MULTICURVETYPE:
833  case MULTISURFACETYPE:
834  return lwgeom_stroke(geom, 32);
835 
836  /* SFS 1.2 types */
837  case TRIANGLETYPE:
838  g = lwpoly_as_lwgeom(lwpoly_from_lwlines((LWLINE*)geom, 0, NULL));
839  lwgeom_free(geom);
840  return g;
841 
842  case TINTYPE:
843  col = (LWCOLLECTION*) geom;
844  for ( i = 0; i < col->ngeoms; i++ )
845  {
846  g = lwpoly_as_lwgeom(lwpoly_from_lwlines((LWLINE*)col->geoms[i], 0, NULL));
847  lwgeom_free(col->geoms[i]);
848  col->geoms[i] = g;
849  }
850  col->type = COLLECTIONTYPE;
851  return lwmpoly_as_lwgeom((LWMPOLY*)geom);
852 
854  geom->type = COLLECTIONTYPE;
855  return (LWGEOM *)geom;
856 
857  /* Collection */
858  case COLLECTIONTYPE:
859  col = (LWCOLLECTION*)geom;
860  for ( i = 0; i < col->ngeoms; i++ )
861  col->geoms[i] = lwgeom_force_sfs((LWGEOM*)col->geoms[i], version);
862 
863  return lwcollection_as_lwgeom((LWCOLLECTION*)geom);
864 
865  default:
866  return (LWGEOM *)geom;
867  }
868 }
LWGEOM * lwgeom_stroke(const LWGEOM *geom, uint32_t perQuad)
Definition: lwstroke.c:767
LWGEOM * lwpoly_as_lwgeom(const LWPOLY *obj)
Definition: lwgeom.c:288
#define MULTICURVETYPE
Definition: liblwgeom.h:95
uint8_t type
Definition: liblwgeom.h:503
#define CURVEPOLYTYPE
Definition: liblwgeom.h:94
#define COMPOUNDTYPE
Definition: liblwgeom.h:93
#define TRIANGLETYPE
Definition: liblwgeom.h:98
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:97
LWGEOM * lwmpoly_as_lwgeom(const LWMPOLY *obj)
Definition: lwgeom.c:253
LWGEOM ** geoms
Definition: liblwgeom.h:509
#define TINTYPE
Definition: liblwgeom.h:99
LWGEOM * lwcollection_as_lwgeom(const LWCOLLECTION *obj)
Definition: lwgeom.c:268
LWPOLY * lwpoly_from_lwlines(const LWLINE *shell, uint32_t nholes, const LWLINE **holes)
Definition: lwpoly.c:368
LWGEOM * lwgeom_force_sfs(LWGEOM *geom, int version)
Definition: lwgeom.c:793
#define MULTISURFACETYPE
Definition: liblwgeom.h:96
uint8_t type
Definition: liblwgeom.h:396
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:92
void lwgeom_free(LWGEOM *lwgeom)
Definition: lwgeom.c:1099
#define COLLECTIONTYPE
Definition: liblwgeom.h:91
Here is the call graph for this function:
Here is the caller graph for this function: