osgEarth的Rex引擎原理分析(三十七)osgEarth如何对投影坐标系和大地坐标系进行显示处理的

本文深入探讨osgEarth如何处理投影坐标系和大地坐标系的显示,揭示TileNode在创建和渲染过程中如何根据地图投影方式调整显示,确保几何图形能够正确展现为球面或平面。同时,文章列出了一系列后续分析的问题,涉及osgEarth的各个组件和机制。
摘要由CSDN通过智能技术生成

目标:(二十九)中的问题87

osgEarth如何对投影坐标系和大地坐标系进行显示处理的

为什么一个能显示成球,一个显示成平面

<map name="MBTiles" type="geocentric" version="2"> 
  <options>
      <profile>epsg:4326</profile>
      <terrain driver="rex"/>
  </options>
  <image name="Sample MBTiles Database" driver="mbtiles">
      <filename>world_countries.mbtiles</filename>
  </image> 
</map>

<map name="MBTiles" type="projected" version="2"> 
  <options>
      <profile>epsg:4326</profile>
      <terrain driver="rex"/>
  </options>
  <image name="Sample MBTiles Database" driver="mbtiles">
      <filename>world_countries.mbtiles</filename>
  </image> 
</map>

这是因为每个TileNode的显示信息,会根据投影关系进行调整。TileNode显示信息的生成过程如下:

1、TileNode在创建时会生成显示信息

osgEarthDrivers/engine_rex/TileNode.cpp
void
TileNode::create(const TileKey& key, TileNode* parent, EngineContext* context)
{
    osg::ref_ptr<SharedGeometry> geom;
    context->getGeometryPool()->getPooledGeometry(
        key,
        mapInfo,         
        context->getOptions().tileSize().get(),
        masks.get(), 
        geom);
        TileDrawable* surfaceDrawable = new TileDrawable(
        key, 
        geom.get(),
        context->getOptions().tileSize().get() );

    // Give the tile Drawable access to the render model so it can properly
    // calculate its bounding box and sphere.
    surfaceDrawable->setModifyBBoxCallback(context->getModifyBBoxCallback());

    // Create the node to house the tile drawable:
    _surface = new SurfaceNode(
        key,
        mapInfo,
        context->getRenderBindings(),
        surfaceDrawable );

}

2、1会从瓦片几何图形池中寻找该瓦片的几何图形,注意几何图形池中的几何图形只和lod级别有关,而和水平垂直方向的位置无关,如果几何图形池中没有对应lod级别的瓦片,则几何图形池会创建,创建过程就会考虑地图的投影方式,从而确保这些几何图形拼接气起来是平面或球面。创建过程如下:

osgEarthDrivers/engine_rex/GeometryPool.cpp
SharedGeometry*
GeometryPool::createGeomet
  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 2
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值