Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

modules: Always use current major version in VTK outputs (r.out.vtk, r3.out.vtk, v.out.vtk) #2343

Merged
merged 4 commits into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions raster/r.out.vtk/writeascii.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ void write_vtk_normal_header(FILE *fp, struct Cell_head region,

/*Simple vtk ASCII header */
fprintf(fp, "# vtk DataFile Version 3.0\n");
fprintf(fp, "GRASS GIS 7 Export\n");
/* The header line describes the data. */
fprintf(fp, "GRASS GIS %i Export\n", GRASS_VERSION_MAJOR);
fprintf(fp, "ASCII\n");
fprintf(fp, "DATASET STRUCTURED_POINTS\n"); /*We are using the structured
point dataset. */
Expand Down Expand Up @@ -104,7 +105,7 @@ void write_vtk_structured_elevation_header(FILE *fp, struct Cell_head region)

/*Simple vtk ASCII header */
fprintf(fp, "# vtk DataFile Version 3.0\n");
fprintf(fp, "GRASS GIS 7 Export\n");
fprintf(fp, "GRASS GIS %i Export\n", GRASS_VERSION_MAJOR);
fprintf(fp, "ASCII\n");
fprintf(fp, "DATASET STRUCTURED_GRID\n"); /*We are using the structured grid
dataset. */
Expand All @@ -122,7 +123,7 @@ void write_vtk_polygonal_elevation_header(FILE *fp, struct Cell_head region)

/*Simple vtk ASCII header */
fprintf(fp, "# vtk DataFile Version 3.0\n");
fprintf(fp, "GRASS GIS 7 Export\n");
fprintf(fp, "GRASS GIS %i Export\n", GRASS_VERSION_MAJOR);
fprintf(fp, "ASCII\n");
fprintf(fp, "DATASET POLYDATA\n"); /*We are using polydataset. */
fprintf(fp, "POINTS %i float\n", region.cols * region.rows);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@ r3.mapcalc --o expr="volume_rgb = volume_null * 5"
# The first @test just exports the volume map as cell and point data
# using alow precision and replaces the default null value with 0
# the created @files should be compared with the reference data.
r3.out.vtk --o input=volume_null output=test_volume_null_1_cells.vtk dp=3 null=0
r3.out.vtk -p --o input=volume_null output=test_volume_null_1_points.vtk dp=3 null=0
r3.out.vtk --o input=volume_null output=test_volume_null_1_cells.vtk precision=3 null=0
r3.out.vtk -p --o input=volume_null output=test_volume_null_1_points.vtk precision=3 null=0

# The second @test adds rgb and vector maps. We re-use the created volume map
# for vector creation. The rgb value must range fom 0 - 255. The generated @files
# should be compared with the reference data.
r3.out.vtk --o rgbmaps=volume_rgb,volume_rgb,volume_rgb vectormaps=volume_null,volume_null,volume_null input=volume_null output=test_volume_null_1_cells_rgb_vect.vtk dp=3 null=-1.0
r3.out.vtk -p --o rgbmaps=volume_rgb,volume_rgb,volume_rgb vectormaps=volume_null,volume_null,volume_null input=volume_null output=test_volume_null_1_points_rgb_vect.vtk dp=3 null=-1.0
r3.out.vtk --o rgbmaps=volume_rgb,volume_rgb,volume_rgb vectormaps=volume_null,volume_null,volume_null input=volume_null output=test_volume_null_1_cells_rgb_vect.vtk precision=3 null=-1.0
r3.out.vtk -p --o rgbmaps=volume_rgb,volume_rgb,volume_rgb vectormaps=volume_null,volume_null,volume_null input=volume_null output=test_volume_null_1_points_rgb_vect.vtk precision=3 null=-1.0

# The third @test uses raster maps to create volume data with an elevation surface
# The maximum elevation should be in the south. Reference @files are present for validation.
r3.out.vtk -s --o top=elev_top bottom=elev_bottom input=volume_null output=test_volume_null_1_cells_elevation.vtk dp=3 null=0
r3.out.vtk -sp --o top=elev_top bottom=elev_bottom input=volume_null output=test_volume_null_1_points_elevation.vtk dp=3 null=0
r3.out.vtk -s --o top=elev_top bottom=elev_bottom input=volume_null output=test_volume_null_1_cells_elevation.vtk precision=3 null=0
r3.out.vtk -sp --o top=elev_top bottom=elev_bottom input=volume_null output=test_volume_null_1_points_elevation.vtk precision=3 null=0

# Comparison of references and vtk files
for i in `ls *.ref` ; do
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# vtk DataFile Version 3.0
GRASS GIS 7 Export
GRASS GIS 8 Export
ASCII
DATASET STRUCTURED_POINTS
DIMENSIONS 13 9 6
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# vtk DataFile Version 3.0
GRASS GIS 7 Export
GRASS GIS 8 Export
ASCII
DATASET UNSTRUCTURED_GRID
POINTS 3840 float
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# vtk DataFile Version 3.0
GRASS GIS 7 Export
GRASS GIS 8 Export
ASCII
DATASET STRUCTURED_POINTS
DIMENSIONS 13 9 6
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# vtk DataFile Version 3.0
GRASS GIS 7 Export
GRASS GIS 8 Export
ASCII
DATASET STRUCTURED_POINTS
DIMENSIONS 12 8 5
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# vtk DataFile Version 3.0
GRASS GIS 7 Export
GRASS GIS 8 Export
ASCII
DATASET STRUCTURED_GRID
DIMENSIONS 12 8 5
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# vtk DataFile Version 3.0
GRASS GIS 7 Export
GRASS GIS 8 Export
ASCII
DATASET STRUCTURED_POINTS
DIMENSIONS 12 8 5
Expand Down
7 changes: 4 additions & 3 deletions raster3d/r3.out.vtk/writeVTKHead.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ void write_vtk_structured_point_header(FILE *fp, char *vtkFile UNUSED,
/*Simple vtk ASCII header */

fprintf(fp, "# vtk DataFile Version 3.0\n");
fprintf(fp, "GRASS GIS 7 Export\n");
/* The header line describes the data. */
fprintf(fp, "GRASS GIS %i Export\n", GRASS_VERSION_MAJOR);
fprintf(fp, "ASCII\n");
fprintf(fp, "DATASET STRUCTURED_POINTS\n"); /*We are using the structured
point dataset. */
Expand Down Expand Up @@ -100,7 +101,7 @@ void write_vtk_structured_grid_header(FILE *fp, char *vtkFile UNUSED,
3,
"write_vtk_structured_grid_header: Writing VTKStructuredGrid-Header");
fprintf(fp, "# vtk DataFile Version 3.0\n");
fprintf(fp, "GRASS GIS 7 Export\n");
fprintf(fp, "GRASS GIS %i Export\n", GRASS_VERSION_MAJOR);
fprintf(fp, "ASCII\n");
fprintf(fp, "DATASET STRUCTURED_GRID\n"); /*We are using the structured grid
dataset. */
Expand All @@ -122,7 +123,7 @@ void write_vtk_unstructured_grid_header(FILE *fp, char *vtkFile UNUSED,
G_debug(3, "write_vtk_unstructured_grid_header: Writing "
"VTKUnstructuredGrid-Header");
fprintf(fp, "# vtk DataFile Version 3.0\n");
fprintf(fp, "GRASS GIS 7 Export\n");
fprintf(fp, "GRASS GIS %i Export\n", GRASS_VERSION_MAJOR);
fprintf(fp, "ASCII\n");
fprintf(fp, "DATASET UNSTRUCTURED_GRID\n"); /*We are using the unstructured
grid dataset. */
Expand Down
4 changes: 3 additions & 1 deletion vector/v.out.vtk/head.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ int write_vtk_head(FILE *fp, struct Map_info *Map)
{
G_debug(3, _("writeVTKHeader: Writing VTK-Header"));
fprintf(fp, "# vtk DataFile Version 3.0\n");
fprintf(fp, "GRASS GIS 7 vector map: %s\n", Map->name);
/* The header line describes the data. */
fprintf(fp, "GRASS GIS %d vector map: %s\n", GRASS_VERSION_MAJOR,
Map->name);
fprintf(fp, "ASCII\n");
fprintf(fp, "DATASET POLYDATA\n"); /*We are using polydata. If Volume data
is supported, uGrid should be used */
Expand Down