Re: (Once again) 2D grid cells over an aerial map

On Tue, 9 Apr 2002, S. Therakomen wrote:

> I'm looking for a way to superimpose color-filled grid cells over a
> particular area of an aerial map, and there's no need for the grid lines.
> Think of it as a map of several communities and you want to lay small
> colored tiles over just the area of a selected community to show its 
> population
> density or landuse, and leave the rest of the map visible.
> Thanks Bill for responding my previous email.
> I've looked at the Rivers.java as you recommended but still it doesn't
> fulfill my needs which are:
> - just colored tiles
> - on an image (.JPEG or .GIF file)
> - without grid lines

I think what your looking for is a Shape.  You would define a 2D shape
(like the 'box' in Test46) and then place copies of it on top of your
image.

If by "grid lines" you mean the "VisAD wire frame box", then use
DisplayRenderer's setBoxOn(boolean) method to turn it off.

Here is a modest example in Jython, that takes the same square shape
and puts it on two locations (in different colors) over an image:

from visad import RealType, ScalarMap, RealTupleType, RealTuple
from visad import PlotText, Integer1DSet, Display, ConstantMap
from visad import VisADQuadArray
import subs
from visad.python.JPythonMethods import *

a=load("../data/mcidas/AREA0001")
d = getDomainType(a)
r = getRangeType(a)

x = d[0]
y = d[1]

#x = RealType.getRealType("x")
#y = RealType.getRealType("y")
shape = RealType.getRealType("shape")
shape_map = ScalarMap(shape, Display.Shape)
s = subs.makeMaps(x,"x", y, "y", r[0], "rgb")
disp = subs.makeDisplay(s)
disp.addMap(shape_map)

coord_type = RealTupleType(x, y, shape)
coord_tuple = RealTuple(coord_type, (100., 100., 0))
cm = ( ConstantMap(0., Display.Red), 
ConstantMap(.99,Display.Green),ConstantMap(.5,Display.Blue) )

coord_tuple2 = RealTuple(coord_type, (200., 200., 0))
cm2 = ( ConstantMap(.99, Display.Red), 
ConstantMap(.5,Display.Green),ConstantMap(.5,Display.Blue) )

square = VisADQuadArray()
square.coordinates = ( .1,.1, 0., .1,-.1,0., -.1,-.1,0., -.1,.1,0)
square.vertexCount = len(square.coordinates)/3

shape_control = shape_map.getControl()
shape_control.setShapeSet(Integer1DSet(1))
shape_control.setShapes((square,))

subs.addData("label", coord_tuple, disp, cm)
subs.addData("label", coord_tuple2, disp, cm2)

subs.addData("image", a, disp)
subs.showDisplay(disp, 500, 500)


--
Tom Whittaker
University of Wisconsin-Madison
Space Science and Eng. Center
ph:  608.262.2759