public class IlvMapCSSRenderer extends IlvDefaultFeatureRenderer implements IlvStylable
IlvGraphic.
The renderers to customize must use setters and getters conform to the
JavaBean specification style.IlvMapCSSRenderer is constructed with a type
argument which indicates the type entry in the CSS file for which the
renderer will take its customization parameters.
airports {
markerColor : red;
markerSize : 10;
markerType : "Cross|Circle";
}
If the renderer was constructed with airports as type, it will
take the markerColor, markerSize, markerType as
customization parameters.null renderer is specified at construction time,
it will be customized and used to produce the IlvGraphic.null renderer is passed, the CSS file can contain the
class of the renderer to be used for a given type by using a special
class key:
cities {
class : "ilog.views.maps.labelling.IlvLabeledPointRenderer";
attributeNames : NAME,txt;
rejectedValues : UNK;
pointRenderingStyle : @=citiesPoint;
textRenderingStyle : @=citiesLabel;
}
In this case, the cities theme will be rendered by an
IlvLabeledPointRenderer, whose customization parameters
are attributeNames, rejectedValues ... citiesPoint,
and citiesLabel are nodes defined elsewhere in the CSS.null renderer is passed and no renderer is defined in
the CSS file, then the IlvMapCSSRenderer will act as an
IlvDefaultFeatureRenderer.
Attributes can also be part of the selector. You can either check the
existence of an attribute, or check the value of attribute. Obviously,
this behavior is possible only if the IlvMapFeature
contains attributes.
roads[FEATURE~="Principal"] {
attributes : @=principalRoadsAttributes;
}
If the FEATURE attribute contains the string "principal", the node will
be matched.
.IlvMapPolygon {
usingGeneralPath : true;
}
All the geometries of class IlvMapPolygon will be rendered
with a general path.APPLIED_RULE_MASK, BAD_CLASS_MASK, BAD_PROP_MASK, BAD_PROP_WITH_STACK_MASK, CREATED_MASK, DECL_MASK, DECL_VALUE_MASK, FAILED_CONVERSIONS_MASK, TIME_REPORT_MASK, WARNING_PROP_MASK| Constructor and Description |
|---|
IlvMapCSSRenderer(IlvFeatureRenderer renderer,
String type,
String[] styleSheets)
Constructs an
IlvMapCSSRenderer. |
IlvMapCSSRenderer(IlvInputStream stream)
Constructs an
IlvMapCSSRenderer from an
IlvInputStream. |
| Modifier and Type | Method and Description |
|---|---|
void |
addPropertyChangeListener(PropertyChangeListener listener)
Adds the specified listener to receive
PropertyChangeEvents
from this CSS manager. |
protected IlvGraphic |
dispatch(IlvMapFeature feature,
IlvCoordinateTransformation tr)
Makes an
IlvGraphic from a map feature. |
String |
getBaseTextDirection()
Returns textual notation of the given base text direction
|
IlvFeatureRenderer |
getCustomizedRenderer(IlvMapFeature feature)
Returns the customized renderer for an
IlvMapFeature instance. |
String |
getStyleSheet()
Returns the value of the
styleSheet property. |
int |
getStyleSheetDebugMask()
Returns the current debug level.
|
String[] |
getStyleSheets()
Returns the cascaded style sheets.
|
String |
getStyleSheets(int index)
Returns one of the cascaded style sheets.
|
boolean |
isPersistent()
Returns
true if the object must be saved. |
IlvGraphic |
makeGraphic(IlvMapFeature feature,
IlvCoordinateTransformation tr)
Makes an
IlvGraphic from a map feature. |
protected IlvGraphic |
makeGraphicFromCollection(IlvMapFeature feature,
IlvCoordinateTransformation tr)
Makes an
IlvGraphic from a map feature which contains a
collection of geometries. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Removes the specified listener so that it no longer receives
PropertyChangeEvents from this CSS manager. |
void |
setBaseTextDirection(String textDirectionName)
Changes the base direction of the text.
|
void |
setStyleSheet(String styleSheet)
Sets the value of the
styleSheet property. |
void |
setStyleSheetDebugMask(int mask)
Sets the debug flag while parsing the style sheets.
|
void |
setStyleSheets(int index,
String css)
Changes one of the cascading style sheets.
|
void |
setStyleSheets(String[] css)
Sets the cascading style sheets.
|
void |
write(IlvOutputStream stream)
Writes the renderer to an
IlvOutputStream. |
getAreaRenderer, getCurveRenderer, getImageRenderer, getMultiPointRenderer, getPointRenderer, getRasterRenderer, getTextRenderer, setAreaRenderer, setCurveRenderer, setImageRenderer, setMultiPointRenderer, setPointRenderer, setRasterRenderer, setTextRendererpublic IlvMapCSSRenderer(IlvFeatureRenderer renderer, String type, String[] styleSheets) throws FileNotFoundException, IOException, IlvStylingException
IlvMapCSSRenderer.renderer - The renderer to customize, or null.type - The type part of the selector.styleSheets - The style sheets.FileNotFoundExceptionIOExceptionIlvStylingExceptionpublic IlvMapCSSRenderer(IlvInputStream stream) throws IlvReadFileException, FileNotFoundException, IOException, IlvStylingException
IlvMapCSSRenderer from an
IlvInputStream.stream - The IlvInputStream to read from.IlvReadFileExceptionFileNotFoundExceptionIOExceptionIlvStylingExceptionpublic void write(IlvOutputStream stream) throws IOException
IlvOutputStream.write in interface IlvPersistentObjectwrite in interface IlvFeatureRendererwrite in class IlvDefaultFeatureRendererstream - The IlvOutputStream to write to.IOException - thrown when an exception occurs during
the write operation for this object.protected IlvGraphic dispatch(IlvMapFeature feature, IlvCoordinateTransformation tr) throws IlvCoordinateTransformationException, IlvMapRenderException
IlvGraphic from a map feature.
The renderer used to produce the IlvGraphic depends on
the parameters passed at construction time (the style sheets, and so on).
See general description for details.
If no renderer has been specified, and no renderer has been defined in
the CSS file, the IlvMapCSSRenderer acts as an
IlvDefaultFeatureRenderer:
This method dispatches calls to a specialized feature renderer depending
on the geometry of the map feature. Each specialized feature renderer is
initialized with a default value, but it can be changed. The specialized
renderer is customized using the CSS file.dispatch in class IlvDefaultFeatureRendererfeature - The map feature to translate.tr - The destination Coordinate System of the map feature.IlvMapRenderException - If the renderer cannot process
the map feature.IlvCoordinateTransformationException - If an error occurs during
the coordinate transformation.IlvDefaultFeatureRenderer.setImageRenderer(ilog.views.maps.IlvFeatureRenderer),
IlvDefaultFeatureRenderer.setAreaRenderer(ilog.views.maps.IlvFeatureRenderer),
IlvDefaultFeatureRenderer.setCurveRenderer(ilog.views.maps.IlvFeatureRenderer),
IlvDefaultFeatureRenderer.setMultiPointRenderer(ilog.views.maps.IlvFeatureRenderer),
IlvDefaultFeatureRenderer.setPointRenderer(ilog.views.maps.IlvFeatureRenderer),
IlvDefaultFeatureRenderer.setRasterRenderer(ilog.views.maps.IlvFeatureRenderer),
IlvDefaultFeatureRenderer.setTextRenderer(ilog.views.maps.IlvFeatureRenderer)public IlvFeatureRenderer getCustomizedRenderer(IlvMapFeature feature) throws IlvMapRenderException
IlvMapFeature instance.feature - The map feature.IlvMapRenderExceptionprotected IlvGraphic makeGraphicFromCollection(IlvMapFeature feature, IlvCoordinateTransformation tr) throws IlvCoordinateTransformationException, IlvMapRenderException
IlvGraphic from a map feature which contains a
collection of geometries.
This method calls dispatch(IlvMapFeature,IlvCoordinateTransformation).makeGraphicFromCollection in class IlvDefaultFeatureRendererfeature - The map feature to translate.tr - The destination Coordinate System of the map feature.IlvGraphic.IlvMapRenderException - If the renderer cannot process
the map feature.IlvCoordinateTransformationException - If an error occurs
during the coordinate transformation.public IlvGraphic makeGraphic(IlvMapFeature feature, IlvCoordinateTransformation tr) throws IlvMapRenderException, IlvCoordinateTransformationException
IlvGraphic from a map feature.
This method calls dispatch(IlvMapFeature,IlvCoordinateTransformation).makeGraphic in interface IlvFeatureRenderermakeGraphic in class IlvDefaultFeatureRendererfeature - The map feature to translate.tr - The destination Coordinate System of the map feature.IlvMapRenderException - If the renderer cannot process
the map feature.IlvCoordinateTransformationException - If an error occurs during
the coordinate transformation.public boolean isPersistent()
true if the object must be saved.isPersistent in interface IlvFeatureRendererisPersistent in class IlvDefaultFeatureRendererpublic void setStyleSheets(String[] css) throws IlvStylingException
IlvMapDataPathManager and is used to resolve the path or
the URL.
The order is by priority (the last CSS takes over).setStyleSheets in interface IlvStylablecss - An array of strings containing the URLs,
or the file names of CSS files (usually with a .css
suffix). A null array is equivalent to specifying
an empty style sheet.IlvStylingException - If an exception occurs while loading or
parsing the style sheet.IlvMapDataPathManagerpublic void setStyleSheets(int index,
String css)
throws IlvStylingException
setStyleSheets(java.lang.String[]).
It lets you change one particular style sheet file, instead of setting
the whole style sheet array.setStyleSheets in interface IlvStylableindex - The index of the style sheet to replace.css - The URL or file name of the new style sheet file.IlvStylingException - If an exception occurs while loading or
parsing the style sheet.setStyleSheets(java.lang.String[])public String getStyleSheets(int index)
getStyleSheets in interface IlvStylableindex - The position of the cascading style sheet to return.index-th style sheet.public String[] getStyleSheets()
getStyleSheets in interface IlvStylablepublic void setStyleSheetDebugMask(int mask)
setStyleSheets(java.lang.String[]) to debug
problems during the configuration.
The default value traces bad class names and "setter" methods
that raise an exception.setStyleSheetDebugMask in interface IlvStylablemask - The debug mask, expressed as an OR combination of the
predefined masks.setStyleSheets(java.lang.String[]),
getStyleSheetDebugMask(),
IlvStylable.APPLIED_RULE_MASK,
IlvStylable.BAD_CLASS_MASK,
IlvStylable.BAD_PROP_MASK,
IlvStylable.CREATED_MASK,
IlvStylable.DECL_MASK,
IlvStylable.DECL_VALUE_MASK,
IlvStylable.FAILED_CONVERSIONS_MASK,
IlvStylable.TIME_REPORT_MASK,
IlvStylable.WARNING_PROP_MASKpublic int getStyleSheetDebugMask()
getStyleSheetDebugMask in interface IlvStylablesetStyleSheetDebugMask(int)public final void setStyleSheet(String styleSheet) throws IlvStylingException
styleSheet property.
This method is equivalent to setStyleSheets(0, styleSheet).styleSheet - The URL, the file name, or directly the style sheet
string. This method overrides the first style sheet defined in
setStyleSheets(String[]).IlvStylingException - If an exception occurs while loading or
parsing the style sheet.public final String getStyleSheet()
styleSheet property.
This method is equivalent to getStyleSheets(0).styleSheet property, or the first of
the cascading style sheets if setStyleSheets(String[]) was used.setStyleSheet(String)public void setBaseTextDirection(String textDirectionName)
public String getBaseTextDirection()
public void addPropertyChangeListener(PropertyChangeListener listener)
PropertyChangeEvents
from this CSS manager. A PropertyChangeEvent will be fired in
response to setting a bound property, such as setStyleSheets(java.lang.String[]).addPropertyChangeListener in interface IlvStylablelistener - The listener that will be subscribed to subsequent
PropertyChangeEvents.public void removePropertyChangeListener(PropertyChangeListener listener)
PropertyChangeEvents from this CSS manager.removePropertyChangeListener in interface IlvStylablelistener - The listener that will be unsubscribed from receiving
PropertyChangeEvents.© Copyright 2024 Rogue Wave Software, Inc., a Perforce company.. All Rights Reserved.