JavaView® v2.00.008

jv.thirdParty.ruler
Class PgAxes

java.lang.Object
  |
  +--jv.object.PsObject
        |
        +--jv.project.PgGeometry
              |
              +--jv.thirdParty.ruler.PgAxes
All Implemented Interfaces:
java.lang.Cloneable, PgGeometryIf, PsUpdateIf, java.io.Serializable

public class PgAxes
extends PgGeometry

An Axes Geometry is a Composition of Rulers. This object constucts a variety of customizable 2D and 3D axes. A 1D axes is a ruler alone, so instantiate from that the ruler.PgRuler class.

Version:
08.08.00, 1.00 created (spd)
Author:
Steve Dugaro
See Also:
PgRuler, Serialized Form

Field Summary
protected  int ALIGN_LABEL_CENTER
           
protected  int ALIGN_LABEL_LEFT
           
protected  int ALIGN_LABEL_RIGHT
           
static int AXES_2DXY_CENTER
           
static int AXES_2DXY_CORNER
           
static int AXES_2DYZ_CENTER
           
static int AXES_2DYZ_CORNER
           
static int AXES_2DZX_CENTER
           
static int AXES_2DZX_CORNER
           
static int AXES_3DBOUNDINGBOX
           
static int AXES_3DCENTRAL
           
static int AXES_3DCORNER
           
protected  int BIND_LABEL_CENTER
           
protected  int BIND_LABEL_LEFT
           
protected  int BIND_LABEL_RIGHT
           
protected  int defScale
           
protected  boolean m_bAutoConfigure
           
protected  boolean m_bFixedMode
          Flag specifying which of 3 2d axes in 3 space are requested. 0:XY, 1:YZ, 2:ZX
protected  boolean m_bMajor
          Flag for showing major hashings everywhere
protected  boolean m_bMinor
          Flag for showing minor hashings everywhere
protected  PdVector[] m_bndBox
           
protected  boolean m_bShowLabels
          Flag for showing the labels everywhere
protected  boolean m_bShowTitles
          Flag for showing the title everywhere
protected  int m_currentRuler
           
protected  PuDouble m_majorHashUnits
           
protected  PuDouble m_minorHashUnits
           
protected  int m_mode
           
protected  PuInteger m_numMajorHashings
           
protected  PuInteger m_numMinorHashings
           
protected  PdVector m_posXDir
           
protected  PdVector m_posYDir
           
protected  PdVector m_posZDir
           
protected  double m_scale
           
protected  boolean[] m_showHashingFlags
          flags correspond to showing the hashmarks along [Xn,Xup,Yn, Yup, Zn, Zup] xyGrid [TFFTFF]; yzGrid [FFTFFT]; zxGrid [FTFFTF]
protected  PdVector m_viewVect
           
protected  PgRuler m_xaxis
           
protected  PgRuler m_yaxis
           
protected  PgRuler m_zaxis
           
protected  int MAX
           
protected  int MIN
           
protected  int N
           
protected  int NEGN
           
protected  int NEGU
           
protected  int[] stdAlignmnt
           
protected  int U
           
protected  int X
           
protected  int XN
           
protected  int xoff
           
protected  int XUP
           
protected  int Y
           
protected  int YN
           
protected  int yoff
           
protected  int YUP
           
protected  int Z
           
protected  int ZN
           
protected  int ZUP
           
 
Fields inherited from class jv.project.PgGeometry
m_ambientProj, m_ambientSpace, m_authorInfo, m_bShowBndBox, m_bShowCenter, m_bShowing, m_bShowTitle, m_center, m_dim, m_dimOfSimplex, m_displayList, m_geometryInfo, m_labelAttribute, m_methodMenu, m_modelMatrix, m_title, m_version, m_versionType
 
Fields inherited from class jv.object.PsObject
HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_MATERIAL_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_SELECTED, IS_USED, m_infoPanel, m_name, m_panelList, m_parent, m_tag, m_updateList, NUM_TAGS
 
Fields inherited from interface jv.project.PgGeometryIf
AMBIENT_H3_HYPERBOLIC, AMBIENT_PROJECTIONS, AMBIENT_R3_EUCLIDEAN, AMBIENT_R4_EUCLIDEAN, AMBIENT_S3_SPHERE, AMBIENT_SPACES, INSPECTOR_CONTROL, INSPECTOR_CONTROL_EXT, INSPECTOR_MATERIAL, INSPECTOR_MATERIAL_EXT, LABEL_BASE, LABEL_CENTER, LABEL_HEAD, LABEL_MIDDLE, LABEL_TAIL, LABEL_TOP, METHOD_EXT, PROJ_KLEIN_BALL, PROJ_PARALLEL, PROJ_POINCARE_BALL, PROJ_STEREOGRAPHIC, PROJ_UPPER_HALFSPACE
 
