LuciadMobile Samples

Try out examples of what LuciadMobile has to offer

The samples are small applications that illustrate one or more functionalities of LuciadMobile. The samples are a good starting point to create your first LuciadMobile application, since you can combine and customize the demonstrated functionalities to suit the requirements of your application.

All Military Symbols Sample

The all military symbols sample provides a graphical overview of all available military symbols.

You can change which symbology to display by selecting another symbology from the menu.

Arrows Sample

The Arrows sample illustrates the use of ELcdLineInterpolation and TLcdLineMarker to create layers that contain arrows that are discretized as quadratic Bezier splines.

This sample starts with an empty layer and contains a menu item that allows creation of new arrows. The creation of arrows is performed by dragging a smooth curve. Arrows can be edited after a long-press on the arrow you want do edit.

Balloons Sample

The balloons sample illustrates the use of ALcdBalloonProvider to define a completely custom balloon style.

In contrast to the default balloon style, the balloons in this sample are not center aligned but left aligned. This sample also uses a custom nine patch background (res/drawable/balloon.9.png) to provide a different look for the balloons.

Bitmap Icons Sample

The Bitmap Icons sample illustrates the use of bitmaps and composite drawables to render icons.

In this sample a single TLcdFeatureLayer is created with 20 randomly distributed points.

The icons are drawn as bitmaps using the default BitmapDrawable provided by the Android API. Selected points are drawn with a composite drawable that paints a circular gradient underneath the selected icon.

You can select and deselect points by tapping the icons. To edit points, long-press an icon and select Edit Geometry from the pop-up menu.

COP Sample

The Common Operational Picture (COP) sample is an all-in-one sample demonstrating various functions of the LuciadMobile API. It consists of two main components: a client application and a server application.

The COP sample offers the following functionality:

  • Integration with on-board GPS device to show your current position on the map
  • Creation of features and annotations on the map
  • Creation of medical evacuation (MEDEVAC) requests
  • Use of the on-board camera to create SPOT reports
  • Retrieval of geographical data of your surroundings using a remote gazetteer
  • Synchronization of data between multiple mobile devices using a remote service

Synchronization of data depends on an external server running the COP web services. A COP sync account must be defined in order for the sample to find this server. You can create a COP sync account under the 'Accounts' section of the 'Settings' application of your Android device.

Custom Controllers Sample

The Custom Controllers Sample illustrates how you can implement and use controllers.

In this sample, a few custom controllers can be activated from the options menu. Three controllers can be used:

  • Show Touch Points: paints a red circle where the screen is touched.
  • Ruler (Geodetic): makes it possible to create a polyline, and measure the geodetic distance along it.
  • Ruler (Rhumbline): makes it possible to create a polyline, and measure the rhumbline distance along it.

Custom Data Format Sample

The Custom Data Format sample illustrates how to decode and display data stored in a custom format file.

This sample shows how you can decode a custom-format data file that describes flight plans and way points, and how you can display those data elements on top of a background layer. The sample also illustrates how you can label the data elements using balloons.

File Loader Sample

The File Loader sample illustrates how to load GeoPackage, LVDB, LRDB and KML files from the storage on a device. File will automatically be decoded and added to a map view.

First Sample

The First Sample illustrates how to set up a basic application with the LuciadMobile API.

In this sample a background raster layer, representing the earth, and a single TLcdFeatureLayer with two features (a polygon and a polyline) are created.

The shapes are styled with a default ALcdFeaturePainter. This painter defines the basic styling settings, line and fill color for example, for features drawn in the features layer.

To select or deselect a feature, tap the feature. To edit a feature, long-press the feature and select Edit Geometry from the menu.

GeoCanvas Sample

The GeoCanvas sample illustrates how to use the geocanvas to customize painting.

You can use the options menu to add new points.

Geodesy Sample

The Geodesy sample illustrates how to use the geodesy API to perform distance, forward azimuth and interpolation calculations.

Move the two points of the line to change the measurements. The bottom panel displays the distance between the two points, the forward azimuth from one point to the other, and an interpolated point located halfway between the two points.

