首先我们了解 arcgis for android 的开发文档
http://resources.arcgis.com/en/help/android-sdk/
1.GeometryEngine 给我提供很多方法其中有 difference
public static Geometry difference (Geometry inputGeometry, Geometry substractor, SpatialReference spatialReference)
Creates the difference of two geometries. The resultant geometry is the part of inputGeometry not in the substractor. The dimension of substractor has to be equal to or greater than that of inputGeometry.
Parameters
inputGeometry | The geometry being subtracted. |
---|---|
substractor | The geometry object to subtract from. |
spatialReference | The spatial reference of the geometries. |
创建两个几何的差异。 生成的几何是inputGeometry的一部分,不在减法器中。 减法器的尺寸必须等于或大于inputGeometry的尺寸。
我们只需要获取两个 Geometry 即可实现裁剪操作。
Geometry clipGeometry;
Geometry inputGeometry;
Geometry geometry = GeometryEngine.difference(clipGeometry,inputGeometry, SpatialReference.create(SpatialReference.WKID_WGS84));
这样就可以得到一个新的图层。
2.GeometryEngine 合并 给我提供很多方法其中有 union
public static Geometry union (Geometry[] geometries, SpatialReference spatialReference)
Constructs a new geometry by union an array of geometries. All inputs must be of the same type of geometries and share one spatial reference.
Parameters
geometries | The geometries to union. |
---|---|
spatialReference | The spatial reference of the geometries. |
Returns
- The geometry object representing the resultant union.
通过合并一组几何图形来构造新的几何图形。 所有输入必须具有相同的几何类型,并且共享一个空间参考。
合并的方法比较简单,
Geometry[] geometrys = new Geometry[2];
geometrys[0] = uniteGeometry1;
geometrys[1] = uniteGeometry2;
Geometry geometry = GeometryEngine.union(geometrys, SpatialReference.create(SpatialReference.WKID_WGS84));
这样就可以生成一个新的图形。
如果有不懂的可以加我QQ 1051163731 (备注:优快云)
欢迎加我微信: wanbeishijie
一起交流学习或者合作开发