public class IlvMapLabelManager extends IlvManagerLayer implements ActionListener
IlvMapLabelManager
manages the display of labels for a specific
IlvManagerView
object. The paintLabels()
method
checks whether labels need to be updated, and fires a timer. This timer is
reset while the view is being repainted. Once the timer expires, the
computation of label gathering and placement is done in a separate process to
avoid blocking the Swing Thread
.Constructor and Description |
---|
IlvMapLabelManager()
Constructs a new
IlvMapLabelManager instance. |
IlvMapLabelManager(IlvInputStream stream)
Reads an
IlvMapLabelManager from an
IlvInputStream . |
IlvMapLabelManager(IlvManagerView view,
IlvMapLabelFactory labelFactory,
int refreshDelay)
The public constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
actionPerformed(ActionEvent e)
Triggered by the timer to launch label computation.
|
void |
addForbiddenArea(Rectangle2D area)
Adds a screen area where labels should not be placed.
|
void |
clearForbiddenAreas()
Removes all forbidden areas for labeling.
|
void |
dispose()
Cleans the resources held by this label manager.
|
protected void |
draw(Graphics dst,
IlvManagerView view)
Draws the specified layer in a manager view.
|
void |
flushTripleBuffer()
Frees resources allocated by the triple buffer.
|
void |
forceLabelRefresh()
Forces the label to refresh on the next repaint.
|
IlvMapLabelFactory |
getLabelFactory()
Returns the
LabelFactory instance used by this
IlvMapLabelManager object. |
boolean |
isAllowLabelPointOverlap()
Returns the flag to prevent labels from covering point features.
|
boolean |
isDisplayLabelsForLayer(IlvMapLayer layer)
Tests if the specified layer index corresponds to a layer displayed by
this
IlvMapLabelManager instance. |
boolean |
isDisplayLabelsForLayer(int layerIndex)
Deprecated.
use isDisplayLabelsForLayer(IlvMapLayer)
|
boolean |
isForceLabelAntialiasing()
Returns the flag for forced text antialiasing.
|
boolean |
isSynchronous()
Tests if the labeling is be done in a separate thread or in the current
thread.
|
boolean |
isTripleBufferedLabels()
Returns the flag for label triple buffering.
|
void |
paintLabels(IlvManagerView view,
Graphics dst)
Paints labels on the
IlvManagerView . |
void |
setAllowLabelPointOverlap(boolean allow)
Sets the flag to prevent labels from covering point features.
|
void |
setDisplayLabelsForLayer(IlvMapLayer layer,
boolean set)
Sets if the specified layer should be displayed by this
IlvMapLabelManager instance. |
void |
setForceLabelAntialiasing(boolean force)
Sets the flag to force text anti-aliasing.
|
void |
setLabelFactory(IlvMapLabelFactory factory)
Sets the
LabelFactory instance used by this
IlvMapLabelManager object. |
void |
setRefreshDelay(int refreshDelay)
Sets the delay timer for when scrolling has stopped.
|
void |
setSynchronous(boolean synchronous)
Sets the synchronous flag for this label manager.
|
void |
setTripleBufferedLabels(boolean tripleBuffer)
Sets the flag for label triple buffering.
|
void |
start()
Restart a previously stopped label manager.
|
void |
stop()
Stops this label manager.
|
void |
write(IlvOutputStream stream)
Writes this
IlvMapLabelManager instance to an
IlvOutputStream . |
addVisibilityFilter, computeBBox, drawImpl, getAlpha, getIndex, getManager, getName, getNamedProperty, getProperty, getVisibilityFilters, isSelectable, isTemporarilyHidden, isVisible, isVisible, print, removeNamedProperty, removeVisibilityFilter, setAlpha, setManager, setName, setNamedProperty, setProperty, writeIt
addObject, afterUpdate, beforeUpdate, collectObjects, collectSelectableObjects, deleteAll, getCardinal, getElements, getIndex, getManagers, getManagersCount, getObject, getObject, getSelectableObject, getSubsequentRemoveThreshold, isQuadtreeEnabled, isZOrdering, map, mapInside, mapInside, mapIntersects, mapIntersects, removeObject, setIndex, SetInitialNumberOfNonZoomablesCapacity, SetInitialNumberOfObjectsCapacity, setQuadtreeEnabled, setSubsequentRemoveThreshold, setZOrdering
public IlvMapLabelManager(IlvManagerView view, IlvMapLabelFactory labelFactory, int refreshDelay)
view
- The IlvManagerView
managed by this IlvMapLabelManager
object.labelFactory
- The LabelFactory
that returns the labels to be displayed.refreshDelay
- The refresh delay.public IlvMapLabelManager()
IlvMapLabelManager
instance.public IlvMapLabelManager(IlvInputStream stream) throws IlvReadFileException
IlvMapLabelManager
from an
IlvInputStream
.stream
- The stream to read from.IlvReadFileException
- if there is a problem reading from
stream
.public void write(IlvOutputStream stream) throws IOException
IlvMapLabelManager
instance to an
IlvOutputStream
.write
in interface IlvPersistentObject
write
in class IlvManagerLayer
stream
- The IlvOutputStream
to write to.IOException
- if there is a problem writing to
stream
.IlvManagerLayer.write(ilog.views.io.IlvOutputStream)
public void stop()
start
method.public void start()
stop()
public void dispose()
public void setRefreshDelay(int refreshDelay)
refreshDelay
- The refresh delay.public void forceLabelRefresh()
public IlvMapLabelFactory getLabelFactory()
LabelFactory
instance used by this
IlvMapLabelManager
object.LabelFactory
instance used by this
IlvMapLabelManager
object.public void setLabelFactory(IlvMapLabelFactory factory)
LabelFactory
instance used by this
IlvMapLabelManager
object.factory
- The LabelFactory
instance used by this
IlvMapLabelManager
object.public void actionPerformed(ActionEvent e)
actionPerformed
in interface ActionListener
e
- The ActionEvent
.public boolean isDisplayLabelsForLayer(IlvMapLayer layer)
IlvMapLabelManager
instance.layer
- The layer to check.IlvMapLabelManager
instance, true
is returned.public void setDisplayLabelsForLayer(IlvMapLayer layer, boolean set)
IlvMapLabelManager
instance.layer
- The specified layer.set
- to
true
if the layer should be displayed.@Deprecated public boolean isDisplayLabelsForLayer(int layerIndex)
IlvMapLabelManager
instance.layerIndex
- The layer index to check.IlvMapLabelManager
instance, true
is returned.public void addForbiddenArea(Rectangle2D area)
area
- A Rectangle2D
instance of SCREEN coordinates.public void clearForbiddenAreas()
public void setAllowLabelPointOverlap(boolean allow)
allow
- Set to true
to allow overlap.public boolean isAllowLabelPointOverlap()
true
is returned.public void setForceLabelAntialiasing(boolean force)
force
- Set to true
to allow anti-aliasing.public boolean isForceLabelAntialiasing()
true
is returned.public void setTripleBufferedLabels(boolean tripleBuffer)
true
.tripleBuffer
- Set to true
to enable triple buffering.public boolean isTripleBufferedLabels()
true
is returned.public void flushTripleBuffer()
protected void draw(Graphics dst, IlvManagerView view)
draw
in class IlvManagerLayer
dst
- The Graphics
to draw.view
- The manager view.IlvManagerView.setLayerCached(int, boolean)
public void paintLabels(IlvManagerView view, Graphics dst)
IlvManagerView
.view
- The view to draw.dst
- The Graphics
to draw.public boolean isSynchronous()
true
is returned.public void setSynchronous(boolean synchronous)
true
, the labeling will be done synchronously. If set to
false
, the labeling will be done in a separate thread.synchronous
- Set to
true
to perform synchronous labeling.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.