public class IlvArrowPolyline extends IlvPolyline
IlvArrowPolyline
represents a line that follows several points
and has one or more arrows along its length.
The default values for an IlvArrowPolyline
instance are as
follows:
Color.black
IlvStroke.JOIN_MITER
0
true
1
The following code example shows how to use IlvArrowPolyline
in a simple Java application:
IlvManager manager = new IlvManager(); IlvPoint[] points = new IlvPoint[7]; points[0] = new IlvPoint(40, 40); points[1] = new IlvPoint(50, 20); points[2] = new IlvPoint(90, 40); points[3] = new IlvPoint(70, 70); points[4] = new IlvPoint(90, 90); points[5] = new IlvPoint(40, 90); points[6] = new IlvPoint(40, 40); IlvArrowPolyline defaultPolyline = new IlvArrowPolyline(points, true); IlvArrowPolyline customPolyline = new IlvArrowPolyline(points, true); customPolyline.removePoint(6, new IlvTransformer() ); customPolyline.setStrokeOn(true); customPolyline.setForeground(Color.green); customPolyline.setLineWidth(5); //Set the arrow to be at the end of the last stretch of the polyline. customPolyline.setUsingAllLines(false); customPolyline.setArrowPosition(.8); customPolyline.moveResize(new IlvRect(100,80,40,40)); IlvPoint center = customPolyline.getCenter(new IlvTransformer()); customPolyline.rotate(center, 130); manager.addObject(defaultPolyline, true); manager.addObject(customPolyline, true);
The following image shows the graphic objects created in the code example:
>
IlvArrowPolyline
is a custom graphic object, that is, a subclass of
IlvGraphic
. Graphic objects are controlled using an instance of
IlvManager
or one of its subclasses, and displayed using one or
more IlvManagerView
instances in a Java Swing application.
For information about generic features for graphic objects, see
IlvGraphic.
IlvManager
,
IlvManagerView
,
IlvStroke
,
Serialized FormConstructor and Description |
---|
IlvArrowPolyline(IlvArrowPolyline source)
Initializes a new arrow polyline by copying the source
polyline.
|
IlvArrowPolyline(IlvInputStream stream)
Reads the object from an IlvInputStream.
|
IlvArrowPolyline(IlvPoint[] points)
Initializes a new arrow polyline with a single arrow.
|
IlvArrowPolyline(IlvPoint[] points,
boolean alllines)
Initializes a new arrow polyline.
|
IlvArrowPolyline(IlvPoint[] points,
boolean alllines,
double atpos)
Initializes a new arrow polyline.
|
IlvArrowPolyline(IlvPoint[] points,
boolean alllines,
double atpos,
boolean copy)
Initializes a new arrow polyline.
|
Modifier and Type | Method and Description |
---|---|
IlvRect |
boundingBox(IlvTransformer t)
Returns the bounding rectangle of the object.
|
IlvGraphic |
copy()
Copies the object.
|
void |
draw(Graphics dst,
IlvTransformer t)
Draws the object.
|
double |
getArrowPosition()
Returns the position of the arrow.
|
protected double |
getArrowSize(double lineWidth,
IlvTransformer t)
Returns the size of the arrow for the corresponding
IlvTransformer . |
boolean |
isUsingAllLines()
Returns whether or not an arrow is drawn on all lines
|
void |
setArrowPosition(double p)
Changes the position of the arrow.
|
void |
setUsingAllLines(boolean value)
Specifies whether an arrow is drawn on all lines, or not.
|
void |
write(IlvOutputStream stream)
Writes the object to an
IlvOutputStream . |
computeBBox, contains, finalize, getEndCap, getForeground, getIntersectionWithOutline, getLineJoin, getLineStyle, getLineWidth, getLineWidth, getMaximumLineWidth, pointsInBBox, setEndCap, setForeground, setLineJoin, setLineStyle, setLineWidth, setMaximumLineWidth, zoomable
allowsPointInsertion, allowsPointMove, allowsPointRemoval, applyTransform, getPointAt, getPoints, getPointsCardinal, inBBox, insertPoint, intersects, makeSelection, movePoint, recomputeBBox, removePoint, translate
addActionListener, addNamedPropertyListener, allViewsRemoved, baseTextDirectionChanged, blinkingStateOn, boundingBox, callDraw, componentOrientationChanged, getAndAssociateObjectInteractor, getBaseTextDirection, getBlinkingAction, getBlinkingObjectOwner, getBlinkingOffPeriod, getBlinkingOnPeriod, getCenter, getComponentOrientation, getDefaultInteractor, getGraphicBag, GetGraphicObject, getLocale, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenu, getPopupMenuName, getProperty, getResolvedBaseTextDirection, getToolTipBaseTextDirection, getToolTipText, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, getULocale, getZOrderIndex, hasProperty, inside, invalidateBBoxCache, invalidateBidiCache, isBaseTextDirectionSensitive, isComponentOrientationSensitive, isDataFlavorSupported, isEditable, isInApplyToObject, isLocaleSensitive, isMovable, isPersistent, isSelectable, isVisible, localeChanged, move, move, moveResize, needsViewNotification, notifyObjectInteractorToManager, processActionEvent, reDraw, registerBlinkingResource, removeActionListener, removeNamedProperty, removeNamedPropertyListener, removeProperty, replaceProperty, resize, rotate, scale, setBackground, setBaseTextDirection, setBaseTextDirectionDuringConstruction, setBlinkingAction, setBlinkingOffPeriod, setBlinkingOnPeriod, setEditable, setFillOn, setGraphicBag, setInApplyToObject, setMovable, setName, setNamedProperty, setNameImpl, setObjectInteractor, setPopupMenu, setPopupMenuName, setProperty, setSelectable, setStrokeOn, setToolTipBaseTextDirection, setToolTipText, setVisible, setZOrderIndex, toString, updateNeedsViewNotification, usesBidiMarkers, viewAddedOrRemoved
public IlvArrowPolyline(IlvPoint[] points, boolean alllines, double atpos)
points
- the array of points. This array and the points
will be copied by the constructor.alllines
- indicates whether an arrow is drawn on all lines or only
on the last line.atpos
- this parameter must be in the range of [0.,1.].
It indicates the position of the arrow on the line.public IlvArrowPolyline(IlvPoint[] points, boolean alllines, double atpos, boolean copy)
points
- the array of points.alllines
- indicates whether an arrow is drawn on all lines or only
on the last line.atpos
- this parameter must be in the range of [0.,1.].
It indicates the position of the arrow on the line.copy
- if true then the array of points and the points
of the first parameter will be copied, otherwise this
array will be used by the object and you must not use this
array anymore.public IlvArrowPolyline(IlvPoint[] points, boolean alllines)
points
- the array of points. This array and the points
will be copied by the constructor.alllines
- indicates whether an arrow is drawn on all lines or only
on the last line.public IlvArrowPolyline(IlvPoint[] points)
points
- the array of points. This array and the points
will be copied by the constructor.public IlvArrowPolyline(IlvArrowPolyline source)
source
- the origin of the copy.public IlvArrowPolyline(IlvInputStream stream) throws IlvReadFileException
stream
- the input stream.IlvReadFileException
- if the format is not correct.public IlvGraphic copy()
copy
in class IlvPolyline
IlvGraphic
public void setArrowPosition(double p)
p
- the new position of the arrow. The value
must be in the range of [0.,1.].public double getArrowPosition()
public boolean isUsingAllLines()
public void setUsingAllLines(boolean value)
public void draw(Graphics dst, IlvTransformer t)
draw
in class IlvPolyline
dst
- The destination Graphics.t
- The transformation used to draw the object.IlvGraphic.callDraw(Graphics,IlvTransformer)
,
IlvGraphic.boundingBox(IlvTransformer)
,
IlvGraphic.zoomable()
,
IlvGraphic
protected double getArrowSize(double lineWidth, IlvTransformer t)
IlvTransformer
.
By redefining this method the subclass can change the default size of the arrow
which by default is proportional to the link line width.
If this method returns a size that is not anymore proportional to the transformer
zoom factor, this may change the zoom capability of this object and the IlvPolyline.zoomable()
method
may also have to return something different.lineWidth
- The actual line width used to drawn the object in manager coordinates.t
- The transformer used to draw the object.IlvPolyline.getLineWidth()
public IlvRect boundingBox(IlvTransformer t)
boundingBox
in interface IlvPolyPointsInterface
boundingBox
in class IlvPolyline
t
- The transformer used to draw the object.IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer)
,
IlvGraphic.zoomable()
,
IlvGraphic
public void write(IlvOutputStream stream) throws IOException
IlvOutputStream
.
Note that even if this is a public method, you should not
call it directly, you should use the write
methods of the manager.write
in interface IlvPersistentObject
write
in class IlvPolyline
stream
- The output stream.IOException
- thrown when an exception occurs during
the write operation for this object.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.