ilog.views.maps.rendering
Class IlvDefaultTextRenderer

java.lang.Object
  extended by ilog.views.maps.rendering.IlvDefaultTextRenderer
All Implemented Interfaces:
IlvPersistentObject, IlvFeatureRenderer
Direct Known Subclasses:
IlvMapTextRenderer

public class IlvDefaultTextRenderer
extends Object
implements IlvFeatureRenderer

This renderer translates a map feature whose geometry is an IlvMapText into an IlvGraphic label.
The IlvGraphic produced can be an IlvLabel, an IlvZoomableLabel or an IlvMapLabel depending on the class specified by the setLabelClass method. The attributes of the generated label are specified using an IlvMapTextRenderingStyle.

Since:
ILOG JViews 3.0
See Also:
IlvMapText, IlvLabel, IlvZoomableLabel, IlvMapLabel

Constructor Summary
IlvDefaultTextRenderer()
          Creates an instance of a text renderer.
IlvDefaultTextRenderer(IlvInputStream stream)
          Reads a text renderer from an IlvInputStream.
 
Method Summary
protected  IlvGraphic createText(Class klass, Object anchor, String string, IlvMapTextRenderingStyle style)
          Creates a text of a non predefined class.
 Class getLabelClass()
          Retrieves the class of the generated label.
 IlvMapTextRenderingStyle getTextRenderingStyle()
          Retrieves the text rendering style.
 boolean isPersistent()
          Returns true.
 IlvGraphic makeGraphic(IlvMapFeature feature, IlvCoordinateTransformation transformation)
          Translates the map feature into a graphic object.
 void setLabelClass(Class cls)
          Sets the class of the generated label.
 void setTextRenderingStyle(IlvMapTextRenderingStyle style)
          Sets the text style for the labels.
 void write(IlvOutputStream stream)
          Writes the renderer to an IlvOutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IlvDefaultTextRenderer

public IlvDefaultTextRenderer()
Creates an instance of a text renderer.


IlvDefaultTextRenderer

public IlvDefaultTextRenderer(IlvInputStream stream)
                       throws IlvReadFileException
Reads a text renderer from an IlvInputStream.

Throws:
IlvReadFileException
Method Detail

makeGraphic

public IlvGraphic makeGraphic(IlvMapFeature feature,
                              IlvCoordinateTransformation transformation)
                       throws IlvMapRenderException,
                              IlvCoordinateTransformationException
Translates the map feature into a graphic object. Depending on the class specified by the setLabelClass method, the IlvGraphic produced can be an IlvLabel, an IlvZoomableLabel, or an IlvMapLabel. Note that this method has been changed since ILOG JViews 5.0. The old method was draw(IlvMapFeature, IlvProjection). In case you have overridden the old draw method, you have to rewrite your method in order to migrate to JViews 5.0.

Specified by:
makeGraphic in interface IlvFeatureRenderer
Parameters:
feature - The map feature to translate.
transformation - The transformation. This parameter should never be null.
Throws:
IlvMapRenderException - If the renderer cannot process the map feature.
IlvCoordinateTransformationException - If a transformation exception occurs.
Since:
JViews 5.0

createText

protected IlvGraphic createText(Class klass,
                                Object anchor,
                                String string,
                                IlvMapTextRenderingStyle style)
                         throws IlvMapRenderException
Creates a text of a non predefined class. The class is passed as parameter which should have been set by the setLabelClass method. The default implementation of the method throws an IlvMapRenderException

Parameters:
klass - The class of the label.
anchor - The anchor of the label. Can be an IlvPoint or an IlvRect
string - The string to display on the label.
style - The IlvMapTextRenderingStyle specifying rendering parameters to be applied to the resulting IlvGraphic
Returns:
The resulting IlvGraphic representing the test object.
Throws:
IlvMapRenderException
Since:
JViews 7.5

setTextRenderingStyle

public void setTextRenderingStyle(IlvMapTextRenderingStyle style)
Sets the text style for the labels.

Parameters:
style - The text rendering style.
Since:
JViews 5.0

getTextRenderingStyle

public IlvMapTextRenderingStyle getTextRenderingStyle()
Retrieves the text rendering style.

Since:
JViews 5.0

getLabelClass

public Class getLabelClass()
Retrieves the class of the generated label. The classes handled by the renderer are either an IlvLabel, an IlvZoomableLabel, or an IlvMapLabel.

Since:
JViews 5.0

setLabelClass

public void setLabelClass(Class cls)
Sets the class of the generated label. The classes handled by the renderer are either an IlvLabel, an IlvZoomableLabel, or an IlvMapLabel.

Since:
JViews 5.0

write

public void write(IlvOutputStream stream)
           throws IOException
Writes the renderer to an IlvOutputStream.

Specified by:
write in interface IlvPersistentObject
Specified by:
write in interface IlvFeatureRenderer
Parameters:
stream - the output stream
Throws:
IOException - thrown when an exception occurs during the write operation for this object.

isPersistent

public boolean isPersistent()
Returns true.

Specified by:
isPersistent in interface IlvFeatureRenderer


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