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

ArcGIS Pro SDK (八)地理数据库 8 拓扑

ArcGIS Pro SDK (八)地理数据库 8 拓扑

文章目录

  • ArcGIS Pro SDK (八)地理数据库 8 拓扑
    • 1 开放拓扑和进程定义
    • 2 获取拓扑规则
    • 3 验证拓扑
    • 4 获取拓扑错误
    • 5 标记和不标记为错误
    • 6 探索拓扑图
    • 7 找到最近的元素

环境:Visual Studio 2022 + .NET6 + ArcGIS Pro SDK 3.0

1 开放拓扑和进程定义

public void OpenTopologyAndProcessDefinition()
{// 从文件地理数据库中打开拓扑并处理拓扑定义。using (Geodatabase geodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(@"C:\TestData\GrandTeton.gdb"))))using (Topology topology = geodatabase.OpenDataset<Topology>("Backcountry_Topology")){ProcessDefinition(geodatabase, topology);}// 打开要素服务拓扑并处理拓扑定义。const string TOPOLOGY_LAYER_ID = "0";using (Geodatabase geodatabase = new Geodatabase(new ServiceConnectionProperties(new Uri("https://sdkexamples.esri.com/server/rest/services/GrandTeton/FeatureServer"))))using (Topology topology = geodatabase.OpenDataset<Topology>(TOPOLOGY_LAYER_ID)){ProcessDefinition(geodatabase, topology);}
}private void ProcessDefinition(Geodatabase geodatabase, Topology topology)
{// 类似于Core.Data API中其余Definition对象,打开数据集的定义有两种方式 -- 通过拓扑数据集本身或通过地理数据库。using (TopologyDefinition definitionViaTopology = topology.GetDefinition()){OutputDefinition(geodatabase, definitionViaTopology);}using (TopologyDefinition definitionViaGeodatabase = geodatabase.GetDefinition<TopologyDefinition>("Backcountry_Topology")){OutputDefinition(geodatabase, definitionViaGeodatabase);}
}private void OutputDefinition(Geodatabase geodatabase, TopologyDefinition topologyDefinition)
{Console.WriteLine($"拓扑聚类容差 => {topologyDefinition.GetClusterTolerance()}");Console.WriteLine($"拓扑Z值聚类容差 => {topologyDefinition.GetZClusterTolerance()}");IReadOnlyList<string> featureClassNames = topologyDefinition.GetFeatureClassNames();Console.WriteLine($"有 {featureClassNames.Count} 个要素类参与了拓扑:");foreach (string name in featureClassNames){// 打开每个参与拓扑的要素类。using (FeatureClass featureClass = geodatabase.OpenDataset<FeatureClass>(name))using (FeatureClassDefinition featureClassDefinition = featureClass.GetDefinition()){Console.WriteLine($"\t{featureClass.GetName()} ({featureClassDefinition.GetShapeType()})");}}
}

2 获取拓扑规则

using (TopologyDefinition topologyDefinition = topology.GetDefinition())
{IReadOnlyList<TopologyRule> rules = topologyDefinition.GetRules();Console.WriteLine($"拓扑定义了 {rules.Count} 条拓扑规则:");Console.WriteLine("ID \t 源类 \t 源子类 \t 目标类 \t 目标子类 \t 规则类型");foreach (TopologyRule rule in rules){Console.Write($"{rule.ID}");Console.Write(!String.IsNullOrEmpty(rule.OriginClass) ? $"\t{rule.OriginClass}" : "\t\"\"");Console.Write(rule.OriginSubtype != null ? $"\t{rule.OriginSubtype.GetName()}" : "\t\"\"");Console.Write(!String.IsNullOrEmpty(rule.DestinationClass) ? $"\t{rule.DestinationClass}" : "\t\"\"");Console.Write(rule.DestinationSubtype != null ? $"\t{rule.DestinationSubtype.GetName()}" : "\t\"\"");Console.Write($"\t{rule.RuleType}");Console.WriteLine();}
}

3 验证拓扑

public void ValidateTopology()
{using (Geodatabase geodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(@"C:\TestData\GrandTeton.gdb"))))using (Topology topology = geodatabase.OpenDataset<Topology>("Backcountry_Topology")){// 如果拓扑当前没有脏区域,调用Validate()将返回一个空的包络线。ValidationResult result = topology.Validate(new ValidationDescription(topology.GetExtent()));Console.WriteLine($"在未编辑的拓扑上验证后的'受影响区域' => {result.AffectedArea.ToJson()}");// 现在创建一个故意违反“PointProperlyInsideArea”拓扑规则的要素。这个动作将创建脏区域。Feature newFeature = null;try{// 获取Campsite要素类中ObjectID为2的要素。然后从这个要素稍微修改后创建一个新的几何体,并用它创建一个新的要素。using (Feature featureViaCampsites2 = GetFeature(geodatabase, "Campsites", 2)){Geometry currentGeometry = featureViaCampsites2.GetShape();Geometry newGeometry = GeometryEngine.Instance.Move(currentGeometry, (currentGeometry.Extent.XMax / 8),(currentGeometry.Extent.YMax / 8));using (FeatureClass campsitesFeatureClass = featureViaCampsites2.GetTable())using (FeatureClassDefinition definition = campsitesFeatureClass.GetDefinition())using (RowBuffer rowBuffer = campsitesFeatureClass.CreateRowBuffer()){rowBuffer[definition.GetShapeField()] = newGeometry;geodatabase.ApplyEdits(() =>{newFeature = campsitesFeatureClass.CreateRow(rowBuffer);});}}// 在'Campsites'参与要素类中创建新要素后,拓扑的状态应为“未分析”,因为尚未验证。Console.WriteLine($"应用编辑后拓扑状态 => {topology.GetState()}");// 现在验证拓扑。结果包络线对应于脏区域。result = topology.Validate(new ValidationDescription(topology.GetExtent()));Console.WriteLine($"在刚编辑后验证的拓扑上的'受影响区域' => {result.AffectedArea.ToJson()}");// 在Validate()之后,拓扑的状态应为“有错误的分析”,因为拓扑当前存在错误。Console.WriteLine($"验证拓扑后的拓扑状态 => {topology.GetState()}");// 如果没有脏区域,则结果包络线应为空。result = topology.Validate(new ValidationDescription(topology.GetExtent()));Console.WriteLine($"在刚验证过的拓扑上的'受影响区域' => {result.AffectedArea.ToJson()}");}finally{if (newFeature != null){geodatabase.ApplyEdits(() =>{newFeature.Delete();});newFeature.Dispose();}}// 删除新创建的要素后再次验证。topology.Validate(new ValidationDescription(topology.GetExtent()));}
}private Feature GetFeature(Geodatabase geodatabase, string featureClassName, long objectID)
{using (FeatureClass featureClass = geodatabase.OpenDataset<FeatureClass>(featureClassName)){QueryFilter queryFilter = new QueryFilter(){ObjectIDs = new List<long>() { objectID }};using (RowCursor cursor = featureClass.Search(queryFilter)){System.Diagnostics.Debug.Assert(cursor.MoveNext());return (Feature)cursor.Current;}}
}

