public class IltLabelingModel extends IlvDefaultLabelingModel
IltLabelingModel
provides a default labeling model for an
IltCompositeGrapher
and provides a bridge between the
API of the IltCompositeGrapher
and the API of the
IlvLabelingModel
.Constructor and Description |
---|
IltLabelingModel(IltCompositeGrapher grapher)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
IlvRect |
boundingBox(Object labelOrObstacle)
Returns the bounding rectangle of a label or obstacle.
|
void |
build(IltAnnealingLabelLayout layout) |
IlvLabelingModel |
createLabelingModel(Object subgraph)
Creates a new
IlvDefaultLabelingModel for a subgraph. |
IltCompositeGrapher |
getGrapher()
Returns the
IltCompositeGrapher which this
model applies to. |
Enumeration<ilog.tgo.graphic.graphlayout.labellayout.IltLabel> |
getLabels()
Returns the enumeration of all labels.
|
Enumeration<ilog.tgo.graphic.graphlayout.labellayout.IltObstacle> |
getObstacles()
Returns the enumeration of all obstacles.
|
IlvPoint[] |
getPolylinePoints(Object polylineObstacle)
Returns the points that define the shape of a polyline obstacle.
|
double |
getPolylineWidth(Object polylineObstacle)
Returns the line width of a polyline obstacle.
|
Object |
getProperty(Object labelOrObstacle,
String key)
Returns the value of a property.
|
boolean |
isLabel(Object obj)
Returns
true if an object is a valid label and
false otherwise. |
boolean |
isObstacle(Object obj)
Returns
true if an object is a valid obstacle and
false otherwise. |
boolean |
isPolylineObstacle(Object obj)
Returns
true if an object is a valid polyline obstacle
and false otherwise. |
void |
moveLabel(Object label,
double x,
double y,
boolean redraw)
Changes the position of the specified label.
|
void |
setProperty(Object labelOrObstacle,
String key,
Object value)
Sets the value of a property for a label or an obstacle.
|
void |
updateLabelPosition(IlvAnnealingLabelLayout labelLayout,
IltCompositeGraphic cg) |
addLayer, afterLayout, beforeLayout, dispose, getCoordinatesMode, getLabelOverlap, getLabelOverlap, getLayers, getLayersCount, getManager, getObstacleOverlap, getObstacleOverlap, getPolylineObstacleOverlap, getPolylineObstacleOverlap, getProperty, getReferenceTransformer, getReferenceView, getRotation, isBoundingBoxDependent, isDefaultLabelClass, isDefaultObstacleClass, isFullLayerNotification, isLayerAdded, isLayoutNeeded, loadParametersFromNamedProperties, loadParametersFromNamedProperties, loadParametersFromNamedProperties, removeAllLayers, removeLayer, removeParametersFromNamedProperties, removeParametersFromNamedProperties, removeParametersFromNamedProperties, saveParametersToNamedProperties, saveParametersToNamedProperties, setCoordinatesMode, setFullLayerNotification, setLabel, setObstacle, setProperty, setReferenceTransformer, setReferenceView, setRotation, toString
addLabelingModelListener, adjustmentEnd, afterAttach, afterDetach, fireLabelingModelEvent, fireLabelingModelEvent, geometryChanged, getInstanceId, getLabelsCount, getObstaclesCount, removeLabelingModelListener, structureChanged
public IltLabelingModel(IltCompositeGrapher grapher)
grapher
- The IltCompositeGrapher
public IltCompositeGrapher getGrapher()
IltCompositeGrapher
which this
model applies to.IltCompositeGrapher
public IlvLabelingModel createLabelingModel(Object subgraph)
IlvDefaultLabelingModel
IlvDefaultLabelingModel
for a subgraph. The
method is used when performing a layout of nested graphs that contain
labels. It is called on the labeling model of a top-level graph that
contains the subgraph.createLabelingModel
in class IlvDefaultLabelingModel
subgraph
- The subgraph object. It must be an instance of
IlvManager
.null
public Enumeration<ilog.tgo.graphic.graphlayout.labellayout.IltLabel> getLabels()
IlvDefaultLabelingModel
getLabels
in class IlvDefaultLabelingModel
IlvLabelingModel.getLabelsCount()
public boolean isLabel(Object obj)
IlvDefaultLabelingModel
true
if an object is a valid label and
false
otherwise. It returns true
if the
object was specified as a label via IlvDefaultLabelingModel.setLabel(java.lang.Object, boolean)
, and
false
if the object was explicitly specified not to be a
label. If nothing was specified via IlvDefaultLabelingModel.setLabel(java.lang.Object, boolean)
, this method
also returns true
if the object is an
IlvLabel
, an IlvZoomableLabel
or an
IlvText
.
If layers were selected for layout (see IlvDefaultLabelingModel.addLayer(ilog.views.IlvManagerLayer)
), then it
returns false
if the object is in a layer that is
currently not selected for layout, independent of its type.
If you want to change the default behavior to consider different
classes as labels, you should not override this method but rather
override IlvDefaultLabelingModel.isDefaultLabelClass(java.lang.Object)
.
isLabel
in class IlvDefaultLabelingModel
obj
- The object to test.true
if an object is a valid label.public void moveLabel(Object label, double x, double y, boolean redraw)
IlvDefaultLabelingModel
x
and
y
coordinates correspond to the top-left corner of the
rectangle that defines the label (see also the method IlvDefaultLabelingModel.boundingBox(Object)
). The coordinates are given with respect to the
current coordinates mode.moveLabel
in class IlvDefaultLabelingModel
label
- The label.x
- The new x-position of the label.y
- The new y-position of the label.redraw
- If true
, the label is redrawn.IlvDefaultLabelingModel.setCoordinatesMode(int)
public Enumeration<ilog.tgo.graphic.graphlayout.labellayout.IltObstacle> getObstacles()
IlvDefaultLabelingModel
getObstacles
in class IlvDefaultLabelingModel
IlvLabelingModel.getObstaclesCount()
public boolean isObstacle(Object obj)
IlvDefaultLabelingModel
true
if an object is a valid obstacle and
false
otherwise. It returns true
if the
object was specified as obstacle via IlvDefaultLabelingModel.setObstacle(java.lang.Object, boolean)
, and
false
if the object was explicitly specified to not be
an obstacle. If nothing was specified via IlvDefaultLabelingModel.setObstacle(java.lang.Object, boolean)
, this
method also returns true
if the object is not an
IlvLabel
or an IlvZoomableLabel
or an
IlvText
.
If layers were selected for layout (see IlvDefaultLabelingModel.addLayer(ilog.views.IlvManagerLayer)
), then it
returns false
if the object is in a layer that is
currently not selected for layout, independent of its type.
If you want to change the default behavior to consider different
classes as obstacles, you should not override this method but rather
override IlvDefaultLabelingModel.isDefaultObstacleClass(java.lang.Object)
.
isObstacle
in class IlvDefaultLabelingModel
obj
- The object to test.true
if an object is a valid obstacle.IlvLabelingModel.isPolylineObstacle(java.lang.Object)
public IlvRect boundingBox(Object labelOrObstacle)
IlvDefaultLabelingModel
IlvLabelLayout.MANAGER_COORDINATES
: returns the bounding
box of the graphic object in the coordinate space of the manager,
that is, it calls IlvGraphic.boundingBox(IlvTransformer)
with a null
argument.IlvLabelLayout.VIEW_COORDINATES
: returns the bounding box
of the graphic object in the coordinate space of the view, that is,
it calls IlvGraphic.boundingBox(IlvTransformer)
with the
reference transformer as an argument (see IlvDefaultLabelingModel.getReferenceTransformer()
).IlvLabelLayout.INVERSE_VIEW_COORDINATES
: returns the
bounding box of the graphic object by calculating the bounding box in
the coordinate space of the view and applying to the rectangle the
inverse transformation (using the reference transformer) to obtain
the corresponding rectangle in the coordinate space of the manager.
This complex mechanism is necessary if the object is not fully
zoomable.boundingBox
in class IlvDefaultLabelingModel
labelOrObstacle
- The label or obstacle.public boolean isPolylineObstacle(Object obj)
IlvDefaultLabelingModel
true
if an object is a valid polyline obstacle
and false
otherwise.
The default implementation returns true
if the object is
an obstacle of one of these types:
If layers were selected for layout (see IlvDefaultLabelingModel.addLayer(ilog.views.IlvManagerLayer)
), then it
returns false
if the object is in a layer that is
currently not selected for layout, independent of its type.
isPolylineObstacle
in class IlvDefaultLabelingModel
obj
- The object to test.true
if the object is a polyline obstacle.IlvDefaultLabelingModel.isObstacle(java.lang.Object)
public double getPolylineWidth(Object polylineObstacle)
IlvDefaultLabelingModel
IlvLabelLayout.MANAGER_COORDINATES
: returns the width of
the polyline obstacle in the coordinate space of the manager.IlvLabelLayout.VIEW_COORDINATES
: returns the width of the
polyline obstacle in the coordinate space of the view (see IlvDefaultLabelingModel.getReferenceTransformer()
).IlvLabelLayout.INVERSE_VIEW_COORDINATES
: returns the
width of the polyline obstacle by calculating the width in the
coordinate space of the view and applying the inverse transformation
(using the reference transformer) to obtain the corresponding value
in the coordinate space of the manager. This complex mechanism is
necessary if the obstacle is not fully zoomable.getPolylineWidth
in class IlvDefaultLabelingModel
polylineObstacle
- The polyline obstacle.IlvDefaultLabelingModel.isPolylineObstacle(java.lang.Object)
,
IlvGraphic.zoomable()
public IlvPoint[] getPolylinePoints(Object polylineObstacle)
IlvDefaultLabelingModel
IlvLabelLayout.MANAGER_COORDINATES
: returns the points in
the coordinate space of the manager.IlvLabelLayout.VIEW_COORDINATES
: returns the points in
the coordinate space of the view (see IlvDefaultLabelingModel.getReferenceTransformer()
).IlvLabelLayout.INVERSE_VIEW_COORDINATES
: returns the
points by calculating the points in the coordinate space of the view
and applying the inverse transformation to the points (using the
reference transformer) to obtain the corresponding points in the
coordinate space of the manager. This complex mechanism is necessary
if the obstacle is not fully zoomable.getPolylinePoints
in class IlvDefaultLabelingModel
polylineObstacle
- The polyline obstacle.null
if the points cannot be determined.IlvDefaultLabelingModel.isPolylineObstacle(java.lang.Object)
,
IlvGraphic.zoomable()
public void setProperty(Object labelOrObstacle, String key, Object value)
IlvDefaultLabelingModel
value
is null
, the property is removed.
Otherwise, the property value is set to value
.setProperty
in class IlvDefaultLabelingModel
labelOrObstacle
- The label or obstacle for which the property is
to be set.key
- The key string for the property.value
- The new value of the property.IlvDefaultLabelingModel.getProperty(java.lang.Object, java.lang.String)
public Object getProperty(Object labelOrObstacle, String key)
IlvDefaultLabelingModel
null
if the property does not exist.getProperty
in class IlvDefaultLabelingModel
labelOrObstacle
- The label or obstacle for which the property is
to be retrieved.key
- The key string for the property.IlvDefaultLabelingModel.setProperty(java.lang.Object, java.lang.String, java.lang.Object)
public void build(IltAnnealingLabelLayout layout)
public void updateLabelPosition(IlvAnnealingLabelLayout labelLayout, IltCompositeGraphic cg)
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.