本文整理汇总了C++中RelationPtr::getTags方法的典型用法代码示例。如果您正苦于以下问题:C++ RelationPtr::getTags方法的具体用法?C++ RelationPtr::getTags怎么用?C++ RelationPtr::getTags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RelationPtr
的用法示例。
在下文中一共展示了RelationPtr::getTags方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: apply
void AddHilbertReviewSortOrderOp::apply(shared_ptr<OsmMap>& map)
{
_mapEnvelope.reset();
MapReprojector::reprojectToPlanar(map);
const RelationMap& relations = map->getRelationMap();
Envelope e = map->calculateEnvelope();
vector< pair<ElementId, int64_t> > reviewOrder;
// reserves at least as much as we need.
reviewOrder.reserve(relations.size());
for (RelationMap::const_iterator it = relations.begin(); it != relations.end(); ++it)
{
RelationPtr r = it->second;
if (ReviewMarker::isReviewUid(map, r->getElementId()))
{
int64_t hv = _calculateHilbertValue(map,
ReviewMarker::getReviewElements(map, r->getElementId()));
pair<ElementId, int64_t> p(r->getElementId(), hv);
reviewOrder.push_back(p);
}
}
sort(reviewOrder.begin(), reviewOrder.end(), reviewLess);
for (size_t i = 0; i < reviewOrder.size(); ++i)
{
RelationPtr r = map->getRelation(reviewOrder[i].first.getId());
r->getTags().set(ReviewMarker::reviewSortOrderKey, (long)i);
}
}
示例2: runEscapeTags
void runEscapeTags()
{
OsmMapPtr map(new OsmMap());
Coordinate coords[] = { Coordinate(0, 0), Coordinate(0, 1), Coordinate(1, 1), Coordinate(1, 0), Coordinate::getNull() };
Tags tags;
tags.set("note", "<2>");
tags.set("aerialway", "t-bar");
tags.set("first name", "first name goes here");
tags.set("full_name", "\"Hacksaw\" Jim Duggan");
WayPtr way = TestUtils::createWay(map, Status::Unknown1, coords);
way->setTags(tags);
QList<ElementPtr> nodes;
NodePtr node1(new Node(Status::Unknown1, map->createNextNodeId(), Coordinate(0.0, 0.1), 15));
node1->getTags().appendValue("name", "test1");
nodes.append(node1);
NodePtr node2(new Node(Status::Unknown1, map->createNextNodeId(), Coordinate(0.1, 0.0), 15));
node2->getTags().appendValue("name", "test2");
nodes.append(node2);
RelationPtr relation = TestUtils::createRelation(map, nodes);
relation->setType("review");
relation->getTags().appendValue("name", "Test Review");
std::vector<RelationData::Entry> members = relation->getMembers();
members[0].role = "reviewee";
members[1].role = "reviewee";
relation->setMembers(members);
QString output = OsmPgCsvWriter::toString(map);
// Compare the results
HOOT_STR_EQUALS(expected_runEscapeTags, output);
}
示例3: runPartialReadTest
void runPartialReadTest()
{
//The differences in tag counts here when compared to
//ServiceHootApiDbReaderTest::runPartialReadTest are due to differences between the way
//HootApiDbWriter and OsmApiDbBulkInserter handle metadata tags, which is by design.
populatePartialMap();
OsmApiDbReader reader;
const int chunkSize = 3;
reader.setMaxElementsPerMap(chunkSize);
reader.open(ServicesDbTestUtils::getOsmApiDbUrl().toString());
reader.initializePartial();
int ctr = 0;
OsmMapPtr map(new OsmMap());
//3 nodes
CPPUNIT_ASSERT(reader.hasMoreElements());
reader.readPartial(map);
CPPUNIT_ASSERT_EQUAL(3, (int)map->getNodes().size());
CPPUNIT_ASSERT_EQUAL(0, (int)map->getWays().size());
CPPUNIT_ASSERT_EQUAL(0, (int)map->getRelations().size());
NodePtr node = map->getNode(1);
CPPUNIT_ASSERT_EQUAL((long)1, node->getId());
CPPUNIT_ASSERT_EQUAL(0.0, node->getX());
CPPUNIT_ASSERT_EQUAL(0.0, node->getY());
CPPUNIT_ASSERT_EQUAL(0, node->getTags().size());
node = map->getNode(2);
CPPUNIT_ASSERT_EQUAL((long)2, node->getId());
CPPUNIT_ASSERT_EQUAL(0.1, node->getX());
CPPUNIT_ASSERT_EQUAL(0.0, node->getY());
CPPUNIT_ASSERT_EQUAL(1, node->getTags().size());
HOOT_STR_EQUALS("n2b", node->getTags().get("noteb"));
node = map->getNode(3);
CPPUNIT_ASSERT_EQUAL((long)3, node->getId());
CPPUNIT_ASSERT_EQUAL(0.2, node->getX());
CPPUNIT_ASSERT_EQUAL(0.0, node->getY());
CPPUNIT_ASSERT_EQUAL(1, node->getTags().size());
HOOT_STR_EQUALS("n3", node->getTags().get("note"));
ctr++;
//2 nodes, 1 way
map.reset(new OsmMap());
CPPUNIT_ASSERT(reader.hasMoreElements());
reader.readPartial(map);
CPPUNIT_ASSERT_EQUAL(2, (int)map->getNodes().size());
CPPUNIT_ASSERT_EQUAL(1, (int)map->getWays().size());
CPPUNIT_ASSERT_EQUAL(0, (int)map->getRelations().size());
node = map->getNode(4);
CPPUNIT_ASSERT_EQUAL((long)4, node->getId());
CPPUNIT_ASSERT_EQUAL(0.3, node->getX());
CPPUNIT_ASSERT_EQUAL(0.0, node->getY());
CPPUNIT_ASSERT_EQUAL(1, node->getTags().size());
HOOT_STR_EQUALS("n4", node->getTags().get("note"));
node = map->getNode(5);
CPPUNIT_ASSERT_EQUAL((long)5, node->getId());
CPPUNIT_ASSERT_EQUAL(0.4, node->getX());
CPPUNIT_ASSERT_EQUAL(0.0, node->getY());
CPPUNIT_ASSERT_EQUAL(0, node->getTags().size());
WayPtr way = map->getWay(1);
CPPUNIT_ASSERT_EQUAL((long)1, way->getId());
CPPUNIT_ASSERT(way->hasNode(1));
CPPUNIT_ASSERT(way->hasNode(2));
CPPUNIT_ASSERT_EQUAL(1, way->getTags().size());
HOOT_STR_EQUALS("w1b", way->getTags().get("noteb"));
ctr++;
//2 ways, 1 relation
map.reset(new OsmMap());
CPPUNIT_ASSERT(reader.hasMoreElements());
reader.readPartial(map);
CPPUNIT_ASSERT_EQUAL(0, (int)map->getNodes().size());
CPPUNIT_ASSERT_EQUAL(2, (int)map->getWays().size());
CPPUNIT_ASSERT_EQUAL(1, (int)map->getRelations().size());
way = map->getWay(2);
CPPUNIT_ASSERT_EQUAL((long)2, way->getId());
CPPUNIT_ASSERT(way->hasNode(2));
CPPUNIT_ASSERT(way->hasNode(3));
CPPUNIT_ASSERT_EQUAL(1, way->getTags().size());
HOOT_STR_EQUALS("w2", way->getTags().get("note"));
way = map->getWay(3);
CPPUNIT_ASSERT_EQUAL((long)3, way->getId());
CPPUNIT_ASSERT(way->hasNode(2));
CPPUNIT_ASSERT_EQUAL(0, way->getTags().size());
RelationPtr relation = map->getRelation(1);
//.........这里部分代码省略.........