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.
Restore this object to the state described in the given XML node.
Restore this object to the state described in the given XML node.
Encode the state of this object into an XML node.
Encode the state of this object into an XML node.
Produces a sequence of user controls and supplemental views, grouped into ComponentGroups by function.
Produces a sequence of user controls and supplemental views, grouped into ComponentGroups by function.
For this view, the first ComponentGroup contains a legend showing the minimum/maximum values in the field and the colors that map to them. If it isn't the case that both the field and the vectors within are of two dimensions, the sequence returned will have a second ComponentGroup with a control for selecting which vector component maps to x and y for the purposes of visualization.
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".
A pre-rendering step.
A pre-rendering step. Finds the minimum and maximum vector amplitudes in the field, which are needed for visually scaling the vector display. Also fires a ValueChanged event to signal interested parties (namely the legend UI component) that there are new values for min and max.
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
A visualization for VectorFields that treats vector components as Cartesian components in two-dimensional space. Two components of each vector are treated as x and y and then displayed as directed lines on a grid.
For fields of three dimensions, each layer is sliced out into a separate grid. Each cell in the grid(s) renders a directed line representing a single vector. Lines originates from the center of their respective cells, and the visual length of all lines are normalized such that the longest line/vector in the field is fully contained in its cell.
Since this visual representation can only account for two components of vectors at a time, the
toolbarComponents
method will return a user control for picking which components to treat as 'x' and 'y' if the field contains vectors of three or more dimensions. This user control is not provided if the field contains vectors of exactly two dimensions - in that case, the first component is taken to be -y and the second component as x. This is the mapping between Cog's (row, column) indexing an a conventional Cartesian space with y increasing in the upward direction and x increasing to the right.