JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.chart3d
Class Chart3dDataView

java.lang.Object
  |
  +--com.klg.jclass.chart3d.TrackChange
        |
        +--com.klg.jclass.chart3d.Chart3dDataView
All Implemented Interfaces:
Changeable, Changeable, Chart3dDataListener, EventListener, Serializable
Direct Known Subclasses:
Chart3dDataViewJava3d

public class Chart3dDataView
extends TrackChange
implements Chart3dDataListener

Class containing the internal representation of the chartable data. Chart3d data is represented as elevation data and zone data (used for 4D grid plots). User pass in a data source which the dataView extracts into an internal data object. The internal data object is then used to plot the data. The Chart3dDataView also manages the drawing of the data, handles changes to the data through Chart3dDataEvent objects that are passed to it, and handles mapping and picking.

See Also:
Serialized Form

Field Summary
protected  boolean batched
           
protected  com.klg.jclass.chart3d.JCChart3d chart3d
          The parent JCChart3d object.
protected  int chartType
          The chart type of this dataView.
protected  com.klg.jclass.chart3d.JCContour contour
          The JCContour object handles contouring and zoning.
static int CONTOURED
           
protected  boolean dataDrawn
           
protected  com.klg.jclass.chart3d.Chart3dDataHandler dataHandler
           
protected  int dataViewId
           
protected  boolean defaultsCalculated
           
protected  com.klg.jclass.chart3d.Draw draw
          The object used by this dataView to draw the data.
protected  int drawCode
           
protected  com.klg.jclass.chart3d.JCElevation elevation
          The JCElevation object determines meshing, shading, and transparency.
protected  com.klg.jclass.chart3d.Chart3dData elevationData
          The internal elevation data object.
protected  com.klg.jclass.chart3d.Chart3dDataModel elevationDataSource
          Elevation data source for this dataView.
protected  ArrayList gridColors
          Allows certain facets or bars to have different colors.
protected  com.klg.jclass.chart3d.Mapping mapping
           
static int MESHED
           
protected  double mouseEditScaleFactor
           
protected  String name
          The name of this dataView.
protected  double radiusOfInfluence
          In Chart3d Java3d, when editing a SURFACE chart using the mouse, data points around the pick point are modified according to the expression deltaZ = scaleFactor * mouseDragDistance * exp(-distanceFromPickPoint/radiusOfInfluence) where deltaZ is the change in the z coordinate value of a given point, scaleFactor = (MaxDataValue - MinDataValue) * mouseEditScaleFactor, mouseDragDistance is the mouse drag distance along the adjustment axis, distanceFromPickPoint is the distance in the x,y plane of a data point from the pick point, radiusOfInfluence is a user-specified parameter.
static int SHADED
           
static int ZONED
           
protected  com.klg.jclass.chart3d.Chart3dGridData zoneData
          The internal zone data object.
protected  com.klg.jclass.chart3d.Chart3dGridDataModel zoneDataSource
          Zone data source for this dataView.
 
Fields inherited from class com.klg.jclass.chart3d.TrackChange
changed, changedFlag
 
Fields inherited from interface com.klg.jclass.chart3d.Changeable
ALL, CONTOURS, NOTIFY_CA_RECALC, NOTIFY_CA_REDRAW, NOTIFY_LEGEND_RECALC, NOTIFY_LEGEND_REDRAW
 
Fields inherited from interface com.klg.jclass.util.Changeable
BASIC_CHANGE_MASK, LAYOUT, NO_CHANGE, NOTIFY_PARENT_LAYOUT, RECALC, REDRAW
 
Constructor Summary
Chart3dDataView()
          Null args constructor.
Chart3dDataView(com.klg.jclass.chart3d.JCChart3d chart3d, int dataViewId)
          Constructor which provides a parent chart3d and a dataViewId.
Chart3dDataView(com.klg.jclass.chart3d.JCChart3d chart3d, int dataViewId, int chartType)
          Constructor which provides a parent chart3d, a dataViewId, and a chartType.
 
