[postgis-tickets] r14755 - Use Tomvantilburg suggestion and just hard-code convex='false' for all IndexedFaceSets.
Regina Obe
lr at pcorp.us
Sat Mar 5 16:30:01 PST 2016
Author: robe
Date: 2016-03-05 16:30:01 -0800 (Sat, 05 Mar 2016)
New Revision: 14755
Modified:
branches/2.2/liblwgeom/cunit/cu_out_x3d.c
branches/2.2/liblwgeom/lwout_x3d.c
Log:
Use Tomvantilburg suggestion and just hard-code convex='false' for all IndexedFaceSets.
Corrects the output of wrongly rendered without affecting true convex
References #3435 for PostGIS 2.2 (fix).
Modified: branches/2.2/liblwgeom/cunit/cu_out_x3d.c
===================================================================
--- branches/2.2/liblwgeom/cunit/cu_out_x3d.c 2016-03-05 20:53:46 UTC (rev 14754)
+++ branches/2.2/liblwgeom/cunit/cu_out_x3d.c 2016-03-06 00:30:01 UTC (rev 14755)
@@ -94,7 +94,7 @@
/* 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 @@
/* 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 @@
/* 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);
Modified: branches/2.2/liblwgeom/lwout_x3d.c
===================================================================
--- branches/2.2/liblwgeom/lwout_x3d.c 2016-03-05 20:53:46 UTC (rev 14754)
+++ branches/2.2/liblwgeom/lwout_x3d.c 2016-03-06 00:30:01 UTC (rev 14755)
@@ -445,7 +445,7 @@
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;
@@ -511,8 +511,8 @@
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++)
@@ -540,7 +540,7 @@
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++)
More information about the postgis-tickets
mailing list