The MapViewer Federate

I’ll start a series of posts to show how to create a little more complex Federation. This post will intruduce the MapViewer.

The MapViewer is a Federate that can show military units in a map. I’ll use some conceps already shown in previous posts like Modular FOM and Class Hierarchy and Fixed Records.

If you want to give a look and/or compile the sources than you can checkout it from the github repository here. You will need Maven to compile. Don’t forget to add Portico into your local repository ( a compiled version is in 3rdparty  folder – v2.0.0 ).

You can download the runnable version from here. The WAR file you must deploy to Tomcat 7 and the JAR files you can run from terminal:

#> java -jar tank.jar

The Portico JAR is embedded. No configuration is needed.

The project will contemplate a Map Federate, an Aircraft Federate and a Tank Federate, but will be ready to extend to show other units by extending BasicUnit.

You can find a video here.

The user interface uses OpenLayers and OpenStreetMap but be adivised to read the OpenStreetMap copyright. before use it in your applications ( I’m using it just for teaching ).

The interface uses Ajax requests to get unit positions in GeoJSON format. The server answers to this requests by using a Struts2 action to create the GeoJSON data from the Tanks list. The Tanks list you already know how to create.

MapViewer: Main screen

MapViewer: Main screen

I’ll give a Log system too. The log content comes directly from the Federate and from the Ambassador. A little screen to see units details will complete the features.

The Tank Federate will not be too different from that I’ve shown before but you’ll find a complete code into the tank folder and I’ll release a compiled JAR soon.

MapViewer Tank Federate

Tank Federate

To keep the simply, I will not create a full simulation. All units will moves on a staight line from left to right ( longitudinal moviment ). I’ll achieve this by adding 0.001 to the longitude value.

Unit moviment

Unit moviment

Pin icons from Map Icons Collection.  I’ll start working on next post and show the SOM and FOM. You can use my work as you wish, but it should give me proper credit.

Go to part 2

Add Comment