public class DefaultSymbolManager extends 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(String symbolName)
Creates a new
IMultiLayerSymbol . |
ISymbol |
createSymbol(int shapeType)
|
ISymbol |
createSymbol(int shapeType,
Color color)
|
ISymbol |
createSymbol(String symbolName)
Creates a new
ISymbol . |
ISymbol |
createSymbol(String symbolName,
Color color)
|
static Color |
darker(Color col) |
ISymbol |
getSymbol(String libraryName,
String symbolID) |
List |
getSymbolLibraryNames() |
SymbolPreferences |
getSymbolPreferences()
Returns the current
SymbolPreferences . |
IWarningSymbol |
getWarningSymbol(String message,
String symbolDesc,
int symbolDrawExceptionType)
Returns an instance of
IWarningSymbol . |
static Color |
invert(Color col) |
static Color |
lighter(Color col) |
ISymbol[] |
loadSymbols(File folder)
Loads the symbols persisted into a folder.
|
ISymbol[] |
loadSymbols(File folder,
FileFilter fileFilter)
Loads the symbols persisted into a folder.
|
CancellableTask |
loadSymbols(File folder,
FileFilter filter,
Visitor visitor) |
void |
registerMultiLayerSymbol(String symbolName,
Class symbolClass)
Registers a
IMultiLayerSymbol implementation class with a name. |
void |
registerMultiLayerSymbol(String symbolName,
int[] shapeTypes,
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(String symbolName,
Class symbolClass)
Registers a
ISymbol implementation class with a name. |
void |
registerSymbol(String symbolName,
int[] shapeTypes,
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,
String fileName,
File folder)
Persists a
ISymbol into the given folder, with the given file
name. |
void |
saveSymbol(ISymbol symbol,
String fileName,
File folder,
boolean overwrite)
Persists a
ISymbol into the given folder, with the given file
name. |
void |
setSymbolPreferences(SymbolPreferences symbolPreferences) |
public ISymbol[] loadSymbols(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(File folder, 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(File folder, FileFilter filter, Visitor visitor)
loadSymbols
in interface SymbolManager
public void saveSymbol(ISymbol symbol, String fileName, 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, String fileName, 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 SymbolPreferences getSymbolPreferences()
SymbolManager
SymbolPreferences
.getSymbolPreferences
in interface SymbolManager
SymbolPreferences
public ISymbol createSymbol(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(String symbolName, Color color) throws MapContextRuntimeException
SymbolManager
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, 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(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(String symbolName, 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(String symbolName, int[] shapeTypes, 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(String symbolName, 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(String symbolName, int[] shapeTypes, 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(String message, 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 List getSymbolLibraryNames()
getSymbolLibraryNames
in interface SymbolManager
public ISymbol getSymbol(String libraryName, String symbolID) throws SymbolException
getSymbol
in interface SymbolManager
SymbolException