DayDreamInGIS 逆地理编码工具(根据经纬度获取位置描述)插件源码解析

本工具调用高德地图逆地理编码api,根据高的地图逆地理编码api,实现根据经纬度获取位置描述。

总体设计逻辑,窗体采用WPF,通过属性的方式传递交互对象,核心处理逻辑写到button的执行逻辑中。

1.页面

页面XAML:

<Window x:Class="DayDreamInGISTool.GeoCoding.InverseGCWPF"xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:Ignorable="d" Title="逆地理编码" ResizeMode="NoResize" WindowStartupLocation="CenterScreen"Width="500" Height="480"><Grid Margin="5"><Grid.RowDefinitions><RowDefinition Height="40"></RowDefinition><RowDefinition Height="40"></RowDefinition><RowDefinition Height="40"></RowDefinition><RowDefinition Height="40"></RowDefinition><RowDefinition Height="40"></RowDefinition><RowDefinition></RowDefinition><RowDefinition></RowDefinition><RowDefinition Height="40"></RowDefinition></Grid.RowDefinitions><Grid><Grid.ColumnDefinitions><ColumnDefinition Width="100"></ColumnDefinition><ColumnDefinition></ColumnDefinition></Grid.ColumnDefinitions><Label Content="高德地图Token" VerticalAlignment="Center"></Label><TextBox Grid.Column="1" VerticalAlignment="Center" Name="txtGDToken" Height="22" Text="b1670be70e419c2a112957742e55a756"></TextBox></Grid><!--第二行--><Grid Grid.Row="1"><Grid.ColumnDefinitions><ColumnDefinition Width="100"></ColumnDefinition><ColumnDefinition></ColumnDefinition></Grid.ColumnDefinitions><Label Content="图层" VerticalAlignment="Center" HorizontalAlignment="Right"></Label><ComboBox Grid.Column="1" Name="cmbLayer" VerticalAlignment="Center" Height="23" SelectionChanged="cmbLayer_SelectionChanged"></ComboBox></Grid><!--第三行--><Grid Grid.Row="2"><Grid.ColumnDefinitions><ColumnDefinition Width="100"></ColumnDefinition><ColumnDefinition></ColumnDefinition></Grid.ColumnDefinitions><Label Content="经度" VerticalAlignment="Center" HorizontalAlignment="Right"></Label><ComboBox Grid.Column="1" Name="cmbLongtitude" VerticalAlignment="Center" Height="23"></ComboBox></Grid><!--第四行--><Grid Grid.Row="3"><Grid.ColumnDefinitions><ColumnDefinition Width="100"></ColumnDefinition><ColumnDefinition></ColumnDefinition></Grid.ColumnDefinitions><Label Content="纬度" VerticalAlignment="Center" HorizontalAlignment="Right"></Label><ComboBox Grid.Column="1" VerticalAlignment="Center" Name="cmbLatitude" Height="23"></ComboBox></Grid><!--第五行--><Grid Grid.Row="4"><Grid.ColumnDefinitions><ColumnDefinition Width="100"></ColumnDefinition><ColumnDefinition></ColumnDefinition></Grid.ColumnDefinitions><Label Content="位置" VerticalAlignment="Center" HorizontalAlignment="Right"></Label><ComboBox Grid.Column="1" VerticalAlignment="Center" Name="cmbLocation" Height="23"></ComboBox></Grid><Grid Grid.Row="5"><GroupBox Header="地址结构"><Grid Margin="45 5"><Grid.RowDefinitions><RowDefinition></RowDefinition><RowDefinition></RowDefinition></Grid.RowDefinitions><Grid><Grid.ColumnDefinitions><ColumnDefinition></ColumnDefinition><ColumnDefinition></ColumnDefinition><ColumnDefinition></ColumnDefinition><ColumnDefinition></ColumnDefinition></Grid.ColumnDefinitions><CheckBox Grid.Column="0" Name="chkPro" IsChecked="False" VerticalAlignment="Center" Checked="chkPro_Checked">省</CheckBox><CheckBox Grid.Column="1" Name="chkCity" IsChecked="False" VerticalAlignment="Center" Checked="chkCity_Checked">市</CheckBox><CheckBox Grid.Column="2" Name="chkCounty" IsChecked="False" VerticalAlignment="Center" Checked="chkCounty_Checked">县/区</CheckBox><CheckBox Grid.Column="3" Name="chkTown" IsChecked="False" VerticalAlignment="Center" Checked="chkTown_Checked">街道/乡镇</CheckBox></Grid><Grid Grid.Row="1"><Label>示例</Label><TextBox Name="txtExample" VerticalAlignment="Center" HorizontalAlignment="Right" IsReadOnly="True">北京市朝阳区望京街道方恒国际中心B座方恒国际</TextBox></Grid></Grid></GroupBox></Grid><!--第六行 说明--><Grid Grid.Row="6"><GroupBox Header="说明"><Grid Margin="8"><TextBlock TextWrapping="Wrap" LineHeight="20"><Run>本插件使用高德地图逆地理编码服务获取位置描述,经纬度需为wgs84或者cgcs2000的经纬度,如果token不能使用,请去高德图管网申请token</Run><LineBreak></LineBreak><Hyperlink  Click="Hyperlink_Click" NavigateUri="https://console.amap.com/dev/key/app"> https://console.amap.com/dev/key/app</Hyperlink></TextBlock></Grid></GroupBox></Grid><!--第七行--><Grid Grid.Row="7"><Grid.ColumnDefinitions><ColumnDefinition></ColumnDefinition><ColumnDefinition></ColumnDefinition></Grid.ColumnDefinitions><Button Content="确定" Name="btnOK" Width="80" Height="30" VerticalAlignment="Center" HorizontalAlignment="Center" Click="btnOK_Click"></Button><Button Content="取消" Name="btnCancel" Width="80" Height="30" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center" Click="btnCancel_Click"></Button></Grid></Grid>
</Window>

