Table of Contents

Module: subs ..\subs.py

A collection of support methods for connecting VisAD to Jython. The emphasis is on display-side methods and classes. All display-dependent functions (methods) are available as either static functions (where one of the parameter is the display) or as an instance function (for a previously-created display). See the _vdisp class.

Imported modules   
from visad import ControlListener
Functions   
_color2rgb
addData
addMaps
addShape
drawLine
drawString
enableRubberBandBoxZoomer
getDisplayMaps
getDisplayScalarMaps
makeColorMap
makeCube
makeDisplay
makeDisplay2D
makeDisplay3D
makeLine
makeLineStyleMap
makeMaps
maximizeBox
moveShape
rotateBox
saveDisplay
setAspectRatio
setAspects
setBackgroundColor
setBoxColor
setBoxOn
setBoxSize
setCursorColor
setForegroundColor
setPointSize
showDisplay
textShape
zoomBox
  _color2rgb 
_color2rgb ( color )

Return a triplet of Red,Green,Blue values (0-1) for the given color or color name

  addData 
addData (
        name,
        data,
        disp,
        constantMaps=None,
        renderer=None,
        ref=None,
        )

Add <data> to the display <disp>. Use a reference <name>. If there are ConstantMaps, also add them. If there is a non-default Renderer, use it as well. Finally, you can supply a pre-defined DataReference as <ref>.

Returns the DataReference

  addMaps 
addMaps ( display,  maps )

Add list/tuple <maps> mappings to the <display>. These determine what scalars will appear along what axes. See makeMaps, below.

  addShape 
addShape (
        type,
        scale=.1,
        color=None,
        index=None,
        autoScale=1,
        )

Deprecated. (Please use the instance method from the display you intend to use this Shape within.)

Simply a shadow method for addShape in case the user has not made their own. You cannot use this method with more than one display (see Shapes class, or use the addShapes() method for the display)

local shadow methods for addShape and moveShape

  drawLine 
drawLine (
        display,
        points,
        color=None,
        mathtype=None,
        style=None,
        width=None,
        )

Deprecated.

Draw lines on the <display>. <points> is a 2 or 3 dimensional, list/tuple of points to connect as a line, ordered as given in the <mathtype>. Default <mathtype> is whatever is mapped to the x,y (and maybe z) axis. <color> is the line color ("red" or java.awt.Color; default=white), <style> is the line style (e.g., "dash"), and <width> is the line width in pixels.

Return a reference to this line.

  drawString 
drawString (
        display,
        string,
        point,
        color=None,
        center=0,
        font="futural",
        start=[ 0., 0., 0.],
        base=[.1, 0., 0.],
        up=[ 0.,.1, 0.],
        size=None,
        )

Deprecated.

Draw a string of characters on the <display>. <string> is the string of characters. <point> 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. This returns the Shapes object. Note that the drawString method in the display returns the shape index for this, so is the preferred method.

draw a string on the display

  enableRubberBandBoxZoomer 
enableRubberBandBoxZoomer ( display,  useKey )

Method to attach a Rubber Band Box zoomer to this display. Once attached, it is there foreever! The useKey parameter can be 0 (no key), 1(CTRL), 2(SHIFT)

  getDisplayMaps 
getDisplayMaps ( display,  includeShapes=0 )

Return a list of the type mappings for the <display>. The list elements are ordered: x,y,z,display. If <includeShapes> is true, then mappings for Shape will be appended. The <display> may be a Display, or the name of a plot() window.

  getDisplayScalarMaps 
getDisplayScalarMaps ( display,  includeShapes=0 )

Return a list of the scalarmaps mappings for this display. The list elements are ordered: x,y,z,display. If <includeShapes> is true, then mappings for Shape will be appended. The <display> may be a Display, or the name of a plot() window.

  makeColorMap 
makeColorMap ( color )

Return a ConstantMap of <color>, given by name (e.g., "red") or a java.awt.Color object. Default is white. Used by numerous methods.

  makeCube 
makeCube ( display )

