|
||||||||||
| 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.IlvLine
public class IlvLine
IlvLine represents a custom graphic object that shows a
straight line between two given points.
The default values for an IlvLine instance are as
follows:
Color.black00 100100
The following code example shows how to use an IlvLine in a
simple Java application:
IlvManager manager = new IlvManager(); IlvLine myLine = new IlvLine(20,20,200,150); myLine.setForeground(Color.green); myLine.setLineWidth(7); manager.addObject(myLine, true);
The following image shows the graphic object created in the code example:
IlvLine 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 | |
|---|---|
IlvLine()
Creates a new line starting at (0, 0) and ending
at (100, 100). |
|
IlvLine(float fromx,
float fromy,
float tox,
float toy)
Creates a new line starting at fromx, fromy
and ending at tox, toy. |
|
IlvLine(IlvInputStream stream)
Reads the object from an IlvInputStream. |
|
IlvLine(IlvLine source)
Creates a new line by copying an existing one. |
|
IlvLine(IlvPoint fromPoint,
IlvPoint toPoint)
Creates a new line starting at fromPoint and ending at
toPoint. |
|
| Method Summary | |
|---|---|
boolean |
allowsPointInsertion()
Returns true if the interactors are allowed to add points, and
false otherwise. |
boolean |
allowsPointMove(int index)
Returns true if the interactors are allowed to move the point
with the specified index, and false otherwise. |
boolean |
allowsPointRemoval()
Returns true if the interactors are allowed to remove points,
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 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 line. |
IlvPoint |
getFrom()
Returns the origin point of the line. |
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 actually displayed when the object is drawn with the specified transformer. |
float |
getMaximumLineWidth()
Returns the maximum line width of the line. |
IlvPoint |
getPointAt(int index,
IlvTransformer t)
Returns a point of the line transformed with the specified transformer. |
int |
getPointsCardinal()
Returns the number of points (that is, 2). |
IlvPoint |
getTo()
Returns the destination point of the line. |
void |
insertPoint(int index,
float x,
float y,
IlvTransformer t)
The insertion of a point is not allowed in IlvLine. |
IlvSelection |
makeSelection()
Creates a selection object for this object. |
void |
movePoint(int index,
float x,
float y,
IlvTransformer t)
Changes the position of a point. |
boolean |
pointsInBBox()
Returns true because all points of the line
are contained in the bounding box. |
void |
removePoint(int index,
IlvTransformer t)
The removal of a point is not allowed in IlvLine. |
void |
setEndCap(int endCap)
Changes the decoration applied at the end of the polyline. |
void |
setForeground(Color color)
Changes the color of the line. |
void |
setFrom(IlvPoint p)
Changes the origin point of the line. |
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 line. |
void |
setTo(IlvPoint p)
Changes the destination point of the line. |
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 IlvLine()
(0, 0) and ending
at (100, 100).
IlvLine(float, float, float, float)
public IlvLine(IlvPoint fromPoint,
IlvPoint toPoint)
fromPoint and ending at
toPoint.
fromPoint - The starting point.toPoint - The ending point.
public IlvLine(float fromx,
float fromy,
float tox,
float toy)
fromx, fromy
and ending at tox, toy.
fromx - The starting x-coordinate.fromy - The starting y-coordinate.tox - The ending x-coordinate.toy - The ending y-coordinate.public IlvLine(IlvLine source)
source - The source line to be copied.
public IlvLine(IlvInputStream stream)
throws IlvReadFileException
IlvInputStream.
stream - The input stream.
IlvReadFileException - if the format is not correct.| Method Detail |
|---|
public IlvGraphic copy()
copy in class IlvGraphicIlvGraphic
public boolean contains(IlvPoint p,
IlvPoint tp,
IlvTransformer t)
contains in class IlvGraphicp - 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 IlvGraphicdst - The destination Graphics.t - The transformation used to draw the object.IlvGraphic.boundingBox(ilog.views.IlvTransformer),
IlvGraphic.zoomable(),
IlvGraphicpublic boolean pointsInBBox()
true because all points of the line
are contained in the bounding box.
pointsInBBox in interface IlvPolyPointsInterfacepublic IlvRect boundingBox(IlvTransformer t)
boundingBox in interface IlvPolyPointsInterfaceboundingBox in class IlvGraphict - The transformer used to draw the object.IlvGraphic.draw(java.awt.Graphics, ilog.views.IlvTransformer),
IlvGraphic.zoomable(),
IlvGraphicpublic void applyTransform(IlvTransformer t)
applyTransform in class IlvGraphict - The transformer to be applied.IlvGraphicpublic IlvPoint getFrom()
public IlvPoint getTo()
public void setTo(IlvPoint p)
p - The new destination point.public void setFrom(IlvPoint p)
p - The new origin point.public float getLineWidth()
0.
public void setLineWidth(float lineWidth)
lineWidth - The new line width.public float getLineWidth(IlvTransformer t)
t - The transformer used to draw the object.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 float getMaximumLineWidth()
public void setMaximumLineWidth(float maximumLineWidth)
maximumLineWidth - The new maximum line width.public float[] getLineStyle()
public void setLineStyle(float[] lineStyle)
lineStyle - The new line style.public void setForeground(Color color)
setForeground in class IlvGraphiccolor - The new color.IlvGraphic.draw(Graphics, IlvTransformer),
IlvGraphic.setBackground(Color),
IlvGraphic.setFillOn(boolean),
IlvGraphic.setStrokeOn(boolean),
IlvGraphicpublic Color getForeground()
public IlvPoint getPointAt(int index,
IlvTransformer t)
getPointAt in interface IlvPolyPointsInterfaceindex - Should be 0 or 1.t - The transformer.public int getPointsCardinal()
2).
getPointsCardinal in interface IlvPolyPointsInterface
public void movePoint(int index,
float x,
float y,
IlvTransformer t)
movePoint in interface IlvPolyPointsInterfaceindex - The index of the point.x - The new x-coordinate of the point.y - The new y-coordinate of the point.t - The transformation to be applied.allowsPointMove(int)public final boolean allowsPointInsertion()
true if the interactors are allowed to add points, and
false otherwise.
The default implementation always returns true.
allowsPointInsertion in interface IlvPolyPointsInterfacepublic final boolean allowsPointRemoval()
true if the interactors are allowed to remove points,
and false otherwise.
The default implementation always returns true.
allowsPointRemoval in interface IlvPolyPointsInterfacepublic boolean allowsPointMove(int index)
true if the interactors are allowed to move the point
with the specified index, and false otherwise.
The default implementation always returns true.
allowsPointMove in interface IlvPolyPointsInterfaceindex - The index of the point.
public final void insertPoint(int index,
float x,
float y,
IlvTransformer t)
IlvLine. Therefore,
this method has an empty implementation, and should not be called.
insertPoint in interface IlvPolyPointsInterfaceindex - The index at which the new point will be inserted.x - The x coordinate of the new point.y - The y coordinate of the new point.t - The transformer used to draw the polypoint.
public final void removePoint(int index,
IlvTransformer t)
IlvLine. Therefore,
this method has an empty implementation, and should not be called.
removePoint in interface IlvPolyPointsInterfaceindex - The index of the point to remove.t - The transformer used to draw the polypoint.public IlvSelection makeSelection()
IlvPolyPointsSelection.
makeSelection in class IlvGraphicIlvDrawSelection
public void write(IlvOutputStream stream)
throws IOException
IlvOutputStream.
You should not call this
method directly; instead, you should use the write
methods of the manager.
write in interface IlvPersistentObjectwrite in class IlvGraphicstream - 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 | |||||||||