当前位置: 首页>>代码示例>>C++>>正文


C++ ConstElementPtr::getTags方法代码示例

本文整理汇总了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);
}
开发者ID:BSteine,项目名称:hootenanny,代码行数:7,代码来源:PoiPolygonMatch.cpp

示例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);
    }
  }
}
开发者ID:bpross-52n,项目名称:hootenanny,代码行数:30,代码来源:TranslatedTagCountVisitor.cpp

示例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);
      }
    }
  }
}
开发者ID:giserh,项目名称:hootenanny,代码行数:55,代码来源:OgrWriter.cpp

示例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;
   }
 }
开发者ID:andyneff,项目名称:hootenanny,代码行数:14,代码来源:BuildingMatchCreator.cpp

示例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();
}
开发者ID:,项目名称:,代码行数:26,代码来源:

示例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()));
}
开发者ID:Nanonid,项目名称:hootenanny,代码行数:7,代码来源:ElementJs.cpp

示例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] << "'");
      }
    }
  }
开发者ID:,项目名称:,代码行数:34,代码来源:

示例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;
}
开发者ID:ngageoint,项目名称:hootenanny,代码行数:32,代码来源:LinearCriterion.cpp

示例9: visit

void TagKeyCountVisitor::visit(const ConstElementPtr& e)
{
  if (e->getTags().contains(_key))
  {
    _keyCount++;
  }
}
开发者ID:Nanonid,项目名称:hootenanny,代码行数:7,代码来源:TagKeyCountVisitor.cpp

示例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());
      }
    }
  }
开发者ID:bpross-52n,项目名称:hootenanny,代码行数:18,代码来源:AttributeCoOccurence.cpp

示例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;
}
开发者ID:Nanonid,项目名称:hootenanny,代码行数:44,代码来源:NameExtractor.cpp

示例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;
}
开发者ID:ngageoint,项目名称:hootenanny,代码行数:10,代码来源:ReversedRoadCriterion.cpp

示例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;
}
开发者ID:ngageoint,项目名称:hootenanny,代码行数:11,代码来源:HgisPoiCriterion.cpp

示例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;
}
开发者ID:,项目名称:,代码行数:20,代码来源:

示例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;
}
开发者ID:BSteine,项目名称:hootenanny,代码行数:23,代码来源:PoiPolygonMatch.cpp


注:本文中的ConstElementPtr::getTags方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。