]> granicus.if.org Git - postgis/commitdiff
Avoid using ST_SharedPath in topology.AddFace as well.
authorSandro Santilli <strk@keybit.net>
Thu, 17 Mar 2011 00:08:11 +0000 (00:08 +0000)
committerSandro Santilli <strk@keybit.net>
Thu, 17 Mar 2011 00:08:11 +0000 (00:08 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@6916 b70326c6-7e19-0410-871a-916f4a2858ee

topology/sql/populate.sql

index d5fc9f67e37d643ac153882a1961f54889c4fb10..11fe4adf6685013b909b11cd3f2c62f0cc9fda51 100644 (file)
@@ -333,7 +333,7 @@ DECLARE
   old_faceid int;
   old_edgeid int;
   sql text;
-  side int;
+  right_side bool;
 BEGIN
   --
   -- Atopology and apoly are required
@@ -371,19 +371,18 @@ BEGIN
     LOOP -- {
 
       -- Find the side of the edge on the face
-      -- TODO: can probably be optimized further
-      SELECT DISTINCT (st_dump(st_sharedpaths(rec.geom, bounds))).path[1]
-        INTO STRICT side;
+      right_side := ST_Line_Locate_Point(bounds,
+                ST_Line_Interpolate_Point(rec.geom, 0.2)) <
+              ST_Line_Locate_Point(bounds,
+                ST_Line_Interpolate_Point(rec.geom, 0.8));
 
-      RAISE DEBUG 'Edge % (left:%, right:%) - ring : % - side : %',
-        rec.edge_id, rec.left_face, rec.right_face, rrec.path, side;
+      RAISE DEBUG 'Edge % (left:%, right:%) - ring : % - right_side : %',
+        rec.edge_id, rec.left_face, rec.right_face, rrec.path, right_side;
 
-      IF side = 1 THEN
-        -- This face is on the right
+      IF right_side THEN
         right_edges := array_append(right_edges, rec.edge_id);
         old_faceid = rec.right_face;
       ELSE
-        -- This face is on the left
         left_edges := array_append(left_edges, rec.edge_id);
         old_faceid = rec.left_face;
       END IF;