فهرست منبع

v.out.ogr: Forcing use of OGR_G_AddPoint_2D when map is not 3D (attempt to fix https://trac.osgeo.org/grass/ticket/2300 "")

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@67451 15284696-431f-4ddb-bdfa-cd5b030d7da7
Moritz Lennert 9 سال پیش
والد
کامیت
ab98f5030e
2فایلهای تغییر یافته به همراه20 افزوده شده و 8 حذف شده
  1. 12 4
      vector/v.out.ogr/export_areas.c
  2. 8 4
      vector/v.out.ogr/export_lines.c

+ 12 - 4
vector/v.out.ogr/export_areas.c

@@ -298,8 +298,12 @@ OGRGeometryH create_polygon(struct Map_info *In, int area,
     
     /* Area */
     for (j = 0; j < Points->n_points; j++) {
-        OGR_G_AddPoint(ring, Points->x[j], Points->y[j],
-                       Points->z[j]);
+	if (Vect_is_3d(In))
+	        OGR_G_AddPoint(ring, Points->x[j], Points->y[j],
+        	               Points->z[j]);
+	else
+	        OGR_G_AddPoint_2D(ring, Points->x[j], Points->y[j]);
+        	               
     }
     
     OGR_G_AddGeometryDirectly(Ogr_geometry, ring);
@@ -311,8 +315,12 @@ OGRGeometryH create_polygon(struct Map_info *In, int area,
         
         ring = OGR_G_CreateGeometry(wkbLinearRing);
         for (j = 0; j < Points->n_points; j++) {
-            OGR_G_AddPoint(ring, Points->x[j], Points->y[j],
-                           Points->z[j]);
+	    if(Vect_is_3d(In))
+	            OGR_G_AddPoint(ring, Points->x[j], Points->y[j],
+	                           Points->z[j]);
+	    else
+	            OGR_G_AddPoint_2D(ring, Points->x[j], Points->y[j]);
+
         }
         OGR_G_AddGeometryDirectly(Ogr_geometry, ring);
     }

+ 8 - 4
vector/v.out.ogr/export_lines.c

@@ -94,13 +94,17 @@ int export_lines_single(struct Map_info *In, int field, int otype, int donocat,
             Ogr_geometry = OGR_G_CreateGeometry(get_wkbtype(type, otype));
             if (OGR_G_GetGeometryType(Ogr_geometry) == wkbPoint) {
                 /* GV_POINTS -> wkbPoint */
-                OGR_G_AddPoint(Ogr_geometry, Points->x[0], Points->y[0],
-                               Points->z[0]);
+		if (Vect_is_3d(In))
+	                OGR_G_AddPoint(Ogr_geometry, Points->x[0], Points->y[0],
+        	                       Points->z[0]);
+		else OGR_G_AddPoint_2D(Ogr_geometry, Points->x[0], Points->y[0]);
             }
             else { /* GV_LINES -> wkbLinestring */
                 for (j = 0; j < Points->n_points; j++) {
-                    OGR_G_AddPoint(Ogr_geometry, Points->x[j], Points->y[j],
-                                   Points->z[j]);
+		if (Vect_is_3d(In))
+	                OGR_G_AddPoint(Ogr_geometry, Points->x[j], Points->y[j],
+        	                       Points->z[j]);
+		else OGR_G_AddPoint_2D(Ogr_geometry, Points->x[j], Points->y[j]);
                 }
             }
         }