Labeling Sample

Sample to demonstrate decluttered labeling.

When starting the sample, it first shows the states of the U.S. with their abbreviated name as label. States with a high population have a higher chance of their name being painted. As you zoom in and more space is available, the full name of every state will become visible.

When zooming in even further, cities and rivers will also become visible. Cities with a high population have a larger point and label than cities with a low population.

This sample demonstrates how to paint decluttered labels for points, polylines and polygons. The sample uses three layers with vector data from the US. Each of these layers uses a separate painter that defines the specific styling that should be applied to the vector data.

To paint labels, every painter overrides the ALcdFeaturePainter#paintLabel method and uses the ALcdLabelCanvas to paint labels. Depending on the properties of a feature, different styling for both the label and its shape is applied.

Use the options menu to toggle the visibility of the different layers.

Location Sample

The Location sample uses the TLcdLocationManager to display a single point icon and its coordinate at the current device (GPS) location. The sample also displays a circle, of which the radius indicates the accuracy of the location measurement.

Longitude-Latitude Grid Sample

The Longitude-Latitude Grid sample illustrates the use of the TLcdGridLayer to draw a longitude-latitude grid. The grid will dynamically adjust the size between grid lines when the scale of the map changes.

MGRS Grid Sample

The MGRS Grid illustrates the use of the TLcdGridLayer to draw an MGRS for a specific UTM or UPS zone. It also uses a TextView to show the most general MGRS coordinate for the area currently in view.

Military Symbols Sample

The military symbols sample illustrates how to create and draw military icons and shapes.

The sample contains some preconfigured military icons and shapes that are distributed over the map. The military icons are points that are rendered using an ALcdMilitaryIconSymbol drawable. To military shapes are lines and areas that require an ALcdMilitaryShapeSymbol as a style.

By long-pressing an icon or shape, the selected military symbol can be edited. To create a new military icon, choose the draw icon action from the options menu. Military shapes can be drawn by selecting draw graphic. A new activity will be started allowing you to choose the military symbol. Depending on whether you're drawing an icon or a shape, a different set of symbols will be available to choose from.

Note: In the symbol chooser, you can add new symbols by pressing the Add New button (star icon). You can also edit one of the listed symbols by long-pressing a symbol.

Multi Map Sample

The Multi Map sample is an extension of the First Sample. It displays the map data in three separate TLcdMapView instances.

The first map shows a regular map, the second one is rotated at 45 degrees, and the rotation of the third map is coupled with the onboard compass of the Android device. Each map displays the same shared content. If geometries are modified in one map, those changes will be displayed in the other maps as well.

Orientation Sample

The Orientation sample is an extension of the First Sample. It allows you to change the map's orientation policy from the options menu.

The following orientation policies are available:

  • Default: The map's rotation is based on the device's orientation, either portrait or landscape orientation.
  • Magnetic North: The map is aligned with the magnetic north reading from the device's compass.
  • True North: The map is aligned with the true north. This combines the reading from the device's compass with the devices current location in order to calculate true north. If a location fix is not available true north cannot be calculated and the map will not orient itself.

Raster Tile Sets Sample

The Raster Tile Sets sample illustrates the loading of various types of raster tile sets that are support by LuciadMobile. This includes:

  • Static images (JPEG, PNG)
  • LuciadMobile TileRaster Database (LRDB)
  • Luciad Fusion
  • Bing Maps
  • WMTS
Example data sets for each of these types can be loaded from the options menu.

Choosing LRDB will load an LRDB file from the sdcard of the device. The LRDB file in question contains a low resolution version of the NASA Blue Marble imagery combined with some higher resolution aerial imagery in the Los Angeles, USA region.

The Luciad Fusion option pops up a dialog allowing you to enter a URL referring to a Luciad Fusion server. After connecting to the server a list of available coverages will be presented. Choosing a coverage from the list will add a layer to the map displaying the coverage.