4 获取拓扑错误

// 获取当前与拓扑相关的所有错误和异常。IReadOnlyList<TopologyError> allErrorsAndExceptions = topology.GetErrors(new ErrorDescription(topology.GetExtent()));
Console.WriteLine($"错误和异常数目 => {allErrorsAndExceptions.Count}");Console.WriteLine("源类名称 \t 源对象ID \t 目标类名称 \t 目标对象ID \t 规则类型 \t 是否异常 \t 几何类型 \t 几何宽度 & 高度 \t 规则ID \t");foreach (TopologyError error in allErrorsAndExceptions)
{Console.WriteLine($"'{error.OriginClassName}' \t {error.OriginObjectID} \t '{error.DestinationClassName}' \t " +$"{error.DestinationObjectID} \t {error.RuleType} \t {error.IsException} \t {error.Shape.GeometryType} \t " +$"{error.Shape.Extent.Width},{error.Shape.Extent.Height} \t {error.RuleID}");
}

5 标记和不标记为错误

// 获取所有由于违反“PointProperlyInsideArea”拓扑规则而引起的错误。using (TopologyDefinition topologyDefinition = topology.GetDefinition())
{TopologyRule pointProperlyInsideAreaRule = topologyDefinition.GetRules().First(rule => rule.RuleType == TopologyRuleType.PointProperlyInsideArea);ErrorDescription errorDescription = new ErrorDescription(topology.GetExtent()){TopologyRule = pointProperlyInsideAreaRule};IReadOnlyList<TopologyError> errorsDueToViolatingPointProperlyInsideAreaRule = topology.GetErrors(errorDescription);Console.WriteLine($"有 {errorsDueToViolatingPointProperlyInsideAreaRule.Count} 个要素违反了'PointProperlyInsideArea'拓扑规则.");// 将违反“PointProperlyInsideArea”拓扑规则的所有错误标记为异常。foreach (TopologyError error in errorsDueToViolatingPointProperlyInsideAreaRule){topology.MarkAsException(error);}// 现在验证所有违反“PointProperlyInsideArea”拓扑规则的错误是否确实已标记为异常。//// 默认情况下,ErrorDescription初始化为ErrorType.ErrorAndException。在这里我们想要ErrorType.ErrorOnly。errorDescription = new ErrorDescription(topology.GetExtent()){ErrorType = ErrorType.ErrorOnly,TopologyRule = pointProperlyInsideAreaRule};IReadOnlyList<TopologyError> errorsAfterMarkedAsExceptions = topology.GetErrors(errorDescription);Console.WriteLine($"在将所有错误标记为异常后,有 {errorsAfterMarkedAsExceptions.Count} 个要素违反了'PointProperlyInsideArea'拓扑规则.");// 最后,通过取消标记为异常将所有异常重置为错误。foreach (TopologyError error in errorsDueToViolatingPointProperlyInsideAreaRule){topology.UnmarkAsException(error);}IReadOnlyList<TopologyError> errorsAfterUnmarkedAsExceptions = topology.GetErrors(errorDescription);Console.WriteLine($"在将所有异常重置为错误后,有 {errorsAfterUnmarkedAsExceptions.Count} 个要素违反了'PointProperlyInsideArea'拓扑规则.");
}

