Documentation of 'jhplot.shapes.HShape' Java class.
HShape
jhplot.shapes

Class HShape

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    Arrow, Circle, Ellipse, Line, Picture, Rectan, Text


    public class HShape
    extends java.lang.Object
    implements java.io.Serializable
    Build 2D primitives for HPlot canvas. Can be done in USER and NDS coordinates.
    See Also:
    Serialized Form
    • Constructor Summary

      Constructors 
      Constructor and Description
      HShape()
      Build a default primitive
      HShape(double[] XX, double[] YY, java.awt.Stroke strock, java.awt.Color color)
      Build a primitive using polyline.
      HShape(double X1, double Y1, double X2, double Y2)
      Build a primitive using the default color and stroke
      HShape(double X1, double Y1, double X2, double Y2, java.awt.Stroke stroke, java.awt.Color color)
      Build a primitive
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method and Description
      boolean contains(double Xm, double Ym) 
      java.awt.Color getColor()
      Get a color of the primitive
      boolean getFill()
      Is this primitive filled?
      double[] getPosition()
      Get position of a primitive
      int getPositionCoordinate()
      Is the position set?
      double getRotation()
      Get rotation angle theta.
      double[] getScaledPosition(double Xscale, double Yscale)
      Scale the positions
      void getSettings(jplot.XMLWrite xw)
      Returns the settings of the primitive in a XML instance.
      java.awt.Stroke getStroke()
      Get the Stroke to a specific value
      java.lang.Float getTransparency()
      Get the transparency level
      int getWhoAm()
      Primitive type
      void setColor(java.awt.Color c)
      Sets the color to a specific value
      void setDashed(double thikness)
      Set dashed line
      void setDotted(double thikness)
      Set dotted line
      void setFill(boolean fill)
      Fill a primitive
      void setPosCoord(java.lang.String howToSet)
      Set the style of the coodinate position
      void setPositionCoordinate(int usePosition)
      How to set the position of this object?
      void setRotation(double theta)
      Rotate the shape or text.
      void setStroke(java.awt.Stroke stroke)
      Set the Stroke to a specific value
      void setTransparency(double trans)
      Get the transparency level
      void setWhoAm(int whoAm)
      Set primitive type
      void updateSettings(jplot.XMLRead xr)
      Update the current primitive with the settings.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • HShape

        public HShape(double X1,
                      double Y1,
                      double X2,
                      double Y2,
                      java.awt.Stroke stroke,
                      java.awt.Color color)
        Build a primitive
        Parameters:
        X1 - X start position
        Y1 - Y start position
        X2 - X end position
        Y2 - Y end position
        stroke - Stroke type for line
        color - Color
      • HShape

        public HShape()
        Build a default primitive
      • HShape

        public HShape(double X1,
                      double Y1,
                      double X2,
                      double Y2)
        Build a primitive using the default color and stroke
        Parameters:
        X1 - X start position
        Y1 - Y start position
        X2 - X end position
        Y2 - Y end position
      • HShape

        public HShape(double[] XX,
                      double[] YY,
                      java.awt.Stroke strock,
                      java.awt.Color color)
        Build a primitive using polyline. Not yet done
        Parameters:
        XX -
        YY -
        strock -
        color -
    • Method Detail

      • getPosition

        public double[] getPosition()
        Get position of a primitive
        Returns:
        double[] positions
      • setRotation

        public void setRotation(double theta)
        Rotate the shape or text. The rotation angle is defined in radians.
        Parameters:
        theta - rotaion angle for the object (in rad).
      • getRotation

        public double getRotation()
        Get rotation angle theta.
        Returns:
        get rotation angle theta (rad).
      • getScaledPosition

        public double[] getScaledPosition(double Xscale,
                                          double Yscale)
        Scale the positions
        Parameters:
        Xscale -
        Yscale -
        Returns:
        Scale
      • setColor

        public void setColor(java.awt.Color c)
        Sets the color to a specific value
        Parameters:
        c - color used to draw the label
      • getColor

        public java.awt.Color getColor()
        Get a color of the primitive
        Returns:
        Color
      • getStroke

        public java.awt.Stroke getStroke()
        Get the Stroke to a specific value
        Returns:
        the Stroke used to draw
      • setStroke

        public void setStroke(java.awt.Stroke stroke)
        Set the Stroke to a specific value
      • setFill

        public void setFill(boolean fill)
        Fill a primitive
        Parameters:
        fill - true if it is filled
      • getFill

        public boolean getFill()
        Is this primitive filled?
        Returns:
        true if it filled
      • contains

        public boolean contains(double Xm,
                                double Ym)
      • getTransparency

        public java.lang.Float getTransparency()
        Get the transparency level
        Returns:
        the transparency level (0-1)
      • setTransparency

        public void setTransparency(double trans)
        Get the transparency level
        Parameters:
        trans - the transparency level (0-1)
      • getPositionCoordinate

        public int getPositionCoordinate()
        Is the position set?
        Returns:
        0 if location is not defined 1 if the position is defined in the NDC system 2 if the location is defined in the user coordinates
      • setPositionCoordinate

        public void setPositionCoordinate(int usePosition)
        How to set the position of this object?
        Parameters:
        0 - if location is not defined 1 if the position is defined in the NDC system 2 if the location is defined in the USER coordinates
      • setPosCoord

        public void setPosCoord(java.lang.String howToSet)
        Set the style of the coodinate position
        Parameters:
        howToSet - set it to "NDC" for normilized coordinates (in the range 0-1). This is a data independent position. Set it to "USER" for the user coordinates
      • setDashed

        public void setDashed(double thikness)
        Set dashed line
        Parameters:
        thikness -
      • setDotted

        public void setDotted(double thikness)
        Set dotted line
        Parameters:
        thikness -
      • getSettings

        public void getSettings(jplot.XMLWrite xw)
        Returns the settings of the primitive in a XML instance.
        Parameters:
        xw - instance of the class containing the settings.
      • updateSettings

        public void updateSettings(jplot.XMLRead xr)
        Update the current primitive with the settings. These settings are formatted in XML and stored in an XMLRead instance.
        Parameters:
        xr - instance of the reader class, containing the settings.
      • setWhoAm

        public void setWhoAm(int whoAm)
        Set primitive type
        Parameters:
        whoAm - Primitive types
      • getWhoAm

        public int getWhoAm()
        Primitive type
        Returns:
        Primitive types

DMelt 3.0 © DataMelt by jWork.ORG