页面逻辑代码:

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 ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.Geodatabase;
using System.CodeDom;
using System.Diagnostics;namespace DayDreamInGISTool.GeoCoding
{/// <summary>/// InverseGCWPF.xaml 的交互逻辑/// </summary>public partial class InverseGCWPF : Window{private IFeatureLayer pftlyr = null;public IFeatureLayer Pftlyr{get { return pftlyr; }set { pftlyr = value; }}private string xfdnm;public string Xfdnm{get { return xfdnm; }set { xfdnm = value; }}private string yfdnm;public string Yfdnm{get { return yfdnm; }set { yfdnm = value; }}private string locationfdnm;public string Locationfdnm{get { return locationfdnm; }set { locationfdnm = value; }}private string gdtoken;public string Gdtoken{get { return gdtoken; }set { gdtoken = value; }}private IMap pMap = null;string toolname = "DDGInverGeocoding";string keyname = "gdtoken";string tokenInReg = "";public InverseGCWPF(){InitializeComponent();pMap = ArcMap.Document.FocusMap;GISCommonHelper.CartoLyrHelper.setFeatureLyrCombox(ref cmbLayer, pMap, esriGeometryType.esriGeometryAny);try{object tt = GISCommonHelper.esriSystemHelper.getValueFromReg2(toolname, keyname);if (tt == null){}else{tokenInReg = tt.ToString();this.txtGDToken.Text = tt.ToString();}}catch (Exception){throw;}setExample();}private bool isPro;public bool IsPro{get { return isPro; }set { isPro = value; }}private bool isCity;public bool IsCity{get { return isCity; }set { isCity = value; }}private bool isCounty;public bool IsCounty{get { return isCounty; }set { isCounty = value; }}private bool isTown;public bool IsTown{get { return isTown; }set { isTown = value; }}private void cmbLayer_SelectionChanged(object sender, SelectionChangedEventArgs e){if (cmbLayer.SelectedIndex != -1){pftlyr = cmbLayer.SelectedValue as IFeatureLayer;GISCommonHelper.CartoFieldHelper.setFieldCombox(ref cmbLongtitude, pftlyr.FeatureClass.Fields, false, esriFieldType.esriFieldTypeDouble, esriFieldType.esriFieldTypeSingle);GISCommonHelper.CartoFieldHelper.setFieldCombox(ref cmbLatitude, pftlyr.FeatureClass.Fields, false,esriFieldType.esriFieldTypeDouble, esriFieldType.esriFieldTypeSingle);GISCommonHelper.CartoFieldHelper.setFieldCombox(ref cmbLocation, pftlyr.FeatureClass.Fields,false,esriFieldType.esriFieldTypeString);GISCommonHelper.CartoFieldHelper.setDftField(ref cmbLongtitude, p =>{if (p.alias_name.Contains("经度") || p.name.Contains("经度") || p.alias_name.Contains("Lng") || p.name.Contains("Lng") || p.alias_name.Contains("Longtitude") || p.name.Contains("Longtitude")|| p.name.ToLower()=="x" || p.alias_name.ToLower()=="x"){return true;}return false;});GISCommonHelper.CartoFieldHelper.setDftField(ref cmbLatitude, p =>{if (p.alias_name.Contains("纬度") || p.name.Contains("纬度") || p.alias_name.Contains("Lat") || p.name.Contains("Lat") || p.alias_name.Contains("Latitude") || p.name.Contains("Latitude")|| p.name.ToLower()=="y" || p.alias_name.ToLower()=="y"){return true;}return false;});GISCommonHelper.CartoFieldHelper.setDftField(ref cmbLocation, p =>{if (p.alias_name.Contains("位置") || p.name=="位置" || p.name.ToLower().Contains("location")){return true;}else{return false;}});}}private void btnCancel_Click(object sender, RoutedEventArgs e){this.DialogResult = false;}// 北京市朝阳区望京街道方恒国际中心B座方恒国际string pro = "浙江省";string city = "杭州市";string county = "上城区";string town = "四季青街道";string building = "钱江新城";private void btnOK_Click(object sender, RoutedEventArgs e){if (pftlyr == null){MessageBox.Show("请选择图层");return;}if (cmbLatitude.SelectedIndex == -1){MessageBox.Show("请配置纬度字段");return;}else{yfdnm = cmbLatitude.SelectedValue.ToString();}if (cmbLongtitude.SelectedIndex == -1){MessageBox.Show("请配置经度字段");return;}else{xfdnm = cmbLongtitude.SelectedValue.ToString();}if (cmbLocation.SelectedIndex == -1){MessageBox.Show("请配置位置字段");return;}else{locationfdnm = cmbLocation.SelectedValue.ToString();}if (string.IsNullOrEmpty(txtGDToken.Text)){MessageBox.Show("高德地图token不能为空");}else {gdtoken = txtGDToken.Text;if(gdtoken== tokenInReg){}else{//写入注册表GISCommonHelper.esriSystemHelper.setValueToReg2(toolname, new KeyValuePair<string, object>(keyname, gdtoken));}}this.DialogResult = true;}private void Hyperlink_Click(object sender, RoutedEventArgs e) {System.Windows.Documents.Hyperlink link = sender as System.Windows.Documents.Hyperlink;Process.Start(new ProcessStartInfo(link.NavigateUri.AbsoluteUri));}private void setExample(){string res = "";if (isPro){res += pro;}if (isCity){res+= city;}if (isCounty){res += county;}if(isTown) {res += town;}res += building;txtExample.Text = res;}private void chkPro_Checked(object sender, RoutedEventArgs e){isPro = chkPro.IsChecked.Value;setExample();}private void chkCity_Checked(object sender, RoutedEventArgs e){isCity= chkCity.IsChecked.Value;setExample();}private void chkCounty_Checked(object sender, RoutedEventArgs e){isCounty= chkCounty.IsChecked.Value;setExample();}private void chkTown_Checked(object sender, RoutedEventArgs e){isTown= chkTown.IsChecked.Value;setExample();}}
}

