[原][osgearth]设置OE的高程,高度场的数据。修改设置高度值

    for( unsigned int row=0; row < hf->getNumRows(); ++row )
    {
      for( unsigned int col=0; col < hf->getNumColumns(); ++col )
      {
        float val = hf->getHeight(col, row);
        if ( !isNoData( val ) ) {
          continue;
        }
        if ( col > 0 )
          val = hf->getHeight(col-1,row);
        else if ( col <= hf->getNumColumns()-1 )
          val = hf->getHeight(col+1,row);

        if ( isNoData( val ) )
        {
          if ( row > 0 )
            val = hf->getHeight(col, row-1);
          else if ( row < hf->getNumRows()-1 )
            val = hf->getHeight(col, row+1);
        }

        if ( isNoData( val ) )
        {
          val = _nodata_value;
        }

        hf->setHeight( col, row, val );
      }
    }

这是从osgearth的ImageToHeightFieldConverter.cpp文件的

osg::HeightField* ImageToHeightFieldConverter::convert(const osg::Image* image ) 函数中找到的。

这里可以看出HeightField高度场中

osg::ref_ptr<osg::FloatArray>   _heights;

的组织方式

HeightField这个类的定义在Shape.cpp文件中!

原文地址:https://www.cnblogs.com/lyggqm/p/6413112.html