The majority of formats require the same two steps for visualization on a Lightspeed view. To visualize MGCP data:
-
Decode the data into an
ILcdModel
using anILcdModelDecoder
. -
Create an
ILspLayer
for theILcdModel
and add it to theILspView
.
//First create the model
ILcdModelDecoder decoder =
new TLcdCompositeModelDecoder(TLcdServiceLoader.getInstance(ILcdModelDecoder.class));
ILcdModel model = decoder.decode(sourceName);
//Create a layer for the model
Collection<ILspLayer> layers = new TLspMGCPLayerFactory().createLayers(model);
final ILspLayer layer = layers.stream().findFirst().get();
//Add the layer to the Lightspeed view (an ILspView)
view.addLayer(layer);
This code snippet uses the The model decoder class that is actually responsible for decoding MGCP data is the
|
This results in an MGCP layer configured with a scale range and model query configuration, to prevent an overload of the map with features.
-
Base features, such as primary roads, cities, woods, and water, are always visible.
-
More feature types, such as roads, rivers, and railways, become visible between the scales 1:100000 and 1:400000.
-
All features are visible once users zoom in below scale 1:100000.
-
Labels become visible from map scale 1:100000 upwards.
See Visualizing Vector Data for more information about visualizing and styling vector data.
The MGCP standard is primarily intended for maps printed on paper. It uses transparent colors and fill patterns for several features. In a LuciadLightspeed application, the map background color may filter through the feature colors as a result. Therefore, it is recommended to apply a white background color to your map view.
To set a white background in a Lightspeed view:
view.setBackground(Color.WHITE);
To set a white background in Lucy, refer to the How to change the background color of the map documentation.
You may want to update the images for the navigation controls, because they are barely visible on a white background. |