本文整理汇总了C++中ConstOsmMapPtr::copyWays方法的典型用法代码示例。如果您正苦于以下问题:C++ ConstOsmMapPtr::copyWays方法的具体用法?C++ ConstOsmMapPtr::copyWays怎么用?C++ ConstOsmMapPtr::copyWays使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConstOsmMapPtr
的用法示例。
在下文中一共展示了ConstOsmMapPtr::copyWays方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: findMatch
WaySublineMatchString MaximalNearestSublineMatcher::findMatch(const ConstOsmMapPtr &map,
const ConstWayPtr& way1, const ConstWayPtr &way2, double &score, Meters maxRelevantDistance) const
{
score = 0;
Meters mrd = maxRelevantDistance == -1 ? way1->getCircularError() + way2->getCircularError() :
maxRelevantDistance;
vector<long> wayIds;
wayIds.push_back(way1->getId());
wayIds.push_back(way2->getId());
OsmMapPtr mapCopy(map->copyWays(wayIds));
WayPtr way1NonConst = mapCopy->getWay(way1->getId());
WayPtr way2NonConst = mapCopy->getWay(way2->getId());
MaximalNearestSubline mns1(
mapCopy, way1NonConst, way2NonConst, _minSplitSize, mrd, _maxRelevantAngle, _headingDelta);
// use the maximal nearest subline code to find the best subline
std::vector<WayLocation> interval1 = mns1.getInterval();
if (!interval1[0].isValid() || !interval1[1].isValid() ||
interval1[0] == interval1[1])
{
// if the interval isn't valid then return an invalid result.
return WaySublineMatchString();
}
_snapToEnds(map, interval1);
WayPtr subline1 = WaySubline(interval1[0], interval1[1]).toWay(mapCopy);
MaximalNearestSubline mns2(mapCopy, way2NonConst, subline1, _minSplitSize, -1, -1, _headingDelta);
std::vector<WayLocation> interval2 = mns2.getInterval();
if (!interval2[0].isValid() || !interval2[1].isValid() ||
interval2[0] == interval2[1])
{
return WaySublineMatchString();
}
_snapToEnds(map, interval2);
WaySublineMatch match = WaySublineMatch(WaySubline(interval1[0], interval1[1]),
WaySubline(interval2[0], interval2[1]));
if (subline1->getNodeCount() > 1)
{
shared_ptr<LineString> ls = ElementConverter(mapCopy).convertToLineString(subline1);
if (ls->isValid())
{
score = ls->getLength();
}
}
vector<WaySublineMatch> v;
// switch the subline match to reference a different map.
v.push_back(WaySublineMatch(match, map));
return WaySublineMatchString(v);
}
示例2: classify
MatchClassification HighwayExpertClassifier::classify(const ConstOsmMapPtr& map,
const WaySublineMatch& match)
{
MatchClassification result;
vector<long> wids;
wids.push_back(match.getSubline1().getElementId().getId());
wids.push_back(match.getSubline2().getElementId().getId());
shared_ptr<OsmMap> theMap = map->copyWays(wids);
if (match.isValid() == false)
{
result.setMissP(1.0);
result.setMatchP(0.0);
result.setReviewP(0.0);
return result;
}
WayPtr sl1 = match.getSubline1().toWay(theMap);
WayPtr sl2 = match.getSubline2().toWay(theMap);
ElementConverter ec(theMap);
Meters l1 = ec.convertToLineString(match.getSubline1().getWay())->getLength();
Meters l2 = ec.convertToLineString(match.getSubline2().getWay())->getLength();
// what portion of the original lines is the MNS
double po1 = ec.convertToLineString(sl1)->getLength() / l1;
double po2 = ec.convertToLineString(sl2)->getLength() / l2;
// give it a score
double ps = std::min(po1, po2) / 2.0 + 0.5;
double p;
// if either of the lines are zero in length.
if (po1 == 0 || po2 == 0)
{
p = 0.0;
}
else
{
p = ps * ProbabilityOfMatch::getInstance().expertProbability(theMap, sl1, sl2);
}
result.setMatchP(p);
result.setMissP(1.0 - p);
return result;
}