栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

LineString (JTS)

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

LineString (JTS)

1 背景

在实际生活中,线是客观存在的

在数学中,平面直角坐标系同样存在线的概念

java 语言如何表达在平面直角坐标系中一条直线

2 LineString

2.1 官网解释

Models an OGC-style LineString. A LineString consists of a sequence of two or more vertices, along with all points along the linearly-interpolated curves (line segments) between each pair of consecutive vertices. Consecutive vertices may be equal. The line segments in the line may intersect each other (in other words, the linestring may "curl back" in itself and self-intersect. Linestrings with exactly two identical points are invalid

A linestring must have either 0 or 2 or more points. If these conditions are not met, the constructors throw an IllegalArgumentException

2.2 个人批注

平面直角坐标系的 java实现类

3 应用

3.1  地图经纬度表示的线

   地图经纬度也是二位平面直角坐标系的一种,所以由经纬度点组成的经纬度线同样可以借助这个

类进行使用

3.2  平面直角坐标系表达的线

   平面直角坐标系所表达的线同样可以借助这个类进行使用

批注,在使用这个类之前如何你对平面直角坐标系没有一点概念,建议先学习一下平面直角坐标系

4  如何创建对象

4.1 基于点创建线

Coordinate[] coordinates = new Coordinate[] {
                new Coordinate(0, 0), new Coordinate(10, 10),
                new Coordinate(20, 20) };
LineString lineString = new GeometryFactory().createLineString(coordinates);

 4.2  基于WKT创建线

 

LineString g1 = (LineString)new WKTReader().read("LINESTRING (0 0, 10 10, 20 20)");

 

5 特性API

 5.1 获取线的起点

         

public Point getStartPoint() 

   5.2  获取线的终点

  

public Point getEndPoint() 

    5.3  获取线的长度

  public double getLength()

   5.4 获取线的 boundary

  public Geometry getBoundary()
    5.5  反转

   

public Geometry reverse()

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/963084.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号