[postgis-tickets] r14757 - Use Tomvantilburg suggestion and just hard-code convex='false' for all IndexedFaceSets.
Regina Obe
lr at pcorp.us
Sat Mar 5 16:43:08 PST 2016
Author: robe
Date: 2016-03-05 16:43:07 -0800 (Sat, 05 Mar 2016)
New Revision: 14757
Modified:
trunk/liblwgeom/cunit/cu_out_x3d.c
trunk/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
Closes #3435 for PostGIS 2.3 (trunk).
Update Copyright info
Modified: trunk/liblwgeom/cunit/cu_out_x3d.c
===================================================================
--- trunk/liblwgeom/cunit/cu_out_x3d.c 2016-03-06 00:32:59 UTC (rev 14756)
+++ trunk/liblwgeom/cunit/cu_out_x3d.c 2016-03-06 00:43:07 UTC (rev 14757)
@@ -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 @@
/* 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: trunk/liblwgeom/lwout_x3d.c
===================================================================
--- trunk/liblwgeom/lwout_x3d.c 2016-03-06 00:32:59 UTC (rev 14756)
+++ trunk/liblwgeom/lwout_x3d.c 2016-03-06 00:43:07 UTC (rev 14757)
@@ -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 @@
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 @@
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 @@
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