jhplot.shapes
Class HShape

java.lang.Object
  extended by jhplot.shapes.HShape
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Arrow, Circle, Ellipse, Line, Picture, Rectan, Text

public class HShape
extends Object
implements Serializable

Main class to build a JAVA 2D primitives

See Also:
Serialized Form

Field Summary
static int ARROW
           
static int CIRCLE
           
protected  Color color
           
protected static Stroke DFS
           
static int ELLIPSE
           
protected  Font f
           
protected  boolean fill
           
static int IMAGE
           
protected  double length
           
static int LINE
           
static int POLYGON
           
static int RECTAN
           
protected  double rotate
           
protected  Stroke strock
           
protected  String text
           
static int TEXT
           
protected  float transp
           
protected  int usePosition
           
protected  int whoAm
           
protected  double width
           
protected  double X1
           
protected  double X2
           
protected  double[] XX
           
protected  double Y1
           
protected  double Y2
           
protected  double[] YY
           
 
Constructor Summary
HShape()
          Build a default primitive
HShape(double[] XX, double[] YY, Stroke strock, 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, Stroke stroke, Color color)
          Build a primitive
 
Method Summary
 boolean contains(double Xm, double Ym)
           
 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[] getScaledPosition(double Xscale, double Yscale)
          Scale the positions
 void getSettings(jplot.XMLWrite xw)
          Returns the settings of the primitive in a XML instance.
 Stroke getStroke()
          Get the Stroke to a specific value
 Float getTransparency()
          Get the transparency level
 int getWhoAm()
          Primitive type
 void setColor(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(String howToSet)
          Set the style of the coodinate position
 void setPositionCoordinate(int usePosition)
          How to set the position of this object?
 void setStroke(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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

width

protected double width

length

protected double length

f

protected Font f

rotate

protected double rotate

text

protected String text

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

DFS

protected static final Stroke DFS

strock

protected Stroke strock

color

protected Color color

X1

protected double X1

Y1

protected double Y1

X2

protected double X2

Y2

protected double Y2

transp

protected float transp

whoAm

protected int whoAm

fill

protected boolean fill

XX

protected double[] XX

YY

protected double[] YY

usePosition

protected int usePosition
Constructor Detail

HShape

public HShape(double X1,
              double Y1,
              double X2,
              double Y2,
              Stroke stroke,
              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,
              Stroke strock,
              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

getScaledPosition

public double[] getScaledPosition(double Xscale,
                                  double Yscale)
Scale the positions

Parameters:
Xscale -
Yscale -
Returns:
Scale

setColor

public void setColor(Color c)
Sets the color to a specific value

Parameters:
c - color used to draw the label

getColor

public Color getColor()
Get a color of the primitive

Returns:
Color

getStroke

public Stroke getStroke()
Get the Stroke to a specific value

Returns:
the Stroke used to draw

setStroke

public void setStroke(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 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(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


© Copyright 2005 S.Chekanov. All Rights Reserved.
jHPlot package, a part of jHepWork: is a full-featured multiplatform data-analysis framework