ArcGIS Pro SDK (九)几何 12 多面体

ArcGIS Pro SDK (九)几何 12 多面体

文章目录

  • ArcGIS Pro SDK (九)几何 12 多面体
    • 1 通过拉伸多边形或折线构建多面体
    • 2 多面体属性
    • 3 构建多面体
    • 4 通过MultipatchBuilderEx构建多面体
    • 5 从另一个多面体构建多面体
    • 6 从 3D 模型文件构建多面体
    • 7 构建 3D 特殊多面体形状
    • 8 创建基本材料
    • 9 使用 JPEG 纹理创建基本材质
    • 10 使用未压缩纹理创建基本材质
    • 11 获取多面体的纹理图像
    • 12 获取多面体的法线坐标
    • 13 获取多面体的法线
    • 14 获取多面体的材质属性

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

1 通过拉伸多边形或折线构建多面体

// 构建一个多边形
string json = "{\"hasZ\":true,\"rings\":[[[0,0,0],[0,1,0],[1,1,0],[1,0,0],[0,0,0]]],\"spatialReference\":{\"wkid\":4326}}";
Polygon polygon = PolygonBuilderEx.FromJson(json);// 通过偏移量拉伸多边形以创建多面体
Multipatch multipatch = GeometryEngine.Instance.ConstructMultipatchExtrude(polygon, 2);// 一个不同的多边形
json = "{\"hasZ\":true,\"rings\":[[[0,0,1],[0,1,2],[1,1,3],[1,0,4],[0,0,1]]],\"spatialReference\":{\"wkid\":4326}}";
polygon = PolygonBuilderEx.FromJson(json);// 在 z 值之间拉伸以创建多面体
multipatch = GeometryEngine.Instance.ConstructMultipatchExtrudeFromToZ(polygon, -10, 20);// 沿着由坐标定义的轴拉伸以创建多面体
Coordinate3D coord = new Coordinate3D(10, 18, -10);
multipatch = GeometryEngine.Instance.ConstructMultipatchExtrudeAlongVector3D(polygon, coord);// 构建一条折线
json = "{\"hasZ\":true,\"paths\":[[[400,800,1000],[800,1400,1500],[1200,800,2000],[1800,1800,2500],[2200,800,3000]]],\"spatialReference\":{\"wkid\":3857}}";
Polyline polyline = PolylineBuilderEx.FromJson(json);// 拉伸到特定 z 值以创建多面体
multipatch = GeometryEngine.Instance.ConstructMultipatchExtrudeToZ(polyline, 500);Coordinate3D fromCoord = new Coordinate3D(50, 50, -500);
Coordinate3D toCoord = new Coordinate3D(200, 50, 1000);// 在两个坐标之间拉伸以创建多面体
multipatch = GeometryEngine.Instance.ConstructMultipatchExtrudeAlongLine(polyline, fromCoord, toCoord);

2 多面体属性