2.代码逻辑

using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using ESRI.ArcGIS.Geodatabase;
using ESRI.ArcGIS.Geometry;
using ESRI.ArcGIS.Carto;
using System.Windows;
using GISCommonHelper;
using DayDreamInGISTool.Assister;
using Newtonsoft.Json.Linq;namespace DayDreamInGISTool.GeoCoding
{/// <summary>/// 高德地图逆地理编码/// 地址结构点选  OO/// 处理消息/状态写入 OO/// 进度条 OO/// token限制 默认token限速/// </summary>public class btnInverseGeocoding : ESRI.ArcGIS.Desktop.AddIns.Button{public btnInverseGeocoding(){}ESRI.ArcGIS.esriSystem.ITrackCancel trackCancel = null;ESRI.ArcGIS.esriSystem.IStepProgressor stepProgressor = null;ESRI.ArcGIS.Framework.IProgressDialog2 progressDialog2 = null;InverseGCWPF iwp = null;string tsttoken = "";bool isTest = false;protected override void OnClick(){try{iwp = new InverseGCWPF();if (iwp.ShowDialog().Value){if(iwp.Gdtoken== tsttoken){MessageBox.Show("测试token,每次处理不超过30个要素");isTest = true;}trackCancel = new ESRI.ArcGIS.Display.CancelTrackerClass();ESRI.ArcGIS.Framework.IProgressDialogFactory progressDialogFactory = new ESRI.ArcGIS.Framework.ProgressDialogFactoryClass();stepProgressor = progressDialogFactory.Create(trackCancel, ArcMap.Application.hWnd);ESRI.ArcGIS.Framework.IProgressDialog2 progressDialog2 = (ESRI.ArcGIS.Framework.IProgressDialog2)stepProgressor; // Explict CastprogressDialog2.CancelEnabled = true;progressDialog2.Description = "逆地理编码中...";progressDialog2.Title = "逆地理编码";progressDialog2.Animation = ESRI.ArcGIS.Framework.esriProgressAnimationTypes.esriProgressGlobe;stepProgressor.Show();execute();//完成trackCancel = null;stepProgressor = null;progressDialog2.HideDialog();progressDialog2 = null;}}catch (Exception ex){MessageBox.Show("发生未知异常:"+ex.Message);}}string statusFd = "status";string infoFd = "info";private void execute(){//创建可能的消息状态字段try{GISCommonHelper.FieldHelper.AddStringField(iwp.Pftlyr.FeatureClass, new KeyValuePair<string, int>(statusFd, 10), new KeyValuePair<string, int>(infoFd, 70));}catch (Exception){MessageBox.Show("创建标识字段出错");}stepProgressor.MinRange = 0;int featurecount = iwp.Pftlyr.FeatureClass.FeatureCount(null);if (isTest){stepProgressor.MaxRange = featurecount > 30 ? 30 : featurecount;  //测试token,一次请求只能30}else{stepProgressor.MaxRange = featurecount;}stepProgressor.StepValue = 1;int n = 0;IFeatureCursor pftcursor = iwp.Pftlyr.FeatureClass.Search(null, false);IFeature pFeature= pftcursor.NextFeature();while(pFeature!=null ){if (isTest){if (n > 30){break;}}stepProgressor.Message = "正在处理要素,OId:" + pFeature.OID;System.Diagnostics.Debug.WriteLine("正在处理:"+pFeature.OID);double lng= (double)pFeature.getval(iwp.Xfdnm);double lat = (double)pFeature.getval(iwp.Yfdnm);RequestRes rr = getLocationStr(lng, lat);if(pFeature.Fields.FindField(statusFd)!=-1)pFeature.setval(statusFd, rr.status);if (rr.status == "0"){if(pFeature.Fields.FindField(infoFd)!=-1)pFeature.setval(infoFd, rr.info);}else if (rr.status == "1"){pFeature.setval(iwp.Locationfdnm, rr.address);}stepProgressor.Step();pFeature.Store();n++;pFeature = pftcursor.NextFeature();}}string bsurl = "https://restapi.amap.com/v3/geocode/regeo?parameters";private RequestRes getLocationStr(double lng,double lat){RequestRes rr = new RequestRes();//https://restapi.amap.com/v3/geocode/regeo?output=xml&location=116.310003,39.991957&key=<用户的key>&radius=1000&extensions=allstring location = "";string url = string.Format("https://restapi.amap.com/v3/geocode/regeo?location={0},{1}&key={2}&radius=1000&extensions=all",lng,lat,iwp.Gdtoken);string json = WebRequestAssist.GetRequestStr(url);var jRoot= JObject.Parse(json);int status= jRoot.Value<int>("status");rr.status = status.ToString();if (status == 1){// 1 请求成功var regeocodeObj = jRoot.GetValue("regeocode") as JObject;string formatted_address = regeocodeObj.Value<string>("formatted_address");//北京市朝阳区望京街道方恒国际中心B座方恒国际//移除前缀var addressComponentObj = regeocodeObj.GetValue("addressComponent");string province = addressComponentObj.Value<string>("province");string district = addressComponentObj.Value<string>("district");string city = addressComponentObj.Value<string>("city");string township = addressComponentObj.Value<string>("township");rr.address = formatted_address;//return formatted_address;if (!iwp.IsPro){formatted_address=formatted_address.Replace(province, "");}if(!iwp.IsCity) {if (!string.IsNullOrEmpty(city)){formatted_address = formatted_address.Replace(city, "");}}if (!iwp.IsCounty){formatted_address = formatted_address.Replace(district,""); }if (!iwp.IsTown){formatted_address = formatted_address.Replace(township, "");}rr.address = formatted_address;}else {//0 请求失败string info = jRoot.Value<string>("info");  //错误消息rr.info = info;}return rr;}protected override void OnUpdate(){}struct RequestRes{public string status { get; set; }public string info { get; set; }public string address { get; set; }}}
}