6 探索拓扑图

public void ExploreTopologyGraph()
{using (Geodatabase geodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(@"C:\TestData\GrandTeton.gdb"))))using (Topology topology = geodatabase.OpenDataset<Topology>("Backcountry_Topology")){// 使用拓扑数据集的范围构建拓扑图。topology.BuildGraph(topology.GetExtent(),(topologyGraph) =>{using (Feature campsites12 = GetFeature(geodatabase, "Campsites", 12)){IReadOnlyList<TopologyNode> topologyNodesViaCampsites12 = topologyGraph.GetNodes(campsites12);TopologyNode topologyNodeViaCampsites12 = topologyNodesViaCampsites12[0];IReadOnlyList<TopologyEdge> allEdgesConnectedToNodeViaCampsites12 = topologyNodeViaCampsites12.GetEdges();IReadOnlyList<TopologyEdge> allEdgesConnectedToNodeViaCampsites12CounterClockwise = topologyNodeViaCampsites12.GetEdges(false);System.Diagnostics.Debug.Assert(allEdgesConnectedToNodeViaCampsites12.Count == allEdgesConnectedToNodeViaCampsites12CounterClockwise.Count);foreach (TopologyEdge edgeConnectedToNodeViaCampsites12 in allEdgesConnectedToNodeViaCampsites12){TopologyNode fromNode = edgeConnectedToNodeViaCampsites12.GetFromNode();TopologyNode toNode = edgeConnectedToNodeViaCampsites12.GetToNode();bool fromNodeIsTheSameAsTopologyNodeViaCampsites12 = (fromNode == topologyNodeViaCampsites12);bool toNodeIsTheSameAsTopologyNodeViaCampsites12 = (toNode == topologyNodeViaCampsites12);System.Diagnostics.Debug.Assert(fromNodeIsTheSameAsTopologyNodeViaCampsites12 || toNodeIsTheSameAsTopologyNodeViaCampsites12,"连接到'topologyNodeViaCampsites12'的每个边的FromNode或ToNode应与'topologyNodeViaCampsites12'本身相同。");IReadOnlyList<FeatureInfo> leftParentFeaturesBoundedByEdge = edgeConnectedToNodeViaCampsites12.GetLeftParentFeatures();foreach (FeatureInfo featureInfo in leftParentFeaturesBoundedByEdge){System.Diagnostics.Debug.Assert(!String.IsNullOrEmpty(featureInfo.FeatureClassName));System.Diagnostics.Debug.Assert(featureInfo.ObjectID > 0);EnsureShapeIsNotEmpty(featureInfo);}IReadOnlyList<FeatureInfo> leftParentFeaturesNotBoundedByEdge = edgeConnectedToNodeViaCampsites12.GetLeftParentFeatures(false);foreach (FeatureInfo featureInfo in leftParentFeaturesNotBoundedByEdge){System.Diagnostics.Debug.Assert(!String.IsNullOrEmpty(featureInfo.FeatureClassName));System.Diagnostics.Debug.Assert(featureInfo.ObjectID > 0);EnsureShapeIsNotEmpty(featureInfo);}IReadOnlyList<FeatureInfo> rightParentFeaturesBoundedByEdge = edgeConnectedToNodeViaCampsites12.GetRightParentFeatures();foreach (FeatureInfo featureInfo in rightParentFeaturesBoundedByEdge){System.Diagnostics.Debug.Assert(!String.IsNullOrEmpty(featureInfo.FeatureClassName));System.Diagnostics.Debug.Assert(featureInfo.ObjectID > 0);EnsureShapeIsNotEmpty(featureInfo);}IReadOnlyList<FeatureInfo> rightParentFeaturesNotBoundedByEdge = edgeConnectedToNodeViaCampsites12.GetRightParentFeatures(false);foreach (FeatureInfo featureInfo in rightParentFeaturesNotBoundedByEdge){System.Diagnostics.Debug.Assert(!String.IsNullOrEmpty(featureInfo.FeatureClassName));System.Diagnostics.Debug.Assert(featureInfo.ObjectID > 0);EnsureShapeIsNotEmpty(featureInfo);}}}});}
}private void EnsureShapeIsNotEmpty(FeatureInfo featureInfo)
{using (Feature feature = featureInfo.GetFeature()){System.Diagnostics.Debug.Assert(!feature.GetShape().IsEmpty, "要素的形状不应为空。");}
}

