[GRASS-SVN] r34709 - in grass-addons: display/d.frame.split
raster/r.colors.tools vector/v.colors
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Dec 4 05:07:00 EST 2008
Author: hamish
Date: 2008-12-04 05:06:59 -0500 (Thu, 04 Dec 2008)
New Revision: 34709
Added:
grass-addons/raster/r.colors.tools/r.colors.stddev.README
grass-addons/vector/v.colors/README
Removed:
grass-addons/display/d.frame.split/d.frame.split
grass-addons/display/d.frame.split/d.frame.split.html
grass-addons/vector/v.colors/Makefile
grass-addons/vector/v.colors/description.html
grass-addons/vector/v.colors/v.colors
Log:
remove scripts moved to main
Deleted: grass-addons/display/d.frame.split/d.frame.split
===================================================================
--- grass-addons/display/d.frame.split/d.frame.split 2008-12-04 10:00:41 UTC (rev 34708)
+++ grass-addons/display/d.frame.split/d.frame.split 2008-12-04 10:06:59 UTC (rev 34709)
@@ -1,174 +0,0 @@
-#!/bin/sh
-############################################################################
-#
-# MODULE: d.frame.split
-# AUTHOR: M. Hamish Bowman, Dept. Marine Science, Otago Univeristy,
-# New Zealand
-# PURPOSE: Split the display into quarter frames, etc
-# (This script should replace d.split for GRASS 7)
-#
-# COPYRIGHT: (c) 2007 Hamish Bowman, and the GRASS Development Team
-# This program is free software released to the public domain
-#
-#############################################################################
-
-#%Module
-#% description: Split the display into subframes.
-#%End
-#%option
-#% key: frames
-#% type: integer
-#% description: Number of subframes
-#% options: 2,4,6,8,9,12,16
-#% answer: 4
-#%end
-#%flag
-#% key: h
-#% description: Split horizontally not vertically
-#%end
-
-if [ -z "$GISBASE" ] ; then
- echo "You must be in GRASS GIS to run this program." 1>&2
- exit 1
-fi
-
-# skip parser if no args are given
-if [ "$#" -gt 0 ] ; then
- if [ "$1" != "@ARGS_PARSED@" ] ; then
- exec g.parser "$0" "$@"
- fi
-else
- GIS_OPT_FRAMES=4
- GIS_FLAG_H=0
-fi
-
-
-if [ `d.mon -p | cut -f1 -d' '` != "Currently" ] ; then
- echo "No monitor currently selected for output"
- exit 1
-fi
-
-d.erase -f
-if [ $? -ne 0 ] ; then
- echo "Error clearing display monitor"
- exit 1
-fi
-
-
-case "$GIS_OPT_FRAMES" in
- 2) if [ $GIS_FLAG_H -eq 0 ] ; then
- #split vert
- d.frame -c frame=uno at=50,100,0,100
- d.frame -c frame=dos at=0,50,0,100
- else
- d.frame -c frame=uno at=0,100,0,50
- d.frame -c frame=dos at=0,100,50,100
- fi
- ;;
- 4) d.frame -c frame=uno at=50,100,0,50
- d.frame -c frame=dos at=50,100,50,100
- d.frame -c frame=tres at=0,50,0,50
- d.frame -c frame=cuatro at=0,50,50,100
- ;;
- 6) if [ $GIS_FLAG_H -eq 0 ] ; then
- #split vert
- d.frame -c frame=uno at=66.6667,100,0,50
- d.frame -c frame=dos at=66.6667,100,50,100
- d.frame -c frame=tres at=33.3333,66.6667,0,50
- d.frame -c frame=cuatro at=33.3333,66.6667,50,100
- d.frame -c frame=cinco at=0,33.3333,0,50
- d.frame -c frame=seis at=0,33.3333,50,100
- else
- d.frame -c frame=uno at=50,100,0,33.3333
- d.frame -c frame=dos at=50,100,33.3333,66.6667
- d.frame -c frame=tres at=50,100,66.6667,100
- d.frame -c frame=cuatro at=0,50,0,33.3333
- d.frame -c frame=cinco at=0,50,33.3333,66.6667
- d.frame -c frame=seis at=0,50,66.6667,100
- fi
- ;;
- 8) if [ $GIS_FLAG_H -eq 0 ] ; then
- #split vert
- d.frame -c frame=uno at=75,100,0,50
- d.frame -c frame=dos at=75,100,50,100
- d.frame -c frame=tres at=50,75,0,50
- d.frame -c frame=cuatro at=50,75,50,100
- d.frame -c frame=cinco at=25,50,0,50
- d.frame -c frame=seis at=25,50,50,100
- d.frame -c frame=siete at=0,25,0,50
- d.frame -c frame=ocho at=0,25,50,100
- else
- d.frame -c frame=uno at=50,100,0,25
- d.frame -c frame=dos at=50,100,25,50
- d.frame -c frame=tres at=50,100,50,75
- d.frame -c frame=cuatro at=50,100,75,100
- d.frame -c frame=cinco at=0,50,0,25
- d.frame -c frame=seis at=0,50,25,50
- d.frame -c frame=siete at=0,50,50,75
- d.frame -c frame=ocho at=0,50,75,100
- fi
- ;;
- 9) d.frame -c frame=uno at=66.6667,100,0,33.3333
- d.frame -c frame=dos at=66.6667,100,33.3333,66.6667
- d.frame -c frame=tres at=66.6667,100,66.6667,100
- d.frame -c frame=cuatro at=33.3333,66.6667,0,33.3333
- d.frame -c frame=cinco at=33.3333,66.6667,33.3333,66.6667
- d.frame -c frame=seis at=33.3333,66.6667,66.6667,100
- d.frame -c frame=siete at=0,33.3333,0,33.3333
- d.frame -c frame=ocho at=0,33.3333,33.3333,66.6667
- d.frame -c frame=nueve at=0,33.3333,66.6667,100
- ;;
- 12) if [ $GIS_FLAG_H -eq 0 ] ; then
- #split vert
- d.frame -c frame=uno at=75,100,0,33.3333
- d.frame -c frame=dos at=75,100,33.3333,66.6667
- d.frame -c frame=tres at=75,100,66.6667,100
- d.frame -c frame=cuatro at=50,75,0,33.3333
- d.frame -c frame=cinco at=50,75,33.3333,66.6667
- d.frame -c frame=seis at=50,75,66.6667,100
- d.frame -c frame=siete at=25,50,0,33.3333
- d.frame -c frame=ocho at=25,50,33.3333,66.6667
- d.frame -c frame=nueve at=25,50,66.6667,100
- d.frame -c frame=diez at=0,25,0,33.3333
- d.frame -c frame=once at=0,25,33.3333,66.6667
- d.frame -c frame=doce at=0,25,66.6667,100
- else
- d.frame -c frame=uno at=66.6667,100,0,25
- d.frame -c frame=dos at=66.6667,100,25,50
- d.frame -c frame=tres at=66.6667,100,50,75
- d.frame -c frame=cuatro at=66.6667,100,75,100
- d.frame -c frame=cinco at=33.3333,66.6667,0,25
- d.frame -c frame=seis at=33.3333,66.6667,25,50
- d.frame -c frame=siete at=33.3333,66.6667,50,75
- d.frame -c frame=ocho at=33.3333,66.6667,75,100
- d.frame -c frame=nueve at=0,33.3333,0,25
- d.frame -c frame=diez at=0,33.3333,25,50
- d.frame -c frame=once at=0,33.3333,50,75
- d.frame -c frame=doce at=0,33.3333,75,100
- fi
- ;;
- 16) d.frame -c frame=uno at=75,100,0,25
- d.frame -c frame=dos at=75,100,25,50
- d.frame -c frame=tres at=75,100,50,75
- d.frame -c frame=cuatro at=75,100,75,100
- d.frame -c frame=cinco at=50,75,0,25
- d.frame -c frame=seis at=50,75,25,50
- d.frame -c frame=siete at=50,75,50,75
- d.frame -c frame=ocho at=50,75,75,100
- d.frame -c frame=nueve at=25,50,0,25
- d.frame -c frame=diez at=25,50,25,50
- d.frame -c frame=once at=25,50,50,75
- d.frame -c frame=doce at=25,50,75,100
- d.frame -c frame=trece at=0,25,0,25
- d.frame -c frame=catorce at=0,25,25,50
- d.frame -c frame=quince at=0,25,50,75
- d.frame -c frame=dieciseis at=0,25,75,100
- ;;
-esac
-
-
-d.frame -s uno
-
-echo "Use 'd.erase -f' to clear frames from display monitor." 1>&2
-
-exit
Deleted: grass-addons/display/d.frame.split/d.frame.split.html
===================================================================
--- grass-addons/display/d.frame.split/d.frame.split.html 2008-12-04 10:00:41 UTC (rev 34708)
+++ grass-addons/display/d.frame.split/d.frame.split.html 2008-12-04 10:06:59 UTC (rev 34709)
@@ -1,43 +0,0 @@
-<H2>DESCRIPTION</H2>
-
-<EM>d.split</EM> divides the active display into a number of equal frames,
-either horizontally or vertically.
-
-
-<H2>NOTES</H2>
-
-Frame labels are created as Spanish numbers to distinguish them from
-monitor numbers, etc. These are "<i>uno, dos, tres, cuatro, cinco,
-seis, siete, ocho, nueve, diez, once, doce, trece, catorce, quince,
-and dieciseis</i>" for frames 1-16.
-The background frame is called <i>full_screen</i>.
-
-<P>
-Commands such as <em>d.rast.leg</em> will interfere with the frame creation
-and cannot be used.
-
-<H2>EXAMPLE</H2>
-
-Split the display monitor into six frames (3x2), jump to the third frame,
-and draw a map.
-<div class="code"><pre>
- d.split -h frames=6
- d.frame -s tres
- d.rast elevation.dem
-</pre></div>
-<BR>
-
-
-<H2>SEE ALSO</H2>
-
-<EM>
-<A HREF="d.frame.html">d.frame</A>
-</EM>
-
-
-<H2>AUTHOR</H2>
-
-Hamish Bowman<BR>
-<i>Dunedin, New Zealand</i>
-<p>
-<i>Last changed: $Date$</i>
Added: grass-addons/raster/r.colors.tools/r.colors.stddev.README
===================================================================
--- grass-addons/raster/r.colors.tools/r.colors.stddev.README (rev 0)
+++ grass-addons/raster/r.colors.tools/r.colors.stddev.README 2008-12-04 10:06:59 UTC (rev 34709)
@@ -0,0 +1 @@
+module moved into main GRASS source tree 12/2008
Deleted: grass-addons/vector/v.colors/Makefile
===================================================================
--- grass-addons/vector/v.colors/Makefile 2008-12-04 10:00:41 UTC (rev 34708)
+++ grass-addons/vector/v.colors/Makefile 2008-12-04 10:06:59 UTC (rev 34709)
@@ -1,7 +0,0 @@
-MODULE_TOPDIR = ../..
-
-PGM = v.colors
-
-include $(MODULE_TOPDIR)/include/Make/Script.make
-
-default: script
Added: grass-addons/vector/v.colors/README
===================================================================
--- grass-addons/vector/v.colors/README (rev 0)
+++ grass-addons/vector/v.colors/README 2008-12-04 10:06:59 UTC (rev 34709)
@@ -0,0 +1 @@
+module moved into main GRASS source tree 12/2008
Deleted: grass-addons/vector/v.colors/description.html
===================================================================
--- grass-addons/vector/v.colors/description.html 2008-12-04 10:00:41 UTC (rev 34708)
+++ grass-addons/vector/v.colors/description.html 2008-12-04 10:06:59 UTC (rev 34709)
@@ -1,79 +0,0 @@
-<H2>DESCRIPTION</H2>
-
-<EM>v.colors</EM> is much like <em>r.colors</em>, but may be used for vector maps.
-You give it a vector map and numeric data column, together with color rules
-like you would do for a raster. It creates a new column in the database with
-R:G:B values suitable for use with '<tt>d.vect -a</tt>'.
-
-<P>
-How it works: it creates a dummy raster map with the same data range as
-the vector's column then runs <em>r.colors</em> for that temporary map.
-It then uses <em>r.what.colors</em> for each value found by <em>v.db.select</em>
-and uploads it a new column in the vector map's attribute database.
-
-<P>
-It is planned that this script will be replaced with a C display module which
-renders thematic vector maps directly instead requiring the overhead of
-saving the colors into the DB.
-
-<P>
-If the target column name given by the <b>rgb_column</b> option does
-not exist, it will be created. The default name is "<tt>GRASSRGB</tt>".
-
-<h2>EXAMPLES</h2>
-
-Create a random sample point map, query raster map values for those points,
-and colorize output.
-
-<div class="code"><pre>
-# Spearfish dataset
-g.region -d
-v.random out=rand5k_elev n=5000
-v.db.addtable map=rand5k_elev column='elevation double precision'
-v.what.rast vector=rand5k_elev raster=elevation.10m column=elevation
-v.colors map=rand5k_elev column=elevation color=bcyr
-d.mon x0
-d.vect -a rand5k_elev
-</pre></div>
-
-
-<P>
-
-Colorizing a TIN generated by <em>v.delaunay</em>:
-
-<div class="code"><pre>
-# new columns for x,y,z of centroids
-v.db.addtable map=tin \
- columns="east double precision, north double precision, height double precision, GRASSRGB varchar(11)"
-
-# transfer geometry for colorizing (we need the centroid height)
-v.to.db tin opt=coor col="east,north,height"
-v.db.select tin
-
-v.colors tin column=height rgb_column=GRASSRGB color=rainbow
-
-# display colorized triangles
-d.mon x0
-d.vect -a tin
-</pre></div>
-
-
-<H2>SEE ALSO</H2>
-
-<EM>
-<A HREF="r.colors.html">r.colors</A><BR>
-<A HREF="r.what.color.html">r.what.color</A><BR>
-<A HREF="v.db.addcol">v.db.addcol</A><BR>
-<A HREF="v.db.select.html">v.db.select</A><BR>
-<A HREF="db.execute.html">db.execute</A>
-</EM>
-
-
-
-<H2>AUTHOR</H2>
-
-Hamish Bowman<BR>
-<i>Dunedin, New Zealand</i>
-
-<p>
-<i>Last changed: $Date$</i>
Deleted: grass-addons/vector/v.colors/v.colors
===================================================================
--- grass-addons/vector/v.colors/v.colors 2008-12-04 10:00:41 UTC (rev 34708)
+++ grass-addons/vector/v.colors/v.colors 2008-12-04 10:06:59 UTC (rev 34709)
@@ -1,335 +0,0 @@
-#!/bin/sh
-############################################################################
-#
-# MODULE: v.colors
-# AUTHOR: M. Hamish Bowman, Dept. Marine Science, Otago Univeristy,
-# New Zealand
-# PURPOSE: Populate a GRASSRGB column with a color map and data column
-# Helper script for thematic mapping tasks
-#
-# COPYRIGHT: (c) 2008 Hamish Bowman, and the GRASS Development Team
-# This program is free software under the GNU General Public
-# License (>=v2). Read the file COPYING that comes with GRASS
-# for details.
-#
-#############################################################################
-
-#%Module
-#% description: Set color rules for features in a vector using a numeric attribute column.
-#% keywords: vector
-#%End
-#% option
-#% key: map
-#% type: string
-#% gisprompt: old,vector,vector
-#% key_desc: name
-#% description: Name of input vector map
-#% required: yes
-#%end
-#%option
-#% key: column
-#% type: string
-#% description: Name of column containg numeric data
-#% required : yes
-#%end
-#%option
-#% key: layer
-#% type: integer
-#% description: Layer number of data column
-#% answer: 1
-#% required: no
-#%end
-#%Option
-#% key: rgb_column
-#% type: string
-#% required: no
-#% description: Name of color column to populate
-#% answer: GRASSRGB
-#% guisection: Colors
-#%End
-#% option
-#% key: range
-#% type: double
-#% required: no
-#% multiple: no
-#% key_desc: min,max
-#% description: Manually set range (min,max)
-#%End
-#% option
-#% key: color
-#% type: string
-#% key_desc: style
-#% description: Type of color table
-#% required: no
-#% guisection: Colors
-#%end
-#%Option
-#% key: raster
-#% type: string
-#% required: no
-#% description: Raster map name from which to copy color table
-#% gisprompt: old,cell,raster
-#% guisection: Colors
-#%End
-#%Option
-#% key: rules
-#% type: string
-#% required: no
-#% description: Path to rules file
-#% gisprompt: old_file,file,input
-#% guisection: Colors
-#%End
-#%Flag
-#% key: s
-#% description: Save placeholder raster map for use with d.legend
-#%End
-#%Flag
-#% key: n
-#% description: Invert colors
-#% guisection: Colors
-#%End
-
-
-## TODO: implement -e (equalized) and -g (logarithmic) methods in r.colors
-## 'v.db.select column= | wc -l' to set region size (1xLength)
-## then create r.in.ascii 1xLength matrix with data (WITHOUT uniq)
-## and run r.colors on that raster map.
-## or
-## v.to.rast, r.colors -g, then parse colr/ file. But that's resolution dependent
-
-
-if [ -z "$GISBASE" ] ; then
- echo "You must be in GRASS GIS to run this program." 1>&2
- exit 1
-fi
-
-if [ "$1" != "@ARGS_PARSED@" ] ; then
- exec g.parser "$0" "$@"
-fi
-
-
-GRASS_VERBOSE=0
-export GRASS_VERBOSE
-
-cleanup()
-{
- if [ -n "$TMP" ] ; then
- \rm "$TMP" "${TMP}_vcol.sql"
- fi
- eval `g.findfile elem=windows file="tmp_vcolors.$$" | grep '^name='`
- if [ -n "$name" ] ; then
- unset WIND_OVERRIDE
- g.remove region="tmp_vcolors.$$"
- fi
- eval `g.findfile elem=cell file="tmp_colr_$$" | grep '^name='`
- if [ -n "$name" ] ; then
- g.remove rast="tmp_colr_$$"
- fi
-}
-trap "cleanup" 2 3 15
-
-
-### setup enviro vars ###
-eval `g.gisenv`
-: ${GISBASE?} ${GISDBASE?} ${LOCATION_NAME?} ${MAPSET?}
-
-#### does map exist in CURRENT mapset?
-eval `g.findfile element=vector file="$GIS_OPT_MAP" mapset="$MAPSET"`
-VECT_MAPSET=`echo "$GIS_OPT_MAP" | grep '@' | cut -f2 -d'@'`
-if [ -z "$VECT_MAPSET" ] ; then
- VECT_MAPSET="$MAPSET"
-fi
-if [ ! "$file" ] || [ "$VECT_MAPSET" != "$MAPSET" ] ; then
- g.message -e "Vector map <$GIS_OPT_MAP> not found in current mapset"
- exit 1
-else
- VECTOR=`echo "$GIS_OPT_MAP" | cut -f1 -d'@'`
-fi
-
-
-
-# sanity check mutually exclusive color options
-CTEST=0
-for OPT in COLOR RASTER RULES ; do
- eval "OPTNAME=\$GIS_OPT_${OPT}"
- if [ -n "$OPTNAME" ] ; then
- CTEST=`expr $CTEST + 1`
- fi
-done
-if [ "$CTEST" -ne 1 ] ; then
- g.message -e "Pick one of color, rules, or raster options"
- exit 1
-fi
-
-if [ -n "$GIS_OPT_COLOR" ] ; then
- #### check the color rule is valid
- COLOR_OPTS=`ls $GISBASE/etc/colors/`
- COLOR_OPTS="`echo $COLOR_OPTS | tr '\n' ' '` random grey.eq grey.log rules"
-
- HAVE_COLR=0
- for COLR in $COLOR_OPTS ; do
- if [ "$COLR" = "$GIS_OPT_COLOR" ] ; then
- HAVE_COLR=1
- break
- fi
- done
- if [ "$HAVE_COLR" -eq 0 ] ; then
- g.message -e "Invalid color rule <$GIS_OPT_COLOR>"
- echo " Valid options are: $COLOR_OPTS"
- exit 1
- fi
-elif [ -n "$GIS_OPT_RASTER" ] ; then
- r.info -r "$GIS_OPT_RASTER" > /dev/null
- if [ $? -ne 0 ] ; then
- g.message -e "Unable to open raster map <$GIS_OPT_RASTER>"
- exit 1
- fi
-elif [ -n "$GIS_OPT_RULES" ] ; then
- if [ ! -r "$GIS_OPT_RULES" ] ; then
- g.message -e "Unable to read color rules file <$GIS_OPT_RULES>"
- exit 1
- fi
-fi
-
-
-#### column checks
-# check input data column
-NCOLUMN_TYPE=`v.info -c map="$GIS_OPT_MAP" layer="$GIS_OPT_LAYER" | grep -i "|$GIS_OPT_COLUMN$" | cut -f1 -d'|'`
-if [ -z "$NCOLUMN_TYPE" ] ; then
- g.message -e "Column <$GIS_OPT_COLUMN> not found"
- exit 1
-elif [ "$NCOLUMN_TYPE" != "INTEGER" ] && [ "$NCOLUMN_TYPE" != "DOUBLE PRECISION" ] ; then
- g.message -e "Column <$GIS_OPT_COLUMN> is not numeric"
- exit 1
-fi
-#echo "column <$GIS_OPT_COLUMN> is type [$NCOLUMN_TYPE]"
-
-# check if GRASSRGB column exists, make it if it doesn't
-TABLE=`v.db.connect -g map="$GIS_OPT_MAP" layer="$GIS_OPT_LAYER" fs=";" | cut -f2 -d';'`
-COLUMN_TYPE=`v.info -c map="$GIS_OPT_MAP" layer="$GIS_OPT_LAYER" | grep -i "|$GIS_OPT_RGB_COLUMN$" | cut -f1 -d'|'`
-if [ -z "$COLUMN_TYPE" ] ; then
- # RGB Column not found, create it
- echo "Creating column <$GIS_OPT_RGB_COLUMN> ..."
- v.db.addcol map="$GIS_OPT_MAP" layer="$GIS_OPT_LAYER" column="$GIS_OPT_RGB_COLUMN varchar(11)"
- if [ $? -ne 0 ] ; then
- g.message -e "Creating color column"
- exit 1
- fi
-elif [ "$COLUMN_TYPE" != "CHARACTER" -a "$COLUMN_TYPE" != "TEXT" ] ; then
- g.message -e "Column <$GIS_OPT_RGB_COLUMN> is not of compatible type (found $COLUMN_TYPE)"
- exit 1
-else
- NUM_CHARS=`db.describe -c "$TABLE" | grep -i " $GIS_OPT_RGB_COLUMN:" | cut -f4 -d':'`
- if [ "$NUM_CHARS" -lt 11 ] ; then
- g.message -e "Color column <$GIS_OPT_RGB_COLUMN> is not wide enough (needs 11 characters)"
- exit 1
- fi
-fi
-
-
-# find data range
-if [ -n "$GIS_OPT_RANGE" ] ; then
- #order doesn't matter
- MINVAL=`echo "$GIS_OPT_RANGE" | grep '[[:digit:]]' | grep ',' | cut -f1 -d','`
- MAXVAL=`echo "$GIS_OPT_RANGE" | grep '[[:digit:]]' | grep ',' | cut -f2 -d','`
-else
- echo "Scanning values ..."
- MINVAL=`v.db.select map="$GIS_OPT_MAP" column="$GIS_OPT_COLUMN" layer="$GIS_OPT_LAYER" | sort -n | grep '^[-0-9]' | head -n 1`
- MAXVAL=`v.db.select map="$GIS_OPT_MAP" column="$GIS_OPT_COLUMN" layer="$GIS_OPT_LAYER" | sort -n | grep '^[-0-9]' | tail -n 1`
-fi
-echo " min=[$MINVAL] max=[$MAXVAL]"
-if [ -z "$MINVAL" ] || [ -z "$MAXVAL" ] ; then
- g.message -e "Scanning data range"
- exit 1
-fi
-
-
-# setup internal region
-g.region save="tmp_vcolors.$$"
-WIND_OVERRIDE="tmp_vcolors.$$"
-export WIND_OVERRIDE
-g.region rows=2 cols=2
-
-# create dummy raster map
-if [ "$NCOLUMN_TYPE" = "INTEGER" ] ; then
- r.mapcalc "tmp_colr_$$ = if( row() == 1, $MINVAL, $MAXVAL)"
-else
- r.mapcalc "tmp_colr_$$ = double( if( row() == 1, $MINVAL, $MAXVAL) )"
-fi
-
-
-if [ -n "$GIS_OPT_COLOR" ] ; then
- COLOR_CMD="color=$GIS_OPT_COLOR"
-elif [ -n "$GIS_OPT_RASTER" ] ; then
- COLOR_CMD="raster=$GIS_OPT_RASTER"
-elif [ -n "$GIS_OPT_RULES" ] ; then
- COLOR_CMD="rules=$GIS_OPT_RULES"
-fi
-if [ $GIS_FLAG_N -eq 1 ] ; then
- FLIP_FLAG="-n"
-else
- FLIP_FLAG=""
-fi
-r.colors map="tmp_colr_$$" "$COLOR_CMD" $FLIP_FLAG
-
-
-
-TMP="`g.tempfile pid=$$`"
-if [ $? -ne 0 ] || [ -z "${TMP}" ] ; then
- g.message -e "Unable to create temporary file"
- cleanup
- exit 1
-fi
-
-
-# calculate colors and write SQL command file
-echo "Looking up colors ..."
-v.db.select map="$GIS_OPT_MAP" layer="$GIS_OPT_LAYER" column="$GIS_OPT_COLUMN" | \
- sort -n | grep '^[-0-9]' | uniq | \
- r.what.color -i in="tmp_colr_$$" | sed -e 's/: /|/' | grep -v '|\*$' | \
- ( while read LINE ; do
- #echo "LINE=[$LINE]"
- VALUE=`echo $LINE | cut -f1 -d'|'`
- COLR=`echo $LINE | cut -f2 -d'|'`
- echo "UPDATE $TABLE SET $GIS_OPT_RGB_COLUMN = '$COLR' WHERE $GIS_OPT_COLUMN = $VALUE;" >> "${TMP}_vcol.sql"
- done )
-
-
-if [ ! -e "${TMP}_vcol.sql" ] ; then
- g.message -e "No values found in color range"
- cleanup
- exit 1
-fi
-
-# apply SQL commands to update the table with values
-NUM_RULES=`wc -l < "${TMP}_vcol.sql"`
-echo "Writing $NUM_RULES colors ..."
-#less "$TMP"
-db.execute input="${TMP}_vcol.sql"
-if [ $? -ne 0 ] ; then
- g.message -e "Processing SQL transaction"
- cleanup
- exit 1
-fi
-
-
-if [ $GIS_FLAG_S -eq 1 ] ; then
- g.rename rast="tmp_colr_$$","vcolors_$$"
- echo "Raster map containing color rules saved to <vcolors_$$>"
- # TODO save full v.colors command line history
- r.support map="vcolors_$$" history="" \
- source1="vector map=$GIS_OPT_MAP" \
- source2="column=$GIS_OPT_COLUMN" \
- title="Dummy raster to use as thematic vector legend" \
- description="generated by v.colors using r.mapcalc"
- r.support map="vcolors_$$" \
- history="RGB saved into <$GIS_OPT_RGB_COLUMN> using <$GIS_OPT_COLOR$GIS_OPT_RASTER$GIS_OPT_RULES>"
-else
- g.remove rast="tmp_colr_$$"
-fi
-cleanup
-
-exit 0
-#v.db.dropcol map=vcol_test col=GRASSRGB
-#d.vect -a vcol_test icon=basic/circle color=none size=8
-
More information about the grass-commit
mailing list