JavaView® v2.12

jv.thirdParty.ruler
Class PgRuler

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

public final class PgRuler
extends PgJvxSrc

A Ruler has an origin in 3-space, a direction in 3-space, and min and max exents along this so-defined line - thus we allow for the origin, direction, and extents of the ruler to be externally controlled. Based on this data, the ruler itself will configure its' appearance according to specifications given in its configuration panel.

Version:
16.05.01, 3.00 revised (kp) Superclass changed to PgJvxSrc.
31.03.01, 2.00 revised (kp) Major revision to increase update speed.
27.09.00, 1.01 revised (spd) measure was added to make the ruler act as a measuring tape. Set the origin for the anchor point with setInitPoint then pass this the endpoint.
07.07.00, 1.00 created (spd)
Author:
Steve Dugaro
See Also:
PgRuler, Serialized Form

Field Summary
static int NORMAL_DIRECTION
           
static int TITLE_ALIGN_CENTER
           
static int TITLE_ALIGN_LEFT
           
static int TITLE_ALIGN_RIGHT
           
static int UP_VECTOR_DIRECTION
           
 
Fields inherited from class jv.object.PsObject
HAS_CONFIG_PANEL, HAS_INFO_PANEL, HAS_MATERIAL_PANEL, HAS_TEXTURE_PANEL, INSPECTOR_INFO, INSPECTOR_INFO_EXT, IS_DELETED, IS_FIXED, IS_SELECTED, IS_USED, NUM_TAGS
 
Fields inherited from interface jv.project.PgGeometryIf
AMBIENT_H2_HYPERBOLIC, AMBIENT_H3_HYPERBOLIC, AMBIENT_H4_HYPERBOLIC, AMBIENT_PROJECTIONS, AMBIENT_R1_EUCLIDEAN, AMBIENT_R2_EUCLIDEAN, AMBIENT_R3_EUCLIDEAN, AMBIENT_R4_EUCLIDEAN, AMBIENT_R5_EUCLIDEAN, AMBIENT_S1_SPHERE, AMBIENT_S2_SPHERE, AMBIENT_S3_SPHERE, AMBIENT_S4_SPHERE, AMBIENT_SPACES, INSPECTOR_CONTROL, INSPECTOR_CONTROL_EXT, INSPECTOR_MATERIAL, INSPECTOR_MATERIAL_EXT, INSPECTOR_TEXTURE, INSPECTOR_TEXTURE_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
PgRuler()
           
PgRuler(int dim)
           
PgRuler(PdVector rulerDir, PdVector rulerNormal)
          Create a new ruler with given direction and normal direction for hashings.
 
Method Summary
 double getMajorUnit()
           
 double getMaxParameter()
           
 double getMinorUnit()
           
 double getMinParameter()
           
 int getNumMajorPartitions()
           
 int getNumMinorPartitions()
           
 void init()
          Initializes and resets geometry.
 boolean isShowingFixedMode()
           
 boolean isShowingHashingsInNormalDir()
           
 boolean isShowingHashingsInUpDir()
           
 boolean isShowingLabels()
           
 boolean isShowingMajorHashings()
          Determines whether the ruler should be partitioned as fixed or dynamic and then sets m_tiMajor accordingly.
 boolean isShowingMinorHashings()
           
 boolean isShowingRulerName()
           
 void setDefaultHashSizes(int orthogonalType)
           
 void setDirection(PdVector dir)
          Set direction of the baseline of the ruler.
 void setEndPoint(PdVector endPnt, PdVector viewDir)
          Measure, is a way of using the ruler as a Tape measure.
 void setFixedHashing(double major, double minor)
           
 void setHashLabel(int xoff, int yoff, int labelhSide, int labelvSide)
          Customizes the positioning of the label at hashings.
 void setHashOffsetInNormalDir(double xoff, double yoff, double zoff)
           
 void setHashOffsetInUpDir(double xoff, double yoff, double zoff)
           
 void setMajorColor(java.awt.Color C)
           
 void setMajorHashSize(double pt1, double pt2, int orthoType)
          Set the endpoints of the hashings along the up or normal vectors
 void setMinMax(double min, double max)
           
 void setMinorColor(java.awt.Color C)
           
 void setMinorHashSize(double pt1, double pt2, int orthogonalType)
          Set the endpoints of the hashings along the up or normal vectors
 void setNameAlignment(int align, int labelhSide, int xoff, int yoff)
          Customizes the positioning of the title of the ruler.
 void setNormal(PdVector N)
          Set direction of the normal vector along which the hashings will be drawn - Normalization will be done within this method
 void setOrigin(PdVector orig)
          Set the origin of the ruler to the specific point in space.
 void setPartitionedHashing(int major, int minor)
           
 void setRulerName(java.lang.String s)
           
 void setRulerName(java.lang.String s, boolean show)
          see setRulerName(s,pos,show)
 void setRulerName(java.lang.String s, int pos)
           
 void setRulerName(java.lang.String s, int pos, boolean show)
           
 void setUpVector(PdVector U)
          Set direction of the up vector along which a secondary set of hashings will be drawn - Normalization will be done within this method
 void showFixedMode(boolean flag)
           
 void showHashingsInNormalDir(boolean flag)
           
 void showHashingsInUpDir(boolean flag)
           
 void showLabels(boolean flag)
           
 void showMajorHashings(boolean flag)
           
 void showMinorHashings(boolean flag)
           
 void showRulerName(boolean flag)
           
 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.PgJvxSrc