7 找到最近的元素

public void FindClosestElement()
{using (Geodatabase geodatabase = new Geodatabase(new FileGeodatabaseConnectionPath(new Uri(@"C:\TestData\GrandTeton.gdb"))))using (Topology topology = geodatabase.OpenDataset<Topology>("Backcountry_Topology")){// 使用拓扑数据集的范围构建拓扑图。topology.BuildGraph(topology.GetExtent(), (topologyGraph) =>{MapPoint queryPointViaCampsites12 = null;using (Feature campsites12 = GetFeature(geodatabase, "Campsites", 12)){queryPointViaCampsites12 = campsites12.GetShape() as MapPoint;}double searchRadius = 1.0;TopologyElement topologyElementViaCampsites12 = topologyGraph.FindClosestElement<TopologyElement>(queryPointViaCampsites12, searchRadius);System.Diagnostics.Debug.Assert(topologyElementViaCampsites12 != null, "在searchRadius范围内应该有一个与'queryPointViaCampsites12'对应的拓扑元素.");IReadOnlyList<FeatureInfo> parentFeatures = topologyElementViaCampsites12.GetParentFeatures();Console.WriteLine("生成'topologyElementViaCampsites12'的父要素:");foreach (FeatureInfo parentFeature in parentFeatures){Console.WriteLine($"\t{parentFeature.FeatureClassName}; OID: {parentFeature.ObjectID}");}TopologyNode topologyNodeViaCampsites12 = topologyGraph.FindClosestElement<TopologyNode>(queryPointViaCampsites12, searchRadius);if (topologyNodeViaCampsites12 != null){// 在searchRadius单位内存在一个最近的TopologyNode。}TopologyEdge topologyEdgeViaCampsites12 = topologyGraph.FindClosestElement<TopologyEdge>(queryPointViaCampsites12, searchRadius);if (topologyEdgeViaCampsites12 != null){// 在searchRadius单位内存在一个最近的TopologyEdge。}});}
}

相关文章:

ArcGIS Pro SDK (八)地理数据库 8 拓扑

ArcGIS Pro SDK &#xff08;八&#xff09;地理数据库 8 拓扑 文章目录 ArcGIS Pro SDK &#xff08;八&#xff09;地理数据库 8 拓扑1 开放拓扑和进程定义2 获取拓扑规则3 验证拓扑4 获取拓扑错误5 标记和不标记为错误6 探索拓扑图7 找到最近的元素 环境&#xff1a;Visual …...

uniapp如何发送websocket请求

方法1&#xff1a; onLoad() {uni.connectSocket({url: ws://127.0.0.1:8000/ws/stat/realTimeStat/,success: (res) > {console.log(connect success, res);}});uni.onSocketOpen(function (res) {console.log(WebSocket连接已打开&#xff01;);uni.sendSocketMessage({d…...

RabbitMQ的工作模式

RabbitMQ的工作模式 Hello World 模式 #mermaid-svg-sbc2QNYZFRQYbEib {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-sbc2QNYZFRQYbEib .error-icon{fill:#552222;}#mermaid-svg-sbc2QNYZFRQYbEib .error-text{fi…...

自建搜索引擎-基于美丽云

Meilisearch 是一个搜索引擎&#xff0c;主程序完全开源&#xff0c;除了使用官方提供的美丽云服务&#xff08;收费&#xff09;进行对接之外&#xff0c;还可以通过自建搜索引擎来实现完全独立的搜索服务。 由于成本问题&#xff0c;本博客采用自建的方式&#xff0c;本文就…...

2024辽宁省大学数学建模竞赛试题思路

A题 (1) 建立模型分析低空顺风风切变对起飞和降落的影响 模型假设 飞机被视为质点&#xff0c;忽略其尺寸和形状对风阻的影响。风切变仅考虑顺风方向的变化&#xff0c;忽略其他方向的风切变。飞机的飞行速度、高度和姿态&#xff08;如迎角、俯仰角&#xff09;是变化的&am…...

循环结构(一)——for语句【互三互三】

文章目录 &#x1f341; 引言 &#x1f341; 一、语句格式 &#x1f341; 二、语句执行过程 &#x1f341; 三、语句格式举例 &#x1f341;四、例题 &#x1f449;【例1】 &#x1f680;示例代码: &#x1f449;【例2】 【方法1】 &#x1f680;示例代码: 【方法2】…...

【深度学习基础】MacOS PyCharm连接远程服务器

目录 一、需求描述二、建立与服务器的远程连接1. 新版Pycharm的界面有什么不同&#xff1f;2. 创建远程连接3. 建立本地项目与远程服务器项目之间的路径映射4.设置保存自动上传文件 三、设置解释器总结 写在前面&#xff0c;本人用的是Macbook Pro&#xff0c; M3 MAX处理器&am…...

微调Qwen2大语言模型加入领域知识

目录 试用Qwen2做推理安装LLaMA-Factory使用自有数据集微调Qwen2验证微调效果 试用Qwen2做推理 参考&#xff1a;https://qwen.readthedocs.io/en/latest/getting_started/quickstart.html from transformers import AutoModelForCausalLM, AutoTokenizer device "cuda…...

【Linux】内核文件系统系统调用流程摸索

内核层可以看到当前调用文件处理的进程ID 这个数据结构是非常大的&#xff1a; 我们打印的pid,tgid就是从这里来的&#xff0c;然后只需要找到pid_t的数据类型就好了。 下图这是运行的日志信息&#xff1a; 从上述日志&#xff0c;其实我也把write的系统调用加了入口的打印信…...

【HZHY-AI300G智能盒试用连载体验】文档资料

感谢电子发烧友和北京合众恒跃科技有限公司提供的的产品试用机会。 HZHY-AI300G工业级国产化智盒&#xff0c;采用RK3588工业级芯片组适应-40℃-85℃工业级宽温网关。 以前测试过其他厂家的RK3568产品&#xff0c;对瑞芯微的工具也比较了解。 在合众恒跃的网站上可以看到基本…...

Linux--深入理与解linux文件系统与日志文件分析

目录 一、文件与存储系统的 inode 与 block 1.1 硬盘存储 1.2 文件存取--block 1.3 文件存取--inode 1.4 文件名与 inode 号 ​编辑 1.5 查看 inode 号码方法 1.6 Linux 系统文件的三个主要的时间属性 1.7 硬盘分区结构 1.8 访问文件的简单了流程 1.9 inode 占用 1.…...

Postman 中的 API 安全性测试:最佳实践与技巧

在当今快速发展的数字化世界中&#xff0c;API&#xff08;应用程序编程接口&#xff09;已成为软件系统之间通信的桥梁。然而&#xff0c;随着API使用的增加&#xff0c;安全风险也随之上升。本文将详细介绍如何在 Postman 中进行 API 的安全性测试&#xff0c;帮助开发者和测…...

PTC可复位保险丝 vs 传统型保险丝:全面对比分析

PTC可复位保险丝&#xff0c;又称为自恢复保险丝、自恢复熔断器或PPTC保险丝&#xff0c;是一种电子保护器件。它利用材料的正温度系数效应&#xff0c;即电阻值随温度升高而显著增加的特性&#xff0c;来实现电路保护。 当电路正常工作时&#xff0c;PTC保险丝呈现低阻态&…...

深入了解Rokid UXR2.0 SDK内置的Unity AR Glass开发组件

本文将了解到Rokid AR开发组件 一、RKCameraRig组件1.脚本属性说明2.如何使用 二、PointableUI组件1.脚本属性说明2.如何使用 三、PointableUICurve组件1.脚本属性说明2.如何使用 四、RKInput组件1.脚本属性说明2.如何使用 五、RKHand组件1.脚本属性说明2.如何使用3.如何禁用手…...

Lottery 分布式抽奖(个人向记录总结)

1.搭建&#xff08;DDDRPC&#xff09;架构 DDD——微服务架构&#xff08;微服务是对系统拆分的方式&#xff09; &#xff08;Domain-Driven Design 领域驱动设计&#xff09; DDD与MVC同属微服务架构 是由Eric Evans最先提出&#xff0c;目的是对软件所涉及到的领域进行建…...

我的AI音乐梦:ChatGPT帮我做专辑

​&#x1f308;个人主页&#xff1a;前端青山 &#x1f525;系列专栏&#xff1a;AI篇 &#x1f516;人终将被年少不可得之物困其一生 依旧青山,本期给大家带来ChatGPT帮我做音乐专辑 嘿&#xff0c;朋友们&#xff01; 想象一下&#xff0c;如果有个超级聪明的机器人能帮你写…...

新手-前端生态

文章目录 新手的前端生态一、概念的理解1、脚手架2、组件 二、基础知识1、HTML2、css3、JavaScript 三、主流框架vue3框架 四、 工具&#xff08;特定框架&#xff09;1、uinapp 五、组件库&#xff08;&#xff09;1、uView如何在哪项目中导入uView 六、应用&#xff08;各种应…...

C#中的类

声明类 public class MyClass{ ​} 注意 类里面 的属性可以输入prop之后再按Tab键 然后再按Tab进行修改属性的名称等等 Random rnd new Random(); int arnd.Next(3); 范围是0-3的整数 但是不包含3 Random rnd new Random(); int arnd.Next(2,3); 只包含2一个数 int?[]…...

探索数据库编程:基础与进阶之存储函数

引言❤️❤️ 数据库存储过程是一组为了执行特定功能的SQL语句集合&#xff0c;它被存储在数据库中&#xff0c;可以通过指定存储过程的名称并给出相应的参数来调用。使用存储过程可以提高数据库操作的效率&#xff0c;减少网络传输量&#xff0c;并且可以封装复杂的逻辑。 编…...

Count数据转换为TPM数据方法整理-常规方法、DGEobj.utils和IOBR包

在正式分析之前&#xff0c;对于数据的处理是至关重要的&#xff0c;这种重要性是体现在很多方面&#xff0c;其中有一点是要求分析者采用正确的数据类型。 对于芯片数据&#xff0c;原始数据进行log2处理之后可以进行很多常见的分析&#xff0c;比如差异分析、热图、箱线图、…...

AI Agent与Agentic AI:原理、应用、挑战与未来展望

文章目录 一、引言二、AI Agent与Agentic AI的兴起2.1 技术契机与生态成熟2.2 Agent的定义与特征2.3 Agent的发展历程 三、AI Agent的核心技术栈解密3.1 感知模块代码示例&#xff1a;使用Python和OpenCV进行图像识别 3.2 认知与决策模块代码示例&#xff1a;使用OpenAI GPT-3进…...

【Linux】C语言执行shell指令

在C语言中执行Shell指令 在C语言中&#xff0c;有几种方法可以执行Shell指令&#xff1a; 1. 使用system()函数 这是最简单的方法&#xff0c;包含在stdlib.h头文件中&#xff1a; #include <stdlib.h>int main() {system("ls -l"); // 执行ls -l命令retu…...

DAY 47

三、通道注意力 3.1 通道注意力的定义 # 新增&#xff1a;通道注意力模块&#xff08;SE模块&#xff09; class ChannelAttention(nn.Module):"""通道注意力模块(Squeeze-and-Excitation)"""def __init__(self, in_channels, reduction_rat…...

Axios请求超时重发机制

Axios 超时重新请求实现方案 在 Axios 中实现超时重新请求可以通过以下几种方式&#xff1a; 1. 使用拦截器实现自动重试 import axios from axios;// 创建axios实例 const instance axios.create();// 设置超时时间 instance.defaults.timeout 5000;// 最大重试次数 cons…...

聊一聊接口测试的意义有哪些?

目录 一、隔离性 & 早期测试 二、保障系统集成质量 三、验证业务逻辑的核心层 四、提升测试效率与覆盖度 五、系统稳定性的守护者 六、驱动团队协作与契约管理 七、性能与扩展性的前置评估 八、持续交付的核心支撑 接口测试的意义可以从四个维度展开&#xff0c;首…...

学校时钟系统,标准考场时钟系统,AI亮相2025高考,赛思时钟系统为教育公平筑起“精准防线”

2025年#高考 将在近日拉开帷幕&#xff0c;#AI 监考一度冲上热搜。当AI深度融入高考&#xff0c;#时间同步 不再是辅助功能&#xff0c;而是决定AI监考系统成败的“生命线”。 AI亮相2025高考&#xff0c;40种异常行为0.5秒精准识别 2025年高考即将拉开帷幕&#xff0c;江西、…...

Angular微前端架构:Module Federation + ngx-build-plus (Webpack)

以下是一个完整的 Angular 微前端示例&#xff0c;其中使用的是 Module Federation 和 npx-build-plus 实现了主应用&#xff08;Shell&#xff09;与子应用&#xff08;Remote&#xff09;的集成。 &#x1f6e0;️ 项目结构 angular-mf/ ├── shell-app/ # 主应用&…...

Python 包管理器 uv 介绍

Python 包管理器 uv 全面介绍 uv 是由 Astral&#xff08;热门工具 Ruff 的开发者&#xff09;推出的下一代高性能 Python 包管理器和构建工具&#xff0c;用 Rust 编写。它旨在解决传统工具&#xff08;如 pip、virtualenv、pip-tools&#xff09;的性能瓶颈&#xff0c;同时…...

基于Java+VUE+MariaDB实现(Web)仿小米商城

仿小米商城 环境安装 nodejs maven JDK11 运行 mvn clean install -DskipTestscd adminmvn spring-boot:runcd ../webmvn spring-boot:runcd ../xiaomi-store-admin-vuenpm installnpm run servecd ../xiaomi-store-vuenpm installnpm run serve 注意&#xff1a;运行前…...

Unity UGUI Button事件流程

场景结构 测试代码 public class TestBtn : MonoBehaviour {void Start(){var btn GetComponent<Button>();btn.onClick.AddListener(OnClick);}private void OnClick(){Debug.Log("666");}}当添加事件时 // 实例化一个ButtonClickedEvent的事件 [Formerl…...