本文整理汇总了C++中ConstElementPtr类的典型用法代码示例。如果您正苦于以下问题:C++ ConstElementPtr类的具体用法?C++ ConstElementPtr怎么用?C++ ConstElementPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ConstElementPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readNextElement
ElementPtr ElementSorter::readNextElement()
{
ElementPtr result;
ConstElementPtr cr;
if (_nodeIndex != _nodeIds.size())
{
cr = _source->getNode(_nodeIds[_nodeIndex++]);
}
else if (_wayIndex != _wayIds.size())
{
cr = _source->getWay(_wayIds[_wayIndex++]);
}
else if (_relationIndex != _relationIds.size())
{
cr = _source->getRelation(_relationIds[_relationIndex++]);
}
if (cr.get())
{
result.reset(cr->clone());
}
return result;
}
示例2: visit
virtual void visit(const ConstElementPtr& e)
{
const Tags& t = e->getTags();
const QString REV = MetadataTags::TrainingReview();
const QString MAT = MetadataTags::TrainingMatch();
if (t.contains(MetadataTags::TrainingId()) ||
t.contains(MAT) ||
t.contains(REV))
{
if (t.contains(MetadataTags::TrainingId()) == false ||
t.contains(MAT) == false)
{
LOG_WARN(QString("Element %1 doesn't contain %2 and %3.")
.arg(e->getElementId().toString())
.arg(MetadataTags::TrainingId())
.arg(MAT));
}
if (t[MAT] == "todo")
{
LOG_WARN("Element " << e->getElementId().toString() << " (" <<
t[MetadataTags::TrainingId()] << ") is still marked as todo: ");
}
if (!(t[MAT] == "none" || t[MAT] == "") &&
!(t[REV] == "none" || t[REV] == ""))
{
LOG_WARN("Element " << e->getElementId().toString() << " (" <<
t[MetadataTags::TrainingId()] << ") has both match and review populated.");
LOG_WARN(" '" << t[MAT] << "' and '" <<
t[REV] << "'");
}
}
}
示例3: _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.");
}
}
}
示例4: isSatisfied
bool LinearCriterion::isSatisfied(const ConstElementPtr& e) const
{
bool result = false;
if (e->getElementType() == ElementType::Node)
{
return false;
}
const Tags& t = e->getTags();
if (e->getElementType() == ElementType::Relation)
{
ConstRelationPtr r = boost::dynamic_pointer_cast<const Relation>(e);
result |= r->getType() == MetadataTags::RelationMultilineString();
result |= r->getType() == MetadataTags::RelationRoute();
result |= r->getType() == MetadataTags::RelationBoundary();
}
for (Tags::const_iterator it = t.constBegin(); it != t.constEnd(); ++it)
{
const SchemaVertex& tv = OsmSchema::getInstance().getTagVertex(it.key() + "=" + it.value());
uint16_t g = tv.geometries;
if (g & (OsmGeometries::LineString | OsmGeometries::ClosedWay) && !(g & OsmGeometries::Area))
{
result = true;
break;
}
}
return result;
}
示例5:
Handle<Value> ElementJs::getCircularError(const Arguments& args) {
HandleScope scope;
ConstElementPtr e = ObjectWrap::Unwrap<ElementJs>(args.This())->getConstElement();
return scope.Close(toV8(e->getCircularError()));
}
示例6: _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.");
}
}
}
}
示例7: isPoiIsh
bool PoiPolygonMatch::isPoiIsh(ConstElementPtr e)
{
return e->getElementType() == ElementType::Node &&
(OsmSchema::getInstance().getCategories(e->getTags()).intersects(
OsmSchemaCategory::building() | OsmSchemaCategory::poi()) ||
e->getTags().getNames().size() > 0);
}
示例8: visit
void PertyRemoveRandomElementVisitor::visit(const ConstElementPtr& e)
{
boost::uniform_real<> uni(0.0, 1.0);
if (uni(*_rng) <= _p)
{
RecursiveElementRemover(ElementId(e->getElementType(), e->getId())).apply(_map->shared_from_this());
}
}
示例9: _getUpdateValuesWayOrRelationStr
QString OsmApiDbSqlChangesetFileWriter::_getUpdateValuesWayOrRelationStr(ConstElementPtr element) const
{
return
QString("changeset_id=%2, visible=%3, \"timestamp\"=%5, version=%4 WHERE id=%1;\n")
.arg(element->getId())
.arg(element->getChangeset())
.arg(_getVisibleStr(element->getVisible()))
.arg(element->getVersion())
.arg(OsmApiDb::TIMESTAMP_FUNCTION);
}
示例10: _getInsertValuesWayOrRelationStr
QString OsmApiDbSqlChangesetFileWriter::_getInsertValuesWayOrRelationStr(ConstElementPtr element) const
{
return
QString("changeset_id, visible, \"timestamp\", "
"version) VALUES (%1, %2, %3, %5, %4);\n")
.arg(element->getId())
.arg(element->getChangeset())
.arg(_getVisibleStr(element->getVisible()))
.arg(element->getVersion())
.arg(OsmApiDb::TIMESTAMP_FUNCTION);
}
示例11: isSatisfied
bool HgisPoiCriterion::isSatisfied(const ConstElementPtr& e) const
{
bool result = false;
// See ticket #6853 for a definition of a "HGIS POI"
if (e->getElementType() == ElementType::Node)
{
result =
OsmSchema::getInstance().hasCategory(e->getTags(), OsmSchemaCategory::hgisPoi().toString());
}
return result;
}
示例12: visit
void DecomposeBuildingRelationsVisitor::visit(const ConstElementPtr& e)
{
if (e->getElementType() == ElementType::Relation)
{
const shared_ptr<Relation>& r = _map->getRelation(e->getId());
if (r->getType() == "building")
{
_decomposeBuilding(r);
}
}
}
示例13: v
vector<ConstWayPtr> ExtractWaysVisitor::extractWays(const ConstOsmMapPtr& map,
const ConstElementPtr& e)
{
LOG_TRACE("Extracting ways from " << e->getElementId());
vector<ConstWayPtr> result;
ExtractWaysVisitor v(result);
v.setOsmMap(map.get());
e->visitRo(*map, v);
return result;
}
示例14: _createNewElement
void OsmApiDbSqlChangesetFileWriter::_createNewElement(ConstElementPtr element)
{
const QString elementTypeStr = element->getElementType().toString().toLower();
ElementPtr changeElement = _getChangeElement(element);
//we only grab and assign a new id if we have a new element with a negative id, since we'll be
//writing this directly to the database and negative ids aren't allowed
LOG_TRACE("ID before: " << changeElement->getElementId());
long id;
if (changeElement->getId() < 0)
{
id = _db.getNextId(element->getElementType().getEnum());
}
else
{
id = changeElement->getId();
}
LOG_TRACE("ID after: " << ElementId(changeElement->getElementType(), id));
changeElement->setId(id);
changeElement->setVersion(1);
changeElement->setVisible(true);
changeElement->setChangeset(_changesetId);
LOG_TRACE("Creating: " << changeElement->getElementId());
QString note = "";
LOG_VART(changeElement->getId());
LOG_VART(note);
LOG_VART(changeElement->getVersion());
QString commentStr = "/* create " + elementTypeStr + " " + QString::number(changeElement->getId());
commentStr += "*/\n";
_outputSql.write((commentStr).toUtf8());
const QString values = _getInsertValuesStr(changeElement);
_outputSql.write(
("INSERT INTO " + elementTypeStr + "s (" + elementTypeStr + "_id, " + values).toUtf8());
_outputSql.write(("INSERT INTO current_" + elementTypeStr + "s (id, " + values).toUtf8());
_createTags(changeElement);
switch (changeElement->getElementType().getEnum())
{
case ElementType::Way:
_createWayNodes(boost::dynamic_pointer_cast<const Way>(changeElement));
break;
case ElementType::Relation:
_createRelationMembers(boost::dynamic_pointer_cast<const Relation>(changeElement));
break;
default:
//node
break;
}
}
示例15: visit
virtual void visit(const ConstElementPtr& e)
{
if (e->getStatus() == _matchStatus && isMatchCandidate(e))
{
checkForMatch(e);
}
}