addEdge, addElement, addPolygon, addVertex, assureEdgeColors, assureElementBackColors, assureElementColors, assureElementNormals, assureElementTextures, assureNeighbours, assurePolygonColors, assurePolygonNormals, assureVectorColors, assureVertexColors, assureVertexNormals, assureVertexTextures, clearTagVertex, clone, copy, getAmbientBounds, getBounds, getDimOfVectors, getEdge, getEdgeColors, getEdges, getElement, getElementBackColors, getElementColors, getElementNormals, getElements, getElementTextures, getGlobalBndColor, getGlobalBndSize, getGlobalBndTagColor, getGlobalEdgeColor, getGlobalEdgeSize, getGlobalEdgeTagColor, getGlobalElementBackColor, getGlobalElementColor, getGlobalElementNormalColor, getGlobalElementNormalLength, getGlobalElementNormalSize, getGlobalElementTagColor, getGlobalPolygonColor, getGlobalPolygonNormalColor, getGlobalPolygonNormalLength, getGlobalPolygonNormalSize, getGlobalPolygonSize, getGlobalPolygonTagColor, getGlobalVectorColor, getGlobalVectorLength, getGlobalVectorSize, getGlobalVertexColor, getGlobalVertexNormalColor, getGlobalVertexNormalLength, getGlobalVertexNormalSize, getGlobalVertexSize, getGlobalVertexTagColor, getJvx, getNeighbours, getNumEdges, getNumElements, getNumPolygons, getNumVectorFields, getNumVectors, getNumVertices, getPolygon, getPolygonColors, getPolygonNormals, getPolygons, getTextureImage, getTextureImageName, getType, getVectorFieldColors, getVectorFieldName, getVectors, getVertex, getVertexColors, getVertexFunctions, getVertexNormals, getVertexTextures, getVertices, hasTagVertex, isDefaultLabelEnabled, isShowingBackface, isShowingBoundaries, isShowingEdgeColors, isShowingEdgeLabels, isShowingEdges, isShowingElementBackColor, isShowingElementBackColors, isShowingElementColors, isShowingElementLabels, isShowingElementNormalArrow, isShowingElementNormals, isShowingElements, isShowingElementTexture, isShowingIndices, isShowingOutline, isShowingPolygonColors, isShowingPolygonEndArrow, isShowingPolygonLabels, isShowingPolygonNormalArrow, isShowingPolygonNormals, isShowingPolygons, isShowingPolygonStartArrow, isShowingVectorArrows, isShowingVectorColors, isShowingVectorField, isShowingVertexColors, isShowingVertexLabels, isShowingVertexNormalArrow, isShowingVertexNormals, isShowingVertexTexture, isShowingVertices, isVectorElementBased, makeElementColorsFromXYZ, makeElementNormals, makeQuadrConn, paint, reflect, setDefaultLabelEnabled, setDimOfElements, setDimOfPolygons, setDimOfVertices, setEdge, setEdgeColors, setEdges, setElement, setElementBackColors, setElementBased, setElementColors, setElementNormals, setElements, setElementTextures, setGlobalBndColor, setGlobalBndSize, setGlobalBndTagColor, setGlobalEdgeColor, setGlobalEdgeSize, setGlobalEdgeTagColor, setGlobalElementBackColor, setGlobalElementColor, setGlobalElementNormalColor, setGlobalElementNormalLength, setGlobalElementNormalSize, setGlobalElementTagColor, setGlobalPolygonColor, setGlobalPolygonNormalColor, setGlobalPolygonNormalLength, setGlobalPolygonNormalSize, setGlobalPolygonSize, setGlobalPolygonTagColor, setGlobalVectorColor, setGlobalVectorLength, setGlobalVectorSize, setGlobalVertexColor, setGlobalVertexNormalColor, setGlobalVertexNormalLength, setGlobalVertexNormalSize, setGlobalVertexSize, setGlobalVertexTagColor, setJvx, setNeighbours, setNumEdges, setNumElements, setNumPolygons, setNumVectorFields, setNumVectors, setNumVertices, setPolygon, setPolygonColors, setPolygonNormals, setPolygons, setState, setTagVertex, setTextureImage, setTextureImageName, setType, setVectorColors, setVectorElementBased, setVectorFieldName, setVectors, setVertex, setVertexColors, setVertexFunctions, setVertexNormals, setVertexTextures, setVertices, showBackface, showBoundaries, showEdgeColors, showEdgeLabels, showEdges, showElementBackColor, showElementBackColors, showElementColors, showElementLabels, showElementNormalArrow, showElementNormals, showElements, showElementTexture, showIndices, showOutline, showPolygonColors, showPolygonEndArrow, showPolygonLabels, showPolygonNormalArrow, showPolygonNormals, showPolygons, showPolygonStartArrow, showVectorArrows, showVectorColors, showVectorField, showVertexColors, showVertexLabels, showVertexNormalArrow, showVertexNormals, showVertexTexture, showVertices
 
