PostGIS  2.2.8dev-r@@SVN_REVISION@@

◆ lwgeom_force_sfs()

LWGEOM* lwgeom_force_sfs ( LWGEOM geom,
int  version 
)

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

745 {
746  LWCOLLECTION *col;
747  int i;
748  LWGEOM *g;
749 
750  /* SFS 1.2 version */
751  if (version == 120)
752  {
753  switch(geom->type)
754  {
755  /* SQL/MM types */
756  case CIRCSTRINGTYPE:
757  case COMPOUNDTYPE:
758  case CURVEPOLYTYPE:
759  case MULTICURVETYPE:
760  case MULTISURFACETYPE:
761  return lwgeom_stroke(geom, 32);
762 
763  case COLLECTIONTYPE:
764  col = (LWCOLLECTION*)geom;
765  for ( i = 0; i < col->ngeoms; i++ )
766  col->geoms[i] = lwgeom_force_sfs((LWGEOM*)col->geoms[i], version);
767 
768  return lwcollection_as_lwgeom((LWCOLLECTION*)geom);
769 
770  default:
771  return (LWGEOM *)geom;
772  }
773  }
774 
775 
776  /* SFS 1.1 version */
777  switch(geom->type)
778  {
779  /* SQL/MM types */
780  case CIRCSTRINGTYPE:
781  case COMPOUNDTYPE:
782  case CURVEPOLYTYPE:
783  case MULTICURVETYPE:
784  case MULTISURFACETYPE:
785  return lwgeom_stroke(geom, 32);
786 
787  /* SFS 1.2 types */
788  case TRIANGLETYPE:
789  g = lwpoly_as_lwgeom(lwpoly_from_lwlines((LWLINE*)geom, 0, NULL));
790  lwgeom_free(geom);
791  return g;
792 
793  case TINTYPE:
794  col = (LWCOLLECTION*) geom;
795  for ( i = 0; i < col->ngeoms; i++ )
796  {
797  g = lwpoly_as_lwgeom(lwpoly_from_lwlines((LWLINE*)col->geoms[i], 0, NULL));
798  lwgeom_free(col->geoms[i]);
799  col->geoms[i] = g;
800  }
801  col->type = COLLECTIONTYPE;
802  return lwmpoly_as_lwgeom((LWMPOLY*)geom);
803 
805  geom->type = COLLECTIONTYPE;
806  return (LWGEOM *)geom;
807 
808  /* Collection */
809  case COLLECTIONTYPE:
810  col = (LWCOLLECTION*)geom;
811  for ( i = 0; i < col->ngeoms; i++ )
812  col->geoms[i] = lwgeom_force_sfs((LWGEOM*)col->geoms[i], version);
813 
814  return lwcollection_as_lwgeom((LWCOLLECTION*)geom);
815 
816  default:
817  return (LWGEOM *)geom;
818  }
819 }
LWGEOM * lwgeom_stroke(const LWGEOM *geom, uint32_t perQuad)
Definition: lwstroke.c:446
LWGEOM * lwpoly_as_lwgeom(const LWPOLY *obj)
Definition: lwgeom.c:239
#define MULTICURVETYPE
Definition: liblwgeom.h:80
uint8_t type
Definition: liblwgeom.h:487
#define CURVEPOLYTYPE
Definition: liblwgeom.h:79
#define COMPOUNDTYPE
Definition: liblwgeom.h:78
#define TRIANGLETYPE
Definition: liblwgeom.h:83
#define POLYHEDRALSURFACETYPE
Definition: liblwgeom.h:82
LWGEOM * lwmpoly_as_lwgeom(const LWMPOLY *obj)
Definition: lwgeom.c:204
LWGEOM ** geoms
Definition: liblwgeom.h:493
#define TINTYPE
Definition: liblwgeom.h:84
LWGEOM * lwcollection_as_lwgeom(const LWCOLLECTION *obj)
Definition: lwgeom.c:219
LWPOLY * lwpoly_from_lwlines(const LWLINE *shell, uint32_t nholes, const LWLINE **holes)
Definition: lwpoly.c:255
LWGEOM * lwgeom_force_sfs(LWGEOM *geom, int version)
Definition: lwgeom.c:744
#define MULTISURFACETYPE
Definition: liblwgeom.h:81
uint8_t type
Definition: liblwgeom.h:380
#define CIRCSTRINGTYPE
Definition: liblwgeom.h:77
void lwgeom_free(LWGEOM *lwgeom)
Definition: lwgeom.c:1050
#define COLLECTIONTYPE
Definition: liblwgeom.h:76
Here is the call graph for this function:
Here is the caller graph for this function: