public class TLcyLspDrawingAddOn extends ALcyLspFormatAddOn
This add-on registers the Lightspeed related functionality of the TLcyDrawingAddOn
. It creates a TLcyLspDrawingFormat
which creates the necessary factories. This format can be modified by
overriding the createBaseFormat()
method.
The API allows for more elaborate customizations.
The actual contents of the format bar is created by an ALcyGUIFactory
, which is exposed in TLcyLspDrawingFormat.createGUIFactory()
.
The default ALcyGUIFactory
is the TLcyLspDrawingToolBarFactory
, which can be extended as starting point for a custom implementation.
Replacing this GUI factory with a custom one (possibly extending from TLcyLspDrawingToolBarFactory
) can be done by:
@Override
protected TLcyLspDrawingFormat createBaseFormat(){
TLcyDrawingFormat gxyFormat = getLucyEnv().retrieveAddOnByClass(TLcyDrawingAddOn.class).getDrawingFormat();
return new TLcyLspDrawingFormat(gxyFormat, getPreferences(), getLongPrefix(), getShortPrefix(), this){
@Override
protected ALcyGUIFactory<Component> createGUIFactory() {
return new CustomGUIFactory();
}
}
}
Note: The format bar factory provided by this add-on is only used for Lightspeed maps.
The one for GXY maps is created in the TLcyDrawingAddOn
.
Constructor and Description |
---|
TLcyLspDrawingAddOn()
Create a new
TLcyLspDrawingAddOn . |
Modifier and Type | Method and Description |
---|---|
protected TLcyLspDrawingFormat |
createBaseFormat()
Returns a new data format for this add-on.
|
protected ALcyLspFormat |
createFormatWrapper(ALcyLspFormat aBaseFormat)
Returns a new data format wrapper for this add-on.
|
protected TLcyPreferencesTool |
createPreferencesTool()
Creates the
TLcyPreferencesTool to be used by this add-on. |
TLcyDrawingAddOn |
getDrawingAddOn()
Returns the GXY drawing add-on
|
TLcyLspDrawingFormat |
getDrawingFormat()
Returns the
TLcyLspDrawingFormat created in the createBaseFormat() method. |
TLcyLspDrawingSettings |
getDrawingSettingsForMap(ILcdView aView)
Method to retrieve the drawing settings for a certain view.
|
void |
plugInto(ILcyLucyEnv aLucyEnv)
Creates and plugs in the add-on's format and preferences tool.
|
createFormatTool, getFormat, unplugFrom
getLongPrefix, getLucyEnv, getPreferences, getPreferencesTool, getShortPrefix
getConfigSourceName, getDisplayName, setConfigSourceName, setDisplayName
public TLcyLspDrawingAddOn()
TLcyLspDrawingAddOn
.public void plugInto(ILcyLucyEnv aLucyEnv)
ALcyLspFormatAddOn
plugInto
in class ALcyLspFormatAddOn
aLucyEnv
- the Lucy environment to plug intoALcyAddOn.unplugFrom(com.luciad.lucy.ILcyLucyEnv)
protected TLcyLspDrawingFormat createBaseFormat()
ALcyLspFormatAddOn
Returns a new data format for this add-on. Override this method to extend the default format with new functionality.
For example, to alter the icon of the layers of this format, you can decorate the layer factory created in the format:
@Override
protected ALcyLspFormat createBaseFormat() {
return new ALcyLspFormatWrapper(super.createBaseFormat()){
@Override
protected ILspLayerFactory createLayerFactory(){
final ILspLayerFactory delegate = super.createLayerFactory();
return new ILspLayerFactory(){
@Override
public boolean canCreateLayers(ILcdModel aModel){
return delegate.canCreateLayers(aModel);
}
@Override
public Collection<ILspLayer> createLayers(ILcdModel aModel){
Collection<ILspLayer> layers = delegate.createLayers(aModel);
for(ILspLayer layer : layers){
ILcdIcon icon = ...;
layer.setIcon(icon)
}
return layers;
}
}
}
}
}
createBaseFormat
in class ALcyLspFormatAddOn
protected final ALcyLspFormat createFormatWrapper(ALcyLspFormat aBaseFormat)
ALcyLspFormatAddOn
Returns a new data format wrapper for this add-on. A format wrapper extends the base format with aspects such as safe guarding, etc.
Overriding this method of an existing add-on should be done with extreme care as add-ons typically rely on the wrappers that should be present (e.g. a safe guard).
createFormatWrapper
in class ALcyLspFormatAddOn
aBaseFormat
- the base format to wrapALcyLspFormatWrapper
protected TLcyPreferencesTool createPreferencesTool()
ALcyPreferencesAddOn
Creates the TLcyPreferencesTool
to be used by this add-on. Overwriting this method
for example allows to register additional ILcyPropertyConverter
s for (complex)
custom properties, to make sure they are correctly decoded from the add-on's configuration file
and/or saved to the workspace. Note that this isn't required for simple properties such as
String
, int
, double
, etc.
The default implementation creates a new tool based on the ALcyAddOn.getConfigSourceName()
and
the add-on's prefixes.
createPreferencesTool
in class ALcyPreferencesAddOn
TLcyPreferencesTool
.public final TLcyLspDrawingFormat getDrawingFormat()
TLcyLspDrawingFormat
created in the createBaseFormat()
method.TLcyLspDrawingFormat
created in the createBaseFormat()
methodpublic final TLcyDrawingAddOn getDrawingAddOn()
public TLcyLspDrawingSettings getDrawingSettingsForMap(ILcdView aView)
aView
- the view for which the drawing settings must be retrievedaView