Class SymbolLibrary
- java.lang.Object
-
- com.supermap.data.InternalHandle
-
- com.supermap.data.InternalHandleDisposable
-
- com.supermap.data.SymbolLibrary
-
- Direct Known Subclasses:
- SymbolFillLibrary, SymbolLineLibrary, SymbolMarkerLibrary
public abstract class SymbolLibrary extends InternalHandleDisposable
The SymbolLibrary class.This class is the parent class of the SymbolMarkerLibrary class, the SymbolLineLibrary class and the SymbolFillLibrary class.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description int
add(Symbol symbol)
Adds the specified Symbol object to the current SymbolLibrary object.int
add(Symbol symbol, SymbolGroup desGroup)
Adds the specified Symbol object to the SymbolLibrary object.void
clear()
Clears all the Symbol objects in the SymbolLibrary object.boolean
contains(int id)
Tests whether this SymbolLibrary object contains the given ID or not.SymbolGroup
findGroup(int id)
Finds the SymbolGroup object which the symbol with the given ID belongs to.Symbol
findSymbol(int id)
Finds the Symbol object with the specified ID in the SymbolLibrary object.Symbol
findSymbol(java.lang.String name)
Finds the Symbol object with the given name in the SymbolLibrary object and returns the first Symbol object whose name is identical with the specified name.boolean
fromFile(java.lang.String fileName)
Imports the existing symbol library file to the SymbolLibrary object.SymbolGroup
getRootGroup()
Returns the root group of the symbol library.boolean
moveTo(int id, SymbolGroup group)
Moves the specified symbol object to the specified symbol group.boolean
remove(int id)
Removes the Symbol object with the specified ID in the SymbolLibrary object.
-
-
-
Method Detail
-
findGroup
public SymbolGroup findGroup(int id)
Finds the SymbolGroup object which the symbol with the given ID belongs to.- Parameters:
id
- The specified ID of the symbol.- Returns:
- Returns the SymbolGroup object.
-
contains
public boolean contains(int id)
Tests whether this SymbolLibrary object contains the given ID or not.- Parameters:
id
- The ID to be tested.- Returns:
- Returns true if the SymbolLibrary object contains the given ID; otherwise, false.
-
findSymbol
public Symbol findSymbol(int id)
Finds the Symbol object with the specified ID in the SymbolLibrary object.- Parameters:
id
- The specified ID- Returns:
- the symbol object.
-
findSymbol
public Symbol findSymbol(java.lang.String name)
Finds the Symbol object with the given name in the SymbolLibrary object and returns the first Symbol object whose name is identical with the specified name.- Parameters:
name
- given name.- Returns:
- the symbol object.
-
fromFile
public boolean fromFile(java.lang.String fileName)
Imports the existing symbol library file to the SymbolLibrary object. This operation will remove the former symbols in the current symbol library.This method can't get the system symbol
- Parameters:
fileName
- The name of the existing symbol library file.- Returns:
- True, if successful; Otherwise false.
-
remove
public boolean remove(int id)
Removes the Symbol object with the specified ID in the SymbolLibrary object.- Parameters:
id
- The specified ID of the Symbol object to be removed.- Returns:
- Returns true if successful; otherwise false.
-
moveTo
public boolean moveTo(int id, SymbolGroup group)
Moves the specified symbol object to the specified symbol group. The moved symbol object will be appended to the end of the target symbol group, with the ID of the symbol object unchaned.- Parameters:
id
- The ID of the Symbol object to be removed.group
- The specified target group.- Returns:
- True, if successful; Otherwise false.
-
clear
public void clear()
Clears all the Symbol objects in the SymbolLibrary object.
-
getRootGroup
public SymbolGroup getRootGroup()
Returns the root group of the symbol library.Below is the illustration for the structure of marker, line, and fill symbol libraries.
The structure of symbol libraries is similar to the structure of Windows explorer. In the root of the disk, there can be 0 or more folders or files, with each of the folders containing 0 or more folders or files. The root group, symbol groups, and symbols of the symbol library are similar to the root of the disk, folders, and files respectively. The root group can contain 0 or more symbol groups or symbols, with each of the symbol groups containing 0 or more symbols groups and symbols.
As shown below, the red dashed rectangle indicates the root group of the symbol library. The root group is a symbol group with the highest level in the symbol library. Each symbol group, including the root group, can contain 0 or more symbol groups or symbols. All symbol groups in a group compose a object and each symbol group can have only one object at most. The object is used to manage (create or delete) all symbol groups in it. We can see that the yellow rectangle indicates a symbol group, corresponding to a , that contains multiple symbol groups and symbols, which compose a object. The symbol group in the yellow rectangle is the parent group of the three symbol groups in the pink rectangle. The three symbol groups in the pink rectangle are the child groups of the symbol group in the yellow rectangle.
Note: Groups and child groups are used to store symbols logically in a tree hierarchy, which would bring convenience for symbol management and usage.
In summary, a contains a unique
SymbolLibrary
object, which can contain at most 1SymbolGroup
object and 0 or several Symbol objects. TheSymbolGroup
object is the collection ofSymbolGroups
objects, which contributes to the tree hierarchical management of symbols.- Returns:
- the root group of the symbol library.
-
add
public int add(Symbol symbol, SymbolGroup desGroup)
Adds the specified Symbol object to the SymbolLibrary object.- Parameters:
symbol
- the symbol to be added.desGroup
- The target SymbolGroup object which the new Symbol object will be added to.- Returns:
- Returns the ID of the symbol newly added.
-
add
public int add(Symbol symbol)
Adds the specified Symbol object to the current SymbolLibrary object.- Parameters:
symbol
- the symbol to be added.- Returns:
- Returns the ID of the symbol newly added.
-
-