Class TLcyDrawingAddOn
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
.
Customizing the format bar
Through the configuration file
All the actions and active settables available in the format bar are configured through the configuration file of this add-on. This allows for the regular customizations:- Changing icons, names, tool tips, ...
- Changing the location of the entries
- Removing entries
Through the API
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
.
- Since:
- 8.2
-
Field Summary
-
Constructor Summary
ConstructorDescriptionThe default constructor by which the Lucy frontend will instantiate the drawing add-on -
Method Summary
Modifier and TypeMethodDescriptionprotected TLcyDrawingFormat
Returns a new data format for this add-on.protected TLcyFormatTool
createFormatTool
(ALcyFormat aFormat) Creates a new format tool for the given format.protected final ALcyFormat
createFormatWrapper
(ALcyFormat aBaseFormat) Returns a new data format wrapper for this add-on.protected TLcyPreferencesTool
Creates theTLcyPreferencesTool
to be used by this add-on.Returns theTLcyDrawingFormat
as created bycreateBaseFormat()
.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.Methods inherited from class com.luciad.lucy.addons.ALcyFormatAddOn
getFormat, unplugFrom
Methods inherited from class com.luciad.lucy.addons.ALcyPreferencesAddOn
getLongPrefix, getLucyEnv, getPreferences, getPreferencesTool, getShortPrefix
Methods inherited from class com.luciad.lucy.addons.ALcyAddOn
getConfigSourceName, getDisplayName, setConfigSourceName, setDisplayName
-
Field Details
-
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.
-
-
Constructor Details
-
TLcyDrawingAddOn
public TLcyDrawingAddOn()The default constructor by which the Lucy frontend will instantiate the drawing add-on
-
-
Method Details
-
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
for theTLcyDrawingFormat
. One can usegetPreferencesTool().getCompositeWorkspacePreferences()
ALcyProperties
that need to be given to the constructor ofTLcyDrawingFormat
.- Specified by:
createBaseFormat
in classALcyFormatAddOn
- Returns:
- a new format for this add-on
- See Also:
-
getDrawingFormat
Returns the
TLcyDrawingFormat
as created bycreateBaseFormat()
. It is typically used to retrieve theALcyDomainObjectSupplier
s from it, or to retrieve theALcyDomainObjectConverter
usinggetDomainObjectConverter
.This method is different from
ALcyFormatAddOn.getFormat()
because the format returned by that method might for example be wrapped with someALcyFormatWrapper
s, such asTLcyAsynchronousFormatWrapper
.- Returns:
- the
TLcyDrawingFormat
. - See Also:
-
createFormatWrapper
Description copied from class: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).
- Specified by:
createFormatWrapper
in classALcyFormatAddOn
- Parameters:
aBaseFormat
- the base format to wrap- Returns:
- a new format for this add-on
- See Also:
-
createFormatTool
Description copied from class: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.) intoILcyLucyEnv
.- Overrides:
createFormatTool
in classALcyFormatAddOn
- Parameters:
aFormat
- the format for which to create a tool- Returns:
- the created
TLcyFormatTool
-
createPreferencesTool
Description copied from class:ALcyPreferencesAddOn
Creates the
TLcyPreferencesTool
to be used by this add-on. Overwriting this method for example allows to register additionalILcyPropertyConverter
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 asString
,int
,double
, etc.The default implementation creates a new tool based on the
ALcyAddOn.getConfigSourceName()
and the add-on's prefixes.- Overrides:
createPreferencesTool
in classALcyPreferencesAddOn
- Returns:
- the created
TLcyPreferencesTool
.
-
plugInto
Description copied from class:ALcyFormatAddOn
Creates and plugs in the add-on's format.
- Overrides:
plugInto
in classALcyFormatAddOn
- Parameters:
aLucyEnv
- the Lucy environment to plug into- See Also:
-
getDrawingSettingsForMap
Method to retrieve the drawing settings for a certain view.- Parameters:
aView
- the view for which the drawing settings must be retrieved- Returns:
- the drawing settings for the view
aView
-