本文整理汇总了C++中OsmReader::setUseDataSourceIds方法的典型用法代码示例。如果您正苦于以下问题:C++ OsmReader::setUseDataSourceIds方法的具体用法?C++ OsmReader::setUseDataSourceIds怎么用?C++ OsmReader::setUseDataSourceIds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OsmReader
的用法示例。
在下文中一共展示了OsmReader::setUseDataSourceIds方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runTest
void runTest()
{
OsmReader reader;
shared_ptr<OsmMap> map(new OsmMap());
reader.setDefaultStatus(Status::Unknown1);
reader.setUseDataSourceIds(true);
reader.read("test-files/MaximalNearestSubline.osm", map);
shared_ptr<OsmMap> map2(new OsmMap(map->getProjection()));
shared_ptr<OGRSpatialReference> srs =
MapReprojector::createAeacProjection(map->calculateBounds());
MapReprojector::reproject(map, srs);
stringstream ss;
shared_ptr<Way> w;
w = MaximalNearestSubline::getMaximalNearestSubline(map, map->getWay(-353),
map->getWay(-313),
10.0, 10.0);
w->setStatus(Status::Conflated);
ss << ElementConverter(map).convertToLineString(w)->toString() << endl;
w = MaximalNearestSubline::getMaximalNearestSubline(map, map->getWay(-313),
map->getWay(-353),
10.0, 10.0);
w->setStatus(Status::Conflated);
ss << ElementConverter(map).convertToLineString(w)->toString() << endl;
w = MaximalNearestSubline::getMaximalNearestSubline(map, map->getWay(-260),
map->getWay(-247),
10.0, 10.0);
w->setStatus(Status::Conflated);
ss << ElementConverter(map).convertToLineString(w)->toString() << endl;
w = MaximalNearestSubline::getMaximalNearestSubline(map, map->getWay(-247),
map->getWay(-260),
10.0, 10.0);
w->setStatus(Status::Conflated);
ss << ElementConverter(map).convertToLineString(w)->toString() << endl;
// {
// shared_ptr<OsmMap> wgs84(new OsmMap(map2));
// MapReprojector::reprojectToWgs84(wgs84);
// OsmWriter writer;
// QString fn = QString("test-output/algorithms/MaximalNearestSublineTestOutput.osm");
// writer.write(wgs84, fn);
// }
QFile fp("test-files/algorithms/MaximalNearestSublineTest.txt");
fp.open(QIODevice::ReadOnly);
QString s = fp.readAll();
CPPUNIT_ASSERT_EQUAL(s.toStdString(), ss.str());
}
示例2: runWaySplitTest
void runWaySplitTest()
{
//Log::WarningLevel levelBefore = Log::getInstance().getLevel();
//Log::getInstance().setLevel(Log::Debug);
OsmMap::resetCounters();
OsmReader reader;
shared_ptr<OsmMap> map(new OsmMap());
reader.setDefaultStatus(Status::Unknown1);
reader.setUseDataSourceIds(true);
reader.read("test-files/perty/PertyWaySplitVisitorTest/PertyWaySplitVisitorTest-in-1.osm", map);
const int numNodesBeforeSplitting = map->getNodeMap().size();
LOG_VARD(numNodesBeforeSplitting);
const int numWaysBeforeSplitting = map->getWays().size();
LOG_VARD(numWaysBeforeSplitting)
MapProjector::projectToPlanar(map);
PertyWaySplitVisitor waySplitVisitor;
boost::minstd_rand rng;
rng.seed(1);
waySplitVisitor.setRng(rng);
waySplitVisitor.setWaySplitProbability(0.5);
waySplitVisitor.setMinNodeSpacing(1.0);
map->visitRw(waySplitVisitor);
MapProjector::projectToWgs84(map);
const int numNewNodesCreatedBySpliting = map->getNodeMap().size() - numNodesBeforeSplitting;
LOG_VARD(numNewNodesCreatedBySpliting);
const int numNewWaysCreatedBySpliting = map->getWays().size() - numWaysBeforeSplitting;
LOG_VARD(numNewWaysCreatedBySpliting);
const QString outDir = "test-output/perty/PertyWaySplitVisitorTest/";
QDir().mkpath(outDir);
OsmWriter writer;
writer.setIncludeHootInfo(true);
const QString outFile = outDir + "/PertyWaySplitVisitorTest-out-1.osm";
writer.write(map, outFile);
HOOT_FILE_EQUALS(
"test-files/perty/PertyWaySplitVisitorTest/PertyWaySplitVisitorTest-out-1.osm", outFile);
//Log::getInstance().setLevel(levelBefore);
}
示例3: dl
shared_ptr<CalculateStatsOp> _calcStats(const QString& inputFile)
{
OsmReader reader;
shared_ptr<OsmMap> map(new OsmMap());
OsmMap::resetCounters();
reader.setDefaultStatus(Status::Unknown1);
reader.setUseStatusFromFile(true);
reader.setUseDataSourceIds(true);
reader.read(inputFile, map);
shared_ptr<CalculateStatsOp> calcStatsOp(new CalculateStatsOp());
//If we figure out the error messages logged by the script translator related stats are
//invalid and fix them, then this log disablement can be removed.
{
DisableLog dl(Log::Fatal);
calcStatsOp->apply(map);
}
//calcStatsOp->printStats();
return calcStatsOp;
}