|
|||||||||
上一个类 下一个类 | 框架 无框架 | ||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |
java.lang.Object com.supermap.data.GeometriesRelation
public class GeometriesRelation
几何对象关系判断类,区别与空间查询的是,此类用于几何对象的判断,而不是数据集,实现原理上与空间查询相同,另外,此类只支持点、线、面的判断,适用于特定的场景 。
public java.util.Map<GeoRegion, ArrayList<Point2D>> RegionsContainPoints( GeoRegion[] regions, Point2D[] points) { GeometriesRelation geometriesRelation = new GeometriesRelation(); // 插入几何面对象 for (int index = 0; index < regions.length; index++) { geometriesRelation.insert(regions[index], index); } java.util.Map<GeoRegion, ArrayList<Point2D>> result = new java.util.HashMap<GeoRegion, ArrayList<Point2D>>(); for (int i = 0; i < points.length; i++) { // 找到所有包含当前点对象的面对象的值。 int[] regionValues = geometriesRelation.matches(points[i], SpatialQueryMode.CONTAIN); for (int j = 0; j < regionValues.length; j++) { GeoRegion geoRegion = regions[regionValues[j]]; if (result.containsKey(geoRegion)) { ArrayList<Point2D> outPoints = result.get(geoRegion); outPoints.add(points[i]); result.put(geoRegion, outPoints); } else { ArrayList<Point2D> outPoints = new ArrayList<Point2D>(); outPoints.add(points[i]); result.put(geoRegion, outPoints); } } } geometriesRelation.dispose(); return result; }
构造方法摘要 | |
---|---|
GeometriesRelation()
构造函数,构造一个几何对象关系判断对象。 |
方法摘要 | |
---|---|
void |
dispose()
释放 GeometriesRelation 占用的资源。 |
Rectangle2D |
getBounds()
获取 GeometriesRelation 中所有插入的几何对象的地理范围。 |
GriddingLevel |
getGridding()
获取面对象格网化等级。 |
int |
getSourcesCount()
获取 GeometriesRelation 中所有插入的几何对象数目。 |
double |
getTolerance()
获取节点容限。 |
boolean |
insert(Geometry geometry,
int value)
插入一个用于被匹配的几何对象,被匹配对象在空间查询模式中为查询对象,例如,要进行面包含点对象查询,需要插入面对象到 GeometriesRelation 中,然后依次匹配得到与点对象满足包含关系的面对象。 |
int[] |
intersectExtents(Rectangle2D extents)
返回与指定矩形范围相交的所有对象,即对象的矩形范围相交。 |
boolean |
isMatch(Geometry geometry,
int srcValue,
SpatialQueryMode mode)
判断对象是否与指定对象满足空间关系 |
boolean |
isMatch(Point2D point,
int srcValue,
SpatialQueryMode mode)
判断二维点是否与指定对象满足空间关系 |
int[] |
matches(Geometry[] geometries,
SpatialQueryMode mode)
找出与匹配对象满足空间关系的所有被匹配对象的值。 |
int[] |
matches(Geometry geometry,
SpatialQueryMode mode)
找出与匹配对象满足空间关系的所有被匹配对象的值。 |
int[] |
matches(Geometry geometry,
SpatialQueryMode mode,
int[] excludes)
找出与匹配对象满足空间关系的所有被匹配对象的值。 |
int[] |
matches(Point2D[] points,
SpatialQueryMode mode)
找出与二维点数组满足空间关系的所有被匹配对象的值 |
int[] |
matches(Point2D point,
SpatialQueryMode mode)
找出与点对象满足空间关系的所有被匹配对象的值。 |
int[] |
matches(Point2D point,
SpatialQueryMode mode,
int[] excludes)
找出与点对象满足空间关系的所有被匹配对象的值。 |
void |
setGridding(GriddingLevel level)
设置面对象格网化等级。 |
void |
setTolerance(double interval)
设置节点容限。 |
从类 java.lang.Object 继承的方法 |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
构造方法详细信息 |
---|
public GeometriesRelation()
方法详细信息 |
---|
public void dispose()
public void setTolerance(double interval)
interval
- 节点容限public double getTolerance()
public GriddingLevel getGridding()
public void setGridding(GriddingLevel level)
level
- 格网化等级。public int getSourcesCount()
public Rectangle2D getBounds()
public boolean insert(Geometry geometry, int value)
geometry
- 被匹配的几何对象,必须是点线面value
- 被匹配的值,是一个唯一值,且必须大于等于0,比如几何对象的 ID 等。
public int[] matches(Geometry geometry, SpatialQueryMode mode)
geometry
- 匹配空间对象mode
- 空间查询模式
public int[] matches(Geometry[] geometries, SpatialQueryMode mode)
geometries
- 匹配空间对象数组mode
- 空间查询模式
public int[] matches(Point2D point, SpatialQueryMode mode)
point
- 要进行匹配的二维点mode
- 空间查询模式
public int[] matches(Point2D[] points, SpatialQueryMode mode)
points
- 结果返回的形式为: 结果数目,结果IDs,结果数目,结果IDs,0,结果数目,结果IDs。mode
- 空间查询模式
public int[] matches(Geometry geometry, SpatialQueryMode mode, int[] excludes)
geometry
- 匹配空间对象mode
- 空间查询模式excludes
- 排除的值,即不参与匹配运算。
public int[] matches(Point2D point, SpatialQueryMode mode, int[] excludes)
point
- 要进行匹配的二维点mode
- 空间查询模式excludes
- 要进行匹配的二维点
public boolean isMatch(Point2D point, int srcValue, SpatialQueryMode mode)
point
- 要进行匹配的二维点srcValue
- 被匹配对象的值mode
- 匹配的空间查询模式
public boolean isMatch(Geometry geometry, int srcValue, SpatialQueryMode mode)
geometry
- 要进行匹配的对象srcValue
- 被匹配对象的值mode
- 匹配的空间查询模式
public int[] intersectExtents(Rectangle2D extents)
extents
- 指定的矩形范围
|
|||||||||
上一个类 下一个类 | 框架 无框架 | ||||||||
摘要: 嵌套 | 字段 | 构造方法 | 方法 | 详细信息: 字段 | 构造方法 | 方法 |