Parameters
- row
- The Row to load.
Exception | Description |
---|---|
ArcGIS.Core.CalledOnWrongThreadException | This method or property must be called within the lambda passed to QueuedTask.Run. |
//See "Change Annotation Text Graphic" for an alternative if TEXTSTRING is missing from the schema await QueuedTask.Run(() => { //annoLayer is ~your~ Annotation layer... // use the inspector methodology var insp = new Inspector(); insp.Load(annoLayer, oid); // make sure TextString attribute exists. //It is not guaranteed to be in the schema ArcGIS.Desktop.Editing.Attributes.Attribute att = insp.FirstOrDefault(a => a.FieldName == "TEXTSTRING"); if (att != null) { insp["TEXTSTRING"] = "Hello World"; //create and execute the edit operation EditOperation op = new EditOperation(); op.Name = "Update annotation"; op.Modify(insp); //OR using a Dictionary - again TEXTSTRING has to exist in the schema //Dictionary<string, object> newAtts = new Dictionary<string, object>(); //newAtts.Add("TEXTSTRING", "hello world"); //op.Modify(annoLayer, oid, newAtts); op.Execute(); } });
//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 });
//assume the geometry used in SelectFeaturesEx() is coming from a //map tool... // //SketchType = SketchGeometryType.Rectangle; //SketchOutputMode = SketchOutputMode.Screen; await QueuedTask.Run(() => { var result = MapView.Active.SelectFeaturesEx(geometry); //Get scene layers with selections //At 2.x - var scene_layers = result.Where(kvp => kvp.Key is FeatureSceneLayer); var scene_layers = result.ToDictionary<FeatureSceneLayer>(); foreach (var kvp in scene_layers) { var scene_layer = kvp.Key as FeatureSceneLayer; var sel_oids = kvp.Value; //If there are attributes then get them if (scene_layer.HasAssociatedFeatureService) { var insp = new Inspector(); foreach (var oid in sel_oids) { insp.Load(scene_layer, oid); //TODO something with retrieved attributes } } } });
Target Platforms: Windows 11, Windows 10