The majority of formats require the same two steps for visualization on a GXY view. To visualize MGCP data:

  1. Decode the data into an ILcdModel using an ILcdModelDecoder.

  2. Create an ILcdGXYLayer for the ILcdModel and add it to the ILcdGXYView.

//First create the model
ILcdModelDecoder decoder =
    new TLcdCompositeModelDecoder(TLcdServiceLoader.getInstance(ILcdModelDecoder.class));
ILcdModel model = decoder.decode(sourceName);

ILcdGXYLayer layer = new TLcdMGCPGXYLayerFactory().createGXYLayer(model);
//Wrap the layer with an async layer wrapper to ensure
//that the view remains responsive while data is being painted
layer = ILcdGXYAsynchronousLayerWrapper.create(layer);

//Add the async layer to the GXY view (an ILcdGXYView)
view.addGXYLayer(layer);

This code snippet uses the TLcdCompositeModelDecoder, initialized with all model decoders available in the service registry.

The model decoder class that is actually responsible for decoding MGCP data is the TLcdMGCPModelDecoder.

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 GXY 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.