[QGIS Commit] r14510 - branches/raster-providers/src/providers/grass

svn_qgis at osgeo.org svn_qgis at osgeo.org
Fri Nov 5 03:26:04 EDT 2010


Author: rblazek
Date: 2010-11-05 00:26:04 -0700 (Fri, 05 Nov 2010)
New Revision: 14510

Modified:
   branches/raster-providers/src/providers/grass/qgis.g.info.c
Log:
raster providers initial work, basic support for passing data for rendering from providers to raster layer

Modified: branches/raster-providers/src/providers/grass/qgis.g.info.c
===================================================================
--- branches/raster-providers/src/providers/grass/qgis.g.info.c	2010-11-05 07:18:07 UTC (rev 14509)
+++ branches/raster-providers/src/providers/grass/qgis.g.info.c	2010-11-05 07:26:04 UTC (rev 14510)
@@ -34,7 +34,7 @@
   info_opt->key = "info";
   info_opt->type = TYPE_STRING;
   info_opt->description = "info key";
-  info_opt->options = "proj,window,query";
+  info_opt->options = "proj,window,size,query,info";
 
   rast_opt = G_define_standard_option( G_OPT_R_INPUT );
   rast_opt->key = "rast";
@@ -79,6 +79,34 @@
       G_fatal_error( "Not yet supported" );
     }
   }
+  // raster width and height
+  else if ( strcmp( "size", info_opt->answer ) == 0 )
+  {
+    if ( rast_opt->answer )
+    {
+      G_get_cellhd( rast_opt->answer, "", &window );
+      fprintf( stdout, "%d,%d", window.cols, window.rows );
+    }
+    else if ( vect_opt->answer )
+    {
+      G_fatal_error( "Not yet supported" );
+    }
+  }
+  // raster informations
+  else if ( strcmp( "info", info_opt->answer ) == 0 )
+  {
+      //struct Range crange;
+      struct FPRange range;
+      double zmin, zmax;
+      RASTER_MAP_TYPE raster_type = G_raster_map_type ( rast_opt->answer, "" );
+      fprintf( stdout, "TYPE:%d\n", raster_type );
+      if (G_read_fp_range( rast_opt->answer, "", &range) < 0) {
+        G_fatal_error(("Unable to read range file"));
+      }
+      G_get_fp_range_min_max(&range, &zmin, &zmax);
+      fprintf( stdout, "MIN_VALUE:%f\n", zmin );
+      fprintf( stdout, "MAX_VALUE:%f\n", zmax );
+  }
   else if ( strcmp( "query", info_opt->answer ) == 0 )
   {
     double x, y;



More information about the QGIS-commit mailing list