public class IlvHyperGrapherPin extends Object implements Serializable, IlvPersistentObject
IlvHyperEdge
).
The pins are managed by the class IlvHyperEdgePinConnector
that can be attached to the node.
Hence, the pins represent the points at the node where a hyperedge can
start or end.IlvHyperEdgePinConnector
,
IlvHyperEdge
,
Serialized FormConstructor and Description |
---|
IlvHyperGrapherPin(IlvHyperEdgePinConnector connector,
IlvPoint proportionalLocation,
IlvPoint absoluteLocation,
double size,
int direction)
Creates a new pin and adds it to the input connector.
|
IlvHyperGrapherPin(IlvInputStream stream)
Reads the pin from an
IlvInputStream . |
IlvHyperGrapherPin(IlvPoint proportionalLocation,
IlvPoint absoluteLocation,
double size,
int direction)
Creates a new pin.
|
Modifier and Type | Method and Description |
---|---|
boolean |
allow(IlvHyperEdgeEnd end)
Returns
true if the input hyperedge end is allowed to
connect to this pin. |
IlvRect |
boundingBox(IlvTransformer t)
Returns the bounding rectangle of the pin.
|
protected boolean |
connectionZoomable()
Returns
true if the connection point of the pin is zoomable;
otherwise it returns false . |
boolean |
contains(IlvPoint p,
IlvPoint tp,
IlvTransformer t)
Tests if a point lies within the pin.
|
IlvHyperGrapherPin |
copy()
Creates a copy of this pin.
|
protected void |
draw(Graphics dst,
IlvRect rect)
Draws the pin.
|
void |
draw(Graphics dst,
IlvTransformer t)
Draws the pin if it is visible.
|
IlvPoint |
getAbsoluteOffset()
Returns the absolute offset of the pin in manager coordinates.
|
Color |
getColor()
Returns the color of the pin if it is visible.
|
Iterator |
getConnectedEnds()
Returns the hyperedge ends that is connected to the pin.
|
int |
getDirection()
Returns the direction into which the pin connects to the hyperedge.
|
IlvHyperEdgePinConnector |
getHyperEdgeConnector()
Returns the
IlvHyperEdgePinConnector which manages this
pin, or null if the pin has been removed. |
IlvGraphic |
getNode()
Returns the node corresponding to the pin, that is, the node
returned by the method
IlvHyperEdgePinConnector.getNode() called
on the IlvHyperEdgePinConnector that manages this pin. |
IlvRect |
getNodeBoundingBox(IlvTransformer t)
Returns the bounding box of the related node.
|
IlvPoint |
getPosition(IlvTransformer t)
Returns the position of the pin in view coordinates.
|
IlvPoint |
getProportionalOffset()
Returns the relative offset of the pin.
|
Color |
getSelectedColor()
Returns the color of the pin if it is selected.
|
double |
getSize()
Returns the size of the pin when it is drawn.
|
boolean |
isAllowMultiConnection()
Returns whether this connector allows multiple hyperedge ends to connect
to the same pin.
|
boolean |
isConnected(IlvHyperEdgeEnd end)
Returns
true if the input hyperedge end is connected
to this pin. |
boolean |
isMovable()
Returns whether the pin is movable by interactors.
|
boolean |
isSelected()
Returns
true if the pin is selected. |
boolean |
isVisible()
Returns whether the pin is visible.
|
void |
setAbsoluteOffset(double xoffset,
double yoffset)
Sets the absolute offset of the pin.
|
void |
setAllowMultiConnection(boolean allow)
Sets whether this connector allows multiple hyperedge ends to connect
to the same pin.
|
void |
setColor(Color c)
Sets the color of the pin if it is visible.
|
void |
setDirection(int direction)
Sets the direction into which the pin connects to the hyperedge.
|
void |
setMovable(boolean movable)
Sets whether the pin is movable by interactors.
|
void |
setPosition(IlvPoint p,
IlvTransformer t)
Sets the position of the pin.
|
void |
setProportionalOffset(double xoffset,
double yoffset)
Sets the proportional offset of the pin.
|
void |
setSelected(boolean selected)
Sets whether the pin is selected.
|
void |
setSelectedColor(Color c)
Sets the color of the pin if it is selected.
|
void |
setVisible(boolean visible)
Sets whether the pin is visible.
|
void |
write(IlvOutputStream stream)
Writes the pin to an
IlvOutputStream . |
protected boolean |
zoomable()
Returns
true if the pin is zoomable;
otherwise it returns false . |
public IlvHyperGrapherPin(IlvPoint proportionalLocation, IlvPoint absoluteLocation, double size, int direction)
The x and y coordinates of the point proportionalLocation
represent the relative location of the pin in the two axis system.
For example, the point (0, 0)
means the top-left corner,
(1,1)
means the bottom-right corner, and
(0.5, 0.5)
means the center of the bounding box of
the node, as returned by the method getNodeBoundingBox(ilog.views.IlvTransformer)
.
The x and y coordinates of the point absoluteLocation
represents the additional absolute offset vector to the relative
location. The real position of the pin is:
x = node.x + proportionalLocation.x * node.width + absoluteLocation.x y = node.y + proportionalLocation.x * node.height + absoluteLocation.y
The direction specified where the pin connects to the hyperedge. The valid values are:
IlvDirection.Left
-
the hyperedge connects to the left side of the pin.
This should be used if the pin is on the left side of the node.IlvDirection.Right
-
the hyperedge connects to the right side of the pin.
This should be used if the pin is on the right side of the node.IlvDirection.Top
-
the hyperedge connects to the top side of the pin.
This should be used if the pin is on the top side of the node.IlvDirection.Bottom
-
the hyperedge connects to the bottom side of the pin.
This should be used if the pin is on the bottom side of the node.IlvDirection.Center
-
the hyperedge connects to the center of the pin.0
-
the hyperedge determines the best connection automatically.proportionalLocation
- The proportional location of the pin.absoluteLocation
- The absolute location of the pin in manager
coordinates.size
- The size of the pin when it is visible.direction
- The direction where the hyperedge connects to the pin.public IlvHyperGrapherPin(IlvHyperEdgePinConnector connector, IlvPoint proportionalLocation, IlvPoint absoluteLocation, double size, int direction)
The x and y coordinates of the point proportionalLocation
represent the relative location of the pin in the two axis system.
For example, the point (0, 0)
means the top-left corner,
(1,1)
means the bottom-right corner, and
(0.5, 0.5)
means the center of the bounding box of
the node, as returned by the method getNodeBoundingBox(ilog.views.IlvTransformer)
.
The x and y coordinates of the point absoluteLocation
represents the additional absolute offset vector to the relative
location. The real position of the pin is:
x = node.x + proportionalLocation.x * node.width + absoluteLocation.x y = node.y + proportionalLocation.x * node.height + absoluteLocation.y
The direction specified where the pin connects to the hyperedge. The valid values are:
IlvDirection.Left
-
the hyperedge connects to the left side of the pin.
This should be used if the pin is on the left side of the node.IlvDirection.Right
-
the hyperedge connects to the right side of the pin.
This should be used if the pin is on the right side of the node.IlvDirection.Top
-
the hyperedge connects to the top side of the pin.
This should be used if the pin is on the top side of the node.IlvDirection.Bottom
-
the hyperedge connects to the bottom side of the pin.
This should be used if the pin is on the bottom side of the node.IlvDirection.Center
-
the hyperedge connects to the center of the pin.0
-
the hyperedge determines the best connection automatically.connector
- The hyperedge connector of this pin.proportionalLocation
- The proportional location of the pin.absoluteLocation
- The absolute location of the pin in manager
coordinates.size
- The size of the pin when it is visible.direction
- The direction where the hyperedge connects to the pin.public IlvHyperGrapherPin(IlvInputStream stream) throws IlvReadFileException
IlvInputStream
.stream
- The input stream.IlvReadFileException
- if the format is not correct.write(ilog.views.io.IlvOutputStream)
public void write(IlvOutputStream stream) throws IOException
IlvOutputStream
.
You should not
call this method directly; instead, you should use the write
methods of the IlvGrapher
that contains the node
to which the hyperedge connector is attached.
write
in interface IlvPersistentObject
stream
- The output stream.IOException
- thrown when an exception occurs during
the write operation for this object.public IlvHyperGrapherPin copy()
public Iterator getConnectedEnds()
IlvHyperEdgeEnd
objects.
The returned iterator does not support the Iterator.remove()
operation.public boolean isConnected(IlvHyperEdgeEnd end)
true
if the input hyperedge end is connected
to this pin.public boolean allow(IlvHyperEdgeEnd end)
true
if the input hyperedge end is allowed to
connect to this pin. You can override this method to restrict the
types of edges that can connect to this pin.
The default implementation returns true
if multi connection
is allowed or if the pin has no connected end yet.end
- The hyperedge end.isAllowMultiConnection()
public IlvPoint getPosition(IlvTransformer t)
t
- The transformer to draw the node of the pin.getNode()
public void setPosition(IlvPoint p, IlvTransformer t)
IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)
).p
- The new position of the pin in view coordinates.t
- The transformer to draw the node of the pin.public void setAbsoluteOffset(double xoffset, double yoffset)
x = node.x + proportionalLocation.x * node.width + xoffset y = node.y + proportionalLocation.x * node.height + yoffset
If the hyperedge connector that owns this pin is visible and inside
a grapher, this must be done inside an applyToObject session of the
node that has the hyperedge connector (see
IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)
).
xoffset
- The x offset in manager coordinates.yoffset
- The y offset in manager coordinates.getAbsoluteOffset()
public IlvPoint getAbsoluteOffset()
setAbsoluteOffset(double, double)
public void setProportionalOffset(double xoffset, double yoffset)
0
means the left border,
1
means the right border, and 0.5
means the
horizontal middle of the bounding box of the node, as returned by the
method getNodeBoundingBox(ilog.views.IlvTransformer)
.
The absolute offset is added to the proportional offsets to retrieve the position of the pin. The real position of the pin is:
x = node.x + xoffset * node.width + absoluteLocation.x y = node.y + yoffset * node.height + absoluteLocation.y
If the hyperedge connector that owns this pin is visible and inside
a grapher, this must be done inside an applyToObject session of the
node that has the hyperedge connector (see
IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)
).
xoffset
- The x offsetyoffset
- The y offsetgetProportionalOffset()
public IlvPoint getProportionalOffset()
setProportionalOffset(double, double)
protected boolean connectionZoomable()
true
if the connection point of the pin is zoomable;
otherwise it returns false
.
The connection point is zoomable if calling the
getConnectPosition
member function with a transformer
gives the same result as calling it with a null
(identity)
transformer and then applying the transformer to the result.
Don't confuse this with the method zoomable()
which indicates
whether the drawing area of the pin would be zoomable.
protected boolean zoomable()
true
if the pin is zoomable;
otherwise it returns false
.
A pin is zoomable if calling the boundingBox
member function with a transformer returns a rectangle that is included
inside the rectangle obtained from calling boundingBox
with a null
(identity) transformer and then applying the
transformer to the result.
Usually, it is enough to verify whether getPosition
member function with a transformer gives the same result as calling it
with a null
(identity) transformer and then applying the
transformer to the result.
public void draw(Graphics dst, IlvTransformer t)
Note that when this method is implemented or overridden, it must always
draw inside the bounding rectangle as returned by the method
boundingBox(ilog.views.IlvTransformer)
for the same value of
the transformer.
dst
- The destination Graphics.t
- The transformation used to draw the pin.protected void draw(Graphics dst, IlvRect rect)
dst
- The destination Graphics. Its current paint has already been
set, to either the normal color of this pin
(getColor()
) or to getSelectedColor()
.rect
- The rectangle where the pin must be drawn/public IlvRect boundingBox(IlvTransformer t)
t
- The transformer used to draw the pin. The value
null
can be used for the identity transformer.draw(java.awt.Graphics, ilog.views.IlvTransformer)
,
zoomable()
public IlvRect getNodeBoundingBox(IlvTransformer t)
getNode().boundingBox(t)
.
For zoomable nodes, it calculates an adjusted bounding box.t
- The transformer used to compute the bounding rectangle of
the node.public final IlvGraphic getNode()
IlvHyperEdgePinConnector.getNode()
called
on the IlvHyperEdgePinConnector
that manages this pin.
The method returns null
for a pin that has been
removed from its IlvHyperEdgePinConnector
.public boolean contains(IlvPoint p, IlvPoint tp, IlvTransformer t)
p
- The point to be tested. This point is untransformed.tp
- The point p
transformed by the
transformer t
.t
- The transformation used to draw the pin.public Color getColor()
public void setColor(Color c)
public Color getSelectedColor()
public void setSelectedColor(Color c)
public void setSelected(boolean selected)
isSelected()
public boolean isSelected()
true
if the pin is selected.setSelected(boolean)
public void setVisible(boolean visible)
isVisible()
public boolean isVisible()
setVisible(boolean)
public void setMovable(boolean movable)
isMovable()
public boolean isMovable()
setMovable(boolean)
public double getSize()
public void setDirection(int direction)
IlvDirection.Left
-
the hyperedge connects to the left side of the pin.
This should be used if the pin is on the left side of the node.IlvDirection.Right
-
the hyperedge connects to the right side of the pin.
This should be used if the pin is on the right side of the node.IlvDirection.Top
-
the hyperedge connects to the top side of the pin.
This should be used if the pin is on the top side of the node.IlvDirection.Bottom
-
the hyperedge connects to the bottom side of the pin.
This should be used if the pin is on the bottom side of the node.IlvDirection.Center
-
the hyperedge connects to the center of the pin.0
-
the hyperedge determines the best connection automatically.IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)
session on the node that has this pin.public int getDirection()
IlvDirection.Left
-
the hyperedge connects to the left side of the pin.
This should be used if the pin is on the left side of the node.IlvDirection.Right
-
the hyperedge connects to the right side of the pin.
This should be used if the pin is on the right side of the node.IlvDirection.Top
-
the hyperedge connects to the top side of the pin.
This should be used if the pin is on the top side of the node.IlvDirection.Bottom
-
the hyperedge connects to the bottom side of the pin.
This should be used if the pin is on the bottom side of the node.IlvDirection.Center
-
the hyperedge connects to the center of the pin.0
-
the hyperedge determines the best connection automatically.public final IlvHyperEdgePinConnector getHyperEdgeConnector()
IlvHyperEdgePinConnector
which manages this
pin, or null
if the pin has been removed.public void setAllowMultiConnection(boolean allow)
public boolean isAllowMultiConnection()
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.