本文整理汇总了C++中ConstOsmMapPtr类的典型用法代码示例。如果您正苦于以下问题:C++ ConstOsmMapPtr类的具体用法?C++ ConstOsmMapPtr怎么用?C++ ConstOsmMapPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConstOsmMapPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: allTagsAreValid
bool MapScoringStatusAndRefTagValidator::allTagsAreValid(const ConstOsmMapPtr& map)
{
//if first map has any element with a hoot::status = Unknown1 tag and a tag with key = REF2,
//then fail
FilteredVisitor unknown1Visitor(
new ChainCriterion(
new StatusCriterion(Status::Unknown1),
new HasTagCriterion("REF2")),
new CountVisitor());
FilteredVisitor& filteredRefVisitor = const_cast<FilteredVisitor&>(unknown1Visitor);
SingleStatistic* singleStat = dynamic_cast<SingleStatistic*>(&unknown1Visitor.getChildVisitor());
assert(singleStat != 0);
map->visitRo(filteredRefVisitor);
const long numFirstInputBadTags = singleStat->getStat();
//if second map has any element with a hoot::status = Unknown2 tag and a tag with key = REF1,
//then fail
FilteredVisitor unknown2Visitor(
new ChainCriterion(
new StatusCriterion(Status::Unknown2),
new HasTagCriterion("REF1")),
new CountVisitor());
filteredRefVisitor = const_cast<FilteredVisitor&>(unknown2Visitor);
singleStat = dynamic_cast<SingleStatistic*>(&unknown2Visitor.getChildVisitor());
assert(singleStat != 0);
map->visitRo(filteredRefVisitor);
const long numSecondInputBadTags = singleStat->getStat();
return (numFirstInputBadTags + numSecondInputBadTags) == 0;
}
示例2: Match
BuildingMatch::BuildingMatch(const ConstOsmMapPtr& map, shared_ptr<const BuildingRfClassifier> rf,
const ElementId& eid1, const ElementId& eid2, ConstMatchThresholdPtr mt) :
Match(mt),
_eid1(eid1),
_eid2(eid2),
_rf(rf),
_explainText("")
{
//LOG_DEBUG("Classifying building pair: " << eid1 << "; " << eid2);
_p = _rf->classify(map, _eid1, _eid2);
//If the buildings aren't matched and they overlap at all, then make them be reviewed.
if (getType() == MatchType::Miss &&
(OverlapExtractor().extract(*map, map->getElement(eid1), map->getElement(eid2)) > 0.0))
{
//LOG_DEBUG("Building miss overlap:");
//LOG_VARD(eid1);
//LOG_VARD(eid2);
_p.clear();
_p.setReviewP(1.0);
_explainText = "Unmatched buildings are overlapping.";
}
else
{
_explainText = mt->getTypeDetail(_p);
}
//LOG_DEBUG(toString());
}
示例3: addToMatrix
void AttributeCoOccurence::addToMatrix(const ConstOsmMapPtr& in)
{
RefToEidVisitor ref2("REF2");
in->visitRo(ref2);
CoOccurenceVisitor coOccurenceResult(ref2.getRefToEid(), _resultMatrix);
in->visitRo(coOccurenceResult);
}
示例4: 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;
}
示例5: _calculateStartWayLocation
WayLocation MaximalSubline::_calculateStartWayLocation(const ConstOsmMapPtr& map,
const ConstWayPtr& a, const ConstWayPtr& b, int indexA, int indexB)
{
Coordinate ca1 = map->getNode(a->getNodeId(indexA))->toCoordinate();
Coordinate ca2 = map->getNode(a->getNodeId(indexA + 1))->toCoordinate();
Coordinate cb1 = map->getNode(b->getNodeId(indexB))->toCoordinate();
LineSegment lsA(ca1, ca2);
Coordinate start;
lsA.closestPoint(cb1, start);
return LocationOfPoint(map, a).locate(start);
}
示例6: isValid
bool CustomPoiMerger::isValid(const ConstOsmMapPtr& map) const
{
bool result = true;
for (set< pair<ElementId, ElementId> >::iterator it = _pairs.begin();
result && it != _pairs.end(); ++it)
{
result = result && map->containsElement(it->first) && map->containsElement(it->second);
result = result && it->first.getType() == ElementType::Node;
result = result && it->second.getType() == ElementType::Node;
}
return result;
}
示例7: createMatches
void PlacesPoiMatchCreator::createMatches(const ConstOsmMapPtr& map, vector<const Match *> &matches,
ConstMatchThresholdPtr threshold)
{
LOG_DEBUG(SystemInfo::getMemoryUsageString());
{
WorstCircularErrorVisitor wav;
map->visitRo(wav);
LOG_DEBUG("Worst circular error: " << wav.getWorstCircularError());
PlacesPoiMatchVisitor v(map, matches, wav.getWorstCircularError(), _bounds, threshold);
map->visitRo(v);
LOG_DEBUG(SystemInfo::getMemoryUsageString());
}
LOG_DEBUG(SystemInfo::getMemoryUsageString());
}
示例8: handleScope
Handle<Value> ScriptMatch::_callGetMatchFeatureDetails(const ConstOsmMapPtr& map) const
{
Isolate* current = v8::Isolate::GetCurrent();
EscapableHandleScope handleScope(current);
Context::Scope context_scope(_script->getContext(current));
Handle<Object> plugin =
Handle<Object>::Cast(
_script->getContext(current)->Global()->Get(String::NewFromUtf8(current, "plugin")));
Handle<Value> value = plugin->Get(String::NewFromUtf8(current, "getMatchFeatureDetails"));
Handle<Function> func = Handle<Function>::Cast(value);
Handle<Value> jsArgs[3];
if (func.IsEmpty() || func->IsFunction() == false)
{
throw IllegalArgumentException("getMatchFeatureDetails must be a valid function.");
}
Handle<Object> mapObj = OsmMapJs::create(map);
int argc = 0;
jsArgs[argc++] = mapObj;
jsArgs[argc++] = ElementJs::New(map->getElement(_eid1));
jsArgs[argc++] = ElementJs::New(map->getElement(_eid2));
TryCatch trycatch;
Handle<Value> result = func->Call(plugin, argc, jsArgs);
HootExceptionJs::checkV8Exception(result, trycatch);
return handleScope.Escape(result);
}
示例9: _validateElement
void MaximalSublineStringMatcher::_validateElement(const ConstOsmMapPtr& map, ElementId eid) const
{
ConstElementPtr e = map->getElement(eid);
if (e->getElementType() == ElementType::Relation)
{
ConstRelationPtr r = dynamic_pointer_cast<const Relation>(e);
if (OsmSchema::getInstance().isMultiLineString(*r) == false)
{
throw NeedsReviewException("Internal Error: When matching sublines expected a multilinestring "
"relation not a " + r->getType() + ". A non-multilinestring should never be found here. "
"Please report this to [email protected]");
}
const vector<RelationData::Entry>& entries = r->getMembers();
for (size_t i = 0; i < entries.size(); i++)
{
if (entries[i].getElementId().getType() != ElementType::Way)
{
throw NeedsReviewException("MultiLineString relations can only contain ways when matching "
"sublines.");
}
}
}
if (e->getElementType() == ElementType::Way)
{
ConstWayPtr w = dynamic_pointer_cast<const Way>(e);
if (w->getNodeCount() <= 1)
{
throw NeedsReviewException("Internal Error: Attempting to match against a zero length way.");
}
}
}
示例10: context_scope
Handle<Value> ScriptMatch::_call(const ConstOsmMapPtr& map, Handle<Object> plugin)
{
HandleScope handleScope;
Context::Scope context_scope(_script->getContext());
plugin =
Handle<Object>::Cast(_script->getContext()->Global()->Get(String::New("plugin")));
Handle<v8::Value> value = plugin->Get(String::New("matchScore"));
Handle<v8::Function> func = v8::Handle<v8::Function>::Cast(value);
Handle<Value> jsArgs[3];
if (func.IsEmpty() || func->IsFunction() == false)
{
throw IllegalArgumentException("matchScore must be a valid function.");
}
Handle<Object> mapObj = OsmMapJs::create(map);
int argc = 0;
jsArgs[argc++] = mapObj;
jsArgs[argc++] = ElementJs::New(map->getElement(_eid1));
jsArgs[argc++] = ElementJs::New(map->getElement(_eid2));
TryCatch trycatch;
Handle<Value> result = func->Call(plugin, argc, jsArgs);
HootExceptionJs::checkV8Exception(result, trycatch);
return handleScope.Close(result);
}
示例11: createMatches
void BuildingMatchCreator::createMatches(const ConstOsmMapPtr& map, vector<const Match*>& matches,
ConstMatchThresholdPtr threshold)
{
LOG_VAR(*threshold);
BuildingMatchVisitor v(map, matches, _getRf(), threshold, Status::Unknown1);
map->visitRo(v);
}
示例12: _validateElement
void MaximalSublineStringMatcher::_validateElement(const ConstOsmMapPtr& map, ElementId eid) const
{
ConstElementPtr e = map->getElement(eid);
if (e->getElementType() == ElementType::Relation)
{
ConstRelationPtr r = dynamic_pointer_cast<const Relation>(e);
if (OsmSchema::getInstance().isMultiLineString(*r) == false)
{
throw NeedsReviewException("When matching sublines expected a multilinestring relation not"
" a " + r->getType());
}
const vector<RelationData::Entry>& entries = r->getMembers();
for (size_t i = 0; i < entries.size(); i++)
{
if (entries[i].getElementId().getType() != ElementType::Way)
{
throw NeedsReviewException("MultiLineString relations can only contain ways when matching "
"sublines.");
}
}
}
}
示例13: createMatches
void ScriptMatchCreator::createMatches(const ConstOsmMapPtr& map, vector<const Match *> &matches,
ConstMatchThresholdPtr threshold)
{
if (!_script)
{
throw IllegalArgumentException("The script must be set on the ScriptMatchCreator.");
}
ScriptMatchVisitor v(map, matches, threshold, _script, _filter);
v.setScriptPath(_scriptPath);
v.calculateSearchRadius();
_cachedCustomSearchRadii[_scriptPath] = v.getCustomSearchRadius();
LOG_VART(_scriptPath);
LOG_VART(_cachedCustomSearchRadii[_scriptPath]);
QFileInfo scriptFileInfo(_scriptPath);
LOG_DEBUG(
"Creating matches with: " << className() << ";" << scriptFileInfo.fileName() << "...");
LOG_VARD(*threshold);
map->visitRo(v);
LOG_INFO(
"Found " << v.getNumMatchCandidatesFound() << " " <<
CreatorDescription::baseFeatureTypeToString(
_getScriptDescription(_scriptPath).baseFeatureType) << " match candidates.");
}
示例14: cleanWay
void WayCleaner::cleanWay(WayPtr way, const ConstOsmMapPtr& map)
{
const vector<long> nodeIds = way->getNodeIds();
if (isZeroLengthWay(way, map))
{
throw HootException("Cannot clean zero length way.");
}
QList<long> modifiedNodeIds = QVector<long>::fromStdVector(nodeIds).toList();
QList<long> nodeIdsTemp;
QList<Coordinate> coords;
for (size_t i = 0; i < nodeIds.size(); i++)
{
bool found = false;
if (nodeIdsTemp.contains(nodeIds[i]))
{
//the only duplicated nodes allowed are the first and last for a closed way
if (i == (nodeIds.size() - 1) && nodeIds[0] == nodeIds[i])
{
}
else
{
found = true;
}
}
else
{
nodeIdsTemp.append(nodeIds[i]);
}
const Coordinate coord = map->getNode(nodeIds[i])->toCoordinate();
if (coords.contains(coord))
{
//the only duplicated coords allowed are the first and last for a closed way, if the node ID's
//match
if (i == (nodeIds.size() - 1) && nodeIds[0] == nodeIds[i])
{
}
else
{
found = true;
}
}
else
{
coords.append(coord);
}
if (found)
{
modifiedNodeIds.removeAt(i);
}
}
way->setNodes(modifiedNodeIds.toVector().toStdVector());
}
示例15: _calculateHilbertValue
int64_t AddHilbertReviewSortOrderOp::_calculateHilbertValue(const ConstOsmMapPtr &map,
const set<ElementId> eids)
{
auto_ptr<Envelope> env;
for (set<ElementId>::const_iterator it = eids.begin(); it != eids.end(); ++it)
{
Envelope::AutoPtr te(map->getElement(*it)->getEnvelope(map));
if (env.get() == 0)
{
env.reset(new Envelope(*te));
}
else
{
env->expandToInclude(te.get());
}
}
if (_mapEnvelope.get() == 0)
{
_mapEnvelope.reset(new Envelope(map->calculateEnvelope()));
}
Coordinate center;
env->centre(center);
Meters cellSize = 10.0;
int xorder = max(1.0, ceil(log(_mapEnvelope->getWidth() / cellSize) / log(2.0)));
int yorder = max(1.0, ceil(log(_mapEnvelope->getHeight() / cellSize) / log(2.0)));
// 31 bits is the most supported for 2 dimensions.
int order = min(31, max(xorder, yorder));
// always 2 dimensions.
Tgs::HilbertCurve c(2, order);
int64_t maxRange = 1 << order;
int point[2];
point[0] = max<int64_t>(0, min<int64_t>(maxRange - 1,
round((center.x - _mapEnvelope->getMinX()) / cellSize)));
point[1] = max<int64_t>(0, min<int64_t>(maxRange - 1,
round((center.y - _mapEnvelope->getMinY()) / cellSize)));
// pad with zeros to make sorting a little easier.
return c.encode(point);
}