// 标准几何属性
bool hasZ = multipatch.HasZ;
bool hasM = multipatch.HasM;
bool hasID = multipatch.HasID;
bool isEmpty = multipatch.IsEmpty;
var sr = multipatch.SpatialReference;// 补丁(部分)的数量
int patchCount = multiPatch.PartCount;
// 点的数量
int pointCount = multiPatch.PointCount;// 作为 MapPoints 获取点
ReadOnlyPointCollection points = multipatch.Points;
// 或作为 3D 坐标获取点
IReadOnlyList<Coordinate3D> coordinates = multipatch.Copy3DCoordinatesToList();// 多面体材料
bool hasMaterials = multiPatch.HasMaterials;
int materialCount = multiPatch.MaterialCount;// 多面体纹理
bool hasTextures = multiPatch.HasTextures;
int textureVertexCount = multiPatch.TextureVertexCount;// 法线
bool hasNormals = multiPatch.HasNormals;// 单个补丁的属性(如果 multipatch.PartCount > 0)
int patchPriority = multiPatch.GetPatchPriority(patchIndex);
PatchType patchType = multiPatch.GetPatchType(patchIndex);// 补丁点
int patchPointCount = multiPatch.GetPatchPointCount(patchIndex);
int pointStartIndex = multiPatch.GetPatchStartPointIndex(patchIndex);
// 补丁点是从 pointStartIndex 到 pointStartIndex + patchPointCount 的 multipatch.Points 中的点 // 如果多面体有材料
if (hasMaterials)
{// 补丁是否有材料?//   如果补丁没有材料,则 materialIndex = -1;//   如果补丁有材料,则 0 <= materialIndex < materialCountint materialIndex = multipatch.GetPatchMaterialIndex(patchIndex);// 单个材料的属性(如果 multipatch.MaterialCount > 0)var color = multipatch.GetMaterialColor(materialIndex);var edgeColor = multipatch.GetMaterialEdgeColor(materialIndex);var edgeWidth = multipatch.GetMaterialEdgeWidth(materialIndex);var shiness = multipatch.GetMaterialShininess(materialIndex);var percent = multipatch.GetMaterialTransparencyPercent(materialIndex);var cullBackFace = multipatch.IsMaterialCullBackFace(materialIndex);// 纹理属性bool isTextured = multipatch.IsMaterialTextured(materialIndex);if (isTextured){int columnCount = multipatch.GetMaterialTextureColumnCount(materialIndex);int rowCount = multipatch.GetMaterialTextureRowCount(materialIndex);int bpp = multipatch.GetMaterialTextureBytesPerPixel(materialIndex);TextureCompressionType compressionType = multipatch.GetMaterialTextureCompressionType(materialIndex);var texture = multipatch.GetMaterialTexture(materialIndex);}
}// 纹理坐标(如果 multipatch.HasTextures = true)
if (hasTextures)
{int numPatchTexturePoints = multiPatch.GetPatchTextureVertexCount(patchIndex);var coordinate2D = multiPatch.GetPatchTextureCoordinate(patchIndex, 0);ICollection<Coordinate2D> textureCoordinates = new List<Coordinate2D>(numPatchTexturePoints);multiPatch.GetPatchTextureCoordinates(patchIndex, ref textureCoordinates);
}// 补丁法线(如果 multipatch.HasNormals = true)
if (hasNormals)
{// 法线坐标的数量 = multipatch.GetPatchPointCount(patchIndex)Coordinate3D patchNormal = multipatch.GetPatchNormal(patchIndex, 0);ICollection<Coordinate3D> normalCoordinates = new List<Coordinate3D>(patchPointCount);multipatch.GetPatchNormals(patchIndex, ref normalCoordinates);
}

3 构建多面体

// 导出为二进制 XML
string binaryXml = multiPatch.ToBinaryXml();// 从二进制 XML 导入 - 方法需要在 MCT 上运行
Multipatch binaryMultipatch = MultipatchBuilderEx.FromBinaryXml(binaryXml);// XML 导出/导入
string xml = multiPatch.ToXml();
Multipatch xmlMultipatch = MultipatchBuilderEx.FromXml(xml);// esriShape 导出/导入
byte[] buffer = multiPatch.ToEsriShape();
Multipatch esriPatch = MultipatchBuilderEx.FromEsriShape(buffer);// 或者使用 GeometryEngine
Multipatch patchImport = GeometryEngine.Instance.ImportFromEsriShape(EsriShapeImportFlags.EsriShapeImportDefaults, buffer, multiPatch.SpatialReference) as Multipatch;

4 通过MultipatchBuilderEx构建多面体

