|
||||||||||
| PREV CLASS Documentation homepage. NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectilog.views.IlvGraphic
ilog.views.graphic.IlvPolyPoints
ilog.views.graphic.IlvPolyline
ilog.views.graphic.IlvArrowPolyline
public class IlvArrowPolyline
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.blackIlvStroke.JOIN_MITER0ftrue1f
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(40f, 40f);
points[1] = new IlvPoint(50f, 20f);
points[2] = new IlvPoint(90f, 40f);
points[3] = new IlvPoint(70f, 70f);
points[4] = new IlvPoint(90f, 90f);
points[5] = new IlvPoint(40f, 90f);
points[6] = new IlvPoint(40f, 40f);
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(.8f);
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 Form| Constructor Summary | |
|---|---|
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,
float atpos)
Initializes a new arrow polyline. |
|
IlvArrowPolyline(IlvPoint[] points,
boolean alllines,
float atpos,
boolean copy)
Initializes a new arrow polyline. |
|
| Method Summary | |
|---|---|
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. |
float |
getArrowPosition()
Returns the position of the arrow. |
protected float |
getArrowSize(float 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(float 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. |
| Methods inherited from class ilog.views.graphic.IlvPolyline |
|---|
computeBBox, contains, finalize, getEndCap, getForeground, getIntersectionWithOutline, getLineJoin, getLineStyle, getLineWidth, getLineWidth, getMaximumLineWidth, pointsInBBox, setEndCap, setForeground, setLineJoin, setLineStyle, setLineWidth, setMaximumLineWidth |
| Methods inherited from class ilog.views.graphic.IlvPolyPoints |
|---|
allowsPointInsertion, allowsPointMove, allowsPointRemoval, applyTransform, getPointAt, getPoints, getPointsCardinal, inBBox, insertPoint, intersects, makeSelection, movePoint, recomputeBBox, removePoint |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public IlvArrowPolyline(IlvPoint[] points,
boolean alllines,
float 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,
float 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.| Method Detail |
|---|
public IlvGraphic copy()
copy in class IlvPolylineIlvGraphicpublic void setArrowPosition(float p)
p - the new position of the arrow. The value
must be in the range of [0.,1.].public float getArrowPosition()
public boolean isUsingAllLines()
public void setUsingAllLines(boolean value)
public void draw(Graphics dst,
IlvTransformer t)
draw in class IlvPolylinedst - The destination Graphics.t - The transformation used to draw the object.IlvGraphic.boundingBox(ilog.views.IlvTransformer),
IlvGraphic.zoomable(),
IlvGraphic
protected float getArrowSize(float 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 IlvGraphic.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 IlvPolyPointsInterfaceboundingBox in class IlvPolylinet - 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 IlvPersistentObjectwrite in class IlvPolylinestream - The output stream.
IOException - thrown when an exception occurs during
the write operation for this object.
|
||||||||||
| PREV CLASS Documentation homepage. NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||