Constructor Summary
PgAxes()
           
 
Method Summary
 void configure(PdVector[] bndBox, PdVector viewDir)
           
protected  void constructAxes()
           
 PgGeometry[] getAxes()
          3 axes will be returned.
 int getMode()
           
 void init()
          Initializes and resets geometry.
 boolean isShowingLabels()
           
 boolean isShowingMajorHashings()
           
 boolean isShowingMinorHashings()
           
 boolean isShowingTitles()
           
 boolean isShowingXYGrid()
           
 boolean isShowingYZGrid()
           
 boolean isShowingZXGrid()
           
protected  void modeBoundingBox()
          Bounding Box Mode: Axes and grid faces appear in the front of the boudnig box.
protected  void modeCentral()
          Central Mode: The zero hashing of the x, y and z axes all intersect at the world (true) origin.
protected  void modeCorner()
          Corner Axes Mode : All the mins meet at one corner, grid faces and axes fall in the back faces of the bounding box.
protected  void moveXAxis(PdVector v)
          move the origin of the x-axis wrt the origin of this Axis
protected  void moveYAxis(PdVector v)
          move the origin of the y-axis wrt the origin of this Axis
protected  void moveZAxis(PdVector v)
          move the origin of the z-axis wrt the origin of this Axis
 void setAllAxesTitles(java.lang.String xTitle, java.lang.String yTitle, java.lang.String zTitle)
           
 void setAllDynamicHashing(int major, int minor)
           
 void setAllFixedHashings(double major, double minor)
           
 void setAllTitleAlignments(int[] xAlign, int[] yAlign, int[] zAlign)
          each parameter is an array of 4 int values, [ruleralignment, labelalignment deltax, deltay] where ruleralignment:={ALIGN_LABEL_LEFT,ALIGN_LABEL_RIGHT,ALIGN_LABEL_CENTER} labelalignment:={ALIGN_LABEL_LEFT,ALIGN_LABEL_RIGHT} and deltax|y is the number of pixels to displace the label in the x|y direction.
 void setAutoConfigure(boolean flag)
          If set to true, axes in "absolute unit mode" will automatically adjust to a 'good' viewing scale based on the bounding box passed into configure().
protected  void setHashingsForUninvolvedAxes(int xdir, int ydir, int zdir)
          The hash sizes and hash directions are set for axes which do not participate in the construction of a grid. i.e. specify how you would like the grid to look when it isnt part of a grid
 void setMode(int i)
           
protected  void setVisibleAxes(boolean showx, boolean showy, boolean showz)
           
 void showAllFixedMode(boolean f)
           
 void showAllLabels(boolean f)
           
 void showAllMajorHashings(boolean f)
           
 void showAllMinorHashings(boolean f)
           
 void showAllTitles(boolean f)
           
 void showAxesLabels(boolean showX, boolean showY, boolean showZ)
           
 void showAxesTitles(boolean showX, boolean showY, boolean showZ)
           
 void showXYGrid(boolean flag)
           
 void showYZGrid(boolean flag)
           
 void showZXGrid(boolean flag)
           
protected  void syncronizeHashingFlags()
          Communicates the direction(s) in which hashings of each ruler should be drawn from m_showHashingFlags of this class to each constituent ruler.
 boolean update(java.lang.Object event)
          Update method of geometry updates registered panels, update listeners, and invokes a repaint in the registered displays.
 
Methods inherited from class jv.project.PgGeometry
addDisplay, addElement, addPolygon, addVertex, blend, clearTagElement, clearTagPolygon, clearTagVertex, clone, copy, fillMethodMenu, getAmbientProjection, getAmbientSpace, getAuthorInfo, getAuthors, getBounds, getCenter, getCenterOfElement, getControlPanel, getDiameter, getDimOfSimplex, getDimOfVertices, getDisplays, getElement, getGeometryInfo, getJvx, getLabelAttribute, getMaterialPanel, getModelMatrix, getPolygon, getTextureImage, getTextureImageName, getTitle, getVersion, getVersionType, getVertex, hasDisplay, hasModelMatrix, hasTagElement, hasTagPolygon, hasTagVertex, intersectionWithLine, isConfigurable, isShowingBndBox, isShowingCenter, isShowingTitle, isVisible, merge, paint, reflect, removeDisplay, removeElement, removePolygon, removeVertex, setAmbientProjection, setAmbientSpace, setAuthorInfo, setAuthors, setCenter, setDimOfSimplex, setElement, setGeometryInfo, setJvx, setLabelAttribute, setLabelAttribute, setModelMatrix, setPolygon, setTagElement, setTagPolygon, setTagVertex, setTextureImage, setTextureImageName, setTitle, setVersion, setVersionType, setVertex, setVisible, showBndBox, showCenter, showTitle, toString
 
