public class WKTMarkFactory extends Object implements MarkFactory
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
method.
Modifier and Type | Field and Description |
---|---|
protected static SoftValueHashMap<String,Map<String,String>> |
CACHE |
protected static Logger |
LOGGER
The logger for the rendering module.
|
protected static URL |
ROOT_DIRECTORY |
static String |
WKT_PREFIX |
static String |
WKT_SEPARATOR |
static String |
WKTLIB_PREFIX |
Constructor and Description |
---|
WKTMarkFactory() |
Modifier and Type | Method and Description |
---|---|
protected 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 added
|
void |
clearCache() |
protected String |
getFromCache(String urlLib,
String wktName)
Returns a WKT geometry from cache given its URL
|
Shape |
getShape(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 file
|
protected Properties |
loadLibrary(String libFile)
Loads a WKT symbol library as a properties file
|
void |
setRoot(URL root)
Sets the root dir for WKT libraries
|
protected static final Logger LOGGER
public static final String WKT_PREFIX
public static final String WKTLIB_PREFIX
public static final String WKT_SEPARATOR
protected static URL ROOT_DIRECTORY
protected static final SoftValueHashMap<String,Map<String,String>> CACHE
public void clearCache()
public void setRoot(URL root)
root
- Directory from which the search for WKT libraries startsprotected String getFromCache(String urlLib, String wktName)
urlLib
- URL of the WKT librarywktName
- name of the WKT shapeprotected void addToCache(String urlLib)
urlLib
- URL of the WKT library as a properties file URLpublic Shape getShape(Graphics2D graphics, Expression symbolUrl, Feature feature) throws Exception
getShape
in interface MarkFactory
symbolUrl
- the expression that will return the symbol name. Once evaluated the
expression should return something like plainName
or like
protocol://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)Exception
MarkFactory.getShape(java.awt.Graphics2D,
org.opengis.filter.expression.Expression, org.opengis.feature.Feature)
protected Properties loadLibrary(String libFile) throws IOException
libFile
- Location of the properties file (it could be a CQL expression)IOException
Copyright © 1996–2019 Geotools. All rights reserved.