JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.chart3d
Class JCPlotCube

java.lang.Object
  |
  +--com.klg.jclass.chart3d.ParentTrackChange
        |
        +--com.klg.jclass.chart3d.JCPlotCube
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
JCPlotCubeJava3d

public class JCPlotCube
extends ParentTrackChange

The JCPlotCube class deals with drawing the cube around the surface, bar, or scatter plot.

See Also:
Serialized Form

Field Summary
protected  com.klg.jclass.chart3d.JCChart3dArea area
          The parent chart3dArea object.
protected  Color background
          The plotCube's background color.
protected  com.klg.jclass.chart3d.JCProjection ceiling
          The plotCube's ceiling projection.
protected  com.klg.jclass.chart3d.JCProjection floor
          The plotCube's floor projection.
protected  Color foreground
          The plotCube's foreground color.
protected  double xNormalizedScale
           
protected  double xScale
          The scale in the x direction.
protected  double yNormalizedScale
           
protected  double yScale
          The scale in the y direction.
protected  double zNormalizedScale
           
protected  double zScale
          The scale in the z direction.
 
Fields inherited from class com.klg.jclass.chart3d.ParentTrackChange
parents
 
Constructor Summary
JCPlotCube()
          No args constructor.
JCPlotCube(com.klg.jclass.chart3d.JCChart3dArea area)
          Contstructor given a parent chart3d area.
 
Method Summary
 void createParallelProjection(BufferedImage dest, com.klg.jclass.chart3d.JCProjection projection)
          Creates a parallel projection of the chart (without the annotation) and stores it in a passed in image, filling the entire image with the projection.
 void createParallelProjection(BufferedImage dest, com.klg.jclass.chart3d.JCProjection projection, Color background)
          Creates a parallel projection of the chart (without the annotation) and stores it in a passed in image, filling the entire image with the projection.
 void createParallelProjection(BufferedImage dest, com.klg.jclass.chart3d.JCProjection projection, int x, int y, int width, int height, Color background)
          Creates a parallel projection of the chart (without the annotation) and stores it in a passed in image, at a given position, and with a given width and height within the image.
protected  void draw2dBoundingBox(Graphics gc, boolean drawBackground)
          Draws the 2d bounding box.
protected  void draw3dBoundingBox(Graphics gc)
          Draws the 3d bounding box.
protected  void drawBoundingBox(Graphics gc, boolean drawBackground)
          Draws the bounding box for the plotcube (either 2d or 3d).
protected  void drawEdge(Graphics gc, int e)
          Draws edge e.
protected  void drawGridLines(Graphics gc)
          This method computes and draws the X, Y, and Z gridlines.
protected  void drawLine(Graphics gc, int i, int j)
          Draws a line from point i to j.
protected  void drawProjection(Graphics gc, boolean isFloor)
          Draws the contoured and/or zoned surface projection on the floor or ceiling of the the plot cube.
protected  void finishEdges(Graphics gc)
          Draws the rest of the cube edges that haven't been drawn before.
 Color getBackground()
          Gets the plotCube background.
 com.klg.jclass.chart3d.JCProjection getCeiling()
          Returns the PlotCube's ceiling projection.
 com.klg.jclass.chart3d.JCChart3dArea getChart3dArea()
          Gets the parent chart3d area.
 Color getDrawBackground()
          Returns the actual background color drawn in the plotCube.
 Color getDrawForeground()
          Returns the foreground color used to draw items within the plotCube.
 com.klg.jclass.chart3d.JCProjection getFloor()
          Returns the PlotCube's floor projection.
 Color getForeground()
          Gets the plotCube foreground.
 double getXNormalizedScale()
          Returns the current value of the PlotCube's normalized x scale.
 double getXScale()
          Returns the current value of the PlotCube's x scale.
 double getYNormalizedScale()
          Returns the current value of the PlotCube's normalized y scale.
 double getYScale()
          Returns the current value of the PlotCube's y scale.
 double getZNormalizedScale()
          Returns the current value of the PlotCube's normalized z scale.
 double getZScale()
          Returns the current value of the PlotCube's z scale.
 boolean hasCeilingProjection()
          Asks whether this PlotCube has a ceiling projection.
 boolean hasFloorProjection()
          Asks if this PlotCube has a floor projection.
 boolean hasProjections()
          Asks if this PlotCube has any projections.
