]> granicus.if.org Git - postgis/commitdiff
Retain type of TopoGeometry objects defined by NO element (#1017)
authorSandro Santilli <strk@keybit.net>
Thu, 29 Dec 2011 18:13:07 +0000 (18:13 +0000)
committerSandro Santilli <strk@keybit.net>
Thu, 29 Dec 2011 18:13:07 +0000 (18:13 +0000)
Includes regression tests for conversion of typed empty objects
from simple to topological model.

git-svn-id: http://svn.osgeo.org/postgis/trunk@8614 b70326c6-7e19-0410-871a-916f4a2858ee

topology/test/regress/createtopogeom.sql
topology/test/regress/createtopogeom_expected
topology/topology.sql.in.c

index 0d81573017ab6aecd7a54203e699ae3b6be1879d..29eb6b8428fe442e823c970d729fdf93cf87c38e 100644 (file)
@@ -60,4 +60,11 @@ SELECT 'ML', ST_AsText(CreateTopoGeom( 'MiX', 2, 4, '{{1,2}}')); -- fine line
 SELECT 'MA', ST_AsText(CreateTopoGeom( 'MiX', 3, 4, '{{1,3}}')); -- fine area
 SELECT 'MM', ST_AsText(CreateTopoGeom( 'MiX', 4, 4, '{{1,3},{1,2},{1,1}}')); -- fine mix
 
+-- Test emptyness {
+SELECT 'POINT EMPTY', ST_AsEWKT( CreateTopoGeom( 'MiX', 1, 4, '{{0,0}}' ) );
+SELECT 'LINESTRING EMPTY', ST_AsEWKT( CreateTopoGeom( 'MiX', 2, 4, '{{0,0}}' ) );
+SELECT 'POLYGON EMPTY', ST_AsEWKT( CreateTopoGeom( 'MiX', 3, 4, '{{0,0}}' ) );
+SELECT 'GEOMETRYCOLLECTION EMPTY', ST_AsEWKT( CreateTopoGeom( 'MiX', 4, 4, '{{0,0}}' ) );
+-- } Test emptyness 
+
 SELECT DropTopology('MiX');
index 7e5a6b3c56904ed89458c3756a3c021b74ef2362..b422a5438b492c61cebbeaeca47a8cd51f6c332a 100644 (file)
@@ -25,4 +25,8 @@ MP|POINT(0 0)
 ML|LINESTRING(0 0,10 0)
 MA|POLYGON((10 0,0 0,5 5,10 0))
 MM|GEOMETRYCOLLECTION EMPTY
+POINT EMPTY|POINT EMPTY
+LINESTRING EMPTY|LINESTRING EMPTY
+POLYGON EMPTY|POLYGON EMPTY
+GEOMETRYCOLLECTION EMPTY|GEOMETRYCOLLECTION EMPTY
 Topology 'MiX' dropped
index 8c678cff2bd84f46470603767dc21a6d8d1189a9..f26d6be99b1054a60893388bc1172c85e4c092f7 100644 (file)
@@ -1239,6 +1239,9 @@ BEGIN
                LOOP
                        geom := rec.g;
                END LOOP;
+               IF geom IS NULL THEN
+                       geom := 'POLYGON EMPTY';
+               END IF;
 
        ELSIF topogeom.type = 2 THEN -- [multi]line
                FOR rec IN EXECUTE 'SELECT ST_LineMerge(ST_Collect(e.geom)) as g FROM '
@@ -1251,6 +1254,9 @@ BEGIN
                LOOP
                        geom := rec.g;
                END LOOP;
+               IF geom IS NULL THEN
+                       geom := 'LINESTRING EMPTY';
+               END IF;
        
        ELSIF topogeom.type = 1 THEN -- [multi]point
                FOR rec IN EXECUTE 'SELECT st_union(n.geom) as g FROM '
@@ -1263,6 +1269,9 @@ BEGIN
                LOOP
                        geom := rec.g;
                END LOOP;
+               IF geom IS NULL THEN
+                       geom := 'POINT EMPTY';
+               END IF;
 
        ELSE
                RAISE NOTICE 'Geometry from TopoGeometry does not support TopoGeometries of type % so far', topogeom.type;