public class IlvDefaultGrapherPin extends IlvGrapherPin
IlvGrapherPin
. It provides the following features:
setPosition(ilog.views.IlvPoint, ilog.views.IlvTransformer)
, will be preserved
for any change of the bounding box of the node. If the node is translated,
the location of the pin is translated with the same distance.
If the node grows or shrinks, the location of the pin moves proportionally.
setPosition(ilog.views.IlvPoint, ilog.views.IlvTransformer)
) or in proportion
to the bounding rectangle of the node. If the location is specified
as absolute coordinates, the coordinates are internally
translated into proportional coordinates.
IlvGrapherPinInteractor
.
The pins are managed by the class IlvPinLinkConnector
.
This pin class is persistent, that is, IlvDefaultGrapherPin
pins
are saved into IVL when saving an IlvGrapher
. Therefore, subclasses
must be public
and must implement the constructor with
IlvInputStream
. Otherwise, the subclass must override
the method isPersistent()
to return false
.
IlvPinLinkConnector
,
Serialized FormConstructor and Description |
---|
IlvDefaultGrapherPin(IlvInputStream stream)
Reads the object from an
IlvInputStream . |
IlvDefaultGrapherPin(IlvPinLinkConnector connector,
IlvPoint proportionalLocation)
Creates a new
IlvDefaultGrapherPin at a specified
proportional location and adds it to the pin link connector. |
IlvDefaultGrapherPin(IlvPinLinkConnector connector,
IlvPoint p,
IlvTransformer t)
Creates a new
IlvDefaultGrapherPin at a specified
absolution location and adds it to the pin link connector. |
Modifier and Type | Method and Description |
---|---|
boolean |
allowsMove()
Overridden implementation of the method from the superclass
to always return
true . |
protected IlvRect |
getNodeBoundingBox(IlvTransformer t)
Called by the
IlvDefaultGrapherPin
when it needs to compute the bounding rectangle of the node. |
IlvPoint |
getPosition(IlvTransformer transformer)
Returns the position of the pin.
|
IlvPoint |
getProportionalPosition()
Returns the proportional position of the pin.
|
boolean |
isPersistent()
Indicates whether the grapher pin must be saved to an IVL file.
|
void |
setPosition(IlvPoint p,
IlvTransformer t)
Sets the absolute position of the pin.
|
void |
setProportionalPosition(IlvPoint proportionalLocation)
Sets the proportional location of the pin.
|
void |
write(IlvOutputStream stream)
Writes the object to an
IlvOutputStream . |
allow, drawGhost, getColor, getNode, getPinLinkConnector, getSize, getType, isConnected, zoomable
public IlvDefaultGrapherPin(IlvPinLinkConnector connector, IlvPoint p, IlvTransformer t)
IlvDefaultGrapherPin
at a specified
absolution location and adds it to the pin link connector.
This constructor stores the location using the method
setPosition(ilog.views.IlvPoint, ilog.views.IlvTransformer)
.connector
- The link connector where the pin is added.p
- The point where the pin must be located, in absolute
coordinates. The point
must be transformed by transformer t
.t
- The transformer that is used to draw the node associated with the
pin link connector.public IlvDefaultGrapherPin(IlvPinLinkConnector connector, IlvPoint proportionalLocation)
IlvDefaultGrapherPin
at a specified
proportional location and adds it to the pin link connector.
This constructor stores the location using the method
setProportionalPosition(ilog.views.IlvPoint)
.
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)
.
connector
- The link connector where the pin is added.proportionalLocation
- The proportional location of the pin.public IlvDefaultGrapherPin(IlvInputStream stream) throws IlvReadFileException
IlvInputStream
.
The default implementation of the method does nothing.
Note that a subclass that overrides the method isPersistent()
to return true
must be public and must provide a constructor
with an IlvInputStream
argument. The first line of the
constructor must be super(stream)
.
stream
- The input stream.IlvReadFileException
- if the format is not correct.write(ilog.views.io.IlvOutputStream)
,
isPersistent()
public void write(IlvOutputStream stream) throws IOException
IlvOutputStream
.
The default implementation of the method does nothing.
You should not
call this method directly; instead, you should use the write
methods of the IlvGrapher
that contains the node
to which the link connector is attached.
write
in interface IlvPersistentObject
write
in class IlvGrapherPin
stream
- The output stream.IOException
- thrown when an exception occurs during
the write operation for this object.public boolean isPersistent()
true
, the grapher pin
is saved; otherwise it is not saved.
This overridden implementation always returns true
.
isPersistent
in class IlvGrapherPin
write(ilog.views.io.IlvOutputStream)
protected IlvRect getNodeBoundingBox(IlvTransformer t)
IlvDefaultGrapherPin
when it needs to compute the bounding rectangle of the node. By default,
it returns getNode().boundingBox(t)
. You can
override this method to return a different bounding rectangle. This is
useful, in particular, if you use a link layout algorithm and you
specified an IlvNodeBoxInterface
.t
- The transformer used to compute the bounding rectangle of
the node.public void setPosition(IlvPoint p, IlvTransformer t)
IlvPinLinkConnector
.
Note that changing the position of a pin can change the bounding
box of the links attached to the pin. Therefore, the method
IlvManager.applyToObject(ilog.views.IlvGraphic, ilog.views.IlvApplyObject, java.lang.Object, boolean)
must be used for the node
returned by the method IlvGrapherPin.getNode()
.
setPosition
in class IlvGrapherPin
p
- The point where the pin must be located. The point
must be transformed by transformer t
.t
- The transformer that is used to draw the node associated with the
pin link connector.IlvGrapherPin.getPosition(ilog.views.IlvTransformer)
,
IlvGrapherPin.allowsMove()
public IlvPoint getPosition(IlvTransformer transformer)
getPosition
in class IlvGrapherPin
transformer
- The transformer used to draw the node.IlvGrapherPin.setPosition(ilog.views.IlvPoint, ilog.views.IlvTransformer)
public void setProportionalPosition(IlvPoint proportionalLocation)
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)
.
proportionalLocation
- The proportional location of the pin.public IlvPoint getProportionalPosition()
public boolean allowsMove()
true
. This indicates that the
location of the pin can be changed using the method
setPosition(ilog.views.IlvPoint, ilog.views.IlvTransformer)
.allowsMove
in class IlvGrapherPin
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.