Class WKTMarkFactory
Object
WKTMarkFactory
- All Implemented Interfaces:
MarkFactory
Factory to produce marks based on WKT representation of symbols. WKT geometries may be defined directly in the SLD
(prefixing it with @see "wkt://", or in a WKT library stored in a properties file (prefixing it with @see
WKTLIB_PREFIX
).
The symbols stored in properties files are cached in soft references for better performance. The root directory
for properties files can be set using the setRoot(java.net.URL)
method.
- Author:
- Luca Morandini lmorandini@ieee.org, Simone Giannecchini, GeoSolutions
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
addToCache
(String urlLib) Adds the shapes contained in a WKT library to the cache; if the url already exists in the cache, the shapes are not addedvoid
protected String
getFromCache
(String urlLib, String wktName) Returns a WKT geometry from cache given its URLgetShape
(Graphics2D graphics, Expression symbolUrl, Feature feature) Returns a WKT shaoe given that its URL specifies a WKT geometry or contains a reference to a WKT geometry specfied in a properties fileprotected Properties
loadLibrary
(String libFile) Loads a WKT symbol library as a properties filestatic void
Sets the root dir for WKT libraries
-
Field Details
-
LOGGER
The logger for the rendering module. -
WKT_PREFIX
- See Also:
-
WKTLIB_PREFIX
- See Also:
-
WKT_SEPARATOR
- See Also:
-
ROOT_DIRECTORY
-
CACHE
-
-
Constructor Details
-
WKTMarkFactory
public WKTMarkFactory()
-
-
Method Details
-
clearCache
public void clearCache() -
setRoot
Sets the root dir for WKT libraries- Parameters:
root
- Directory from which the search for WKT libraries starts
-
getFromCache
Returns a WKT geometry from cache given its URL- Parameters:
urlLib
- URL of the WKT librarywktName
- name of the WKT shape
-
addToCache
Adds the shapes contained in a WKT library to the cache; if the url already exists in the cache, the shapes are not added- Parameters:
urlLib
- URL of the WKT library as a properties file URL
-
getShape
Returns a WKT shaoe given that its URL specifies a WKT geometry or contains a reference to a WKT geometry specfied in a properties file- Specified by:
getShape
in interfaceMarkFactory
symbolUrl
- the expression that will return the symbol name. Once evaluated the expression should return something likeplainName
or likeprotocol://path
. See the actual implementations for details on the kind of supported name.feature
- The feature that will be used to evaluate the symbolURL expression (or to extract data from it, think complex attributes, in that case a visit to the expression and some direct attribute value extraction might be needed instead)- Throws:
Exception
- See Also:
-
loadLibrary
Loads a WKT symbol library as a properties file- Parameters:
libFile
- Location of the properties file (it could be a CQL expression)- Throws:
IOException
-