laptop and a wrench

不具合

The annotation feature created by ArcGIS Pro SDK fails to rotate when MapView is rotated by a specified angle.

最後に公開された状態: March 30, 2020 ArcGIS Pro SDK for .NET
不具合 ID 番号 BUG-000129683
送信されましたMarch 26, 2020
最終更新日June 5, 2024
適用対象ArcGIS Pro SDK for .NET
見つかったバージョン2.5
オペレーティング システムWindows OS
オペレーティング システムのバージョン10.0 64 Bit
ステータスWill Not Be Addressed

参考情報

The code here is for creating a point annotation. Create a two-point annotation if staying horizontal with the map is not desired. A replacement C# file doing this is as below: using System; using System.Linq; using System.Threading.Tasks; using System.Collections.Generic; using ArcGIS.Core.CIM; using ArcGIS.Core.Data; using ArcGIS.Core.Geometry; using ArcGIS.Desktop.Editing; using ArcGIS.Desktop.Framework.Dialogs; using ArcGIS.Desktop.Framework.Threading.Tasks; using ArcGIS.Desktop.Mapping; using ArcGIS.Desktop.Editing.Attributes; namespace AGP_AnnoEdit { internal class AddAnnoTool : MapTool { private int _seq = 0; public AddAnnoTool() { IsSketchTool = true; UseSnapping = true; SketchOutputMode = ArcGIS.Desktop.Mapping.SketchOutputMode.Map; SketchType = SketchGeometryType.Point; } protected override Task OnToolActivateAsync(bool active) { return base.OnToolActivateAsync(active); } protected override async Task OnSketchCompleteAsync(Geometry geometry) { bool creationResult = false; await QueuedTask.Run(() => { var map = ArcGIS.Desktop.Mapping.MapView.Active.Map; AnnotationLayer annoLayer = map.GetLayersAsFlattenedList().OfType().FirstOrDefault(); creationResult = StoreNewFeatureAnno(annoLayer, geometry, (++_seq).ToString()); }); return creationResult; } // patterned after https://github.com/Esri/arcgis-pro-sdk/wiki/ProConcepts-Editing-Annotation internal static bool StoreNewFeatureAnno(AnnotationLayer annoLayer, ArcGIS.Core.Geometry.Geometry geometry, string textStr) { bool creationResult = false; string message = String.Empty; // Create an edit operation var createOperation = new EditOperation(); createOperation.Name = string.Format("Create {0}", annoLayer.Name); createOperation.SelectNewFeatures = false; // get the anno feature class var fc = annoLayer.GetFeatureClass() as ArcGIS.Core.Data.Mapping.AnnotationFeatureClass; // get the featureclass CIM definition which contains the labels, symbols var fcDefinition = fc.GetDefinition() as ArcGIS.Core.Data.Mapping.AnnotationFeatureClassDefinition; var labels = fcDefinition.GetLabelClassCollection(); var symbols = fcDefinition.GetSymbolCollection(); // make sure there are labels, symbols if ((labels.Count == 0) || (symbols.Count == 0)) return false; // use the first label class var label = labels[0]; // each label has a textSymbol // the symbolName *should* be the symbolID to be used var symbolName = label.TextSymbol.SymbolName; int symbolID = -1; if (!int.TryParse(symbolName, out symbolID)) { // int.TryParse fails - attempt to find the symbolName in the symbol collection foreach (var symbol in symbols) { if (symbol.Name == symbolName) { symbolID = symbol.ID; break; } } } // no symbol? if (symbolID == -1) return false; // load the schema Inspector insp = new Inspector(true); insp.LoadSchema(annoLayer); // ok to access AnnotationClassID this way - it is guaranteed to exist insp["AnnotationClassID"] = label.ID; insp["SymbolID"] = symbolID; CIMTextSymbol textSymbol = SymbolFactory.Instance.ConstructTextSymbol(CIMColor.CreateRGBColor(0, 0, 0), 12, "Arial", "normal"); double tolerance = geometry.SpatialReference?.XYTolerance ?? 0.001; // Create a two point line from the input point so that it remains in a fixed position when the map is rotated. Polyline polyline = Create2PointPolylineFromPoint(geometry as MapPoint, tolerance * 2.0, 0); // y=0 so horizontal // set up some properties AnnotationProperties annoProperties = insp.GetAnnotationProperties(); annoProperties.FontName = textSymbol.FontFamilyName; annoProperties.FontSize = textSymbol.GetSize(); annoProperties.TextString = textStr; annoProperties.VerticalAlignment = ArcGIS.Core.CIM.VerticalAlignment.Bottom; annoProperties.HorizontalAlignment = ArcGIS.Core.CIM.HorizontalAlignment.Center; annoProperties.Shape = polyline as Geometry; insp.SetAnnotationProperties(annoProperties); // Queue feature creation createOperation.Create(annoLayer, insp); try { // Execute the operation creationResult = createOperation.Execute(); if (!creationResult) message = createOperation.ErrorMessage; } catch (GeodatabaseException exObj) { message = exObj.Message; } if (!string.IsNullOrEmpty(message)) MessageBox.Show(message); return creationResult; } internal static Polyline Create2PointPolylineFromPoint(MapPoint point, double xtol, double ytol) { if (point == null) return null; // use the starting point and offsets to construct the points var point1 = GeometryEngine.Instance.Move(MapPointBuilder.CreateMapPoint(point), -xtol, -ytol) as MapPoint; var point2 = GeometryEngine.Instance.Move(MapPointBuilder.CreateMapPoint(point), xtol, ytol) as MapPoint; return PolylineBuilder.CreatePolyline(new List() { point1, point2 }); } } }

再現の手順

不具合 ID: BUG-000129683

ソフトウェア:

  • ArcGIS Pro SDK for .NET

バグのステータスが変更されたときに通知を受け取る

Esri Support アプリのダウンロード

このトピックについてさらに調べる

ArcGIS エキスパートのサポートを受ける

テクニカル サポートへのお問い合わせ

Esri Support アプリのダウンロード

ダウンロード オプションに移動