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

Class PgAxes

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


    public final class PgAxes
    extends PgGeometry
    implements PvCameraListenerIf
    A group of coordinates axes is a collection of individual rulers. This object constructs a variety of customizable 2D and 3D axes. A 1D axes is a ruler alone, so instantiate from that the ruler.PgRuler class.
    See Also:
    PgRuler, Serialized Form
    Author:
    Steve Dugaro, Konrad Polthier
    Version:
    21.03.04, 3.01 revised (kp) Default axis configuration changed to CENTRAL from BOUNDINGBOX.
    20.03.04, 3.00 revised (kp) Full revision of API interface and internal algorithms.
    17.08.03, 2.50 revised (kp) Handling of associated display slightly improved.
    14.08.03, 2.20 revised (kp) Central mode now adjusts the origin to avoid disconnected axes.
    21.08.02, 2.10 revised (kp) Implement PvCameraListenerIf.
    31.03.01, 2.00 revised (kp) Major revision to increase update speed.
    08.08.00, 1.00 created (spd)
    • Field Detail

      • AXES_2DBOUNDINGBOX

        public static final int AXES_2DBOUNDINGBOX
        Not supported yet.
        See Also:
        Constant Field Values
      • COORD_ADJUST

        public static final int COORD_ADJUST
        Indicates that axes adjusts to ambient transformation.
        See Also:
        Constant Field Values
      • COORD_SCENE

        public static final int COORD_SCENE
        Scene respectively camera coordinate system.
        See Also:
        Constant Field Values
      • COORD_MODEL

        public static final int COORD_MODEL
        Modelling coordinate system.
        See Also:
        Constant Field Values
      • COORD_AMBIENT

        public static final int COORD_AMBIENT
        Ambient coordinate system, not implemented yet.
        See Also:
        Constant Field Values
      • OPT_HASH_NUMBER

        public static int OPT_HASH_NUMBER
        Preferred number of major hash ticks on an axis.
      • OPT_HASH_RATIO

        public static double OPT_HASH_RATIO
        Preferred ratio of major unit to minor unit.
    • Constructor Detail

      • PgAxes

        public PgAxes(int dim)
        Constructs an axes object which handles the axis of a right handed coordinate system.

        HACK: Internally we currently allocate always 3 rulers even if dim==2. A user may not notice this behaviour.

    • Method Detail

      • init

        public void init()
        Initialization of axis object.
        Overrides:
        init in class PgGeometry
      • reset

        public void reset()
        Reset the current axes and rulers, re-construct axes and recompute hashings of rulers.
        Since:
        JavaView 2.48
        Version:
        09.12.02, 1.00 created (kp).
      • setEnabledBoxRatio

        public void setEnabledBoxRatio(boolean flag)
        Enable usage of a variable aspect ratio for the viewing frustum of this camera.
      • setBoxRatio

        public void setBoxRatio(PdVector boxRatio)
        Enable usage of a variable aspect ratio for the viewing frustum of this camera.
      • setDisplay

        public void setDisplay(PvDisplayIf disp)
        Display must be assigned right after creating an axes object. Axes object is not able to configure without a display.
        Since:
        JavaView 2.99.001
        Version:
        17.08.03, 1.00 created (kp)
      • setAxesColor

        public void setAxesColor(java.awt.Color col)
        Assign color of all individual axes.
      • setAxesSize

        public void setAxesSize(double size)
        Assign color of all individual axes.
      • isShowing

        public boolean isShowing()
        Determine if all axes are visible in the display. Does not affect individual visibility setting of each axes.
      • setShowing

        public void setShowing(boolean flag)
        Set visibility of this axes geometry.
        Since:
        JavaView 2.99.001
        Version:
        17.08.03, 1.00 created (kp)
      • getNumRulers

        public int getNumRulers()
        Get number of individual axis, respectively rulers. HACK: currently not working, it always returns 3.
      • setNumRulers

        public void setNumRulers(int num)
        Set number of individual axis, respectively rulers. HACK: currently not working, must be 3.
      • getHashingFlags

        public boolean[] getHashingFlags()
        Get state of showing of grid xy, yz, and zx planes.
      • isShowingXYGrid

        public boolean isShowingXYGrid()
        Get visibility of xy grid.
      • showXYGrid

        public void showXYGrid(boolean flag)
        Enable showing of grid in xy-plane which is spaced at major and minor hashing ticks.
        See Also:
        setHashingsFlags(boolean [])
      • isShowingYZGrid

        public boolean isShowingYZGrid()
        Get visibility of yz grid.
      • showYZGrid

        public void showYZGrid(boolean flag)
        Enable showing of grid in yz-plane which is spaced at major and minor hashing ticks.
        See Also:
        setHashingsFlags(boolean [])
      • isShowingZXGrid

        public boolean isShowingZXGrid()
        Get visibility of zx grid.
      • showZXGrid

        public void showZXGrid(boolean flag)
        Enable showing of grid in zx-plane which is spaced at major and minor hashing ticks.
        See Also:
        setHashingsFlags(boolean [])
      • isShowingFixedMode

        public boolean isShowingFixedMode()
        Deprecated. since JavaView 3.12.002, use getHashMode() which returns PgRuler#HASH_FIXED or PgRuler#HASH_PARTITIONED
        Determine if fixed or partition mode is enabled.
      • showFixedMode

        public void showFixedMode(boolean flag)
        Deprecated. since JavaView 3.12.002, use setHashMode(int) with PgRuler#HASH_FIXED or PgRuler#HASH_PARTITIONED
        Enable fixed or partition mode.
      • getHashMode

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

        public void setHashMode(int mode)
        Set hashing mode of a ruler which is either partitioned or fixed, see PgRuler#HASH_FIXED or PgRuler#HASH_PARTITIONED.
        Since:
        JavaView 3.12.002
        Version:
        20.03.04, 1.00 created (kp)
      • isShowingMajorHashings

        public boolean isShowingMajorHashings()
        Get showing of major hashing ticks of this axis and all rulers.
      • showMajorHashings

        public void showMajorHashings(boolean flag)
        Enable showing of major hashing ticks of this axis and all rulers.
      • isShowingMinorHashings

        public boolean isShowingMinorHashings()
        Get showing of minor hashing ticks of this axis and all rulers.
      • showMinorHashings

        public void showMinorHashings(boolean flag)
        Enable showing of minor hashing ticks of this axis and all rulers.
      • isShowingLabels

        public boolean isShowingLabels()
        Determine if numbers are shown at hashings of this axis.
      • showLabels

        public void showLabels(boolean flag)
        Enable showing of numbers at hashings of this axis and all rulers.
      • setLabelColors

        public void setLabelColors(java.awt.Color col)
        Assign label color of all individual axes.
        Parameters:
        col - Font color used to draw the label.
      • setLabelStyles

        public void setLabelStyles(int style)
        Assign label style of all individual axes labels.
        Parameters:
        style - Font style used to draw the label.
      • setLabelSize

        public void setLabelSize(int size)
        Assign label size of all individual axes labels.
        Parameters:
        size - Font size used to draw the label.
      • showTitles

        public void showTitles(boolean flag)
        Deprecated. use showNames(boolean).
      • getTitles

        public java.lang.String[] getTitles()
        Deprecated. use getNames().
      • setTitles

        public void setTitles(java.lang.String[] axisName)
        Deprecated. use setNames(String []).
      • getLabels

        public java.lang.String[] getLabels()
        Deprecated. use getNames().
      • setLabels

        public void setLabels(java.lang.String[] axisName)
        Deprecated. use setNames(String []).
      • isShowingNames

        public boolean isShowingNames()
        Determine if names of axes are shown at the middle of axes.
      • showNames

        public void showNames(boolean flag)
        Show names of all axes at one of their midpoint.
        Parameters:
        flag - enable showing of name
        Since:
        JavaView 2.47
        Version:
        26.11.02, 1.00 created (kp) Replacement for showTitles().
      • getNames

        public java.lang.String[] getNames()
        Get names of all axes showing at one of their midpoints.
        Returns:
        array of names, one name per axis
        Since:
        JavaView 2.47
        Version:
        26.11.02, 1.00 created (kp) Replacement for getTitles().
      • setNames

        public void setNames(java.lang.String[] axisName)
        Set names of all axes showing at one of their midpoints.
        Parameters:
        axisName - array of names, one name per axis
        Since:
        JavaView 2.47
        Version:
        26.11.02, 1.00 created (kp) Replacement for setTitles().
      • setNameAlignments

        public void setNameAlignments(int[] xAlign,
                                      int[] yAlign,
                                      int[] zAlign)
        Each parameter is an array of 4 int values, [ruleralignment, labelalignment, deltax, deltay] where ruleralignment:={PgRuler.RULER_NAME_ALIGN_LEFT,PgRuler.RULER_NAME_ALIGN_RIGHT,PgRuler.RULER_NAME_ALIGN_CENTER} labelalignment:=the side of the label to bound to given point, {PgGeometryIf.LABEL_HEAD, PgGeometryIf.LABEL_CENTER, PgGeometryIf.LABEL_TAIL} deltax resp. deltay are the number of pixels to displace the label in the x resp. y direction.

        For axes in 2D, the last argument may be null.

      • setFixedHashings

        public void setFixedHashings(double major,
                                     double minor)
        Set major and minor hashing units of this axis. If box ratio is disabled the hashing units of all rulers will be synchronized to the given values.
        Parameters:
        major - interval length between adjacent major hashing units in world coordinates
        minor - interval length between adjacent minor hashing units in world coordinates
      • setPartitionedHashing

        public void setPartitionedHashing(int major,
                                          int minor)
        Set number of major and minor hashing ticks. If box ratio is disabled the number of hashing ticks of all rulers will be synchronized to the given values.
        Parameters:
        major - total number of major hashing ticks
        minor - number of minor hashing ticks within a major interval.
      • isEnabledAutoHashing

        public boolean isEnabledAutoHashing()
        Check if axes is automatically adjusted to varying size of the shown shape.
        Since:
        JavaView 2.47
        Version:
        05.12.02, 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 stretched 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.
      • isEnabledAutoConfigure

        public boolean isEnabledAutoConfigure()
        Deprecated. since JavaView 3.12.002, use isEnabledAutoHashing()
        Check if axes is automatically adjusted to varying size of the shown shape.
      • setEnabledAutoConfigure

        public void setEnabledAutoConfigure(boolean flag)
        Deprecated. since JavaView 3.12.002, use setEnabledAutoHashing(boolean)
        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 stretched 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.
      • setAutoConfigure

        public void setAutoConfigure(boolean flag)
        Deprecated. use setEnabledAutoHashing(boolean)
      • isEnabledAutoLayout

        public boolean isEnabledAutoLayout()
        Check if automatic positioning of axes is enabled.
        Since:
        JavaView 3.12.002
        Version:
        21.03.04, 1.00 created (kp)
      • setEnabledAutoLayout

        public void setEnabledAutoLayout(boolean flag)
        Enable automatic positioning of axes.
        Since:
        JavaView 3.12.002
        Version:
        21.03.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.12.002
        Version:
        19.03.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.12.002
        Version:
        19.03.04, 1.00 created (kp)
      • getCoordSystem

        public int getCoordSystem()
        Check if axes is attached to scene, individual geometry or ambient coordinate system. If attached to geometries, then axes configuration will be in same coordinates system as the current camera.
        Returns:
        integer value like PgAxes#COORD_ADJUST etc.
        Since:
        JavaView 3.12.002
        Version:
        21.03.04, 1.00 created (kp)
      • setCoordSystem

        public void setCoordSystem(int coord)
        Set coordinate system to which axes is attached, e.g. to scene, individual geometry or ambient space. If attached to geometries, then axes configuration will be in same coordinates system as the current camera.
        Parameters:
        coord - integer value like PgAxes#COORD_ADJUST etc.
        Since:
        JavaView 3.12.002
        Version:
        21.03.04, 1.00 created (kp)
      • getMode

        public int getMode()
        Get the axes type which is currently displayed. One of the values like PgAxes#AXES_3DCORNER.
      • setMode

        public void setMode(int mode)
        Set the axes type which is currently displayed. Depending on the mode the axes are shown either in drawing order back or front (default).

        Only in mode AXES_3DCORNER axes are shown in back drawing order.

        Parameters:
        mode - one of the values like PgAxes#AXES_3DCORNER
        Version:
        14.10.00, 1.10 revised (kp) Switch layering in display depending on mode.
        08.08.00, 1.00 created (sd)
      • getAxes

        public PgRuler[] getAxes()
        Set of axis 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)
        Assign new camera viewing direction and scene bounding box, and, if autoHashing is enabled, recompute hashing units.

        Hashing units are computed for each ruler individually if boxRatio is enabled.

        Parameters:
        bndBox - current bounding box of scene in display.
        viewDir - normalized viewing direction of current camera.
        Version:
        25.12.04, 1.10 revised (kp) In boxRatio mode compute individual hash units.
      • setCameraType

        public void setCameraType(int type)
        Determines the current projection in the display where this axis is used. For example, in 2D projection mode not all axes are needed, so the camera type determines which axes must be switched off.
        Parameters:
        type - camera type as available in PvCameraIf.CAMERA_...
        Since:
        JavaView 2.92.000
        Version:
        14.08.03, 1.00 created (kp)
      • getBounds

        public PdVector[] getBounds()
        Compute bounding box of the vertices which are transformed with ambient and model matrix.

        The two returned bounding box vectors are 3-dimensional. If dimension of vertices is less than 3 then remaining components are zeroed.

        Note, transformation not supported yet.

        Overrides:
        getBounds in class PgGeometry
        Returns:
        two 3d vectors which are the extremal corners of the bounding cube
        Since:
        21.03.04, 1.10 revised (kp) Dimension of bounding box vector now always 3.
        , JavaView 3.12.002
        See Also:
        PgGeometry.getAmbientBounds()
        Version:
        30.01.05, 2.00 revised (kp) Returns a copy and no longer the internal variable.
      • setBounds

        public void setBounds(PdVector[] bndbox)
        Update the bounding box used to configure these axes.
      • pickCamera

        public void pickCamera(PvCameraEvent pos)
        Get camera events resulting from picking the mouse. Use information about camera in one display to adjust the camera in the other window. But previously rotate the camera position around the line given by interest+t*upVector by -6 degrees.
        Specified by:
        pickCamera in interface PvCameraListenerIf
        Parameters:
        pos - Pick event issued by the display
        See Also:
        PvCameraListenerIf
      • dragCamera

        public void dragCamera(PvCameraEvent pos)
        Get camera events resulting from dragging the mouse. This method just calls the method pickCamera which does all the work.
        Specified by:
        dragCamera in interface PvCameraListenerIf
        Parameters:
        pos - Drag event issued by the display
        See Also:
        PvCameraListenerIf
"JavaView? v5.03.003"

"

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

Ads help maintain this website.