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

网站建设与运营市场开发方案广州本地做网站

网站建设与运营市场开发方案,广州本地做网站,市场调研表模板,做哪些网站可以赚钱的基础知识 Coordinate: 表示一个二维坐标点,包括 X 和 Y 坐标值。 CoordinateSequence: 由一系列 Coordinate 对象组成的序列,可以表示线、多边形等几何对象的顶点。 CoordinateFilter: 用于对几何对象的坐标进行过滤或修改的接口。 Geometry: 表示一个几…

 

基础知识
Coordinate: 表示一个二维坐标点,包括 X 和 Y 坐标值。
CoordinateSequence: 由一系列 Coordinate 对象组成的序列,可以表示线、多边形等几何对象的顶点。
CoordinateFilter: 用于对几何对象的坐标进行过滤或修改的接口。

Geometry: 表示一个几何对象的抽象基类。它有许多具体的子类,如 Point、LineString、Polygon 等,用于表示不同类型的几何对象。
GeometryFactory: 用于创建几何对象的工厂类,提供了创建不同类型几何对象的方法。
GeometryCollection: 表示多个几何对象的集合,可以包含各种类型的几何对象。
GeometryTransformer: 用于对几何对象进行转换的工具类,包括坐标系转换、平移、旋转、缩放等操作。

Envelope: 表示一个矩形边界框,可以用于表示几何对象的边界范围。

IntersectionMatrix: 描述几何对象之间的拓扑关系的矩阵,包含 9 个位置值(Dimensional Extended Nine-Intersection Model)。

PrecisionModel: 用于控制几何对象坐标的精度和舍入规则。
Point: 表示一个点的几何对象,由一个坐标构成。

LineString: 表示一条线段或曲线的几何对象,由一系列有序的坐标点构成。

LinearRing: 表示一个封闭的线环,通常用于定义多边形的外环或内环。

Polygon: 表示一个多边形的几何对象,由一个外环和零个或多个内环组成。

MultiPoint: 表示多个点的集合,每个点都是一个独立的几何对象。
MultiLineString: 表示多条线段或曲线的集合,每条线段都是一个独立的几何对象。
MultiPolygon: 表示多个多边形的集合,每个多边形都是一个独立的几何对象。

DistanceOp: 用于计算几何对象之间的距离和最近点的工具类。

IntersectionMatrix: 描述几何对象之间的拓扑关系的矩阵,包含 9 个位置值(Dimensional Extended Nine-Intersection Model)。

引用库:

代码如下:

