org.apache.batik.gvt

Class MarkerShapePainter

public class MarkerShapePainter extends Object implements ShapePainter

A shape painter that can be used to paint markers on a shape.
Field Summary
protected MarkerendMarker
End Marker
protected ExtendedShapeextShape
The Shape to be painted.
protected MarkermiddleMarker
Middle Marker
protected MarkerstartMarker
Start Marker
Constructor Summary
MarkerShapePainter(Shape shape)
Constructs a new MarkerShapePainter that can be used to markers on top of a shape.
Method Summary
protected ProxyGraphicsNodebuildEndMarkerProxy()
Builds a proxy GraphicsNode for the input Marker to be drawn at the end position.
protected voidbuildMarkerGroup()
Builds a new marker group with the current set of markers.
protected ProxyGraphicsNode[]buildMiddleMarkerProxies()
Builds a proxy GraphicsNode for the input Marker to be drawn at the middle positions
protected ProxyGraphicsNodebuildStartMarkerProxy()
Builds a proxy GraphicsNode for the input Marker to be drawn at the start position
MarkergetEndMarker()
Returns the marker that shall be drawn at the last vertex of the given shape.
ExtendedShapegetExtShape()
Gets the Shape this shape painter is associated with as an Extended Shape.
MarkergetMiddleMarker()
Returns the marker that shall be drawn at every other vertex (not the first or the last one) of the given shape.
ShapegetPaintedArea()
Returns the area painted by this shape painter.
Rectangle2DgetPaintedBounds2D()
Returns the bounds of the area painted by this shape painter
protected Point2DgetSegmentTerminatingPoint(double[] coords, int segType)
Extracts the terminating point, depending on the segment type.
ShapegetSensitiveArea()
Returns the area covered by this shape painter (even if not painted).
Rectangle2DgetSensitiveBounds2D()
Returns the bounds of the area covered by this shape painte (even if not painted).
ShapegetShape()
Gets the Shape this shape painter is associated with.
MarkergetStartMarker()
Returns the marker that shall be drawn at the first vertex of the given shape.
booleaninPaintedArea(Point2D pt)
Returns true if pt is in the area painted by this shape painter
booleaninSensitiveArea(Point2D pt)
Returns true if pt is in the sensitive area.
double[]normalize(double[] v)
Normalizes the input vector.
voidpaint(Graphics2D g2d)
Paints the specified shape using the specified Graphics2D.
voidsetEndMarker(Marker endMarker)
Sets the marker that shall be drawn at the last vertex of the given shape.
voidsetMiddleMarker(Marker middleMarker)
Sets the marker that shall be drawn at every other vertex (not the first or the last one) of the given shape.
voidsetShape(Shape shape)
Sets the Shape this shape painter is associated with.
voidsetStartMarker(Marker startMarker)
Sets the marker that shall be drawn at the first vertex of the given shape.

Field Detail

endMarker

protected Marker endMarker
End Marker

extShape

protected ExtendedShape extShape
The Shape to be painted.

middleMarker

protected Marker middleMarker
Middle Marker

startMarker

protected Marker startMarker
Start Marker

Constructor Detail

MarkerShapePainter

public MarkerShapePainter(Shape shape)
Constructs a new MarkerShapePainter that can be used to markers on top of a shape.

Parameters: shape Shape to be painted by this painter. Should not be null

Method Detail

buildEndMarkerProxy

protected ProxyGraphicsNode buildEndMarkerProxy()
Builds a proxy GraphicsNode for the input Marker to be drawn at the end position.

buildMarkerGroup

protected void buildMarkerGroup()
Builds a new marker group with the current set of markers.

buildMiddleMarkerProxies

protected ProxyGraphicsNode[] buildMiddleMarkerProxies()
Builds a proxy GraphicsNode for the input Marker to be drawn at the middle positions

buildStartMarkerProxy

protected ProxyGraphicsNode buildStartMarkerProxy()
Builds a proxy GraphicsNode for the input Marker to be drawn at the start position

getEndMarker

public Marker getEndMarker()
Returns the marker that shall be drawn at the last vertex of the given shape.

getExtShape

public ExtendedShape getExtShape()
Gets the Shape this shape painter is associated with as an Extended Shape.

Returns: shape associated with this painter

getMiddleMarker

public Marker getMiddleMarker()
Returns the marker that shall be drawn at every other vertex (not the first or the last one) of the given shape.

getPaintedArea

public Shape getPaintedArea()
Returns the area painted by this shape painter.

getPaintedBounds2D

public Rectangle2D getPaintedBounds2D()
Returns the bounds of the area painted by this shape painter

getSegmentTerminatingPoint

protected Point2D getSegmentTerminatingPoint(double[] coords, int segType)
Extracts the terminating point, depending on the segment type.

getSensitiveArea

public Shape getSensitiveArea()
Returns the area covered by this shape painter (even if not painted). This is always null for Markers.

getSensitiveBounds2D

public Rectangle2D getSensitiveBounds2D()
Returns the bounds of the area covered by this shape painte (even if not painted). This is always null for Markers.

getShape

public Shape getShape()
Gets the Shape this shape painter is associated with.

Returns: shape associated with this painter

getStartMarker

public Marker getStartMarker()
Returns the marker that shall be drawn at the first vertex of the given shape.

inPaintedArea

public boolean inPaintedArea(Point2D pt)
Returns true if pt is in the area painted by this shape painter

inSensitiveArea

public boolean inSensitiveArea(Point2D pt)
Returns true if pt is in the sensitive area. This is always false for Markers.

normalize

public double[] normalize(double[] v)
Normalizes the input vector. This assumes an non-zero length

paint

public void paint(Graphics2D g2d)
Paints the specified shape using the specified Graphics2D.

Parameters: g2d the Graphics2D to use

setEndMarker

public void setEndMarker(Marker endMarker)
Sets the marker that shall be drawn at the last vertex of the given shape.

Parameters: endMarker the end marker

setMiddleMarker

public void setMiddleMarker(Marker middleMarker)
Sets the marker that shall be drawn at every other vertex (not the first or the last one) of the given shape.

Parameters: middleMarker the middle marker

setShape

public void setShape(Shape shape)
Sets the Shape this shape painter is associated with.

Parameters: shape new shape this painter should be associated with. Should not be null.

setStartMarker

public void setStartMarker(Marker startMarker)
Sets the marker that shall be drawn at the first vertex of the given shape.

Parameters: startMarker the start marker

Copyright B) 2007 Apache Software Foundation. All Rights Reserved.