Visualizing Military Symbology data on a map requires two steps:
-
Create an
IFeatureModel
containing the data. The model is created and not decoded from disk, because the military symbology standard does not describe a file format. -
Create a
FeatureLayer
for the model and add it to theMap
.
// Create the coordinate reference in which the model will be defined. auto crs = TestCrs::epsg4326(); // Create an APP-6 symbol "unmanned aerial vehicle unit" and set a value for its text modifier "Unique Designation". auto symbol = MilitarySymbol::create(MilitarySymbology::Standard::App6d, "10060100001103000000"); symbol->putValue(MilitarySymbol::Modifier::UniqueDesignation, "Regular"); // Copy the symbol to a Feature instance and a point geometry. Feature emptyFeature = Feature::newBuilder().dataType(MilitaryDataModel::getSymbolType()).build(); auto featureGeometry = GeometryFactory::createPoint(crs, 0, 27, 46); auto feature = symbol->copyToFeature(emptyFeature, featureGeometry); // Declare the model metadata. auto modelMetadata = ModelMetadata::newBuilder().title("My Symbology Model").build(); auto featureModelMetadata = FeatureModelMetadata::newBuilder().dataModel(MilitaryDataModel::get()).reference(crs).build(); auto modelBounds = GeometryFactory::createBounds(crs, featureGeometry->getLocation(), 0, 0, 0); // Build an IFeatureModel containing only the feature we just created. auto militarySymbologyModel = FeatureModelBuilder::newBuilder() .modelMetadata(modelMetadata) .featureModelMetadata(featureModelMetadata) .bounds(modelBounds) .features({feature}) .build(); // Finally, put the model in a layer, and add it to the map. // A default IFeaturePainter is automatically deduced from the model's data model. auto layer = FeatureLayer::newBuilder().model(militarySymbologyModel).build(); map->getLayerList()->add(layer);
See this article if you want to customize the styling of your military symbols.