[GRASS-SVN] r29836 - grass/trunk/scripts/d.vect.thematic

svn_grass at osgeo.org svn_grass at osgeo.org
Fri Jan 25 13:09:57 EST 2008


Author: cmbarton
Date: 2008-01-25 13:09:57 -0500 (Fri, 25 Jan 2008)
New Revision: 29836

Modified:
   grass/trunk/scripts/d.vect.thematic/d.vect.thematic
Log:
Fix to make thematic mapping work in the GIS Manager GUI under Windows

Modified: grass/trunk/scripts/d.vect.thematic/d.vect.thematic
===================================================================
--- grass/trunk/scripts/d.vect.thematic/d.vect.thematic	2008-01-25 17:31:56 UTC (rev 29835)
+++ grass/trunk/scripts/d.vect.thematic/d.vect.thematic	2008-01-25 18:09:57 UTC (rev 29836)
@@ -334,7 +334,9 @@
 trap "exitprocedure" 2 3 15
 
 # identify current monitor or start monitor
-currmon=`eval d.mon -L | grep "(selected)" | awk '{print $1}'`
+if [ "$GIS_FLAG_S" -ne 1 ] ; then
+    currmon=`eval d.mon -L | grep "(selected)" | awk '{print $1}'`
+fi
 
 if [ -z "$currmon" -a "$GIS_FLAG_S" -ne 1 ] ; then
         g.message -e message='*** You must open a display monitor ***'
@@ -342,6 +344,19 @@
 	exit 2
 fi
 
+# if running in the GUI, do not create a graphic legend in an xmon
+if [ "$GIS_FLAG_S" -eq 1 ] ; then
+    GIS_FLAG_L=0
+    # if running in GUI, turn off immediate mode rendering so that the
+    # iterated d.vect commands will composite using the display driver
+    rendermode=$GRASS_RENDER_IMMEDIATE
+    pngread=$GRASS_PNG_READ
+    GRASS_PNG_READ=TRUE
+    export GRASS_PNG_READ
+    GRASS_PNG_AUTO_WRITE=FALSE
+    export GRASS_PNG_AUTO_WRITE
+fi
+
 table=`v.db.connect $GIS_OPT_MAP -g | grep -w $GIS_OPT_LAYER | awk '{print $2}'`
 database=`v.db.connect $GIS_OPT_MAP -g | grep -w $GIS_OPT_LAYER | awk '{print $4}'`
 driver=`v.db.connect $GIS_OPT_MAP -g | grep -w $GIS_OPT_LAYER | awk '{print $5}'`
@@ -472,7 +487,6 @@
 g.message message="Value range: $min - $max"
 
 # graduated color thematic mapping
-
 if [ "$GIS_OPT_THEMETYPE" = "graduated_colors" ] ; then
     # set color schemes for graduated color maps
     case "$GIS_OPT_COLORSCHEME" in
@@ -622,18 +636,6 @@
     i=1
     first="true"
 
-	# if running in GUI, turn off immediate mode rendering so that the
-	# iterated d.vect commands will composite using the display driver
-	if [ "$GIS_FLAG_S"  -eq 1 ] ; then
-		rendermode=$GRASS_RENDER_IMMEDIATE
-		autowrite=$GRASS_PNG_AUTO_WRITE
-		GRASS_RENDER_IMMEDIATE=FALSE
-		export GRASS_RENDER_IMMEDIATE
-		GRASS_PNG_AUTO_WRITE=FALSE
-		export GRASS_PNG_AUTO_WRITE
-		d.mon start=PNG
-	fi
-
     while [ $i -le $numint ]     
         do 
         if [ "$GIS_FLAG_M" -eq 1 ] ; then
@@ -869,17 +871,6 @@
         line3=`expr $line3 - 4`
     done
     
-    # reset rendering for GUI use
-	if [ "$GIS_FLAG_S"  -eq 1 ] ; then
-		d.mon stop=PNG
-		if [ -n "$currmon" ] ; then
-		    d.mon select=$currmon
-		fi
-		GRASS_RENDER_IMMEDIATE=$rendermodeexport
-		export GRASS_RENDER_IMMEDIATE
-		GRASS_PNG_AUTO_WRITE=$autowrite
-		export GRASS_PNG_AUTO_WRITE
-	fi
 fi
 
 #graduated points and line widths thematic mapping
@@ -970,18 +961,6 @@
     i=$numint
     ptsize=$GIS_OPT_MAXSIZE
 
-	# if running in GUI, turn off immediate mode rendering so that the
-	# iterated d.vect commands will composite using the display driver
-	if [ "$GIS_FLAG_S"  -eq 1 ] ; then
-		rendermode=$GRASS_RENDER_IMMEDIATE
-		autowrite=$GRASS_PNG_AUTO_WRITE
-		GRASS_RENDER_IMMEDIATE=FALSE
-		export GRASS_RENDER_IMMEDIATE
-		GRASS_PNG_AUTO_WRITE=FALSE
-		export GRASS_PNG_AUTO_WRITE
-		d.mon start=PNG
-	fi
-
     while [ $i -ge 1 ]     
         do 
         if [ "$GIS_FLAG_M" -eq 1 ] ; then
@@ -1166,20 +1145,18 @@
         line2=`expr $line2 - $lineht`
         i=`expr $i - 1`
     done
-    # reset rendering for GUI use
-	if [ "$GIS_FLAG_S"  -eq 1 ] ; then
-		d.mon stop=PNG
-		if [ -n "$currmon" ] ; then 
-		    d.mon select=$currmon
-		fi
-		GRASS_RENDER_IMMEDIATE=$rendermode
-		export GRASS_RENDER_IMMEDIATE
-		GRASS_PNG_AUTO_WRITE=$autowrite
-		export GRASS_PNG_AUTO_WRITE
-	fi
 
 fi
 
+if [ "$GIS_FLAG_S" -eq 1 ] ; then
+    # reset display parameters
+    #GRASS_PNG_READ=$pngread
+    GRASS_PNG_READ=FALSE
+    export GRASS_PNG_READ
+    GRASS_RENDER_IMMEDIATE=$rendermode
+    export GRASS_RENDER_IMMEDIATE
+fi
+
 # Create graphic legend
 if [ "$GIS_FLAG_L" -eq 1 -a "$GIS_OPT_MONITOR" != "none" ] ; then
     if [ `eval d.mon -L | grep $GIS_OPT_MONITOR | awk '{print $5}'` = "not" ] ; then



More information about the grass-commit mailing list