本文整理汇总了C++中ConstOsmMapPtr::getWay方法的典型用法代码示例。如果您正苦于以下问题:C++ ConstOsmMapPtr::getWay方法的具体用法?C++ ConstOsmMapPtr::getWay怎么用?C++ ConstOsmMapPtr::getWay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConstOsmMapPtr
的用法示例。
在下文中一共展示了ConstOsmMapPtr::getWay方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isValid
bool WayMergeManipulation::isValid(ConstOsmMapPtr map) const
{
bool result = false;
if (map->containsWay(_left) && map->containsWay(_right))
{
result = map->getWay(_left)->isUnknown();
result = result && map->getWay(_right)->isUnknown();
}
return result;
}
示例2: write
void OsmPgCsvWriter::write(ConstOsmMapPtr map)
{
QList<long> ids;
// Start with the nodes
const NodeMap& nodes = map->getNodes();
for (NodeMap::const_iterator it = nodes.begin(); it != nodes.end(); ++it)
ids.append(it->first);
// Sort the values to give consistent results.
qSort(ids.begin(), ids.end(), qLess<long>());
for (int i = 0; i < ids.size(); i++)
writePartial(map->getNode(ids[i]));
// Next are the ways
ids.clear();
const WayMap& ways = map->getWays();
for (WayMap::const_iterator it = ways.begin(); it != ways.end(); ++it)
ids.append(it->first);
// Sort the values to give consistent results.
qSort(ids.begin(), ids.end(), qLess<long>());
for (int i = 0; i < ids.size(); i++)
writePartial(map->getWay(ids[i]));
// Finally the relations
ids.clear();
const RelationMap& relations = map->getRelations();
for (RelationMap::const_iterator it = relations.begin(); it != relations.end(); ++it)
ids.append(it->first);
// Sort the values to give consistent results.
qSort(ids.begin(), ids.end(), qLess<long>());
for (int i = 0; i < ids.size(); i++)
writePartial(map->getRelation(ids[i]));
}
示例3: WayLocation
WaySubline::WaySubline(const WaySubline& from, const ConstOsmMapPtr& newMap)
{
if (from.isValid())
{
ConstWayPtr oldWay = from.getStart().getWay();
ConstWayPtr newWay = newMap->getWay(oldWay->getId());
_start = WayLocation(newMap, newWay,
from.getStart().getSegmentIndex(), from.getStart().getSegmentFraction());
_end = WayLocation(newMap, newWay,
from.getEnd().getSegmentIndex(), from.getEnd().getSegmentFraction());
}
}
示例4: getWay
ConstWayPtr getWay(ConstOsmMapPtr map, const QString& key, const QString& value)
{
std::vector<long> wids = map->findWays(key, value);
CPPUNIT_ASSERT_EQUAL((size_t)1, wids.size());
return map->getWay(wids[0]);
}
示例5: _evaluateMatch
MaximalSublineStringMatcher::ScoredMatch MaximalSublineStringMatcher::_evaluateMatch(
const ConstOsmMapPtr &map, Meters maxDistance, const vector<ConstWayPtr>& ways1,
const vector<ConstWayPtr> &ways2, const vector<bool>& reversed1,
const vector<bool> &reversed2) const
{
vector<WaySublineMatch> matches;
// make a copy of the map and the ways we need so we can reverse the ways as needed.
set<ElementId> eids;
_insertElementIds(ways1, eids);
_insertElementIds(ways2, eids);
OsmMapPtr copiedMap(new OsmMap(map->getProjection()));
CopySubsetOp(map, eids).apply(copiedMap);
vector<WayPtr> prep1 = _changeMap(ways1, copiedMap);
vector<WayPtr> prep2 = _changeMap(ways2, copiedMap);
// reversed ways as appropriate
_reverseWays(prep1, reversed1);
_reverseWays(prep2, reversed2);
double scoreSum = 0;
// go through and match each way against every other way
for (size_t i = 0; i < prep1.size(); i++)
{
for (size_t j = 0; j < prep2.size(); j++)
{
double score;
WaySublineMatchString m = _sublineMatcher->findMatch(copiedMap, prep1[i], prep2[j], score,
maxDistance);
scoreSum += score;
matches.insert(matches.end(), m.getMatches().begin(), m.getMatches().end());
}
}
HashMap<long, bool> wayIdToReversed1, wayIdToReversed2;
// create a map from way id to reverse status
for (size_t i = 0; i < prep1.size(); i++)
{
wayIdToReversed1[prep1[i]->getId()] = reversed1[i];
}
for (size_t i = 0; i < prep2.size(); i++)
{
wayIdToReversed2[prep2[i]->getId()] = reversed2[i];
}
// go through all the matches
for (size_t i = 0; i < matches.size(); i++)
{
WaySubline ws1, ws2;
// if the direction is reversed on one but not both ways then mark the match as reversed.
long m1Id = matches[i].getSubline1().getStart().getWay()->getId();
long m2Id = matches[i].getSubline2().getStart().getWay()->getId();
if (wayIdToReversed1[m1Id])
{
// make sure the way subline is pointed to the right way (not reversed)
ConstWayPtr w = map->getWay(matches[i].getSubline1().getElementId());
ws1 = matches[i].getSubline1().reverse(w);
}
else
{
ws1 = WaySubline(matches[i].getSubline1(), map);
}
if (wayIdToReversed2[m2Id])
{
// make sure the way subline is pointed to the right way (not reversed)
ConstWayPtr w = map->getWay(matches[i].getSubline2().getElementId());
ws2 = matches[i].getSubline2().reverse(w);
}
else
{
ws2 = WaySubline(matches[i].getSubline2(), map);
}
if (wayIdToReversed1[m1Id] != wayIdToReversed2[m2Id])
{
matches[i] = WaySublineMatch(ws1, ws2, true);
}
else
{
matches[i] = WaySublineMatch(ws1, ws2, false);
}
}
return ScoredMatch(scoreSum, matches);
}