本文整理汇总了C++中geos::io::WKTReader::read方法的典型用法代码示例。如果您正苦于以下问题:C++ WKTReader::read方法的具体用法?C++ WKTReader::read怎么用?C++ WKTReader::read使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类geos::io::WKTReader
的用法示例。
在下文中一共展示了WKTReader::read方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runIndexOfAfterTest
void runIndexOfAfterTest(string const& inputStr, string const& testPtWKT)
{
GeomPtr input(reader.read(inputStr));
GeomPtr testPoint(reader.read(testPtWKT));
const Coordinate* testPt = testPoint->getCoordinate();
bool resultOK = indexOfAfterCheck(input.get(), *testPt);
ensure(resultOK);
}
示例2: runIndicesOfThenExtract
void runIndicesOfThenExtract(string const& inputStr, string const& subLineStr)
{
GeomPtr input(reader.read(inputStr));
GeomPtr subLine(reader.read(subLineStr));
GeomPtr result(indicesOfThenExtract(input.get(), subLine.get()));
checkExpected(result.get(), subLine.get());
}
示例3: runOffsetTest
void runOffsetTest(string const& inputWKT, string const& testPtWKT,
double offsetDistance, string const& expectedPtWKT)
{
GeomPtr input(reader.read(inputWKT));
GeomPtr testPoint(reader.read(testPtWKT));
GeomPtr expectedPoint(reader.read(expectedPtWKT));
const Coordinate* testPt = testPoint->getCoordinate();
const Coordinate* expectedPt = expectedPoint->getCoordinate();
Coordinate offsetPt = extractOffsetAt(input.get(), *testPt, offsetDistance);
bool isOk = offsetPt.distance(*expectedPt) < TOLERANCE_DIST;
if (! isOk)
cout << "Expected = " << *expectedPoint << " Actual = " << offsetPt << endl;
ensure(isOk);
}
示例4: testInputOutput
void testInputOutput(const std::string& WKT,
const std::string& ndrWKB,
const std::string& xdrWKB)
{
GeomPtr gWKT(wktreader.read(WKT));
// NDR input
std::stringstream ndr_in(ndrWKB);
GeomPtr gWKB_ndr(wkbreader.readHEX(ndr_in));
ensure("NDR input",
gWKB_ndr->equalsExact(gWKT.get()) );
// XDR input
std::stringstream xdr_in(xdrWKB);
GeomPtr gWKB_xdr(wkbreader.readHEX(xdr_in));
ensure("XDR input",
gWKB_xdr->equalsExact(gWKT.get()) );
// Compare geoms read from NDR and XDR
ensure( gWKB_xdr->equalsExact(gWKB_ndr.get()) );
// NDR output
std::stringstream ndr_out;
ndrwkbwriter.writeHEX(*gWKT, ndr_out);
ensure_equals("NDR output",
ndr_out.str(), ndr_in.str());
// XDR output
std::stringstream xdr_out;
xdrwkbwriter.writeHEX(*gWKT, xdr_out);
ensure_equals("XDR output",
xdr_out.str(), xdr_in.str());
}
示例5: checkExtractLine
void checkExtractLine(const char* wkt, double start, double end, const char* expected)
{
string wktstr(wkt);
GeomPtr linearGeom(reader.read(wktstr));
LengthIndexedLine indexedLine(linearGeom.get());
GeomPtr result(indexedLine.extractLine(start, end));
checkExpected(result.get(), expected);
}
示例6:
test_polygon_data()
: pm_(1), factory_(&pm_, 0), reader_(&factory_),
empty_poly_(factory_.createPolygon()), poly_size_(7)
{
// Create non-empty LinearRing
GeometryPtr geo = 0;
geo = reader_.read("POLYGON((0 10, 5 5, 10 5, 15 10, 10 15, 5 15, 0 10))");
poly_ = static_cast<PolygonPtr>(geo);
}
示例7: geom
void
runPtLocator(int expected, const Coordinate& pt,
const std::string& wkt)
{
GeomPtr geom(reader.read(wkt));
geos::algorithm::PointLocator pointLocator;
int loc = pointLocator.locate(pt, geom.get());
ensure_equals(loc, expected);
}
示例8: checkLengthOfLine
void
checkLengthOfLine(std::string wkt, double expectedLength)
{
std::unique_ptr<Geometry> lineGeom(reader_.read(wkt));
std::unique_ptr<LineString> line(dynamic_cast<LineString*>(lineGeom.release()));
ensure(nullptr != line.get());
const CoordinateSequence* lineSeq = line->getCoordinatesRO();
double actual = algorithm::Length::ofLine(lineSeq);
ensure_equals(actual, expectedLength);
}
示例9:
test_polygon_data()
: pm_(1)
, factory_(GeometryFactory::create(&pm_, 0))
, reader_(factory_.get())
, empty_poly_(factory_->createPolygon()), poly_size_(7)
{
// Create non-empty LinearRing
GeometryPtr geo = nullptr;
geo = reader_.read("POLYGON((0 10, 5 5, 10 5, 15 10, 10 15, 5 15, 0 10))");
poly_ = dynamic_cast<PolygonPtr>(geo);
}
示例10: fromWKT
GeomPtr fromWKT(const std::string& wkt)
{
GeomPtr geom;
try {
geom.reset( rdr.read(wkt) );
}
catch (const GEOSException& ex) {
cerr << ex.what() << endl;
}
return geom;
}
示例11:
test_geometrysnapper_data()
:
factory(), // initialize before use!
reader(&factory),
src(reader.read(
"POLYGON ((0 0, 0 100, 100 100, 100 0, 0 0))"
)),
snapper( *(src.get()) )
{
}
示例12: readWKT
GeomPtr readWKT(const std::string& inputWKT)
{
return GeomPtr(wktreader.read(inputWKT));
}
示例13: checkExpected
void checkExpected(Geometry* result, string const& expected)
{
GeomPtr subLine(reader.read(expected));
checkExpected(result, subLine.get());
}