Package org.apache.batik.gvt
Class MarkerShapePainter
- java.lang.Object
-
- org.apache.batik.gvt.MarkerShapePainter
-
- All Implemented Interfaces:
ShapePainter
public class MarkerShapePainter extends java.lang.Object implements ShapePainter
A shape painter that can be used to paint markers on a shape.
-
-
Field Summary
Fields Modifier and Type Field Description protected Marker
endMarker
End Markerprotected ExtendedShape
extShape
The Shape to be painted.protected Marker
middleMarker
Middle Markerprotected Marker
startMarker
Start Marker
-
Constructor Summary
Constructors Constructor Description MarkerShapePainter(java.awt.Shape shape)
Constructs a newMarkerShapePainter
that can be used to markers on top of a shape.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ProxyGraphicsNode
buildEndMarkerProxy()
Builds a proxyGraphicsNode
for the inputMarker
to be drawn at the end position.protected void
buildMarkerGroup()
Builds a new marker group with the current set of markers.protected ProxyGraphicsNode[]
buildMiddleMarkerProxies()
Builds a proxyGraphicsNode
for the inputMarker
to be drawn at the middle positionsprotected ProxyGraphicsNode
buildStartMarkerProxy()
Builds a proxyGraphicsNode
for the inputMarker
to be drawn at the start positionMarker
getEndMarker()
Returns the marker that shall be drawn at the last vertex of the given shape.ExtendedShape
getExtShape()
Gets the Shape this shape painter is associated with as an Extended Shape.Marker
getMiddleMarker()
Returns the marker that shall be drawn at every other vertex (not the first or the last one) of the given shape.java.awt.Shape
getPaintedArea()
Returns the area painted by this shape painter.java.awt.geom.Rectangle2D
getPaintedBounds2D()
Returns the bounds of the area painted by this shape painterprotected java.awt.geom.Point2D
getSegmentTerminatingPoint(double[] coords, int segType)
Extracts the terminating point, depending on the segment type.java.awt.Shape
getSensitiveArea()
Returns the area covered by this shape painter (even if not painted).java.awt.geom.Rectangle2D
getSensitiveBounds2D()
Returns the bounds of the area covered by this shape painte (even if not painted).java.awt.Shape
getShape()
Gets the Shape this shape painter is associated with.Marker
getStartMarker()
Returns the marker that shall be drawn at the first vertex of the given shape.boolean
inPaintedArea(java.awt.geom.Point2D pt)
Returns true if pt is in the area painted by this shape painterboolean
inSensitiveArea(java.awt.geom.Point2D pt)
Returns true if pt is in the sensitive area.double[]
normalize(double[] v)
Normalizes the input vector.void
paint(java.awt.Graphics2D g2d)
Paints the specified shape using the specified Graphics2D.void
setEndMarker(Marker endMarker)
Sets the marker that shall be drawn at the last vertex of the given shape.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.void
setShape(java.awt.Shape shape)
Sets the Shape this shape painter is associated with.void
setStartMarker(Marker startMarker)
Sets the marker that shall be drawn at the first vertex of the given shape.
-
-
-
Field Detail
-
extShape
protected ExtendedShape extShape
The Shape to be painted.
-
startMarker
protected Marker startMarker
Start Marker
-
middleMarker
protected Marker middleMarker
Middle Marker
-
endMarker
protected Marker endMarker
End Marker
-
-
Method Detail
-
paint
public void paint(java.awt.Graphics2D g2d)
Paints the specified shape using the specified Graphics2D.- Specified by:
paint
in interfaceShapePainter
- Parameters:
g2d
- the Graphics2D to use
-
getPaintedArea
public java.awt.Shape getPaintedArea()
Returns the area painted by this shape painter.- Specified by:
getPaintedArea
in interfaceShapePainter
-
getPaintedBounds2D
public java.awt.geom.Rectangle2D getPaintedBounds2D()
Returns the bounds of the area painted by this shape painter- Specified by:
getPaintedBounds2D
in interfaceShapePainter
-
inPaintedArea
public boolean inPaintedArea(java.awt.geom.Point2D pt)
Returns true if pt is in the area painted by this shape painter- Specified by:
inPaintedArea
in interfaceShapePainter
-
getSensitiveArea
public java.awt.Shape getSensitiveArea()
Returns the area covered by this shape painter (even if not painted). This is always null for Markers.- Specified by:
getSensitiveArea
in interfaceShapePainter
-
getSensitiveBounds2D
public java.awt.geom.Rectangle2D getSensitiveBounds2D()
Returns the bounds of the area covered by this shape painte (even if not painted). This is always null for Markers.- Specified by:
getSensitiveBounds2D
in interfaceShapePainter
-
inSensitiveArea
public boolean inSensitiveArea(java.awt.geom.Point2D pt)
Returns true if pt is in the sensitive area. This is always false for Markers.- Specified by:
inSensitiveArea
in interfaceShapePainter
-
setShape
public void setShape(java.awt.Shape shape)
Sets the Shape this shape painter is associated with.- Specified by:
setShape
in interfaceShapePainter
- Parameters:
shape
- new shape this painter should be associated with. Should not be null.
-
getExtShape
public ExtendedShape getExtShape()
Gets the Shape this shape painter is associated with as an Extended Shape.- Returns:
- shape associated with this painter
-
getShape
public java.awt.Shape getShape()
Gets the Shape this shape painter is associated with.- Specified by:
getShape
in interfaceShapePainter
- 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.
-
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
-
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.
-
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
-
getEndMarker
public Marker getEndMarker()
Returns the marker that shall be drawn at the last vertex of the given shape.
-
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
-
buildMarkerGroup
protected void buildMarkerGroup()
Builds a new marker group with the current set of markers.
-
buildStartMarkerProxy
protected ProxyGraphicsNode buildStartMarkerProxy()
Builds a proxyGraphicsNode
for the inputMarker
to be drawn at the start position
-
buildEndMarkerProxy
protected ProxyGraphicsNode buildEndMarkerProxy()
Builds a proxyGraphicsNode
for the inputMarker
to be drawn at the end position.
-
buildMiddleMarkerProxies
protected ProxyGraphicsNode[] buildMiddleMarkerProxies()
Builds a proxyGraphicsNode
for the inputMarker
to be drawn at the middle positions
-
normalize
public double[] normalize(double[] v)
Normalizes the input vector. This assumes an non-zero length
-
getSegmentTerminatingPoint
protected java.awt.geom.Point2D getSegmentTerminatingPoint(double[] coords, int segType)
Extracts the terminating point, depending on the segment type.
-
-