A symbology defines a standard for visualizing domain objects, such as points and lines. The domain object properties determine the used icon and/or style. LuciadLightspeed provides support for painting symbologies. Implementations of standardized symbologies are available in the LuciadLightspeed components:
-
The military symbologies MIL-STD 2525b, MIL-STD 2525c, APP-6A, APP-6B, APP-6C and TTA-106 V4 in the Defense Symbology component
-
The naval symbology S-52, part of the Maritime Standards component
-
ICAO symbology, part of the Aviation Standards component
-
Geosym, part of the Defense Standards component
Painting symbologies for points
The generic mechanisms that LuciadLightspeed provides for painting symbology for points are:
-
Icons:
ILcdIcon
objects to represent the graphical symbols -
An icon painter
TLcdGXYIconPainter
to display the symbol -
An object icon provider
ILcdObjectIconProvider
to link the domain object (point or shape) to its correct icon
The following sections describe each of the involved classes and interfaces in more detail.
Using an ILcdIcon
The interface ILcdIcon
is the core interface for representing a graphical point symbol in LuciadLightspeed. It represents a figure or picture with
a fixed width and height specified in pixels. Its method paint
allows you to paint the icon on any Graphics
instance. Next to the visualization of point or shape data in an ILcdGXYView
, it is also frequently used in a GUI to represent an action, a controller, a layer, and so on.
LuciadLightspeed offers various implementations, of which the most important are:
-
TLcdSymbol
: offers a number of predefined symbols, like a circle, a triangle, and more. The implementation allows you to configure the size, the border color, and the fill color of each icon. -
TLcdIconFactory
: this class contains a number of images that are frequently used in LuciadLightspeed as a GUI icon associated with a certain action, for example an image of a magnifying glass for a zoom action or a polygon image for a polygon controller. -
TLcdMessageIcon
: This class displays a message in a box. Message icons are useful to display messages on anILcdGXYView
. You can use the methodputCornerIcon
, for example, to give a user an indication that the view is loading data. -
TLcdImageIcon
: this class is used to create an icon from an image file. -
TLcdAnchoredIcon
: creates a wrapper icon which is used to anchor an icon with a point other than its center point. -
TLcdHaloIcon
: creates a wrapper icon which is used to add a halo around another icon.
Because the Java Foundation Classes (JFC/Swing) contain a similar interface javax.swing.Icon
, LuciadLightspeed provides two conversion classes TLcdIconSW
and TLcdSWIcon
that are used to wrap ILcdIcon
implementations into an Icon
and the other way around. These classes are useful when you want to use an ILcdIcon
in a Swing class or conversely, an Icon
in a LuciadLightspeed class.
Using a TLcdGXYIconPainter
To visualize ILcdPoint
and ILcdShape
objects on a map using icons, LuciadLightspeed offers the class TLcdGXYIconPainter
. This class is both an implementation of ILcdGXYPainter
and ILcdGXYEditor
, so it can be used for painting and editing on a view. It paints an ILcdIcon
at the location of the ILcdPoint
or the focus point of the ILcdShape
. The painter uses three icons, which you can configure independently: one to paint as default, one to paint when the object
is selected, and one to paint snapping target points of the object. Program: Using a link:../../../reference/LuciadLightspeed/com/luciad/view/gxy/painter/TLcdGXYIconPainter.html[TLcdGXYIconPainter
] to visualize point data illustrates its use by creating a layer that is initialized with this painter.
TLcdGXYIconPainter
to visualize point data (from samples/gxy/shapes/MainPanel
)
painter.setIcon(new TLcdImageIcon("images/mif/mif20_airplane.gif"));
painter.setSelectedIcon(new TLcdSymbol(TLcdSymbol.CIRCLE, 22, Color.red));
Using an ILcdObjectIconProvider
Most applications require the use of a set of icons, each to be used with a different group of points or shapes. To support
this, LuciadLightspeed provides the interface ILcdObjectIconProvider
, which is used to retrieve an icon for a given Object
instance. A typical implementation of this interface has an internal icon repository from which icons are returned for different
objects, based on their type, properties, or features. Program Program: Sample implementation of ILcdObjectIconProvider
contains a simple implementation that always returns the same icon.
ILcdObjectIconProvider
/**
* This implementation of {@code ILcdObjectIconProvider} always returns
* the same icon, regardless of the supplied object.
*/
public class MyIconProvider implements ILcdObjectIconProvider {
private final ILcdIcon fIcon = new TLcdSymbol(TLcdSymbol.FILLED_RECT, 5, Color.BLACK, Color.BLACK);
@Override
public ILcdIcon getIcon(Object aObject) throws IllegalArgumentException {
return fIcon;
}
@Override
public boolean canGetIcon(Object aObject) {
return true;
}
}
To use icon providers with a TLcdGXYIconPainter
, you can use the methods setSelectionIconProvider
and setIconProvider
.