public abstract class ALcyLspFormatAddOn extends ALcyPreferencesAddOn
Extension of ALcyPreferencesAddOn
that is also equipped with an ALcyLspFormat
. The format is created by createBaseFormat()
, then wrapped with createFormatWrapper(com.luciad.lucy.format.lightspeed.ALcyLspFormat)
and eventually plugged into ILcyLucyEnv
using a TLcyLspFormatTool
created in createFormatTool
.
Modifier | Constructor and Description |
---|---|
protected |
ALcyLspFormatAddOn(String aLongPrefix,
String aShortPrefix)
Creates a new
ALcyLspFormatAddOn |
Modifier and Type | Method and Description |
---|---|
protected abstract ALcyLspFormat |
createBaseFormat()
Returns a new data format for this add-on.
|
protected TLcyLspFormatTool |
createFormatTool(ALcyLspFormat aFormat)
Creates a new format tool for the given format.
|
protected abstract ALcyLspFormat |
createFormatWrapper(ALcyLspFormat aBaseFormat)
Returns a new data format wrapper for this add-on.
|
ALcyLspFormat |
getFormat()
Returns the
ALcyLspFormat class that encapsulates this add-on's data format. |
void |
plugInto(ILcyLucyEnv aLucyEnv)
Creates and plugs in the add-on's format and preferences tool.
|
void |
unplugFrom(ILcyLucyEnv aLucyEnv)
Unplugs the add-on's format and preferences tool.
|
createPreferencesTool, getLongPrefix, getLucyEnv, getPreferences, getPreferencesTool, getShortPrefix
getConfigSourceName, getDisplayName, setConfigSourceName, setDisplayName
protected ALcyLspFormatAddOn(String aLongPrefix, String aShortPrefix)
ALcyLspFormatAddOn
aLongPrefix
- The long prefix. This prefix must be globally unique. It is stored in
workspace files, so if backward compatibility is a concern (e.g. read an
old workspace file), this prefix must never change.aShortPrefix
- The short prefix, see also TLcyPreferencesTool
.
It might be stored in workspace files, so if backward compatibility is a
concern (e.g. read an old workspace file), this prefix must never change.public void plugInto(ILcyLucyEnv aLucyEnv)
plugInto
in class ALcyPreferencesAddOn
aLucyEnv
- the Lucy environment to plug intoALcyAddOn.unplugFrom(com.luciad.lucy.ILcyLucyEnv)
public void unplugFrom(ILcyLucyEnv aLucyEnv)
unplugFrom
in class ALcyPreferencesAddOn
aLucyEnv
- the Lucy environmentALcyAddOn.plugInto(com.luciad.lucy.ILcyLucyEnv)
public ALcyLspFormat getFormat()
Returns the ALcyLspFormat
class that encapsulates this add-on's data format.
See the createBaseFormat()
if you want to override or extend the data format. Note
that the format instance returned here can be different from the one created by createBaseFormat()
, as it is wrapped by createFormatWrapper(com.luciad.lucy.format.lightspeed.ALcyLspFormat)
createBaseFormat()
protected abstract ALcyLspFormat createBaseFormat()
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;
}
}
}
}
}
protected abstract ALcyLspFormat createFormatWrapper(ALcyLspFormat aBaseFormat)
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).
aBaseFormat
- the base format to wrapALcyLspFormatWrapper
protected TLcyLspFormatTool createFormatTool(ALcyLspFormat aFormat)
Creates a new format tool for the given format. It is used to plug all parts of the format (
e.g. ILspLayerFactory
etc.) into ILcyLucyEnv
.
Generally it is not needed to override this method. A possible use case is when you want to plug in certain services with a different priority.
aFormat
- the format for which to create a toolTLcyLspFormatTool