没有做网站经验可以学seo吗,广州建站,河南网站备案所需资料,中国制造网外贸平台怎么注册ArcGIS Pro SDK #xff08;七#xff09;编辑 13 注解 文章目录 ArcGIS Pro SDK #xff08;七#xff09;编辑 13 注解1 注释构建工具2 以编程方式启动编辑批注3 更新批注文本4 修改批注形状5 修改批注文本图形6 接地到网格 环境#xff1a;Visual Studio 2022 .NET6 …ArcGIS Pro SDK 七编辑 13 注解 文章目录 ArcGIS Pro SDK 七编辑 13 注解1 注释构建工具2 以编程方式启动编辑批注3 更新批注文本4 修改批注形状5 修改批注文本图形6 接地到网格 环境Visual Studio 2022 .NET6 ArcGIS Pro SDK 3.0 1 注释构建工具
// 在您的 config.daml 中设置 categoryRefID
// tool id... categoryRefIDesri_editing_construction_annotation captionCreate Anno ...// 在构造函数中选择 Sketch 类型 Point 或 Line 或 BezierLine...
internal class AnnoConstructionTool : MapTool
{public AnnoConstructionTool(){IsSketchTool true;UseSnapping true;SketchType SketchGeometryType.Point;}protected async override Taskbool OnSketchCompleteAsync(Geometry geometry){if (CurrentTemplate null || geometry null)return false;// 创建编辑操作var createOperation new EditOperation();createOperation.Name string.Format(Create {0}, CurrentTemplate.Layer.Name);createOperation.SelectNewFeatures true;var insp CurrentTemplate.Inspector;var result await QueuedTask.Run(() {// 获取注释属性类AnnotationProperties annoProperties insp.GetAnnotationProperties();// 设置自定义注释属性annoProperties.TextString 自定义文本;annoProperties.Color ColorFactory.Instance.RedRGB;annoProperties.FontSize 24;annoProperties.FontName Arial;annoProperties.HorizontalAlignment ArcGIS.Core.CIM.HorizontalAlignment.Right;annoProperties.Shape geometry;// 将注释属性分配回检查器insp.SetAnnotationProperties(annoProperties);// 队列特征创建createOperation.Create(CurrentTemplate.Layer, insp);// 执行操作return createOperation.Execute();});return result;}2 以编程方式启动编辑批注
var plugin FrameworkApplication.GetPlugInWrapper(esri_editing_EditVerticesText);
if (plugin.Enabled)((ICommand)plugin).Execute(null);3 更新批注文本
await QueuedTask.Run(()
{// annoLayer 是您的注释图层...// 使用检查器方法学// 在 2.x 版本中 - var insp new Inspector(true);var insp new Inspector();insp.Load(annoLayer, oid);// 获取注释属性AnnotationProperties annoProperties insp.GetAnnotationProperties();// 设置属性annoProperties.TextString Hello World;// 将注释属性分配回检查器insp.SetAnnotationProperties(annoProperties);// 创建和执行编辑操作EditOperation op new EditOperation();op.Name Update annotation;op.Modify(insp);op.Execute();
});4 修改批注形状
await QueuedTask.Run(() {// 不要使用 Shape....Shape 是注释文本的边界框这不是您想要的...// 在 2.x 版本中 - var insp new Inspector(true);var insp new Inspector();insp.Load(annoLayer, oid);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();op.Name Change annotation angle;op.Modify(insp);op.Execute();}});5 修改批注文本图形
await QueuedTask.Run(() {var selection annoLayer.GetSelection();if (selection.GetCount() 0)return;// 使用第一个选中的要素// 在 2.x 版本中 - var insp new Inspector(true);var insp new Inspector();insp.Load(annoLayer, selection.GetObjectIDs().FirstOrDefault());// 如果不是注释要素则应返回 null 的 getAnnoPropertiesAnnotationProperties annoProperties insp.GetAnnotationProperties();// 获取文本图形CIMTextGraphic textGraphic annoProperties.TextGraphic;// 修改文本textGraphic.Text Hello world;// 通过符号设置 x、y 偏移量var symbol textGraphic.Symbol.Symbol;var textSymbol symbol as CIMTextSymbol;textSymbol.OffsetX 2;textSymbol.OffsetY 3;textSymbol.HorizontalAlignment HorizontalAlignment.Center;// 加载更新后的文本图形annoProperties.LoadFromTextGraphic(textGraphic);// 将注释属性分配回去insp.SetAnnotationProperties(annoProperties);EditOperation op new EditOperation();op.Name modify symbol;op.Modify(insp);bool result op.Execute();});6 接地到网格
CIMGroundToGridCorrection correction null;
bool isCorecting correction.IsCorrecting(); // 等同于 correction ! null correction.Enabled;
bool UsingOffset correction.UsingDirectionOffset(); // 等同于 correction.IsCorrecting() correction.UseDirection;
double dOffset correction.GetDirectionOffset(); // 等同于 correction.UsingDirectionOffset() ? correction.Direction : DefaultDirectionOffset;
bool usingDistanceFactor correction.UsingDistanceFactor(); // 等同于 correction.IsCorrecting() correction.UseScale;
bool usingElevation correction.UsingElevationMode(); // 等同于 correction.UsingDistanceFactor() c.ScaleType GroundToGridScaleType.ComputeUsingElevation;
bool usingSFactor correction.UsingConstantScaleFactor(); //; 等同于 correction.UsingDistanceFactor() correction.ScaleType GroundToGridScaleType.ConstantFactor;
double dSFactor correction.GetConstantScaleFactor(); // 等同于 correction.UsingDistanceFactor() ? correction.ConstantScaleFactor : DefaultConstantScaleFactor;