您的位置:首页 > 编程语言 > Java开发

geometry-api-java 学习笔记(七)拓扑运算之cut

2017-07-10 14:26 501 查看
cut操作是一种布尔操作,cut操作符就是对给定的几何图形进行cut。

下图给了例子:



用java操作cut如下:

//This creates an instance of the cut operator. //创建cut操作的句柄
OperatorCut opCut = OperatorCut.local();

/*
* considerTouch: True/False indicates whether we consider a touch event a cut
* cuttee: Input Geometry to be cut (Polygon/Polyline)
* cutter: Polyline which will divide the cuttee into pieces where it crosses the cutter.
* Returns a Geometry cursor of the cut geometries.
*/
GeometryCursor cursor = opCut.execute(considerTouch, cuttee, cutter, spatialReference, null);

/*
* For retrieving the resultant Polygon(s) from the GeometryCurson we use,
*/
Polygon cut = (Polygon) cursor.next();

这里主要注意
opCut.execute(considerTouch, cuttee, cutter, spatialReference, null);

里面给定的四个参数即可,最后返回一个集合游标。
提示:这里的cut线为又向线,沿着方向切割。

All left cuts will be grouped together in the first geometry. Right cuts and coincident cuts are grouped in the second geometry. Each undefined cut along with any uncut parts are output as separate geometries. If there were no cuts, the cursor will return
no geometry. If the left or right cut does not exist, the returned geometry will be empty for this type of cut.

An undefined cut will only be produced if a left or right cut was produced and there was a part left over after cutting or a cut is bounded to the left and right of the cutter.

参考:http://esri.github.io/geometry-api-java/doc/Cut.html
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: