[GRASS-SVN] r38429 - in grass/trunk: include lib/raster
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jul 15 16:42:46 EDT 2009
Author: glynn
Date: 2009-07-15 16:42:46 -0400 (Wed, 15 Jul 2009)
New Revision: 38429
Modified:
grass/trunk/include/rasterdefs.h
grass/trunk/lib/raster/auto_mask.c
grass/trunk/lib/raster/gdal.c
grass/trunk/lib/raster/init.c
grass/trunk/lib/raster/opencell.c
grass/trunk/lib/raster/set_window.c
grass/trunk/lib/raster/window_map.c
Log:
Initialize raster library automatically
Modified: grass/trunk/include/rasterdefs.h
===================================================================
--- grass/trunk/include/rasterdefs.h 2009-07-15 15:09:04 UTC (rev 38428)
+++ grass/trunk/include/rasterdefs.h 2009-07-15 20:42:46 UTC (rev 38429)
@@ -343,6 +343,7 @@
void Rast_init(void);
void Rast__check_init(void);
void Rast_init_all(void);
+void Rast__init(void);
/* interp.c */
DCELL Rast_interp_linear(double, DCELL, DCELL);
Modified: grass/trunk/lib/raster/auto_mask.c
===================================================================
--- grass/trunk/lib/raster/auto_mask.c 2009-07-15 15:09:04 UTC (rev 38428)
+++ grass/trunk/lib/raster/auto_mask.c 2009-07-15 20:42:46 UTC (rev 38429)
@@ -38,6 +38,8 @@
{
struct Cell_head cellhd;
+ Rast__init();
+
/* if mask is switched off (-2) return -2
if R__.auto_mask is not set (-1) or set (>=0) recheck the MASK */
@@ -84,6 +86,8 @@
void Rast_suppress_masking(void)
{
+ Rast__init();
+
if (R__.auto_mask > 0) {
Rast_close(R__.mask_fd);
/* G_free (R__.mask_buf); */
@@ -101,6 +105,8 @@
void Rast_unsuppress_masking(void)
{
+ Rast__init();
+
if (R__.auto_mask < -1) {
R__.mask_fd = -1;
Rast__check_for_auto_masking();
Modified: grass/trunk/lib/raster/gdal.c
===================================================================
--- grass/trunk/lib/raster/gdal.c 2009-07-15 15:09:04 UTC (rev 38428)
+++ grass/trunk/lib/raster/gdal.c 2009-07-15 20:42:46 UTC (rev 38429)
@@ -355,6 +355,7 @@
struct Key_Value *key_val;
char buf[32];
+ Rast__init();
Rast_init_gdal();
Modified: grass/trunk/lib/raster/init.c
===================================================================
--- grass/trunk/lib/raster/init.c 2009-07-15 15:09:04 UTC (rev 38428)
+++ grass/trunk/lib/raster/init.c 2009-07-15 20:42:46 UTC (rev 38429)
@@ -44,10 +44,7 @@
void Rast_init(void)
{
- if (initialized)
- return;
-
- init();
+ Rast__init();
}
@@ -66,6 +63,14 @@
}
+void Rast__init(void)
+{
+ if (G_is_initialized(&initialized))
+ return;
+ init();
+ G_initialize_done(&initialized);
+}
+
static int init(void)
{
/* no histograms */
@@ -87,6 +92,7 @@
void Rast_init_all(void)
{
+ Rast__init();
Rast__check_for_auto_masking();
Rast_init_gdal();
}
Modified: grass/trunk/lib/raster/opencell.c
===================================================================
--- grass/trunk/lib/raster/opencell.c 2009-07-15 15:09:04 UTC (rev 38428)
+++ grass/trunk/lib/raster/opencell.c 2009-07-15 20:42:46 UTC (rev 38429)
@@ -168,6 +168,8 @@
char xname[GNAME_MAX], xmapset[GMAPSET_MAX];
struct GDAL_link *gdal;
+ Rast__init();
+
/* make sure window is set */
Rast__init_window();
@@ -564,6 +566,8 @@
const char *cell_dir;
int nbytes;
+ Rast__init();
+
switch (map_type) {
case CELL_TYPE:
cell_dir = "cell";
@@ -729,6 +733,8 @@
*/
int Rast_set_fp_type(RASTER_MAP_TYPE map_type)
{
+ Rast__init();
+
switch (map_type) {
case FCELL_TYPE:
case DCELL_TYPE:
Modified: grass/trunk/lib/raster/set_window.c
===================================================================
--- grass/trunk/lib/raster/set_window.c 2009-07-15 15:09:04 UTC (rev 38428)
+++ grass/trunk/lib/raster/set_window.c 2009-07-15 20:42:46 UTC (rev 38429)
@@ -33,6 +33,8 @@
int maskfd;
const char *err;
+ Rast__init();
+
/* adjust window, check for valid window */
/* adjust the real one, not a copy
G_copy (&twindow, window, sizeof(struct Cell_head));
Modified: grass/trunk/lib/raster/window_map.c
===================================================================
--- grass/trunk/lib/raster/window_map.c 2009-07-15 15:09:04 UTC (rev 38428)
+++ grass/trunk/lib/raster/window_map.c 2009-07-15 20:42:46 UTC (rev 38429)
@@ -115,6 +115,8 @@
*/
void Rast__init_window(void)
{
+ Rast__init();
+
if (G_is_initialized(&R__.window_set))
return;
More information about the grass-commit
mailing list