com.supermap.data
类 GeoCompound

java.lang.Object
  继承者 com.supermap.data.Geometry
      继承者 com.supermap.data.GeoCompound

public class GeoCompound
extends Geometry

复合几何对象类。

该类继承自 Geometry 类,主要用于 CAD 图层。复合几何对象由多个子对象构成,每一个子对象对应一个 Geometry 类对象。该类提供了添加、移除子对象等管理子对象的功能。

复合几何对象类的对象的结构是一个树状结构,复合几何对象由多个子对象构成,每一个子对象对应一个 Geometry 类对象,因此,复合几何对象的子对象也可以是一个复合几何对象类对象,以此类推,构成了复合几何对象的层层嵌套的树状结构,如下面的示意图,简单地展示了复合几何对象的树状结构。


构造方法摘要
GeoCompound()
          构造一个新的 GeoCompound 对象。
GeoCompound(GeoCompound geoCompound)
          根据给定的 GeoCompound 对象构造一个与其完全相同的新对象。
 
方法摘要
 int addPart(Geometry geometry)
          向复合几何对象中添加一个子对象。
 void adjust(boolean isMinGeometryMovedUp)
          调整复合几何对象中子对象的叠置顺序。
 GeoCompound clone()
          返回当前 GeoCompound 对象的一个拷贝。
 void dispose()
          释放该对象所占用的资源。
 Geometry[] divide(boolean isTopOnly)
          分解复合几何对象,复合几何对象的结构类似于树状结构, 如果分解时只分解顶层对象,则返回的几何对象仍然可能存在复合几何对象,否则将不含有复合几何对象。
 Geometry getPart(int index)
          返回复合几何对象中的指定序号的子对象。
 int getPartCount()
          返回构成复合几何对象的子对象的个数。
 boolean insertPart(int index, Geometry geometry)
          向复合几何对象中的指定序号的位置处插入一个子对象。
 Geometry mirror(Point2D startPoint, Point2D endPoint)
          返回当前复合几何对象关于指定线段对称的几何对象,即获取复合几何对象的镜像。
 boolean removePart(int index)
          删除复合几何对象中的指定序号的子对象。
 boolean setPart(int index, Geometry geometry)
          用指定的几何对象替换复合几何对象中指定序号处的子对象。
 
从类 com.supermap.data.Geometry 继承的方法
addCustomGeometryCreatedListener, fromXML, getBounds, getID, getInnerPoint, getStyle, getType, getVariantID, hitTest, isEmpty, offset, removeCustomGeometryCreatedListener, resize, rotate, setEmpty, setID, setStyle, toXML
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

GeoCompound

public GeoCompound()
构造一个新的 GeoCompound 对象。


GeoCompound

public GeoCompound(GeoCompound geoCompound)
根据给定的 GeoCompound 对象构造一个与其完全相同的新对象。

参数:
geoCompound - 给定的 GeoCompound 对象。
方法详细信息

getPartCount

public int getPartCount()
返回构成复合几何对象的子对象的个数。

返回:
构成复合几何对象的子对象的个数。
默认值:
默认值为 0。

addPart

public int addPart(Geometry geometry)
向复合几何对象中添加一个子对象。

参数:
geometry - 待添加的子对象,该对象是 Geometry 类对象。
返回:
成功添加的子对象的序号。

removePart

public boolean removePart(int index)
删除复合几何对象中的指定序号的子对象。

参数:
index - 指定的待删除子对象的序号。
返回:
删除成功返回 true; 否则返回 false。

getPart

public Geometry getPart(int index)
返回复合几何对象中的指定序号的子对象。

参数:
index - 指定的复合几何对象子对象的序号。
返回:
成功返回指定序号的子对象,失败返回空值。

insertPart

public boolean insertPart(int index,
                          Geometry geometry)
向复合几何对象中的指定序号的位置处插入一个子对象。

参数:
index - 指定的插入的位置,默认值为1。
geometry - 待插入的子对象。
返回:
插入成功返回 true; 否则返回 false。

setPart

public boolean setPart(int index,
                       Geometry geometry)
用指定的几何对象替换复合几何对象中指定序号处的子对象。

参数:
index - 被替换的子对象的序号,必须大于或者等于0。
geometry - 指定的几何对象。
返回:
替换成功返回 true; 否则返回 false。

adjust

public void adjust(boolean isMinGeometryMovedUp)
调整复合几何对象中子对象的叠置顺序。

参数:
isMinGeometryMovedUp - 是否将较小的子对象移到上面。

divide

public Geometry[] divide(boolean isTopOnly)
分解复合几何对象,复合几何对象的结构类似于树状结构, 如果分解时只分解顶层对象,则返回的几何对象仍然可能存在复合几何对象,否则将不含有复合几何对象。

复合几何对象类的对象的结构是一个树状结构,复合几何对象由多个子对象构成,每一个子对象对应一个 Geometry 类对象,因此,复合几何对象的子对象也可以是一个复合几何对象类对象,以此类推,构成了复合几何对象的层层嵌套的树状结构,如下面的示意图,简单地展示了复合几何对象的树状结构。

例子:如果分解下图中的红色矩形框所示的复合几何对象,当设置 isTopOnly 参数为 true 时,则在执行分解操作时,只分解它顶层所含有的子对象,即蓝色矩形框所示层次中的子对象,分解的结果将返回由下图所示的对象1、2、3、4构成的几何对象数组;当设置 isTopOnly 参数为 false 时,分解操作将分解该复合几何对象所有层次内的对象,分解后的几何对象将不包含有复合几何对象。

参数:
isTopOnly - 是否只分解顶层对象。该参数为 true 时,表示只分解顶层的对象。
返回:
几何对象数组。

dispose

public void dispose()
释放该对象所占用的资源。当调用该方法之后,此对象不再可用。

覆盖:
Geometry 中的 dispose

clone

public GeoCompound clone()
返回当前 GeoCompound 对象的一个拷贝。

覆盖:
java.lang.Object 中的 clone
返回:
通过克隆操作得到的 GeoCompound 对象。

mirror

public Geometry mirror(Point2D startPoint,
                       Point2D endPoint)
返回当前复合几何对象关于指定线段对称的几何对象,即获取复合几何对象的镜像。

覆盖:
Geometry 中的 mirror
参数:
startPoint - 指定的线段的起点。
endPoint - 指定的线段的终点。
返回:
复合几何对象的镜像。
另请参见:
Geometry.offset(double,double)