NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Hi Donna... Donna L Gresh wrote:
I'd like to just be able to draw some text at particular values in the data set (i.e. x = datamin, y=-1, and x=datamax, y=-1 for my horizontal colorbar). Is this a big deal, or is there a simple way to do it?
In jython, you can use the display.drawString() method in subs.py. This allows you to specify the location of your string in terms of the types mapped to the 'visad box' coordinates. The signature is:
def drawString(self, string, position, color=None, center=0, font="futural",start=[0.,0.,0.], base=[.1,0.,0.], up=[0.,.1,0.],size=None ): """ Draw a string of characters on this display. <string> is the string of characters. <position> is the starting location for the string drawing, expressed as a list/tuple of 2 or 3 values (x,y,z). <color> is the color (e.g., "red" or java.awt.Color; default white). <center> if true will center the string. <font> defiles the HersheyFont name to use. <start> defines the relative location of the starting point (x,y,z; default = 0,0,0). <base> defines the direction that the base of the string should point (x,y,z; default along x-axis). <up> defines the direction of the vertical stroke for each character (default = along y-axis). <size> is the relative size. Returns the index to the shape of the text (useful for moving). so, for example: disp.drawString("My string",(2.3, -2.1),color='green', center=1)would put the "My string" characters in green starting at x=2.3 and y=-2.1 in the display "disp".
If you have to use Java ;-) then you may want to create a visad.Shape and use the PlotText.render_label() [or ...render_font()] method to create a Shape that you can then add to the display whenever you want it.
Hope that helps. tom -- Tom Whittaker (tomw@xxxxxxxxxxxxx) University of Wisconsin-Madison Space Science and Engineering Center Cooperative Institute for Meteorological Satellite Studies Phone/VoiceMail: 608.262.2759
visad
archives: