本文整理汇总了C++中ConstElementPtr::getTags方法的典型用法代码示例。如果您正苦于以下问题:C++ ConstElementPtr::getTags方法的具体用法?C++ ConstElementPtr::getTags怎么用?C++ ConstElementPtr::getTags使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConstElementPtr
的用法示例。
在下文中一共展示了ConstElementPtr::getTags方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: visit
void TranslatedTagCountVisitor::visit(const ConstElementPtr& e)
{
if (e->getTags().getInformationCount() > 0)
{
shared_ptr<Geometry> g = ElementConverter(_map->shared_from_this()).convertToGeometry(e);
Tags t = e->getTags();
t["error:circular"] = QString::number(e->getCircularError());
t["hoot:status"] = e->getStatusString();
// remove all the empty tags.
for (Tags::const_iterator it = e->getTags().begin(); it != e->getTags().end(); ++it)
{
if (t[it.key()] == "")
{
t.remove(it.key());
}
}
QString layerName;
vector<ScriptToOgrTranslator::TranslatedFeature> f = _translator->translateToOgr(t,
e->getElementType(), g->getGeometryTypeId());
// only write the feature if it wasn't filtered by the translation script.
for (size_t i = 0; i < f.size(); i++)
{
_countTags(f[i].feature);
}
}
}
示例3: _writePartial
void OgrWriter::_writePartial(ElementProviderPtr& provider, const ConstElementPtr& e)
{
if (_translator.get() == 0)
{
throw HootException("You must call open before attempting to write.");
}
if (e->getTags().getInformationCount() > 0)
{
// There is probably a cleaner way of doing this.
// convertToGeometry calls getGeometryType which will throw an exception if it gets a relation
// that it doesn't know about. E.g. "route", "superroute", " turnlanes:turns" etc
shared_ptr<Geometry> g;
try
{
g = ElementConverter(provider).convertToGeometry(e);
}
catch (IllegalArgumentException& err)
{
LOG_WARN("Error converting geometry: " << err.getWhat() << " (" << e->toString() << ")");
g.reset((GeometryFactory::getDefaultInstance()->createEmptyGeometry()));
}
/*
LOG_DEBUG("After conversion to geometry, element is now a " <<
g->getGeometryType() );
*/
Tags t = e->getTags();
t["error:circular"] = QString::number(e->getCircularError());
t["hoot:status"] = e->getStatusString();
for (Tags::const_iterator it = e->getTags().begin(); it != e->getTags().end(); ++it)
{
if (t[it.key()] == "")
{
t.remove(it.key());
}
}
vector<ScriptToOgrTranslator::TranslatedFeature> tf = _translator->translateToOgr(t,
e->getElementType(), g->getGeometryTypeId());
// only write the feature if it wasn't filtered by the translation script.
for (size_t i = 0; i < tf.size(); i++)
{
OGRLayer* layer = _getLayer(tf[i].tableName);
if (layer != 0)
{
_addFeature(layer, tf[i].feature, g);
}
}
}
}
示例4: isRelated
static bool isRelated(ConstElementPtr e1, ConstElementPtr e2)
{
if (e1->getStatus() != e2->getStatus() &&
e1->isUnknown() && e2->isUnknown() &&
OsmSchema::getInstance().isBuilding(e1->getTags(), e1->getElementType()) &&
OsmSchema::getInstance().isBuilding(e2->getTags(), e2->getElementType()))
{
return true;
}
else
{
return false;
}
}
示例5: _getTags
QString OsmPgCsvWriter::_getTags(const ConstElementPtr& e)
{
QString buffer;
QTextStream stream(&buffer);
stream.setCodec("UTF-8");
const Tags& tags = e->getTags();
QRegExp regex("[\"=>, -]");
for (Tags::const_iterator it = tags.constBegin(); it != tags.constEnd(); ++it)
{
// Comma separated list
if (it != tags.constBegin())
stream << ",";
// Surround the key with quotes if it contains a special character requiring it
if (it.key().contains(regex))
stream << "\"" << QString(it.key()).replace("\"", "\\\"") << "\"";
else
stream << it.key();
stream<< "=>";
// Surround the value with quotes if it contains a special character requiring it
if (it.value().contains(regex))
stream << "\"" << QString(it.value()).replace("\"", "\\\"") << "\"";
else
stream << it.value();
}
return stream.readAll();
}
示例6:
Handle<Value> ElementJs::getTags(const Arguments& args) {
HandleScope scope;
ConstElementPtr e = ObjectWrap::Unwrap<ElementJs>(args.This())->getConstElement();
return scope.Close(TagsJs::New(e->getTags()));
}
示例7: 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] << "'");
}
}
}
示例8: 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;
}
示例9: visit
void TagKeyCountVisitor::visit(const ConstElementPtr& e)
{
if (e->getTags().contains(_key))
{
_keyCount++;
}
}
示例10: visit
virtual void visit(const ConstElementPtr& e)
{
QStringList refs;
if (e->getTags().contains(_ref))
{
e->getTags().readValues(_ref, refs);
}
refs.removeAll("todo");
refs.removeAll("none");
if (refs.size() > 0)
{
for (int i = 0; i < refs.size(); i++)
{
_ref2Eid[refs[i]].insert(e->getElementId());
}
}
}
示例11: extract
double NameExtractor::extract(const ConstElementPtr& target, const ConstElementPtr& candidate) const
{
QStringList targetNames = target->getTags().getNames();
targetNames.append(target->getTags().getPseudoNames());
QStringList candidateNames = candidate->getTags().getNames();
candidateNames.append(candidate->getTags().getPseudoNames());
double score = -1;
for (int i = 0; i < targetNames.size(); i++)
{
for (int j = 0; j < candidateNames.size(); j++)
{
double thisScore = _d->compare(targetNames[i], candidateNames[j]);
score = max(thisScore, score);
}
}
if (score == -1)
{
return nullValue();
}
else
{
// LOG_INFO("score: " << score << " weight: " << weight);
// LOG_INFO("target: " << target->toString());
// LOG_INFO("candidate: " << candidate->toString());
// if (candidate->getTags()["REF2"].contains(target->getTags()["REF1"]))
// {
// LOG_INFO(getName() << " | Match: " << score << " | " <<
// target->getTags().getNames().join(";") << " | " <<
// candidate->getTags().getNames().join(";"))
// }
// else
// {
// LOG_INFO(getName() << " | Miss: " << score << " | " <<
// target->getTags().getNames().join(";") << " | " <<
// candidate->getTags().getNames().join(";"))
// }
}
return score;
}
示例12: isSatisfied
bool ReversedRoadCriterion::isSatisfied(const ConstElementPtr& e) const
{
bool result = false;
const QString oneway = e->getTags()["oneway"].toLower();
if (oneway == "-1" || oneway == "reverse")
{
result = true;
}
return result;
}
示例13: 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;
}
示例14: isSatisfied
bool TagValueNumericRangeCriterion::isSatisfied(const ConstElementPtr& e) const
{
//The element must have tags for all keys passed in, and all the values for those keys must be
//within the specified range.
for (int i = 0; i < _tagKeys.size(); i++)
{
const QString tagKey = _tagKeys.at(i);
if (!e->getTags().contains(tagKey))
{
return false;
}
bool ok = false;
const long val = e->getTags().get(tagKey).toLong(&ok);
if (!ok || val < _rangeMin || val > _rangeMax)
{
return false;
}
}
return true;
}
示例15: _calculateTypeMatch
bool PoiPolygonMatch::_calculateTypeMatch(ConstElementPtr e1, ConstElementPtr e2) const
{
bool result = false;
const Tags& t1 = e1->getTags();
const Tags& t2 = e2->getTags();
for (Tags::const_iterator it = t1.begin(); it != t1.end(); it++)
{
// if it is a use or POI category
if ((OsmSchema::getInstance().getCategories(it.key(), it.value()) &
(OsmSchemaCategory::building() | OsmSchemaCategory::use() | OsmSchemaCategory::poi()))
!= OsmSchemaCategory::Empty)
{
result = t2.get(it.key()) == it.value();
if (result)
{
return result;
}
}
}
return result;
}