jhplot.shapes
Class HShape
- java.lang.Object
-
- jhplot.shapes.HShape
-
- All Implemented Interfaces:
- java.io.Serializable
public class HShape extends java.lang.Object implements java.io.Serializable
Build 2D primitives forHPlot
canvas. Can be done in USER and NDS coordinates.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static int
ARROW
static int
CIRCLE
static int
ELLIPSE
static int
IMAGE
static int
LINE
static int
POLYGON
static int
RECTAN
static int
TEXT
-
Constructor Summary
Constructors Constructor and Description HShape()
Build a default primitiveHShape(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 strokeHShape(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 primitiveboolean
getFill()
Is this primitive filled?double[]
getPosition()
Get position of a primitiveint
getPositionCoordinate()
Is the position set?double
getRotation()
Get rotation angle theta.double[]
getScaledPosition(double Xscale, double Yscale)
Scale the positionsvoid
getSettings(jplot.XMLWrite xw)
Returns the settings of the primitive in a XML instance.java.awt.Stroke
getStroke()
Get the Stroke to a specific valuejava.lang.Float
getTransparency()
Get the transparency levelint
getWhoAm()
Primitive typevoid
setColor(java.awt.Color c)
Sets the color to a specific valuevoid
setDashed(double thikness)
Set dashed linevoid
setDotted(double thikness)
Set dotted linevoid
setFill(boolean fill)
Fill a primitivevoid
setPosCoord(java.lang.String howToSet)
Set the style of the coodinate positionvoid
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 valuevoid
setTransparency(double trans)
Get the transparency levelvoid
setWhoAm(int whoAm)
Set primitive typevoid
updateSettings(jplot.XMLRead xr)
Update the current primitive with the settings.
-
-
-
Field Detail
-
LINE
public static final int LINE
- See Also:
- Constant Field Values
-
ARROW
public static final int ARROW
- See Also:
- Constant Field Values
-
TEXT
public static final int TEXT
- See Also:
- Constant Field Values
-
IMAGE
public static final int IMAGE
- See Also:
- Constant Field Values
-
CIRCLE
public static final int CIRCLE
- See Also:
- Constant Field Values
-
ELLIPSE
public static final int ELLIPSE
- See Also:
- Constant Field Values
-
RECTAN
public static final int RECTAN
- See Also:
- Constant Field Values
-
POLYGON
public static final int POLYGON
- See Also:
- Constant Field Values
-
-
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 positionY1
- Y start positionX2
- X end positionY2
- Y end positionstroke
- Stroke type for linecolor
- 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 positionY1
- Y start positionX2
- X end positionY2
- 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