|
||||||||||
| 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.IlvLinkImage
ilog.views.graphic.IlvSplineLinkImage
public class IlvSplineLinkImage
IlvSplineLinkImage represents the connection between two
nodes in a grapher; the link is displayed as
a series of spline curves that trace the link points.
For more information about specialized link graphic objects, see
IlvLinkImage.
The default values for an IlvSplineLinkImage instance are
as follows:
Color.black0fIlvStroke.CAP_SQUARE
The following code example shows how to use an
IlvSplineLinkImage in a simple Java application:
IlvGraphic node1, node2;
IlvGrapher grapher = new IlvGrapher();
IlvPolylineLinkImage link;
//Create new ellipse node and add it to the grapher.
node1 = new IlvEllipse(new IlvRect(30,10,50,50), true, false);
grapher.addNode(node1,false);
//Add a new rectangular node to the grapher.
node2 = new IlvRectangle(new IlvRect(220,90,50,50), false, true);
grapher.addNode(node2, 2, true);
//Add points
IlvPoint[] points = new IlvPoint[5];
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);
//Link the two nodes and add the link to a grapher.
link = new IlvPolylineLinkImage(
node1,
node2,
true,
points);
link.setForeground(Color.green);
grapher.addLink(link,true);
The following image shows the graphic object created in the code example:
>
IlvSplineLinkImage 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 Form| Constructor Summary | |
|---|---|
IlvSplineLinkImage(IlvGraphic from,
IlvGraphic to,
boolean oriented,
IlvPoint[] points)
Creates and initializes a new IlvSplineLinkImage. |
|
IlvSplineLinkImage(IlvInputStream stream)
Reads the object from an IlvInputStream. |
|
IlvSplineLinkImage(IlvSplineLinkImage source)
Creates and initializes a new IlvSplineLinkImage
by copying an existing one. |
|
| Method Summary | |
|---|---|
boolean |
allowsPointInsertion()
Returns true if point insertion is allowed, and
false otherwise. |
boolean |
allowsPointRemoval()
Returns true if point removal is allowed,
and false otherwise. |
void |
applyTransform(IlvTransformer t)
Applies a transformation to the shape of the object. |
IlvRect |
boundingBox(IlvTransformer t)
Returns the bounding rectangle of the object. |
boolean |
contains(IlvPoint p,
IlvPoint tp,
IlvTransformer t)
Tests if a point lies within the outline of the link. |
IlvGraphic |
copy()
Copies the object. |
void |
draw(Graphics dst,
IlvTransformer t)
Draws the object. |
IlvPoint[] |
getLinkPoints(IlvTransformer t)
Returns the points that define the link. |
IlvPoint |
getPointAt(int index,
IlvTransformer t)
Returns the point at the specified index. |
int |
getPointsCardinal()
Returns the number of points. |
float |
getSmoothness()
Returns the smoothness of the spline. |
void |
insertPoint(int index,
float x,
float y,
IlvTransformer t)
Inserts a point at a specified index. |
boolean |
isSpline()
Returns true if the link has spline routing functionality. |
IlvSelection |
makeSelection()
Creates the selection object for this class. |
void |
movePoint(int index,
float x,
float y,
IlvTransformer t)
Changes the position of a point. |
boolean |
pointsInBBox()
Returns false since the points defining the spline
are not in the bounding box of the object. |
void |
removePoint(int index,
IlvTransformer t)
Removes the point at the specified index. |
void |
setIntermediateLinkPoints(IlvPoint[] points,
int index,
int length)
Changes the intermediate points that define the link. |
void |
setSmoothness(float smoothness)
Sets the smoothness of the spline. |
void |
write(IlvOutputStream stream)
Writes the object to an IlvOutputStream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public IlvSplineLinkImage(IlvGraphic from,
IlvGraphic to,
boolean oriented,
IlvPoint[] points)
IlvSplineLinkImage.
from - the origin object.to - the destination object.oriented - specifies whether an arrow is drawn at the end of the
link, or not.points - the intermediate points of the spline.public IlvSplineLinkImage(IlvSplineLinkImage source)
IlvSplineLinkImage
by copying an existing one.
source - the copied object.
public IlvSplineLinkImage(IlvInputStream stream)
throws IlvReadFileException
IlvInputStream.
stream - the input stream.
IlvReadFileException - if the format is not correct.| Method Detail |
|---|
public IlvGraphic copy()
copy in class IlvLinkImageIlvGraphicpublic int getPointsCardinal()
getPointsCardinal in interface IlvPolyPointsInterfacegetPointsCardinal in class IlvLinkImagepublic IlvPoint[] getLinkPoints(IlvTransformer t)
getLinkPoints in class IlvLinkImage
public void setIntermediateLinkPoints(IlvPoint[] points,
int index,
int length)
length points in points array
beginning at the index point and will use them for a new
intermediate points array.
If the array is null or the length parameter is 0, intermediate points are removed.
setIntermediateLinkPoints in class IlvLinkImagepoints - An array of points.index - The index of the point which will be the first intermediate point.length - The number of intermediate points taken in the points array.IlvApplyObject,
IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)
public IlvPoint getPointAt(int index,
IlvTransformer t)
getPointAt in interface IlvPolyPointsInterfacegetPointAt in class IlvLinkImageindex - The index of the point.t - The transformer through which the object is drawn.public boolean allowsPointInsertion()
true if point insertion is allowed, and
false otherwise. The
default implementation returns true.
allowsPointInsertion in interface IlvPolyPointsInterfaceallowsPointInsertion in class IlvLinkImagetrue if the insertion of intermediate points is
allowed and false otherwise.IlvLinkImage.insertPoint(int, float, float, ilog.views.IlvTransformer)public boolean allowsPointRemoval()
true if point removal is allowed,
and false otherwise.
allowsPointRemoval in interface IlvPolyPointsInterfaceallowsPointRemoval in class IlvLinkImagetrue if the removal of intermediate points is
allowed and false otherwise.IlvLinkImage.removePoint(int, ilog.views.IlvTransformer)
public void insertPoint(int index,
float x,
float y,
IlvTransformer t)
insertPoint in interface IlvPolyPointsInterfaceinsertPoint in class IlvLinkImageindex - The index at which the new point will be inserted.x - The x coordinate of the new point (in manager's coordinates).y - The y coordinate of the new point (in manager's coordinates).t - The transformer used to draw the link.
public void removePoint(int index,
IlvTransformer t)
removePoint in interface IlvPolyPointsInterfaceremovePoint in class IlvLinkImageindex - The index of the point to be removed.t - The transformer used to draw the polypoint.
public void movePoint(int index,
float x,
float y,
IlvTransformer t)
index is the index of the first or the last point,
the method calls the movePoint method of the superclass.
Otherwise, the method simply moves the point to the new coordinates.
movePoint in interface IlvPolyPointsInterfacemovePoint in class IlvLinkImageindex - The index of the point to be moved.x - The new x coordinate of the point (in manager's coordinates).y - The new y coordinate of the point (in manager's coordinates).t - the transformer through which the object is drawn.IlvApplyObject,
IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)public void applyTransform(IlvTransformer t)
applyTransform in class IlvLinkImaget - The transformer to be applied.IlvGraphicpublic boolean pointsInBBox()
false since the points defining the spline
are not in the bounding box of the object.
pointsInBBox in interface IlvPolyPointsInterfacepointsInBBox in class IlvLinkImagepublic IlvRect boundingBox(IlvTransformer t)
boundingBox in interface IlvPolyPointsInterfaceboundingBox in class IlvLinkImaget - 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 IlvLinkImagep - The point to be tested.tp - The point p transformed by the transformer t.t - The transformation that was applied to the object when it
was drawn.
true if the point lies inside this graphic object.IlvGraphic
public void draw(Graphics dst,
IlvTransformer t)
draw in class IlvLinkImagedst - The destination Graphics.t - The transformation used to draw the object.IlvGraphic.boundingBox(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 IlvLinkImagestream - The output stream.
IOException - thrown when an exception occurs during
the write operation for this object.public void setSmoothness(float smoothness)
A special value IlvGraphicUtil.AUTO_SMOOTHNESS can be set
to use an algorithm that automatically detects an appropriate smoothness
for each bend.
The default value is IlvGraphicUtil.COMPATIBLE_SMOOTHNESS.
With this value, a spline looks exactly as in JViews 3.0,
that is, the spline with more than two bends (4 control points) will not
look smooth.
Changing the smoothness influences the bounding box of the object.
Therefore it should be only done using an IlvApplyObject
passed to IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean).
smoothness - The smoothness.getSmoothness()public float getSmoothness()
setSmoothness(float)public boolean isSpline()
isSpline in class IlvLinkImagepublic IlvSelection makeSelection()
IlvSplineLinkSelection.
makeSelection in class IlvLinkImageIlvSplineLinkSelection
|
||||||||||
| PREV CLASS Documentation homepage NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||