Package jpicedt.graphic.model
Class Arrow
- java.lang.Object
-
- jpicedt.graphic.model.Arrow
-
- All Implemented Interfaces:
PicObjectConstants
public class Arrow extends java.lang.Object implements PicObjectConstants
A class implementing the arrow attribute. This class acts as a model and a view at the same time. A syncAttributes() method allows for synchronizing the current attribute set with the arrow parameters used by the paint() method.This class is also a container for predefined arrows (implemented as static inner classes).
- Since:
- jPicEdt 1.3.1
- Version:
- $Id: Arrow.java,v 1.9.2.2 2007/09/02 11:56:26 reynal Exp $
- Author:
- Sylvain Reynal
-
-
Field Summary
Fields Modifier and Type Field Description static ArrowARROW_HEADstatic ArrowCIRCLE_CENTEREDstatic ArrowCIRCLE_FLUSHEDstatic ArrowDISK_CENTEREDstatic ArrowDISK_FLUSHEDstatic ArrowDOUBLE_ARROW_HEADstatic ArrowDOUBLE_REVERSE_ARROW_HEADprotected doubleglobalScaleLengthprotected doubleglobalScaleWidthstatic ArrowNONEstatic ArrowREVERSE_ARROW_HEADstatic ArrowROUNDED_BRACKETstatic ArrowSQUARE_BRACKETstatic ArrowT_BAR_CENTEREDstatic ArrowT_BAR_FLUSHED-
Fields inherited from interface jpicedt.graphic.model.PicObjectConstants
ARROW_GLOBAL_SCALE_LENGTH, ARROW_GLOBAL_SCALE_WIDTH, ARROW_INSET_SCALE, ARROW_LENGTH_SCALE, ARROW_WIDTH_LINEWIDTH_SCALE, ARROW_WIDTH_MINIMUM_MM, BRACKET_LENGTH_SCALE, CROSSHATCH, CROSSHATCH_FILLED, DASH_OPAQUE, DASH_TRANSPARENT, DASH1, DASH2, DASH3, DASHED, DIMEN, DOT_SEP, DOT_SEP1, DOT_SEP2, DOT_SEP3, DOTTED, DOUBLE_COLOR, DOUBLE_LINE, DOUBLE_SEP, FILL_COLOR, FILL_STYLE, HATCH_ANGLE, HATCH_COLOR, HATCH_SEP, HATCH_WIDTH, HLINES, HLINES_FILLED, INNER, LEFT_ARROW, LINE_COLOR, LINE_STYLE, LINE_WIDTH, MIDDLE, OUTER, OVER_STRIKE, OVER_STRIKE_COLOR, OVER_STRIKE_WIDTH, POLYDOTS_ANGLE, POLYDOTS_CIRCLE, POLYDOTS_DISK, POLYDOTS_PENTAGON, POLYDOTS_PENTAGON_FILLED, POLYDOTS_PLUS, POLYDOTS_SCALE_H, POLYDOTS_SCALE_V, POLYDOTS_SIZE_LINEWIDTH_SCALE, POLYDOTS_SIZE_MINIMUM_MM, POLYDOTS_SQUARE, POLYDOTS_SQUARE_FILLED, POLYDOTS_STYLE, POLYDOTS_SUPERIMPOSE, POLYDOTS_TRIANGLE, POLYDOTS_TRIANGLE_FILLED, PS_POINT, PST_CUSTOM, RBRACKET_LENGTH_SCALE, RIGHT_ARROW, SHADOW, SHADOW_ANGLE, SHADOW_COLOR, SHADOW_SIZE, SOLID, TBAR_WIDTH_LINEWIDTH_SCALE, TBAR_WIDTH_MINIMUM_MM, TEXT_BOX_CIRCLE, TEXT_BOX_NO_FRAME, TEXT_BOX_OVAL, TEXT_BOX_RECTANGLE, TEXT_FRAME, TEXT_HALIGN_CENTER, TEXT_HALIGN_LEFT, TEXT_HALIGN_RIGHT, TEXT_HOR_ALIGN, TEXT_ROTATION, TEXT_VALIGN_BASELINE, TEXT_VALIGN_BOTTOM, TEXT_VALIGN_CENTER, TEXT_VALIGN_TOP, TEXT_VERT_ALIGN, VLINES, VLINES_FILLED
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Arrowcopy()static javax.swing.ImageIcon[]createArrowIcons(boolean rightArrow)build icons for e.g.static ArrowgetArrow(int indx)Returns the Arrow corresponding to the given indx Arrow.NONE if indx > number of arrowsstatic intgetIndex(Arrow arrow)Returns an integer associated with the given arrow (essentially for JComboxBox's...)java.lang.StringgetName()Return the name of this arrow.static Arrow[]getPredefinedArrows()Returns an array of predefined arrowsstatic voidmain(java.lang.String[] arg)voidpaint(java.awt.Graphics2D g, double linewidth, double locX, double locY, PicPoint dir)Paints this arrow (this implementation does nothing)voidpaint(java.awt.Graphics2D g, double linewidth, PicPoint loc, PicPoint dir)Paints this arrow.voidsyncAttributes(PicAttributeSet set)Configure the parameters of this arrow (size, scale, inset, ...) from the given attribute set, aka view/model synchronization.java.lang.StringtoString()Returns a string representation of this Arrow for debugging purpose
-
-
-
Field Detail
-
globalScaleWidth
protected double globalScaleWidth
-
globalScaleLength
protected double globalScaleLength
-
NONE
public static final Arrow NONE
-
ARROW_HEAD
public static final Arrow ARROW_HEAD
-
REVERSE_ARROW_HEAD
public static final Arrow REVERSE_ARROW_HEAD
-
DOUBLE_ARROW_HEAD
public static final Arrow DOUBLE_ARROW_HEAD
-
DOUBLE_REVERSE_ARROW_HEAD
public static final Arrow DOUBLE_REVERSE_ARROW_HEAD
-
T_BAR_CENTERED
public static final Arrow T_BAR_CENTERED
-
T_BAR_FLUSHED
public static final Arrow T_BAR_FLUSHED
-
SQUARE_BRACKET
public static final Arrow SQUARE_BRACKET
-
ROUNDED_BRACKET
public static final Arrow ROUNDED_BRACKET
-
CIRCLE_FLUSHED
public static final Arrow CIRCLE_FLUSHED
-
CIRCLE_CENTERED
public static final Arrow CIRCLE_CENTERED
-
DISK_FLUSHED
public static final Arrow DISK_FLUSHED
-
DISK_CENTERED
public static final Arrow DISK_CENTERED
-
-
Constructor Detail
-
Arrow
protected Arrow(java.lang.String name)
- Parameters:
name- the name (possibly explicit) of this Arrow
-
Arrow
protected Arrow(Arrow src)
-
-
Method Detail
-
copy
public Arrow copy()
-
getName
public java.lang.String getName()
Return the name of this arrow.
-
syncAttributes
public void syncAttributes(PicAttributeSet set)
Configure the parameters of this arrow (size, scale, inset, ...) from the given attribute set, aka view/model synchronization. Note that (according to PsTricks doc), attributes apply to both arrows at once for a given element; hence there's no need to separate left and right attributes. This implementation simply synchronizes global scale factors (ARROW_SCALE_WIDTH and ARROW_SCALE_LENGTH), and should be overriden in each concrete subclass.Usage: this method should invoked by the view responsible for rendering the drawing, whenever synchronization is needed b/w the view and the model, i.e. whenever at least one attribute value changed.
-
getIndex
public static int getIndex(Arrow arrow)
Returns an integer associated with the given arrow (essentially for JComboxBox's...)- Parameters:
arrow- one of the predefined Arrow'ss
-
getArrow
public static Arrow getArrow(int indx)
Returns the Arrow corresponding to the given indx Arrow.NONE if indx > number of arrows
-
getPredefinedArrows
public static Arrow[] getPredefinedArrows()
Returns an array of predefined arrows
-
createArrowIcons
public static javax.swing.ImageIcon[] createArrowIcons(boolean rightArrow)
build icons for e.g. ComboBoxlists from predefined arrows- Parameters:
rightArrow- false for left arrow, true for right arrow
-
main
public static void main(java.lang.String[] arg)
-
paint
public void paint(java.awt.Graphics2D g, double linewidth, PicPoint loc, PicPoint dir)Paints this arrow. Convenient call to #paint(Graphics2D, double, double, double, PicPoint).- Parameters:
g- graphic contextlinewidth- current lineWidth of the object this arrow is attached to (in mm)loc- arrow reference point on the screen (that is, line end-point)dir- a vector of length 1 indicating the direction of the arrow (see PEToolKit.getDirector...)
-
paint
public void paint(java.awt.Graphics2D g, double linewidth, double locX, double locY, PicPoint dir)Paints this arrow (this implementation does nothing)- Parameters:
g- graphic contextlinewidth- current lineWidth of the object this arrow is attached to (in mm)locX- X-coord of arrow reference point on the screen (that is, line end-point)locY- Y-coord of arrow reference point on the screen (that is, line end-point)dir- a vector of length 1 indicating the direction of the arrow (see PEToolKit.getDirector...)
-
toString
public java.lang.String toString()
Returns a string representation of this Arrow for debugging purpose- Overrides:
toStringin classjava.lang.Object
-
-