Use Tomvantilburg suggestion and just hard-code convex='false' for all IndexedFaceSets.
authorRegina Obe <lr@pcorp.us>
Sun, 6 Mar 2016 00:43:07 +0000 (00:43 +0000)
committerRegina Obe <lr@pcorp.us>
Sun, 6 Mar 2016 00:43:07 +0000 (00:43 +0000)
Corrects the output of wrongly rendered without affecting true convex
Closes #3435 for PostGIS 2.3 (trunk).
Update Copyright info

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

liblwgeom/cunit/cu_out_x3d.c
liblwgeom/lwout_x3d.c

index b130cc506726163d718b6fccd36fa9c102847967..c94da4a5440184056a79b22a681a9a4e0574f198 100644 (file)
@@ -1,8 +1,8 @@
 /**********************************************************************
  *
  * PostGIS - Spatial Types for PostgreSQL
- * http://www.postgis.org
- * Copyright 2011 Regina Obe
+ * http://postgis.net
+ * Copyright 2011-2016 Regina Obe
  *
  * This is free software; you can redistribute and/or modify it under
  * the terms of the GNU General Public Licence. See the COPYING file.
@@ -94,7 +94,7 @@ static void out_x3d3_test_geoms(void)
        /* Polygon **/
        do_x3d3_test(
            "POLYGON((15 10 3,13.536 6.464 3,10 5 3,6.464 6.464 3,5 10 3,6.464 13.536 3,10 15 3,13.536 13.536 3,15 10 3))",
-           "<IndexedFaceSet  coordIndex='0 1 2 3 4 5 6 7'><Coordinate point='15 10 3 13.536 6.464 3 10 5 3 6.464 6.464 3 5 10 3 6.464 13.536 3 10 15 3 13.536 13.536 3 ' /></IndexedFaceSet>",
+           "<IndexedFaceSet  convex='false' coordIndex='0 1 2 3 4 5 6 7'><Coordinate point='15 10 3 13.536 6.464 3 10 5 3 6.464 6.464 3 5 10 3 6.464 13.536 3 10 15 3 13.536 13.536 3 ' /></IndexedFaceSet>",
            NULL, 3, 0);
 
        /* TODO: Polygon - with internal ring - the answer is clearly wrong */
@@ -123,13 +123,13 @@ static void out_x3d3_test_geoms(void)
        /* MultiPolygon */
        do_x3d3_test(
            "MULTIPOLYGON(((0 1 1,2 3 1,4 5 1,0 1 1)),((6 7 1,8 9 1,10 11 1,6 7 1)))",
-           "<IndexedFaceSet  coordIndex='0 1 2 -1 3 4 5'><Coordinate point='0 1 1 2 3 1 4 5 1 6 7 1 8 9 1 10 11 1 ' /></IndexedFaceSet>",
+           "<IndexedFaceSet  convex='false' coordIndex='0 1 2 -1 3 4 5'><Coordinate point='0 1 1 2 3 1 4 5 1 6 7 1 8 9 1 10 11 1 ' /></IndexedFaceSet>",
            NULL, 0, 0);
        
        /* PolyhedralSurface */
        do_x3d3_test(
            "POLYHEDRALSURFACE( ((0 0 0, 0 0 1, 0 1 1, 0 1 0, 0 0 0)), ((0 0 0, 0 1 0, 1 1 0, 1 0 0, 0 0 0)), ((0 0 0, 1 0 0, 1 0 1, 0 0 1, 0 0 0)), ((1 1 0, 1 1 1, 1 0 1, 1 0 0, 1 1 0)), ((0 1 0, 0 1 1, 1 1 1, 1 1 0, 0 1 0)), ((0 0 1, 1 0 1, 1 1 1, 0 1 1, 0 0 1)) )",
-           "<IndexedFaceSet  coordIndex='0 1 2 3 -1 4 5 6 7 -1 8 9 10 11 -1 12 13 14 15 -1 16 17 18 19 -1 20 21 22 23'><Coordinate point='0 0 0 0 0 1 0 1 1 0 1 0 0 0 0 0 1 0 1 1 0 1 0 0 0 0 0 1 0 0 1 0 1 0 0 1 1 1 0 1 1 1 1 0 1 1 0 0 0 1 0 0 1 1 1 1 1 1 1 0 0 0 1 1 0 1 1 1 1 0 1 1' /></IndexedFaceSet>",
+           "<IndexedFaceSet convex='false'  coordIndex='0 1 2 3 -1 4 5 6 7 -1 8 9 10 11 -1 12 13 14 15 -1 16 17 18 19 -1 20 21 22 23'><Coordinate point='0 0 0 0 0 1 0 1 1 0 1 0 0 0 0 0 1 0 1 1 0 1 0 0 0 0 0 1 0 0 1 0 1 0 0 1 1 1 0 1 1 1 1 0 1 1 0 0 0 1 0 0 1 1 1 1 1 1 1 0 0 0 1 1 0 1 1 1 1 0 1 1' /></IndexedFaceSet>",
            NULL, 0, 0);
 
        /* TODO: returns garbage at moment correctly implement GeometryCollection -- */