var coords_face1 = new List<Coordinate3D>()
{new Coordinate3D(12.495461061000071,41.902603910000039,62.552700000000186),new Coordinate3D(12.495461061000071,41.902603910000039,59.504700000004959),new Coordinate3D(12.495461061000071,41.902576344000067,59.504700000004959),new Coordinate3D(12.495461061000071,41.902603910000039,62.552700000000186),new Coordinate3D(12.495461061000071,41.902576344000067,59.504700000004959),new Coordinate3D(12.495461061000071,41.902576344000067,62.552700000000186),
};var coords_face2 = new List<Coordinate3D>()
{new Coordinate3D(12.495461061000071, 41.902576344000067, 62.552700000000186),new Coordinate3D(12.495461061000071, 41.902576344000067, 59.504700000004959),new Coordinate3D(12.495488442000067, 41.902576344000067, 59.504700000004959),new Coordinate3D(12.495461061000071, 41.902576344000067, 62.552700000000186),new Coordinate3D(12.495488442000067, 41.902576344000067, 59.504700000004959),new Coordinate3D(12.495488442000067, 41.902576344000067, 62.552700000000186),
};var coords_face3 = new List<Coordinate3D>()
{new Coordinate3D(12.495488442000067, 41.902576344000067, 62.552700000000186),new Coordinate3D(12.495488442000067, 41.902576344000067, 59.504700000004959),new Coordinate3D(12.495488442000067, 41.902603910000039, 59.504700000004959),new Coordinate3D(12.495488442000067, 41.902576344000067, 62.552700000000186),new Coordinate3D(12.495488442000067, 41.902603910000039, 59.504700000004959),new Coordinate3D(12.495488442000067, 41.902603910000039, 62.552700000000186),
};var coords_face4 = new List<Coordinate3D>()
{new Coordinate3D(12.495488442000067, 41.902576344000067, 59.504700000004959),new Coordinate3D(12.495461061000071, 41.902576344000067, 59.504700000004959),new Coordinate3D(12.495461061000071, 41.902603910000039, 59.504700000004959),new Coordinate3D(12.495488442000067, 41.902576344000067, 59.504700000004959),new Coordinate3D(12.495461061000071, 41.902603910000039, 59.504700000004959),new Coordinate3D(12.495488442000067, 41.902603910000039, 59.504700000004959),
};var coords_face5 = new List<Coordinate3D>()
{new Coordinate3D(12.495488442000067, 41.902603910000039, 59.504700000004959),new Coordinate3D(12.495461061000071, 41.902603910000039, 59.504700000004959),new Coordinate3D(12.495461061000071, 41.902603910000039, 62.552700000000186),new Coordinate3D(12.495488442000067, 41.902603910000039, 59.504700000004959),new Coordinate3D(12.495461061000071, 41.902603910000039, 62.552700000000186),new Coordinate3D(12.495488442000067, 41.902603910000039, 62.552700000000186),
};var coords_face6 = new List<Coordinate3D>()
{new Coordinate3D(12.495488442000067, 41.902603910000039, 62.552700000000186),new Coordinate3D(12.495461061000071, 41.902603910000039, 62.552700000000186),new Coordinate3D(12.495461061000071, 41.902576344000067, 62.552700000000186),new Coordinate3D(12.495488442000067, 41.902603910000039, 62.552700000000186),new Coordinate3D(12.495461061000071, 41.902576344000067, 62.552700000000186),new Coordinate3D(12.495488442000067, 41.902576344000067, 62.552700000000186),
};var materialRed = new BasicMaterial();
materialRed.Color = System.Windows.Media.Colors.Red;var materialTransparent = new BasicMaterial();
materialTransparent.Color = System.Windows.Media.Colors.White;
materialTransparent.TransparencyPercent = 80;var blueTransparent = new BasicMaterial(materialTransparent);
blueTransparent.Color = System.Windows.Media.Colors.SkyBlue;// 创建补丁对象列表
var patches = new List<Patch>();// 创建多面体构建器对象
var mpb = new ArcGIS.Core.Geometry.MultipatchBuilderEx();// 使用适当的坐标制作每个补丁并添加到补丁列表中
var patch = mpb.MakePatch(PatchType.Triangles);
patch.Coords = coords_face1;
patches.Add(patch);patch = mpb.MakePatch(PatchType.Triangles);
patch.Coords = coords_face2;
patches.Add(patch);patch = mpb.MakePatch(PatchType.Triangles);
patch.Coords = coords_face3;
patches.Add(patch);patch = mpb.MakePatch(PatchType.Triangles);
patch.Coords = coords_face4;
patches.Add(patch);patch = mpb.MakePatch(PatchType.Triangles);
patch.Coords = coords_face5;
patches.Add(patch);patch = mpb.MakePatch(PatchType.Triangles);
patch.Coords = coords_face6;
patches.Add(patch);patches[0].Material = materialRed;
patches[1].Material = materialTransparent;
patches[2].Material = materialRed;
patches[3].Material = materialRed;
patches[4].Material = materialRed;
patches[5].Material = blueTransparent;// 将补丁分配给多面体构建器
mpb.Patches = patches;// 检查哪些补丁当前包含该材料
var red = mpb.QueryPatchIndicesWithMaterial(materialRed);
//   red should be [0, 2, 3, 4]// 调用geometry函数获取多面体
multipatch = mpb.ToGeometry() as Multipatch;