大体解析:(1)获取要素的经度、纬度字段值

(2)调用高德地图逆地理编码API,获取位置描述

(3)通过Newtonsoft.JSON解析返回的json对象,并按照要求,剔除省、市等前缀

(4)将结果写入要素

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

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

相关文章

掌握JavaScript的练习之道:十个手写函数让你信手拈来!

&#x1f90d; 前端开发工程师&#xff08;主业&#xff09;、技术博主&#xff08;副业&#xff09;、已过CET6 &#x1f368; 阿珊和她的猫_CSDN个人主页 &#x1f560; 牛客高级专题作者、在牛客打造高质量专栏《前端面试必备》 &#x1f35a; 蓝桥云课签约作者、已在蓝桥云…

MySQL事务MVCC详解

一、概述 MVCC (MultiVersion Concurrency Control) 叫做多版本并发控制机制。主要是通过数据多版本来实现读-写分离&#xff0c;做到即使有读写冲突时&#xff0c;也能做到不加锁&#xff0c;非阻塞并发读&#xff0c;从而提高数据库并发性能。 MVCC只在已提交读&#xff08…

行业追踪,2023-10-18

自动复盘 2023-10-18 凡所有相&#xff0c;皆是虚妄。若见诸相非相&#xff0c;即见如来。 k 线图是最好的老师&#xff0c;每天持续发布板块的rps排名&#xff0c;追踪板块&#xff0c;板块来开仓&#xff0c;板块去清仓&#xff0c;丢弃自以为是的想法&#xff0c;板块去留让…

