本文整理匯總了C++中GEOSGeomFromWKT函數的典型用法代碼示例。如果您正苦於以下問題:C++ GEOSGeomFromWKT函數的具體用法?C++ GEOSGeomFromWKT怎麽用?C++ GEOSGeomFromWKT使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GEOSGeomFromWKT函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: GEOSGeomFromWKT
void object::test<8>()
{
geom1_ = GEOSGeomFromWKT("MULTILINESTRING((0 0, 10 0),(10 0, 10 10))");
geom2_ = GEOSGeomFromWKT("LINESTRING(10 0, 10 -10)");
pat_ = GEOSRelateBoundaryNodeRule(geom1_, geom2_, 5);
ensure(0 == pat_);
}
示例2: initGEOS
void object::test<2>
()
{
numcalls = 0;
initGEOS(notice, notice);
GEOS_interruptRegisterCallback(countCalls);
ensure_equals(numcalls, 0);
GEOSGeometry* geom1 = GEOSGeomFromWKT("LINESTRING(0 0, 1 1, 2 2, 4 4)");
GEOSGeometry* geom2 = GEOSGeomFromWKT("LINESTRING(0 0, 1 1.01, 4 4.001)");
ensure("GEOSGeomFromWKT failed", nullptr != geom1);
GEOSGeometry* geom3 = GEOSSnap(geom1, geom2, 0.1);
ensure("GEOSSnap failed", nullptr != geom3);
ensure("interrupt callback never called", numcalls > 0);
GEOSGeom_destroy(geom1);
GEOSGeom_destroy(geom2);
GEOSGeom_destroy(geom3);
GEOS_interruptRegisterCallback(nullptr); /* unregister */
finishGEOS();
}
示例3: GEOSGeomFromWKT
void object::test<1>()
{
geom1_ = GEOSGeomFromWKT("POINT(10 10)");
geom2_ = GEOSGeomFromWKT("POINT(3 6)");
double dist;
int ret = GEOSDistance(geom1_, geom2_, &dist);
ensure_equals(ret, 1);
ensure_distance(dist, 8.06225774829855, 1e-12);
}
示例4: GEOSGeomFromWKT
void object::test<1>()
{
geom1_ = GEOSGeomFromWKT("POLYGON EMPTY");
geom2_ = GEOSGeomFromWKT("POLYGON EMPTY");
ensure( 0 != geom1_ );
ensure( 0 != geom2_ );
GEOSCoordSequence *coords_;
coords_ = GEOSNearestPoints(geom1_, geom2_);
ensure( 0 == coords_ );
}
示例5: GEOSGeomFromWKT
void object::test<4>
()
{
geom1_ = GEOSGeomFromWKT("LINESTRING(0 0, 10 10)");
geom2_ = GEOSGeomFromWKT("LINESTRING(0 10, 10 0)");
prepGeom1_ = GEOSPrepare(geom1_);
ensure(nullptr != prepGeom1_);
int ret = GEOSPreparedIntersects(prepGeom1_, geom2_);
ensure_equals(ret, 1);
}
示例6: GEOSGeomFromWKT
void object::test<1>()
{
input_ = GEOSGeomFromWKT("MULTIPOINT (130 240, 130 240, 130 240, 570 240, 570 240, 570 240, 650 240)");
ensure( 0 != input_ );
expected_ = GEOSGeomFromWKT("LINESTRING (130 240, 650 240, 130 240)");
ensure( 0 != expected_ );
GEOSGeometry* output = GEOSConvexHull(input_);
ensure( 0 != output );
ensure( 0 == GEOSisEmpty(output) );
// TODO
//ensure( 0 != GEOSEquals(output, expected_));
}
示例7: wkt0
void object::test<7>()
{
std::string wkt0("LINESTRING ("
"665.7317504882812500 133.0762634277343700,"
"1774.4752197265625000 19.9391822814941410,"
"756.2413940429687500 466.8306579589843700,"
"626.1337890625000000 1898.0147705078125000,"
"433.8007202148437500 404.6052856445312500)");
geom1_ = GEOSGeomFromWKT(wkt0.c_str());
ensure( 0 != geom1_ );
double width = 57.164000837203;
// left-sided
{
geom2_ = GEOSOffsetCurve(geom1_, width, 8, GEOSBUF_JOIN_MITRE, 5.57);
ensure( 0 != geom2_ );
// likely, 5 >= 5
ensure(GEOSGeomGetNumPoints(geom2_) >= GEOSGeomGetNumPoints(geom1_));
wkt_ = GEOSWKTWriter_write(wktw_, geom2_);
//ensure_equals(std::string(wkt_), ...);
}
// right-sided
{
width = -width;
geom2_ = GEOSOffsetCurve(geom1_, width, 8, GEOSBUF_JOIN_MITRE, 5.57);
ensure( 0 != geom2_ );
// likely, 5 >= 7
ensure(GEOSGeomGetNumPoints(geom2_) >= GEOSGeomGetNumPoints(geom1_));
wkt_ = GEOSWKTWriter_write(wktw_, geom2_);
//ensure_equals(std::string(wkt_), ...);
}
}
示例8: GEOSGeomFromWKT
/// Polygon fully within rectangle
template<> template<> void object::test<12>()
{
const char *wkt = "POLYGON((1 1, 1 30, 30 30, 30 1, 1 1),(10 10, 20 10, 20 20, 10 20, 10 10))";
geom1_ = GEOSGeomFromWKT(wkt);
geom2_ = GEOSClipByRect(geom1_, 0, 0, 40, 40);
isEqual(geom2_, wkt);
}
示例9: GEOSGeomFromWKT
void object::test<3>()
{
geom1_ = GEOSGeomFromWKT("MULTIPOLYGON(((0 0,0 10,10 10,10 0,0 0)))");
geom2_ = GEOSGeomFromWKT("POLYGON((1 1,1 2,2 2,2 1,1 1))");
ensure( nullptr != geom1_ );
ensure( nullptr != geom2_ );
char const r1 = GEOSWithin(geom1_, geom2_);
ensure_equals(int(r1), 0);
char const r2 = GEOSWithin(geom2_, geom1_);
ensure_equals(int(r2), 1);
}
示例10: GEOSGeomFromWKT
void object::test<1>()
{
geom1_ = GEOSGeomFromWKT("POLYGON EMPTY");
geom2_ = GEOSGeomFromWKT("POLYGON EMPTY");
ensure( 0 != geom1_ );
ensure( 0 != geom2_ );
char const r1 = GEOSIntersects(geom1_, geom2_);
ensure_equals(r1, 0);
char const r2 = GEOSIntersects(geom2_, geom1_);
ensure_equals(r2, 0);
}
示例11: GEOSGeomFromWKT
void object::test<1>()
{
const int size = 2;
GEOSGeometry* geoms[size] = { 0 };
geoms[0] = GEOSGeomFromWKT("LINESTRING(1 3, 3 3, 3 1, 1 1, 1 3)");
geoms[1] = GEOSGeomFromWKT("LINESTRING(1 3, 3 3, 3 1, 1 1, 1 3)");
GEOSGeometry* g = GEOSPolygonizer_getCutEdges(geoms, size);
ensure(0 != g);
ensure_equals(GEOSGetNumGeometries(g), size);
GEOSGeom_destroy(g);
GEOSGeom_destroy(geoms[0]);
GEOSGeom_destroy(geoms[1]);
}
示例12: GEOSGeomFromWKT
void object::test<1>()
{
geom1_ = GEOSGeomFromWKT("POLYGON EMPTY");
ensure ( 0 != GEOSisEmpty(geom1_) );
geom2_ = GEOSSimplify(geom1_, 43.2);
ensure ( 0 != GEOSisEmpty(geom2_) );
}
示例13: GEOSGeomFromWKT
void object::test<2>()
{
geom1_ = GEOSGeomFromWKT("POINT (6 3)");
ensure( 0 != geom1_ );
geom2_ = GEOSUnaryUnion(geom1_);
ensure( 0 != geom2_ );
ensure_equals(toWKT(geom2_), std::string("POINT (6 3)"));
}
示例14: GEOSGeomFromWKT
void object::test<1>()
{
GEOSGeometry* geom1 = GEOSGeomFromWKT("POLYGON EMPTY");
ensure ( 0 != GEOSisEmpty(geom1) );
GEOSGeometry* geom2 = GEOSSimplify(geom1, 43.2);
ensure ( 0 != GEOSisEmpty(geom2) );
}
示例15: test_wkt
void test_wkt(std::string const& wkt)
{
geom1_ = GEOSGeomFromWKT(wkt.c_str());
ensure ( 0 != geom1_ );
char* wkt_c = GEOSGeomToWKT(geom1_);
std::string out(wkt_c);
free(wkt_c);
ensure_equals(out, wkt);
}