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