5 从另一个多面体构建多面体

// 创建多面体构建器对象
var builder = new ArcGIS.Core.Geometry.MultipatchBuilderEx(multipatch);// 检查一些属性
bool hasM = builder.HasM;
bool hasZ = builder.HasZ;
bool hasID = builder.HasID;
bool isEmpty = builder.IsEmpty;
bool hasNormals = builder.HasNormals;var patches = builder.Patches;
int patchCount = patches.Count;// 如果有补丁
if (patchCount > 0)
{int pointCount = builder.GetPatchPointCount(0);// 替换第一个补丁中的第一个点if (pointCount > 0){// 获取第一个点var pt = builder.GetPoint(0, 0);builder.SetPoint(0, 0, newPoint);}// 检查当前包含纹理的补丁var texture = builder.QueryPatchIndicesWithTexture(brickTextureResource);// 分配纹理材质patches[0].Material = brickMaterialTexture;
}// 更新builder以支持M值
builder.HasM = true;
// 同步补丁属性以匹配builder属性
// 在这种情况下,因为我们刚刚将HasM设置为true,每个补丁现在都将为其坐标集获取一个默认的M值
builder.SynchronizeAttributeAwareness();// 调用ToGeometry获取多面体
multipatch = builder.ToGeometry() as Multipatch;// multipatch.HasM 将为 true

6 从 3D 模型文件构建多面体

try
{var model = ArcGIS.Core.Geometry.MultipatchBuilderEx.From3DModelFile(@"c:\Temp\My3dModelFile.dae");bool modelIsEmpty = model.IsEmpty;
}
catch (FileNotFoundException)
{// 文件未找到
}
catch (ArgumentException)
{// 文件扩展名不受支持或无法读取文件
}

7 构建 3D 特殊多面体形状

