上篇我们主要对几何对象之间的关系做了简单的说明,在GEOS中的方法使做了大概的了解,本篇我们以程序实例对这几种关系进行简单的验证说明,直接上代码:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32// GeoTest.cpp : 定义控制台应用程序的入口点。 // #include "stdafx.h" #include <iostream> #include <stdlib.h> #include "geos.h" using namespace std; using namespace geos; using namespace geos::geom; static const GeometryFactory* g_factory = geos::geom::GeometryFactory::getDefaultInstance(); //全局对象,所有的图形都由此对象创建 //单点的创建 Point* createGeosPoint(double x, double y) { Coordinate pt(x, y); //坐标 Point* p = g_factory->createPoint(pt); return p; } //多点的创建 MultiPoint* createGeosMultiPoint(double x, double y, double offset) { CoordinateArraySequence *cas = new CoordinateArraySequence(); //构建点序列 std::vector<Coordinate> points; points.push_back(Coordinate(x, y)); points.push_back(Coordinate(x + offset, y)); points.push_back(Coordinate(x + 2 * offset, y + offset)); points.push_back(Coor
最后
以上就是无心八宝粥最近收集整理的关于Geos库学习之(四)——几何对象空间关系判断实例的全部内容,更多相关Geos库学习之(四)——几何对象空间关系判断实例内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复