Documentation of 'jv.thirdParty.ruler.PgRuler' Java class
PgRuler ("JavaView Reference Manual")
"JavaView? v5.03.003"
jv.thirdParty.ruler

Class PgRuler

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, PsUpdateIf, PgGeometryIf


    public final class PgRuler
    extends PgJvxSrc
    A ruler is 2d or higher dimensional space is determined by an origin, a direction of its axis and a normal for drawing hashings. The spacing and labeling of hashings may be controlled or automatically computed by a ruler.

    Rulers are used as components of PgAxes but additionally may be used individually to measure distances.

    See Also:
    PgAxes, Serialized Form
    Author:
    Steve Dugaro, Konrad Polthier
    Version:
    04.05.14, 4.01 revised (kp) Geometry type mentioned in constructor.
    20.03.04, 4.00 revised (kp) Full revision of API interface and internal algorithms.
    14.08.03, 3.50 revised (kp) Remove internal vector allocations.
    19.07.03, 3.40 revised (kp) Correct assignment of brighter colors for minor hashings.
    13.03.03, 3.30 revised (kp) Hashing color is now adjusted when global polygon color is changed.
    16.11.02, 3.20 revised (kp) Only enable showing of vertex labels instead of all indices.
    26.09.02, 3.10 revised (kp) Allow more fractional digits if axis is small.
    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)
    • Field Detail

      • HASH_FIXED

        public static final int HASH_FIXED
        Fixed spacing of hashings at automatically or assigned ticks.
        See Also:
        Constant Field Values
      • MODE_FIXED

        public static final int MODE_FIXED
        Deprecated. since JavaView 3.13, use HASH_FIXED
        Fixed spacing of hashings at automatically or assigned ticks.
        See Also:
        Constant Field Values
      • HASH_PARTITIONED

        public static final int HASH_PARTITIONED
        Dynamic spacing of hashings at equal distances from a reference tick.
        See Also:
        Constant Field Values
      • MODE_PARTITIONED

        public static final int MODE_PARTITIONED
        Deprecated. since JavaView 3.13, use HASH_PARTITIONED
        Dynamic spacing of hashings at equal distances from a reference tick.
        See Also:
        Constant Field Values
      • RULER_NAME_ALIGN_CENTER

        public static final int RULER_NAME_ALIGN_CENTER
        See Also:
        Constant Field Values
    • Constructor Detail

      • PgRuler

        public PgRuler()
        Create a ruler in 3D space.
      • PgRuler

        public PgRuler(int dim)
        Create a ruler in given space dimension which is by default oriented along the x-axis.
      • PgRuler

        public PgRuler(PdVector rulerDir,
                       PdVector rulerNormal)
        Deprecated. since JavaView 3.12.002, use setDirection and setNormal
        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
        rulerNormal - vector orthogonal to direction of baseline
    • Method Detail

      • init

        public void init()
        Initialization method.
        Overrides:
        init in class PgJvxSrc
        Version:
        26.10.04, 1.10 revised added a call to computeHashings() at the end. (kh)
      • setGlobalPolygonColor

        public void setGlobalPolygonColor(java.awt.Color color)
        This method assigns the global polygon color of superclass and sets the default color for hashings.
        Overrides:
        setGlobalPolygonColor in class PgJvxSrc
        Since:
        JavaView 2.60.002
        Version:
        13.03.03, 1.00 created (kp)
      • setGlobalPolygonSize

        public void setGlobalPolygonSize(double size)
        This method assigns the global polygon color of superclass and sets the default color for hashings.
        Overrides:
        setGlobalPolygonSize in class PgJvxSrc
        Since:
        JavaView 3.62.013
        Version:
        28.11.04, 1.00 created (kp)
      • 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. 1. event == this : geometry has changed, all panels will be updated.
        2. 2. event == null : geometry has changed, no need to update a panel.
        3. 3. event == a panel : geometry has changed, all panels except 'panel' will be updated.
        4. 4. 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.

        Specified by:
        update in interface PsUpdateIf
        Overrides:
        update in class PgGeometry
        Parameters:
        event - carries a lot of information
        Returns:
        true if event has been handled, otherwise false
        See Also:
        PsObject.setParent(PsUpdateIf), PsObject.getFather(), PsObject.addUpdateListener(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()
      • getMaxParameter

        public double getMaxParameter()
      • getMinParameter

        public double getMinParameter()
      • getNumMajorPartitions

        public int getNumMajorPartitions()
      • getNumMinorPartitions

        public int getNumMinorPartitions()
      • getMajorUnit

        public double getMajorUnit()
      • getMinorUnit

        public double getMinorUnit()
      • showLabels

        public void showLabels(boolean flag)
      • isShowingArrow

        public boolean isShowingArrow()
      • showArrow

        public void showArrow(boolean flag)
      • isShowingFixedMode

        public boolean isShowingFixedMode()
        Deprecated. use getHashMode() which returns HASH_FIXED or HASH_PARTITIONED
        Mode of a ruler is either partitioned or fixed.
      • showFixedMode

        public void showFixedMode(boolean flag)
        Deprecated. use setHashMode(int) with HASH_FIXED or HASH_PARTITIONED
        Mode of a ruler is either partitioned or fixed.
      • getHashMode

        public int getHashMode()
        Get hashing mode of a ruler is either partitioned or fixed, see HASH_FIXED or HASH_PARTITIONED.
        Since:
        JavaView 2.47
        Version:
        05.12.02, 1.00 created (kp)
      • setHashMode

        public void setHashMode(int mode)
        Set hashing mode of a ruler which is either partitioned or fixed, see HASH_FIXED or HASH_PARTITIONED.
        Since:
        JavaView 2.47
        Version:
        05.12.02, 1.00 created (kp)
      • getMode

        public int getMode()
        Deprecated. since JavaView 3.12.002, use getHashMode()
        Get hashing mode of a ruler is either partitioned or fixed, see PgRuler#HASH_FIXED or PgRuler#HASH_PARTITIONED.
      • setMode

        public void setMode(int mode)
        Deprecated. since JavaView 3.12.002, use setHashMode(int)
        Set hashing mode of a ruler which is either partitioned or fixed, see PgRuler#HASH_FIXED or PgRuler#HASH_PARTITIONED.
      • showMajorHashings

        public void showMajorHashings(boolean flag)
      • showMinorHashings

        public void showMinorHashings(boolean flag)
      • showHashingsInNormalDir

        public void showHashingsInNormalDir(boolean flag)
      • showHashingsInUpDir

        public void showHashingsInUpDir(boolean flag)
      • isShowingRulerName

        public boolean isShowingRulerName()
        Check whether showing of name of ruler is switched on. On default, showing of name is disabled.

        In contrast to the usual name of an object, the ruler name is shown in the center of an axis with some fake trick.

        Since:
        JavaView 2.47
        See Also:
        PgGeometry.showTitle(boolean), PsObject.setName(String)
        Version:
        26.11.02, 1.00 created (kp)
      • showRulerName

        public void showRulerName(boolean flag)
        Enable and disable showing of name of ruler in display. On default, showing of title is disabled.

        In contrast to the usual name of an object, the ruler name is shown in the center of an axis with some fake trick.

        Since:
        JavaView 2.47
        See Also:
        PgGeometry.showTitle(boolean), PsObject.setName(String)
        Version:
        26.11.02, 1.00 created (kp)
      • 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(double x,
                              double y,
                              double z)
        Set the origin of the ruler to the specific point in space.
        Parameters:
        x - new x-component of origin of ruler
        y - new y-component of origin of ruler
        z - new z-component of origin of ruler
      • 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(double x,
                                 double y,
                                 double z)
        Set direction of the baseline of the ruler. Normalization will be done within this method.
        Parameters:
        x - new x-component of direction vector of the baseline of the ruler
        y - new y-component of direction vector of the baseline of the ruler
        z - new z-component of direction vector of the baseline of the 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(double x,
                              double y,
                              double z)
        Set direction of the normal vector along which the hashings will be drawn. Normalization will be done within this method.
        Parameters:
        x - new x-component of a 3d vector (based at the origin) specifying the direction in which to draw the hashings
        y - new y-component of a 3d vector (based at the origin) specifying the direction in which to draw the hashings
        z - new z-component of a 3d vector (based at the origin) specifying the direction in which to draw the hashings
      • setNormal

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

        public void setUpVector(PdVector up)
        Deprecated. since JavaView 3.12.002, upVector is automatically computed when dir or normal is assigned.
        For rulers in 3D space, set direction of the up vector along which a secondary set of hashings will be drawn. Normalization will be done within this method.
        Parameters:
        up - a 3d vector (based at the origin) specifying the direction in which to draw the hashings
      • setDefaultHashSizes

        public void setDefaultHashSizes(int orthoType)
        Reset minor and major hash extents to default values.
        Parameters:
        orthoType - specify which of 2 perpendicular directions (PgRuler#NORMAL_DIRECTION or PgRuler#UP_VECTOR_DIRECTION) that hashing occurs.
      • setMajorHashSize

        public void setMajorHashSize(double pt1,
                                     double pt2,
                                     int orthoType)
        Set the extent size of major hashings along the up or normal vectors
        Parameters:
        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
        orthoType - specify which of 2 perpendicular directions (PgRuler#NORMAL_DIRECTION or PgRuler#UP_VECTOR_DIRECTION) that hashing occurs.
      • setMinorHashSize

        public void setMinorHashSize(double pt1,
                                     double pt2,
                                     int orthoType)
        Set the extent size of minor hashings along the up or normal vectors
        Parameters:
        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
        orthoType - specify which of 2 perpendicular directions that hashing occurs.
      • setFixedHashing

        public void setFixedHashing(double major,
                                    double minor)
      • setPartitionedHashing

        public void setPartitionedHashing(int major,
                                          int minor)
      • setMinMax

        public void setMinMax(double min,
                              double max)
        Set maximum and minimum value of this ruler.
      • setMajorColor

        public void setMajorColor(java.awt.Color color)
      • setMinorColor

        public void setMinorColor(java.awt.Color color)
      • getRulerName

        public java.lang.String getRulerName()
        Get name of ruler as it appears at an axis, for example. Note, the name is identical to the name of the underlying geometry.
        Returns:
        name of ruler
      • setRulerName

        public void setRulerName(java.lang.String name)
        Set the name of ruler as it appears at an axis, for example.
        Parameters:
        name - the title to be shown for the ruler
        See Also:
        setRulerName(String,int,boolean)
      • setRulerName

        public void setRulerName(java.lang.String name,
                                 int pos)
        Set the name of ruler as it appears at an axis, for example.
        Parameters:
        name - the title to be shown for the ruler
        pos - the positioning of the label with respect to the ruler baseline :={RULER_NAME_ALIGN_LEFT,RULER_NAME_ALIGN_RIGHT,RULER_NAME_ALIGN_CENTER}
        See Also:
        setRulerName(String,int,boolean)
      • setRulerName

        public void setRulerName(java.lang.String name,
                                 boolean show)
        Set the name of ruler as it appears at an axis, for example.
        Parameters:
        name - the title to be shown for the ruler
        show - whether or not to show the ruler name/title
        See Also:
        setRulerName(String,int,boolean)
      • setRulerName

        public void setRulerName(java.lang.String name,
                                 int pos,
                                 boolean show)
        Set the name of ruler as it appears at an axis, for example.
        Parameters:
        name - the title to be shown for the ruler
        pos - the positioning of the label with respect to the ruler baseline :={RULER_NAME_ALIGN_LEFT,RULER_NAME_ALIGN_RIGHT,RULER_NAME_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 name of the ruler.
        Parameters:
        align - {RULER_NAME_ALIGN_LEFT,RULER_NAME_ALIGN_RIGHT,RULER_NAME_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)
      • isEnabledAutoHashing

        public boolean isEnabledAutoHashing()
        Check if axes is automatically adjusted to varying size of the shown shape.
        Since:
        JavaView 3.62.013
        Version:
        28.11.04, 1.00 created (kp)
      • setEnabledAutoHashing

        public void setEnabledAutoHashing(boolean flag)
        Flag is 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 single minor hashing will be placed between each major hashings whenever a reconfiguration is needed.
        Since:
        JavaView 3.62.013
        Version:
        28.11.04, 1.00 created (kp)
      • isEnabledAutoBounds

        public boolean isEnabledAutoBounds()
        Check if automatic adjustment of size of axes to varying bounding box is enabled.
        Since:
        JavaView 3.62.013
        Version:
        28.11.04, 1.00 created (kp)
      • setEnabledAutoBounds

        public void setEnabledAutoBounds(boolean flag)
        Enable automatic adjustment of size of axes to varying bounding box.
        Since:
        JavaView 3.62.013
        Version:
        28.11.04, 1.00 created (kp)
"JavaView? v5.03.003"

"

The software JavaView? is copyright protected. All Rights Reserved.
"

Ads help maintain this website.