Selecting Bing Maps will connect to Microsofts Bing Maps server and display global high resolution aerial imagery. In order to access the Bing Maps servers you will have to enter a Bing Maps key. Your Bing Maps key can be entered in a dialog box or it can be placed in a file named bing-key.txt which should be placed on the SD card of your device in the folder MapData.

Choosing WMTS will pop up a dialog for the WMTS server URL. When pressing OK, the sample will retrieve the list of available WMTS layers from the server and display the subset of those that can be displayed by LuciadMobile. Choosing a WMTS layer name creates and adds a new layer to the map that displays the WMTS layer.

Scale Dependent Icons Sample

The Scale Dependent Icons sample illustrates the use of drawables to render different icons depending on the current view's scale. As you zoom in on the icons they will grow in size in discrete steps. When zoomed in far enough the dot icon changes to a bitmap icon.

In this sample a single TLcdFeatureLayer is created with 20 randomly distributed points. To select and deselect points, tap the icons. To edit points, long-press an icon and select Edit Geometry from the pop-up menu.

Shape Annotation Sample

The Shape Annotation sample illustrates how to annotate features interactively.

This sample is an extension of the Creation Sample. It allows the user to annotate features with a single text string. To create an annotation, long-press a feature and select Annotate from the pop-up menu. To view the annotation of a feature, tap the feature briefly. A balloon containing the annotation appears.

Shape Creation Sample

The Shape Creation sample illustrates how features can be created interactively.

In this sample, feature creation is initiated from the options menu. You can create either lines or areas:

  • Creating lines: tap the screen to place the vertices of the line. Alternatively, drag your finger across the screen to draw the line in free-hand mode.
  • Creating areas: creating areas is similar to creating lines. Either tap the screen to place vertices, or create the area in free-hand mode.

Simple Icons Sample

This sample illustrates the use of a TLcdFeatureLayer to display points as icons.

In this sample, a single TLcdFeatureLayer is created with randomly distributed points. Styling of the points is performed using the default TLcdDrawableProvider. The icons are drawn as simple circular disks using a custom Drawable implementation. Select or deselect points by tapping the feature. Edit features by long-pressing an icon, and selecting Edit Geometry from the pop-up menu.

Terrain Analysis Sample

Sample to demonstrate the terrain analysis features such as terrain sampling and line-of-sight.

In this sample the green dot represents the user's location. The white objects are targets. Depending on which element you tap, a different LOS computation is executed.

  • Tapping on the user will create a TLcdLOSViewshedOperation.
  • Tapping on one of the points creates a TLcdLOSPoint2PointOperation from the user to the point.
  • Tapping on the polyline creates a TLcdLOSPoint2LineOperation from the user to the polyline.
The LOS operations are automatically executed and visualized using the TLcdLOSLayer.

Use the options menu to change the accuracy setting of the LOS or to change the color map that is used for visualization. Points and lines can also be moved by long pressing on them and selecting the edit geometry option.

This sample also contains a TLcdRasterTileSetLayer layer to visualize elevation data from an ALcdRasterTileSetModel. The elevation data is visualized using the default TLcdElevationColorMap.

Track Feed Sample

Sample to demonstrate how to consume a live track feed from a network service.

This sample shows track positions that are randomly generated by the COP web services. Tracks are displayed as airplane icons rotated according to their heading. Communication between client and server is via WebSockets.

This sample requires a server running the COP web services. A COP sync account must be defined in order for the sample to find the track server. You can create a COP sync account under the 'Accounts' section of the 'Settings' application of your Android device.

View Decorator Sample

The View Decorator sample illustrates how you can add custom view decorations.

This sample shows four different types of decorations. You can activate a decoration type by selecting it from the options menu. The following decorations can be activated:

  • A statistics overlay, showing the current frames per seconds, memory usage, and so on
  • A scale overlay, showing a bar that illustrates distances on the map
  • A simple compass, pointing North
  • A compass drawn at the edges of the screen

World Sample

The World sample illustrates the loading and painting of a larger LVDB file. It illustrates how LuciadMobile handles large datasets by loading the data asynchronously.