// Modifies the geometry of an annotation feature in the specified annotation layer. await QueuedTask.Run(() => { //Don't use 'Shape'....Shape is the bounding box of the annotation text. This is NOT what you want... // //var insp = new Inspector(); //insp.Load(annotationLayer, objectId); //var shape = insp["SHAPE"] as Polygon; //...wrong shape... //Instead, we must use the AnnotationProperties //annotationLayer is ~your~ Annotation layer var insp = new Inspector(); insp.Load(annotationLayer, objectId); AnnotationProperties annoProperties = insp.GetAnnotationProperties(); var shape = annoProperties.Shape; if (shape.GeometryType != GeometryType.GeometryBag) { var newGeometry = GeometryEngine.Instance.Move(shape, 10, 10); annoProperties.Shape = newGeometry; insp.SetAnnotationProperties(annoProperties); EditOperation op = new EditOperation { Name = "Change annotation angle" }; op.Modify(insp); if (!op.IsEmpty) { var result = op.Execute(); //Execute and ExecuteAsync will return true if the operation was successful and false if not } } });
Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)