public class IlvDefaultTextRenderer extends Object implements IlvFeatureRenderer
IlvMapText
into an IlvGraphic
label. 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
.IlvMapText
,
IlvLabel
,
IlvZoomableLabel
,
IlvMapLabel
,
Serialized FormConstructor and Description |
---|
IlvDefaultTextRenderer()
Creates an instance of a text renderer.
|
IlvDefaultTextRenderer(IlvInputStream stream)
Reads a text renderer from an
IlvInputStream . |
Modifier and Type | Method and Description |
---|---|
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 . |
public IlvDefaultTextRenderer()
public IlvDefaultTextRenderer(IlvInputStream stream) throws IlvReadFileException
IlvInputStream
.IlvReadFileException
public IlvGraphic makeGraphic(IlvMapFeature feature, IlvCoordinateTransformation transformation) throws IlvMapRenderException, IlvCoordinateTransformationException
setLabelClass
method, the IlvGraphic
produced can be an IlvLabel
,
an IlvZoomableLabel
, or an IlvMapLabel
.
Note that this method has been changed since Perforce 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.makeGraphic
in interface IlvFeatureRenderer
feature
- The map feature to translate.transformation
- The transformation. This parameter should never
be null
.IlvMapRenderException
- If the renderer cannot process
the map feature.IlvCoordinateTransformationException
- If a transformation
exception occurs.protected IlvGraphic createText(Class<?> klass, Object anchor, String string, IlvMapTextRenderingStyle style) throws IlvMapRenderException
setLabelClass
method.
The default implementation of the method throws an IlvMapRenderException
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
IlvGraphic
representing the test object.IlvMapRenderException
public void setTextRenderingStyle(IlvMapTextRenderingStyle style)
style
- The text rendering style.public IlvMapTextRenderingStyle getTextRenderingStyle()
public Class<?> getLabelClass()
IlvLabel
,
an IlvZoomableLabel
, or an IlvMapLabel
.public void setLabelClass(Class<?> cls)
IlvLabel
,
an IlvZoomableLabel
, or an IlvMapLabel
.public void write(IlvOutputStream stream) throws IOException
IlvOutputStream
.write
in interface IlvPersistentObject
write
in interface IlvFeatureRenderer
stream
- the output streamIOException
- thrown when an exception occurs during
the write operation for this object.public boolean isPersistent()
true
.isPersistent
in interface IlvFeatureRenderer
© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.