Draw the single field element at the given indices.
Draw the single field element at the given indices.
Called after the pen has been moved to the top-left corner of the cell to draw in. Clients should take care to draw within the bounds of the cell, which is a cellSize by cellSize square.
It would be nice if we could give an element as an argument instead of a bunch of indices, but the Field class doesn't currently define any means to actually extract elements from the field; that's left to subclasses. Further complicating things, the panel classes don't know in advance how many dimensions the data field has, so we have to use a variable length indices parameter. If your field class has a read(indices: Int*) method, you can get the current element, regardless of field dimensions, like so:
val element = read(indices: _*)
A list of properties that should be persisted when the app closes, and restored the next time it's launched.
A list of properties that should be persisted when the app closes, and restored the next time it's launched. A common example of a persistent is the zoom/magnification level of the viewer. Be sure to add any relevenant properties to this list in your Viewer subclasses!
Returns the XML representation of this viewer's properties, suitable for saving into a file.
Returns the XML representation of this viewer's properties, suitable for saving into a file.
Reset the visualization.
Reset the visualization. An optional operation; subclasses must override this method or else it does nothing.
Builds the toolbar controls and displays for this visualization and returns them as a sequence of ComponentGroups.
Builds the toolbar controls and displays for this visualization and returns them as a sequence of ComponentGroups. In this case, the first group of components contains the "magnitude panel" (showing the lengths of the shortest and longest vectors in the field) and the second group contains controls that change how the view is rendered.
Updates the visualization based on the contents of data
.
Updates the visualization based on the contents of data
.
The src
argument was orignally meant to reference the
kernel/field/object that generated the data, in order to support
composite visualizations (that is, viewers that produce a visual based on
the data from several different sources), but launching such viewers in
the current UI is clunky at beset, so this feature isn't used. Viewers
that only visualize a single field's data can probably safely ignore this
arument (and indeed, most of the current ones do).
The field or object that generated the data
argument
New field data that needs to be rendered by this viewer
Update the data being viewed with new "data".
Update the data being viewed with new "data".
Compute any needed statistics on your data (for display or to help draw later).
Compute any needed statistics on your data (for display or to help draw later). Called after new data has been received (in updateData) but before drawing begins for that new data.
Parses the XML tag produced by the propertiesTag
method and restores
any saved valued to this Viewer.
Parses the XML tag produced by the propertiesTag
method and restores
any saved valued to this Viewer.
Increase zoom level by zDelta
.
Increase zoom level by zDelta
.
Default zoom/unzoom increment used by zoomIn
and zoomOut
.
Default zoom/unzoom increment used by zoomIn
and zoomOut
. When the
ZoomType is Additive, this value is added to or substracted from the
current zoomLevel
. In multiplicative mode, zoomLevel
is multipled by
zDelta
on zooming in or by its reciprocal on zooming out.
Decrease zoom level by zDelta
.
Decrease zoom level by zDelta
.
Controls how zDelta is applied to the current zoom level.
Controls how zDelta is applied to the current zoom level. In Additive, a delta is added to the current zoom level; in Multiplicative mode, the zoom level is multiplied by delta when zooming in, and by its reciprocal when zooming out.
Default zoom type is additive. If you change it to multiplicative, you should probably ensure that the default zDelta is something other than 1f, as multiplying by one probably won't do anything.
Created with IntelliJ IDEA. User: gonzatob Date: 9/6/12 Time: 3:46 PM
Viewer for fields of two-dimensional geometric vectors. Vectors are displayed as directed lines on a grid, whith the grid having identical dimensions to that of the field.
Cog uses a row, column coordinate system. We can think of rows and columns corresponding to y and x in a Cartesian coordinate system, but bear in mind then that row indices increase in the downward direction, and thus our y coordinate increases in the downward direction as well. Also note the order in which we present row, column coordinates: the vertical or y component comes first. For these reasons, the canonical 2D geometric vector in Cog maps to a (-y, x) ordered pair in a traditional x-increases-to-the- right and y-increased-up Cartesian space.
So, a Cog vector v = Vector(-5, 7) looks like this in Cartesian coordinates:
| v | . . | . . | . . | . . - - - - - - - - - - 0 - - - - - - - - - - | | | |