var featSceneLayer = MapView.Active.Map.GetLayersAsFlattenedList() .OfType<FeatureSceneLayer>().FirstOrDefault(); if (!featSceneLayer.HasAssociatedFeatureService || !featSceneLayer.IsEditable) return;//not supported //TODO continue editing here...
//must support editing! //var featSceneLayer = ... ; if (!featSceneLayer.HasAssociatedFeatureService || !featSceneLayer.IsEditable) return; //Check geometry type...must be point in this example if (featSceneLayer.ShapeType != esriGeometryType.esriGeometryPoint) return; 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();//fyi, no await
//must support editing! //var featSceneLayer = .... ; if (!featSceneLayer.HasAssociatedFeatureService || !featSceneLayer.IsEditable) return; var delOp = new EditOperation() { Name = "Delete selected features" }; //Assuming we have a selection on the layer... delOp.Delete(featSceneLayer, featSceneLayer.GetSelection().GetObjectIDs()); await delOp.ExecuteAsync();//await if needed but not required
//must support editing! var featSceneLayer = MapView.Active.Map.GetLayersAsFlattenedList() .OfType<FeatureSceneLayer>().FirstOrDefault(); if (!featSceneLayer.HasAssociatedFeatureService || !featSceneLayer.IsEditable) return; var ok = await 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); return editOp.Execute();//synchronous flavor });
Target Platforms: Windows 11, Windows 10, Windows 8.1