|
||||||||||
| 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
public class IlvPolyline
IlvPolyline represents a line that follows several points.
The default values for an IlvPolyline instance are as
follows:
Color.blackIlvStroke.JOIN_MITER0f
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(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);
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 Summary | |
|---|---|
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. |
|
| Method Summary | |
|---|---|
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. |
float |
getLineWidth()
Returns the line width of the object. |
float |
getLineWidth(IlvTransformer t)
Returns the line width that is really displayed when the object is drawn with the specified transformer. |
float |
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 c)
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(float lineWidth)
Changes the line width of the object. |
void |
setMaximumLineWidth(float maximumLineWidth)
Changes the maximum line width of the polyline. |
void |
write(IlvOutputStream stream)
Writes the object to an IlvOutputStream. |
| 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 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.| Method Detail |
|---|
public IlvGraphic copy()
copy in class IlvGraphicIlvGraphicpublic boolean pointsInBBox()
IlvPolyline this
method simply returns true.
public float getLineWidth()
public void setLineWidth(float 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_MITER.
IlvStrokepublic void setLineJoin(int lineJoin)
lineJoin - the new decoration style. The values are defined
in the class IlvStroke.
The default value is JOIN_MITER.IlvStrokepublic float getMaximumLineWidth()
public void setMaximumLineWidth(float 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(),
IlvGraphic
public 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.IlvGraphic
public 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 float 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.boundingBox(ilog.views.IlvTransformer),
IlvGraphic.zoomable(),
IlvGraphicpublic void setForeground(Color c)
setForeground in class IlvGraphicc - 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.
protected void finalize()
throws Throwable
finalize in class ObjectThrowable
|
||||||||||
| PREV CLASS Documentation homepage. NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||