[GRASS-SVN] r56219 - grass/trunk/vector/v.extrude

svn_grass at osgeo.org svn_grass at osgeo.org
Sun May 12 07:18:44 PDT 2013


Author: martinl
Date: 2013-05-12 07:18:44 -0700 (Sun, 12 May 2013)
New Revision: 56219

Modified:
   grass/trunk/vector/v.extrude/extrude.c
   grass/trunk/vector/v.extrude/main.c
   grass/trunk/vector/v.extrude/v.extrude.html
Log:
v.extrude: support only points, lines, and areas
           update manual


Modified: grass/trunk/vector/v.extrude/extrude.c
===================================================================
--- grass/trunk/vector/v.extrude/extrude.c	2013-05-12 13:42:06 UTC (rev 56218)
+++ grass/trunk/vector/v.extrude/extrude.c	2013-05-12 14:18:44 UTC (rev 56219)
@@ -9,8 +9,8 @@
   \brief Extrude 2D vector feature to 3D
 
   - point -> 3d line (vertical)
-  - boundary -> faces
-  - area -> faces + kernel
+  - line  -> set of faces (each segment defines one face)
+  - area  -> set of faces + kernel
 
   \param In input vector map
   \param[in,out] Out output vector map
@@ -42,7 +42,7 @@
     nlines = 0;
 
     if (type != GV_POINT && Points->n_points < 2)
-	return nlines;
+	return nlines; /* not enough points to face */
 
     if (!Points_wall) {
         Points_wall  = Vect_new_line_struct();
@@ -77,7 +77,6 @@
 	}
     }
 
-    
     /* build walls, roof and floor */
     for (k = 0; ; k++) {
 	voffset_curr = voffset_next = 0.0;
@@ -104,7 +103,7 @@
 		if (k >= Points->n_points - 1)
 		    break;
 	    }
-	    else if (type & (GV_BOUNDARY | GV_AREA)) {
+	    else if (type == GV_AREA) {
 		if (k >= Points->n_points - 2)
 		    break;
 	    }
@@ -128,14 +127,8 @@
 			      Points->z[k] + objheight + voffset_curr);
 	    break;
 	}
-	else if (type == GV_LINE) {
-	    /* line -> 3d line (currently disabled) */
-	    Vect_append_point(Points_wall, Points->x[k], Points->y[k],
-			      Points->z[k] + objheight + voffset_curr);
-	    if (k >= Points->n_points - 1)
-		break;
-	}
-	else if (type & (GV_BOUNDARY | GV_AREA)) {
+	
+        if (type & (GV_LINE | GV_AREA)) {
 	    /* reset */
 	    Vect_reset_line(Points_wall);
 
@@ -168,11 +161,12 @@
 	}
     }
 