Methods inherited from class jv.object.PsObject
addInspector, addUpdateListener, clearTag, clone, clone, copy, getFather, getInfoPanel, getInspector, getName, getNumObjects, hasInspector, hasTag, hasUpdateListener, instanceOf, instanceOf, removeInspector, removeUpdateListener, setName, setParent, setTag, updatePanels
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jv.project.PgGeometryIf
getInfoPanel, getName, setName
 
Methods inherited from interface jv.object.PsUpdateIf
getFather, setParent
 

Field Detail

AXES_3DCENTRAL

public static final int AXES_3DCENTRAL

AXES_3DCORNER

public static final int AXES_3DCORNER

AXES_3DBOUNDINGBOX

public static final int AXES_3DBOUNDINGBOX

AXES_2DXY_CENTER

public static final int AXES_2DXY_CENTER

AXES_2DYZ_CENTER

public static final int AXES_2DYZ_CENTER

AXES_2DZX_CENTER

public static final int AXES_2DZX_CENTER

AXES_2DXY_CORNER

public static final int AXES_2DXY_CORNER

AXES_2DYZ_CORNER

public static final int AXES_2DYZ_CORNER

AXES_2DZX_CORNER

public static final int AXES_2DZX_CORNER

ALIGN_LABEL_LEFT

protected final int ALIGN_LABEL_LEFT

ALIGN_LABEL_RIGHT

protected final int ALIGN_LABEL_RIGHT

ALIGN_LABEL_CENTER

protected final int ALIGN_LABEL_CENTER

BIND_LABEL_LEFT

protected final int BIND_LABEL_LEFT

BIND_LABEL_RIGHT

protected final int BIND_LABEL_RIGHT

BIND_LABEL_CENTER

protected final int BIND_LABEL_CENTER

XN

protected final int XN

XUP

protected final int XUP

YN

protected final int YN

YUP

protected final int YUP

ZN

protected final int ZN

ZUP

protected final int ZUP

MIN

protected final int MIN

MAX

protected final int MAX

X

protected final int X

Y

protected final int Y

Z

protected final int Z

N

protected final int N

U

protected final int U

NEGN

protected final int NEGN

NEGU

protected final int NEGU

defScale

protected final int defScale

xoff

protected final int xoff

yoff

protected final int yoff

stdAlignmnt

protected final int[] stdAlignmnt

m_showHashingFlags

protected boolean[] m_showHashingFlags
flags correspond to showing the hashmarks along [Xn,Xup,Yn, Yup, Zn, Zup] xyGrid [TFFTFF]; yzGrid [FFTFFT]; zxGrid [FTFFTF]

m_bFixedMode

protected boolean m_bFixedMode
Flag specifying which of 3 2d axes in 3 space are requested. 0:XY, 1:YZ, 2:ZX

m_bMajor

protected boolean m_bMajor
Flag for showing major hashings everywhere

m_bMinor

protected boolean m_bMinor
Flag for showing minor hashings everywhere

m_bShowLabels

protected boolean m_bShowLabels
Flag for showing the labels everywhere

m_bShowTitles

protected boolean m_bShowTitles
Flag for showing the title everywhere

m_numMajorHashings

protected PuInteger m_numMajorHashings

m_numMinorHashings

protected PuInteger m_numMinorHashings

m_majorHashUnits

protected PuDouble m_majorHashUnits

m_minorHashUnits

protected PuDouble m_minorHashUnits

m_bndBox

protected PdVector[] m_bndBox

m_viewVect

protected PdVector m_viewVect

m_xaxis

protected PgRuler m_xaxis

m_yaxis

protected PgRuler m_yaxis

m_zaxis

protected PgRuler m_zaxis

m_posXDir

protected PdVector m_posXDir

m_posYDir

protected PdVector m_posYDir

m_posZDir

protected PdVector m_posZDir

m_mode

protected int m_mode

m_currentRuler

protected int m_currentRuler

m_scale

protected double m_scale

m_bAutoConfigure

protected boolean m_bAutoConfigure
Constructor Detail

PgAxes

public PgAxes()
Method Detail

init

public void init()
Description copied from class: PgGeometry
Initializes and resets geometry.
Overrides:
init in class PgGeometry

update

public boolean update(java.lang.Object event)
Description copied from class: PgGeometry
Update method of geometry updates registered panels, update listeners, and invokes a repaint in the registered displays. Usage:
1. event == this : geometry has changed, all panels will be updated.
2. event == null : geometry has changed, no need to update a panel.
3. event == a panel : geometry has changed, all panels except 'panel' will be updated.
3. event == else : unhandled event, error.
Panels are not updated if they have not been created yet, or if they are not visible.

Any update is forwarded to the parent of the geometry with the geometry as event.