Docker是一个流行的容器化平台,用于构建、部署和运行应用程序。

文章目录 Web应用程序数据库服务器微服务应用开发环境持续集成和持续部署 (CI/CD)应用程序依赖项云原生应用程序研究和教育 &#x1f388;个人主页&#xff1a;程序员 小侯 &#x1f390;CSDN新晋作者 &#x1f389;欢迎 &#x1f44d;点赞✍评论⭐收藏 ✨收录专栏&#xff1a;…

mysql查看连接池的命令

查看实时连接的个数 &#xff08;瞬时值&#xff09; SHOW STATUS LIKE Threads_connected; 查看具体的链接信息 show full processlist; 数据库链接池常见的报错 Cannot create PoolableConnectionFactory (Data source rejected establishment of connection, message fr…

Android Fragment 基本概念和基本使用

Android Fragment 基本概念和基本使用 一、基本概念 Fragment&#xff0c;简称碎片&#xff0c;是Android 3.0&#xff08;API 11&#xff09;提出的&#xff0c;为了兼容低版本&#xff0c;support-v4库中也开发了一套Fragment API&#xff0c;最低兼容Android 1.6。 过去s…

Swift使用Embassy库进行数据采集:热点新闻自动生成器

概述 爬虫程序是一种可以自动从网页上抓取数据的软件。爬虫程序可以用于各种目的&#xff0c;例如搜索引擎、数据分析、内容聚合等。本文将介绍如何使用Swift语言和Embassy库编写一个简单的爬虫程序&#xff0c;该程序可以从新闻网站上采集热点信息&#xff0c;并生成一个简单…

Redis的五大基础数据类型

String 字符串类型&#xff0c;通过set关键字和get关键字来设置字符串键值对和获取字符串键值对。 hash 哈希类型&#xff0c;结构和Map<String,Map<String,stirng>>类似。 使用hset来设置哈希&#xff0c;使用hget来获取哈希&#xff0c;hget要精确到第二个key…

苍穹外卖(八) 使用WebSocket协议完成来单提醒及客户催单功能

WebSocket介绍 WebSocket 是基于 TCP 的一种新的网络协议。它实现了浏览器与服务器全双工通信(双向传输)——浏览器和服务器只需要完成一次握手&#xff0c;两者之间就可以创建持久性的连接&#xff0c; 并进行双向数据传输。 HTTP协议和WebSocket协议对比&#xff1a; HTTP…

2022年下半年 软件设计师 上午试卷(前21题)

以下关于RISC&#xff08;精简指令集计算机&#xff09;特点的叙述中&#xff0c;错误的是 &#xff08;1&#xff09; 。 &#xff08;1&#xff09; A. 对存储器操作进行限制&#xff0c;使控制简单化 B. 指令种类多&#xff0c;指令功能强 C. 设置大量通用寄存器 D. 选…

