public class IlvArrowLine extends IlvLine
IlvArrowLine
represents a custom graphic object that shows a
straight line between two given points with a small arrow head on the line
trajectory.
The default values for an IlvArrowLine
instance are as
follows:
Color.black
0
0
100
100
to
point
The following code example shows how to use an IlvArrowLine
in a
simple Java application:
IlvManager manager = new IlvManager(); IlvArrowLine myLine = new IlvArrowLine(); myLine.setFrom(new IlvPoint(20,20)); myLine.setTo(new IlvPoint(200,150)); myLine.setForeground(Color.green); myLine.setLineWidth(4); myLine.setArrowPosition(0.6); manager.addObject(myLine, true);
The following image shows the graphic object created in the code example:
IlvArrowLine
is a custom graphic object, that is, a subclass of
IlvGraphic
. Graphic objects are controlled using an
IlvManager
instance and displayed using one or more
IlvManagerView
instances in a Java Swing application.
For information about generic features for graphic objects, see
IlvGraphic.
IlvPoint
,
IlvManager
,
IlvManagerView
,
Serialized FormConstructor and Description |
---|
IlvArrowLine()
Creates a new arrow line starting at 0, 0 and ending
at 100, 100.
|
IlvArrowLine(double fromx,
double fromy,
double tox,
double toy,
double atpos)
Creates a new arrow line starting at fromx, fromy and ending
at tox, toy.
|
IlvArrowLine(IlvArrowLine source)
Creates a new line by copying an existing one.
|
IlvArrowLine(IlvInputStream stream)
Reads the object from an IlvInputStream.
|
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 . |
void |
setArrowPosition(double p)
Changes the position of the arrow.
|
void |
write(IlvOutputStream stream)
Writes the object to an
IlvOutputStream . |
allowsPointInsertion, allowsPointMove, allowsPointRemoval, applyTransform, contains, finalize, getEndCap, getForeground, getFrom, getLineStyle, getLineWidth, getLineWidth, getMaximumLineWidth, getPointAt, getPointsCardinal, getTo, insertPoint, makeSelection, movePoint, pointsInBBox, removePoint, setEndCap, setForeground, setFrom, setLineStyle, setLineWidth, setMaximumLineWidth, setTo
addActionListener, addNamedPropertyListener, allViewsRemoved, baseTextDirectionChanged, blinkingStateOn, boundingBox, callDraw, componentOrientationChanged, getAndAssociateObjectInteractor, getBaseTextDirection, getBlinkingAction, getBlinkingObjectOwner, getBlinkingOffPeriod, getBlinkingOnPeriod, getCenter, getComponentOrientation, getDefaultInteractor, getGraphicBag, GetGraphicObject, getIntersectionWithOutline, getLocale, getName, getNamedProperty, getObjectInteractor, getPopupMenu, getPopupMenu, getPopupMenuName, getProperty, getResolvedBaseTextDirection, getToolTipBaseTextDirection, getToolTipText, getToolTipText, getTopLevelGraphicBag, getTransferData, getTransferDataFlavors, getULocale, getZOrderIndex, hasProperty, inside, intersects, 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, translate, updateNeedsViewNotification, usesBidiMarkers, viewAddedOrRemoved, zoomable
public IlvArrowLine()
(100, 100)
.IlvArrowLine(double, double, double, double, double)
public IlvArrowLine(double fromx, double fromy, double tox, double toy, double atpos)
public IlvArrowLine(IlvArrowLine source)
public IlvArrowLine(IlvInputStream stream) throws IlvReadFileException
stream
- the input stream.IlvReadFileException
- if the format is not correct.public IlvGraphic copy()
copy
in class IlvLine
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 void draw(Graphics dst, IlvTransformer t)
draw
in class IlvLine
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 no longer proportional to the transformer
zoom factor, this may change the zoom capability of this object and the
IlvGraphic.zoomable()
method may also have to return something different.lineWidth
- The actual line width used to draw the object in manager
coordinates.t
- The transformer used to draw the object.IlvLine.getLineWidth()
public IlvRect boundingBox(IlvTransformer t)
boundingBox
in interface IlvPolyPointsInterface
boundingBox
in class IlvLine
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 IlvLine
stream
- The output stream.IOException
- thrown when an exception occurs during
the write operation for this object.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.