Any update is forwarded to each registered display with the geometry as event which leads to a repaint of the display.
Overrides:
update in class PgGeometry
Following copied from interface: jv.object.PsUpdateIf
Parameters:
event - carries a lot of information
Returns:
true if event has been handled, otherwise false
See Also:
PsObject, PsUpdateIf.getFather(), PsUpdateIf.setParent(PsUpdateIf)

isShowingXYGrid

public boolean isShowingXYGrid()

isShowingYZGrid

public boolean isShowingYZGrid()

isShowingZXGrid

public boolean isShowingZXGrid()

isShowingMajorHashings

public boolean isShowingMajorHashings()

isShowingMinorHashings

public boolean isShowingMinorHashings()

isShowingLabels

public boolean isShowingLabels()

isShowingTitles

public boolean isShowingTitles()

showXYGrid

public void showXYGrid(boolean flag)

showYZGrid

public void showYZGrid(boolean flag)

showZXGrid

public void showZXGrid(boolean flag)

showAllFixedMode

public void showAllFixedMode(boolean f)

showAllMajorHashings

public void showAllMajorHashings(boolean f)

showAllMinorHashings

public void showAllMinorHashings(boolean f)

showAllLabels

public void showAllLabels(boolean f)

showAllTitles

public void showAllTitles(boolean f)

showAxesLabels

public void showAxesLabels(boolean showX,
                           boolean showY,
                           boolean showZ)

showAxesTitles

public void showAxesTitles(boolean showX,
                           boolean showY,
                           boolean showZ)

setAllTitleAlignments

public void setAllTitleAlignments(int[] xAlign,
                                  int[] yAlign,
                                  int[] zAlign)
each parameter is an array of 4 int values, [ruleralignment, labelalignment deltax, deltay] where ruleralignment:={ALIGN_LABEL_LEFT,ALIGN_LABEL_RIGHT,ALIGN_LABEL_CENTER} labelalignment:={ALIGN_LABEL_LEFT,ALIGN_LABEL_RIGHT} and deltax|y is the number of pixels to displace the label in the x|y direction.

setAllAxesTitles

public void setAllAxesTitles(java.lang.String xTitle,
                             java.lang.String yTitle,
                             java.lang.String zTitle)

setAllFixedHashings

public void setAllFixedHashings(double major,
                                double minor)

setAllDynamicHashing

public void setAllDynamicHashing(int major,
                                 int minor)

setAutoConfigure

public void setAutoConfigure(boolean flag)
If set to true, axes in "absolute unit mode" will automatically adjust to a 'good' viewing scale based on the bounding box passed into configure(). Essentially the scale jumps up or down by a factor of 10 if any length of the bounding box is streched to 10*currentscale + 10*currentscale/2 or squashed to currentscale/10 - currentscale/10*2. In other words, an attempt is made to maintain approximately 10 hashings over each ruler. This need not apply to the "partitioned ruler mode" as the ruler is already subdivided. This is true by default - set to false if many more hashings are needed. Note that in this mode a sigle minor hashing will be placed between each major hashings whenever a reconfiguration is needed.

setMode

public void setMode(int i)

getMode

public int getMode()

getAxes

public PgGeometry[] getAxes()
3 axes will be returned. The ones you add to the display are up to you, but computations will be done for all assuming all will be displayed.

configure

public void configure(PdVector[] bndBox,
                      PdVector viewDir)

constructAxes

protected void constructAxes()

modeCentral

protected void modeCentral()
Central Mode: The zero hashing of the x, y and z axes all intersect at the world (true) origin. The axes extremities extend to touch the walls of the given bounding box.

modeCorner

protected void modeCorner()
Corner Axes Mode : All the mins meet at one corner, grid faces and axes fall in the back faces of the bounding box.

modeBoundingBox

protected void modeBoundingBox()
Bounding Box Mode: Axes and grid faces appear in the front of the boudnig box.

syncronizeHashingFlags

protected void syncronizeHashingFlags()
Communicates the direction(s) in which hashings of each ruler should be drawn from m_showHashingFlags of this class to each constituent ruler.

setHashingsForUninvolvedAxes

protected void setHashingsForUninvolvedAxes(int xdir,
                                            int ydir,
                                            int zdir)
The hash sizes and hash directions are set for axes which do not participate in the construction of a grid. i.e. specify how you would like the grid to look when it isnt part of a grid

moveXAxis

protected void moveXAxis(PdVector v)
move the origin of the x-axis wrt the origin of this Axis

moveYAxis

protected void moveYAxis(PdVector v)
move the origin of the y-axis wrt the origin of this Axis

moveZAxis

protected void moveZAxis(PdVector v)
move the origin of the z-axis wrt the origin of this Axis

setVisibleAxes

protected void setVisibleAxes(boolean showx,
                              boolean showy,
                              boolean showz)

JavaView® v2.00.008

The software JavaView® is copyright protected. All Rights Reserved.