在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中创建一个高程查询信
解决缓存宽度
整合新高程
如果高程有任何改变,返回新的高程图,高度场。
原文:http://www.cnblogs.com/lyggqm/p/6413533.html