政府门户网站建设内容/cnzz站长统计工具

政府门户网站建设内容,cnzz站长统计工具,陈田村拆车件网上商城,做服装招聘的网站有哪些功能:检查图斑中所有的夹角,如果为锐角,在单独的标记图层中标记。生成的结果放在默认gdb中,以 图层名_锐角检查 的方式命名 大体实现方式:遍历图层中的所有要素(多部件要素分别处理)&#xff0…

功能:检查图斑中所有的夹角,如果为锐角,在单独的标记图层中标记。生成的结果放在默认gdb中,以 图层名_锐角检查 的方式命名

大体实现方式:遍历图层中的所有要素(多部件要素分别处理),对每个夹角进行判断。

具体功能与ArcMap中锐角检查工具类似

DayDreamInGIS数据处理工具 V1.1.5_beta 锐角检查工具源码与解析_daydreamingistool-CSDN博客

工具界面:

(使用prowindow,样式确实更和谐)

界面代码:

<controls:ProWindow x:Class="DayDreamInGISTool.CornerCheck.CornerCheckWindow"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:controls="clr-namespace:ArcGIS.Desktop.Framework.Controls;assembly=ArcGIS.Desktop.Framework"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:d="http://schemas.microsoft.com/expression/blend/2008"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"xmlns:extensions="clr-namespace:ArcGIS.Desktop.Extensions;assembly=ArcGIS.Desktop.Extensions"mc:Ignorable="d"Title="锐角检查" Width="500" Height="200" WindowStartupLocation="CenterOwner"><controls:ProWindow.Resources><ResourceDictionary><ResourceDictionary.MergedDictionaries><extensions:DesignOnlyResourceDictionary Source="pack://application:,,,/ArcGIS.Desktop.Framework;component\Themes\Default.xaml"/></ResourceDictionary.MergedDictionaries></ResourceDictionary></controls:ProWindow.Resources><Grid Margin="5"><Grid.RowDefinitions><RowDefinition></RowDefinition><RowDefinition></RowDefinition><RowDefinition></RowDefinition></Grid.RowDefinitions><Grid><Grid.ColumnDefinitions><ColumnDefinition Width="90"></ColumnDefinition><ColumnDefinition></ColumnDefinition></Grid.ColumnDefinitions><Label VerticalAlignment="Center" HorizontalAlignment="Right">图层</Label><ComboBox Grid.Column="1" Name="cmbLayer" VerticalAlignment="Center" Height="27"></ComboBox></Grid><Grid Grid.Row="1"><Grid.ColumnDefinitions><ColumnDefinition Width="90"></ColumnDefinition><ColumnDefinition></ColumnDefinition></Grid.ColumnDefinitions><Label VerticalAlignment="Center" HorizontalAlignment="Right">角度阈值(度)</Label><TextBox Grid.Column="1" Name="txtYuzhi" VerticalAlignment="Center" Height="27" Text="10"></TextBox></Grid><Grid Grid.Row="2"><Grid.ColumnDefinitions><ColumnDefinition></ColumnDefinition><ColumnDefinition></ColumnDefinition></Grid.ColumnDefinitions><Button Width="140" Height="35" Name="btnOK" Click="btnOK_Click">确定</Button><Button Width="140" Height="35" Grid.Column="1" Name="btnCancel" Click="btnCancel_Click">取消</Button></Grid></Grid>
</controls:ProWindow>

界面交互代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ArcGIS.Core.Data;
using ArcGIS.Desktop.Framework.Threading.Tasks;
using ArcGIS.Desktop.Mapping;
using RGeometry=ArcGIS.Core.Geometry;
using GISCommonHelper;
using ArcGIS.Core.Geometry;
using ArcGIS.Desktop.Core;
using ArcGIS.Core.Data.DDL;
using ArcGIS.Desktop.Editing;
using ArcGIS.Core.Data.Exceptions;
using ArcGIS.Core.Internal.CIM;namespace DayDreamInGISTool.CornerCheck
{/// <summary>/// Interaction logic for CornerCheckWindow.xaml/// </summary>public partial class CornerCheckWindow : ArcGIS.Desktop.Framework.Controls.ProWindow{private FeatureLayer player;private double yuzhi;public CornerCheckWindow(){InitializeComponent();try{var map = MapView.Active.Map;cmbLayer.setLyrlist<FeatureLayer>(map, (o, e) =>{if (cmbLayer.SelectedIndex != -1){Player = this.cmbLayer.SelectedValue as FeatureLayer;}});}catch (Exception){}}public FeatureLayer Player { get => player; set => player = value; }public double Yuzhi { get => yuzhi; set => yuzhi = value; }private void btnCancel_Click(object sender, RoutedEventArgs e){this.DialogResult = false;}private void btnOK_Click(object sender, RoutedEventArgs e){if (this.cmbLayer.SelectedIndex == -1){MessageBox.Show("请设置图层");return;}if(double.TryParse(txtYuzhi.Text,out yuzhi)){}else{MessageBox.Show("阈值必须为数字");return;}this.DialogResult = true;}}
}