//using GeoAPI.Geometries;
using NetTopologySuite.Features;
using NetTopologySuite.Geometries;
using NetTopologySuite;
using NetTopologySuite.IO;
using Coordinate = NetTopologySuite.Geometries.Coordinate;
//using GeoAPI;
using NetTopologySuite.Operation.Polygonize;
using System.Threading;
using Point = NetTopologySuite.Geometries.Point;
using Polygon = NetTopologySuite.Geometries.Polygon;
using NetTopologySuite.Index.Quadtree;
using NetTopologySuite.Index.Strtree;
using NetTopologySuite.Triangulate;
using NetTopologySuite.Operation.Linemerge;
using System.Windows.Media;
using GeometryCollection = NetTopologySuite.Geometries.GeometryCollection;
using NetTopologySuite.Operation.Distance;
using NetTopologySuite.Algorithm;
using NetTopologySuite.Index.Bintree;
using System.Net.NetworkInformation;
using GeoAPI.Geometries;
using NetTopologySuite.IO.Esri.Shapefiles;
using NetTopologySuite.IO.Esri.Dbf;
using System.Collections;
[assembly: CommandClass(typeof(IfoxDemo.NTS自己))]//只允许此类快捷键命令namespace IfoxDemo
{public class NTS自己{[CommandMethod("xx")]public static void shp(){var ed = Env.Editor;"ad".Print();// 创建一个点对象var point = new Point(10, 20);ed.WriteMessage("// 创建一个点对象 point :" + point + "\n");// 创建一条线段对象var line = new LineString(new[] { new Coordinate(0, 0),new Coordinate(10, 10),new Coordinate(20, 0)});ed.WriteMessage("// 创建一条线段对象 line :" + line + "\n");// 创建一个多边形对象var polygon = new Polygon(new LinearRing(new[] {new Coordinate(0, 0),new Coordinate(0, 10),new Coordinate(10, 10),new Coordinate(10, 0),new Coordinate(0, 0)}));ed.WriteMessage("//  创建一个多边形对象 polygon : " + polygon + "\n");// 计算两个几何对象之间的距离var distance = point.Distance(line);ed.WriteMessage("//  计算两个几何对象之间的距离 distance: " + distance + "\n");// 计算一个几何对象的缓冲区var buffer = polygon.Buffer(0.5);Env.Editor.WriteMessage("//计算一个几何对象的缓冲区 buffer: " + buffer + "\n");// 判断两个几何对象是否相交var isIntersect = line.Intersects(polygon);ed.WriteMessage("//判断两个几何对象是否相交 isIntersect: " + isIntersect + "\n");// 创建一个包含所有几何对象的边界框//var envelope = line.Envelope.Union(polygon.Envelope);//    public void Insert(Envelope itemEnv, T item)//{//    CollectStats(itemEnv);//    var insertEnv = EnsureExtent(itemEnv, _minExtent);//    _root.Insert(insertEnv, item);//}// 创建一个 Quadtree 索引//var index = new Quadtree<NetTopologySuite.Geometries.Geometry>();//    index.Insert(envelope,line);//有bug//index.Insert(polygon);// 在索引中查找与一个几何对象相交的对象// var results = index.Query(line.EnvelopeInternal);// Env.Editor.WriteMessage("查找与一个几何对象相交的对象 results : " + results);GeometryFactory geometryFactory = new GeometryFactory();// 创建点Point point1 = geometryFactory.CreatePoint(new Coordinate(1.0, 1.0));Point point2 = geometryFactory.CreatePoint(new Coordinate(2.0, 12.0));Point point3 = geometryFactory.CreatePoint(new Coordinate(21.0, 22.0));Point point4 = geometryFactory.CreatePoint(new Coordinate(23.0, 32.0));Point point5 = geometryFactory.CreatePoint(new Coordinate(25.0, 42.0));Point point6 = geometryFactory.CreatePoint(new Coordinate(27.0, 52.0));Point point7 = geometryFactory.CreatePoint(new Coordinate(29.0, 62.0));// 使用 DistanceOp 计算两点之间的距离DistanceOp distanceOp = new DistanceOp(point1, point2);double dist = distanceOp.Distance();Env.Editor.WriteMessage("//计算两点之间的距离 dist : " + dist + "\n");// 创建线段LineString lineString = geometryFactory.CreateLineString(new Coordinate[] {new Coordinate(0, 0),new Coordinate(1, 1),new Coordinate(2, 2)});// 创建多边形Polygon polygon2 = geometryFactory.CreatePolygon(new Coordinate[] {new Coordinate(0, 0),new Coordinate(0, 1),new Coordinate(1, 1),new Coordinate(1, 0),new Coordinate(0, 0)});//计算两条线段的夹角(不区分方向)逆时针为正var 夹角不区分方向 = AngleUtility.AngleBetween(point1.Coordinate, point3.Coordinate, point2.Coordinate);ed.WriteMessage("//夹角不区分方向,逆时针为正" + 夹角不区分方向 + "\n");//计算两条线段的夹角(区分方向)var 夹角区分方向 = AngleUtility.AngleBetweenOriented(point1.Coordinate, point3.Coordinate, point2.Coordinate);ed.WriteMessage("//夹角区分方向" + 夹角区分方向 + "\n");// 生成 Delaunay 三角网DelaunayTriangulationBuilder dtb = new DelaunayTriangulationBuilder();dtb.SetSites(new MultiPoint(new Point[] { point1, point2, point3, point4, point5, point6, point7 }));GeometryCollection triangles = (GeometryCollection)dtb.GetTriangles(geometryFactory);Env.Editor.WriteMessage("//Delaunay 三角网 triangles: " + triangles + "\n");// 合并线段LineMerger lineMerger = new LineMerger();lineMerger.Add(lineString);System.Collections.ICollection mergedLines = (System.Collections.ICollection)lineMerger.GetMergedLineStrings();Env.Editor.WriteMessage("//合并线段 mergedLines : " + mergedLines + "\n");//创建集合图形// 几何创建工厂(也可不使用工厂模式直接创建几何图形)var gf = new GeometryFactory();var pg3 = gf.CreatePolygon(new[]{new Coordinate(612, 612),new Coordinate(144, 355),new Coordinate(165, 188),new Coordinate(277, 328),new Coordinate(612, 612)});Env.Editor.WriteMessage(" //创建几何图形Polygon pg3 : " + pg3 + "\n");var pg4 = gf.CreatePolygon(new[]{new Coordinate(412, 612),new Coordinate(555, 455),new Coordinate(655, 188),new Coordinate(577, 328),new Coordinate(412, 612)});//求并集方法var union = pg3.Union(pg4);Env.Editor.WriteMessage("//求并集:union  " + union + "\n");//求差集方法var difference = pg3.Difference(pg4);Env.Editor.WriteMessage("//求差集:difference  " + difference + "\n");// 创建一个包含多个点的集合Coordinate[] coordinates = new Coordinate[]{new Coordinate(0, 0),new Coordinate(5, 0),new Coordinate(3, 3),new Coordinate(0, 5),new Coordinate(2, 2),new Coordinate(1, 4)};GeometryFactory geometryFactory2 = new GeometryFactory();MultiPoint points = geometryFactory2.CreateMultiPointFromCoords(coordinates);Env.Editor.WriteMessage("//包含多个点的集合MultiPoint: " + points + "\n");// 使用 NetTopologySuite 计算二维凸包ConvexHull convexHull = new ConvexHull(points);var geo = new ConvexHull(points.Coordinates, GeometryFactory.Default).GetConvexHull();var 二维凸包 = convexHull.GetConvexHull();Env.Editor.WriteMessage("//计算二维凸包geo: " + geo + "\n");Env.Editor.WriteMessage("//计算二维凸包Convex hull geometry: " + 二维凸包 + "\n");//检测一个环是否是简单的(IsSimple)复杂的示例(IsSimple=false,自相交):var points2 = new Coordinate[] {new Coordinate(2,1), new Coordinate(3, 1),new Coordinate(1,4), new Coordinate(4, 4),new Coordinate(2, 1),};var ring = new LinearRing(points2);ed.WriteMessage("//检测一个环是否是简单的(true)、(自相交false) " + ring.IsSimple + "\n");var ring2 = new LinearRing(points2);ed.WriteMessage("//检测多边形的顺逆时针 rings2是: " + (ring2.IsCCW ? "逆时针" : "顺时针") + "\n");多边形的凹凸(convex / concave) 和 顺(Clockwise)/ 逆(CounterClockwise)时针3.1 多边形的凹凸定义:凸多边形(convex): 所有的内角都小于180°;凹多边形(concave): 至少有一个内角大于180°;/////在C#环境中,使用NetTopologySuite.IO.ShapeFile通常涉及以下步骤://1.引入必要的NuGet包,如NetTopologySuite和NetTopologySuite.IO。//2.创建`ShapefileReader`或`ShapefileWriter`对象来读取或写入Shapefile。//3.使用`ReadShape()`或`ReadFeature()`方法获取Shapefile中的几何对象和属性。//4.对数据进行操作,如计算几何、筛选属性等。//5.使用`WriteShape()`或`WriteFeature()`方法将修改后的数据写回Shapefile。string path = @"C:\Users\Administrator\Desktop\黄岗寺\黄岗寺.shp";// 检查文件是否存在if (!File.Exists(path)){ed.WriteMessage("Shapefile not found.\n");return;}ShapefileReader reader = new ShapefileReader(path);/*****             读取dbf文件                   ******/string dbfPath = @"C:\Users\Administrator\Desktop\黄岗寺\黄岗寺.dbf";if (!File.Exists(dbfPath)){ed.WriteMessage("dbf not found.\n");return;}using var dbf = new DbfReader(dbfPath);foreach (var record in dbf){foreach (var fieldName in record.GetNames()){ed.WriteMessage($"{fieldName,10} {record[fieldName]}\n");}}/************    读取shp文件     *************/string shpPath = @"C:\Users\Administrator\Desktop\黄岗寺\黄岗寺.shp";if (!File.Exists(shpPath)){ed.WriteMessage("dbf not found.\n");return;}//foreach (var geometry in Shapefile.ReadAllGeometries(shpPath))//{//    Console.WriteLine(geometry);//}var features = NetTopologySuite.IO.Esri.Shapefile.ReadAllFeatures(shpPath);int i = 0;foreach (var feature in features){i++;//此时通过NTS库读取的Geometry SRID为0,没有坐标系var geometry = feature.Geometry;ed.WriteMessage(@$"geometry{i}:" + geometry + "\n");//这一步为Geometry添加4326坐标系var geometryForWGS84 = GeometryFactory.Default.WithSRID(4326).CreateGeometry(geometry);ed.WriteMessage("wkbForWGS84:"+ geometryForWGS84 + "\n");}}}
}


文章转载自:

http://uhOH6I2N.gbcnz.cn
http://QUvvWssA.gbcnz.cn
http://HvHfWJFJ.gbcnz.cn
http://8eIFBAtC.gbcnz.cn
http://IhZcFBNG.gbcnz.cn
http://xLFzsrhH.gbcnz.cn
http://fhsYfXB6.gbcnz.cn
http://JTgorDBa.gbcnz.cn
http://SVc3Ip5a.gbcnz.cn
http://du8FPoGb.gbcnz.cn
http://UYGfSsye.gbcnz.cn
http://CIgkGmNo.gbcnz.cn
http://gXWcAv9v.gbcnz.cn
http://sfKzfBFr.gbcnz.cn
http://mWCH8G1R.gbcnz.cn
http://ENHuinme.gbcnz.cn
http://PDhyfzMm.gbcnz.cn
http://8iMH0dF8.gbcnz.cn
http://UrX1fpMO.gbcnz.cn
http://1Lj6fTHw.gbcnz.cn
http://GPZpF5lT.gbcnz.cn
http://Z8cmuz4B.gbcnz.cn
http://qwjrccv5.gbcnz.cn
http://iOiCZLjR.gbcnz.cn
http://v7oj0TY7.gbcnz.cn
http://KTXWpKsf.gbcnz.cn
http://hcwOH0sP.gbcnz.cn
http://jSUtSVck.gbcnz.cn
http://oI6wkkqT.gbcnz.cn
http://OZeD6JmM.gbcnz.cn
http://www.dtcms.com/wzjs/718351.html

相关文章:

  • .net做的网站怎么样建站行业解决方案
  • dedecms网站地图怎么做.概述网站建设的基本流程
  • 那个视频网站做公开课比较好上海今天最新新闻10条
  • 企业响应式网站建设报价自己有网站做app吗
  • 擦彩网站开发百度网盘下载的文件在哪
  • h5网站如何做排名新加坡网址大全
  • 教育公司 网站建设做庭院景观的那个网站推广好
  • 临海市住房和城乡建设规划局网站京东电子商务网站的建设
  • 网站推广企业高县住房和城乡建设部网站
  • 网站建设实训报告心得做c 题的网站
  • 做网站经常加班还是app网页制作模板设计
  • 做电商网站的框架结构图网站开发后端是什么
  • 用帝国cms系统怎么做网站东坑网页设计
  • 使用网站南京企业网站开发费用申请
  • 有空间怎么做网站吸引顾客的营销策略
  • 国外源码下载网站wordpress俄语版
  • 景区官方网站建设方案宣传片拍摄方案策划书
  • 提供网站建设哪家效果好乐清公司网站建设
  • dede网站 设置404 错误页面桂园精品网站建设费用
  • 河北网站建设与管理专业精准网络营销推广
  • 湖北网站建设贴吧传奇新服网
  • 对于职业规划做的好的网站无锡做网站公司多少钱
  • 本地网站做通用会员卡广州开发app哪家公司好
  • 西安网站建设软件公司起名打分最准的免费网站
  • 承德网站开发公司怎么制做网站
  • 网站写好了怎么做后台管理住房和城乡建设部网站公告
  • 被网上教开网店的骗了怎么办烟台网站排名优化公司
  • 钓鱼网站怎么制作视频html代码自动生成器
  • 最好的网站开发wordpress now
  • 免费跨境电商网站百度推广必须做手机网站吗