public class IlvMapStyleController extends Object implements IlvPersistentObject, TransformerListener
IlvMapStyleController
is used to manage the association of a
set of IlvMapStyle
and IlvMapLayer
objects.
Each style is used for a specific layer with a given scale range. This
class also provides a TransformerListener
that can affect
the style in an IlvMapLayer
corresponding to a given scale.
For that listener to correctly update the theme, you need to make sure a view is attached to the controller through setView(IlvManagerView)
Constructor and Description |
---|
IlvMapStyleController()
Creates an empty style controller.
|
IlvMapStyleController(IlvInputStream stream)
Reads an
IlvMapStyleController object from an
IlvInputStream . |
Modifier and Type | Method and Description |
---|---|
void |
addDynamicStyleListener(DynamicStyleListener listener)
Adds a theme listener.
|
void |
addTheme(double scale,
IlvMapLayer layer,
String name)
Adds an
IlvMapStyle /IlvMapLayer association that
is controlled by a scale. |
void |
addTheme(IlvMapLayer layer,
IlvMapDynamicStyle theme)
Adds an
IlvMapStyle /IlvMapLayer association that
is controlled by a scale. |
static String |
formatScale(String prefix,
double unsurscale)
Formats the scale.
|
IlvMapStyle |
getStyle(IlvMapLayer layer,
double scale)
Retrieves the style registered for the given layer that matches a given
scale.
|
IlvMapDynamicStyle |
getTheme(IlvMapLayer layer,
double scale)
Retrieves the
IlvMapDynamicStyle object registered for a
given layer that matches a specific scale. |
IlvMapDynamicStyle[] |
getThemes(IlvMapLayer layer)
Returns the array of
IlvMapDynamicStyle objects associated
with a given layer. |
IlvManagerView |
getView()
Retrieves the view associated with this
IlvMapStyleController . |
void |
removeDynamicStyleListener(DynamicStyleListener listener)
Removes a theme listener.
|
void |
removeTheme(IlvMapLayer layer,
IlvMapDynamicStyle style)
Removes a given style from the controller.
|
void |
setThemes(IlvMapLayer layer,
IlvMapDynamicStyle[] themesArray)
Sets the dynamic styles for a given layer.
|
void |
setView(IlvManagerView view)
Sets a view to this
IlvMapStyleController object. |
String |
toString()
Returns a string representation of this object.
|
void |
transformerChanged(TransformerChangedEvent event)
Implements
TransformerListener . |
void |
updateCurrentTheme()
This method is called by the transformer listener.
|
void |
updateTheme(IlvManagerView v,
IlvMapLayer l)
Sets the layer style for the current scale of a view.
|
void |
write(IlvOutputStream stream)
Writes the attributes of a persistent object.
|
public IlvMapStyleController()
public IlvMapStyleController(IlvInputStream stream) throws IlvReadFileException
IlvMapStyleController
object from an
IlvInputStream
.stream
- The stream to read from.IlvReadFileException
- if there is a problem reading from
stream
.public String toString()
public static String formatScale(String prefix, double unsurscale)
prefix
- This parameter is usually "1/".unsurscale
- The scale.public void write(IlvOutputStream stream) throws IOException
write
in interface IlvPersistentObject
stream
- the output streamIOException
- thrown when an exception occurs during
the write operation for this object.IlvPersistentObject.write(ilog.views.io.IlvOutputStream)
public void addTheme(IlvMapLayer layer, IlvMapDynamicStyle theme)
IlvMapStyle
/IlvMapLayer
association that
is controlled by a scale.layer
- The layer on which the style will be applied with regard to the scale.theme
- A dynamic style attached to the layer.public void setThemes(IlvMapLayer layer, IlvMapDynamicStyle[] themesArray)
layer
- The layer on which the style will be applied with regard to
the scale.themesArray
- A dynamic style array attached to the layer.public void addTheme(double scale, IlvMapLayer layer, String name)
IlvMapStyle
/IlvMapLayer
association that
is controlled by a scale.scale
- The scale to add a theme to.layer
- The layer on which the style will be applied with regard to
the scale.name
- The name of the style;public void removeTheme(IlvMapLayer layer, IlvMapDynamicStyle style)
layer
- The IlvMapLayer
object.style
- The style to be removed.public void addDynamicStyleListener(DynamicStyleListener listener)
listener
- The theme listener to add.public void removeDynamicStyleListener(DynamicStyleListener listener)
listener
- The theme listener to remove.public IlvManagerView getView()
IlvMapStyleController
.public void setView(IlvManagerView view)
IlvMapStyleController
object.
A TransformerListener
is added to the view to activate the
registered IlvMapDynamicStyle
when the scale changes.view
- The view to associate.public IlvMapDynamicStyle[] getThemes(IlvMapLayer layer)
IlvMapDynamicStyle
objects associated
with a given layer.layer
- The layer which the styles are associated with.public IlvMapDynamicStyle getTheme(IlvMapLayer layer, double scale)
IlvMapDynamicStyle
object registered for a
given layer that matches a specific scale.layer
- The layer to retrieve the style for.scale
- The scale to retrieve the style for.scale
.public IlvMapStyle getStyle(IlvMapLayer layer, double scale)
layer
- The layer to check for registered styles.scale
- The scale to match.layer
at scale
.public void transformerChanged(TransformerChangedEvent event)
TransformerListener
.transformerChanged
in interface TransformerListener
event
- The TransformerChangedEvent
event.public void updateCurrentTheme()
public void updateTheme(IlvManagerView v, IlvMapLayer l)
v
- The view to retrieve the scale from.l
- The layer whose style will be changed.© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.