本文整理汇总了C++中ConstWayPtr::getTags方法的典型用法代码示例。如果您正苦于以下问题:C++ ConstWayPtr::getTags方法的具体用法?C++ ConstWayPtr::getTags怎么用?C++ ConstWayPtr::getTags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConstWayPtr
的用法示例。
在下文中一共展示了ConstWayPtr::getTags方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: runConflateTest
void runConflateTest()
{
OsmReader reader;
shared_ptr<OsmMap> map(new OsmMap());
reader.setDefaultStatus(Status::Unknown1);
reader.read("test-files/ToyBuildingsTestA.osm", map);
reader.setDefaultStatus(Status::Unknown2);
reader.read("test-files/ToyBuildingsTestB.osm", map);
MapProjector::projectToPlanar(map);
WayMap wm = map->getWays();
for (WayMap::const_iterator it = wm.begin(); it != wm.end(); ++it)
{
const ConstWayPtr& w = it->second;
const Tags& t = w->getTags();
if (t["REF1"] != "Target" && t["REF2"] != "Target")
{
map->removeWay(it->first);
}
}
Conflator uut;
shared_ptr<Manipulator> m(new BuildingMergeManipulator());
deque< shared_ptr<Manipulator> > manipulators;
manipulators.push_back(m);
uut.setManipulators(manipulators);
uut.loadSource(map);
uut.conflate();
shared_ptr<OsmMap> out(new OsmMap(uut.getBestMap()));
MapProjector::projectToWgs84(out);
OsmWriter writer;
writer.setIncludeIds(true);
writer.write(out, "test-output/BuildingConflatorTest.osm");
ConstWayPtr cheddars = getWay(out, "REF1", "Cheddar's");
CPPUNIT_ASSERT_EQUAL(string("Cheddar's"), cheddars->getTags()["REF2"].toStdString());
HOOT_STR_EQUALS(Status::Conflated, cheddars->getStatus());
ConstWayPtr biondi = getWay(out, "REF1", "Biondi");
CPPUNIT_ASSERT_EQUAL(string("Biondi"), biondi->getTags()["REF2"].toStdString());
HOOT_STR_EQUALS(Status::Conflated, biondi->getStatus());
ConstWayPtr freddys = getWay(out, "REF1", "Freddy's");
CPPUNIT_ASSERT_EQUAL(false, freddys->getTags().contains("REF2"));
HOOT_STR_EQUALS(Status::Unknown1, freddys->getStatus());
ConstWayPtr target = getWay(out, "REF1", "Target");
CPPUNIT_ASSERT_EQUAL(string("Target"), biondi->getTags()["REF2"].toStdString());
HOOT_STR_EQUALS(Status::Unknown1, target->getStatus());
CPPUNIT_ASSERT_EQUAL((size_t)9, out->getWays().size());
}
示例2: toWay
WayPtr WaySubline::toWay(const OsmMapPtr& map, GeometryConverter::NodeFactory* nf) const
{
ConstWayPtr way = _start.getWay();
auto_ptr<GeometryConverter::NodeFactory> nfPtr;
if (nf == 0)
{
nf = new FindNodesInWayFactory(way);
// delete it automatically.
nfPtr.reset(nf);
}
WayPtr result(new Way(way->getStatus(), map->createNextWayId(), way->getCircularError()));
result->setTags(way->getTags());
int includedStartIndex = _start.getSegmentIndex();
if (_start.getSegmentFraction() > 0.0)
{
includedStartIndex += 1;
}
int includedEndIndex = _end.getSegmentIndex();
if (_end.getSegmentFraction() >= 1.0)
{
includedEndIndex += 1;
}
if (!_start.isNode())
{
Coordinate c = _start.getCoordinate();
shared_ptr<Node> n = nf->createNode(map, c, way->getStatus(),
way->getCircularError());
map->addNode(n);
result->addNode(n->getId());
}
for (int i = includedStartIndex; i <= includedEndIndex; i++)
{
result->addNode(way->getNodeId(i));
}
if (!_end.isNode())
{
Coordinate c = _end.getCoordinate();
shared_ptr<Node> n = nf->createNode(map, c, way->getStatus(), way->getCircularError());
map->addNode(n);
result->addNode(n->getId());
}
return result;
}
示例3: if
geos::geom::GeometryTypeId ElementConverter::getGeometryType(const ConstElementPtr& e,
bool throwError, const bool statsFlag)
{
ElementType t = e->getElementType();
switch (t.getEnum())
{
case ElementType::Node:
return GEOS_POINT;
case ElementType::Way:
{
ConstWayPtr w = dynamic_pointer_cast<const Way>(e);
assert(w);
if(statsFlag)
{
if (w->isValidPolygon() && OsmSchema::getInstance().isAreaForStats(w->getTags(), ElementType::Way))
return GEOS_POLYGON;
else
return GEOS_LINESTRING;
} else {
if (w->isValidPolygon() && OsmSchema::getInstance().isArea(w->getTags(), ElementType::Way))
return GEOS_POLYGON;
else
return GEOS_LINESTRING;
}
break;
}
case ElementType::Relation:
{
ConstRelationPtr r = dynamic_pointer_cast<const Relation>(e);
assert(r);
if(statsFlag)
{
if (r->isMultiPolygon() || OsmSchema::getInstance().isAreaForStats(r->getTags(), ElementType::Relation))
return GEOS_MULTIPOLYGON;
else if (OsmSchema::getInstance().isLinear(*r))
return GEOS_MULTILINESTRING;
} else {
if (r->isMultiPolygon() || OsmSchema::getInstance().isArea(r->getTags(), ElementType::Relation))
return GEOS_MULTIPOLYGON;
else if (OsmSchema::getInstance().isLinear(*r))
{
return GEOS_MULTILINESTRING;
}
else if (r->getMembers().size() == 0 ||
OsmSchema::getInstance().isCollection(*r))
{
// an empty geometry, pass back a collection
return GEOS_GEOMETRYCOLLECTION;
}
}
break;
}
default:
LOG_ERROR("Element was not a node, way, or relation");
break;
}
if (throwError)
{
throw IllegalArgumentException("Unknown geometry type.");
}
else
{
return GeometryTypeId(-1);
}
}