var sr = MapView.Active.Map.SpatialReference;var extent = MapView.Active.Extent;
var center = extent.Center;
var centerZ = MapPointBuilderEx.CreateMapPoint(center.X, center.Y, 500, sr);// 立方体
multipatch = ArcGIS.Core.Geometry.MultipatchBuilderEx.CreateMultipatch(MultipatchConstructType.Cube, centerZ, 200, sr);
// 四面体
multipatch = ArcGIS.Core.Geometry.MultipatchBuilderEx.CreateMultipatch(MultipatchConstructType.Tetrahedron, centerZ, 200, sr);
// 菱形
multipatch = ArcGIS.Core.Geometry.MultipatchBuilderEx.CreateMultipatch(MultipatchConstructType.Diamond, centerZ, 200, sr);
// 六角形
multipatch = ArcGIS.Core.Geometry.MultipatchBuilderEx.CreateMultipatch(MultipatchConstructType.Hexagon, centerZ, 200, sr);// 球体框架
multipatch = ArcGIS.Core.Geometry.MultipatchBuilderEx.CreateMultipatch(MultipatchConstructType.SphereFrame, centerZ, 200, 0.8, sr);
// 球体
multipatch = ArcGIS.Core.Geometry.MultipatchBuilderEx.CreateMultipatch(MultipatchConstructType.Sphere, centerZ, 200, 0.8, sr);
// 圆柱体
multipatch = ArcGIS.Core.Geometry.MultipatchBuilderEx.CreateMultipatch(MultipatchConstructType.Cylinder, centerZ, 200, 0.8, sr);
// 圆锥体
multipatch = ArcGIS.Core.Geometry.MultipatchBuilderEx.CreateMultipatch(MultipatchConstructType.Cone, centerZ, 200, 0.8, sr);// 使用builder添加材料或纹理
// 创建一个带有材料的圆锥体
builder = new MultipatchBuilderEx(MultipatchConstructType.Cone, centerZ, 200, 0.8, sr);BasicMaterial faceMaterial = new BasicMaterial();
faceMaterial.Color = System.Windows.Media.Color.FromRgb(255, 0, 0);
faceMaterial.Shininess = 150;
faceMaterial.TransparencyPercent = 50;
faceMaterial.EdgeWidth = 20;foreach (var patch in builder.Patches)patch.Material = faceMaterial;multipatch = builder.ToGeometry() as Multipatch;

8 创建基本材料

// 使用默认值创建BasicMaterial
BasicMaterial material = new BasicMaterial();
System.Windows.Media.Color color = material.Color;         // color = Colors.Black
System.Windows.Media.Color edgeColor = material.EdgeColor; // edgeColor = Colors.Black
int edgeWidth = material.EdgeWidth;                        // edgeWidth = 0
int transparency = material.TransparencyPercent;           // transparency = 0
int shininess = material.Shininess;                        // shininess = 0
bool cullBackFace = material.IsCullBackFace;               // cullBackFace = false// 修改属性
material.Color = System.Windows.Media.Colors.Red;
material.EdgeColor = System.Windows.Media.Colors.Blue;
material.EdgeWidth = 10;
material.TransparencyPercent = 50;
material.Shininess = 25;
material.IsCullBackFace = true;

9 使用 JPEG 纹理创建基本材质

// 将jpeg读取到缓冲区中
// 在3.0版本中需要https://www.nuget.org/packages/Microsoft.Windows.Compatibility
// System.Drawing
System.Drawing.Image image = System.Drawing.Image.FromFile(@"C:\temp\myImageFile.jpg");
MemoryStream memoryStream = new MemoryStream();System.Drawing.Imaging.ImageFormat format = System.Drawing.Imaging.ImageFormat.Jpeg;
image.Save(memoryStream, format);
byte[] imageBuffer = memoryStream.ToArray();var jpgTexture = new JPEGTexture(imageBuffer);// 纹理属性
int bpp = jpgTexture.BytesPerPixel;
int columnCount = jpgTexture.ColumnCount;
int rowCount = jpgTexture.RowCount;// 构建textureResource和material
BasicMaterial material = new BasicMaterial();
material.TextureResource = new TextureResource(jpgTexture);

10 使用未压缩纹理创建基本材质

UncompressedTexture uncompressedTexture1 = new UncompressedTexture(new byte[10 * 12 * 3], 10, 12, 3);// 纹理属性
int bpp = uncompressedTexture1.BytesPerPixel;
int columnCount = uncompressedTexture1.ColumnCount;
int rowCount = uncompressedTexture1.RowCount;// 构建textureResource和material
TextureResource tr = new TextureResource(uncompressedTexture1);
BasicMaterial material = new BasicMaterial();
material.TextureResource = tr;