protected  void normalizeScales()
          Normalizes the three scale values between 0 and 1.
 void setBackground(Color background)
          Sets the plotCube background.
 void setCeiling(com.klg.jclass.chart3d.JCProjection ceiling)
          Sets the PlotCube's ceiling projection (null parameters are not allowed).
 void setChart3dArea(com.klg.jclass.chart3d.JCChart3dArea area)
          Sets the parent chart3d area.
 void setFloor(com.klg.jclass.chart3d.JCProjection floor)
          Sets the PlotCube's floor projection (null parameters are not allowed).
 void setForeground(Color foreground)
          Sets the plotCube foreground.
protected  void setPoint(int i, Matrix4d ctm, double x, double y, double z)
          Sets the ith ScreenPoint to the transformed value of the point (x,y,z).
 void setXScale(double xScale)
          Sets the PlotCube's x scale (default value is 1.0).
 void setYScale(double yScale)
          Sets the PlotCube's y scale (default value is 1.0).
 void setZScale(double zScale)
          Sets the PlotCube's z scale (default value is 1.0).
protected  void updateBoundingBox(Graphics gc, int axisId, int x, int y)
          Erases and then draws the bounding box preview cube.
 
Methods inherited from class com.klg.jclass.chart3d.ParentTrackChange
addParent, clearParents, removeParent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

xScale

protected double xScale
The scale in the x direction. Measured relative to the other scale values.


yScale

protected double yScale
The scale in the y direction. Measured relative to the other scale values.


zScale

protected double zScale
The scale in the z direction. Measured relative to the other scale values.


ceiling

protected com.klg.jclass.chart3d.JCProjection ceiling
The plotCube's ceiling projection.


floor

protected com.klg.jclass.chart3d.JCProjection floor
The plotCube's floor projection.


background

protected Color background
The plotCube's background color.


foreground

protected Color foreground
The plotCube's foreground color.


xNormalizedScale

protected double xNormalizedScale

yNormalizedScale

protected double yNormalizedScale

zNormalizedScale

protected double zNormalizedScale

area

protected com.klg.jclass.chart3d.JCChart3dArea area
The parent chart3dArea object.

Constructor Detail

JCPlotCube

public JCPlotCube()
No args constructor. Chart3d area is null. Other values at their default.


JCPlotCube

public JCPlotCube(com.klg.jclass.chart3d.JCChart3dArea area)
Contstructor given a parent chart3d area. All other values at default.

Parameters:
area - the parent chart3d area
Method Detail

getChart3dArea

public com.klg.jclass.chart3d.JCChart3dArea getChart3dArea()
Gets the parent chart3d area.

Returns:
the parent JCChart3dArea object

setChart3dArea

public void setChart3dArea(com.klg.jclass.chart3d.JCChart3dArea area)
Sets the parent chart3d area. There can be only one chart3d area parent since the plotcube is heavily dependent on things in the chart area (for example, the axes, the transformation, the cube object, and so on).

Parameters:
area - the new parent chart3dArea

setXScale

public void setXScale(double xScale)
Sets the PlotCube's x scale (default value is 1.0).

Parameters:
xScale - the new x scale

getXScale

public double getXScale()
Returns the current value of the PlotCube's x scale.

Returns:
the PlotCube's x scale

getXNormalizedScale

public double getXNormalizedScale()
Returns the current value of the PlotCube's normalized x scale.

Returns:
the PlotCube's normalized x scale

setYScale

public void setYScale(double yScale)
Sets the PlotCube's y scale (default value is 1.0).

Parameters:
yScale - the new y scale

getYScale

public double getYScale()
Returns the current value of the PlotCube's y scale.

Returns:
the PlotCube's y scale

getYNormalizedScale