-    if (type & (GV_POINT | GV_LINE)) {
+    if (type == GV_POINT) {
 	Vect_write_line(Out, GV_LINE, Points_wall, Cats);
-	nlines++;
+	return 1;
     }
-    else if (type == GV_AREA && Points_roof->n_points > 3) {
+
+    if (type == GV_AREA && Points_roof->n_points > 3) {
         /* close roof and floor */
 	Vect_append_point(Points_roof,
 			  Points_roof->x[0], Points_roof->y[0],

Modified: grass/trunk/vector/v.extrude/main.c
===================================================================
--- grass/trunk/vector/v.extrude/main.c	2013-05-12 13:42:06 UTC (rev 56218)
+++ grass/trunk/vector/v.extrude/main.c	2013-05-12 14:18:44 UTC (rev 56219)
@@ -54,8 +54,7 @@
     
     int field;
     int only_type, cat;
-    int fdrast, interp_method;
-    int process_area, trace;
+    int fdrast, interp_method, trace;
     double objheight, objheight_default, voffset;
     
     struct field_info *Fi;
@@ -87,8 +86,8 @@
     opt.where->guisection = _("Selection");
 
     opt.type = G_define_standard_option(G_OPT_V_TYPE);
-    opt.type->answer = "point,boundary,area";
-    opt.type->options = "point,boundary,area";
+    opt.type->answer = "point,line,area";
+    opt.type->options = "point,line,area";
     opt.type->guisection = _("Selection");
 
     opt.output = G_define_standard_option(G_OPT_V_OUTPUT);
@@ -149,15 +148,7 @@
     interp_method = Rast_option_to_interp_type(opt.interp);
 
     trace = (flag.trace->answer) ? TRUE : FALSE;
-    process_area = (only_type & GV_AREA) ? TRUE : FALSE;
-    if (process_area) {
-	if (only_type & GV_BOUNDARY) {
-	    /* do not write wall twice -> disable boundary type */
-	    only_type &= ~GV_BOUNDARY;
-	}
-	only_type &= ~GV_AREA;
-    }
-
+    
     /* set input vector map name and mapset */
     Vect_check_input_output_name(opt.input->answer, opt.output->answer, G_FATAL_EXIT);
 
@@ -232,7 +223,7 @@
     }
 
     /* if area */
-    if (process_area) {
+    if (only_type & GV_AREA) {
         int area, nareas, centroid;
         
         nareas = Vect_get_num_areas(&In);

Modified: grass/trunk/vector/v.extrude/v.extrude.html
===================================================================
--- grass/trunk/vector/v.extrude/v.extrude.html	2013-05-12 13:42:06 UTC (rev 56218)
+++ grass/trunk/vector/v.extrude/v.extrude.html	2013-05-12 14:18:44 UTC (rev 56219)
@@ -1,29 +1,33 @@
 <h2>DESCRIPTION</h2>
 
-<em>v.extrude</em> creates faces, kernels or 3D lines based on 2D
-vector features. Points are converted to 3D vertical lines, boundaries
-to faces and areas to volumes (composition of faces and kernel).
+<em>v.extrude</em> creates faces, kernels or 3D lines based on input
+2D vector features. Points are converted to 3D vertical lines, lines
+to faces and areas to volumes (composition of closed set of faces and
+kernel).
 
 <p>
-If the flag <b>-t</b> and <b>elevation</b> parameter is used then 3D
-vector features follow the elevation model by using individual
-elevation values for the vertices and nodes. Height is interpolated
-from elevation model using given interpolation <b>method</b>. This can
-be useful for models of large objects (eg. forest stands).
+If <b>elevation</b> parameter is used then 3D vector features follow
+the elevation model by using individual elevation values for the
+vertices. Height for vertices is interpolated from elevation raster
+map using given interpolation <b>method</b>.
 
 <h2>NOTES</h2>
 
 <em>v.extrude</em> extrudes vector features which means that points
-are converted to vertical lines. Lines are not supported by this
-module.
+are converted to vertical lines. Lines and area boundaries are
+extruded to a set of faces, each segment defines one face. Area
+centroids are written as kernels. Area as a composition of boundaries
+and centroid is stored as a closed set of faces and kernel which
+define a volume.
 
 <p>
 For conversion of 2D points or lines to 3D can be also
-used <em><a href="v.to.3d.html">v.to.3d</a></em>. In opposite
+used <em><a href="v.to.3d.html">v.to.3d</a></em> module. In opposite
 to <em>v.extrude</em>, <em><a href="v.to.3d.html">v.to.3d</a></em>
-doesn't extrude vector features, it just defines z-coordinate for the
-feature geometry. It means that no feature type conversion is applied,
-points remains still points. Same applies for the lines.
+doesn't extrude vector features, it just defines z-coordinate in the
+features geometry. It means that no feature type conversion is
+applied, points remain still points in the output vector map. Same
+applies for the lines.
 
 <p>
 <em>v.extrude</em> modifies only features geometry, attribute data



More information about the grass-commit mailing list