public class IlvPolyline extends IlvPolyPoints
IlvPolyline represents a line that follows several points.
The default values for an IlvPolyline instance are as
follows:
Color.blackIlvStroke.JOIN_MITER0
The following code example shows how to use IlvPolyline
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);
IlvPolyline defaultPolyline = new IlvPolyline(points, true);
IlvPolyline customPolyline = new IlvPolyline(points, true);
customPolyline.removePoint(6, new IlvTransformer() );
customPolyline.setStrokeOn(true);
customPolyline.setForeground(Color.green);
customPolyline.setLineWidth(5);
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:
>
IlvPolyline 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 and Description |
|---|
IlvPolyline()
Creates a new
IlvPolyline
with some default shape. |
IlvPolyline(IlvInputStream stream)
Reads the object from an
IlvInputStream. |
IlvPolyline(IlvPoint[] points)
Creates a new
IlvPolyline. |
IlvPolyline(IlvPoint[] points,
boolean copy)
Creates a new
IlvPolyline. |
IlvPolyline(IlvPolyline source)
Creates a new
IlvPolyline by copying an existing one. |
| Modifier and Type | Method and Description |
|---|---|
IlvRect |
boundingBox(IlvTransformer t)
Returns the bounding rectangle of the object.
|
protected void |
computeBBox(IlvRect bbox)
Recomputes the bounding rectangle of the object.
|
boolean |
contains(IlvPoint p,
IlvPoint tp,
IlvTransformer t)
Tests if a point lies within the outline of the object.
|
IlvGraphic |
copy()
Copies the object.
|
void |
draw(Graphics dst,
IlvTransformer t)
Draws the object.
|
protected void |
finalize()
Overrides the method to clean some resources.
|
int |
getEndCap()
Returns the decoration applied at the end of the polyline.
|
Color |
getForeground()
Returns the color of the object.
|
IlvPoint |
getIntersectionWithOutline(IlvPoint innerPoint,
IlvPoint outerPoint,
IlvTransformer t)
Returns the intersection of the line segment from inner point to outer
point with the shape of the graphic object.
|
int |
getLineJoin()
Returns the decoration applied when two segments are joined.
|
float[] |
getLineStyle()
Returns the array representing the lengths of the dash segments.
|
double |
getLineWidth()
Returns the line width of the object.
|
double |
getLineWidth(IlvTransformer t)
Returns the line width that is
really displayed when the object is drawn
with the specified transformer.
|
double |
getMaximumLineWidth()
Returns the maximum line width of the polyline.
|
boolean |
pointsInBBox()
Returns true if all points of the polypoint object are contained in the
bounding box.
|
void |
setEndCap(int endCap)
Changes the decoration applied at the end of the polyline.
|
void |
setForeground(Color color)
Changes the color of the object.
|
void |
setLineJoin(int lineJoin)
Changes the decoration applied when two segments are joined.
|
void |
setLineStyle(float[] lineStyle)
Changes the array representing the lengths of the dash segments.
|
void |
setLineWidth(double lineWidth)
Changes the line width of the object.
|
void |
setMaximumLineWidth(double maximumLineWidth)
Changes the maximum line width of the polyline.
|
void |
write(IlvOutputStream stream)
Writes the object to an
IlvOutputStream. |
boolean |
zoomable()
Returns whether the object is zoomable.
|
allowsPointInsertion, allowsPointMove, allowsPointRemoval, applyTransform, getPointAt, getPoints, getPointsCardinal, inBBox, insertPoint, intersects, makeSelection, movePoint, recomputeBBox, removePoint, translateaddActionListener, 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, viewAddedOrRemovedpublic IlvPolyline()
IlvPolyline
with some default shape.public IlvPolyline(IlvPoint[] points)
IlvPolyline.
Note that this constructor will copy the array and
the points in the array, so you can reuse the same
array for another operation.points - the points of the polyline.public IlvPolyline(IlvPoint[] points, boolean copy)
IlvPolyline.points - the array of points.copy - if true, 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 IlvPolyline(IlvPolyline source)
IlvPolyline by copying an existing one.source - the copied object.public IlvPolyline(IlvInputStream stream) throws IlvReadFileException
IlvInputStream.stream - the input stream.IlvReadFileException - if the format is not correct.public IlvGraphic copy()
copy in class IlvGraphicIlvGraphicpublic boolean pointsInBBox()
IlvPolyline this
method simply returns true.public double getLineWidth()
public void setLineWidth(double lineWidth)
lineWidth - the new line width.public int getEndCap()
IlvStroke.
The default value is CAP_SQUARE.IlvStrokepublic void setEndCap(int endCap)
endCap - the new decoration style. The values
are defined in the class IlvStroke.
The default value is CAP_SQUARE.IlvStrokepublic int getLineJoin()
IlvStroke.
The default value is JOIN_ROUND since JViews 8.7.IlvStrokepublic void setLineJoin(int lineJoin)
lineJoin - the new decoration style. The values are defined
in the class IlvStroke.
The default value is JOIN_ROUND since JViews 8.7.IlvStrokepublic double getMaximumLineWidth()
public void setMaximumLineWidth(double maximumLineWidth)
public float[] getLineStyle()
public void setLineStyle(float[] lineStyle)
protected void computeBBox(IlvRect bbox)
computeBBox in class IlvPolyPointsbbox - the rectangle to store the resulting bounding box.public IlvRect boundingBox(IlvTransformer t)
boundingBox in interface IlvPolyPointsInterfaceboundingBox in class IlvPolyPointst - The transformer used to draw the object.IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer),
IlvGraphic.zoomable(),
IlvGraphicpublic boolean contains(IlvPoint p, IlvPoint tp, IlvTransformer t)
contains in class IlvGraphicp - The point to be tested, in untransformed coordinates.tp - The point p transformed by the transformer t.t - The transformer used to draw the object.true if the point lies inside this graphic object.IlvGraphicpublic IlvPoint getIntersectionWithOutline(IlvPoint innerPoint, IlvPoint outerPoint, IlvTransformer t)
innerPoint is not inside the graphic object,
or if outerPoint is not outside the graphic object, it
must return a valid point. For instance, if there is no intersection,
it can return the start point.getIntersectionWithOutline in class IlvGraphicinnerPoint - A point usually inside the graphic object, given in
manager view coordinates.outerPoint - A point usually outside of the graphic object, given in
manager view coordinates.t - The transformation used to draw the object.IlvClippingLinkConnectorpublic double getLineWidth(IlvTransformer t)
t - the transformer used to draw the object.public void draw(Graphics dst, IlvTransformer t)
draw in class IlvGraphicdst - The destination Graphics.t - The transformation used to draw the object.IlvGraphic.callDraw(Graphics,IlvTransformer),
IlvGraphic.boundingBox(IlvTransformer),
IlvGraphic.zoomable(),
IlvGraphicpublic void setForeground(Color color)
IlvBlinkingColor.setForeground in class IlvGraphiccolor - the new color.IlvGraphic.draw(Graphics, IlvTransformer),
IlvGraphic.setBackground(Color),
IlvGraphic.setFillOn(boolean),
IlvGraphic.setStrokeOn(boolean),
IlvGraphicpublic Color getForeground()
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 IlvPolyPointsstream - The output stream.IOException - thrown when an exception occurs during
the write operation for this object.public boolean zoomable()
zoomable in class IlvGraphicIlvGraphic,
IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer),
IlvGraphic.boundingBox(IlvTransformer),
IlvManager© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.