Turn the VisAD box for this <display> into a cube with no perspective (no vanishing point. Useful for aligning vertically-stacked data.

  makeDisplay 
makeDisplay ( maps )

Create (and return) a VisAD DisplayImpl and add the ScalarMaps <maps>, if any. The VisAD box is resized to about 95% of the window. Use 3D if availble, otherwise use 2D. This returns the Display.

create (and return) a VisAD DisplayImpl and add the ScalarMaps, if any the VisAD box is resized to about 95% of the window

  makeDisplay2D 
makeDisplay2D ( maps )

Create (and return) a VisAD DisplayImplJ2D and add the ScalarMaps <maps>, if any. The VisAD box is resized to about 95% of the window. This returns the Display.

  makeDisplay3D 
makeDisplay3D ( maps )

Create (and return) a VisAD DisplayImplJ3D and add the ScalarMaps <maps>, if any. The VisAD box is resized to about 95% of the window. This returns the Display.

static methods start here

  makeLine 
makeLine ( domainType,  points )

returns a set of <points>, as defined in the <domainType>. For example, if <domaintType> defines a (Latitude,Longitude), then the <points> are in Latitude,Longitude.

non-display type of methods to do useful things make a 2D or 3D line, return a reference so it can be changed

  makeLineStyleMap 
makeLineStyleMap ( style,  width )

Make a ConstantMap for the indicated line <style>, which may be: "dash", "dot", "dashdot", or "solid" (default). The <width> is the line width in pixels. Used by drawLine.

  makeMaps 
makeMaps ( *a )

Define a list of scalar mappings for each axis and any other one needed. The parameter list is in pairs: Type, Name. For example: makeMaps("lat","y", "lon","x") returns a list that maps variable "lat" to the y-axis, and variable "lon" to the x-axis.

Here is a complete list of available names:

"x","y","z","lat","lon","rad","list","red","green", "blue","rgb","rgba","hue","saturation","value","hsv","cyan", "magenta","yellow","cmy","alpha","animation","selectvalue", "selectrange","contour","flow1x","flow1y","flow1z", "flow2x","flow2y","flow2z","xoffset","yoffset","zoffset", "shape","text","shapescale","linewidth","pointsize", "cylradius","cylazimuth","cylzaxis", "flow1elev","flow1azimuth","flow1radial", "flow2elev","flow2azimuth","flow2radial","linestyle", "textureenable"

  maximizeBox 
maximizeBox ( display,  clip=1 )

Set the size of the VisAD box for the <display> to 95%. If <clip> is true, the display will be clipped at the border of the box; otherwise, data displays may spill over.

  moveShape 
moveShape ( index,  coord )

Deprecated. (Please use the instance method from the display you intend to use this Shape within.)

Simply a shadow method for moveShape in case the user has not made their own.

  rotateBox 
rotateBox (
        display,
        azimuth,
        declination,
        )

Rotate the 3D display box to the azimuth angle (0-360) and declination angle (all in degrees). Code from Unidata.

  saveDisplay 
saveDisplay ( disp,  filename )

Save the display <disp> as a JPEG, given the filename to use.

  setAspectRatio 
setAspectRatio ( display,  ratio )

Set the aspect <ratio> for the <display>. The ratio is expressed as the fractional value for: width/height.

define the aspects of width and height, as a ratio: width/height

  setAspects 
setAspects (
        display,
        x,
        y,
        z,
        )

Set the relative sizes of each axis in the <display>.

  setBackgroundColor 
setBackgroundColor ( display,  color )

Set the background color to color (which may be a java.awt.Color, or a string with the name in it (like green)

  setBoxColor 
setBoxColor ( display,  color )

Set the box color to color (which may be a java.awt.Color, or a string with the name in it (like green)

  setBoxOn 
setBoxOn ( display,  on )

Turn the wire frame box on or off.

  setBoxSize 
setBoxSize (
        display,
        percent=.70,
        clip=1,
        showBox=1,
        snap=0,
        )

Set the size of the VisAD box for the <display> as a percentage (fraction). The default is .70 (70%). If <clip> is true, the display will be clipped at the border of the box; otherwise, data displays may spill over. If <showBox> is true, the wire-frame will be shown; otherwise, it will be turned off. If <snap> is true, the box will be reoriented to an upright position.

  setCursorColor 
setCursorColor ( display,  color )

Set the cursor color to color (which may be a java.awt.Color, or a string with the name in it (like green)

  setForegroundColor 
setForegroundColor ( display,  color )

Set the foreground color to color (which may be a java.awt.Color, or a string with the name in it (like green)

  setPointSize 
setPointSize ( display,  size )

Set the size of points (1,2,3...) to use in the <display>.

  showDisplay 
showDisplay (
        display,
        width=300,
        height=300,
        title="VisAD Display",
        bottom=None,
        top=None,
        panel=None,
        right=None,
        left=None,
        )

Quick display of <display> in a separate frame. <width> and <height> give the dimensions of the window; <title> is the text string for the titlebar, <bottom> is a panel to put below the <display>, <top> is a panel to put above the <display>, and <panel> is the panel to put everything into (default is to make a new one, and display it). Additionally, you may put panels on the <right> and <left>.

quick display of a Display object in a separate JFrame you can set the size and title, if you want...

  textShape 
textShape (
        string,
        center=0,
        font="futural",
        start=[ 0., 0., 0.],
        base=[.1, 0., 0.],
        up=[ 0.,.1, 0.],
        size=None,
        )

Creates a Shape for the text string given. For use with the Shape class. See comments on drawString, above.

  zoomBox 
zoomBox ( display,  factor )

Zoom the display by factor (1.0 does nothing...). Related: setBoxSize().

Classes   

HandlePickEvent

Helper class for interfacing to the VisAD Display when

LinkBoxControl

RubberBandZoomer

Class to define a Rubber Band Box zoom capability

SelectField

Aids in showing a series of data objects using Display.SelectValue.

Shapes

Helper class for handling Shapes within a display.

_vdisp

Super class for displays - this contains all the

myFrame

Creates a frame out of the display, with possible optional panels


Table of Contents

This document was automatically generated on Wed Feb 26 13:00:02 2003 by HappyDoc version 2.1