NAME
bpviewport, bpaxes, bpgrid, bptext, bppolyline, bppolypoint, bptrace, bptracepanel, bpmap, bpdatagrid - BRTT tk canvas item extensions
SYNOPSIS
package require Buplot
canvaspathName create bpviewport viewportName x y ?options?
canvaspathName create bpaxes viewportName ?options?
canvaspathName create bpgrid viewportName ?options?
canvaspathName create bptext viewportName textstring x y ?options?
canvaspathName create bppolyline viewportName ?options?
canvaspathName create bppolypoint viewportName ?options?
canvaspathName create bpmap viewportName ?options?
canvaspathName create bptrace viewportName ?options?
canvaspathName create bptracepanel viewportName ?options?
canvaspathName create bpdatagrid viewportName ?options?
DESCRIPTION
These are all special tk canvas item extensions available through the
Buplot package in the Antelope tcl/tk extensions. All of these canvas
item widgets act as normal tk canvas items, including such functionality
as the ability to display these in scrolled canvases and the ability
to generate PostScript output, and they should be thought of as extensions
to the various items that are described in
canvas(n).
In theory, most of what these extensions can do could be done with the
off-the-shelf canvas items that normally come with any tcl/tk package.
However, the off-the-shelf items have not been written to efficiently
display large graphical items, such as dense time series (like seismograms),
large geographic map coordinate sets, and other bulky data items, such
as large sets of geographic locations that are produced by earthquake
catalogs. Another problem with the off-the-shelf items is that they
do not provide any embedded and efficient way for computing coordinate
transformations which are always necessary for displaying data.
OVERVIEW OF ITEM TYPES
The
Buplot package was designed to deal with these inadequacies
of the standard tk canvas items. The process of using the
Buplot
items is to first create a normal tk
canvas widget with widget
path
canvaspathName. This is created in the normal tk widget heirarchy
and is manipulated as any other canvas widget. The next step involves
the definition of one or more
bpviewports, using the
create bpviewport
tcl canvas item command. The concept of viewports is standard within
graphical software packages. The idea is that a viewport acts as a window
within a "virtual graphical device", such as a graphical monitor screen,
or, in our case, a tk canvas, that is used to display data that is represented
in some data-centric "world" coordinate system. For example imagine a set
of longitude-latitude data coordinates that you would like to plot
within a tk canvas. The world coordinates in this case are longitude and
latitude. In order to use the off-the-shelf tk canvas item widgets you
would have to convert these longitude-latitude world coordinates into
a set of X-Y pixel coordinates, the virtual device coordinate system.
The bpviewport canvas item is a widget that will automatically
transform data in world coordinates into integer
X-Y pixel data coordinates that are suitable for passing directly
into the virtual display device drivers (in this case the tk -> Xwindows
drivers). A bpviewport can be thought of as a virtual canvas item
since it does not by itself result in display graphics (the exception to
this is that it will paint certain background colors). However, use of
any of the other extension canvas items require an existing bpviewport
item, which is used to define the world to virtual device coordinate
transformations. All bpviewports must be assigned a unique name in
bpviewportName by the application programmer when they are created.
These names are used as references by the other Buplot widget
extensions to associate particular widgets with particular
viewports.
A set of axes and labels can be created with the bpaxes canvas item.
A set of plot grid lines can be displayed with the bpgrid canvas item.
Text can be anchored in world coordinates, justified and rotated using
the bptext canvas item.
Complex polyline objects can be rendered with the bppolyline canvas
item. Polyline objects can be displayed as line outlines and/or as
filled polygons. A set of plot symbols can be displayed with the
bppolypoint canvas item. Each plot symbol shape, color, and an
associated text label can be specified independently. Both the bppolyline and
bppolypoint canvas items can use bplot_vector(3t) tcl extensions
for representing vectors of plot coordinates and symbol attributes.
An interface
into the Antelope mappts mapping data sets (see gmtmap(3),
gshhsmap(3)) is provided with the bpmap canvas item which
will make geographic maps of water areas,
land areas, coastlines, rivers and political boundaries for the entire
world at high resolution.
COMMON ITEM OPTIONS
The
Buplot canvas item extensions are configured in the same
manner as all other convas items, through an argument list when
they are created or by using the nomral
itemconfigure tk canvas
item command. Common item options for all of the
Buplot items are as follows.
-
-tags tagList
Specifies a set of tags to apply to the item. tagList
consists of a list of tag names, which replace any
existing tags for the item. tagList may be an empty
list.
BPVIEWPORT ITEMS
Bpviewport items are necessary adjuncts to any of the other items.
These items will anchor viewport "frames" into a canvas.
A viewport can include margins around the actual data viewport for displaying
graph labels and titles. A
bpviewport item can be configured to be strictly
invisible, meaing the viewport itself will cause no graphics to be rendered,
or they can be configured to paint in background colors before the other
associated items are rendered. Note that multiple viewports can occupy
the same space in a canvas. In the following documentation, when we say
"viewport frame" we are referring to the entire rectangular viewport
area including margins for making axes and title displays. When
we refer to "viewport window" we are refering to only the inner portion of the
viewport frame inside of the margins that will contain the actual data. A
bpviewport item is created with the following command:
-
canvaspathName create bpviewport viewportName x y ?options?
With the following item options:
-
viewportName
This must be a unique name for the viewport that is assigned
by the programmer. This name is used to reference the viewport
in all of the other Buplot item extensions.
-
x y
The location of the viewport frame relative to the canvas origin.
These are parsed with Tk_CanvasGetCoord(3) and can be specified
in a variety of units according to the documentation. A point in the viewport
frame, based upon the -anchor option defined below, is positioned to this point in the canvas.
The following standard options are supported
by bpviewport items:
The following item options are specific to bpviewport items:
-
-anchor anchorPos
anchorPos tells how to position the viewport frame relative to
the x, y positioning point for the item. It may have any of
the forms accepted by Tk_GetAnchor(3). For example, if
anchorPos is "center" then the frame is centered on the
point; if anchorPos is "n" then the frame will be drawn
so that its top center point is at the positioning
point. This option defaults to "nw".
-
-width widthPixels
Specifies the width in pixels of the viewport frame.
If the width is set to 0, then the width of the viewport
is set equal to the width of the canvas and the width of the viewport
will change automatically whenever the width of the canvas changes.
This defaults to 0.
-
-height heightPixels
Specifies the height in pixels of the viewport frame.
If the height is set to 0, then the height of the viewport
is set equal to the height of the canvas and the height of the viewport
will change automatically whenever the height of the canvas changes.
This defaults to 0.
-
-mleft leftmarginPixels
This can be used to specify a margin in the X-axis direction that is
applied between the left side of the viewport frame
and the left side of the actual data viewport window.
This defaults to 0.
-
-mright rightmarginPixels
This can be used to specify a margin in the X-axis direction that is
applied between the right side of the actual data viewport window.
and the right side of the viewport frame.
This defaults to 0.
-
-mbottom bottommarginPixels
This can be used to specify a margin in the Y-axis direction that is
applied between the bottom side of the actual data viewport window.
and the bottom side of the viewport frame.
This defaults to 0.
-
-mtop topmarginPixels
This can be used to specify a margin in the Y-axis direction that is
applied between the top side of the viewport frame
and the top side of the actual data viewport window.
This defaults to 0.
-
-wtran wTran
This specifies a transformation that can be applied to the data
world coordinates before scaling into device plot coordinates.
This is normally used for plotting geographic data in latitude-longitude
world coordinates and must be one of "none", for no transformations,
"merc", for Mercator transformation, or "edp", for
equal distance transformation. Note that if a transformation is applied,
the -xleft, -xright, ..., plot scaling options are specified
in units of the transformed world coordinates.
This defaults to "none".
-
-latr latitudeRef
This specifies a reference latitude in degrees for use when -wtran
is specified as "edp".
This defaults to 0.0.
-
-lonr longitudeRef
This specifies a reference longitude in degrees for use when -wtran
is specified as "edp".
This defaults to 0.0.
-
-xmode modeXaxis
This must be one of "lin", "log", or "time"
and specifies whether the X-axis scaling in the viewport window will
be linear, logarithmic or if the X-axis represents time.
This defaults to "lin".
-
-ymode modeYaxis
This must be one of "lin", "log", or "time"
and specifies whether the Y-axis scaling in the viewport window will
be linear, logarithmic or if the Y-axis represents time.
This defaults to "lin".
-
-xleft leftdataWorldcoords
This specifies the X-axis data value in transformed world coordinates that will map
onto the left side of the viewport window. This is normally specified
as a floating number, unless the -xmode option has been specified
as "time", in which case this can be specified as a normal
Antelope absolute time value in any of the forms allowed in str2epoch(3).
Note that this can be set to a NULL value by specifying a NULL string
as the argument. If this is NULL, then the X-axis data value for scaling
to the left edge of the viewport window is automatically determined from
the data as the minimum X value.
This defaults to NULL.
-
-xright rightdataWorldcoords
This specifies the X-axis data value in transformed world coordinates that will map
onto the right side of the viewport window. This is normally specified
as a floating number, unless the -xmode option has been specified
as "time", in which case this can be specified as a normal
Antelope absolute time value in any of the forms allowed in str2epoch(3).
Note that this can be set to a NULL value by specifying a NULL string
as the argument. If this is NULL, then the X-axis data value for scaling
to the right edge of the viewport window is automatically determined from
the data as the maximum X value.
This defaults to NULL.
-
-xtranslate xpixels
This will cause a X-direction translation of the world coordinate system
relative to the viewport window. It is used primarily to smoothly pan
a plot window using the cursor. The xpixels argument is the number
of pixels to translate in the X-direction. The translation is temporary
and does not effect the xleft and xright world coordinate scales
until xpixels is set to apply, which causes the xleft and
xright world coordinate scales to change to match the current
translated viewport window.
-
-xgain xgain, -xgain_anchor xgain_anchor
These will cause a X-direction temporary scaling of the world coordinate system
relative to the viewport window. It is used primarily to smoothly zoom in or zoom out
a plot window using the cursor. The xgain argument is the X-gain
factor to be applied, with 1.0 preserving the current scale, > 1.0 causing
the plot to zoom in by that factor and < 1.0 causing the plot to zoom out by that factor.
The xgain_anchor argument is the
X-direction pixel coordinate, relative to the parent canvas window, that
should not move in the viewport window. The translation is temporary
and does not effect the xleft and xright world coordinate scales
until xgain is set to apply, which causes the xleft and
xright world coordinate scales to change to match the current
translated viewport window.
-
-ybottom bottomdataWorldcoords
This specifies the Y-axis data value in transformed world coordinates that will map
onto the bottom side of the viewport window. This is normally specified
as a floating number, unless the -ymode option has been specified
as "time", in which case this can be specified as a normal
Antelope absolute time value in any of the forms allowed in str2epoch(3).
Note that this can be set to a NULL value by specifying a NULL string
as the argument. If this is NULL, then the Y-axis data value for scaling
to the bottom edge of the viewport window is automatically determined from
the data as the minimum Y value.
This defaults to NULL.
-
-ytop topdataWorldcoords
This specifies the Y-axis data value in transformed world coordinates that will map
onto the top side of the viewport window. This is normally specified
as a floating number, unless the -ymode option has been specified
as "time", in which case this can be specified as a normal
Antelope absolute time value in any of the forms allowed in str2epoch(3).
Note that this can be set to a NULL value by specifying a NULL string
as the argument. If this is NULL, then the Y-axis data value for scaling
to the top edge of the viewport window is automatically determined from
the data as the maximum Y value.
This defaults to NULL.
-
-ytranslate ypixels
This will cause a Y-direction translation of the world coordinate system
relative to the viewport window. It is used primarily to smoothly pan
a plot window using the cursor. The ypixels argument is the number
of pixels to translate in the Y-direction. The translation is temporary
and does not effect the ybottom and ytop world coordinate scales
until ypixels is set to apply, which causes the ybottom and
ytop world coordinate scales to change to match the current
translated viewport window.
-
-ygain ygain, -ygain_anchor ygain_anchor
These will cause a Y-direction temporary scaling of the world coordinate system
relative to the viewport window. It is used primarily to smoothly zoom in or zoom out
a plot window using the cursor. The ygain argument is the Y-gain
factor to be applied, with 1.0 preserving the current scale, > 1.0 causing
the plot to zoom in by that factor and < 1.0 causing the plot to zoom out by that factor.
The ygain_anchor argument is the
Y-direction pixel coordinate, relative to the parent canvas window, that
should not move in the viewport window. The translation is temporary
and does not effect the ybottom and ytop world coordinate scales
until ygain is set to apply, which causes the ybottom and
ytop world coordinate scales to change to match the current
translated viewport window.
-
-fill fillColor
Specifies a color to use for filling the background of the data viewport
window. Can be specified in any of the forms documented in Tk_GetColor(3).
If this is specified as a NULL string, then no background will be rendered
for the data viewport window.
This defaults to NULL.
-
-fill_frame framefillColor
Specifies a color to use for filling the background of the entire viewport
frame, including both the data viewport and the margin areas.
Can be specified in any of the forms documented in Tk_GetColor(3).
If this is specified as a NULL string, then no background will be rendered
for the viewport frame. Note that the frame is rendered before the data
viewport window so that if both -fill and -fill_frame are specified
then the -fill backrgound will be painted on top of the -fill_frame
background. Also note that if both -fill and -fill_frame are NULL, then
the viewport is invisible.
This defaults to NULL.
BPAXES ITEMS
Bpaxes items are used to display plot axes annotations including the axes
themselves plus tic marks, text labels for the axes, a plot title and
units labels along the axes.
An
bpaxes item is created with the following command:
-
canvaspathName create bpaxes viewportName ?options?
With the following item options:
-
viewportName
This must be the name of the bpviewport item that is used
to determine the sizes and scales of the plot.
The following standard options are supported
by bpaxes items:
The following item options are specific to bpaxes items:
-
-fill_labels labelColor
Specifies a color to use for filling the label fonts.
Can be specified in any of the forms documented in Tk_GetColor(3).
These are the text labels for the axes and the plot title.
This defaults to "black".
-
-fill_numbers numberColor
Specifies a color to use for filling the tic number fonts.
Can be specified in any of the forms documented in Tk_GetColor(3).
These are the tic mark numerical text labels for the axes.
This defaults to "black".
-
-fill_axes axesColor
Specifies a color to use for filling the axes and tic mark lines.
Can be specified in any of the forms documented in Tk_GetColor(3).
This defaults to "black".
-
-font_labels labelFont
Specifies a font to use for displaying the label strings.
Can be specified in any of the forms documented in Tk_GetFont(3).
This defaults to "helvetica 16 bold".
-
-font_numbers numberFont
Specifies a font to use for displaying the numerical strings.
Can be specified in any of the forms documented in Tk_GetFont(3).
This defaults to "helvetica 12".
-
-font_numbers_superscripts superscriptFont
Specifies a font to use for displaying the exponent numerical strings
used in the display of logarithmic axis labels.
Can be specified in any of the forms documented in Tk_GetFont(3).
This defaults to "helvetica 8".
-
-xvisible {0|1}
Specifies if the X-axis axis displays are visible, 1, or
invisible, 0.
This defaults to "1".
-
-yvisible {0|1}
Specifies if the Y-axis axis displays are visible, 1, or
invisible, 0.
This defaults to "1".
-
-linewidth_box boxlineWidth
Specifies the line width for the axes box.
A value of 0 ensures the thinnest possible line.
This defaults to "1".
-
-xlinewidth XticlinebigWidth
Specifies the line width for the X-axis large increment tic lines in pixels.
A value of 0 ensures the thinnest possible line.
This defaults to "1".
-
-xlinewidth_small XticlinesmallWidth
Specifies the line width for the X-axis small increment tic lines in pixels.
A value of 0 ensures the thinnest possible line.
This defaults to "0".
-
-xticlength XticlinebigLength
Specifies the length for the X-axis large increment tic lines in pixels.
This defaults to "10".
-
-xticlength_small XticlinesmallLength
Specifies the length for the X-axis small increment tic lines in pixels.
This defaults to "5".
-
-xincrement incrementXtic
Specifies an increment for the major tic marks on the X-axis
in world coordinate units. If this is set to 0.0, then
the major X-axis tic increments are determined automatically.
This defaults to "0.0".
-
-xincrement_small smallincrementXtic
Specifies an increment for the minor tic marks on the X-axis
in world coordinate units. If this is set to 0.0, then
the minor X-axis tic increments are determined automatically.
This defaults to "0.0".
-
-mindx minimumXtic
This is a minimum size hint for the X-axis major tic mark increment.
It is used to limit how small major tic intervals can be when
the -xincrement option is set to 0.0. This is specified
in units of pixels.
This defaults to "200".
-
-ylinewidth YticlinebigWidth
Specifies the line width for the Y-axis large increment tic lines in pixels.
A value of 0 ensures the thinnest possible line.
This defaults to "1".
-
-ylinewidth_small YticlinesmallWidth
Specifies the line width for the Y-axis small increment tic lines in pixels.
A value of 0 ensures the thinnest possible line.
This defaults to "0".
-
-yticlength YticlinebigLength
Specifies the length for the Y-axis large increment tic lines in pixels.
This defaults to "10".
-
-yticlength_small YticlinesmallLength
Specifies the length for the Y-axis small increment tic lines in pixels.
This defaults to "5".
-
-yincrement incrementYtic
Specifies an increment for the major tic marks on the Y-axis
in world coordinate units. If this is set to 0.0, then
the major Y-axis tic increments are determined automatically.
This defaults to "0.0".
-
-yincrement_small smallincrementYtic
Specifies an increment for the minor tic marks on the Y-axis
in world coordinate units. If this is set to 0.0, then
the minor Y-axis tic increments are determined automatically.
This defaults to "0.0".
-
-mindy minimumYtic
This is a minimum size hint for the Y-axis major tic mark increment.
It is used to limit how small major tic intervals can be when
the -yincrement option is set to 0.0. This is specified
in units of pixels.
This defaults to "100".
-
-linewidth ticlinebigWidth
Shorthand for setting both X and Y axes
line width for the large increment tic lines in pixels.
-
-linewidth_small ticlinesmallWidth
Shorthand for setting both X and Y axes
line width for the small increment tic lines in pixels.
-
-ticlength ticlinebigLength
Shorthand for setting both X and Y axes
lengths for the large increment tic lines in pixels.
-
-ticlength_small ticlinesmallLength
Shorthand for setting both X and Y axes
lengths for the small increment tic lines in pixels.
-
-xlabel labelXaxis
Specifies a label string that is displayed under the X-axis.
This defaults to "".
-
-ylabel labelYaxis
Specifies a label string that is displayed to the left of the Y-axis.
Note that the Y-axis label is rotated 90 degrees counter clockwise.
This defaults to "".
-
-xformat formatXaxis
This specifies a normal printf(3C)-style format string that
determines how the X-axis numerical tic labels are displayed.
If this is "auto", then the format is determined automatically.
If this is "none", then no X-axis numerical labeling will be done.
If this is "time", then X-axis numerical labeling will be done assuming
the X axis is an absolute time axis and the labels will be similar to those
in dbpick(1) and orbmonrtd(1). Note that the "time" format
disables the normal X-axis tic generation and instead draws optional grid time lines.
If the grid time lines are drawn using this format option, then they should not be drawn
for the X-axis using the BPGRID item described below (this can be done with the X-axis
only by using the -visibile_x and -visibile_xsmall options).
This defaults to "auto".
-
-xfill_time_axes timeaxesColor
Specifies a color to use for filling X-axis time grid axes.
This is only used when -xformat is set to "time".
Can be specified in any of the forms documented in Tk_GetColor(3).
This defaults to "black".
-
-xlinewidth_time timelineWidth
Specifies the line width for the time grid axes.
This is only used when -xformat is set to "time".
A value of 0 ensures the thinnest possible line.
A value of -1 will disable display of the X-axis time grid lines.
This defaults to "1".
-
-xtime_format timeFormat
Specifies a format string for labeling the X-axis time values.
This is only used when -xformat is set to "time".
This string is in the style of the time format specifications used by epoch2str(3).
If this string is set to "", then a time label is not displayed.
This defaults to "%T".
-
-xdate_format timeFormat
Specifies a format string for labeling the X-axis date values.
This is only used when -xformat is set to "time".
This string is in the style of the time format specifications used by epoch2str(3).
If this string is set to "", then a date label is not displayed.
This defaults to "%G".
-
-yformat formatYaxis
This specifies a normal printf(3C)-style format string that
determines how the Y-axis numerical tic labels are displayed.
If this is "auto", then the format is determined automatically.
If this is "none", then no Y-axis numerical labeling will be done.
This defaults to "auto".
-
-axis_style axisStyle
This specifies on which sides of the viewport window the axis lines
are to be drawn, with "n" for north (top), "s" for
south (bottom), "e", for east (right), and "w", for
west (left). The characters for each desired side are concatenated
together in the string.
This defaults to "nsew".
-
-tic_style ticStyle
This specifies where and how tic marks will be drawn.
Each entry consists of two characters with the first character
specifying the viewport window side for drawing the tic marks, the
same as the "n", "s", "e", "w" characters
in the -axis_style argument, and the second character specifying one
of "i", to draw the tic marks inside of the viewport
window, "o", to draw the tic marks outside of the
viewport window, or "c", to center the tic marks on the sides of
the viewport window. The characters for each desired side are concatenated
together in the string.
This defaults to "nisieiwi".
BPGRID ITEMS
Bpgrid items are used to display plot grid line annotations. These grid
lines normally are configured to align with the tic marks from an
bpaxes itme.
A
bpgrid item is created with the following command:
-
canvaspathName create bpgrid viewportName ?options?
With the following item options:
-
viewportName
This must be the name of the bpviewport item that is used
to determine the sizes and scales of the plot.
The following standard options are supported
by bpgrid items:
The following item options are specific to bpgrid items:
-
-fill majorgridColor
Specifies a color to use for filling the major grid lines.
Major grid lines normally are aligned with axes item major tic marks.
Can be specified in any of the forms documented in Tk_GetColor(3).
This defaults to "black".
-
-fill_small minorgridColor
Specifies a color to use for filling the minor grid lines.
Minor grid lines normally are aligned with axes item minor tic marks.
Can be specified in any of the forms documented in Tk_GetColor(3).
This defaults to "black".
-
-visible {0|1}
Specifies if the grid line displays are visible, 1, or
invisible, 0.
This defaults to "1".
-
-visible_x {0|1}
Specifies if the X-axis major grid line displays are visible, 1, or
invisible, 0.
This defaults to "1".
-
-visible_xsmall {0|1}
Specifies if the X-axis minor grid line displays are visible, 1, or
invisible, 0.
This defaults to "1".
-
-visible_y {0|1}
Specifies if the Y-axis major grid line displays are visible, 1, or
invisible, 0.
This defaults to "1".
-
-visible_ysmall {0|1}
Specifies if the Y-axis minor grid line displays are visible, 1, or
invisible, 0.
This defaults to "1".
-
-linewidth majorlineWidth
Specifies the line width for the major grid lines in pixels.
A value of 0 insures the thinnest possible line.
This defaults to "1".
-
-linewidth_small minorlineWidth
Specifies the line width for the minor grid lines in pixels.
A value of 0 insures the thinnest possible line.
This defaults to "1".
-
-xincrement incrementXmajor
Specifies an increment for the major grid lines perpendicular to the X-axis
in world coordinate units. If this is set to 0.0, then
the major X-axis increments are determined automatically.
This defaults to "0.0".
-
-xincrement_small incrementXminor
Specifies an increment for the minor grid lines perpendicular to the X-axis
in world coordinate units. If this is set to 0.0, then
the minor X-axis increments are determined automatically.
This defaults to "0.0".
-
-mindx minimumXmajor
This is a minimum size hint for the X-axis major grid increment.
It is used to limit how small major grid increments can be when
the -xincrement option is set to 0.0. This is specified
in units of pixels.
This defaults to "200".
-
-yincrement incrementYmajor
Specifies an increment for the major grid lines perpendicular to the Y-axis
in world coordinate units. If this is set to 0.0, then
the major Y-axis increments are determined automatically.
This defaults to "0.0".
-
-yincrement_small incrementYminor
Specifies an increment for the minor grid lines perpendicular to the X-axis
in world coordinate units. If this is set to 0.0, then
the minor Y-axis increments are determined automatically.
This defaults to "0.0".
-
-mindy minimumYmajor
This is a minimum size hint for the X-axis major grid increment.
It is used to limit how small major grid increments can be when
the -yincrement option is set to 0.0. This is specified
in units of pixels.
This defaults to "100".
BPTEXT ITEMS
Bptext items are used to display general text string annotations. Although there
are default tk canvas items for displaying text, the
bptext item
allows text to be positioned using world coordinates. It also allows
text to be rotated.
A
bptext item is created with the following command:
-
canvaspathName create bptext viewportName textstring x y ?options?
With the following item options:
-
viewportName
This must be the name of the bpviewport item that is used
to determine the sizes and scales of the plot.
-
textstring
The text string to be displayed.
-
x y
The location of the text string relative to the viewport.
These are parsed with Tk_CanvasGetCoord(3) and can be specified
in a variety of units according to the documentation. If specified
as straight numerical strings or any of the forms in Tk_CanvasGetCoord(3),
then x, y are used as device coordinates (i.e. pixels, inches, etc.) relative to the lower left hand
corner of the viewport window.
In addition, there are
a number of other tokens that can be used in defining x and y.
If either ends in "d", then the coordinate is in data world coordinates.
If either ends in "v", then the coordinate is in units of viewport window width or height,
so that x corresponding to the middle of the viewport window would be "0.5v".
A viewport window or viewport frame qualifier, one of
"bottom", for Y-axis viewport window bottom,
"fbottom", for Y-axis viewport frame bottom,
"top", for Y-axis viewport window top,
"ftop", for Y-axis viewport frame top,
"left", for X-axis viewport window left edge,
"fleft", for X-axis viewport frame left edge,
"right", for X-axis viewport window right edge,
"fright", for X-axis viewport frame right edge,
can also be put at the beginning of the
strings to represent anchoring the coordinate to a particular edge of the frame or window.
An example of this would be "top+0.1i" for y which would position the
text 0.1 inches above the top of the viewport window.
The following standard options are supported
by bptext items:
The following item options are specific to bptext items:
-
-fill textColor
Specifies a color to use for filling the text fonts.
Can be specified in any of the forms documented in Tk_GetColor(3).
This defaults to "black".
-
-font textFont
Specifies a font to use for displaying the text string.
Can be specified in any of the forms documented in Tk_GetFont(3).
This defaults to "helvetica 12".
-
-visible {0|1}
Specifies if the text display is visible, 1, or
invisible, 0.
This defaults to "1".
-
-justification textJustification
Specifies how to position the text string relative to
the x, y positioning point for the item. It may have any of
the forms accepted by Tk_GetAnchor(3). For example, if
textJustification is "center" then the text is centered on the
point; if textJustification is "n" then the text will be drawn
so that its top center point is at the positioning
point. This option defaults to "sw".
-
-angle textAngle
This specifies a rotation angle of the text string in degrees counter clockwise
with the reference point being the justification point. A value of 0.0
will display the text in a normal horizontal manner.
This option default to 0.0.
BPPOLYLINE ITEMS
Bppolyline items are used to display sets of X-Y coordinate vectors as either
line plots or as filled polygons.
A
bppolyline item is created with the following command:
-
canvaspathName create bppolyline viewportName ?options?
With the following item options:
-
viewportName
This must be the name of the bpviewport item that is used
to determine the sizes and scales of the plot.
The following standard options are supported
by bppolyline items:
The following item options are specific to bppolyline items:
-
{-vector vectorHandle[:index]|-thistory thistoryHandle|-tr dbPtr}
This specifies the source of the X-Y coordinate data for making the
polyline plot. Data may be represented as vector(3p)
objects, by specifying the -vector argument. Note that an optional
index value can be specified after the vector handle to specify
the index of the dependent variable in vector objects that have more
than one dependent variable (the index starts at 0).
Data may also be represented as time histories represented by history(3p)
objects, by specifying the -thistory argument.
Data may also be represented as a trace database (see perldb(3p)),
by specifying the -tr argument.
Note that all data must be in world coordinates.
-
-fill fillColor
Specifies a color to use for filling the closed polygons.
Can be specified in any of the forms documented in Tk_GetColor(3).
If this is specified as a NULL string (""), then there will be no polygon
filling.
This defaults to "".
-
-outline lineColor
Specifies a color to use for drawing lines.
Can be specified in any of the forms documented in Tk_GetColor(3).
If this is specified as a NULL string (""), then there will be no line
plots.
This defaults to "black".
-
-linewidth lineWidth
Specifies the line width for the lineplots in pixels.
A value of 0 insures the thinnest possible line.
This defaults to "1".
-
-visible {0|1}
Specifies if the polyline display is visible, 1, or
invisible, 0.
This defaults to "1".
BPPOLYPOINT ITEMS
Bppolypoint items are used to display sets of X-Y coordinate vectors as points
that can be displayed with plot symbols and/or text labels.
A
bppolypoint item is created with the following command:
-
canvaspathName create bppolypoint viewportName ?options?
With the following item options:
-
viewportName
This must be the name of the bpviewport item that is used
to determine the sizes and scales of the plot.
The following standard options are supported
by bppolypoint items:
The following item options are specific to bppolypoint items:
-
-vector vectorHandle[:index]
This specifies the source of the X-Y coordinate data for making the
polyline plot. Data must be represented as vector(3p)
objects, by specifying the -vector argument. Note that an optional
index value can be specified after the vector handle to specify
the index of the dependent variable in vector objects that have more
than one dependent variable (the index starts at 0).
Note that all data must be in world coordinates. Each of the plot points
defined in the input vector object may be configured so that the plot
label and plot symbol fill color, outline color and size can be different
for each point. This is done by specifying a label field for each of
the vector points (see vector(3p)). The label for each plot
point can be displayed as a text label if the -showtext option is set
to 1. In order to effect changes in symbol attributes, each vector
point label attribute must also contain tokens in the form
{f=symbolfillColor o=symboloutlineColor sz=symbolSize
sy=symbolType}.
These tokens can appear with or without a text label. For instance,
if a vector point text label is set to
"Apt {f=red o=black sz=20 sy=circle}", then that point's plot symbol,
a circle, will
be filled in red, with a line outline in black, sized to 20 pixels and
a text label of "Apt" will also be displayed. Note that the other symbol
attributes will be the same for all points and generally it is safest to use fill
and/or outline on each symbol the same across the plot points (i.e. don't
try to disable filling for certain points and enable it for others). Also,
the various symbol control tokens may be omitted in the point labels which
causes the default colors and size to be used.
-
-symbol symbolType
This specifies a plot symbol type and must be one of
"point", "cross", "x", "triangle",
"square", "circle", "star", or "diamond".
This defaults to "point".
-
-fill symbolfillColor
Specifies a color to use for filling the plot symbols.
Can be specified in any of the forms documented in Tk_GetColor(3).
If this is specified as a NULL string (""), then the plot symbols will
not be filled.
This defaults to "".
-
-outline symboloutlineColor
Specifies a color to use for drawing the plot symbol outlines.
Can be specified in any of the forms documented in Tk_GetColor(3).
If this is specified as a NULL string (""), then there will be no
symbol outlines drawn.
This defaults to "black".
-
-linewidth lineWidth
Specifies the line width for the symbol outlines in pixels.
A value of 0 insures the thinnest possible line.
This defaults to "1".
-
-textforeground textColor
Specifies a color to use for displaying the label text fonts.
Can be specified in any of the forms documented in Tk_GetColor(3).
This defaults to "black".
-
-font textFont
Specifies a font to use for displaying the label text strings.
Can be specified in any of the forms documented in Tk_GetFont(3).
This defaults to "helvetica 12".
-
-size symbolSize
Specifies a size in pixels for the plot symbols.
This defaults to 5.
-
-visible {0|1}
Specifies if the polypoint display is visible, 1, or
invisible, 0.
This defaults to 1.
-
-showsymbols {0|1}
Specifies if the polypoint symbol displays are visible, 1, or
invisible, 0.
This defaults to 1.
-
-showtext {0|1}
Specifies if the polypoint label text strings are visible, 1, or
invisible, 0.
This defaults to 0.
BPMAP ITEMS
Bpap items are used to display geographic base maps. These are rendered
as filled complex polygons consisting of vector shoreline data that makes
use of the GSHHS data in the Antelope distribution and the
gshhsmap(3)
utility for accessing this map database. In addition, rivers and political
boundaries can also be displayed as polyline plots. These data come from the
GMT NetCDF files in the Antelope distribution and the Antelope
netcdf(3) routines
are used to access these data. Note that typically maps are displayed in
viewports with the
-wtran option set to "
merc" or "
edp".
A
bpmap item is created with the following command:
-
canvaspathName create bpmap viewportName ?options?
With the following item options:
-
viewportName
This must be the name of the bpviewport item that is used
to determine the sizes and scales of the plot.
The following standard options are supported
by bpmap items:
The following item options are specific to bpmap items:
-
-fill_land landfillColor
Specifies a color to use for filling land areas.
Can be specified in any of the forms documented in Tk_GetColor(3).
If this is specified as a NULL string, then land areas will not be filled.
This defaults to "#fff2e5".
-
-fill_water waterfillColor
Specifies a color to use for filling water areas.
Can be specified in any of the forms documented in Tk_GetColor(3).
If this is specified as a NULL string, then water areas will not be filled.
This defaults to "#e0e0ff".
-
-resolution Resolution
This specifies the resolution for the map data to be displayed
and must be one of "auto", for automatically switch the
map resolution according to the amount of the Earth's surface being
displayed, or
"crude", "low", "intermediate", "high", "full".
This defaults to "auto".
-
-coasts coastOutlinespecs
This is used to determine the color and linewidth for displaying coastlines
as polylines and must be in the form <colorspec>:<linewidth>, where
<colorspec> is a normal perltk color specification and <linewidth>
is a line width in pixels. Note that if the line width is set to -1, then the
coastlines will not be displayed.
This defaults to "black:-1".
-
-rivers riverOutlinespecs
This is used to determine the color and linewidth for displaying rivers
as polylines and must be in the form <colorspec>:<linewidth, where
<colorspec> is a normal perltk color specification and <linewidth>
is a line width in pixels. Note that if the line width is set to -1, then the
rivers will not be displayed.
This defaults to "#c0c0ff:1".
-
-political politicalOutlinespecs
This is used to determine the color and linewidth for displaying political boundaries
as polylines and must be in the
form <level1>:<color1>:<lw1>[,<level2>:<color2>:<lw2>[...]] where
<level1> is a boundary level (1 = national boundary, 2 = provencial/state
boundary, etc.),
<color1> is a normal perltk color specification and <lw1>
is a line width in pixels.
Multiple specifications for different levels can be concatenated together
with a "," delimiter. Note that if the line width is set to -1, then the
associated boundaries will not be displayed.
This defaults to "1:#ff0000:3,2:#00a000:1,3:#ff00ff:0".
-
-visible {0|1}
Specifies if the map display is visible, 1, or
invisible, 0.
This defaults to "1".
BPTRACE ITEMS
Bptrace items are used to display single waveform traces.
A
bptrace item is created with the following command:
-
canvaspathName create bptrace viewportName ?options?
With the following item options:
-
viewportName
This must be the name of the bpviewport item that is used
to determine the sizes and scales of the plot.
The following standard options are supported
by bptrace items:
The following item options are specific to btrace items:
-
{-scg scgHandle|-tr dbPtr}
This specifies the source of the waveform data for making the
trace plot. Waveform data must be represented as scg(3p)
station-channel-gather objects, by specifying the -scg argument, or as
a trace database (see perldb(3p)),
by specifying the -tr argument.
-
-foreground foregroundColor
Specifies a foreground color to use for making the trace plot lines.
Can be specified in any of the forms documented in Tk_GetColor(3).
This defaults to #ffff00, which is yellow.
-
-background backgroundColor
Specifies a background color to use for filling the region behind the trace plots.
Can be specified in any of the forms documented in Tk_GetColor(3).
This defaults to #000080, which is dark blue.
-
-postscript_foreground postscriptForegroundColor
Specifies a foreground color to use for making the trace plot lines in the postscript displays.
Can be specified in any of the forms documented in Tk_GetColor(3).
This defaults to NULL which means use the same color as -foreground.
-
-postscript_background postscriptBackgroundColor
Specifies a background color to use for filling the region behind the trace plots in the postscript displays.
Can be specified in any of the forms documented in Tk_GetColor(3).
This defaults to NULL which means use the same color as -background.
-
-linewidth lineWidth
Specifies the width of the trace plot lines in pixels.
This defaults to 1.
-
-postscript_linewidth postscriptLineWidth
Specifies the width of the trace plot lines in pixels in the postscript displays.
This defaults to 1.
-
-again AmpGain
This specifies a trace amplitude gain factor.
This defaults to 1.0.
-
-ybottom YBottom
-
-ytop YTop
These specify trace amplitude plot scales corresponding to the bottom and top of the plot.
These default to 0.0.
-
-ascale_mode {auto|fixed}
This specifies the trace amplitude scaling mode and must be one of auto, for auto scaling, or
fixed, for fixed scales using the -ybottom and -ytop options.
This defaults to auto.
BPTRACEPANEL ITEMS
Bptracepanel items are used to display multiple waveform traces in a single item.
This canvas item is different from the other buplot canvas items inthat the viewport
functionality relating to plot scaling is unused. Viewport size and margins are still honored.
The plot scaling in time, the position of the traces vertically and the trace amplitude scaling are
all done within the
bptracepanel items themselves. A fundamental restriction of
this canvas item is that every trace is displayed with the same time scaling (subject to
time offsets defined by
-data_timeoffset below).
Trace data being accumulated with this canvas item are pre-pixelated into buffers that
correspond to the horizontal (time) pixel range being displayed. Certain display functions
can be quickly executed from these pixelated buffers as long as the time scaling has
not changed. These functions include trace amplitude scaling, trace plot mode changes (see adisplay_mode
below) and changing of trace vertical positions and heights.
A bptracepanel item is created with the following command:
-
canvaspathName create bptracepanel viewportName ?options?
With the following item options:
-
viewportName
This must be the name of the associated bpviewport item. For bptracepanel items
the scaling is all done within the item itself and the viewport scales are ignored.
The following item options are specific to btracepanel items:
-
-orb t=orbtag[,o=orbname][,s=select][,r=reject][,a=tafter][,f=filter]
This specifies an ORB data source. The t=orbtag field must always be specified
and defines a unique tag or name for an ORB data source. the o=orbname field
specifies an ORB name in standard form. This field must be present if the
orbtag has not been already specified in a previous call. If the orbtag references
an already existing data source, then the orbname field should not be specified.
The s=select, r=reject and a=tafter fields are optional and will cause orbselect(3),
orbreject(3), or orbafter(3) commands to be sent to the orbserver. The f=filter field
is optional and will cause the ORB channel data streams to be pre-filtered. These commands
can be either specified when creating a new data source or for a source that has
already been created. Note that multiple ORB data sources can be configured by using
multiple itemconfig commands.
-
-python_callback script_proceedure_name
This is used in conjunction with the -orb ORB data source configuration option.
This causes a python proceedure with the name script_proceedure_name to be called
whenever an apparent new channel of data is read from the ORB data sources.
The user defined python script will be called with a single string argument
that will be set to "net_sta_chan[_loc] orbtag tstart tend", where net_sta_chan[_loc]
is the SEED code for the channel, orbtag is the orbtag value defined in the -orb
option, tstart and tend are the start and end times of the data packet.
The script should return a single string set to "Unused", meaning the
channel is not used for any trace plots, "Used", meaning the channel has
already been processed and is used for one or more trace displays, or an index
string (see the -index option below) that will be used to create a new trace.
If more than one trace display will be created from the same data packet, then
the output string should consist of a set of whitespace separated index codes.
The callback Python proceedure should not be an object method unless it is a
class method. This callback is obviously only useful when the widget is being used
through the Python Tkinter extension. It is imperative that no Tkinter calls
be made within the callback proceedure. Such calls will result in Python
GIL lockouts or other problems. If new trace displays are to be created, the
Python callback must place the new index values into a cache and process these
later in the normal event driven processing callbacks.
-
-action {clear|rerender}
If this is clear, then all of the pixelated buffers are cleared and the
displays are set to the background color.
If this is rerender, then all of the pixelated buffers are re-rendered
into the display window using the current configuration options.
-
-twin timeWindow
This specifies the total time duration in seconds of the panel canvas. Note
that the canvas can be larger than the displayed region. This must be specified
before any trace sample values are input.
-
-tscroll_offset timeScrollOffset
This is a scrolling offset in seconds applied to the panel canvas to position
it within the display region. A value of 0.0 will cause the right-most
edge of the canvas (the most recent time) to be aligned with the right-most edge of the
display region. This defaults to 0.0.
-
-yscroll_offset yScrollOffset
This is a scrolling offset in pixels applied to the panel canvas to position
it within the display region. A value of 0.0 will cause the top-most
edge of the canvas to be aligned with the top-most edge of the
display region. This defaults to 0.0.
-
-autoscale_update_interval Autoscale_update_interval
This is an update time interval in seconds that controls how often automatic amplitude scaling
is performed for the pixelated trace buffers. If this is set to 0, regular automatic
amplitude scaling will not be done.
This defaults to 10.0.
-
-width width
This is the total width of the panel canvas in pixels and can be larger than the
displayed region.
-
-x x
This is an X offset in pixels of the display region relative to the viewport.
-
-panel_height PanelHeight
This is the total height of the bptracepanel display pixmap in pixels and
controls whether or not individual display pixmaps are created for each trace.
If it is set to 0, then individual pixmaps are created for each trace. In this
mode, the individual trace pixmap heights are determined by the -height options for
each trace (see below) and each if the trace plots will always clip at the bounds of each of the individual trace pixmaps.
If -panel_height is set to a positive integer, then a single pixmap of this height
is used to display all of the traces. In this mode, trace plots are only clipped by the entire bptracepanel
display pixmap and can overlap each other in amplitude.
This defaults to 0.0.
-
-tlabel_height timeLabelHeight
This is the height in pixels of the timing labels. This is typically only used
with a citemget command to retrieve the height for setting canvas dimensions.
The label height is usually set automatically according to the time label font
height.
-
-timeright timeRight
This is the epochal time value corresponding to the right edge of the canvas panel.
-
-timeupdate_interval Time_update_interval
This is an update time interval in seconds that controls how often automatic time scrolling
will take place. During automatic time scrolling, the right edge of the display is automatically set to
the current system clock time plus a buffer value defined in the -timefuture option.
If this is set to 0, regular automatic time scrolling will not be done.
This defaults to 0.0.
-
-timefuture Time_future
This is a time interval in seconds used in conjunction with the -timeupdate_interval
option for defining the right edge time value of the display. When trying to plot real-time
data with the right edge of the display close to the current time, it is important that -timefuture
be set large enough to accomodate all spurious data with time tags in the future. Otherwise,
plotting artifacts will appear.
This defaults to 0.0.
-
-foreground_tmark foregroundTimeMark
This is the foreground color of the timing annotation grid.
Can be specified in any of the forms documented in Tk_GetColor(3).
This defaults to #8080ff.
-
-foreground_tmark_now foregroundTimeMarkNow
This is the foreground color of the timing annotation line used to mark the current time.
Can be specified in any of the forms documented in Tk_GetColor(3).
This defaults to red.
-
-foreground_tlabel foregroundTimeLabel
This is the foreground color of the timing annotation labels.
Can be specified in any of the forms documented in Tk_GetColor(3).
This defaults to black.
-
-background_tlabel backgroundTimeLabel
This is the background color of the timing annotation labels.
Can be specified in any of the forms documented in Tk_GetColor(3).
This defaults to #ffddff.
-
-time_font fontTimeLabel
This is the font used for the timing annotations.
Can be specified in any of the forms documented in Tk_GetFont(3).
This defaults to "helvetica 12 bold".
-
-tlabel_visible {0|1}
This controls whether or not the time text labels are visible.
-
-tmark_now_visible {0|1}
This controls whether or not the
timing annotation line used to mark the current time is visible.
-
-index displayIndex
This is used to create a new trace display within the canvas panel, or to change the attributes
of an existing trace display. Each trace display must have a uniquely assigned dispayIndex
character string that identifies that trace display. If a trace display with
index displayIndex does not exist, then it is created. All of the following
options relate to single trace displays and must have the -index option
specified in the same itemconfig command.
-
{-nscl nscl,orbtag|-vector vectorHandle}
This specifies the source of waveform data. If it is -nscl, then data comes from one of the ORB sources
specified through the -orb option. The nscl field is the SEED net_sta_chan[_loc]
code and the orbtag field is used to match the particular ORB source. This causes
the ORB packet reading to be routed automatically to the tk widget without the
need for script processing. If this is -vector, then
the waveform data must be represented as tclvector(3t)
time sampled data objects and each new vector object requires a new itemconfig call in the
calling script.
-
-filter filterString
This is a standard Antelope filter string specification for a filter
to be applied to the trace data before it is displayed. See wffil(3),
wffilbrtt(3) and wffilave(3) for examples of filter string specifications.
-
-foreground foregroundColor
Specifies a foreground color to use for making the trace plot line.
Can be specified in any of the forms documented in Tk_GetColor(3).
This defaults to #ffff00, which is yellow.
-
-background backgroundColor
Specifies a background color to use for filling the region behind the trace plots.
Can be specified in any of the forms documented in Tk_GetColor(3).
This defaults to #000080, which is dark blue.
-
-background_nodata backgroundNodataColor
Specifies a background color to use for filling the region during time intervals where trace
data does not exist (there are gaps).
Can be specified in any of the forms documented in Tk_GetColor(3).
This defaults to #6060ff, which is light blue.
-
-postscript_foreground postscriptForegroundColor
Specifies a foreground color to use for making the trace plot lines in the postscript displays.
Can be specified in any of the forms documented in Tk_GetColor(3).
This defaults to NULL which means use the same color as -foreground.
-
-postscript_background postscriptBackgroundColor
Specifies a background color to use for filling the region behind the trace plots in the postscript displays.
Can be specified in any of the forms documented in Tk_GetColor(3).
This defaults to NULL which means use the same color as -background.
-
-linewidth lineWidth
Specifies the width of the trace plot lines in pixels.
This defaults to 1.
-
-postscript_linewidth postscriptLineWidth
Specifies the width of the trace plot lines in pixels in the postscript displays.
This defaults to 1.
-
-y y
This is the distance from the top of the panel canvas in pixels where the top of this
trace display should be anchored.
-
-height height
This is the height of this trace display in pixels.
-
-data_timeoffset data_timeoffset
This is a time offset value in seconds that is added to each of the data time tags before display.
This defaults to 0.0.
-
-again AmpGain
This specifies a trace amplitude gain factor.
This defaults to 1.0.
-
-ybottom YBottom
-
-ytop YTop
These specify trace amplitude plot scales corresponding to the bottom and top of the trace display height.
These default to 0.0.
-
-ascale_mode {autof|fixed}
This specifies the trace amplitude scaling mode and must be one of autof, for auto scaling, or
fixed, for fixed scales using the -ybottom and -ytop options. In autof mode,
the first data input after the scale is set is used to determine mon and max scales automatically
and then the scale mode is set back to fixed automatically.
This defaults to fixed.
-
-atran_mode {lin|log}
This specifies the trace amplitude transformations and must be one of lin, for linear (no) transformation, or
log, for base 10 logarithmic transformation of the absolute value of the trace samples.
This defaults to lin.
-
-adisplay_mode {trace|color}
This specifies the how the trace is displayed and must be one of trace, for a normal line "wiggle" plot, or
color, for a color contour representation of the trace amplitude values.
This defaults to trace.
BPDATAGRID ITEMS
Bpatagrid items are used to display rectilinear data grids, as defined in
bugrid(3),
as color contours with optional alpha blending onto an underlying color image, such as a map, and with
the ability to project the grid mesh onto various map projections and to do on-the-fly slowness to distance
transformations using standard travel time functions.
A
bpdatagrid item is created with the following command:
-
canvaspathName create bpdatagrid viewportName ?options?
With the following item options:
-
viewportname
This must be the name of the bpviewport item that is used
to determine the sizes and scales of the plot.
The following standard options are supported
by bpdatagrid items:
The following item options are specific to bpdatagrid items:
-
-grid {gridHandle|test}
This specifies the source of the data grid for making the
grid color contour plots. Grid data must be represented as bugrid(3) handles.
If the value of gridHandle is test, then a test grid is generated internally
using the various -test_... options defined below.
-
-visible {0|1}
Specifies if the data grid color contour is visible, 1, or
invisible, 0.
This defaults to "1".
-
-caching {0|1}
Specifies if background image caching is enabled, 1, or
disabled, 0. Background image caching is described below.
This defaults to "1".
-
-cache_background {0|1}
This specifies a flag that controls how underlying background images are processed. When alpha
blending is used, the underlying background image must be retrieved from the Xserver so that
the colors can be blended on a pixel-by-pixel basis and this retrieval can result in
significant performance degradation. Datagrid items automatically cache underlying background
images between rendering calls and will use the cached image instead of requesting a new image from
the Xserver according to this flag. This flag should be cleared whenever the background image
needs to be retrieved, causing the cached image to be reset, and set whenever the cached version of
the background image should be used without retrieving from the Xserver.
-
-cache_trans {0|1}
This specifies a flag that controls how on-the-fly grid mesh transformations are processed.
Whenever grid mesh transformations take place, such as transforming a grid mesh of Cartesian
slowness values into the display pixel mesh using travel time functions and appropriate
mapping projections, this process can result in significant performance degradation.
Datagrid items automatically cache the transformation values for each display pixel that
relates the display pixel to a coordinate pair in the original data grid coordinate system.
This allows new grid surfaces to be quickly mapped onto the display pixel grid as long as
the grid mesh and the display mapping has not changed.
This flag should be cleared whenever the transformation
needs to be recalculated, and set whenever the cached version of
the transformation can be used.
-
-gtran {none|edp|slowness}
This defines what, if any, transformation should be applied to the grid mesh in order
to display it properly in the final display coordinates. This should be one of none,
for no transformation, edp, for a grid mesh that was originally defined on a rectilinear
mesh of Cartesian distance values using an equal distance map projection and needs to be
transformed into whatever map projection is defined by the viewport window, or slowness,
for a grid mesh that was originally defined on a rectilinear
mesh of Cartesian slowness values and needs to be projected onto
whatever map projection is defined by the viewport window.
This defaults to none.
-
-frame datagridFrame
This specified the particular time sample to be displayed.
This defaults to 0.
-
-zmin zminScale
-
-zmin_color zminColor
-
-zmax zmaxScale
-
-zmax_color zmaxColor
These defines how the grid surface is mapped into color contours. The surface color specified by -zmin_color
will correspond to a surface dependent
variable value specified by -zmin and similarly for -zmax_color and -zmax.
-
-dz dzScale
This specifies an incremental value of the grid dependent variable that will define where colors change.
If this is set to 0.0, then the colors will change continuously. Colors are blended between
the colors specified by -zmin_color and -zmax_color according to the value of the grid dependent
variable and the scale factors specified by -zmin and -zmax. Color values for grid dependent variable
values that are outside of the range specified by -zmin, -zmax are clipped to the
color values specified by -zmin_color, -zmax_color.
This defaults to 0.0.
-
-blend_mode {overlay|blend}
This defines how the data grid colors should be blended onto the underlying image and should
be one of overlay, which cases the color contour to completely obscure the underlying image,
or blend, which causes a pixel-by-pixel color blending of the color contour and the underlying
image (aka alpha blending).
this defaults to overlay.
-
-interp_mode {block|bilinear}
This defines how the data grid dependent data values are interpolated within the
original data grid mesh. This must be one of block or bilinear (see bugrid(3)).
this defaults to bilinear.
-
-test_xmin testgridXmin
-
-test_xmax testgridXmax
-
-test_nx testgridNx
-
-test_ymin testgridYmin
-
-test_ymax testgridYmax
-
-test_ny testgridNy
These define the test grid mesh and are only used when -grid is specified as test.
These default to 0.0, 1.0, 33, 0.0, 1.0, 33.
-
-slat sourceLatitude
-
-slon sourceLongitude
-
-sdepth sourceDepth
-
-method traveltimeMethod
-
-model traveltimeModel
-
-phase traveltimePhase
These define the source latitude-longitude-depth and the travel time method, model and
phase code (see tt(3)) for making slowness grid mesh transformations and are only
used when -gtran is specified as slowness.
These default to 0.0, 0.0, 0.0, tttaup, iasp91, P.
-
-rlat referenceLatitude
-
-rlon referenceLongitude
-
-xstrike referenceXStrike
These define the reference latitude-longitude and the strike of the grid mesh X-axis
for making equal distance projection grid mesh transformations and are only
used when -gtran is specified as edp.
These default to 0.0, 0.0, 90.0.
EXAMPLES
Following is an example for using most of the
Buplot item
extensions.
% cat testbpgraph
#!/bin/sh
# This comment extends to the next line for tcl \
exec awish $0 -- $*
# This is a tcl script for testing most of the Buplot
# package canvas widget item extensions
# need Buplot backage
package require Buplot
# package require Tclx
# first we create a frame
frame .f
# now a normal tk canvas widget
canvas .f.c -width 800 -height 800
# All Buplot items must be associated with a
# Buplot 'viewport" item, so we create a viewport
# item, in the manner we would create any other canvas
# item, and we give it name "myvp". We set the width
# and hight to 0, meaning that the viewport width
# and height should be the same as the canvas
# dimensions and should change whenever the canvas
# is resized. We also set the world coordinate to
# device coordinate scaling (with -xleft, etc.)
# and some margins and some background fill colors.
.f.c create bpviewport myvp 0 0 \
-width 0 -height 0 \
-xleft 0.0 -xright 5.0 \
-ybottom -1.1 -ytop 1.1 \
-mleft 80 -mright 20 \
-mbottom 50 -mtop 30 \
-fill_frame lightblue \
-fill white -tag vp
# Next we create an "axes" item and associate it
# with our viewport. We set some axis labels, format
# strings for printing out the axis numerical
# annotations and styles for the axes and tic marks.
.f.c create bpaxes myvp \
-xformat "%.1f" \
-yformat "%.1f" \
-axis_style sw \
-tic_style siwinoeo \
-xlabel "My X-stuff" \
-ylabel "My Y-stuff"
# Now we create a "grid" item and associate it
# with our viewport. This will display plot grid
# lines. Note that the order of item creation
# determines the order in which it is drawn, so
# the grid lines will be drawn after the axis
# annotations.
.f.c create bpgrid myvp \
-linewidth 2 \
-fill black \
-fill_small gray
# Now a "ptext" item that we use for drawing a
# plot title. Note the "v" and "top" tokens in the
# x-y position arguments.
.f.c create bptext myvp "My text" 0.5v top+0.1i \
-fill red \
-font "Helvetica 14 bold" \
-justification s \
-angle 0
# We finally get around to plotting some data
# with a "polyline" item. Here we are using the
# builtin test polyline which is an exponential
# decaying sinusoid.
.f.c create bppolyline myvp -test \
-outline blue \
-linewidth 3
# It is more interesting to build up our own data,
# so we can do this with a perl Vector object (from
# the extended vector... perl commands). Here we
# create a vector named "myvec" and add four points
# to it. We also make sure the vector point label
# attributes are specified. These labels can be used
# by "bppolypoint" items to appear as text labels and
# to affect the plot symbol attributes.
package require Vector
global vec
set vec [vector_create]
vector_append $vec -1 0.1 0.6 "Apt {f=magenta sz=10 sy=circle}"
vector_append $vec -1 1.9 0.4 "Bpt {f=darkblue sz=30 sy=square}"
vector_append $vec -1 0.3 0.9 "Cpt {f=white o= sz=20 sy=star}"
vector_append $vec -1 0.4 0.8 "Dpt {f=black o=orange sz=15}"
# We create another "bppolyline" item and plot the
# data from our newly created vector. In this case we
# specify a fill color which causes the polyline to
# define the boundary of a complex polygon and to be
# filled with the color yellow. We also render the
# polyline outline of the polygon with the color red.
# Note that when a polyline is filled in this way
# that the first point is automatically added to the
# end of the polyline to close the polygon.
.f.c create bppolyline myvp \
-vector $vec \
-fill "yellow" \
-outline "red" \
-linewidth 2 \
-tags "vectorpl"
# Now we create a "bppolypoint" item, using the same vector,
# that will display plot symbols and labels at each of the
# points in the vector. We set some default attributes for
# drawing the plot symbols. However, the label fields in the
# vector object contain special tokens that are interpreted
# by the "polypoint" item as plot symbol attributes that can
# be different for each point. In this way it is possible
# to code in individual changes to plot symbol color and
# size as a function of some other variable (e.g., you
# could use this to set up a vector of earthquake coordinates
# with symbol color and size coded by depth and magnitude).
.f.c create bppolypoint myvp \
-vector $vec \
-symbol "triangle" \
-fill "white" \
-outline "green" \
-font "helvetica 12 bold" \
-textforeground "brown" \
-linewidth 2 \
-showtext 1 \
-tags "vectorpp"
grid configure .f.c -column 0 -row 0 -sticky nsew
grid configure .f -column 0 -row 0 -sticky nsew
grid rowconfigure .f 0 -weight 1
grid columnconfigure .f 0 -weight 1
grid rowconfigure . 0 -weight 1
grid columnconfigure . 0 -weight 1
# Now lets bind right mouse button events
# The idea is to be able to pan the plot region by
# dragging the right mouse button
proc bindstartpandrag {x y} {
global xstart
global ystart
set xstart $x
set ystart $y
}
proc bindpandrag {w x y} {
global xstart
global ystart
set delx [expr $xstart - $x]
set dely [expr $ystart - $y]
$w itemconfigure "vp" -xtranslate $delx -ytranslate $dely
}
proc bindstoppandrag {w} {
$w itemconfigure "vp" -xtranslate "apply" -ytranslate "apply"
}
bind .f.c <ButtonPress-3> "bindstartpandrag %x %y"
bind .f.c <Button3-Motion> "bindpandrag %W %x %y"
bind .f.c <ButtonRelease-3> "bindstoppandrag %W"
# Now shift-right mouse button
# will cause the plot to zoom in and out
# while dragging the shift-right mouse button
proc bindstartzoomdrag {w x y} {
global xstart
global ystart
set xstart $x
set ystart $y
$w itemconfigure "vp" -xgain_anchor $xstart -ygain_anchor $ystart
}
proc bindzoomdrag {w x y} {
global xstart
global ystart
set delx [expr $xstart - $x]
set dely [expr $ystart - $y]
set xgain [expr 1.0 + $delx * 0.001]
set ygain [expr 1.0 + $dely * 0.001]
if {$xgain <= 0.0} {set xgain 0.001}
if {$ygain <= 0.0} {set ygain 0.001}
$w itemconfigure "vp" -xgain $xgain -ygain $ygain
}
proc bindstopzoomdrag {w} {
$w itemconfigure "vp" -xgain "apply" -ygain "apply"
}
bind .f.c <Shift-ButtonPress-3> "bindstartzoomdrag %W %x %y"
bind .f.c <Shift-Button3-Motion> "bindzoomdrag %W %x %y"
bind .f.c <Shift-ButtonRelease-3> "bindstopzoomdrag %W"
# Finally left mouse button
# will select a close plot point in the polypoint
# displat and dragging the left mouse button will
# move the point
proc bindstartpointdrag {win w x y} {
global dragwindow
if {[info exists dragwindow] != 0} {unset dragwindow}
set l [buplot_locatevp $win $x $y "getentries"]
set vp [lindex $l 0]
set inside [lindex $l 1]
# $inside is set if the polypoint was inside of the viewport plot area
if {[info exists vp] == 0} {return}
if { $inside == 0 } {return}
# get the closest polypoint out of @entries
global index
set entry [lindex $l 2]
set index [lindex $entry 1]
set dist [lindex $entry 2]
# see if it is close enough
if { $dist > 20.0 } { return }
# close enough, get the plot coordinates and warp cursor
set dragwindow $vp
global vec
set l [vector_get $vec xy $index]
set xwc [lindex $l 0]
set ywc [lindex $l 1]
set label [lindex $l 2]
set l [buplot_wcoords2pixels $vp $xwc $ywc]
set x [expr int([lindex $l 0])]
set y [expr int([lindex $l 1])]
event generate $w <Motion> -warp 1 -x $x -y $y
# set the point fill color to something indicating it is being moved
global labelsave
set labelsave $label
regsub "\}" $label " o=red\}" label
vector_puty $vec $index $ywc $label
global mycanvas
$w itemconfigure "vectorpp" -vector $vec
}
proc bindpointdrag {w x y} {
global dragwindow
if {[info exists dragwindow] == 0} {return}
set l [buplot_pixels2wcoords $dragwindow $x $y]
set xwc [lindex $l 0]
set ywc [lindex $l 1]
global vec
global index
vector_put $vec $index $xwc $ywc
$w itemconfigure "vectorpp" -vector $vec
$w itemconfigure "vectorpl" -vector $vec
}
proc bindstoppointdrag {w x y} {
global dragwindow
if {[info exists dragwindow] == 0} {return}
set l [buplot_pixels2wcoords $dragwindow $x $y]
set xwc [lindex $l 0]
set ywc [lindex $l 1]
global labelsave
global vec
global index
vector_put $vec $index $xwc $ywc $labelsave
$w itemconfigure "vectorpp" -vector $vec
$w itemconfigure "vectorpl" -vector $vec
unset dragwindow
}
bind .f.c <ButtonPress-1> "bindstartpointdrag %i %W %x %y"
bind .f.c <Button1-Motion> "bindpointdrag %W %x %y"
bind .f.c <ButtonRelease-1> "bindstoppointdrag %W %x %y"
# We update everything to get the display rendered on the
# screen
update idletasks
# And finally we make a postscript printout of the display
# using the standard canvas postscript command.
.f.c postscript -pageheight 8i -rotate true -file testbuplot.ps
Following is an example for using the bpmap item abd plotting
some earthquake locations.
% cat testbpmap
#!/bin/sh
# This comment extends to the next line for tcl \
exec awish $0 -- $*
# This is a tcl script for testing most of the Buplot
# package mapping capabilities
# need Buplot backage
package require Buplot
# need Datascope package for bringing in
# some earthquake coordinates
package require Datascope
# need Vector package for housing coordinate points
package require Vector
proc balloon_make {w text x y} {
if [info exists y] {
set id [$w create text $x $y -text $text -tag balloon]
foreach {x0 y0 x1 y1} [$w bbox $id] break
set xc [expr 0.5*($x1-$x0)]
set yc [expr 0.5*($y1-$y0)]
set x0 [expr $x0+$xc]
set y0 [expr $y0+$yc]
set x1 [expr $x1+$xc]
set y1 [expr $y1+$yc]
$w move $id $xc $yc
$w create rect $x0 $y0 $x1 $y1 -fill lightyellow -tag balloon
$w raise $id
}
}
# this procedure will display the current
# position of the mouse in units of latitude
# and longitude
proc showlatlon {win x y} {
set l [buplot_locatevp $win $x $y]
set vp [lindex $l 0]
set inside [lindex $l 1]
global latlon
# if the mouse is not inside a plot region, clear the display
if { $inside == 0 } {
set latlon ""
return
}
# set the display
set l [buplot_pixels2wcoords $vp $x $y]
set lon [lindex $l 0]
set lat [lindex $l 1]
if {$lat < 0.0} {
set lat [format "S%06.3f" [expr -$lat]]
} else {
set lat [format "N%06.3f" $lat]
}
if {$lon < 0.0} {
set lon [format "W%07.3f" [expr -$lon]]
} else {
set lon [format "E%07.3f" $lon]
}
set latlon [format "%s %s" $lat $lon]
}
# this procedure will move (pan) the edp viewport
# map reference lat-lon to a point specified by
# a canvas coordinate
proc panmap {vp x y} {
set l [buplot_pixels2wcoords $vp $x $y]
set lon [lindex $l 0]
set lat [lindex $l 1]
if { $vp == "vp" } {
.f.c itemconfigure $vp -latr $lat -lonr $lon
} else {
set xl [.f.c itemcget $vp -xleft]
set xr [.f.c itemcget $vp -xright]
set yb [.f.c itemcget $vp -ybottom]
set yt [.f.c itemcget $vp -ytop]
set lonr [expr ($xr-$xl)]
set latr [expr ($yt-$yb)]
set xl expr[$lon - 0.5*$lonr]
set xr expr[$lon + 0.5*$lonr]
set yb expr[$lat - 0.5*$latr]
set yt expr[$lat + 0.5*$latr]
while { $xr > 180.0 } {
set xl [expr $xl-360.0]
set xr [expr $xr-360.0]
}
while { $xl < -360.0 } {
set xl [expr $xl+360.0]
set xr [expr $xr+360.0]
}
.f.c itemconfigure $vp -xleft $xl -xright $xr -ybottom $yb -ytop $yt
}
}
# this procedure binds to left mouse clicks
# and will find the closest event, warp the cursor
# to the event and bring up a balloon that describes
# the event
proc bindfindclosest {win w x y} {
set l [buplot_locatevp $win $x $y "getentries"]
set vp [lindex $l 0]
set inside [lindex $l 1]
# $inside is set if the event was inside of the viewport plot area
if { $inside == 0 } {return}
# get the events vector index out of entries
set entry [lindex $l 2]
set item [lindex $entry 0]
set index [lindex $entry 1]
set v [$w itemcget $item -vector]
# get the events lat-lon and warp the cursor to that lat-lon
set l [vector_get $v xy $index]
set lon [lindex $l 0]
set lat [lindex $l 1]
set label [lindex $l 2]
set l [buplot_wcoords2pixels $vp $lon $lat]
set x [expr int([lindex $l 0])]
set y [expr int([lindex $l 1])]
event generate $w <Motion> -warp 1 -x $x -y $y
# get event info and attach the balloon
global db
set l [dbgetv $db 0 $index "time" "depth" "mb"]
set time [lindex $l 0]
set depth [lindex $l 1]
set mb [lindex $l 2]
set msg [format "time : %s\nlat : %.5f\nlon : %.5f\ndepth : %.1f\nmb : %.1f"
[strtime $time] $lat $lon $depth $mb]
# cancel any old balloon expires
$w delete balloon
global afterid
if {[info exists afterid]} {
after cancel $afterid
unset afterid
}
# set balloon position and attach balloon
balloon_make $w $msg $x $y
# this bit causes the balloon to "expire" after 5 seconds
set afterid [after 5000 [list $w "delete" "balloon"]]
}
proc bindpanmap {win x y} {
set l [buplot_locatevp $win $x $y]
set vp [lindex $l 0]
set inside [lindex $l 1]
if { $inside == 1 } {panmap $vp $x $y}
}
# this procedure will zoom in/out either of the
# map viewports according to a factor. The x y
# canvas coordinate is used to determine which
# viewport to zoom.
proc zoommap {vp x y factor} {
set xl [.f.c itemcget $vp -xleft]
set xr [.f.c itemcget $vp -xright]
set yb [.f.c itemcget $vp -ybottom]
set yt [.f.c itemcget $vp -ytop]
set xc [expr 0.5*($xl+$xr)]
set yc [expr 0.5*($yb+$yt)]
set xl [expr $xl-$xc]
set xr [expr $xr-$xc]
set yb [expr $yb-$yc]
set yt [expr $yt-$yc]
set xl [expr $xc + $factor * $xl]
set xr [expr $xc + $factor * $xr]
set yb [expr $yc + $factor * $yb]
set yt [expr $yc + $factor * $yt]
.f.c itemconfigure $vp -xleft $xl -xright $xr -ybottom $yb -ytop $yt
}
proc bindzoommap {win x y key} {
set l [buplot_locatevp $win $x $y]
set vp [lindex $l 0]
set inside [lindex $l 1]
if { $inside == 0 } {return}
if { $key == "O" } {zoommap $vp $x $y 2.0}
if { $key == "o" } {zoommap $vp $x $y 1.25}
if { $key == "I" } {zoommap $vp $x $y 0.5}
if { $key == "i" } {zoommap $vp $x $y 0.8}
}
proc bindenter {} {
focus .f.c
}
# this procedure will set a color specification
# for transforming a depth value into a color
proc setcolor {depth} {
set symlit 0.75
set hue [expr 240.0*(1.0-($depth/600.0))]
return [format "%.1f:%s:1.0" $hue $symlit]
}
# set overall sizes, margins and positions
set width 500
set heightm [expr int ( 0.5 * $width )]
set heighte $width
set mleft 60
set mright 20
set mbottomm 50
set mbottome 20
set mtopm 20
set mtope 5
set water_color "#c0c0ff"
set fwidth [expr $width + $mleft + $mright]
set fheightm [expr $heightm + $mtopm + $mbottomm]
set fheighte [expr $heighte + $mtope + $mbottome]
set cwidth $fwidth
set cheight [expr $fheightm + $fheighte]
# create main frame
frame .f
grid configure .f -column 0 -row 0 -sticky nsew
grid rowconfigure . 0 -weight 1
grid columnconfigure . 0 -weight 1
grid rowconfigure .f 0 -weight 0
grid rowconfigure .f 1 -weight 1
grid columnconfigure .f 0 -weight 1
# this frame will contain the current mouse
# position display
frame .ft -background "white"
grid configure .ft -column 0 -row 1 -sticky nsew
grid rowconfigure .ft 0 -weight 1
grid columnconfigure .ft 0 -weight 1
# this is the canvas frame that will contain
# the maps
canvas .f.c -width $cwidth -height $cheight
grid configure .f.c -column 0 -row 1 -sticky nsew
# setup widget for displaying current
# mouse coordinates
global latlon
set latlon " "
label .ft.l -textvariable latlon -width 16 -font "helvetica 10 bold" -background "white"
grid configure .ft.l -column 0 -row 0 -sticky nsew
# create viewport for Mercator map
.f.c create bpviewport "vpm" 0 0 \
-wtran "merc" \
-latr 0.0 \
-lonr 0.0 \
-width $fwidth \
-height $fheightm \
-xleft -180.0 \
-xright 180.0 \
-ybottom -90.0 \
-ytop 90.0 \
-mleft $mleft \
-mright $mright \
-mbottom $mbottomm \
-mtop $mtopm \
-fill "gray" \
-fill_frame "#ecffec" \
-tags "vpm"
# create map for Mercator map
.f.c create bpmap "vpm" \
-resolution "auto" \
-political "1:#ff0000:1,2:#00a000:0,3:#ff00ff:0" \
-fill_water $water_color \
-coasts "1:#000000:0" \
-tags "mapm"
# put in axes labeling for Mercator map
.f.c create bpaxes "vpm" \
-xlabel "Longitude" \
-ylabel "Latitude" \
-mindx 50 \
-mindy 50 \
-xincrement 30.0 \
-yincrement 30.0 \
-xincrement_small 10.0 \
-yincrement_small 10.0 \
-tags "mapm"
# put in lat-lon grid lines for Marcator map
.f.c create bpgrid "vpm" \
-mindx 50 \
-mindy 50 \
-xincrement 30.0 \
-yincrement 30.0 \
-xincrement_small 10.0 \
-yincrement_small 10.0 \
-linewidth 1 \
-linewidth_small 1 \
-fill "darkgray" \
-fill_small "darkgray" \
-tags "mapm"
# create viewport for EDP map
.f.c create bpviewport "vp" 0 $fheightm \
-wtran "edp" \
-latr -0.0 \
-lonr 0.0 \
-width $fwidth \
-height $fheighte \
-xleft -90.0 \
-xright 90.0 \
-ybottom -90.0 \
-ytop 90.0 \
-mleft $mleft \
-mright $mright \
-mbottom $mbottome \
-mtop $mtope \
-fill "gray" \
-fill_frame "#ecffec" \
-tags "vp"
# create map for EDP map
.f.c create bpmap "vp" \
-resolution "auto" \
-political "1:#ff0000:1,2:#00a000:0,3:#ff00ff:0" \
-fill_water $water_color \
-tags "map"
# put in axes labeling for EDP map
# note that currently the axis number labeling
# is disabled for EDP maps
.f.c create bpaxes "vp" \
-mindx 100 \
-xincrement 30.0 \
-yincrement 30.0 \
-xincrement_small 5.0 \
-yincrement_small 5.0 \
-tags "map"
# put in lat-lon grid lines for EDP map
.f.c create bpgrid "vp" \
-mindx 0 \
-mindy 0 \
-xincrement 30.0 \
-yincrement 30.0 \
-xincrement_small 5.0 \
-yincrement_small 5.0 \
-linewidth -1 \
-linewidth_small 1 \
-fill "darkgray" \
-fill_small "darkgray" \
-tags "map"
# Now lets bind right mouse button events
# The idea is to be able to pan the plot region by
# dragging the right mouse button
proc bindstartdrag {win x y} {
set l [buplot_locatevp $win $x $y]
if {[llength $l] < 1} {return}
set vp [lindex $l 0]
set inside [lindex $l 1]
global dragwindow
set dragwindow $vp
global xstart
global ystart
set xstart $x
set ystart $y
}
proc binddrag {w x y} {
global dragwindow
if {[info exists dragwindow] == 0} {return}
global xstart
global ystart
set delx [expr $xstart - $x]
set dely [expr $ystart - $y]
$w itemconfigure $dragwindow -xtranslate $delx -ytranslate $dely
}
proc bindstopdrag {w} {
global dragwindow
if {[info exists dragwindow] == 0} {return}
$w itemconfigure $dragwindow -xtranslate "apply" -ytranslate "apply"
unset dragwindow
}
# assign canvas bindings for mouse and
# keyboard events
# O,o = zoom out
# I,i = zoom in
# but3-drag = pan map
# Shift-but3 = pan map by resetting center lat-lon
# motion = display coords
bind .f.c <KeyPress> "bindzoommap %i %x %y %k"
bind .f.c <ButtonPress-3> "bindstartdrag %i %x %y"
bind .f.c <Button3-Motion> "binddrag %W %x %y"
bind .f.c <ButtonRelease-3> "bindstopdrag %W"
bind .f.c <Shift-ButtonPress-3> "bindpanmap %i %x %y"
bind .f.c <ButtonPress-1> "bindfindclosest %i %W %x %y"
bind .f.c <Motion> "showlatlon %i %x %y"
bind .f.c <Any-Enter> "bindenter"
# now we are going to create a vector, open
# a database with some origins, read the origin
# lats, lons and depths, and fill in the vector
set events [vector_create]
global db
set db [dbopen "gsn" r]
set dbe [dblookup $db 0 "event" 0 0]
set dbo [dblookup $db 0 "origin" 0 0]
set db [dbjoin $dbe $dbo "prefor#orid"]
set nrecs [dbquery $db dbRECORD_COUNT]
for {set i 0} {$i < $nrecs} {incr i} {
set lat [dbgetv $db 0 $i "lat"]
set lon [dbgetv $db 0 $i "lon"]
set depth [dbgetv $db 0 $i "depth"]
set color [setcolor $depth]
vector_append $events -1 $lon $lat [format "{f=%s}" $color]
}
# now we create polypoint items to show the origins
# in each map
.f.c create bppolypoint "vpm" \
-vector $events \
-symbol "square" \
-fill "blue" \
-outline "" \
-size 3
.f.c create bppolypoint "vp" \
-vector $events \
-symbol "square" \
-fill "blue" \
-outline "" \
-size 3
# tell the window manager to not allow
# interactive resizing - this display
# will be fixed size - and start the
# mail loop
wm resizable . 0 0
# We update everything to get the display rendered on the
# screen
update idletasks
# And finally we make a postscript printout of the display
# using the standard canvas postscript command.
.f.c postscript -pageheight 8i -rotate true -file testbuplot.ps
AUTHOR
Danny Harvey, BRTT