Method Summary
 void addGridColor(int x, int y, Color color)
          Sets the color of the specified bar (or set of bars) by creating a JCGridColor and adding it to the gridColors ArrayList.
 void addGridColor(com.klg.jclass.chart3d.JCGridColor gridColor)
          Sets the color of the specified bar (or set of bars) by adding the passed in gridColor to the gridColors ArrayList.
 void calcDefaults()
          Calculates default values for those values that were not provided by the user.
 void chart3dDataChange(com.klg.jclass.chart3d.event.Chart3dDataEvent event)
          chart3dDataChange is called whenever the chart 3D data has changed.
protected  void computeDataDrawn()
          Will we draw anything? Computes a drawCode (for easier access to the four booleans that control the type of surface, bar, or scatter plot).
 void computeDataLimits()
          Computes the limits of the data (i.e.
 Point3d coordToDataCoord(int x, int y)
          Same as map().
 com.klg.jclass.chart3d.JCData3dIndex coordToDataIndex(int x, int y)
          Similar to pick() for a specific data view.
 void createDraw()
          Creates the correct draw object based on the data type.
 Point dataCoordToCoord(Point3d point)
          Same as unmap().
 Point dataIndexToCoord(com.klg.jclass.chart3d.JCData3dIndex index)
          Similar to unpick() for a specific this specific data view.
protected  void doPreprocessing()
          Does preprocessing needed before drawing.
 double dragZValue(com.klg.jclass.chart3d.Chart3dData data, com.klg.jclass.chart3d.JCData3dIndex index, int x, int y)
          Finds a new Z value for a given point based on a given pixel position.
protected  void drawGraph(Graphics gc)
          Actually draws the graph.
protected  void filterGridColors()
          Processes gridColors.
 com.klg.jclass.chart3d.JCGridColor findGridColor(int x, int y)
          Finds the first JCGridColor (starting at the end of the list) in the gridColors list that matches the indices (x, y).
 com.klg.jclass.chart3d.JCChart3d getChart3d()
          Returns the parent JCChart3d object.
 int getChartType()
          Return the chart type for this dataView.
 com.klg.jclass.chart3d.JCContour getContour()
          Returns the current JCContour object for this dataView.
 int getDataViewId()
          Gets the dataView ID number.
 com.klg.jclass.chart3d.Draw getDraw()
          Returns the object used to draw the data.
 int getDrawCode()
          Returns the current draw code mask.
 com.klg.jclass.chart3d.JCElevation getElevation()
          Returns the current JCElevation object for this dataView.
 com.klg.jclass.chart3d.Chart3dData getElevationData()
          Returns the internal elevation data object.
 com.klg.jclass.chart3d.Chart3dDataModel getElevationDataSource()
          Gets the elevationDataSource property for Chart3dDataView.
 ArrayList getGridColors()
          Returns the current list of grid colors.
 com.klg.jclass.chart3d.Mapping getMapping()
          Returns the current mapping object.
 double getMouseEditScaleFactor()
          This method returns the mouseEditScaleFactor used in mouse editing of a SURFACE, BAR, or SCATTER chart.
 String getName()
          Gets the dataView's name.
 double getRadiusOfInfluence()
          This method returns the value of the radiusOfInfluence parameter used in mouse editing of a SURFACE chart.
 com.klg.jclass.chart3d.Chart3dGridData getZoneData()
          Returns the internal zone data object.
 com.klg.jclass.chart3d.Chart3dGridDataModel getZoneDataSource()
          Gets the zoneDataSource property for Chart3dDataView.
 double gridValue(com.klg.jclass.chart3d.Chart3dGridData data, double x, double y)
          Given grid data and an (x,y) point on the visible xy plane within the grid, do bilinear interpolation using the 4 closest grid points and return the corresponding z value.
 boolean isBatched()
          Gets the Batched property.
 boolean isDataDrawn()
          Based on user inputs, is there any data drawn? If the user input data that doesn't make sense (i.e.
 Point3d map(int x, int y)
          Performs a map operation by mapping the provided screen pixel information to a point in 3d space that is on the surface (if the point misses the surface a point with (x, y, z) values of Double.MAX_VALUE is returned.
 boolean removeGridColor(int x, int y)
          Removes the first matching entry from the gridColors ArrayList (starting from the last to the first).
protected  boolean removeGridColor(int x, int y, int n, boolean callSetChanged)
          Removes the first matching entry from the gridColors ArrayList (starting from the nth entry back to the first).
 void setBatched(boolean isBatched)
          Sets the Batched property.
 void setChanged(boolean b, int cf)
          Sets the value of the Changed property.
 void setChanged(boolean b, int cf, boolean updateParent)
          Sets the value of the Changed property, with option to prevent parent updating via the updateParent parameter.
 void setChart3d(com.klg.jclass.chart3d.JCChart3d chart3d)
          Sets the parent JCChart3d object.
 void setChartType(int chartType)
          Sets the chart type for this dataView.
 void setContour(com.klg.jclass.chart3d.JCContour contour)
          Sets a JCContour object on this dataView.
 void setDataViewId(int dataViewId)
          Sets the dataView ID number.
 void setElevation(com.klg.jclass.chart3d.JCElevation elevation)
          Sets a JCElevation object for this dataView.
 void setElevationDataSource(com.klg.jclass.chart3d.Chart3dDataModel elevationDataSource)
          Sets the elevation data source for this Chart3dDataView.
 void setGridColors(ArrayList gridColors)
          Sets the grid color list.
 void setMapping(com.klg.jclass.chart3d.Mapping mapping)
          Sets the mapping object.
 void setMouseEditScaleFactor(double factor)
          This method sets the mouseEditScaleFactor used in mouse editing of a SURFACE, BAR, or SCATTER chart.
 void setName(String name)
          Sets the dataView's name.
 void setRadiusOfInfluence(double radius)
          This method sets the radiusOfInfluence parameter used in mouse editing of a SURFACE chart.
 void setZoneDataSource(com.klg.jclass.chart3d.Chart3dGridDataModel zoneDataSource)
          Sets the zone data source for this Chart3dDataView.
 Point unmap(Point3d point)
          Performs an unmap operation by taking a point in 3d data space and transforming it to screen space.
 
Methods inherited from class com.klg.jclass.chart3d.TrackChange
getChanged, getChanged, isChanged, isChanged, updateFlags
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MESHED

public static final int MESHED
See Also:
Constant Field Values

SHADED

public static final int SHADED
See Also:
Constant Field Values

ZONED

public static final int ZONED
See Also:
Constant Field Values

CONTOURED

public static final int CONTOURED
See Also:
Constant Field Values

chart3d

protected com.klg.jclass.chart3d.JCChart3d chart3d
The parent JCChart3d object.


elevationDataSource

protected com.klg.jclass.chart3d.Chart3dDataModel elevationDataSource
Elevation data source for this dataView. The elevation data is the primary data for the dataView and provides a surface plot, bar plot, or scatter plot depending on the chartType.


elevationData

protected com.klg.jclass.chart3d.Chart3dData elevationData
The internal elevation data object. This object allows user to query information about the data that was supplied by the elevationDataSource.


zoneDataSource

protected com.klg.jclass.chart3d.Chart3dGridDataModel zoneDataSource
Zone data source for this dataView. Zone data allows color to be a 4th dimension for the corresponding elevation data. The underlying grid needs to match the elevation data's underlying grid.


zoneData

protected com.klg.jclass.chart3d.Chart3dGridData zoneData
The internal zone data object. This object allows user to query information about the data that was supplied by the zoneDataSource.


chartType

protected int chartType
The chart type of this dataView. One of SURFACE, BAR, or SCATTER.

See Also:
JCChart3d

elevation

protected com.klg.jclass.chart3d.JCElevation elevation
The JCElevation object determines meshing, shading, and transparency.


contour

protected com.klg.jclass.chart3d.JCContour contour
The JCContour object handles contouring and zoning.


name

protected String name
The name of this dataView. Used by the legend code and the customizer.


gridColors

protected ArrayList gridColors
Allows certain facets or bars to have different colors.


draw

protected com.klg.jclass.chart3d.Draw draw
The object used by this dataView to draw the data.


mapping

protected com.klg.jclass.chart3d.Mapping mapping

dataHandler

protected com.klg.jclass.chart3d.Chart3dDataHandler dataHandler

dataDrawn

protected boolean dataDrawn

drawCode

protected int drawCode

defaultsCalculated

protected boolean defaultsCalculated

dataViewId

protected int dataViewId

batched

protected boolean batched

radiusOfInfluence

protected double radiusOfInfluence
In Chart3d Java3d, when editing a SURFACE chart using the mouse, data points around the pick point are modified according to the expression deltaZ = scaleFactor * mouseDragDistance * exp(-distanceFromPickPoint/radiusOfInfluence) where deltaZ is the change in the z coordinate value of a given point, scaleFactor = (MaxDataValue - MinDataValue) * mouseEditScaleFactor, mouseDragDistance is the mouse drag distance along the adjustment axis, distanceFromPickPoint is the distance in the x,y plane of a data point from the pick point, radiusOfInfluence is a user-specified parameter.


mouseEditScaleFactor

protected double mouseEditScaleFactor
Constructor Detail

Chart3dDataView

public Chart3dDataView()
Null args constructor. This means that chart3d is null (which is not a good thing because many child objects call the getChart3d() method and expect a valid JCChart3d object to be there).


Chart3dDataView

public Chart3dDataView(com.klg.jclass.chart3d.JCChart3d chart3d,
                       int dataViewId)
Constructor which provides a parent chart3d and a dataViewId.

Parameters:
chart3d - The parent chart3d
dataViewId - The dataView index into the master dataView array

Chart3dDataView

public Chart3dDataView(com.klg.jclass.chart3d.JCChart3d chart3d,
                       int dataViewId,
                       int chartType)
Constructor which provides a parent chart3d, a dataViewId, and a chartType.

Parameters:
chart3d - The parent chart3d
dataViewId - The dataView index into the master dataView array
chartType -
Method Detail

getChart3d

public com.klg.jclass.chart3d.JCChart3d getChart3d()
Returns the parent JCChart3d object.

Returns:
The parent JCChart3d object

setChart3d

public void setChart3d(com.klg.jclass.chart3d.JCChart3d chart3d)
Sets the parent JCChart3d object.

Parameters:
chart3d - The new parent JCChart3d object

getElevationDataSource

public com.klg.jclass.chart3d.Chart3dDataModel getElevationDataSource()
Gets the elevationDataSource property for Chart3dDataView. This elevationDataSource property represents the class used to load data into the Chart3dDataView class. The elevationDataSource property holds this populating class if it implements either EditableChart3dDataModel or Chart3dDataManager. If the elevationDataSource property is null, that means that the populating data source class was discarded because it was no longer needed.

Returns:
Object acting as a data source for Chart3dDataView; this object implements either EditableChart3dDataModel or Chart3dDataManager.

setElevationDataSource

public void setElevationDataSource(com.klg.jclass.chart3d.Chart3dDataModel elevationDataSource)
Sets the elevation data source for this Chart3dDataView. The data source class must implement either Chart3dDataModel or EditableChart3dDataModel. JClass Chart 3D will do the correct operation based on the object provided. If this data source class implements Chart3dDataManager, this data view will be registered as a listener for data changes. The data source class will be saved in the elevationDataSource propertyfor future reference if it implements either Chart3dDataManager or EditableChart3dDataModel. Otherwise, since it is only needed to load data once, the elevationDataSource property will be set to null.

Parameters:
elevationDataSource - Object acting as a elevation data source for Chart3dDataView; this object must implement either Chart3dDataModel or EditableChart3dDataModel.

getElevationData

public com.klg.jclass.chart3d.Chart3dData getElevationData()
Returns the internal elevation data object. This object is used internally but is provided as a way to query the current elevation data parameters and this object is needed as input to some convenience methods. Note that manipulating data inside the internal object can be done, but this is strongly discouraged. The recommended way to manipulate the data is through the data model or through Chart3dDataEvents.

Returns:
The current internal elevation data object

getZoneDataSource

public com.klg.jclass.chart3d.Chart3dGridDataModel getZoneDataSource()
Gets the zoneDataSource property for Chart3dDataView. This property allows the user to add a 4th dimension to the data based on color. This zoneDataSource property represents the class used to load data into the Chart3dDataView class. The zoneDataSource property holds this populating class if it implements either EditableChart3dDataModel or Chart3dDataManager. If the zoneDataSource property is null, that means that the populating data source class was discarded because it was no longer needed.

Returns:
Object acting as a data source for Chart3dDataView; this object implements either EditableChart3dDataModel or Chart3dDataManager.

setZoneDataSource

public void setZoneDataSource(com.klg.jclass.chart3d.Chart3dGridDataModel zoneDataSource)
Sets the zone data source for this Chart3dDataView. The data source class must implement either Chart3dGridDataModel or EditableChart3dGridDataModel. JClass Chart 3D will do the correct operation based on the object provided. If this data source class implements Chart3dGridDataManager, this data view will be registered as a listener for data changes. The data source class will be saved in the zoneDataSource property for future reference if it implements either Chart3dDataManager or EditableChart3dDataModel. Otherwise, since it is only needed to load data once, the zoneDataSource property will be set to null.

Parameters:
zoneDataSource - Object acting as a zone data source for Chart3dDataView; this object must implement either Chart3dGridDataModel or EditableChart3dGridDataModel.

getZoneData

public com.klg.jclass.chart3d.Chart3dGridData getZoneData()
Returns the internal zone data object. This object is used internally but is provided as a way to query the current zone data parameters and is needed as input to some convenience methods. Note that manipulating data inside the internal object can be done, but this is strongly discouraged. The recommended way to manipulate the data is through the data model or through Chart3dDataEvents.

Returns:
The current internal elevation data object

isDataDrawn

public boolean isDataDrawn()
Based on user inputs, is there any data drawn? If the user input data that doesn't make sense (i.e. an object that implements the Chart3dPointDataModel when the chartType is SURFACE,/code>) or invalid data (i.e. an object the implements the Chart3dGridDataModel which has less than two x or y grid values) this flag will return false and nothing will be drawn in the JCChart3dArea.

Returns:
Is there any data drawn?

getDrawCode

public int getDrawCode()
Returns the current draw code mask. This is a logical OR of the MESHED, SHADED, CONTOURED, and ZONED masks which are set based on the corresponding properties in the child JCContour and JCElevation objects. This is meant to be used as an internal mask but is exposed if users want to query it. Note that this mask gets set somewhere during the drawing process.

Returns:
The current draw code

getDataViewId

public int getDataViewId()
Gets the dataView ID number. This number is index into the master dataView array stored in the parent JCChart3d class.

Returns:
The current dataView ID number

setDataViewId

public void setDataViewId(int dataViewId)
Sets the dataView ID number. This number is index into the master dataView array stored in the parent JCChart3d class. Note that currently only one dataView is supported.

Parameters:
dataViewId - The new dataView ID number

getChartType

public int getChartType()
Return the chart type for this dataView. This is one of SURFACE, BAR, or SCATTER (defined in the JCChart3d class).

Returns:
The chart type for this dataView
See Also:
JCChart3d

setChartType

public void setChartType(int chartType)
Sets the chart type for this dataView. This is one of SURFACE, BAR, or SCATTER (defined in the JCChart3d class).

Parameters:
chartType -
See Also:
JCChart3d

getName

public String getName()
Gets the dataView's name. The name is used in the legend and customizer to distinguish between dataViews.

Returns:
The current dataView name

setName

public void setName(String name)
Sets the dataView's name. The name is used in the legend and customizer to distinguish between dataViews.

Parameters:
name - The new dataView name

getGridColors

public ArrayList getGridColors()
Returns the current list of grid colors. This list allows the user to color a particular bar or facet, row/column of bars or facets with a given color.

Returns:
The current grid colors list

setGridColors

public void setGridColors(ArrayList gridColors)
Sets the grid color list. This list allows the user to color a particular bar or facet, row/column of bars or facets with a given color.

Parameters:
gridColors - The new grid color list

findGridColor

public com.klg.jclass.chart3d.JCGridColor findGridColor(int x,
                                                        int y)
Finds the first JCGridColor (starting at the end of the list) in the gridColors list that matches the indices (x, y).

Parameters:
x - The x index to match
y - The y index to match

removeGridColor

protected boolean removeGridColor(int x,
                                  int y,
                                  int n,
                                  boolean callSetChanged)
Removes the first matching entry from the gridColors ArrayList (starting from the nth entry back to the first). The entry must match exactly (x == JCData3dIndex.ALL will only match if the gridColor's index is JCData3dIndex.ALL). Internal use only.

Parameters:
x - The x index of the grid color to be removed
y - The y index of the grid color to be removed
n - The number of grid colors in the array to scan (could be less than gridColors.size())
callSetChanged - If true, mark the dataView as changed and redraw.

removeGridColor

public boolean removeGridColor(int x,
                               int y)
Removes the first matching entry from the gridColors ArrayList (starting from the last to the first). The entry must match exactly (x == JCData3dIndex.ALL will only match if the gridColor's index is JCData3dIndex.ALL).

Parameters:
x - The x index of the grid color to be removed
y - The y index of the grid color to be removed

addGridColor

public void addGridColor(int x,
                         int y,
                         Color color)
Sets the color of the specified bar (or set of bars) by creating a JCGridColor and adding it to the gridColors ArrayList. If the x and y of the gridColor match an entry already on the list then that entry will be replaced by the new one. If the color of the gridColor is null, then remove the matching entry without replacing it.

Parameters:
x - The x index of the grid color to be added
y - The y index of the grid color to be added
color - The color of the grid color to be added

addGridColor

public void addGridColor(com.klg.jclass.chart3d.JCGridColor gridColor)
Sets the color of the specified bar (or set of bars) by adding the passed in gridColor to the gridColors ArrayList. If the x and y of the gridColor match an entry already on the list then that entry will be replaced by the new one. If the color of the gridColor is null, then remove the matching entry without replacing it.

Parameters:
gridColor - The gridColor object to be added.

filterGridColors

protected void filterGridColors()
Processes gridColors. Starting at the first entry, basically act like you are adding each entry to a new list. Duplicate entries will replace old ones and null colors will wipe out a matching entry. Note that any new entry always be placed at the end of the list.


getDraw

public com.klg.jclass.chart3d.Draw getDraw()
Returns the object used to draw the data.

Returns:
The object used to draw the data

getElevation

public com.klg.jclass.chart3d.JCElevation getElevation()
Returns the current JCElevation object for this dataView.

Returns:
The current elevation object.

setElevation

public void setElevation(com.klg.jclass.chart3d.JCElevation elevation)
Sets a JCElevation object for this dataView. Setting the elevation property to null not allowed.

Parameters:
elevation - The new JCElevation objection

getContour

public com.klg.jclass.chart3d.JCContour getContour()
Returns the current JCContour object for this dataView.

Returns:
The current contour object.

setContour

public void setContour(com.klg.jclass.chart3d.JCContour contour)
Sets a JCContour object on this dataView. Note that since the JCContour object is heavily dependent on the Chart3dDataView's data (among other things), a contour object can only have one dataView parent. Also, setting the contour property to null not allowed.

Parameters:
contour - The new JCContour object

getMapping

public com.klg.jclass.chart3d.Mapping getMapping()
Returns the current mapping object.

Returns:
The current mapping object

setMapping

public void setMapping(com.klg.jclass.chart3d.Mapping mapping)
Sets the mapping object.

Parameters:
mapping - The new mapping object

isBatched

public boolean isBatched()
Gets the Batched property. The Batched property controls whether the Chart3dDataView is notified immediately of data model changes, or if the changes are accumulated and sent at a later date.

Specified by:
isBatched in interface Changeable
Overrides:
isBatched in class TrackChange
Returns:
true if changes are accumulated, false otherwise.

setBatched

public void setBatched(boolean isBatched)
Sets the Batched property. The Batched property controls whether the Chart3dDataView is notified immediately of data model changes, or if the changes are accumulated and sent at a later date.

Parameters:
isBatched - Are updates batched until later?

chart3dDataChange

public void chart3dDataChange(com.klg.jclass.chart3d.event.Chart3dDataEvent event)
chart3dDataChange is called whenever the chart 3D data has changed. Interested listeners should implement this method and register the object with the appropriate data source.

Specified by:
chart3dDataChange in interface Chart3dDataListener
Parameters:
event - The data event to process

setChanged

public void setChanged(boolean b,
                       int cf)
Sets the value of the Changed property. The Changed property manages whether the data view requires recalculation. If set to true, a recalculation may be triggered.

Specified by:
setChanged in interface Changeable
Overrides:
setChanged in class TrackChange
Parameters:
b - Has anything been changed?
cf - The change mask the tells what type of changed has happened

setChanged

public void setChanged(boolean b,
                       int cf,
                       boolean updateParent)
Sets the value of the Changed property, with option to prevent parent updating via the updateParent parameter. This method overrides the TrackChange method so that it can mark other appropriate objects as changed. Note that updateParent is independent of Batched.

Specified by:
setChanged in interface Changeable
Overrides:
setChanged in class TrackChange
Parameters:
b - Has a change happened?
cf - The change mask that tells what type of change has happened
updateParent - Tell our parent about the change (which will cause a repaint)?

computeDataLimits

public void computeDataLimits()
Computes the limits of the data (i.e. maximum and minimum) for all three dimensions based on the data input. These are used to calculate axis limits, the viewport, and plot cube boundaries.


computeDataDrawn

protected void computeDataDrawn()
Will we draw anything? Computes a drawCode (for easier access to the four booleans that control the type of surface, bar, or scatter plot). Also computes another boolean dataDrawn that determines if anything is to be drawn.


calcDefaults

public void calcDefaults()
Calculates default values for those values that were not provided by the user. For instance, this calculates the data min and max and sets the axis min and max if the "useDefaults" are true. It also calculates the default contour levels. The user can call this method if he/she requires these values before rendering the chart.


createDraw

public void createDraw()
Creates the correct draw object based on the data type.


doPreprocessing

protected void doPreprocessing()
Does preprocessing needed before drawing. Based on the user input compute the draw object needed, process text objects, and calculate processing order. Also, precomputes screen points for both data and contours.


drawGraph

protected void drawGraph(Graphics gc)
Actually draws the graph. The drawing mechanism is quite different for a normal 3d graph vs a 2d projection (only contours and zones). This method goes thru each of the graph parts (plotCube, Annotation, Gridlines, graph, etc) and draws them in the correct order.

Parameters:
gc - The graphics object used to draw

map

public Point3d map(int x,
                   int y)
Performs a map operation by mapping the provided screen pixel information to a point in 3d space that is on the surface (if the point misses the surface a point with (x, y, z) values of Double.MAX_VALUE is returned.

Parameters:
x - x value in screen pixels
y - y value in screen pixels
Returns:
The data point that maps to the inputted pixel point.

unmap

public Point unmap(Point3d point)
Performs an unmap operation by taking a point in 3d data space and transforming it to screen space.

Parameters:
point - The point in 3d dat space to be transformed.
Returns:
AWT Point object representing the location in screen pixels (relative to the Chart 3D component)

coordToDataCoord

public Point3d coordToDataCoord(int x,
                                int y)
Same as map(). Converts pixel coordinates to data space coordinates.

Parameters:
x - x value in screen pixels
y - y value in screen pixels
Returns:
Point3d instance

dataCoordToCoord

public Point dataCoordToCoord(Point3d point)
Same as unmap(). Converts data coordinates to pixel coordinates.

Parameters:
point - The point in 3d data space to be transformed.
Returns:
AWT Point object representing the location in screen pixels (relative to the Chart 3D component)

dataIndexToCoord

public Point dataIndexToCoord(com.klg.jclass.chart3d.JCData3dIndex index)
Similar to unpick() for a specific this specific data view. Converts a JCData3dIndex instance (containing a data view and an point index for either grid data or point data) to pixel values relative to the Chart 3D component.

Parameters:
index - Object representing the index of the point to unpick. This is either a JCData3dGridIndex representing the (x, y) index of grid data point or a JCData3dPointIndex representing the (series, point) index of a point in a point data set.
Returns:
AWT Point object representing the location is screen pixels relative to the Chart 3D component.

coordToDataIndex

public com.klg.jclass.chart3d.JCData3dIndex coordToDataIndex(int x,
                                                             int y)
Similar to pick() for a specific data view. Converts pixel values relative to the Chart 3D component to a JCData3dIndex instance representing the index of the picked point. This is either a JCData3dGridIndex representing the (x, y) index of grid data point or a JCData3dPointIndex representing the (series, point) index of a point in a point data set.

Parameters:
x - The x value of screen position
y - The y value of screen position
Returns:
The JCData3dIndex object representing the index of the picked point.

dragZValue

public double dragZValue(com.klg.jclass.chart3d.Chart3dData data,
                         com.klg.jclass.chart3d.JCData3dIndex index,
                         int x,
                         int y)
Finds a new Z value for a given point based on a given pixel position. Given a start point A (for grid data a point on the grid and for point data one of the points in the list of series) and a point P on the screen, project the line AP (in 3-space) onto the line through A parallel to the z axis and find the z value that corresponds to P on the projected line.

Parameters:
data - The data for which this operation is to take place. It is either an instance of Chart3dGridData or Chart3dPointData.
index - The data index of the point. For grid data, this must be an instance of JCData3dGridIndex, which corresponds to an x and y grid position specification. For point data, this must be an instance of JCData3dPoint index which corresponds to the series and point number of the point.
x - The x value of screen position
y - The y value of screen position
Returns:
The new computed z-value

gridValue

public double gridValue(com.klg.jclass.chart3d.Chart3dGridData data,
                        double x,
                        double y)
Given grid data and an (x,y) point on the visible xy plane within the grid, do bilinear interpolation using the 4 closest grid points and return the corresponding z value. Note that this does error checking and then just calls JChart3dUtil.biLinearInterp();.

Parameters:
data - The internal grid data object. This can be retrieved from a Chart3dDataView object via getElevationData() or getZoneData().
x - The x data-space value
y - The y data-space value
Returns:
The interpolated z value. Return's the data's hole value if an error occurs.
See Also:
getElevationData(), getZoneData(), JCChart3dUtil.biLinearInterp(com.klg.jclass.chart3d.Chart3dGridData, int, int, double, double)

setRadiusOfInfluence

public void setRadiusOfInfluence(double radius)
This method sets the radiusOfInfluence parameter used in mouse editing of a SURFACE chart. Applies only to the Java3d version of Chart3d.


getRadiusOfInfluence

public double getRadiusOfInfluence()
This method returns the value of the radiusOfInfluence parameter used in mouse editing of a SURFACE chart. Applies only to the Java3d version of Chart3d.


setMouseEditScaleFactor

public void setMouseEditScaleFactor(double factor)
This method sets the mouseEditScaleFactor used in mouse editing of a SURFACE, BAR, or SCATTER chart. Applies only to the Java3d version of Chart3d.


getMouseEditScaleFactor

public double getMouseEditScaleFactor()
This method returns the mouseEditScaleFactor used in mouse editing of a SURFACE, BAR, or SCATTER chart. Applies only to the Java3d version of Chart3d.


Copyright © 2004 Quest Software Inc..
All rights reserved.