JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.chart3d
Class BarFacet

java.lang.Object
  |
  +--com.klg.jclass.chart3d.FacetAbstract
        |
        +--com.klg.jclass.chart3d.BarFacet
All Implemented Interfaces:
Facet, Serializable

public class BarFacet
extends FacetAbstract

Class responsible for drawing bars

See Also:
Serialized Form

Field Summary
static int BAR_CONTOUR
           
static int BAR_ERASE
           
static int BAR_ERASE_MESH
           
static int BAR_FILL_MESH
           
static int BAR_FILLED
           
static int BAR_MESH
           
static int BAR_SIDES
           
static int FACE_A
           
static int FACE_B
           
static int FACE_C
           
static int FACE_D
           
static int FACE_H
           
static int FACE_L
           
static int FACE_NONE
           
protected static int[][] faceCorner
           
protected  Graphics gc
           
 
Fields inherited from class com.klg.jclass.chart3d.FacetAbstract
data, drawGrid, xPoints, yPoints
 
Constructor Summary
BarFacet()
          Default constructor.
BarFacet(com.klg.jclass.chart3d.DrawGrid drawGrid, Graphics gc)
          Constructor which supplies the drawing object and the Graphics object needed to draw
 
Method Summary
protected  void drawBar(int x, int y, int f0, int f1, Point4d[] plane, com.klg.jclass.chart3d.ScreenPoint[] top, com.klg.jclass.chart3d.ScreenPoint[] bottom)
          Main bar rendering routine.
protected  void drawBarContour(com.klg.jclass.chart3d.ScreenPoint[] spts, int f0, int f1)
          Draw a contour line on the side faces defined by face codes f0 and f1.
protected  void drawBarFace(com.klg.jclass.chart3d.ScreenPoint[] top, com.klg.jclass.chart3d.ScreenPoint[] bottom, int fCode, int style)
          Constructs and draws a face of a bar in the given style.
protected  void drawBarStyle(com.klg.jclass.chart3d.ScreenPoint[] top, com.klg.jclass.chart3d.ScreenPoint[] bottom, int f0, int f1, int style)
          Draw a bar or bar segement in a given style by drawing four bar faces (top, bottom, and the two side faces that can be seen from the current eye position) between the planes defined by top and bottom.
protected  void drawShadedBar(com.klg.jclass.chart3d.ScreenPoint[] top, com.klg.jclass.chart3d.ScreenPoint[] bottom, int f0, int f1, boolean above, com.klg.jclass.chart3d.JCGridColor gridColor)
          Draw an entire bar by drawing four bar faces (top, bottom, and the two side faces that can be seen from the current eye position) between the planes defined by top and bottom.
protected  com.klg.jclass.chart3d.ScreenPoint[] planeToScreen(Point4d[] plane, double zValue)
          Projects a plane in data space to screen coordinates.
 void processFacet(int x, int y, int edges)
          Process the facet at grid point (x, y) which for this class means drawing a bar at (x,y).
 
Methods inherited from class com.klg.jclass.chart3d.FacetAbstract
fillPointArrays, getDrawGrid, getScreenPoint, setDrawGrid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FACE_NONE

public static final int FACE_NONE
See Also:
Constant Field Values

FACE_A

public static final int FACE_A
See Also:
Constant Field Values

FACE_B

public static final int FACE_B
See Also:
Constant Field Values

FACE_C

public static final int FACE_C
See Also:
Constant Field Values

FACE_D

public static final int FACE_D
See Also:
Constant Field Values

FACE_H

public static final int FACE_H
See Also:
Constant Field Values

FACE_L

public static final int FACE_L
See Also:
Constant Field Values

faceCorner

protected static final int[][] faceCorner

BAR_MESH

public static final int BAR_MESH
See Also:
Constant Field Values

BAR_FILLED

public static final int BAR_FILLED
See Also:
Constant Field Values

BAR_FILL_MESH

public static final int BAR_FILL_MESH
See Also:
Constant Field Values

BAR_ERASE

public static final int BAR_ERASE
See Also:
Constant Field Values

BAR_ERASE_MESH

public static final int BAR_ERASE_MESH
See Also:
Constant Field Values

BAR_SIDES

public static final int BAR_SIDES
See Also:
Constant Field Values

BAR_CONTOUR

public static final int BAR_CONTOUR
See Also:
Constant Field Values

gc

protected transient Graphics gc
Constructor Detail

BarFacet

public BarFacet()
Default constructor.


BarFacet

public BarFacet(com.klg.jclass.chart3d.DrawGrid drawGrid,
                Graphics gc)
Constructor which supplies the drawing object and the Graphics object needed to draw

Parameters:
drawGrid - The drawing object that controls which bar is being drawn
gc - The Graphics object needed to draw
Method Detail

planeToScreen

protected com.klg.jclass.chart3d.ScreenPoint[] planeToScreen(Point4d[] plane,
                                                             double zValue)
Projects a plane in data space to screen coordinates. The plane is defined by four points, which represent the (x,y) position of a bar's four corners in data space. A zValue is supplied to defined the z position of the plane. The four points are then transformed to screen space and these points are returned.

Parameters:
plane - A plane consisting of four points that defines the x and y extents of the bar in data space
zValue - The zValue for each of the four points of the plane
Returns:
A list of four screen points corresponding to the projected plane

drawBarFace

protected void drawBarFace(com.klg.jclass.chart3d.ScreenPoint[] top,
                           com.klg.jclass.chart3d.ScreenPoint[] bottom,
                           int fCode,
                           int style)
