org.jhotdraw.draw.decoration
Class CompositeLineDecoration
- java.lang.Object
-
- org.jhotdraw.draw.decoration.CompositeLineDecoration
-
- All Implemented Interfaces:
- java.io.Serializable, java.lang.Cloneable, LineDecoration, DOMStorable
public class CompositeLineDecoration extends java.lang.Object implements LineDecoration, DOMStorable
ALineDecorationwhich can compose multiple individual line decorations.An composite implementation of a line decoration. It allows more than one line decoration shape to be rotated and moved to the end of the line. The shape is scaled by the stroke width.
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor and Description CompositeLineDecoration()Constructs a composite line decoration with no decorations.CompositeLineDecoration(LineDecoration decoration1, LineDecoration decoration2)Constructs a composite line decoration with the two supplied decorations.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddDecoration(LineDecoration decoration)Add another line decoration into the composite line decoration.voiddraw(java.awt.Graphics2D g, Figure f, java.awt.geom.Point2D.Double p1, java.awt.geom.Point2D.Double p2)Draws the arrow tip in the direction specified by the given two Points..doublegetDecorationRadius(Figure f)Returns the radius of the decorator.java.awt.geom.Rectangle2D.DoublegetDrawingArea(Figure f, java.awt.geom.Point2D.Double p1, java.awt.geom.Point2D.Double p2)Returns the drawing area of the decorator.voidread(DOMInput in)voidwrite(DOMOutput out)
-
-
-
Constructor Detail
-
CompositeLineDecoration
public CompositeLineDecoration()
Constructs a composite line decoration with no decorations.
-
CompositeLineDecoration
public CompositeLineDecoration(LineDecoration decoration1, LineDecoration decoration2)
Constructs a composite line decoration with the two supplied decorations.
-
-
Method Detail
-
addDecoration
public void addDecoration(LineDecoration decoration)
Add another line decoration into the composite line decoration. The new decoration will be appended to the existing decorations and is also the last drawn.
-
draw
public void draw(java.awt.Graphics2D g, Figure f, java.awt.geom.Point2D.Double p1, java.awt.geom.Point2D.Double p2)Draws the arrow tip in the direction specified by the given two Points.. (template method)- Specified by:
drawin interfaceLineDecoration
-
getDrawingArea
public java.awt.geom.Rectangle2D.Double getDrawingArea(Figure f, java.awt.geom.Point2D.Double p1, java.awt.geom.Point2D.Double p2)
Returns the drawing area of the decorator.- Specified by:
getDrawingAreain interfaceLineDecoration
-
getDecorationRadius
public double getDecorationRadius(Figure f)
Returns the radius of the decorator. This is used to crop the end of the line, to prevent it from being drawn it over the decorator.- Specified by:
getDecorationRadiusin interfaceLineDecoration
-
read
public void read(DOMInput in) throws java.io.IOException
- Specified by:
readin interfaceDOMStorable- Throws:
java.io.IOException
-
write
public void write(DOMOutput out) throws java.io.IOException
- Specified by:
writein interfaceDOMStorable- Throws:
java.io.IOException
-
-
DataMelt 3.0 © DataMelt by jWork.ORG