@@ -167,13 +167,13 @@ static void out_x3d3_test_option(void)
        /* geocoordinate long,lat*/
        do_x3d3_test(
            "SRID=4326;POLYGON((15 10 3,13.536 6.464 3,10 5 3,6.464 6.464 3,5 10 3,6.464 13.536 3,10 15 3,13.536 13.536 3,15 10 3))",
-           "<IndexedFaceSet  coordIndex='0 1 2 3 4 5 6 7'><GeoCoordinate geoSystem='\"GD\" \"WE\" \"longitude_first\"' point='15 10 3 13.536 6.464 3 10 5 3 6.464 6.464 3 5 10 3 6.464 13.536 3 10 15 3 13.536 13.536 3 ' /></IndexedFaceSet>",
+           "<IndexedFaceSet  convex='false' coordIndex='0 1 2 3 4 5 6 7'><GeoCoordinate geoSystem='\"GD\" \"WE\" \"longitude_first\"' point='15 10 3 13.536 6.464 3 10 5 3 6.464 6.464 3 5 10 3 6.464 13.536 3 10 15 3 13.536 13.536 3 ' /></IndexedFaceSet>",
            NULL, 3, 2);
                
        /* geocoordinate lat long*/
        do_x3d3_test(
            "SRID=4326;POLYGON((15 10 3,13.536 6.464 3,10 5 3,6.464 6.464 3,5 10 3,6.464 13.536 3,10 15 3,13.536 13.536 3,15 10 3))",
-           "<IndexedFaceSet  coordIndex='0 1 2 3 4 5 6 7'><GeoCoordinate geoSystem='\"GD\" \"WE\" \"latitude_first\"' point='10 15 3 6.464 13.536 3 5 10 3 6.464 6.464 3 10 5 3 13.536 6.464 3 15 10 3 13.536 13.536 3 ' /></IndexedFaceSet>",
+           "<IndexedFaceSet  convex='false' coordIndex='0 1 2 3 4 5 6 7'><GeoCoordinate geoSystem='\"GD\" \"WE\" \"latitude_first\"' point='10 15 3 6.464 13.536 3 5 10 3 6.464 6.464 3 10 5 3 13.536 6.464 3 15 10 3 13.536 13.536 3 ' /></IndexedFaceSet>",
            NULL, 3, 3);
 
 
index 6e603209cbef3147795dca4fdc4745d6d8e926c8..b9735a78f19dcf6723cdd9168032e0085e6c4681 100644 (file)
@@ -1,8 +1,7 @@
-/**********************************************************************
+**********************************************************************
  *
  * PostGIS - Spatial Types for PostgreSQL
  * http://postgis.net
- *
  * PostGIS is free software: you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation, either version 2 of the License, or
@@ -18,7 +17,7 @@
  *
  **********************************************************************
  *
- * Copyright 2011-2015 Arrival 3D
+ * Copyright 2011-2016 Arrival 3D, Regina Obe
  *
  **********************************************************************/
 
@@ -457,7 +456,7 @@ asx3d3_multi_buf(const LWCOLLECTION *col, char *srs, char *output, int precision
             break;
         case MULTIPOLYGONTYPE:
             x3dtype = "IndexedFaceSet";
-            ptr += sprintf(ptr, "<%s %s coordIndex='", x3dtype, defid);
+            ptr += sprintf(ptr, "<%s %s convex='false' coordIndex='", x3dtype, defid);
             ptr += asx3d3_mpoly_coordindex((const LWMPOLY *)col, ptr);
             ptr += sprintf(ptr, "'>");
             break;
@@ -523,8 +522,8 @@ asx3d3_psurface_size(const LWPSURFACE *psur, char *srs, int precision, int opts,
        size_t size;
        size_t defidlen = strlen(defid);
 
-       if ( X3D_USE_GEOCOORDS(opts) ) size = sizeof("<IndexedFaceSet coordIndex=''><GeoCoordinate geoSystem='\"GD\" \"WE\" \"longitude_first\"' point='' />") + defidlen;
-       else size = sizeof("<IndexedFaceSet coordIndex=''><Coordinate point='' />") + defidlen;
+       if ( X3D_USE_GEOCOORDS(opts) ) size = sizeof("<IndexedFaceSet convex='false' coordIndex=''><GeoCoordinate geoSystem='\"GD\" \"WE\" \"longitude_first\"' point='' />") + defidlen;
+       else size = sizeof("<IndexedFaceSet convex='false' coordIndex=''><Coordinate point='' />") + defidlen;
        
 
        for (i=0; i<psur->ngeoms; i++)
@@ -552,7 +551,7 @@ asx3d3_psurface_buf(const LWPSURFACE *psur, char *srs, char *output, int precisi
        ptr = output;
 
        /* Open outmost tag */
-       ptr += sprintf(ptr, "<IndexedFaceSet %s coordIndex='",defid);
+       ptr += sprintf(ptr, "<IndexedFaceSet convex='false' %s coordIndex='",defid);
 
        j = 0;
        for (i=0; i<psur->ngeoms; i++)