JaObject
jhplot.jadraw

Class JaObject

    • Field Summary

      Fields 
      Modifier and TypeField and Description
      static intBB_MAX_X
      The component of the boundingbox array that contains the upper x value of the boundingbox.
      static intBB_MAX_Y
      The component of the boundingbox array that contains the upper y value of the boundingbox.
      static intBB_MIN_X
      The component of the boundingbox array that contains the lower x value of the boundingbox.
      static intBB_MIN_Y
      The component of the boundingbox array that contains the lower y value of the boundingbox.
      static intCOPY
      An integer that indicates the current edit mode COPY.
      static DecimalFormatD_FORMAT
      The decimal format used for numbers in LaTeX output.
      static intINIT_SIZE
      An integer that gives the initial size of an object.
      static intLENGTH
      An integer that gives the length of the handle sides.
      static intMOVE
      An integer that indicates the current edit mode MOVE.
      static intRESIZE
      An integer that indicates the current edit mode RESIZE.
      static intSELECT_BODY
      An integer that indicates that the user grabbed the body of an object.
      static intSELECT_LL
      An integer that indicates that the user grabbed the lower left handle of an object.
      static intSELECT_LR
      An integer that indicates that the user grabbed the lower right handle of an object.
      static intSELECT_NONE
      An integer that indicates that the user did not grab any object.
      static intSELECT_P1
      An integer that specifies the first point of an arc object.
      static intSELECT_P2
      An integer that specifies the second point of an arc object.
      static intSELECT_P3
      An integer that specifies the third point of an arc object.
      static intSELECT_UL
      An integer that indicates that the user grabbed the upper left handle of an object.
      static intSELECT_UR
      An integer that indicates that the user grabbed the upper right handle of an object.
    • Constructor Summary

      Constructors 
      Constructor and Description
      JaObject() 
    • Method Summary

      Methods 
      Modifier and TypeMethod and Description
      abstract JaObjectcopy()
      Returns an exact copy of the given JaObject.
      abstract voiddrawHandles(org.freehep.graphics2d.VectorGraphics g2)
      Draws the handles of this JaObject that allow to move/resize/edit it.
      voiddrawVisualAid(org.freehep.graphics2d.VectorGraphics g2)
      Draws a visual aid for the user during dragging of certain JaxoObjects.
      abstract booleaneditPanel()
      Brings up the edit panel that allows to change the parameters of this object.
      double[]getBoundingBox()
      Returns the bounding box of this JaObject.
      ColorgetColor()
      Returns the color of this object.
      GeneralPathgetGeneralPath()
      Returns the GeneralPath that draws this JaObject.
      abstract intgetGrabbedHandle(int clickX, int clickY, int editmode)
      Determines which handle the user has selected to move/resize/edit an object.
      intgetHeight()
      Returns the height of this object.
      intgetRelh()
      Returns the relative height of this object.
      doublegetRelHndc()
      Returns the relative height of this object in NDC.
      doublegetRelHuser()
      Returns the relative height of this object in USER.
      DimensiongetRelSize()
      Returns the relative width and height of this object.
      intgetRelw()
      Returns the relative width of this object.
      doublegetRelWndc()
      Returns the relative width of this object in NDC.
      doublegetRelWuser()
      Returns the relative width of this object in USER.
      DimensiongetSize()
      Returns the width and height of this object.
      intgetWidth()
      Returns the width of this object.
      intgetX()
      Returns the x coordinate of this object.
      doublegetXndc()
      Returns the NDC x coordinate of this object.
      doublegetXuser()
      Returns the USER x coordinate of this object.
      intgetY()
      Returns the y coordinate of this object.
      doublegetYndc()
      Returns the NDC y coordinate of this object.
      doublegetYuser()
      Returns the USER y coordinate of this object.
      abstract booleanisCopy(JaObject testObject)
      Determines if this JaObject is a copy of the specified one.
      booleanisMarked()
      Determines whether this JaObject is marked as an element of a group or not.
      booleanisUser()
      Set to true if coordinates were set using USER coordinate system attached to axes
      abstract voidjaxoDraw(org.freehep.graphics2d.VectorGraphics g2, boolean drawToScreen)
      The method that draws the JaObject.
      abstract StringlatexCommand(float scale, Dimension canvasDim)
      The LaTeX command that is necessary to draw the given JaObject using the axodraw.sty package.
      abstract StringlatexWidth()
      The LaTeX command that sets the width for this JaObject, using the axodraw.sty package.
      voidmoveBy(int deltaX, int deltaY)
      Reset the x, and y coordinates of the object when it is moved by deltaX and deltaY.
      abstract voidrescaleObject(int orx, int ory, float scale)
      Abstract class to rescale this JaObject by the scale factor scale, keeping the point (orx, ory) fixed.
      Point2DscalePoint(double orx, double ory, double scale, double px, double py)
      Returns a point that is obtained from a point (px, py) after a scale transformation scale, keeping the point (orx, ory) fixed.
      voidsetAsMarked(boolean mark)
      Sets this JaObject as element of a group.
      voidsetBoundingBox(double[] bb)
      Sets the bounding box of this JaObject.
      voidsetColor(Color c)
      Sets the color of this object.
      voidsetLocation(double xc, double yc, String what)
      Set location of the object in the NDC or USER coordinates.
      voidsetLocation(int newX, int newY)
      Sets the x and y coordinate of this object.
      voidsetRelh(int newRelh)
      Sets the relative height of this object.
      voidsetRelw(int newRelw)
      Sets the relative width of this object.
      voidsetRelWAndH(int w, int h)
      Sets the relative width and height of this object.
      voidsetRelWH(double w, double h, String what)
      Set relative size in the NDC or USER coordinates
      voidsetSize(int w, int h, int rw, int rh)
      Reset the size (width, height, relative width and height) of this object.
      voidsetX(int newX)
      Sets the x coordinate of this object.
      voidsetY(int newY)
      Sets the y coordinate of this object.
      voidupdateCoor() 
      voidupdateNDC() 
    • Field Detail

      • SELECT_NONE

        public static final int SELECT_NONE
        An integer that indicates that the user did not grab any object.
        See Also:
        Constant Field Values
      • SELECT_BODY

        public static final int SELECT_BODY
        An integer that indicates that the user grabbed the body of an object.
        See Also:
        Constant Field Values
      • SELECT_UL

        public static final int SELECT_UL
        An integer that indicates that the user grabbed the upper left handle of an object.
        See Also:
        Constant Field Values
      • SELECT_UR

        public static final int SELECT_UR
        An integer that indicates that the user grabbed the upper right handle of an object.
        See Also:
        Constant Field Values
      • SELECT_LR

        public static final int SELECT_LR
        An integer that indicates that the user grabbed the lower right handle of an object.
        See Also:
        Constant Field Values
      • SELECT_LL

        public static final int SELECT_LL
        An integer that indicates that the user grabbed the lower left handle of an object.
        See Also:
        Constant Field Values
      • MOVE

        public static final int MOVE
        An integer that indicates the current edit mode MOVE.
        See Also:
        Constant Field Values
      • RESIZE

        public static final int RESIZE
        An integer that indicates the current edit mode RESIZE.
        See Also:
        Constant Field Values
      • COPY

        public static final int COPY
        An integer that indicates the current edit mode COPY.
        See Also:
        Constant Field Values
      • LENGTH

        public static final int LENGTH
        An integer that gives the length of the handle sides.
        See Also:
        Constant Field Values
      • INIT_SIZE

        public static final int INIT_SIZE
        An integer that gives the initial size of an object.
        See Also:
        Constant Field Values
      • SELECT_P1

        public static final int SELECT_P1
        An integer that specifies the first point of an arc object.
        See Also:
        Constant Field Values
      • SELECT_P2

        public static final int SELECT_P2
        An integer that specifies the second point of an arc object.
        See Also:
        Constant Field Values
      • SELECT_P3

        public static final int SELECT_P3
        An integer that specifies the third point of an arc object.
        See Also:
        Constant Field Values
      • BB_MIN_X

        public static final int BB_MIN_X
        The component of the boundingbox array that contains the lower x value of the boundingbox.
        See Also:
        Constant Field Values
      • BB_MIN_Y

        public static final int BB_MIN_Y
        The component of the boundingbox array that contains the lower y value of the boundingbox.
        See Also:
        Constant Field Values
      • BB_MAX_X

        public static final int BB_MAX_X
        The component of the boundingbox array that contains the upper x value of the boundingbox.
        See Also:
        Constant Field Values
      • BB_MAX_Y

        public static final int BB_MAX_Y
        The component of the boundingbox array that contains the upper y value of the boundingbox.
        See Also:
        Constant Field Values
      • D_FORMAT

        public static final DecimalFormat D_FORMAT
        The decimal format used for numbers in LaTeX output.
    • Constructor Detail

      • JaObject

        public JaObject()
    • Method Detail

      • getGeneralPath

        public final GeneralPath getGeneralPath()
        Returns the GeneralPath that draws this JaObject.
        Returns:
        The GeneralPath of this JaObject.
      • updateCoor

        public void updateCoor()
      • updateNDC

        public void updateNDC()
      • getBoundingBox

        public double[] getBoundingBox()
        Returns the bounding box of this JaObject.
        Returns:
        The bounding box of this JaObject.
      • setBoundingBox

        public final void setBoundingBox(double[] bb)
        Sets the bounding box of this JaObject.
        Parameters:
        bb - The bounding box to be set for this JaObject.
      • setAsMarked

        public final void setAsMarked(boolean mark)
        Sets this JaObject as element of a group.
        Parameters:
        mark - A boolean variable indicating whether this JaObject should be set as an element of a group or not.
      • isMarked

        public final boolean isMarked()
        Determines whether this JaObject is marked as an element of a group or not.
        Returns:
        Boolean variable telling whether this JaObject is part of a group or not
      • isUser

        public boolean isUser()
        Set to true if coordinates were set using USER coordinate system attached to axes
        Returns:
        true if user
      • getX

        public final int getX()
        Returns the x coordinate of this object.
        Returns:
        The x coordinate of this object.
      • getXndc

        public final double getXndc()
        Returns the NDC x coordinate of this object.
        Returns:
        The x coordinate of this object.
      • getXuser

        public final double getXuser()
        Returns the USER x coordinate of this object.
        Returns:
        The x coordinate of this object in the current axes frame
      • setX

        public final void setX(int newX)
        Sets the x coordinate of this object.
        Parameters:
        newX - The x coordinate of this object.
      • getY

        public final int getY()
        Returns the y coordinate of this object.
        Returns:
        The y coordinate of this object.
      • getYndc

        public final double getYndc()
        Returns the NDC y coordinate of this object.
        Returns:
        The NDC y coordinate of this object.
      • getYuser

        public final double getYuser()
        Returns the USER y coordinate of this object.
        Returns:
        The USER y coordinate of this object in the current axis frame
      • setY

        public final void setY(int newY)
        Sets the y coordinate of this object.
        Parameters:
        newY - The y coordinate of this object.
      • setLocation

        public void setLocation(double xc,               double yc,               String what)
        Set location of the object in the NDC or USER coordinates.
        Parameters:
        xc - X location
        yc - Y location
        what - if "NDC", coordinate in NDC (from 0 to 1), if "USER" coordinates are in the user system given by the axes.
      • setRelWH

        public void setRelWH(double w,            double h,            String what)
        Set relative size in the NDC or USER coordinates
        Parameters:
        w - width of the object
        h - height of the object
        what - if "NDC", coordinate in NDC (from 0 to 1), if "USER" coordinates are in the user system given by the axes.
      • getWidth

        public final int getWidth()
        Returns the width of this object.
        Returns:
        The width of this object.
      • getHeight

        public final int getHeight()
        Returns the height of this object.
        Returns:
        The height of this object.
      • getRelw

        public final int getRelw()
        Returns the relative width of this object.
        Returns:
        The relative width of this object.
      • setRelw

        public final void setRelw(int newRelw)
        Sets the relative width of this object.
        Parameters:
        newRelw - The relative width of this object.
      • getRelh

        public final int getRelh()
        Returns the relative height of this object.
        Returns:
        The relative height of this object.
      • getRelHndc

        public final double getRelHndc()
        Returns the relative height of this object in NDC.
        Returns:
        The relative height of this object.
      • getRelHuser

        public final double getRelHuser()
        Returns the relative height of this object in USER.
        Returns:
        The relative height of this object.
      • getRelWndc

        public final double getRelWndc()
        Returns the relative width of this object in NDC.
        Returns:
        The relative height of this object.
      • getRelWuser

        public final double getRelWuser()
        Returns the relative width of this object in USER.
        Returns:
        The relative height of this object.
      • setRelh

        public final void setRelh(int newRelh)
        Sets the relative height of this object.
        Parameters:
        newRelh - The relative height of this object.
      • getColor

        public final Color getColor()
        Returns the color of this object.
        Returns:
        The color of this object.
      • setColor

        public final void setColor(Color c)
        Sets the color of this object.
        Parameters:
        c - The color of this object.
      • setRelWAndH

        public final void setRelWAndH(int w,               int h)
        Sets the relative width and height of this object.
        Parameters:
        w - The relative width of this object.
        h - The relative height of this object.
      • setLocation

        public final void setLocation(int newX,               int newY)
        Sets the x and y coordinate of this object.
        Parameters:
        newX - The x coordinate of this object.
        newY - The y coordinate of this object.
      • moveBy

        public void moveBy(int deltaX,          int deltaY)
        Reset the x, and y coordinates of the object when it is moved by deltaX and deltaY.
        Parameters:
        deltaX - The x displacement.
        deltaY - The y displacement.
      • setSize

        public final void setSize(int w,           int h,           int rw,           int rh)
        Reset the size (width, height, relative width and height) of this object.
        Parameters:
        w - The width of this object.
        h - The heightof this object.
        rw - The relative width of this object.
        rh - The relative height of this object.
      • getSize

        public final Dimension getSize()
        Returns the width and height of this object.
        Returns:
        A dimension with the size of the object.
      • getRelSize

        public final Dimension getRelSize()
        Returns the relative width and height of this object.
        Returns:
        A dimension with the relative size of the object.
      • drawVisualAid

        public void drawVisualAid(org.freehep.graphics2d.VectorGraphics g2)
        Draws a visual aid for the user during dragging of certain JaxoObjects. Currently applies for JaxoArcs (draws the center point and a radius line), JaxoLoops, JaxoBlobs and JaxoVertices (draws the center point in each case).
        Parameters:
        g2 - The graphics context to draw the visual aid.
      • scalePoint

        public Point2D scalePoint(double orx,                 double ory,                 double scale,                 double px,                 double py)
        Returns a point that is obtained from a point (px, py) after a scale transformation scale, keeping the point (orx, ory) fixed.
        Parameters:
        orx - The x-coordinate of the fixed point.
        ory - The y-coordinate of the fixed point.
        scale - The scale factor.
        px - The x-coordinate of the point to be transformed.
        py - The y-coordinate of the point to be transformed.
        Returns:
        A Point2D containing the x- and y-coordinate of the new point.
      • jaxoDraw

        public abstract void jaxoDraw(org.freehep.graphics2d.VectorGraphics g2,            boolean drawToScreen)
        The method that draws the JaObject.
        Parameters:
        g2 - The graphics context where the object has to be drawn.
        drawToScreen - A boolean variable that indicates whether the drawing is done on the screen or somewhere else. This is used for exporting/printing, where the object handles should not be painted, even if they are visible on the screen.
      • drawHandles

        public abstract void drawHandles(org.freehep.graphics2d.VectorGraphics g2)
        Draws the handles of this JaObject that allow to move/resize/edit it.
        Parameters:
        g2 - The corresponding graphics context.
      • getGrabbedHandle

        public abstract int getGrabbedHandle(int clickX,                   int clickY,                   int editmode)
        Determines which handle the user has selected to move/resize/edit an object.
        Parameters:
        clickX - The x coordinate where the mouse click has ocurred.
        clickY - The y coordinate where the mouse click has ocurred.
        editmode - The current edit mode.
        Returns:
        One of the static variables SELECT_* defined in JaObject that specifies the handle which the user has clicked.
      • copy

        public abstract JaObject copy()
        Returns an exact copy of the given JaObject.
        Returns:
        The copy of the given JaObject.
      • isCopy

        public abstract boolean isCopy(JaObject testObject)
        Determines if this JaObject is a copy of the specified one.
        Parameters:
        testObject - The JaObject to compare against.
        Returns:
        True if the JaxoObjects are identical.
      • latexCommand

        public abstract String latexCommand(float scale,                  Dimension canvasDim)
        The LaTeX command that is necessary to draw the given JaObject using the axodraw.sty package.
        Parameters:
        scale - A scale factor to translate Java coordinates to LaTeX coordinates.
        canvasDim - The current dimension of the canvas.
        Returns:
        The corresponding axodraw LaTeX command.
      • latexWidth

        public abstract String latexWidth()
        The LaTeX command that sets the width for this JaObject, using the axodraw.sty package.
        Returns:
        The corresponding LaTeX command.
      • rescaleObject

        public abstract void rescaleObject(int orx,                 int ory,                 float scale)
        Abstract class to rescale this JaObject by the scale factor scale, keeping the point (orx, ory) fixed.
        Parameters:
        orx - The x-coordinate of the fixed point.
        ory - The y-coordinate of the fixed point.
        scale - The scale parameter.
      • editPanel

        public abstract boolean editPanel()
        Brings up the edit panel that allows to change the parameters of this object.
        Returns:
        True if the editing actually changed the object, false if the object has not been changed.

SCaVis 2.2 © jWork.ORG