public class TLcyDrawingAddOn extends ALcyFormatAddOn
An addon that provides an ALcyFormat
supporting the out-of-the-box shapes of
LuciadLightspeed (e.g. points, polylines, circles, ...), together with a file format etc. The format
also has a tool bar for creating new layers, drawing new objects and modifying the style of
existing objects.
This drawing tool bar is in fact an ALcyFormatBar
, that is
displayed by the TLcyFormatBarAddOn
.
So if that add-on isn't loaded, the drawing tool bar can't be shown below the map.
The ALcyFormat
of the TLcyDrawingAddOn
can be extended with
additional domain objects. See ALcyDomainObjectSupplier
for more
information on extending the drawing format.
The default shapes of the drawing format are styled using Styled Layer Descriptors (SLD).
Reusing this styling mechanism for custom shapes, is possible through TLcySLDDomainObjectSupplier
.
This addon provides the domain model and the facilities to paint the domain objects on a
flat, 2D map. Interoperability with the TEA Industry Specific Component is provided in the
TLcyDrawingTEAAddOn
.
The API allows for more elaborate customizations.
The actual contents of the format bar is created by an ALcyGUIFactory
, which is exposed in TLcyDrawingFormat.createGUIFactory()
.
The default ALcyGUIFactory
is the TLcyDrawingToolBarFactory
, which can be extended as starting point for a custom implementation.
Replacing this GUI factory with a custom one (possibly extending from TLcyDrawingToolBarFactory
) can be done by:
@Override
protected TLcyDrawingFormat createBaseFormat(){
return new TLcyDrawingFormat(this){
@Override
protected ALcyGUIFactory<Component> createGUIFactory() {
return new CustomGUIFactory();
}
}
}
Note: The format bar factory provided by this add-on is only used for GXY maps.
The one for Lightspeed maps is created in the TLcyLspDrawingAddOn
.
Modifier and Type | Field and Description |
---|---|
static DataFlavor |
DRAWING_FLAVOR
Data flavor for the drawing format.
|
Constructor and Description |
---|
TLcyDrawingAddOn()
The default constructor by which the Lucy frontend will instantiate the drawing add-on
|
Modifier and Type | Method and Description |
---|---|
protected TLcyDrawingFormat |
createBaseFormat()
Returns a new data format for this add-on.
|
protected TLcyFormatTool |
createFormatTool(ALcyFormat aFormat)
Creates a new format tool for the given format.
|
protected ALcyFormat |
createFormatWrapper(ALcyFormat aBaseFormat)
Returns a new data format wrapper for this add-on.
|
protected TLcyPreferencesTool |
createPreferencesTool()
Creates the
TLcyPreferencesTool to be used by this add-on. |
TLcyDrawingFormat |
getDrawingFormat()
Returns the
TLcyDrawingFormat as created by createBaseFormat() . |
TLcyDrawingSettings |
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.
|
getFormat, unplugFrom
getLongPrefix, getLucyEnv, getPreferences, getPreferencesTool, getShortPrefix
getConfigSourceName, getDisplayName, setConfigSourceName, setDisplayName
public static final DataFlavor DRAWING_FLAVOR
Data flavor for the drawing format. It is used for copy and paste support, see
ALcyLayerSelectionTransferHandler
.
The transfer data for this DataFlavor is an com.luciad.lucy.map.ILcyLayerSubsetList
.
All elements in this subset list are guaranteed/required to be drawing domain objects.
public TLcyDrawingAddOn()
protected TLcyDrawingFormat 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 ALcyFormat createBaseFormat() {
return new ALcyFormatWrapper(super.createBaseFormat()){
@Override
protected ILcdGXYLayerFactory createGXYLayerFactory(){
final ILcdGXYLayerFactory delegate = super.createGXYLayerFactory();
return new ILcdGXYLayerFactory(){
@Override
public ILcdGXYLayer createGXYLayer(ILcdModel aModel){
ILcdGXYLayer layer = delegate.createGXYLayer(aModel);
if (layer != null){
ILcdIcon icon = ...;
layer.setIcon(icon);
}
return layer;
}
}
}
}
}
Returns an instance of TLcyDrawingFormat
. One can use
getPreferencesTool().getCompositeWorkspacePreferences()
ALcyProperties
that need to be given to the constructor of
TLcyDrawingFormat
. createBaseFormat
in class ALcyFormatAddOn
getDrawingFormat()
public TLcyDrawingFormat getDrawingFormat()
Returns the TLcyDrawingFormat
as created by createBaseFormat()
. It is
typically used to retrieve the ALcyDomainObjectSupplier
s from it, or to retrieve
the ALcyDomainObjectConverter
using getDomainObjectConverter
.
This method is different from ALcyFormatAddOn.getFormat()
because the format returned by that
method might for example be wrapped with some ALcyFormatWrapper
s, such as
TLcyAsynchronousFormatWrapper
.
TLcyDrawingFormat
.createBaseFormat()
protected final ALcyFormat createFormatWrapper(ALcyFormat aBaseFormat)
ALcyFormatAddOn
Returns a new data format wrapper for this add-on. A format wrapper extends the base format with aspects such as asynchronous painting, mutable file behavior, 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 ALcyFormatAddOn
aBaseFormat
- the base format to wrapALcyFormatWrapper
protected TLcyFormatTool createFormatTool(ALcyFormat aFormat)
ALcyFormatAddOn
Creates a new format tool for the given format. It is used to plug all parts of the format (
e.g. ILcdGXYLayerFactory
, ILcdModelDecoder
, etc.) into
ILcyLucyEnv
.
createFormatTool
in class ALcyFormatAddOn
aFormat
- the format for which to create a toolTLcyFormatTool
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 void plugInto(ILcyLucyEnv aLucyEnv)
ALcyFormatAddOn
Creates and plugs in the add-on's format.
plugInto
in class ALcyFormatAddOn
aLucyEnv
- the Lucy environment to plug intoALcyAddOn.unplugFrom(com.luciad.lucy.ILcyLucyEnv)
public TLcyDrawingSettings getDrawingSettingsForMap(ILcdView aView)
aView
- the view for which the drawing settings must be retrievedaView