public class DefaultSymbolManager extends java.lang.Object implements SymbolManager
SymbolManager
implementation.Modifier and Type | Class and Description |
---|---|
class |
DefaultSymbolManager.SymbolsLoaderTask |
LABELINGSTRATEGY_FILE_EXTENSION, LEGEND_FILE_EXTENSION
Constructor and Description |
---|
DefaultSymbolManager() |
Modifier and Type | Method and Description |
---|---|
IMultiLayerSymbol |
createMultiLayerSymbol(int shapeType)
Creates a new
IMultiLayerSymbol which can be used to render the
given Geometry type. |
IMultiLayerSymbol |
createMultiLayerSymbol(java.lang.String symbolName)
Creates a new
IMultiLayerSymbol . |
ISymbol |
createSymbol(int shapeType)
|
ISymbol |
createSymbol(int shapeType,
java.awt.Color color)
|
ISymbol |
createSymbol(java.lang.String symbolName)
Creates a new
ISymbol . |
ISymbol |
createSymbol(java.lang.String symbolName,
java.awt.Color color)
Creates a new
ISymbol with the given Color . |
static java.awt.Color |
darker(java.awt.Color col) |
ISymbol |
getSymbol(java.lang.String libraryName,
java.lang.String symbolID) |
java.util.List |
getSymbolLibraryNames() |
SymbolPreferences |
getSymbolPreferences()
Returns the current
SymbolPreferences . |
IWarningSymbol |
getWarningSymbol(java.lang.String message,
java.lang.String symbolDesc,
int symbolDrawExceptionType)
Returns an instance of
IWarningSymbol . |
static java.awt.Color |
invert(java.awt.Color col) |
static java.awt.Color |
lighter(java.awt.Color col) |
ISymbol |
loadSymbol(java.io.File file)
Loads a persisted symbol from the given file.
|
ISymbol[] |
loadSymbols(java.io.File folder)
Loads the symbols persisted into a folder.
|
ISymbol[] |
loadSymbols(java.io.File folder,
java.io.FileFilter fileFilter)
Loads the symbols persisted into a folder.
|
CancellableTask |
loadSymbols(java.io.File folder,
java.io.FileFilter filter,
Visitor visitor) |
void |
registerMultiLayerSymbol(java.lang.String symbolName,
java.lang.Class symbolClass)
Registers a
IMultiLayerSymbol implementation class with a name. |
void |
registerMultiLayerSymbol(java.lang.String symbolName,
int[] shapeTypes,
java.lang.Class symbolClass)
Registers a
IMultiLayerSymbol implementation class with a name
and a list of geometry types which the symbol is able to render. |
void |
registerSymbol(java.lang.String symbolName,
java.lang.Class symbolClass)
Registers a
ISymbol implementation class with a name. |
void |
registerSymbol(java.lang.String symbolName,
int[] shapeTypes,
java.lang.Class symbolClass)
Registers a
ISymbol implementation class with a name and a list
of geometry types which the symbol is able to render. |
void |
saveSymbol(ISymbol symbol,
java.lang.String fileName,
java.io.File folder)
Persists a
ISymbol into the given folder, with the given file
name. |
void |
saveSymbol(ISymbol symbol,
java.lang.String fileName,
java.io.File folder,
boolean overwrite)
Persists a
ISymbol into the given folder, with the given file
name. |
void |
setSymbolPreferences(SymbolPreferences symbolPreferences) |
public ISymbol[] loadSymbols(java.io.File folder) throws SymbolException
SymbolManager
PersistenceManager
, loading all files
found into the folder.loadSymbols
in interface SymbolManager
folder
- to load the persisted symbols fromSymbolException
- if there is an error loading the symbolspublic ISymbol[] loadSymbols(java.io.File folder, java.io.FileFilter fileFilter) throws SymbolException
SymbolManager
PersistenceManager
, loading the files
found into the folder which apply to the provided filter.loadSymbols
in interface SymbolManager
folder
- to load the persisted symbols fromfileFilter
- to apply to know which files to loadSymbolException
- if there is an error loading the symbolspublic CancellableTask loadSymbols(java.io.File folder, java.io.FileFilter filter, Visitor visitor)
loadSymbols
in interface SymbolManager
public void saveSymbol(ISymbol symbol, java.lang.String fileName, java.io.File folder) throws SymbolException
SymbolManager
ISymbol
into the given folder, with the given file
name.saveSymbol
in interface SymbolManager
symbol
- to persistfileName
- of the file to createfolder
- where to create the fileSymbolException
- if there is an error persisting the symbol, or the file to
create already existspublic void saveSymbol(ISymbol symbol, java.lang.String fileName, java.io.File folder, boolean overwrite) throws SymbolException
SymbolManager
ISymbol
into the given folder, with the given file
name.saveSymbol
in interface SymbolManager
symbol
- to persistfileName
- of the file to createfolder
- where to create the fileoverwrite
- what to do if the file to create already existsSymbolException
- if there is an error persisting the symbol, or the file to
create already exists and overwrite is falsepublic ISymbol loadSymbol(java.io.File file) throws SymbolException
loadSymbol
in interface SymbolManager
SymbolException
public SymbolPreferences getSymbolPreferences()
SymbolManager
SymbolPreferences
.getSymbolPreferences
in interface SymbolManager
SymbolPreferences
public ISymbol createSymbol(java.lang.String symbolName) throws MapContextRuntimeException
SymbolManager
ISymbol
.createSymbol
in interface SymbolManager
symbolName
- the name of the symbol to createISymbol
MapContextRuntimeException
- if there is an error creating the symbolpublic ISymbol createSymbol(int shapeType) throws MapContextRuntimeException
SymbolManager
createSymbol
in interface SymbolManager
shapeType
- the Geometry
type to renderISymbol
MapContextRuntimeException
- if there is an error creating the symbolpublic ISymbol createSymbol(java.lang.String symbolName, java.awt.Color color) throws MapContextRuntimeException
SymbolManager
ISymbol
with the given Color
.createSymbol
in interface SymbolManager
symbolName
- the name of the symbol to createcolor
- the color for the symbolISymbol
MapContextRuntimeException
- if there is an error creating the symbolpublic ISymbol createSymbol(int shapeType, java.awt.Color color) throws MapContextRuntimeException
SymbolManager
createSymbol
in interface SymbolManager
shapeType
- the Geometry
type to rendercolor
- the color for the symbolISymbol
MapContextRuntimeException
- if there is an error creating the symbolpublic IMultiLayerSymbol createMultiLayerSymbol(java.lang.String symbolName) throws MapContextRuntimeException
SymbolManager
IMultiLayerSymbol
.createMultiLayerSymbol
in interface SymbolManager
symbolName
- the name of the symbol to createIMultiLayerSymbol
MapContextRuntimeException
- if there is an error creating the symbolpublic IMultiLayerSymbol createMultiLayerSymbol(int shapeType) throws MapContextRuntimeException
SymbolManager
IMultiLayerSymbol
which can be used to render the
given Geometry
type.createMultiLayerSymbol
in interface SymbolManager
shapeType
- the Geometry
type to renderIMultiLayerSymbol
MapContextRuntimeException
- if there is an error creating the symbolpublic void registerSymbol(java.lang.String symbolName, java.lang.Class symbolClass) throws MapContextRuntimeException
SymbolManager
ISymbol
implementation class with a name. This way
the symbol class is not related to any geometry type, so it can be
created only through the SymbolManager.createSymbol(String)
method.registerSymbol
in interface SymbolManager
symbolName
- the symbol namesymbolClass
- the symbol implementation classMapContextRuntimeException
- if the provided class does not implement the ISymbol
interfacepublic void registerSymbol(java.lang.String symbolName, int[] shapeTypes, java.lang.Class symbolClass) throws MapContextRuntimeException
SymbolManager
ISymbol
implementation class with a name and a list
of geometry types which the symbol is able to render.registerSymbol
in interface SymbolManager
symbolName
- the symbol nameshapeTypes
- the list of geometry types the symbol is able to rendersymbolClass
- the symbol implementation classMapContextRuntimeException
- if the provided class does not implement the ISymbol
interfacepublic void registerMultiLayerSymbol(java.lang.String symbolName, java.lang.Class symbolClass) throws MapContextRuntimeException
SymbolManager
IMultiLayerSymbol
implementation class with a name.
This way the symbol class is not related to any geometry type, so it can
be created only through the SymbolManager.createMultiLayerSymbol(String)
method.registerMultiLayerSymbol
in interface SymbolManager
symbolName
- the symbol namesymbolClass
- the symbol implementation classMapContextRuntimeException
- if the provided class does not implement the
IMultiLayerSymbol
interfacepublic void registerMultiLayerSymbol(java.lang.String symbolName, int[] shapeTypes, java.lang.Class symbolClass) throws MapContextRuntimeException
SymbolManager
IMultiLayerSymbol
implementation class with a name
and a list of geometry types which the symbol is able to render.registerMultiLayerSymbol
in interface SymbolManager
symbolName
- the symbol nameshapeTypes
- the list of geometry types the symbol is able to rendersymbolClass
- the symbol implementation classMapContextRuntimeException
- if the provided class does not implement the
IMultiLayerSymbol
interfacepublic IWarningSymbol getWarningSymbol(java.lang.String message, java.lang.String symbolDesc, int symbolDrawExceptionType) throws MapContextRuntimeException
SymbolManager
IWarningSymbol
.
TODO: revisar el uso de esto, a ver si es necesario o se puede ocultar
dentro de la implementación.getWarningSymbol
in interface SymbolManager
MapContextRuntimeException
public void setSymbolPreferences(SymbolPreferences symbolPreferences)
setSymbolPreferences
in interface SymbolManager
public java.util.List getSymbolLibraryNames()
getSymbolLibraryNames
in interface SymbolManager
public ISymbol getSymbol(java.lang.String libraryName, java.lang.String symbolID) throws SymbolException
getSymbol
in interface SymbolManager
SymbolException
public static java.awt.Color darker(java.awt.Color col)
col
- public static java.awt.Color lighter(java.awt.Color col)
col
- public static java.awt.Color invert(java.awt.Color col)
col
-