Methods inherited from class jv.project.PgGeometry
addDisplay, blend, clearTagElement, clearTagPolygon, copy, fillMethodMenu, getAmbientInvMatrix, getAmbientMatrix, getAmbientProjection, getAmbientSpace, getAuthorInfo, getAuthors, getCenter, getCenterOfElement, getControlPanel, getDiameter, getDimOfSimplex, getDimOfVertices, getDisplays, getGeometryInfo, getLabelAttribute, getMaterialPanel, getModelMatrix, getTitle, getVersion, getVersionType, hasAmbientMatrix, hasDisplay, hasModelMatrix, hasTagElement, hasTagPolygon, intersectionWithLine, isConfigurable, isShowingBndBox, isShowingCenter, isShowingTitle, isVisible, merge, removeDisplay, removeElement, removePolygon, removeVertex, setAmbientMatrix, setAmbientProjection, setAmbientSpace, setAuthorInfo, setAuthors, setCenter, setDimOfSimplex, setGeometryInfo, setLabelAttribute, setLabelAttribute, setModelMatrix, setTagElement, setTagPolygon, setTitle, setVersion, setVersionType, setVisible, showBndBox, showCenter, showTitle, toString
 
Methods inherited from class jv.object.PsObject
addInspector, addUpdateListener, assureInspector, 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, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jv.project.PgGeometryIf
assureInspector, getInfoPanel, getName, setName
 
Methods inherited from interface jv.object.PsUpdateIf
getFather, setParent
 

Field Detail

NORMAL_DIRECTION

public static final int NORMAL_DIRECTION

UP_VECTOR_DIRECTION

public static final int UP_VECTOR_DIRECTION

TITLE_ALIGN_LEFT

public static final int TITLE_ALIGN_LEFT

TITLE_ALIGN_RIGHT

public static final int TITLE_ALIGN_RIGHT

TITLE_ALIGN_CENTER

public static final int TITLE_ALIGN_CENTER
Constructor Detail

PgRuler

public PgRuler()

PgRuler

public PgRuler(int dim)

PgRuler

public PgRuler(PdVector rulerDir,
               PdVector rulerNormal)
Create a new ruler with given direction and normal direction for hashings. Both vectors must be orthogonal but need not be normalized.
Parameters:
rulerDir - direction of baseline of ruler
rulerMormal - vector orthogonal to direction of baseline
Method Detail

init

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

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)

isShowingMajorHashings

public boolean isShowingMajorHashings()
Determines whether the ruler should be partitioned as fixed or dynamic and then sets m_tiMajor accordingly. Also if the ruler does not have a positive length FAIL is returned meaning m_tiMajor has not been changed thus the hashing computations can be avoided alltogether.

isShowingMinorHashings

public boolean isShowingMinorHashings()

isShowingHashingsInNormalDir

public boolean isShowingHashingsInNormalDir()

isShowingHashingsInUpDir

public boolean isShowingHashingsInUpDir()

isShowingLabels

public boolean isShowingLabels()

isShowingRulerName

public boolean isShowingRulerName()

isShowingFixedMode

public boolean isShowingFixedMode()

getMaxParameter

public double getMaxParameter()

getMinParameter

public double getMinParameter()

getNumMajorPartitions

public int getNumMajorPartitions()

getNumMinorPartitions

public int getNumMinorPartitions()

getMajorUnit

public double getMajorUnit()

getMinorUnit

public double getMinorUnit()

showRulerName

public void showRulerName(boolean flag)

showLabels

public void showLabels(boolean flag)

showFixedMode

public void showFixedMode(boolean flag)

showMajorHashings

public void showMajorHashings(boolean flag)

showMinorHashings

public void showMinorHashings(boolean flag)

showHashingsInNormalDir

public void showHashingsInNormalDir(boolean flag)

showHashingsInUpDir

public void showHashingsInUpDir(boolean flag)

setEndPoint

