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


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

本文整理汇总了C++中ConstElementPtr::toString方法的典型用法代码示例。如果您正苦于以下问题:C++ ConstElementPtr::toString方法的具体用法?C++ ConstElementPtr::toString怎么用?C++ ConstElementPtr::toString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ConstElementPtr的用法示例。


在下文中一共展示了ConstElementPtr::toString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

Handle<Value> ElementJs::toString(const Arguments& args)
{
  HandleScope scope;

  ConstElementPtr e = ObjectWrap::Unwrap<ElementJs>(args.This())->getConstElement();

  return scope.Close(String::New(e->toString().toUtf8().data()));
}
开发者ID:Nanonid,项目名称:hootenanny,代码行数:8,代码来源:ElementJs.cpp

示例2: _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


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