Class WKTMarkFactory

  • All Implemented Interfaces:
    MarkFactory

    public class WKTMarkFactory
    extends Object
    implements 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
    • Constructor Detail

      • WKTMarkFactory

        public WKTMarkFactory()
    • Method Detail

      • clearCache

        public void clearCache()
      • setRoot

        public static void setRoot​(URL root)
        Sets the root dir for WKT libraries
        Parameters:
        root - Directory from which the search for WKT libraries starts
      • getFromCache

        protected String getFromCache​(String urlLib,
                                      String wktName)
        Returns a WKT geometry from cache given its URL
        Parameters:
        urlLib - URL of the WKT library
        wktName - name of the WKT shape
      • addToCache

        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
        Parameters:
        urlLib - URL of the WKT library as a properties file URL
      • loadLibrary

        protected Properties loadLibrary​(String libFile)
                                  throws IOException
        Loads a WKT symbol library as a properties file
        Parameters:
        libFile - Location of the properties file (it could be a CQL expression)
        Throws:
        IOException