public void setEndPoint(PdVector endPnt,
                        PdVector viewDir)
Measure, is a way of using the ruler as a Tape measure. To use this method you simply need to pass it an endpoint from which a measurement is made from the currently defined ruler origin set via #setOrigin(). Hashings will only be automatically visible if measurements are made in the xy,yz, or xz perspectives. For the arbitrary perspective case you must explicity give a direction in which to draw the hash, else results may be unpredictable.

setOrigin

public void setOrigin(PdVector orig)
Set the origin of the ruler to the specific point in space.
Parameters:
orig - new origin of ruler

setDirection

public void setDirection(PdVector dir)
Set direction of the baseline of the ruler. Normalization will be done within this method.
Parameters:
dir - direction vector of the baseline of the ruler

setNormal

public void setNormal(PdVector N)
Set direction of the normal vector along which the hashings will be drawn - Normalization will be done within this method
Parameters:
N - a 3d vector (based at the origin) specifying the direction in which to draw the hashings

setUpVector

public void setUpVector(PdVector U)
Set direction of the up vector along which a secondary set of hashings will be drawn - Normalization will be done within this method
Parameters:
U - a 3d vector (based at the origin) specifying the direction in which to draw the hashings

setMajorHashSize

public void setMajorHashSize(double pt1,
                             double pt2,
                             int orthoType)
Set the endpoints of the hashings along the up or normal vectors
Parameters:
orthoType - specify which of 2 perpendicular directions that hashing occurs.
pt1 - a scalar multiple of the hash vector representing one endpoint of the hash line
pt2 - a scalar multiple of the hash vector representing the other endpoint of the hash line

setDefaultHashSizes

public void setDefaultHashSizes(int orthogonalType)

setMinorHashSize

public void setMinorHashSize(double pt1,
                             double pt2,
                             int orthogonalType)
Set the endpoints of the hashings along the up or normal vectors
Parameters:
orthogonalType: - specify which of 2 perpendicular directions that hashing occurs.
pt1 - a scalar multiple of the hash vector representing one endpoint of the hash line
pt2 - a scalar multiple of the hash vector representing the other endpoint of the hash line

setFixedHashing

public void setFixedHashing(double major,
                            double minor)

setPartitionedHashing

public void setPartitionedHashing(int major,
                                  int minor)

setMinMax

public void setMinMax(double min,
                      double max)

setMajorColor

public void setMajorColor(java.awt.Color C)

setMinorColor

public void setMinorColor(java.awt.Color C)

setRulerName

public void setRulerName(java.lang.String s)
See Also:
setRulerName(s,pos,show)

setRulerName

public void setRulerName(java.lang.String s,
                         int pos)
See Also:
setRulerName(s,pos,show)

setRulerName

public void setRulerName(java.lang.String s,
                         boolean show)
see setRulerName(s,pos,show)

setRulerName

public void setRulerName(java.lang.String s,
                         int pos,
                         boolean show)
Parameters:
s - the title to be shown for the ruler
pos - the positioning of the label with respect to the ruler baseline :={TITLE_ALIGN_LEFT,TITLE_ALIGN_RIGHT,TITLE_ALIGN_CENTER}
show - whether or not to show the ruler name/title

setHashLabel

public void setHashLabel(int xoff,
                         int yoff,
                         int labelhSide,
                         int labelvSide)
Customizes the positioning of the label at hashings.
Parameters:
xoff - how much to offset the label from the label origin in the x direction
yoff - how much to offset the label from the label origin in the y direction
labelhSide - horizontal position at label to align with, {PgGeometryIf.LABEL_HEAD, PgGeometryIf.LABEL_CENTER, PgGeometryIf.LABEL_TAIL}
labelvSide - vertical position at label to align with, {PgGeometryIf.LABEL_BASE, PgGeometryIf.LABEL_MIDDLE, PgGeometryIf.LABEL_TOP}

setNameAlignment

public void setNameAlignment(int align,
                             int labelhSide,
                             int xoff,
                             int yoff)
Customizes the positioning of the title of the ruler.
Parameters:
align - {ALIGNLEFT,TITLE_ALIGN_RIGHT,TITLE_ALIGN_CENTER} with base, center or tip of ruler's baseline.
labelhSide - the side of the label to bound to given point, {PgGeometryIf.LABEL_HEAD, PgGeometryIf.LABEL_CENTER, PgGeometryIf.LABEL_TAIL}
xoff - how much to offset the label from the label origin in the x direction.
yoff - how much to offset the label from the label origin in the y direction.

setHashOffsetInNormalDir

public void setHashOffsetInNormalDir(double xoff,
                                     double yoff,
                                     double zoff)

setHashOffsetInUpDir

public void setHashOffsetInUpDir(double xoff,
                                 double yoff,
                                 double zoff)

JavaView® v2.12

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