Class DefaultSymbolManager
java.lang.Object
org.gvsig.fmap.mapcontext.rendering.symbols.impl.DefaultSymbolManager
- All Implemented Interfaces:
SymbolManager
Default
SymbolManager implementation.- Author:
- gvSIG team
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface org.gvsig.fmap.mapcontext.rendering.symbols.SymbolManager
LABELINGSTRATEGY_FILE_EXTENSION, LEGEND_FILE_EXTENSION -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateMultiLayerSymbol(int shapeType) Creates a newIMultiLayerSymbolwhich can be used to render the givenGeometrytype.createMultiLayerSymbol(String symbolName) Creates a newIMultiLayerSymbol.createSymbol(int shapeType) Creates a newISymbolwhich can be used to render the givenGeometrytype.createSymbol(int shapeType, Color color) createSymbol(String symbolName) Creates a newISymbol.createSymbol(String symbolName, Color color) static ColorReturns the currentSymbolPreferences.getWarningSymbol(String message, String symbolDesc, int symbolDrawExceptionType) Returns an instance ofIWarningSymbol.static Colorstatic ColorloadSymbol(File file) Loads a persisted symbol from the given file.ISymbol[]loadSymbols(File folder) Loads the symbols persisted into a folder.ISymbol[]loadSymbols(File folder, FileFilter fileFilter) Loads the symbols persisted into a folder.org.gvsig.tools.task.CancellableTaskloadSymbols(File folder, FileFilter filter, org.gvsig.tools.visitor.Visitor visitor) voidregisterMultiLayerSymbol(String symbolName, int[] shapeTypes, Class symbolClass) Registers aIMultiLayerSymbolimplementation class with a name and a list of geometry types which the symbol is able to render.voidregisterMultiLayerSymbol(String symbolName, Class symbolClass) Registers aIMultiLayerSymbolimplementation class with a name.voidregisterSymbol(String symbolName, int[] shapeTypes, Class symbolClass) Registers aISymbolimplementation class with a name and a list of geometry types which the symbol is able to render.voidregisterSymbol(String symbolName, Class symbolClass) Registers aISymbolimplementation class with a name.voidsaveSymbol(ISymbol symbol, String fileName, File folder) Persists aISymbolinto the given folder, with the given file name.voidsaveSymbol(ISymbol symbol, String fileName, File folder, boolean overwrite) Persists aISymbolinto the given folder, with the given file name.voidsetSymbolPreferences(SymbolPreferences symbolPreferences)
-
Constructor Details
-
DefaultSymbolManager
public DefaultSymbolManager()
-
-
Method Details
-
loadSymbols
Description copied from interface:SymbolManagerLoads the symbols persisted into a folder. It loads the symbols through the use of the currentPersistenceManager, loading all files found into the folder.- Specified by:
loadSymbolsin interfaceSymbolManager- Parameters:
folder- to load the persisted symbols from- Returns:
- the list of loaded symbols
- Throws:
SymbolException- if there is an error loading the symbols
-
loadSymbols
Description copied from interface:SymbolManagerLoads the symbols persisted into a folder. It loads the symbols through the use of the currentPersistenceManager, loading the files found into the folder which apply to the provided filter.- Specified by:
loadSymbolsin interfaceSymbolManager- Parameters:
folder- to load the persisted symbols fromfileFilter- to apply to know which files to load- Returns:
- the list of loaded symbols
- Throws:
SymbolException- if there is an error loading the symbols
-
loadSymbols
public org.gvsig.tools.task.CancellableTask loadSymbols(File folder, FileFilter filter, org.gvsig.tools.visitor.Visitor visitor) - Specified by:
loadSymbolsin interfaceSymbolManager
-
saveSymbol
Description copied from interface:SymbolManagerPersists aISymbolinto the given folder, with the given file name.- Specified by:
saveSymbolin interfaceSymbolManager- Parameters:
symbol- to persistfileName- of the file to createfolder- where to create the file- Throws:
SymbolException- if there is an error persisting the symbol, or the file to create already exists
-
saveSymbol
public void saveSymbol(ISymbol symbol, String fileName, File folder, boolean overwrite) throws SymbolException Description copied from interface:SymbolManagerPersists aISymbolinto the given folder, with the given file name.- Specified by:
saveSymbolin interfaceSymbolManager- Parameters:
symbol- to persistfileName- of the file to createfolder- where to create the fileoverwrite- what to do if the file to create already exists- Throws:
SymbolException- if there is an error persisting the symbol, or the file to create already exists and overwrite is false
-
loadSymbol
Loads a persisted symbol from the given file.- Specified by:
loadSymbolin interfaceSymbolManager- Throws:
SymbolException
-
getSymbolPreferences
Description copied from interface:SymbolManagerReturns the currentSymbolPreferences.- Specified by:
getSymbolPreferencesin interfaceSymbolManager- Returns:
- the current
SymbolPreferences
-
createSymbol
Description copied from interface:SymbolManagerCreates a newISymbol.- Specified by:
createSymbolin interfaceSymbolManager- Parameters:
symbolName- the name of the symbol to create- Returns:
- a new
ISymbol - Throws:
MapContextRuntimeException- if there is an error creating the symbol
-
createSymbol
Description copied from interface:SymbolManagerCreates a newISymbolwhich can be used to render the givenGeometrytype.- Specified by:
createSymbolin interfaceSymbolManager- Parameters:
shapeType- theGeometrytype to render- Returns:
- a new
ISymbol - Throws:
MapContextRuntimeException- if there is an error creating the symbol
-
createSymbol
Description copied from interface:SymbolManager- Specified by:
createSymbolin interfaceSymbolManager- Parameters:
symbolName- the name of the symbol to createcolor- the color for the symbol- Returns:
- a new
ISymbol - Throws:
MapContextRuntimeException- if there is an error creating the symbol
-
createSymbol
Description copied from interface:SymbolManager- Specified by:
createSymbolin interfaceSymbolManager- Parameters:
shapeType- theGeometrytype to rendercolor- the color for the symbol- Returns:
- a new
ISymbol - Throws:
MapContextRuntimeException- if there is an error creating the symbol
-
createMultiLayerSymbol
public IMultiLayerSymbol createMultiLayerSymbol(String symbolName) throws MapContextRuntimeException Description copied from interface:SymbolManagerCreates a newIMultiLayerSymbol.- Specified by:
createMultiLayerSymbolin interfaceSymbolManager- Parameters:
symbolName- the name of the symbol to create- Returns:
- a new
IMultiLayerSymbol - Throws:
MapContextRuntimeException- if there is an error creating the symbol
-
createMultiLayerSymbol
Description copied from interface:SymbolManagerCreates a newIMultiLayerSymbolwhich can be used to render the givenGeometrytype.- Specified by:
createMultiLayerSymbolin interfaceSymbolManager- Parameters:
shapeType- theGeometrytype to render- Returns:
- a new
IMultiLayerSymbol - Throws:
MapContextRuntimeException- if there is an error creating the symbol
-
registerSymbol
Description copied from interface:SymbolManagerRegisters aISymbolimplementation class with a name. This way the symbol class is not related to any geometry type, so it can be created only through theSymbolManager.createSymbol(String)method.- Specified by:
registerSymbolin interfaceSymbolManager- Parameters:
symbolName- the symbol namesymbolClass- the symbol implementation class- Throws:
MapContextRuntimeException- if the provided class does not implement the ISymbol interface
-
registerSymbol
public void registerSymbol(String symbolName, int[] shapeTypes, Class symbolClass) throws MapContextRuntimeException Description copied from interface:SymbolManagerRegisters aISymbolimplementation class with a name and a list of geometry types which the symbol is able to render.- Specified by:
registerSymbolin interfaceSymbolManager- Parameters:
symbolName- the symbol nameshapeTypes- the list of geometry types the symbol is able to rendersymbolClass- the symbol implementation class- Throws:
MapContextRuntimeException- if the provided class does not implement the ISymbol interface
-
registerMultiLayerSymbol
public void registerMultiLayerSymbol(String symbolName, Class symbolClass) throws MapContextRuntimeException Description copied from interface:SymbolManagerRegisters aIMultiLayerSymbolimplementation class with a name. This way the symbol class is not related to any geometry type, so it can be created only through theSymbolManager.createMultiLayerSymbol(String)method.- Specified by:
registerMultiLayerSymbolin interfaceSymbolManager- Parameters:
symbolName- the symbol namesymbolClass- the symbol implementation class- Throws:
MapContextRuntimeException- if the provided class does not implement theIMultiLayerSymbolinterface
-
registerMultiLayerSymbol
public void registerMultiLayerSymbol(String symbolName, int[] shapeTypes, Class symbolClass) throws MapContextRuntimeException Description copied from interface:SymbolManagerRegisters aIMultiLayerSymbolimplementation class with a name and a list of geometry types which the symbol is able to render.- Specified by:
registerMultiLayerSymbolin interfaceSymbolManager- Parameters:
symbolName- the symbol nameshapeTypes- the list of geometry types the symbol is able to rendersymbolClass- the symbol implementation class- Throws:
MapContextRuntimeException- if the provided class does not implement theIMultiLayerSymbolinterface
-
getWarningSymbol
public IWarningSymbol getWarningSymbol(String message, String symbolDesc, int symbolDrawExceptionType) throws MapContextRuntimeException Description copied from interface:SymbolManagerReturns an instance ofIWarningSymbol. TODO: revisar el uso de esto, a ver si es necesario o se puede ocultar dentro de la implementación.- Specified by:
getWarningSymbolin interfaceSymbolManager- Parameters:
message-symbolDesc-symbolDrawExceptionType-- Returns:
- the warning symbol
- Throws:
MapContextRuntimeException
-
setSymbolPreferences
- Specified by:
setSymbolPreferencesin interfaceSymbolManager
-
getSymbolLibraryNames
- Specified by:
getSymbolLibraryNamesin interfaceSymbolManager
-
getSymbol
- Specified by:
getSymbolin interfaceSymbolManager- Throws:
SymbolException
-
darker
- Parameters:
col-- Returns:
- color 1/3 closer to black
-
lighter
- Parameters:
col-- Returns:
- color 1/3 closer to white
-
invert
- Parameters:
col-- Returns:
- inverted color (inverts each band, same alpha)
-