ilog.views.maps.label
Class IlvMapLabelManager

java.lang.Object
  extended by ilog.views.IlvIndexedSet
      extended by ilog.views.IlvManagerLayer
          extended by ilog.views.maps.label.IlvMapLabelManager
All Implemented Interfaces:
IlvPersistentObject, ActionListener, Serializable, EventListener

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.

Since:
JViews 7.5
Version:
1.0
See Also:
Serialized Form

Constructor Summary
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.
 
Method Summary
 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.
 
Methods inherited from class ilog.views.IlvManagerLayer
addVisibilityFilter, computeBBox, drawImpl, getAlpha, getIndex, getManager, getName, getNamedProperty, getProperty, getVisibilityFilters, isSelectable, isTemporarilyHidden, isVisible, isVisible, print, removeNamedProperty, removeVisibilityFilter, setAlpha, setManager, setName, setNamedProperty, setProperty, writeIt
 
Methods inherited from class ilog.views.IlvIndexedSet
addObject, afterUpdate, beforeUpdate, collectObjects, deleteAll, getCardinal, getElements, getIndex, getManagers, getManagersCount, getObject, getObject, getSubsequentRemoveThreshold, isQuadtreeEnabled, map, mapInside, mapInside, mapIntersects, mapIntersects, removeObject, setIndex, setQuadtreeEnabled, setSubsequentRemoveThreshold
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvMapLabelManager

public IlvMapLabelManager(IlvManagerView view,
                          IlvMapLabelFactory labelFactory,
                          int refreshDelay)
The public constructor.

Parameters:
view - The IlvManagerView managed by this IlvMapLabelManager object.
labelFactory - The LabelFactory that returns the labels to be displayed.
refreshDelay - The refresh delay.

IlvMapLabelManager

public IlvMapLabelManager()
Constructs a new IlvMapLabelManager instance.

Since:
JViews 8.0

IlvMapLabelManager

public IlvMapLabelManager(IlvInputStream stream)
                   throws IlvReadFileException
Reads an IlvMapLabelManager from an IlvInputStream.

Parameters:
stream - The stream to read from.
Throws:
IlvReadFileException - if there is a problem reading from stream.
Method Detail

write

public void write(IlvOutputStream stream)
           throws IOException
Writes this IlvMapLabelManager instance to an IlvOutputStream.

Specified by:
write in interface IlvPersistentObject
Overrides:
write in class IlvManagerLayer
Parameters:
stream - The IlvOutputStream to write to.
Throws:
IOException - if there is a problem writing to stream.
See Also:
IlvManagerLayer.write(ilog.views.io.IlvOutputStream)

stop

public void stop()
Stops this label manager. Restarted the label manager by calling the start method.

Since:
JViews 7.5

start

public void start()
Restart a previously stopped label manager.

See Also:
stop()

dispose

public void dispose()
Cleans the resources held by this label manager. After a call to this method, this label manager can not be used anymore.


setRefreshDelay

public void setRefreshDelay(int refreshDelay)
Sets the delay timer for when scrolling has stopped.

Parameters:
refreshDelay - The refresh delay.

forceLabelRefresh

public void forceLabelRefresh()
Forces the label to refresh on the next repaint.


getLabelFactory

public IlvMapLabelFactory getLabelFactory()
Returns the LabelFactory instance used by this IlvMapLabelManager object.

Returns:
The LabelFactory instance used by this IlvMapLabelManager object.

setLabelFactory

public void setLabelFactory(IlvMapLabelFactory factory)
Sets the LabelFactory instance used by this IlvMapLabelManager object.

Parameters:
factory - The LabelFactory instance used by this IlvMapLabelManager object.

actionPerformed

public void actionPerformed(ActionEvent e)
Triggered by the timer to launch label computation.

Specified by:
actionPerformed in interface ActionListener
Parameters:
e - The ActionEvent.

isDisplayLabelsForLayer

public boolean isDisplayLabelsForLayer(IlvMapLayer layer)
Tests if the specified layer index corresponds to a layer displayed by this IlvMapLabelManager instance.

Parameters:
layer - The layer to check.
Returns:
If the layer is displayed by this IlvMapLabelManager instance, true is returned.
Since:
JViews 8.0

setDisplayLabelsForLayer

public void setDisplayLabelsForLayer(IlvMapLayer layer,
                                     boolean set)
Sets if the specified layer should be displayed by this IlvMapLabelManager instance.

Parameters:
layer - The specified layer.
set - to true if the layer should be displayed.

isDisplayLabelsForLayer

public boolean isDisplayLabelsForLayer(int layerIndex)
Deprecated. use isDisplayLabelsForLayer(IlvMapLayer)

Checks if the specified layer index corresponds to a layer displayed by this IlvMapLabelManager instance.

Parameters:
layerIndex - The layer index to check.
Returns:
If the layer is displayed by this IlvMapLabelManager instance, true is returned.

addForbiddenArea

public void addForbiddenArea(Rectangle2D area)
Adds a screen area where labels should not be placed. The manager will try to place them somewhere else.

Parameters:
area - A Rectangle2D instance of SCREEN coordinates.

clearForbiddenAreas

public void clearForbiddenAreas()
Removes all forbidden areas for labeling.


setAllowLabelPointOverlap

public void setAllowLabelPointOverlap(boolean allow)
Sets the flag to prevent labels from covering point features.

Parameters:
allow - Set to true to allow overlap.

isAllowLabelPointOverlap

public boolean isAllowLabelPointOverlap()
Returns the flag to prevent labels from covering point features.

Returns:
If overlap is allowed, true is returned.

setForceLabelAntialiasing

public void setForceLabelAntialiasing(boolean force)
Sets the flag to force text anti-aliasing.

Parameters:
force - Set to true to allow anti-aliasing.

isForceLabelAntialiasing

public boolean isForceLabelAntialiasing()
Returns the flag for forced text antialiasing.

Returns:
If antialiasing is set, true is returned.

setTripleBufferedLabels

public void setTripleBufferedLabels(boolean tripleBuffer)
Sets the flag for label triple buffering. The default value is true.

Parameters:
tripleBuffer - Set to true to enable triple buffering.

isTripleBufferedLabels

public boolean isTripleBufferedLabels()
Returns the flag for label triple buffering.

Returns:
If triple buffering is enabled, true is returned.

flushTripleBuffer

public void flushTripleBuffer()
Frees resources allocated by the triple buffer.


draw

protected void draw(Graphics dst,
                    IlvManagerView view)
Draws the specified layer in a manager view.

Overrides:
draw in class IlvManagerLayer
Parameters:
dst - The Graphics to draw.
view - The manager view.
See Also:
IlvManagerView.setLayerCached(int, boolean)

paintLabels

public void paintLabels(IlvManagerView view,
                        Graphics dst)
Paints labels on the IlvManagerView.

Parameters:
view - The view to draw.
dst - The Graphics to draw.

isSynchronous

public boolean isSynchronous()
Tests if the labeling is be done in a separate thread or in the current thread.

Returns:
If the labeling is performed in the current thread, true is returned.
Since:
JViews 8.0

setSynchronous

public void setSynchronous(boolean synchronous)
Sets the synchronous flag for this label manager. If the flag is set to true, the labeling will be done synchronously. If set to false, the labeling will be done in a separate thread.

Parameters:
synchronous - Set to true to perform synchronous labeling.
Since:
JViews 8.0


Copyright © 1996-2007 ILOG S.A. All rights reserved.   Documentation homepage.   . All Rights Reserved.