浏览代码

-b flag added to avoid vector topology

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@36565 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Neteler 16 年之前
父节点
当前提交
45a117462f
共有 4 个文件被更改,包括 22 次插入6 次删除
  1. 1 0
      raster/r.random/local_proto.h
  2. 7 1
      raster/r.random/main.c
  3. 12 4
      raster/r.random/r.random.html
  4. 2 1
      raster/r.random/random.c

+ 1 - 0
raster/r.random/local_proto.h

@@ -29,6 +29,7 @@ struct rr_state
     struct RASTER_MAP_PTR nulls, cnulls, buf, cover, min, max, cmin, cmax;
     struct RASTER_MAP_PTR nulls, cnulls, buf, cover, min, max, cmin, cmax;
     FILE *fsites;
     FILE *fsites;
     int z_geometry;
     int z_geometry;
+    int notopol;
 };
 };
 
 
 
 

+ 7 - 1
raster/r.random/main.c

@@ -42,7 +42,7 @@ int main(int argc, char *argv[])
     } parm;
     } parm;
     struct
     struct
     {
     {
-	struct Flag *zero, *info, *z_geometry;
+	struct Flag *zero, *info, *z_geometry, *notopol_flag;
     } flag;
     } flag;
 
 
     G_gisinit(argv[0]);
     G_gisinit(argv[0]);
@@ -89,6 +89,11 @@ int main(int argc, char *argv[])
     flag.z_geometry->key = 'd';
     flag.z_geometry->key = 'd';
     flag.z_geometry->description = _("Generate vector points as 3D points");
     flag.z_geometry->description = _("Generate vector points as 3D points");
 
 
+    flag.notopol_flag = G_define_flag();
+    flag.notopol_flag->key = 'b';
+    flag.notopol_flag->description = _("Do not build topology in points mode");
+    flag.notopol_flag->guisection = _("Points");
+
     if (G_parser(argc, argv) != 0)
     if (G_parser(argc, argv) != 0)
 	exit(EXIT_FAILURE);
 	exit(EXIT_FAILURE);
 
 
@@ -106,6 +111,7 @@ int main(int argc, char *argv[])
     myState.outraster = parm.raster->answer;
     myState.outraster = parm.raster->answer;
     myState.outvector = parm.sites->answer;
     myState.outvector = parm.sites->answer;
     myState.z_geometry = flag.z_geometry->answer;
     myState.z_geometry = flag.z_geometry->answer;
+    myState.notopol = flag.notopol_flag->answer;
 
 
     /* If they only want info we ignore the rest */
     /* If they only want info we ignore the rest */
     get_stats(&myState);
     get_stats(&myState);

+ 12 - 4
raster/r.random/r.random.html

@@ -6,7 +6,7 @@ coordinates of points whose locations have been randomly
 determined.  The program locates these randomly generated
 determined.  The program locates these randomly generated
 vector points (sites) within the current geographic region and mask (if
 vector points (sites) within the current geographic region and mask (if
 any), on non-NULL category value data areas within a
 any), on non-NULL category value data areas within a
-user-specified raster map layer.  If the user sets the
+user-specified raster map layer. If the user sets the
 <b>-z</b> flag, points will be randomly generated across all
 <b>-z</b> flag, points will be randomly generated across all
 cells (even those with NULL values).
 cells (even those with NULL values).
 
 
@@ -37,6 +37,11 @@ column  <em>covervalue</em> is populated with raster values from
 the <em>cover</em> map.
 the <em>cover</em> map.
 
 
 <p>
 <p>
+If the user sets the <b>-b</b> flag, vector points are written without
+topology to minimize the required resources. This is suitable input
+to <em>v.surf.rst</em> and other vector modules.
+
+<p>
 The user may specify the quantity of random locations to be
 The user may specify the quantity of random locations to be
 generated either as a <em>positive integer</em> (e.g., 10),
 generated either as a <em>positive integer</em> (e.g., 10),
 or as a <em>percentage of the raster map layer's cells</em> 
 or as a <em>percentage of the raster map layer's cells</em> 
@@ -108,9 +113,12 @@ parameter.
 
 
 <h2>SEE ALSO</h2>
 <h2>SEE ALSO</h2>
 
 
-<em><a href="g.region.html">g.region</a></em><br>
-<em><a href="r.reclass.html">r.reclass</a></em><br>
-<em><a href="v.random.html">v.random</a></em><br>
+<em>
+<a href="g.region.html">g.region</a><br>
+<a href="r.reclass.html">r.reclass</a><br>
+<a href="v.random.html">v.random</a><br>
+<a href="v.surf.rst.html">v.surf.rst</a>
+</em>
 
 
 
 
 <h2>AUTHOR</h2>
 <h2>AUTHOR</h2>

+ 2 - 1
raster/r.random/random.c

@@ -252,7 +252,8 @@ int execute_random(struct rr_state *theState)
     if (theState->outvector) {
     if (theState->outvector) {
 	db_commit_transaction(driver);
 	db_commit_transaction(driver);
 	db_close_database_shutdown_driver(driver);
 	db_close_database_shutdown_driver(driver);
-	Vect_build(&Out);
+	if (theState->notopol != 1)
+	    Vect_build(&Out);
 	Vect_close(&Out);
 	Vect_close(&Out);
     }
     }
     if (theState->outraster)
     if (theState->outraster)