核心逻辑代码,放在ProWindow的showButton中。

using ArcGIS.Core.CIM;
using ArcGIS.Core.Data;
using ArcGIS.Core.Data.DDL;
using ArcGIS.Core.Data.Exceptions;
using ArcGIS.Core.Geometry;
using ArcGIS.Desktop.Catalog;
using ArcGIS.Desktop.Core;
using ArcGIS.Desktop.Editing;
using ArcGIS.Desktop.Extensions;
using ArcGIS.Desktop.Framework;
using ArcGIS.Desktop.Framework.Contracts;
using ArcGIS.Desktop.Framework.Dialogs;
using ArcGIS.Desktop.Framework.Threading.Tasks;
using ArcGIS.Desktop.Layouts;
using ArcGIS.Desktop.Mapping;
using GISCommonHelper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;namespace DayDreamInGISTool.CornerCheck
{internal class ShowCornerCheckWindow : Button{private CornerCheckWindow _cornercheckwindow = null;private FeatureClass resultFtCls = null;string orignoidfdnm = "Orign_OId";  //源oidstring corneranglefdnm = "CornerAngle";  //夹角string targetanglefdnm = "Angle";  //指向角string summaryfdnm = "Summary";  //其他说明private FeatureLayer pftlyr;private double yuzhi;ProgressDialog progDlg = null;CancelableProgressorSource progSrc = null;protected override void OnClick(){//already open?if (_cornercheckwindow != null)return;_cornercheckwindow = new CornerCheckWindow();_cornercheckwindow.Owner = FrameworkApplication.Current.MainWindow;//_cornercheckwindow.Closed += (o, e) => { _cornercheckwindow = null; };//_cornercheckwindow.Show();//uncomment for modaltry{progDlg = new ProgressDialog($"锐角检查中...", "取消", 100, true);bool? res = _cornercheckwindow.ShowDialog();if (res.Value){yuzhi = _cornercheckwindow.Yuzhi;pftlyr = _cornercheckwindow.Player;//{pftlyr.GetDefinition().Name} progDlg.Show();progSrc = new CancelableProgressorSource(progDlg);execute();}}catch (Exception ex){MessageBox.Show("发生未知异常_"+ex.Message);}finally{if (progDlg != null){progDlg.Hide();progDlg.Dispose();}_cornercheckwindow = null;}}private void execute(){//暂时不做进度条QueuedTask.Run(() =>{long ftcount=pftlyr.GetFeatureClass().GetCount();progSrc.Progressor.Max = (uint)ftcount;resultFtCls = createResultFtCls();FeatureClass ftcls = pftlyr.GetFeatureClass();using (RowCursor cursor = ftcls.Search()){EditOperation editOperation = new EditOperation();while (cursor.MoveNext()){using (Feature feature = cursor.Current as Feature){long oid = feature.GetObjectID();Geometry geo = feature.GetShape();if (geo.GeometryType == ArcGIS.Core.Geometry.GeometryType.Polygon){var polygon = geo as Polygon;check(polygon, oid, editOperation);}progSrc.Progressor.Value++;progSrc.Message = $"要素:{oid} 检查完成";}}string message = "";try{// 执行编辑操作bool creationResult = editOperation.Execute();// 如果操作失败,存储错误消息if (!creationResult) { message = editOperation.ErrorMessage; }}catch (GeodatabaseException exObj){// 如果出现地理数据库异常,存储异常消息message = exObj.Message;throw;}}},progSrc.Progressor);}private void check(Polygon polygon, long oid, EditOperation editOperation){//多部件要素,每个部分单独处理var list = GeometryEngine.Instance.MultipartToSinglePart(polygon);foreach (var item in list){CornerAngleCheck(item as Polygon, yuzhi, oid, editOperation);}}private void CornerAngleCheck(Polygon pPolygon, double tolerance, long oid, EditOperation editOperation){var pntCol = pPolygon.Points;for (int i = 0; i < pntCol.Count - 1; i++)  //循环,多边形的点首尾相接,最后一个点不用核查{MapPoint currentpnt = pntCol[i];MapPoint prePoint = null;MapPoint nextPoint = null;if (i == 0){prePoint = pntCol[pntCol.Count - 2];  //获取倒数第二个点,即为肉眼意义上的前一个点}else{prePoint = pntCol[i - 1];}if (i == pntCol.Count - 2){nextPoint = pntCol[0];}else{nextPoint = pntCol[i + 1];}double ca = calcCornerAngle(currentpnt, prePoint, nextPoint);double aindegredd = GISCommonHelper.MathHelper.Radian2Degree(ca);double d1 = GISCommonHelper.GeometryHelper.getDistance(currentpnt, prePoint);double d2 = GISCommonHelper.GeometryHelper.getDistance(currentpnt, nextPoint);//定位点距离大致算double dis = (d1 + d2) / 5.0;  //平均边长的十分之一处//生成定位点MapPoint pc = GeometryEngine.Instance.ConstructPointFromAngleDistance(currentpnt, GISCommonHelper.GeometryHelper.getAngle(currentpnt, prePoint) + ca / 2.0, dis);if (aindegredd <= tolerance){editOperation.Callback(context => {using RowBuffer rowBuffer = resultFtCls.CreateRowBuffer();rowBuffer[orignoidfdnm] = oid;rowBuffer[corneranglefdnm] = aindegredd;//rowBuffer[targetanglefdnm] = 0;  //指向角度//构建线Polyline pln = GISCommonHelper.GeometryHelper.getPolyline(pc, currentpnt, MapView.Active.Map.SpatialReference);rowBuffer[resultFtCls.GetDefinition().GetShapeField()] = pln;using Feature feature = resultFtCls.CreateRow(rowBuffer);context.Invalidate(feature);}, resultFtCls);}else{//非锐角}}}/// <summary>/// 计算夹角 返回结果弧度/// </summary>/// <param name="cPnt">顶点</param>/// <param name="p1">起点</param>/// <param name="p2">结点</param>/// <returns>弧度</returns>public double calcCornerAngle(MapPoint cPnt, MapPoint p1, MapPoint p2){double a1 = GISCommonHelper.GeometryHelper.getAngle(cPnt, p1);double a2 = GISCommonHelper.GeometryHelper.getAngle(cPnt, p2);double a = a2 - a1;if (a < 0){a = a + Math.PI * 2;}return a;}string ruijiaojcfcname = "锐角检查";/// <summary>/// 创建结果要素类 默认/// </summary>/// <returns></returns>private FeatureClass createResultFtCls(){ruijiaojcfcname = $"{pftlyr.GetDefinition().Name}_锐角检查";var sr = pftlyr.GetFeatureClass().GetDefinition().GetSpatialReference();//在当前数据库中创建var DefaultGDB = Project.Current.DefaultGeodatabasePath;using (Geodatabase gdb = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(DefaultGDB)))){bool isexist = gdb.FeatureClassExists(ruijiaojcfcname);//如果存在,则先删除if (isexist){var dr=MessageBox.Show("工作空间已经存在锐角检查数据集,是否删除?", "提示", System.Windows.MessageBoxButton.YesNo);if(dr== System.Windows.MessageBoxResult.Yes){//删除已有var featureclass = gdb.OpenDataset<FeatureClass>(ruijiaojcfcname);FeatureClassDescription fdc = new FeatureClassDescription(featureclass.GetDefinition());SchemaBuilder sb3 = new SchemaBuilder(gdb);sb3.Delete(fdc);}else{ruijiaojcfcname = $"锐角检查_{DateTime.Now.GetTimeStamp()}";}progSrc.Progressor.Message = $"创建结果数据集 {ruijiaojcfcname} 完成";}var hasZ = false;var hasM = false;var shapeDescription = new ShapeDescription(GeometryType.Polyline, sr){HasM = hasM,HasZ = hasZ};var f0 = new ArcGIS.Core.Data.DDL.FieldDescription("OBJECTID", FieldType.OID);var f1 = new ArcGIS.Core.Data.DDL.FieldDescription(orignoidfdnm, FieldType.Integer);var f2 = new ArcGIS.Core.Data.DDL.FieldDescription(corneranglefdnm, FieldType.Double);var f3 = new ArcGIS.Core.Data.DDL.FieldDescription(targetanglefdnm, FieldType.Double);var f4 = new ArcGIS.Core.Data.DDL.FieldDescription(summaryfdnm, FieldType.String);f4.Length = 80;var fieldDescriptions = new List<ArcGIS.Core.Data.DDL.FieldDescription>(){f0,f1,f2,f3,f4};//创建FeatureClassDescriptionvar fcDescription = new FeatureClassDescription(ruijiaojcfcname, fieldDescriptions, shapeDescription);//创建SchemaBuilderSchemaBuilder sb = new SchemaBuilder(gdb);sb.Create(fcDescription);bool success = sb.Build();var featureclass2 = gdb.OpenDataset<FeatureClass>(ruijiaojcfcname); ;  //再次打开//添加图层Uri uu = featureclass2.GetPath();var layer = LayerFactory.Instance.CreateLayer(uu, MapView.Active.Map, 0, ruijiaojcfcname);return featureclass2;}}}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/740071.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

C语言字符函数和字符串函数

前言 今天这篇博客咱们一起来认识一些特殊的函数&#xff0c;在编程的过程中&#xff0c;我们经常要处理字符和字符串&#xff0c;为了方便字符和字符串&#xff0c;C语言提供了一些库函数&#xff0c;让我们一起看看这些函数都有什么功能吧&#xff01;&#xff01;&#xff0…

基础刷题50之八(数组元素积的符号)

文章目录 前言一、题目二、力扣官方解释文心一言解释总结 前言 刚上研一&#xff0c;有人劝我好好学C&#xff0c;当时用的不多就没学&#xff0c;现在毕业上班了。在此亡羊补牢了 在此感谢力扣和文心一言 一、题目 数组元素积的符号 已知函数 signFunc(x) 将会根据 x 的正负…

python读取execl里的图片

正常的读取图片 from openpyxl import load_workbook from PIL import Imagefrom openpyxl import load_workbook wb load_workbook(rC:\Users\Administrator\Downloads\output1111.xlsx) ws wb[wb.sheetnames[0]] for image in ws._images:data image.anchor._fromif image…

深耕大屏营销领域的酷开科技,为品牌方带来更多的收益

互联网作为一种新的发展趋势&#xff0c;更是为我们提供了无数的机会和无限可能性&#xff0c;从电子商务时代到社交网络时代&#xff0c;价值文化也成为了品牌与消费者之间紧密联系的关键纽带。而在此背景下&#xff0c;OTT大屏拥有着独特的优势&#xff0c;作为OTT行业内的独…

数据库三大范式设计原则

数据库三大范式 第一范式(确保每列保持原子性) 第一范式是最基本的范式。如果数据库表中的所有字段值都是不可分解的原子值&#xff0c;就说明该数据库表满足了第一范式。 第二范式(确保表中的每列都和主键相关) 第二范式在第一范式的基础之上更进一层。第二范式需要确保数据…

网络工程师——2024自学

一、怎样从零开始学习网络工程师 当今社会&#xff0c;人人离不开网络。整个IT互联网行业&#xff0c;最好入门的&#xff0c;网络工程师算是一个了。 什么是网络工程师呢&#xff0c;简单来说&#xff0c;就是互联网从设计、建设到运行和维护&#xff0c;都需要网络工程师来…

03在ESP-IDF中使用C++面向对象编程

在ESP-IDF中使用C和C进行混合编译 ESP-IDF是Espressif Systems开发的官方IoT开发框架&#xff0c;用于编程和开发ESP32系列的微控制器。虽然ESP-IDF主要使用C语言编写&#xff0c;但它也支持使用C进行开发 为什么要进行混合编译&#xff1f; C是一种功能强大的编程语言&…

【NR 定位】3GPP NR Positioning 5G定位标准解读(十五)-UL-TDOA 定位

前言 3GPP NR Positioning 5G定位标准&#xff1a;3GPP TS 38.305 V18 3GPP 标准网址&#xff1a;Directory Listing /ftp/ 【NR 定位】3GPP NR Positioning 5G定位标准解读&#xff08;一&#xff09;-CSDN博客 【NR 定位】3GPP NR Positioning 5G定位标准解读&#xff08;…

Linux:时间指令 - cal date

Linux&#xff1a;时间指令 - cal & date date指令cal指令 date指令 date用于以指定格式显示时间 我们先看看直接输入date指令的效果&#xff1a; [hxyiZ2zehtehrgzt3wqccrpyfZ CSDN]$ date Tue Mar 12 21:38:01 CST 2024直接输入date指令&#xff0c;得到了以 星期 月 日…

C#,数值计算,解微分方程的龙格-库塔二阶方法与源代码

1 微分方程 含有导数或微分的方程称为微分方程,未知函数为一元函数的微分方程称为常微分方程。 微分方程的阶数 微分方程中导数或微分的最高阶数称为微分方程的阶数。 微分方程的解 使得微分方程成立的函数称为微分方程的解。 微分方程的特解 微分方程的不含任意常数的解称…

蚂蚁集团2025届暑期实习开始啦~

蚂蚁集团2025届暑期实习开始啦&#xff5e;欢迎大家投递信贷事业群-风险管理部的算法岗&#xff0c;找我内推哦&#xff5e;社招也有hc&#xff0c;欢迎大家沟通&#xff01;

STM32CubeIDE基础学习-STM32CubeIDE软件代码编写格式问题

STM32CubeIDE基础学习-STM32CubeIDE软件代码编写格式问题 前言 代码编写最好就是规定一个格式&#xff0c;或者建立一个偏好&#xff0c;这样写出来的代码就方便自己管理了&#xff0c;不然代码乱放下次打开工程就很难找到具体位置&#xff0c;如果规定了格式&#xff0c;那么…

Git 系列:简介安装以及配置管理

文章目录 简介安装简介Centos安装 配置管理[git help](https://www.git-scm.com/docs/git-help)概要选项示例git-doc [git config](https://www.git-scm.com/docs/git-config)概要选项变量示例 初始化配置 简介安装 简介 https://git-scm.com/ Git是一个开源的分布式版本控制…

理论学习:Softmax层和全连接层 全连接层之前的数据

Softmax层和全连接层 Softmax层和全连接层在深度学习模型中通常是紧密相关的&#xff0c;经常一起使用。 全连接层&#xff08;也称为线性层或密集连接层&#xff09;是深度学习模型中常见的层之一&#xff0c;它将输入张量与权重矩阵相乘&#xff0c;并添加偏置项&#xff0c;…

酒店宾馆医院IPTV电视系统质保期满后怎样进行维护?-酒店宾馆医院IPTV电视系统质保期满常年巡检售后服务攻略

酒店宾馆医院IPTV电视系统质保期满后怎样进行维护&#xff1f;-酒店宾馆医院IPTV电视系统质保期满常年巡检售后服务攻略 北京海特伟业任洪卓发布于2024年3月11日 一、酒店IPTV电视系统简述 酒店IPTV电视系统&#xff0c;是新时代“互联网”在酒店领域的重要应用之一&#xff…

15双体系Java学习之数组的声明和创建

数组的声明 ★小贴士 可以使用int[] a;或者int a[];建议使用第一种风格&#xff0c;因为它将元素类型int[]&#xff08;整型数组&#xff09;与变量名清晰分开了。 在Java中声明数组时不能指定其长度。这种定义是非法的&#xff1a;int a[5]; 注意&#xff1a;上图显示的内存…

JDBC连接MysqL

import java.sql.*;public class Demo {public static void main(String[] args) throws ClassNotFoundException, SQLException {//1.注册驱动&#xff0c;加载驱动&#xff1b;Class.forName("com.mysql.jdbc.Driver");//2.获得连接,返回connection类型的对象&…

重学SpringBoot3-集成Thymeleaf

更多SpringBoot3内容请关注我的专栏&#xff1a;《SpringBoot3》 期待您的点赞&#x1f44d;收藏⭐评论✍ 重学SpringBoot3-集成Thymeleaf 1. 添加Thymeleaf依赖2. 配置Thymeleaf属性&#xff08;可选&#xff09;3. 创建Thymeleaf模板4. 创建一个Controller5. 运行应用并访问页…

数学建模-模糊性综合评价模型

中医药是中国传统文化的重要组成部分&#xff0c;凝聚了中华民族千百年来智慧的结晶。作为中医的发源地&#xff0c;中国政府一直致力于保护、发展和推广中医药&#xff0c;采取了一系列政策措施[]。目前&#xff0c;中国面临着老龄化日益加剧&#xff0c;老年人群中慢性疾病和…

在家不无聊,赚钱有门道:5个正规线上赚钱平台,轻松开启副业

随着网络技术的快速发展&#xff0c;越来越多的人开始寻求通过网络来探索兼职副业的可能性&#xff0c;期望实现额外的收入。在这个过程中&#xff0c;选择一个正规且可靠的线上兼职平台显得尤为关键。 为此小编精心网上盘点了5个正规且靠谱的线上兼职副业平台。这些平台不仅安…