首页 > 其他 > 详细

[原][osgearth]OE地形平整代码解读

时间:2017-02-18 18:22:55      阅读:866      评论:0      收藏:0      [点我收藏+]

在FlatteningLayer文件的createHeightField函数中:使用的github在2017年1月份的代码

if (!geoms.getComponents().empty())
    {
        osg::ref_ptr<osg::HeightField> hf = HeightFieldUtils::createReferenceHeightField(
            ex,
            257, 257,           // base tile size for elevation data
            0u,                 // no border
            true);              // initialize to HAE (0.0) heights

        // Initialize to NO DATA.
        hf->getFloatArray()->assign(hf->getNumColumns()*hf->getNumRows(), NO_DATA_VALUE);

        // Create an elevation query envelope at the LOD we are creating
        osg::ref_ptr<ElevationEnvelope> envelope = _pool->createEnvelope(workingSRS, key.getLOD());

        // Resolve the buffering widths:
        double lineWidthLocal = lineWidth()->as(workingSRS->getUnits());
        double bufferWidthLocal = bufferWidth()->as(workingSRS->getUnits());
        
        if(integrate(key, hf, &geoms, workingSRS, lineWidthLocal, bufferWidthLocal, envelope, progress) || (progress && progress->isCanceled()))
        {
            //double t_create = OE_GET_TIMER(create);
            //OE_INFO << LC << key.str() << " : t=" << t_create << "s\n";

            // If integrate made any changes, return the new heightfield.
            // (Or if the operation was canceled...return it anyway and it 
            // will be discarded).
            return hf.release();
        }
    }

 

 

  创建一个高度场,长宽都是257,边界为0,高度引用大地水平基准面。

   用默认值初始化高度场

   在自己创建的LOD中创建一个高程查询信

   解决缓存宽度

   整合新高程

   如果高程有任何改变,返回新的高程图,高度场。

[原][osgearth]OE地形平整代码解读

原文:http://www.cnblogs.com/lyggqm/p/6413533.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!