com.supermap.data
类 GeoLine
- java.lang.Object
-
- com.supermap.data.InternalHandle
-
- com.supermap.data.InternalHandleDisposable
-
- com.supermap.data.Geometry
-
- com.supermap.data.GeoLine
-
- 所有已实现的接口:
- IDisposable
public class GeoLine extends Geometry
线几何对象类,派生于
该类用于描述线状地理实体,如河流,道路,等值线等,一般用一个或多个有序坐标点集合来表示。线的方向决定于有序坐标点的顺序,也可以通过调用 reverse 方法来改变线的方向。线对象由一个或多个部分组成,每个部分称为线对象的一个子对象,每个子对象用一个有序坐标点集合来表示。可以对子对象进行添加,删除,修改等操作。Geometry类。
-
-
构造器概要
构造器 构造器和说明 GeoLine()构造一个新的 GeoLine 对象。GeoLine(GeoLine geoLine)用指定的 GeoLine 对象构造一个与其完全相同的新对象。GeoLine(Point2Ds points)根据指定的参数来构造一个 GeoLine 的新对象。GeoLine(Point2Ds points, boolean bHasM)根据指定的参数来构造一个 GeoLine 的新对象。
-
方法概要
所有方法 实例方法 具体方法 限定符和类型 方法和说明 intaddPart(Point2Ds points)向此线几何对象追加一个子对象。GeoLineclone()返回当前 GeoLine 对象的一个拷贝。GeoRegionconvertToRegion()将此线几何对象转换为面几何对象。voiddispose()释放该对象所占用的资源。Point2DfindPointOnLineByDistance(double distance)在线上以指定的距离找点,查找的起始点为线的起始点。booleanfromXML(String xml)从XML加载几何对象doublegetLength()返回线几何对象的长度,其值为各个子对象长度之和。Point2DsgetPart(int index)返回此线几何对象中指定序号的子对象,以有序点集合的方式返回该子对象。intgetPartCount()返回线几何对象的子对象个数。intindexOf(Point2Ds part)返回指定有序点集合所表示的子对象在此线几何对象中的序号。booleaninsertPart(int index, Point2Ds points)往此线几何对象中的指定位置插入一个子对象。booleanisEmpty()返回线几何对象是否为空,即其子对象个数是否为零。Geometrymirror(Point2D startPoint, Point2D endPoint)返回当前线几何对象关于指定线段对称的几何对象,即获取线几何对象的镜像。voidoffset(double dx, double dy)偏移booleanremovePart(int index)删除此线几何对象中的指定序号的子对象。voidresize(Rectangle2D bounds)改变几何对象的大小 当宽度为负数时对象水平翻转,当高度为负数时,对象垂直翻转booleanreverse()改变该线几何对象的各个子对象的方向,即将表示各子对象的有序点集合中的点的顺序颠倒。voidrotate(Point2D basePoint, double angle)旋转几何对象voidsetEmpty()清空当前线几何对象的空间数据,即删除其所有子对象。booleansetPart(int index, Point2Ds points)修改此线几何对象指定序号的子对象,即用新的有序点集合来替换原子对象的有序点集合。-
从类继承的方法 com.supermap.data.Geometry
addCustomGeometryCreatedListener, getBounds, getHasM, getID, getInnerPoint, getStyle, getType, getVariantID, hitTest, removeCustomGeometryCreatedListener, setBounds, setHasM, setID, setStyle, toXML
-
-
-
-
构造器详细资料
-
GeoLine
public GeoLine()
构造一个新的 GeoLine 对象。
-
GeoLine
public GeoLine(GeoLine geoLine)
用指定的 GeoLine 对象构造一个与其完全相同的新对象。- 参数:
geoLine- 指定的 GeoLine 对象。- 抛出:
IllegalArgumentException- 如果作为拷贝源的线对象已调用dispose()方法。
-
GeoLine
public GeoLine(Point2Ds points)
根据指定的参数来构造一个 GeoLine 的新对象。- 参数:
points- 构成线的有序点集合。- 抛出:
IllegalArgumentException- 如果 points 中的点的总数小于2。
-
GeoLine
public GeoLine(Point2Ds points, boolean bHasM)
根据指定的参数来构造一个 GeoLine 的新对象。- 参数:
points- 构成线的有序点集合。bHasM- 是否包含M值- 抛出:
IllegalArgumentException- 如果 points 中的点的总数小于2。
-
-
方法详细资料
-
isEmpty
public boolean isEmpty()
返回线几何对象是否为空,即其子对象个数是否为零。- 覆盖:
isEmpty在类中Geometry- 返回:
- 如果线几何对象为空则返回 true,否则返回 false。
- 另请参阅:
Geometry.offset(double, double)
-
clone
public GeoLine clone()
返回当前 GeoLine 对象的一个拷贝。
-
dispose
public void dispose()
释放该对象所占用的资源。调用该方法之后,此对象不再可用。- 指定者:
dispose在接口中IDisposable- 指定者:
dispose在类中Geometry
-
getLength
public double getLength()
返回线几何对象的长度,其值为各个子对象长度之和。- 返回:
- 线几何对象的长度。
- 默认值:
- 默认值为 0.0。
-
getPartCount
public int getPartCount()
返回线几何对象的子对象个数。 线几何对象清空后,其子对象的个数为0。- 返回:
- 该线几何对象的子对象个数。
- 默认值:
- 默认值为 0。
-
addPart
public int addPart(Point2Ds points)
向此线几何对象追加一个子对象。- 参数:
points- 一个有序点集合。- 返回:
- 成功返回添加的子对象的序号。
- 抛出:
IllegalArgumentException- 如果 points 中的点的个数小于2。
-
removePart
public boolean removePart(int index)
删除此线几何对象中的指定序号的子对象。- 参数:
index- int 指定的子对象的序号。- 返回:
- 成功则返回 true,否则返回 false。
- 抛出:
IndexOutOfBoundsException- 如果序号大于等于子对象的个数或序号小于0。
-
convertToRegion
public GeoRegion convertToRegion()
将此线几何对象转换为面几何对象。转换成功返回面几何对象。- 对于没有封闭的线对象,转换为面对象时,会把首尾自动连起来。
- 当此
GeoLine对象实例的某个子对象的点数少于3抛出 InvalidOperationException 异常。
- 返回:
- 转换成功返回区域对象。
- 抛出:
IllegalArgumentException- 如果此GeoLine对象实例的某个子对象的点数少于3。
-
findPointOnLineByDistance
public Point2D findPointOnLineByDistance(double distance)
在线上以指定的距离找点,查找的起始点为线的起始点。- 当 distance 大于 Length 时,返回线最后一个子对象的终点。
- 当 distance=0 时,返回线几何对象的起始点;
- 当线几何对象具有多个子对象的时候,按照子对象的序号依次查找,例如一个线几何对象有三个子对象组成,如下图所示。
箭头表示了各子对象的方向,P0,P1 和 P2 分别为其起点,其长度分别为 L1,L2 和 L3,dl 表示指定的距离,p 表示某一个子对象上 dl 距离的终止点,P3 为 L3 的终点。
当distance=0时,返回 P0 点;
当distance>L1+L2+L3时,返回 P3 点;
当distance=L1+dL时,返回 P 点。
- 参数:
distance- 要找点的距离- 返回:
- 查找成功返回要找的点,否则返回 null。
- 抛出:
IllegalArgumentException- 如果传入的距离为负值。
-
getPart
public Point2Ds getPart(int index)
返回此线几何对象中指定序号的子对象,以有序点集合的方式返回该子对象。当二维线对象是简单线对象时,如果传入参数0,得到的是此线对象的节点的集合。
- 参数:
index- 子对象的序号。- 返回:
- 成功返回
Point2Ds对象,失败返回空值。
-
insertPart
public boolean insertPart(int index, Point2Ds points)往此线几何对象中的指定位置插入一个子对象。成功则返回 true,否则返回 false。- 参数:
index- 插入的位置。points- 插入的有序点集合。- 返回:
- 成功则返回 true,否则返回 false。
- 抛出:
IndexOutOfBoundsException- 如果 index 大于该线几何对象的子对象总数或 index 为负。IllegalArgumentException- 如果 points 中的点的总数小于2。
-
reverse
public boolean reverse()
改变该线几何对象的各个子对象的方向,即将表示各子对象的有序点集合中的点的顺序颠倒。- 返回:
- 成功则返回 true,否则返回 false。
-
setPart
public boolean setPart(int index, Point2Ds points)修改此线几何对象指定序号的子对象,即用新的有序点集合来替换原子对象的有序点集合。- 参数:
index- 被修改的子对象的序号。points- 有序点的集合。- 返回:
- 成功返回 true,否则返回 false。
- 抛出:
IndexOutOfBoundsException- 如果 index 不小于子对象的个数或 index 为负。IllegalArgumentException- 如果 points 中的点的个数小于2。
-
indexOf
public int indexOf(Point2Ds part)
返回指定有序点集合所表示的子对象在此线几何对象中的序号。- 参数:
part- 指定的有序点集合。- 返回:
- 指定有序点集合所表示的子对象在此线几何对象中的序号,若该子对象不存在,则返回-1。
-
fromXML
public boolean fromXML(String xml)
从XML加载几何对象- 覆盖:
fromXML在类中Geometry- 参数:
xml- String- 返回:
- boolean
- 另请参阅:
Geometry.offset(double, double)
-
mirror
public Geometry mirror(Point2D startPoint, Point2D endPoint)
返回当前线几何对象关于指定线段对称的几何对象,即获取线几何对象的镜像。- 覆盖:
mirror在类中Geometry- 参数:
startPoint- 指定的线段的起点。endPoint- 指定的线段的终点。- 返回:
- 线几何对象的镜像。
- 另请参阅:
Geometry.offset(double,double)
-
offset
public void offset(double dx, double dy)偏移
-
resize
public void resize(Rectangle2D bounds)
改变几何对象的大小 当宽度为负数时对象水平翻转,当高度为负数时,对象垂直翻转
-
rotate
public void rotate(Point2D basePoint, double angle)
旋转几何对象
-
-
Copyright © 2021–2025 SuperMap. All rights reserved.