【算法|动态规划No.23】leetcode376. 摆动序列

个人主页&#xff1a;兜里有颗棉花糖 欢迎 点赞&#x1f44d; 收藏✨ 留言✉ 加关注&#x1f493;本文由 兜里有颗棉花糖 原创 收录于专栏【手撕算法系列专栏】【LeetCode】 &#x1f354;本专栏旨在提高自己算法能力的同时&#xff0c;记录一下自己的学习过程&#xff0c;希望…

【C#】【winform】Microsoft Visual Studio Installer Project 打包应用程序全部过程

提示&#xff1a;只针对扩展包来完成打包的工作过程。 文章目录 前言一、Microsoft Visual Studio Installer Project 是什么&#xff1f;二、安装1.安装Microsoft Visual Studio Installer Project 三、安开始打包1.添加setup1.在解决方案上面右键&#xff0c;添加-新建项目2.…

H5+Vue3编写官网,并打包发布到同一个域名下

背景 因为html5有利于搜索引擎抓取和收录我们网站更多的内容&#xff0c;对SEO很友好&#xff0c;可以为网站带来更多的流量,并且多端适配&#xff0c;兼容性和性能都非常不错&#xff0c;所以使用h5来编写官网首页。 因为用户个人中心可以通过官网跳转&#xff0c;不需要被浏…

双目视觉实战--单视图测量方法

目录 一.简介 二、2D变换 1. 等距变换&#xff08;欧式变换&#xff09; 2. 相似变换 3. 仿射变换 4. 射影变换&#xff08;透视变换&#xff09; 5. 结论 三、影消点与影消线 1. 平面上的线 2. 直线的交点 3. 2D无穷远点 4. 无穷远直线 5. 无穷远点的透视变换与仿…

【01】LVGL-CodeBlock模拟器安装 | LVGL工程下载 | PC端模拟LVGL步骤

LVGL模拟器 1.LVGL模拟器介绍2.Windows环境搭建CodeBlock及获取LVGL工程3.PC端模拟LVGL4.总结 1.LVGL模拟器介绍 LVGL模拟器&#xff1a;使用PC端软件模拟LVGL运行&#xff0c;而不需要任何嵌入式硬件。优点&#xff1a;便于学习、跨平台协同开发 2.Windows环境搭建CodeBlock及…

【Python、Qt】使用QItemDelegate实现单元格的富文本显示+复选框功能

[2023-10-19]代码已更新&#xff0c;完善了单元格宽度不足时省略号的显示问题。 [2023-10-18]代码已更新&#xff0c;追加单元格的文本对齐功能(使用成员函数QStandardItem.setTextAlignment设置单元格的Align。 主打一个 折磨 坑多 陪伴。代码为Python&#xff0c;C的就自己逐…

Python万圣节蝙蝠

目录 系列文章 前言 蝙蝠 程序设计 程序分析 运行结果 尾声 系列文章 序号文章目录直达链接1浪漫520表白代码https://want595.blog.csdn.net/article/details/1306668812满屏表白代码https://want595.blog.csdn.net/article/details/1297945183跳动的爱心https://want5…

云务器迁移(腾讯云>华为云)

自己平时除了写些bug外还喜欢玩玩服务器&#xff0c;这不前几年买了一个域名&#xff0c;当时服务器买的是阿里云的&#xff0c;想着域名备案挺麻烦的就一直用着&#xff0c;只是在服务器到期后会重新购买其他运营商的&#xff08;关键是续不起&#x1f92b;&#xff09; 这不最…

C/C++ 快速入门

参考&#xff1a;https://blog.csdn.net/gao_zhennan/article/details/128769439 1 下载Visual Studio Code并安装中文插件&#xff0c;此处不再叙述 2 插件安装C/C插件 3 使用快捷键【Ctr ~】打打开终端 验证并未安装编译器 4 我们即将使用【MinGW-64】做为编译器 https:…

程序环境和预处理

导言&#xff1a; 在编写代码的过程中&#xff0c;我们一般都是在一些图形化软件的编译器中实现&#xff0c;编译器帮我们实现了很多操作&#xff0c;这里就一些简单的过程进行说明。本文主要阐述了c语言程序的编译链接以及一些预处理知识&#xff0c;和宏定义的使用。 目录 …