Use the extension method "CanEditData" to determine if the data represented by a MapMember can be edited independently of the TOC Editable state.
{
featSceneLayer = MapView.Active.Map.GetLayersAsFlattenedList()
.OfType<FeatureSceneLayer>().FirstOrDefault();
if (!featSceneLayer.HasAssociatedFeatureService ||
!featSceneLayer.IsEditable)
{
//not supported - exit the function
}
//TODO continue editing here...
}
{
//must support editing!
if (!featSceneLayer.HasAssociatedFeatureService ||
!featSceneLayer.IsEditable)
{
//not supported - exit the function
}
//Check geometry type...must be point in this example
var editOp = new EditOperation()
{
Name = "Create new 3d point feature",
SelectNewFeatures = true
};
var attributes = new Dictionary<string, object>();
//mapPoint contains the new 3d point location
attributes.Add("SHAPE", mapPoint);
attributes.Add("TreeID", "1");
editOp.Create(featSceneLayer, attributes);
editOp.ExecuteAsync();
}
{
if (!featSceneLayer.HasAssociatedFeatureService ||
!featSceneLayer.IsEditable)
return;
// Note: call within QueuedTask.Run()
{
var delOp = new EditOperation()
{
Name = "Delete selected features"
};
//Assuming we have a selection on the layer...
delOp.Delete(featSceneLayer, featSceneLayer.GetSelection().GetObjectIDs());
delOp.ExecuteAsync();
}
}
{
//must support editing!
if (!featSceneLayer.HasAssociatedFeatureService ||
!featSceneLayer.IsEditable)
return;
// Note: call within QueuedTask.Run()
{
var editOp = new EditOperation()
{
Name = "Edit FeatureSceneLayer Attributes",
SelectModifiedFeatures = true
};
//make an inspector
var inspector = new Inspector();
//get the attributes for the specified oid
inspector.Load(featSceneLayer, oid);
inspector["PermitNotes"] = "test";//modify
editOp.Modify(inspector);
editOp.Execute();//synchronous flavor
}
}
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)