2025-01-04 04:12:51 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
2025-03-13 00:42:41 +00:00
|
|
|
#include <osgEarth/MapNode>
|
|
|
|
|
#include <osgEarthUtil/Sky>
|
2025-04-21 00:20:00 +00:00
|
|
|
#include <osgEarth/Viewpoint>
|
2025-01-04 04:12:51 +00:00
|
|
|
|
2025-01-09 00:32:05 +00:00
|
|
|
#include "common/SpdLogger.h"
|
|
|
|
|
#include "config.h"
|
2025-01-12 17:35:51 +00:00
|
|
|
#include "scene/ui/OESceneUI.h"
|
2025-01-09 00:32:05 +00:00
|
|
|
|
2025-03-13 00:42:41 +00:00
|
|
|
namespace osgEarth {
|
|
|
|
|
namespace Util {
|
|
|
|
|
class EarthManipulator;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
class OEScene : public osg::Group {
|
2025-01-04 04:12:51 +00:00
|
|
|
public:
|
|
|
|
|
OEScene();
|
2025-03-13 00:42:41 +00:00
|
|
|
void AttachView(osgViewer::View* view);
|
|
|
|
|
void DetachView(osgViewer::View* view);
|
2025-01-04 04:12:51 +00:00
|
|
|
|
2025-03-13 00:42:41 +00:00
|
|
|
bool AddToScene(osg::Node* node) const;
|
2025-04-21 00:20:00 +00:00
|
|
|
void SetHomeViewpoint(const osgEarth::Viewpoint& viewpoint, double duration_s);
|
2025-06-17 18:05:47 +00:00
|
|
|
bool TrackEntity(osg::Node* entity, bool track) const;
|
2025-03-13 00:42:41 +00:00
|
|
|
|
2025-01-09 00:32:05 +00:00
|
|
|
osgEarth::MapNode* GetMapNode(void) const {
|
|
|
|
|
dyt_check(earthMapNode_.valid());
|
|
|
|
|
return earthMapNode_;
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-12 17:35:51 +00:00
|
|
|
OESceneUI* GetOrCreateSceneUI();
|
2025-11-13 14:13:40 +00:00
|
|
|
// Read-only accessor to avoid creating UI during teardown
|
|
|
|
|
OESceneUI* GetSceneUI() const {
|
|
|
|
|
return sceneUI_.get();
|
|
|
|
|
}
|
2025-03-13 00:42:41 +00:00
|
|
|
osgEarth::Util::EarthManipulator* GetManipulater() const {
|
|
|
|
|
return earthManipulator_.get();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
osg::Viewport* GetViewport() const;
|
2025-11-01 11:33:08 +00:00
|
|
|
bool ScreenToWorldCoordinate(int x, int y, osg::Vec3d* output) const;
|
|
|
|
|
bool Vec3ToLocation(const osg::Vec3& input, osg::Vec3d* output) const;
|
2025-03-13 00:42:41 +00:00
|
|
|
|
|
|
|
|
static const osgEarth::SpatialReference* GetSrs();
|
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void Init();
|
2025-01-12 17:35:51 +00:00
|
|
|
|
2025-01-04 04:12:51 +00:00
|
|
|
private:
|
|
|
|
|
osg::ref_ptr<osg::Node> earthRootNode_;
|
2025-03-13 00:42:41 +00:00
|
|
|
osg::ref_ptr<osgEarth::Util::EarthManipulator> earthManipulator_;
|
2025-01-04 04:12:51 +00:00
|
|
|
osg::ref_ptr<osgEarth::MapNode> earthMapNode_;
|
|
|
|
|
osg::ref_ptr<osg::Group> entityRoot_;
|
2025-03-13 00:42:41 +00:00
|
|
|
osg::ref_ptr<osgEarth::Util::SkyNode> skyDome_;
|
2025-01-12 17:35:51 +00:00
|
|
|
osg::ref_ptr<OESceneUI> sceneUI_;
|
2025-03-13 00:42:41 +00:00
|
|
|
osgViewer::View* curentView_ {nullptr};
|
2025-10-20 18:17:40 +00:00
|
|
|
bool homeViewpointSet_ {false};
|
2025-01-04 04:12:51 +00:00
|
|
|
};
|