]> granicus.if.org Git - postgis/commitdiff
Add lwgeom_construct_empty API call
authorSandro Santilli <strk@keybit.net>
Mon, 9 Jan 2012 17:01:48 +0000 (17:01 +0000)
committerSandro Santilli <strk@keybit.net>
Mon, 9 Jan 2012 17:01:48 +0000 (17:01 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@8720 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/liblwgeom.h.in
liblwgeom/lwgeom.c

index 6cb7ef227c0d934f77bd3482a4830053dc59e27a..a084bc4178ed009a3a0668996798f61e90e59dbf 100644 (file)
@@ -1166,6 +1166,7 @@ extern LWCOLLECTION* lwcollection_construct(uint8_t type, int srid, GBOX *bbox,
 /*
 * Empty geometry constructors.
 */
+extern LWGEOM* lwgeom_construct_empty(uint8_t type, int srid, char hasz, char hasm);
 extern LWPOINT* lwpoint_construct_empty(int srid, char hasz, char hasm);
 extern LWLINE* lwline_construct_empty(int srid, char hasz, char hasm);
 extern LWPOLY* lwpoly_construct_empty(int srid, char hasz, char hasm);
index 5b796f907ec330ed7fd77c138864451bbb9fb692..c34a32b0c7bf0849622ae3efee2b6aaf7e215c3c 100644 (file)
@@ -1519,4 +1519,34 @@ lwgeom_affine(LWGEOM *geom, const AFFINE *affine)
 
 }
 
+LWGEOM *
+lwgeom_construct_empty(uint8_t type, int srid, char hasz, char hasm)
+{
+       switch(type) 
+       {
+               case POINTTYPE:
+                       return lwpoint_as_lwgeom(lwpoint_construct_empty(srid, hasz, hasm));
+               case LINETYPE:
+                       return lwline_as_lwgeom(lwline_construct_empty(srid, hasz, hasm));
+               case POLYGONTYPE:
+                       return lwpoly_as_lwgeom(lwpoly_construct_empty(srid, hasz, hasm));
+               case CURVEPOLYTYPE:
+                       return lwcurvepoly_as_lwgeom(lwcurvepoly_construct_empty(srid, hasz, hasm));
+               case CIRCSTRINGTYPE:
+                       return lwcircstring_as_lwgeom(lwcircstring_construct_empty(srid, hasz, hasm));
+               case TRIANGLETYPE:
+                       return lwtriangle_as_lwgeom(lwtriangle_construct_empty(srid, hasz, hasm));
+               case COMPOUNDTYPE:
+               case MULTIPOINTTYPE:
+               case MULTILINETYPE:
+               case MULTIPOLYGONTYPE:
+               case COLLECTIONTYPE:
+                       return lwcollection_as_lwgeom(lwcollection_construct_empty(type, srid, hasz, hasm));
+               default:
+                       lwerror("lwgeom_construct_empty: unsupported geometry type: %s",
+                               lwtype_name(type));
+                       return NULL;
+       }
+}
+