浏览代码

Added a test case, reference data and a screenshot.

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@46741 15284696-431f-4ddb-bdfa-cd5b030d7da7
Soeren Gebbert 14 年之前
父节点
当前提交
c9f9744db6

+ 3 - 3
vector/v.to.rast3/main.c

@@ -121,12 +121,12 @@ int main(int argc, char *argv[])
 	if (cat < 0) {
 	if (cat < 0) {
 	    continue;
 	    continue;
 	}
 	}
-    /* Check if the coordinates are located in the cube */
+        /* Check if the coordinates are located in the cube */
 	if (!G3d_isValidLocation(&(map->region), Points->y[0], Points->x[0], Points->z[0])) {
 	if (!G3d_isValidLocation(&(map->region), Points->y[0], Points->x[0], Points->z[0])) {
 	    continue;
 	    continue;
 	}
 	}
-    /* Convert the north, east and top coorindate into row, col and depth*/
-    G3d_location2coord2(&(map->region), Points->y[0], Points->x[0], Points->z[0], &col, &row, &depth);
+        /* Convert the north, east and top coorindate into row, col and depth*/
+        G3d_location2coord2(&(map->region), Points->y[0], Points->x[0], Points->z[0], &col, &row, &depth);
 
 
 	if (ctype == DB_C_TYPE_INT) {
 	if (ctype == DB_C_TYPE_INT) {
 	    int ivalue;
 	    int ivalue;

+ 10 - 0
vector/v.to.rast3/random_points.txt

@@ -0,0 +1,10 @@
+19.17747394|31.55063415|39.15496119|1|39
+24.18719598|72.93178863|9.87756846|2|10
+79.77326931|61.45836758|13.88873554|3|14
+53.5236053|38.19176415|31.44354624|4|31
+76.22586326|41.07207282|47.61148626|5|48
+10.05659184|50.85693824|35.86484647|6|36
+103.00769336|48.5575101|0.81502858|7|1
+90.85358752|10.97852614|40.20883771|8|40
+101.19850929|32.07555154|6.48952234|9|6
+106.94294376|79.91396144|10.91284527|10|11

+ 23 - 0
vector/v.to.rast3/test.v.to.rast3.sh

@@ -0,0 +1,23 @@
+# Test the conversion of vector points into cell values
+# of raster3d maps.
+
+# We set up a specific region in the
+# @preprocess step of this test. The region setting 
+# should work for UTM and LL test locations
+g.region s=0 n=80 w=0 e=120 b=0 t=50 res=10 res3=10 -p3
+# We import vector data located in the source directory
+# The data was created using v.random with seed option:
+# v.random --o -z seed=1 n=10 output=random_points column=value zmin=0 zmax=50 column_type=integer
+# v.out.ascii input=random_points output=random_points.txt columns=value
+# I don't know if the random generator always creates the same pseudo random number with seed 1
+# on any supported operation system with a C standard library
+v.in.ascii input=random_points.txt columns='x double precision, y double precision, z double precision, key int, value int' x=1 y=2 z=3 output=random_points --o
+
+# After data creation we @test the vector to @raster3d map conversion
+# As @prescision=0 is used for data export.
+v.to.rast3 --o input=random_points column=value output=vector_to_volume
+
+# Some data export commands for reference data creation and visual validation
+# r3.out.ascii --o input=vector_to_volume output=vector_to_volume.ref dp=0 null=*
+# r3.out.vtk input=vector_to_volume output=vector_to_volume.vtk null=0
+# v.out.vtk input=random_points output=random_points.vtk

+ 13 - 3
vector/v.to.rast3/v.to.rast3.html

@@ -1,7 +1,6 @@
 <H2>DESCRIPTION</H2>
 <H2>DESCRIPTION</H2>
 
 
-<EM>v.to.rast3</EM> converts a GRASS 3D vector point map to a GRASS 3dgrid raster3d
- (voxel) map.
+<EM>v.to.rast3</EM> converts a GRASS 3D vector point map to a GRASS raster3d map.
 
 
 <H2>NOTES</H2>
 <H2>NOTES</H2>
 
 
@@ -10,11 +9,22 @@ a vector point is converted into a single 3d cell
 representing the location of the vector point. As 3d cell value the database 
 representing the location of the vector point. As 3d cell value the database 
 attribute of the vector point is stored as float.
 attribute of the vector point is stored as float.
 
 
+
+<center>
+<img src=v.to.rast3.test.png border=0><BR>
+<table border=0 width=600>
+<tr><td><center>
+<i>This screenshot shows the result of the v.to.rast3 test. Visualized are the cube of the
+grass region, the vector points as black dots and the voxel cells as wireframe model. Only cells with
+non-null values are shown.</i>
+</center></td></tr>
+</table>
+</center>
+
 <H2>SEE ALSO</H2>
 <H2>SEE ALSO</H2>
 
 
 <EM><A HREF="g.region.html">g.region</A></EM>
 <EM><A HREF="g.region.html">g.region</A></EM>
 
 
-
 <H2>AUTHOR</H2>
 <H2>AUTHOR</H2>
 
 
 Original s.to.rast3: Jaro Hofierka, Geomodel s.r.o.<br>
 Original s.to.rast3: Jaro Hofierka, Geomodel s.r.o.<br>

二进制
vector/v.to.rast3/v.to.rast3.test.png


+ 51 - 0
vector/v.to.rast3/vector_to_volume.ref

@@ -0,0 +1,51 @@
+version: grass7
+order: nsbt
+north: 80.000000
+south: 0.000000
+east: 120.000000
+west: 0.000000
+top: 50.000000
+bottom: 0.000000
+rows: 8
+cols: 12
+levels: 5
+* * 10 * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * 1 * 
+* * * * * * * * * * 6 * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * 11 * 
+* * * * * * * 14 * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* 36 * * * * * * * * * * 
+* * * * * * * * * * * * 
+* 39 * * * 31 * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * 48 * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * * * * 
+* * * * * * * * * 40 * * 
+* * * * * * * * * * * *