Constructs and draws a face of a bar in the given style.

Parameters:
top - The top plane of the bar in screen space
bottom - The bottom plane of the bar in screen space
fCode - The face code for this bar face. Must be one of FACE_A, FACE_B, FACE_C, FACE_D, FACE_H, or FACE_L. If value is FACE_NONE, then nothing is drawn.
style - The bar drawing style. Is one of BAR_MESH, BAR_FILLED, BAR_FILL_MESH, BAR_ERASE, BAR_ERASE_MESH, BAR_SIDES, BAR_CONTOUR. See definitions above for explanation of styles.

drawBarContour

protected void drawBarContour(com.klg.jclass.chart3d.ScreenPoint[] spts,
                              int f0,
                              int f1)
Draw a contour line on the side faces defined by face codes f0 and f1. The spts array define four corner points of the bar in screen space for the contour level to be drawn. It is assumed that the gc has been previously updated so it will draw the line in the correct color, width and line style. Note that this method is faster than calling drawBarFace(..., BAR_CONTOUR)

Parameters:
spts - The four corner points of the bar for the given contour level in screen space.
f0 - The face code of a side face to be drawn for this bar. Must be one of FACE_A, FACE_B, FACE_C, FACE_D. If value is FACE_NONE, then no contour line is drawn.
f1 - The face code of a side face to be drawn for this bar. Must be one of FACE_A, FACE_B, FACE_C, FACE_D. If value is FACE_NONE, then no contour line is drawn.

drawBarStyle

protected void drawBarStyle(com.klg.jclass.chart3d.ScreenPoint[] top,
                            com.klg.jclass.chart3d.ScreenPoint[] bottom,
                            int f0,
                            int f1,
                            int style)
Draw a bar or bar segement in a given style by drawing four bar faces (top, bottom, and the two side faces that can be seen from the current eye position) between the planes defined by top and bottom. It is assumed that the gc has previously been updated with the correct information to draw the bar in the correct color, line style, fill style, etc.

Parameters:
top - The top plane of this bar (or bar segment) in screen space
bottom - The bottom plane of this bar (or bar segment) in screen space
f0 - The face code of a side face to be drawn for this bar. Must be one of FACE_A, FACE_B, FACE_C, FACE_D. If value is FACE_NONE, then no side face is drawn.
f1 - The face code of a side face to be drawn for this bar. Must be one of FACE_A, FACE_B, FACE_C, FACE_D. If value is FACE_NONE, then no side face is drawn.

drawShadedBar

protected void drawShadedBar(com.klg.jclass.chart3d.ScreenPoint[] top,
                             com.klg.jclass.chart3d.ScreenPoint[] bottom,
                             int f0,
                             int f1,
                             boolean above,
                             com.klg.jclass.chart3d.JCGridColor gridColor)
Draw an entire bar by drawing four bar faces (top, bottom, and the two side faces that can be seen from the current eye position) between the planes defined by top and bottom. If a gridColor for this bar has been defined, use it. Otherwise determine the color of the bar by shaded top or bottom color depending on whether the bar is above or below the z origin. It is assumed that other than the color the gc has previously been updated with the correct information to draw the bar in the correct line style, fill style, etc.

Parameters:
top - The top plane of this bar (or bar segment) in screen space
bottom - The bottom plane of this bar (or bar segment) in screen space
f0 - The face code of a side face to be drawn for this bar. Must be one of FACE_A, FACE_B, FACE_C, FACE_D. If value is FACE_NONE, then no side face is drawn.
f1 - The face code of a side face to be drawn for this bar. Must be one of FACE_A, FACE_B, FACE_C, FACE_D. If value is FACE_NONE, then no side face is drawn.
above - Is the bar above the z origin?
gridColor - The grid color used for this bar. Null if none has been defined for this bar.

drawBar

protected void drawBar(int x,
                       int y,
                       int f0,
                       int f1,
                       Point4d[] plane,
                       com.klg.jclass.chart3d.ScreenPoint[] top,
                       com.klg.jclass.chart3d.ScreenPoint[] bottom)
Main bar rendering routine. f0 and f1 indicate the sides of the bar (other than the top and bottom) which need to be drawn based on the eye position. The plane gives the x/y extents of the bar. top and bottom are precomputed screen position of the top and bottom faces.

Parameters:
x - The x grid index of the bar being drawn
y - The y grid index of the bar being drawn
f0 - The face code of a side face to be drawn for this bar. Must be one of FACE_A, FACE_B, FACE_C, FACE_D. If value is FACE_NONE, then no side face is drawn.
f1 - The face code of a side face to be drawn for this bar. Must be one of FACE_A, FACE_B, FACE_C, FACE_D. If value is FACE_NONE, then no side face is drawn.
plane - A plane that defines the x and y extents of the bar in data space
top - The top plane of the bar in screen space
bottom - The bottom plane of the bar in screen space

processFacet

public void processFacet(int x,
                         int y,
                         int edges)
Process the facet at grid point (x, y) which for this class means drawing a bar at (x,y). Based on the grid region (@see GridRegion), determine which faces of the bar are visible and then call drawBar to actually draw the bar.

Specified by:
processFacet in interface Facet
Specified by:
processFacet in class FacetAbstract
Parameters:
x - The x grid index of the bar being drawn
y - The y grid index of the bar being drawn
edges - The grid region that the bar is in.

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