当前位置: 首页 > news >正文

ARCGIS PRO DSK GraphicsLayer创建文本要素

一、判断GraphicsLayer层【地块注记】是否存在,如果不存在则新建、如果存在则删除所有要素

Dim GraphicsLayer = pmap.GetLayersAsFlattenedList().OfType(Of ArcGIS.Desktop.Mapping.GraphicsLayer).FirstOrDefault() '获取当前map对象中的GetLayer图层
Await QueuedTask.Run(Sub()If GraphicsLayer Is Nothing = True Then'创建 GraphicsLayerIf pmap.MapType <> MapType.Map Then Exit Sub       ' Not 2DDim gl_param = New GraphicsLayerCreationParamsgl_param.Name = "地块注记"'默认情况下会添加到目录的顶部GraphicsLayer = LayerFactory.Instance.CreateLayer(Of ArcGIS.Desktop.Mapping.GraphicsLayer)(gl_param, pmap)Else'全选文本Dim zj_zdmane As String = ""zj_zdmane = "地块注记"Dim elements = GraphicsLayer.GetElementsAsFlattenedList().Where(Function(gele As GraphicElement) gele.Name.StartsWith(zj_zdmane)) ’获取GetLayer图层中定义的元素(本例为text)'删除选择textGraphicsLayer.SelectElements(elements)GraphicsLayer.RemoveElements(GraphicsLayer.GetSelectedElements())End IfMapView.Active.Redraw(True)  '视图刷新End Sub)

二、CreateTextGraphicElement 方法
       ​GraphicElement CreateTextGraphicElement( 
                IElementContainer elementContainer,
                TextType textType,
                Geometry geometry,
                CIMTextSymbol textSymbol,
                string text,
                string elementName,
                bool select,                    【可选】
                ElementInfo elementInfo 【可选】
             )
             textType:要创建的文本图形的类型​

成员描述
CircleParagraph圆文本
EllipseParagraph椭圆文本
NoneNone- 默认
PointText点文本
PolygonParagraph多边形文本
RectangleParagraph矩形文本
SplinedText沿直线或曲线样条的文本

三、检查应用程序中是否有特定字体可用于 Pro 会话。 必须在 MCT 上调用此方法。IsFontAvailable 方法 (SymbolFactory)
public bool IsFontAvailable( 
                  string fontName,   
                  string fontStyle,
                  FontType fontType,
                  List<CIMFontVariation> fontVariationSettings
               )
               fontName:字体簇的名称。
               fontStyle :字体样式的名称。
               fontType:字体类型。
               fontVariationSettings:要应用的任何字体变体设置。可以为 null。
返回值:一个布尔值,表示字体是否可用。例如:

Dim BOOT=SymbolFactory.Instance.IsFontAvailable("Arial", "Bold", FontType.Unspecified, null)

四、创建文本
1、创建简单的文本符号(Creates a simple text symbol)创建一个大小为8.5、字体系列为“Corbel”、字体样式为“Regular”的简单黑色文本符号。

