Before enabling creation or editing capabilities, make sure that your model defines an IFeatureModelUpdater
.
You typically do that by calling FeatureModelBuilder::editable(true)
when you are creating your model:
auto editableModel = FeatureModelBuilder::newBuilder() .modelMetadata(modelMetadata) .featureModelMetadata(featureModelMetadata) .bounds(modelBounds) .features({}) .editable(true) .build();
To allow users to edit the geometry of military symbols interactively, you must enable the editing behavior in the feature layer builder. This snippet shows you how to do that:
// Create a layer from a military symbols model and make it editable auto layer = FeatureLayer::newBuilder() // .model(militarySymbologyModel) .editable(true) .build();
See this article for more information about editing.
To allow users to insert new military symbols on the map, you must pass the correct IGeometryCreator
to your controller’s Creator
.
You can retrieve the geometry creator from the MilitarySymbologyNode
:
// set up a Creator for the feature and its geometry. auto standard = MilitarySymbology::Standard::MilStd2525b; auto symbol = MilitarySymbol::create(standard, "G*G*GPAR--****X"); auto featureCreator = std::make_shared<MilitarySymbolFeatureCreator>(symbol); // wire creation to the controller (here we're using DefaultController) defaultController->setCreator(Creator::newBuilder().layer(layer).map(map).featureCreator(featureCreator).build());
See this article for more information about creation.