JTS geometry 常用方法使用记录(二)

接着上一篇文章继续:(1247条消息) geometry 常用方法使用记录(一)_qiaobing1226的博客-CSDN博客

18. 两个几何的差集

 public Geometry symDifference(Geometry other) {
        if (this.isEmpty() || other.isEmpty()) {
            if (this.isEmpty() && other.isEmpty()) {
                return OverlayOp.createEmptyResult(4, this, other, this.factory);
            }

            if (this.isEmpty()) {
                return other.copy();
            }

            if (other.isEmpty()) {
                return this.copy();
            }
        }

        checkNotGeometryCollection(this);
        checkNotGeometryCollection(other);
        return SnapIfNeededOverlayOp.overlayOp(this, other, 4);
    }

19.返回几何体的缓冲区(一)

    默认样式

    public Geometry buffer(double distance) {
        return BufferOp.bufferOp(this, distance);
    }

20.返回几何体的缓冲区(二)

参数分别是:缓冲区宽度、端点圆弧样式

//线段末端样式
public static final int CAP_ROUND = 1;
public static final int CAP_FLAT = 2;
public static final int CAP_SQUARE = 3;

//quadrantSegments 圆弧处,线段数量
public static final int JOIN_ROUND = 1;  (默认)一个半圆
public static final int JOIN_MITRE = 2;  一条垂直于末端的直线
public static final int JOIN_BEVEL = 3;
public static final int DEFAULT_QUADRANT_SEGMENTS = 8;
//源方法
 public Geometry buffer(double distance, int quadrantSegments) {
        return BufferOp.bufferOp(this, distance, quadrantSegments);
    }

//调用示例
Geometry buffer = laneToQuery.buffer(bufferDis, BufferParameters.DEFAULT_QUADRANT_SEGMENTS);

  圆弧线段数

 quadrantSegments参数示例:JOIN_ROUND = 1

quadrantSegments参数示例:JOIN_ROUND = 2

 quadrantSegments参数示例:JOIN_ROUND = 3

 quadrantSegments参数示例:DEFAULT_QUADRANT_SEGMENTS = 8

21.返回几何体的缓冲区(三)

//源方法
 public Geometry buffer(double distance, int quadrantSegments, int endCapStyle) {
        return BufferOp.bufferOp(this, distance, quadrantSegments, endCapStyle);
    }


//调用示例
 Geometry buffer = laneToQuery.buffer(bufferDis, BufferParameters.DEFAULT_QUADRANT_SEGMENTS, BufferParameters.CAP_FLAT);
           

设置线段末尾端点样式

endCapStyle参数示例:CAP_ROUND = 1   (默认)一个半圆

endCapStyle参数示例:CAP_FLAT = 2   一条垂直于末端的直线

endCapStyle参数示例:CAP_SQUARE = 3

22.返回当前的几何的覆盖面几何

    public Geometry convexHull() {
        return (new ConvexHull(this)).getConvexHull();
    }

23. 获取当前几何的边界

LinearRing boundary = (LinearRing) polygon.getBoundary();

 

参考:SFS-简单要素标准

网址:1.2. II. SFS-简单要素标准 — OGC标准规范 文档 (osgeo.cn)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值