public double getYNormalizedScale()
Returns the current value of the PlotCube's normalized y scale.

Returns:
the PlotCube's normalized y scale

setZScale

public void setZScale(double zScale)
Sets the PlotCube's z scale (default value is 1.0).

Parameters:
zScale - the new z scale

getZScale

public double getZScale()
Returns the current value of the PlotCube's z scale.

Returns:
the PlotCube's z scale

getZNormalizedScale

public double getZNormalizedScale()
Returns the current value of the PlotCube's normalized z scale.

Returns:
the PlotCube's normalized z scale

normalizeScales

protected void normalizeScales()
Normalizes the three scale values between 0 and 1. Needed so that we always know that the plotcube is between -1 and 1.


setBackground

public void setBackground(Color background)
Sets the plotCube background. This value is null by default, which means that the plotCube color is the same as the parent chart area's background, or seemingly transparent.

Parameters:
background - the new plotCube background

getBackground

public Color getBackground()
Gets the plotCube background. This value is null by default, which means that the plotCube color is the same as the parent chart area's background, or seemingly transparent.

Returns:
the current plotCube background

setForeground

public void setForeground(Color foreground)
Sets the plotCube foreground. This value is null by default, which means that the plotCube color is the same as the parent chart area's foreground, or seemingly transparent.

Parameters:
foreground - the new plotCube foreground

getForeground

public Color getForeground()
Gets the plotCube foreground. This value is null by default, which means that the plotCube color is the same as the parent chart area's foreground, or seemingly transparent.

Returns:
the current plotCube foreground

getDrawBackground

public Color getDrawBackground()
Returns the actual background color drawn in the plotCube. If the user has set a plotCube background color, use it. Otherwise, use the parent JCChart3dArea's background color.

Returns:
the actual plotcube background color

getDrawForeground

public Color getDrawForeground()
Returns the foreground color used to draw items within the plotCube. Such items include the plotCube lines and the default mesh line color. If the user has set a plotCube foreground color, use it. Otherwise, use the parent JCChart3dArea's foreground color.

Returns:
the actual plotcube foreground color

setCeiling

public void setCeiling(com.klg.jclass.chart3d.JCProjection ceiling)
Sets the PlotCube's ceiling projection (null parameters are not allowed).

Parameters:
ceiling - the new projection for the ceiling of the cube

getCeiling

public com.klg.jclass.chart3d.JCProjection getCeiling()
Returns the PlotCube's ceiling projection.

Returns:
the PlotCube's ceiling projection

setFloor

public void setFloor(com.klg.jclass.chart3d.JCProjection floor)
Sets the PlotCube's floor projection (null parameters are not allowed).

Parameters:
floor - the new projection for the floor of the cube

getFloor

public com.klg.jclass.chart3d.JCProjection getFloor()
Returns the PlotCube's floor projection.

Returns:
the PlotCube's floor projection

hasCeilingProjection

public boolean hasCeilingProjection()
Asks whether this PlotCube has a ceiling projection.

Returns:

hasFloorProjection

public boolean hasFloorProjection()
Asks if this PlotCube has a floor projection.

Returns:

hasProjections

public boolean hasProjections()
Asks if this PlotCube has any projections.

Returns:

drawBoundingBox

protected void drawBoundingBox(Graphics gc,
                               boolean drawBackground)
Draws the bounding box for the plotcube (either 2d or 3d).

Parameters:
gc -
drawBackground -

setPoint

protected void setPoint(int i,
                        Matrix4d ctm,
                        double x,
                        double y,
                        double z)
Sets the ith ScreenPoint to the transformed value of the point (x,y,z).

Parameters:
i - the index of the screen point
ctm - the current transformation matrix
x - the x coordinate of the point
y - the y coordinate of the point
z - the z coordinate of the point

drawLine

protected void drawLine(Graphics gc,
                        int i,
                        int j)
Draws a line from point i to j.
Note: This method assumes the line style has been set and that the plotcube ScreenPoint array "pts" has been calculated for points i and j.

Parameters:
gc - the graphics context with which to draw
i - the index of the first point
j - the index of the second point

drawEdge

protected void drawEdge(Graphics gc,
                        int e)
Draws edge e.
Note: This method assumes the line style has been set and that the plotcube ScreenPoint array "pts" has been calculated.

Parameters:
gc - the graphics context with which to draw
e - the edge number to draw

draw3dBoundingBox

protected void draw3dBoundingBox(Graphics gc)
Draws the 3d bounding box. This method computes the plotcube ScreenPoint array "pts".

Parameters:
gc - the graphics context with which to draw

finishEdges

protected void finishEdges(Graphics gc)
Draws the rest of the cube edges that haven't been drawn before. This is done when projections have been drawn. This method assumes that the plotcube ScreenPoint array "pts" has been calculated.

Parameters:
gc - the graphics context used to draw

draw2dBoundingBox

protected void draw2dBoundingBox(Graphics gc,
                                 boolean drawBackground)
Draws the 2d bounding box. It is assumed that this routine first gets called with drawBackground = true (to compute the transformation and screen position of the bounding box and possibly the background) and then with drawBackground = false. This method computes the plotcube ScreenPoint array "pts" the first time through.

Parameters:
gc - the graphics context with which to draw
drawBackground - whether to draw the background

updateBoundingBox

protected void updateBoundingBox(Graphics gc,
                                 int axisId,
                                 int x,
                                 int y)
Erases and then draws the bounding box preview cube.

Parameters:
gc - the graphics context with which to draw
axisId - the id of the axis about which the preview cube is rotating
x - the x coordinate of the eye point for JCAxis.AXIS_EYE rotation
y - the y coordinate of the eye point for JCAxis.AXIS_EYE rotation

createParallelProjection

public void createParallelProjection(BufferedImage dest,
                                     com.klg.jclass.chart3d.JCProjection projection)
Creates a parallel projection of the chart (without the annotation) and stores it in a passed in image, filling the entire image with the projection. If there is any gap between the data and the dataport, the plot cube backgound will be used.

Parameters:
dest - the image to store the parallel projection in
projection - the JCProjection object that tells whether the projection is contoured and/or zoned

createParallelProjection

public void createParallelProjection(BufferedImage dest,
                                     com.klg.jclass.chart3d.JCProjection projection,
                                     Color background)
Creates a parallel projection of the chart (without the annotation) and stores it in a passed in image, filling the entire image with the projection. If there is any gap between the data and the dataport, the specified background color will be used.

Parameters:
dest - the image to store the parallel projection in
projection - the JCProjection object that tells whether the projection is contoured and/or zoned
background -

createParallelProjection

public void createParallelProjection(BufferedImage dest,
                                     com.klg.jclass.chart3d.JCProjection projection,
                                     int x,
                                     int y,
                                     int width,
                                     int height,
                                     Color background)
Creates a parallel projection of the chart (without the annotation) and stores it in a passed in image, at a given position, and with a given width and height within the image.

If there is any gap between the data and the dataport, the specified background color will be used.

Parameters:
dest - the image to store the parallel projection in
projection - the JCProjection object that tells whether the projection is contoured and/or zoned
x - the x position at which to place the projection in the image
y - the y position at which to place the projection in the image
width - the width (within the image) of the projection
height - the height (within the image) of the projection
background -

drawProjection

protected void drawProjection(Graphics gc,
                              boolean isFloor)
Draws the contoured and/or zoned surface projection on the floor or ceiling of the the plot cube. The idea is to alter the absolute tranformation so that it maps onto the bottom or top of the cube, reconstruct the view matrix, transform the data points and contour points, draw, set the transformation back to what it was, and transform again.

Parameters:
gc - the graphics context with which to draw
isFloor - if true, it is a floor projection; otherwise, it is a ceiling projection

drawGridLines

protected void drawGridLines(Graphics gc)
This method computes and draws the X, Y, and Z gridlines. It checks to see which faces are visible (precomputed during annotation phase and stored in the Cube object) and draws gridlines on the faces which the user has specifically requested.

Parameters:
gc - the graphics context with which to draw

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