11 获取多面体的纹理图像

// <summary>
// 此方法获取多面体的材料纹理图像。
// 此方法必须在MCT上调用。使用QueuedTask.Run。
// </summary>
// <param name="multipatch">输入的多面体。</param>
// <param name="patchIndex">获取材料纹理的补丁(部分)索引。</param>
public void GetMultipatchTextureImage(Multipatch multipatch, int patchIndex)
{int materialIndex = multipatch.GetPatchMaterialIndex(patchIndex);if (!multipatch.IsMaterialTextured(materialIndex))return;TextureCompressionType compressionType = multipatch.GetMaterialTextureCompressionType(materialIndex);string ext = compressionType == TextureCompressionType.CompressionJPEG ? ".jpg" : ".dat";byte[] textureBuffer = multipatch.GetMaterialTexture(materialIndex);Stream imageStream = new MemoryStream(textureBuffer);System.Drawing.Image image = System.Drawing.Image.FromStream(imageStream);image.Save(@"C:\temp\myImage" + ext);
}

12 获取多面体的法线坐标

// <summary>
// 此方法获取多面体的法线坐标并执行一些操作。
// 此方法必须在MCT上调用。使用QueuedTask.Run。
// </summary>
// <param name="multipatch">输入的多面体。</param>
// <param name="patchIndex">获取法线的补丁(部分)索引。</param>
public void DoSomethingWithNormalCoordinate(Multipatch multipatch, int patchIndex)
{if (multipatch.HasNormals){// 如果多面体有法线,则法线数量等于点的数量。int numNormals = multipatch.GetPatchPointCount(patchIndex);for (int pointIndex = 0; pointIndex < numNormals; pointIndex++){Coordinate3D normal = multipatch.GetPatchNormal(patchIndex, pointIndex);// 对法线坐标进行一些操作。}}
}

13 获取多面体的法线

// <summary>
// 此方法获取多面体的法线坐标并执行一些操作。
// 此方法必须在MCT上调用。使用QueuedTask.Run。
// </summary>
// <param name="multipatch">输入的多面体。</param>
public void DoSomethingWithNormalCoordinates(Multipatch multipatch)
{if (multipatch.HasNormals){// 只分配一次列表int numPoints = multipatch.PointCount;ICollection<Coordinate3D> normals = new List<Coordinate3D>(numPoints);// 多面体的部分也称为补丁int numPatches = multipatch.PartCount;for (int patchIndex = 0; patchIndex < numPatches; patchIndex++){multipatch.GetPatchNormals(patchIndex, ref normals);// 对这个补丁的法线进行一些操作。}}
}

14 获取多面体的材质属性

public void GetMaterialProperties(Multipatch multipatch, int patchIndex)
{if (multipatch.HasMaterials){// 获取指定补丁的材质索引。int materialIndex = multipatch.GetPatchMaterialIndex(patchIndex);System.Windows.Media.Color color = multipatch.GetMaterialColor(materialIndex);int tranparencyPercent = multipatch.GetMaterialTransparencyPercent(materialIndex);bool isBackCulled = multipatch.IsMaterialCullBackFace(materialIndex);if (multipatch.IsMaterialTextured(materialIndex)){int bpp = multipatch.GetMaterialTextureBytesPerPixel(materialIndex);int columnCount = multipatch.GetMaterialTextureColumnCount(materialIndex);int rowCount = multipatch.GetMaterialTextureRowCount(materialIndex);}}
}

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

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

相关文章

Vue的计算属性和方法有什么区别

Vue中的计算属性&#xff08;computed&#xff09;和方法&#xff08;methods&#xff09;都是用于处理数据和逻辑的重要特性&#xff0c;但它们之间存在一些关键的区别。以下是两者的主要区别&#xff1a; 1. 缓存性 计算属性&#xff1a;计算属性是基于它们的依赖进行缓存的…

Pytorch实现图像分类-水果数据集分类--深度学习大作业

目录 1.概述 2.设计 3.实现 4.实验 5.总结 1.概述 本次深度学习大作业&#xff0c;我使用AlexNet模型对"Fruits-360"数据集中的两部分水果和蔬菜图片进行分类 2.设计 模型设计&#xff1a;Alexnet网络 卷积层部分&#xff1a;构建了一系列卷积层、激活函数…

【等保测评】服务器——Windows server 2012 R2

文章目录 **身份鉴别****访问控制****安全审计****入侵防范****恶意代码防范****可信验证****测评常用命令** Windows服务器安全计算环境测评 测评对象&#xff1a;Windows server 2012 R2 身份鉴别 &#xff08;高风险&#xff09;应对登录的用户进行身份标识和鉴别&#x…

【爱上C++】list用法详解、模拟实现

文章目录 一&#xff1a;list介绍以及使用1.list介绍2.基本用法①list构造方式②list迭代器的使用③容量④元素访问⑤插入和删除⑥其他操作image.png 3.list与vector对比 二&#xff1a;list模拟实现1.基本框架2.节点结构体模板3.__list_iterator 结构体模板①模板参数说明②构…

CentOS8无论安装更新什么都出现错误: Failed to download metadata for repo ‘AppStream‘

CentOS 已经停止维护&#xff0c;需要将镜像从 mirror.centos.org 更改为 vault.centos.org&#xff0c;依次执行以下命令即可: 1、cd /etc/yum.repos.d/ 2、sed -i s/mirrorlist/#mirrorlist/g /etc/yum.repos.d/CentOS-* 3、sed -i s|#baseurlhttp://mirror.centos.org|baseu…

【无人机】低空经济中5G RedCap芯片的技术分析报告

1. 引言 图一. 新基建&#xff1a;低空经济 低空经济作为一种新兴的经济形态&#xff0c;涵盖了无人机、电动垂直起降飞行器&#xff08;eVTOL&#xff09;、低空物流、空中交通管理等多个领域。随着5G网络的普及和演进&#xff0c;5G RedCap&#xff08;Reduced Capability&a…

Typora 1.5.8 版本安装下载教程 (轻量级 Markdown 编辑器),图文步骤详解,免费领取(软件可激活使用)

文章目录 软件介绍软件下载安装步骤激活步骤 软件介绍 Typora是一款基于Markdown语法的轻量级文本编辑器&#xff0c;它的主要目标是为用户提供一个简洁、高效的写作环境。以下是Typora的一些主要特点和功能&#xff1a; 实时预览&#xff1a;Typora支持实时预览功能&#xff0…

笔记:Enum中FlagsAttribute特性的用法

一、目的&#xff1a;分享Enum中FlagsAttribute特性的用法 在C#中&#xff0c;Enum&#xff08;枚举&#xff09;类型可以使用[Flags]属性来表示一个枚举可以存储多个值。这是通过按位运算符&#xff08;如|&#xff08;或&#xff09;和&&#xff08;与&#xff09;&#…

HarmonyOS应用开发者高级认证,Next版本发布后最新题库 - 多选题序号1

基础认证题库请移步&#xff1a;HarmonyOS应用开发者基础认证题库 注&#xff1a;有读者反馈&#xff0c;题库的代码块比较多&#xff0c;打开文章时会卡死。所以笔者将题库拆分&#xff0c;单选题20个为一组&#xff0c;多选题10个为一组&#xff0c;题库目录如下&#xff0c;…

腾讯云简单部署MYSQL 8.0

1.安装MySQL8.0资源库 yum localinstall https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm2.安装MySQL8.0 yum -y install mysql-community-server --nogpgcheck . yum -y install mysql-community-server --nogpgcheck 3.启动MySQL并配置开机自启 sys…

【效率提升】程序员常用Shell脚本

文章目录 常用Shell脚本一. 定期更新分区数据二、获取系统资源的使用情况 常用Shell脚本 一. 定期更新分区数据 在某些场景下&#xff0c;我们需要对N年前某一分区的数据进行删除&#xff0c;并添加今年该对应分区的数据&#xff0c;实现数据的流动式存储。 #!/bin/bash dt$…

【devops】ttyd 一个web版本的shell工具 | web版本shell工具 | web shell

一、什么是 TTYD ttyd是在web端一个简单的服务器命令行工具 类似我们在云厂商上直接ssh链接我们的服务器输入指令一样 二、安装ttyd 1、macOS Install with Homebrew: brew install ttydInstall with MacPorts: sudo port install ttyd 2、linux Binary version (recommend…

引入js的script标签如何做到异步加载

使用defer和async属性后&#xff0c;JavaScript加载和HTML解析之间的关系有所不同。了解这些差异可以帮助优化网页加载性能。 defer属性 行为&#xff1a; 当使用defer属性时&#xff0c;浏览器会异步加载JavaScript文件&#xff0c;不会阻塞HTML的解析。所有带有defer属性的…

Leetcode 3223. Minimum Length of String After Operations

Leetcode 3223. Minimum Length of String After Operations 1. 解题思路2. 代码实现 题目链接&#xff1a;3223. Minimum Length of String After Operations 1. 解题思路 这一题还是比较简单的&#xff0c;其实就是想明白对于任何一个字符&#xff0c;如果其个数在3个或以…

神经网络中如何优化模型和超参数调优(案例为tensor的预测)

总结&#xff1a; 初级&#xff1a;简单修改一下超参数&#xff0c;效果一般般但是够用&#xff0c;有时候甚至直接不够用 中级&#xff1a;optuna得出最好的超参数之后&#xff0c;再多一些epoch让train和testloss整体下降&#xff0c;然后结果就很不错。 高级&#xff1a;…

c++应用网络编程之五Windows常用的网络IO模型

一、Windows的网络编程 其实对开发者而言&#xff0c;只有Windows和其它平台。做为一种普遍流行的图形OS&#xff0c;其一定会与类Linux的编程有着明显的区别&#xff0c;这点当然也会体现在网络编程上。Windows有着自己一套相对独立的上层Socket编程模型或者说框架&#xff0…

Redis集群部署Windows版本

Redis集群 之前因为数据量的原因&#xff0c;并没有进行Redis集群的配置需要&#xff0c;现在由于数据量大&#xff0c;需要进行集群部署。 最初在windows系统部署&#xff0c;需要Redis的windows版本&#xff0c;但官方没有windows版本&#xff0c;所以需要去gitHub上找由民…

STM32 移植MQTT

在STM32上移植MQTT客户端库&#xff08;如Paho MQTT C库&#xff09;涉及几个关键步骤&#xff0c;包括库的选择、环境配置、代码集成和测试。下面是一个概括的指南&#xff0c;帮助你开始这个过程。 1. 选择MQTT库 对于STM32&#xff0c;你可以选择多个MQTT库&#xff0c;但…

【STM32】MPU内存保护单元

注&#xff1a;仅在F7和M7系列上使用介绍 功能&#xff1a; 设置不同存储区域的存储器访问权限&#xff08;管理员、用户&#xff09; 设置存储器&#xff08;内存和外设&#xff09;属性&#xff08;可缓冲、可缓存、可共享&#xff09; 优点&#xff1a;提高嵌入式系统的健壮…

Bash 学习摘录

文章目录 1、变量和参数的介绍&#xff08;1&#xff09;变量替换$(...) &#xff08;2&#xff09;特殊的变量类型export位置参数shift 2、引用&#xff08;1&#xff09;引用变量&#xff08;2&#xff09;转义 3、条件判断&#xff08;1&#xff09;条件测试结构&#xff08…