Await QueuedTask.Run(Sub()pmap = MapView.Active.Map  ‘获取激活的map对象Dim GraphicsLayer = pmap.GetLayersAsFlattenedList().OfType(Of ArcGIS.Desktop.Mapping.GraphicsLayer).FirstOrDefault()  ‘获取的GraphicsLayer对象Dim TextSymbol =SymbolFactory.Instance.ConstructTextSymbol(ColorFactory.Instance.BlackRGB, 8.5, "Corbel", "Regular")'文本的偏移量TextSymbol.OffsetX = 0.5TextSymbol.OffsetY = 0.5Dim Location As MapPoint = MapPointBuilderEx.CreateMapPoint(PX,PY)Dim text As String = "Forest Grove"Dim polyTxtElm As GraphicElement = ElementFactory.Instance.CreateTextGraphicElement(GraphicsLayer, TextType.PointText, Location, TextSymbol, text, "地块注记")End Sub)

效果:

2、创建创建带有光晕环的文本符号(Creates a text symbol with a halo)

Await QueuedTask.Run(Sub()pmap = MapView.Active.Map  ‘获取激活的map对象Dim GraphicsLayer = pmap.GetLayersAsFlattenedList().OfType(Of ArcGIS.Desktop.Mapping.GraphicsLayer).FirstOrDefault()  ‘获取的GraphicsLayer对象Dim haloPoly = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.RedRGB, SimpleFillStyle.Solid)Dim TextSymbol = SymbolFactory.Instance.ConstructTextSymbol(haloPoly, 10, "Arial", "Bold")'文本的偏移量TextSymbol.OffsetX = 0.5TextSymbol.OffsetY = 0.5Dim Location As MapPoint = MapPointBuilderEx.CreateMapPoint(PX,PY)Dim text As String = "Portland"Dim polyTxtElm As GraphicElement = ElementFactory.Instance.CreateTextGraphicElement(GraphicsLayer, TextType.PointText, Location, TextSymbol, text, "地块注记")End Sub)

 效果:

3、创建简单的牵引文本符号(Creates a text symbol with a halo)

Await QueuedTask.Run(Sub()pmap = MapView.Active.Map  ‘获取激活的map对象Dim GraphicsLayer = pmap.GetLayersAsFlattenedList().OfType(Of ArcGIS.Desktop.Mapping.GraphicsLayer).FirstOrDefault()  ‘获取的GraphicsLayer对象Dim textSymbol = SymbolFactory.Instance.ConstructTextSymbol(ColorFactory.Instance.BlackRGB, 10, "Verdana", "Regular")Dim lineCalloutSymbol = new CIMSimpleLineCallout()Dim lineSymbol = SymbolFactory.Instance.ConstructLineSymbol(ColorFactory.Instance.BlackRGB, 1, SimpleLineStyle.DashDotDot)lineCalloutSymbol.LineSymbol = lineSymbol'文本的偏移量TextSymbol.OffsetX = 10TextSymbol.OffsetY = 10textSymbol.Callout = lineCalloutSymbolDim Location As MapPoint = MapPointBuilderEx.CreateMapPoint(PX,PY)Dim text As String = "Forest Grove"Dim polyTxtElm As GraphicElement = ElementFactory.Instance.CreateTextGraphicElement(GraphicsLayer, TextType.PointText, Location, TextSymbol, text, "地块注记")End Sub)

效果:

4、创建圆角矩形的牵引文本框符号(Creates a balloon callout text symbol)

Await QueuedTask.Run(Sub()pmap = MapView.Active.Map  ‘获取激活的map对象Dim GraphicsLayer = pmap.GetLayersAsFlattenedList().OfType(Of ArcGIS.Desktop.Mapping.GraphicsLayer).FirstOrDefault()  ‘获取的GraphicsLayer对象Dim Location As MapPoint = MapPointBuilderEx.CreateMapPoint(PX,PY)Dim textSymbol = SymbolFactory.Instance.ConstructTextSymbol(ColorFactory.Instance.WhiteRGB, 11, "Corbel", "Regular")Dim balloonCallout = new CIMBalloonCallout()BalloonCallout.BalloonStyle = BalloonCalloutStyle.RoundedRectangleDim polySymbol = SymbolFactory.Instance.ConstructPolygonSymbol(ColorFactory.Instance.BlackRGB, SimpleFillStyle.Solid)BalloonCallout.BackgroundSymbol = polySymbolBalloonCallout.Margin = new CIMTextMarginWith BalloonCallout.Margin.Left = 5.Right = 5.Bottom = 5.Top = 5End WithTextSymbol.Callout = balloonCalloutDim text As String = "Forest Grove"Dim polyTxtElm As GraphicElement = ElementFactory.Instance.CreateTextGraphicElement(GraphicsLayer, TextType.RectangleParagraph, Location, TextSymbol, text, "地块注记")End Sub)

效果:

5、创建点符号的文本符号(Creates a point callout text symbol)

Await QueuedTask.Run(Sub()pmap = MapView.Active.Map  ‘获取激活的map对象Dim GraphicsLayer = pmap.GetLayersAsFlattenedList().OfType(Of ArcGIS.Desktop.Mapping.GraphicsLayer).FirstOrDefault()  ‘获取的GraphicsLayer对象Dim textSymbol = SymbolFactory.Instance.ConstructTextSymbol(ColorFactory.Instance.WhiteRGB, 6, "Tahoma", "Bold")Dim shieldCalloutSymbol = new CIMPointSymbolCallout()Dim symbolStyleItem = GetPointSymbol("ArcGIS 2D", "Shield 1")             ShieldCalloutSymbol.PointSymbol = symbolStyleItem.Symbol as CIMPointSymbolShieldCalloutSymbol.PointSymbol.SetSize(18.0)TextSymbol.Callout = shieldCalloutSymbolDim Location As MapPoint = MapPointBuilderEx.CreateMapPoint(PX,PY)Dim text As String = "I5"Dim polyTxtElm As GraphicElement = ElementFactory.Instance.CreateTextGraphicElement(GraphicsLayer, TextType.PointText, Location, TextSymbol, text, "地块注记")End Sub)

效果:

6、创建设置矩形背景色的牵引文本框符号(Creates a background callout text symbol)

Await QueuedTask.Run(Sub()pmap = MapView.Active.Map  ‘获取激活的map对象Dim GraphicsLayer = pmap.GetLayersAsFlattenedList().OfType(Of ArcGIS.Desktop.Mapping.GraphicsLayer).FirstOrDefault()  ‘获取的GraphicsLayer对象Dim Location As MapPoint = MapPointBuilderEx.CreateMapPoint(PX,PY)Dim textSymbol = SymbolFactory.Instance.ConstructTextSymbol(ColorFactory.Instance.BlackRGB, 8, "Tahoma", "Bold")Dim backgroundCalloutSymbol = new CIMBackgroundCallout()Dim lineSymbol = SymbolFactory.Instance.ConstructLineSymbol(ColorFactory.Instance.BlackRGB, 1, SimpleLineStyle.DashDotDot)Dim aquaBackground = ColorFactory.Instance.CreateRGBColor(190, 255, 232, 100)Dim polySymbol = SymbolFactory.Instance.ConstructPolygonSymbol(aquaBackground, SimpleFillStyle.Solid)BackgroundCalloutSymbol.LeaderLineSymbol = lineSymbolTextSymbol.OffsetX = 10TextSymbol.OffsetY = 10BackgroundCalloutSymbol.BackgroundSymbol = polySymbolDim accentSymbol = SymbolFactory.Instance.ConstructLineSymbol(ColorFactory.Instance.BlackRGB, 2, SimpleLineStyle.Solid)BackgroundCalloutSymbol.AccentBarSymbol = accentSymbolBackgroundCalloutSymbol.Margin = new CIMTextMarginWith BalloonCallout.Margin.Left = 5.Right = 5.Bottom = 5.Top = 5End WithTextSymbol.Callout = backgroundCalloutSymbolDim text As String = "Forest Grove"Dim polyTxtElm As GraphicElement = ElementFactory.Instance.CreateTextGraphicElement(GraphicsLayer,TextType.RectangleParagraph, poly, TextSymbol, text, "地块注记")End Sub)

效果:

相关文章:

ARCGIS PRO DSK GraphicsLayer创建文本要素

一、判断GraphicsLayer层【地块注记】是否存在&#xff0c;如果不存在则新建、如果存在则删除所有要素 Dim GraphicsLayer pmap.GetLayersAsFlattenedList().OfType(Of ArcGIS.Desktop.Mapping.GraphicsLayer).FirstOrDefault() 获取当前map对象中的GetLayer图层 Await Queue…...

看板项目之vue代码分析

目录&#xff1a; Q1、vue项目怎么实现的输入localhost&#xff1a;8080就能自动跳到index页面Q2、组合饼状图如何实现Q3、vue项目如何实现环境的切换Q4、vue怎么实现vue里面去调用js文件里面的函数 Q1、vue项目怎么实现的输入localhost&#xff1a;8080就能自动跳到index页面 …...

lua 游戏架构 之 游戏 AI (七)ai_dead

定义一个名为ai_dead的类&#xff0c;继承自ai_base类。这个类用于处理游戏中AI在死亡状态下的行为逻辑。以下是对代码的具体解释&#xff1a; 1. **引入基类**&#xff1a; - 使用require函数引入ai_base类&#xff0c;作为基础类。 2. **定义ai_dead类**&#xff1a; …...

前端开发知识(一)-html

1.前端开发需掌握的内容&#xff1a; 2.前端开发的三剑客&#xff1a;html、css、javascript Vue可以简化JavaScpript流程。 Element&#xff08;饿了么开发的&#xff09; &#xff1a;前端组件库。 Ngix&#xff1a;前端服务器。 3.前端开发工具&#xff1a;vscode 1)按…...

身份证如何查验真伪?C#身份证二要素、三要素接口集成

身份证不仅是我们的身份证明&#xff0c;更是社会生活中的“通行证”&#xff0c;现在人们的衣食住行都离不开身份证。但对于提供服务的平台而言&#xff0c;如何对用户提供的身份信息进行真伪核验便成为了一大难题。别担心&#xff0c;今天小编为服务平台带来了身份证二要素、…...

C++ | Leetcode C++题解之第290题单词规律

题目&#xff1a; 题解&#xff1a; class Solution { public:bool wordPattern(string pattern, string str) {unordered_map<string, char> str2ch;unordered_map<char, string> ch2str;int m str.length();int i 0;for (auto ch : pattern) {if (i > m) {…...

Pytorch使用教学7-张量的广播

PyTorch中的张量具有和NumPy相同的广播特性&#xff0c;允许不同形状的张量之间进行计算。 广播的实质特性&#xff0c;其实是低维向量映射到高维之后&#xff0c;相同位置再进行相加。我们重点要学会的就是低维向量如何向高维向量进行映射。 相同形状的张量计算 虽然我们觉…...

生成式AI:对话系统(Chat)与自主代理(Agent)的和谐共舞

生成式AI&#xff1a;对话与行动的和谐共舞 我们正站在一个令人激动的时代门槛上——生成式AI技术飞速发展&#xff0c;带来了无限的可能性。一个关键问题浮现&#xff1a;AI的未来是对话系统&#xff08;Chat&#xff09;的天下&#xff0c;还是自主代理&#xff08;Agent&am…...

唯众物联网(IOT)全功能综合实训教学解决方案

一、引言 在信息技术日新月异的今天&#xff0c;物联网&#xff08;IoT&#xff09;作为推动数字化转型的关键力量&#xff0c;其触角已延伸至我们生活的方方面面&#xff0c;深刻地重塑了工作模式、生活习惯乃至社会结构的每一个角落。面对这一前所未有的变革浪潮&#xff0c…...

24证券从业考试报名『个人信息表』填写模板❗

24证券从业考试报名『个人信息表』填写模板❗ 1️⃣居住城市、通讯地址&#xff1a;写自己现居住的地址就可以。 2️⃣学历&#xff1a;需要注意的是学历填写的是考生已经取得的学历&#xff0c;在校大学生已经不具有报名资格&#xff0c;选择大专以上&#xff0c;或者是高中学…...

深度学习系列70:模型部署torchserve

1. 流程说明 ts文件夹下&#xff0c; 从launcher.py进入&#xff0c;执行jar文件。 入口为model_server.py的start()函数。内容包含&#xff1a; 读取args&#xff0c;创建pid文件 找到java&#xff0c;启动model-server.jar程序&#xff0c;同时读取log-config文件&#xff…...

算法日记day 20(中序后序遍历序列构造二叉树|最大、合并、搜索二叉树)

一、中序后序序列构造二叉树 题目&#xff1a; 给定两个整数数组 inorder 和 postorder &#xff0c;其中 inorder 是二叉树的中序遍历&#xff0c; postorder 是同一棵树的后序遍历&#xff0c;请你构造并返回这颗 二叉树 。 示例 1: 输入&#xff1a;inorder [9,3,15,20,…...

【科研】# Taylor Francis 论文 LaTeX template模版 及 Word模版

【科研写论文】系列 文章目录 【科研写论文】系列前言一、Word 模板&#xff08;附下载网址&#xff09;&#xff1a;二、LaTeX 版本方法1&#xff1a;直接网页端打开&#xff08;附网址&#xff09;方法2&#xff1a;直接下载到本地电脑上编辑下载地址说明及注意事项 前言 给…...

Linux网络配置及常见命令!

vim /etc/sysconfig/network-scripsts/ifcfg-ens33&#xff08;图形界面配置网络&#xff09; Xshell rz:上传&#xff08;从Windows到Linux&#xff09; sz&#xff1a;下载&#xff1a;&#xff08;从Linux到Windows&#xff09;&#xff08;后接文件手工输入&#xff09;…...

linux之shell脚本实战

&#x1f49d;&#x1f49d;&#x1f49d;欢迎来到我的博客&#xff0c;很高兴能够在这里和您见面&#xff01;希望您在这里可以感受到一份轻松愉快的氛围&#xff0c;不仅可以获得有趣的内容和知识&#xff0c;也可以畅所欲言、分享您的想法和见解。 推荐:Linux运维老纪的首页…...

文件上传漏洞(ctfshow web151-161)

Web151 F12修改源代码 exts后面png改为php 这样就可以上传php的文件了 Web152&#xff1a; 考点&#xff1a;后端不能单一校验 就是要传图片格式&#xff0c;抓个包传个png的图片 然后bp抓包修改php后缀解析 然后放包 Web153-web156 在php代码中可以使用“{}”代替“[]” …...

小猪佩奇.js

闲着没事 使用js 画一个小猪佩奇把 <!DOCTYPE html> <html lang"en"><head><meta charset"UTF-8"><meta name"viewport" content"widthdevice-width, initial-scale1.0"><title>Document</tit…...

人工智能AI合集:Ollama部署对话语言大模型-网页访问

目录 &#x1f345;点击这里查看所有博文 随着人工智能技术的飞速发展&#xff0c;AI已经不再是遥不可及的高科技概念&#xff0c;而是逐渐融入到我们的日常生活中。从智能手机的语音助手到家庭中的智能音箱&#xff0c;再到工业自动化和医疗诊断&#xff0c;AI的应用无处不在…...

CentOS搭建Apache服务器

安装对应的软件包 [roothds ~]# yum install httpd mod_ssl -y 查看防火墙的状态和selinux [roothds ~]# systemctl status firewalld [roothds ~]# cat /etc/selinux/config 若未关闭&#xff0c;则关闭防火墙和selinux [roothds ~]# systemctl stop firewalld [roothds ~]# …...

CDGA|数据治理:安全如何贯穿数据供给、流通、使用全过程

随着信息技术的飞速发展&#xff0c;数据已经成为企业运营、社会管理和经济发展的核心要素。然而&#xff0c;数据在带来巨大价值的同时&#xff0c;也伴随着诸多安全风险。因此&#xff0c;数据治理的重要性日益凸显&#xff0c;它不仅仅是对数据的简单管理&#xff0c;更是确…...

Python爬虫实战:研究MechanicalSoup库相关技术

一、MechanicalSoup 库概述 1.1 库简介 MechanicalSoup 是一个 Python 库,专为自动化交互网站而设计。它结合了 requests 的 HTTP 请求能力和 BeautifulSoup 的 HTML 解析能力,提供了直观的 API,让我们可以像人类用户一样浏览网页、填写表单和提交请求。 1.2 主要功能特点…...

C++实现分布式网络通信框架RPC(3)--rpc调用端

目录 一、前言 二、UserServiceRpc_Stub 三、 CallMethod方法的重写 头文件 实现 四、rpc调用端的调用 实现 五、 google::protobuf::RpcController *controller 头文件 实现 六、总结 一、前言 在前边的文章中&#xff0c;我们已经大致实现了rpc服务端的各项功能代…...

java_网络服务相关_gateway_nacos_feign区别联系

1. spring-cloud-starter-gateway 作用&#xff1a;作为微服务架构的网关&#xff0c;统一入口&#xff0c;处理所有外部请求。 核心能力&#xff1a; 路由转发&#xff08;基于路径、服务名等&#xff09;过滤器&#xff08;鉴权、限流、日志、Header 处理&#xff09;支持负…...

在HarmonyOS ArkTS ArkUI-X 5.0及以上版本中,手势开发全攻略:

在 HarmonyOS 应用开发中&#xff0c;手势交互是连接用户与设备的核心纽带。ArkTS 框架提供了丰富的手势处理能力&#xff0c;既支持点击、长按、拖拽等基础单一手势的精细控制&#xff0c;也能通过多种绑定策略解决父子组件的手势竞争问题。本文将结合官方开发文档&#xff0c…...

Day131 | 灵神 | 回溯算法 | 子集型 子集

Day131 | 灵神 | 回溯算法 | 子集型 子集 78.子集 78. 子集 - 力扣&#xff08;LeetCode&#xff09; 思路&#xff1a; 笔者写过很多次这道题了&#xff0c;不想写题解了&#xff0c;大家看灵神讲解吧 回溯算法套路①子集型回溯【基础算法精讲 14】_哔哩哔哩_bilibili 完…...

ssc377d修改flash分区大小

1、flash的分区默认分配16M、 / # df -h Filesystem Size Used Available Use% Mounted on /dev/root 1.9M 1.9M 0 100% / /dev/mtdblock4 3.0M...

三体问题详解

从物理学角度&#xff0c;三体问题之所以不稳定&#xff0c;是因为三个天体在万有引力作用下相互作用&#xff0c;形成一个非线性耦合系统。我们可以从牛顿经典力学出发&#xff0c;列出具体的运动方程&#xff0c;并说明为何这个系统本质上是混沌的&#xff0c;无法得到一般解…...

VM虚拟机网络配置(ubuntu24桥接模式):配置静态IP

编辑-虚拟网络编辑器-更改设置 选择桥接模式&#xff0c;然后找到相应的网卡&#xff08;可以查看自己本机的网络连接&#xff09; windows连接的网络点击查看属性 编辑虚拟机设置更改网络配置&#xff0c;选择刚才配置的桥接模式 静态ip设置&#xff1a; 我用的ubuntu24桌…...

搭建DNS域名解析服务器(正向解析资源文件)

正向解析资源文件 1&#xff09;准备工作 服务端及客户端都关闭安全软件 [rootlocalhost ~]# systemctl stop firewalld [rootlocalhost ~]# setenforce 0 2&#xff09;服务端安装软件&#xff1a;bind 1.配置yum源 [rootlocalhost ~]# cat /etc/yum.repos.d/base.repo [Base…...

Linux系统部署KES

1、安装准备 1.版本说明V008R006C009B0014 V008&#xff1a;是version产品的大版本。 R006&#xff1a;是release产品特性版本。 C009&#xff1a;是通用版 B0014&#xff1a;是build开发过程中的构建版本2.硬件要求 #安全版和企业版 内存&#xff1a;1GB 以上 硬盘&#xf…...