diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGBackgroundNode.cpp b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGBackgroundNode.cpp index 870fdf2de..cb015aa01 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGBackgroundNode.cpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGBackgroundNode.cpp @@ -83,7 +83,7 @@ public: /* class OSGBackgroundNode */ -OSGBackgroundNode::OSGBackgroundNode(QObject *parent) : OSGNode(parent), h(new Hidden(this)) +OSGBackgroundNode::OSGBackgroundNode(QObject *parent) : Inherited(parent), h(new Hidden(this)) {} OSGBackgroundNode::~OSGBackgroundNode() @@ -108,6 +108,8 @@ void OSGBackgroundNode::setImageFile(const QUrl &url) void OSGBackgroundNode::update() { + Inherited::update(); + if (isDirty(URL)) { h->updateURL(); } diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGBackgroundNode.hpp b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGBackgroundNode.hpp index 87c08507a..191530996 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGBackgroundNode.hpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGBackgroundNode.hpp @@ -40,6 +40,8 @@ namespace osgQtQuick { class OSGQTQUICK_EXPORT OSGBackgroundNode : public OSGNode { Q_OBJECT Q_PROPERTY(QUrl imageFile READ imageFile WRITE setImageFile NOTIFY imageFileChanged) + typedef OSGNode Inherited; + public: OSGBackgroundNode(QObject *parent = 0); virtual ~OSGBackgroundNode(); @@ -50,11 +52,12 @@ public: signals: void imageFileChanged(const QUrl &url); +protected: + virtual void update(); + private: struct Hidden; Hidden *const h; - - virtual void update(); }; } // namespace osgQtQuick diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGCamera.cpp b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGCamera.cpp index 0d5a40360..36102ee99 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGCamera.cpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGCamera.cpp @@ -27,8 +27,6 @@ #include "OSGCamera.hpp" -#include "OSGNode.hpp" - #include #include @@ -191,7 +189,7 @@ public: /* class OSGCamera */ -OSGCamera::OSGCamera(QObject *parent) : OSGNode(parent), h(new Hidden(this)) +OSGCamera::OSGCamera(QObject *parent) : Inherited(parent), h(new Hidden(this)) {} OSGCamera::~OSGCamera() @@ -254,6 +252,8 @@ void OSGCamera::setGraphicsContext(osg::GraphicsContext *gc) void OSGCamera::update() { + Inherited::update(); + if (isDirty(ClearColor)) { h->updateClearColor(); } diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGCamera.hpp b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGCamera.hpp index 5db7a715d..e32ca49fe 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGCamera.hpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGCamera.hpp @@ -45,6 +45,8 @@ class OSGQTQUICK_EXPORT OSGCamera : public OSGNode { Q_PROPERTY(qreal fieldOfView READ fieldOfView WRITE setFieldOfView NOTIFY fieldOfViewChanged) Q_PROPERTY(bool logarithmicDepthBuffer READ logarithmicDepthBuffer WRITE setLogarithmicDepthBuffer NOTIFY logarithmicDepthBufferChanged) + typedef OSGNode Inherited; + friend class OSGViewport; public: @@ -65,14 +67,15 @@ signals: void fieldOfViewChanged(qreal arg); void logarithmicDepthBufferChanged(bool enabled); +protected: + virtual void update(); + private: struct Hidden; Hidden *const h; osg::Camera *asCamera() const; void setGraphicsContext(osg::GraphicsContext *gc); - - virtual void update(); }; } // namespace osgQtQuick diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGFileNode.cpp b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGFileNode.cpp index 218f09898..518dd87b1 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGFileNode.cpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGFileNode.cpp @@ -146,7 +146,7 @@ private slots: /* class OSGFileNode */ -OSGFileNode::OSGFileNode(QObject *parent) : OSGNode(parent), h(new Hidden(this)) +OSGFileNode::OSGFileNode(QObject *parent) : Inherited(parent), h(new Hidden(this)) {} OSGFileNode::~OSGFileNode() @@ -199,6 +199,8 @@ void OSGFileNode::setOptimizeMode(OptimizeMode::Enum optimizeMode) void OSGFileNode::update() { + Inherited::update(); + if (isDirty(Async)) { // do nothing... } diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGFileNode.hpp b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGFileNode.hpp index b269f0869..645a4a1ec 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGFileNode.hpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGFileNode.hpp @@ -39,6 +39,7 @@ QT_END_NAMESPACE namespace osgQtQuick { class OSGQTQUICK_EXPORT OptimizeMode : public QObject { Q_OBJECT + public: enum Enum { None, Optimize, OptimizeAndCheck }; Q_ENUMS(Enum) // TODO switch to Q_ENUM once on Qt 5.5 @@ -49,6 +50,8 @@ class OSGQTQUICK_EXPORT OSGFileNode : public OSGNode { Q_PROPERTY(bool async READ async WRITE setAsync NOTIFY asyncChanged) Q_PROPERTY(osgQtQuick::OptimizeMode::Enum optimizeMode READ optimizeMode WRITE setOptimizeMode NOTIFY optimizeModeChanged) + typedef OSGNode Inherited; + public: OSGFileNode(QObject *parent = 0); virtual ~OSGFileNode(); @@ -67,11 +70,12 @@ signals: void asyncChanged(const bool async); void optimizeModeChanged(OptimizeMode::Enum); +protected: + virtual void update(); + private: struct Hidden; Hidden *const h; - - virtual void update(); }; } // namespace osgQtQuick diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGGeoTransformNode.cpp b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGGeoTransformNode.cpp index 267320f7d..d9a590c13 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGGeoTransformNode.cpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGGeoTransformNode.cpp @@ -147,6 +147,7 @@ public: // qDebug() << "OSGGeoTransformNode::updatePosition" << position; osgEarth::MapNode *mapNode = NULL; + if (sceneNode && sceneNode->node()) { mapNode = osgEarth::MapNode::findMapNode(sceneNode->node()); if (!mapNode) { @@ -199,7 +200,7 @@ private slots: /* class OSGGeoTransformNode */ -OSGGeoTransformNode::OSGGeoTransformNode(QObject *parent) : OSGNode(parent), h(new Hidden(this)) +OSGGeoTransformNode::OSGGeoTransformNode(QObject *parent) : Inherited(parent), h(new Hidden(this)) {} OSGGeoTransformNode::~OSGGeoTransformNode() @@ -269,6 +270,8 @@ void OSGGeoTransformNode::setPosition(QVector3D arg) void OSGGeoTransformNode::update() { + Inherited::update(); + if (isDirty(Child)) { h->updateChildNode(); } diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGGeoTransformNode.hpp b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGGeoTransformNode.hpp index 22963b5b0..73006ed2e 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGGeoTransformNode.hpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGGeoTransformNode.hpp @@ -41,12 +41,12 @@ class OSGQTQUICK_EXPORT OSGGeoTransformNode : public OSGNode { Q_PROPERTY(osgQtQuick::OSGNode *modelData READ childNode WRITE setChildNode NOTIFY childNodeChanged) // TODO rename to earthNode Q_PROPERTY(osgQtQuick::OSGNode * sceneData READ sceneNode WRITE setSceneNode NOTIFY sceneNodeChanged) - Q_PROPERTY(bool clampToTerrain READ clampToTerrain WRITE setClampToTerrain NOTIFY clampToTerrainChanged) Q_PROPERTY(bool intoTerrain READ intoTerrain NOTIFY intoTerrainChanged) - Q_PROPERTY(QVector3D position READ position WRITE setPosition NOTIFY positionChanged) + typedef OSGNode Inherited; + public: OSGGeoTransformNode(QObject *parent = 0); virtual ~OSGGeoTransformNode(); @@ -75,11 +75,12 @@ signals: void positionChanged(QVector3D arg); +protected: + virtual void update(); + private: struct Hidden; Hidden *const h; - - virtual void update(); }; } // namespace osgQtQuick diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGGroup.cpp b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGGroup.cpp index d74a3a9c4..c757876d8 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGGroup.cpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGGroup.cpp @@ -161,7 +161,7 @@ private slots: /* class OSGGGroupNode */ -OSGGroup::OSGGroup(QObject *parent) : OSGNode(parent), h(new Hidden(this)) +OSGGroup::OSGGroup(QObject *parent) : Inherited(parent), h(new Hidden(this)) {} OSGGroup::~OSGGroup() @@ -181,6 +181,8 @@ QQmlListProperty OSGGroup::children() const void OSGGroup::update() { + Inherited::update(); + if (isDirty(Children)) { h->updateGroupNode(); } diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGGroup.hpp b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGGroup.hpp index be115edb5..6487e076f 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGGroup.hpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGGroup.hpp @@ -39,17 +39,20 @@ class OSGQTQUICK_EXPORT OSGGroup : public OSGNode { Q_CLASSINFO("DefaultProperty", "children") + typedef OSGNode Inherited; + public: explicit OSGGroup(QObject *parent = 0); virtual ~OSGGroup(); QQmlListProperty children() const; +protected: + virtual void update(); + private: struct Hidden; Hidden *const h; - - virtual void update(); }; } // namespace osgQtQuick diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGNode.cpp b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGNode.cpp index d7abad4c8..c8db2a789 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGNode.cpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGNode.cpp @@ -129,21 +129,15 @@ void OSGNode::componentComplete() qDebug() << "OSGNode::componentComplete" << this; update(); clearDirty(); - h->complete = h->node.valid(); - if (!isComponentComplete()) { - qWarning() << "OSGNode::componentComplete - not complete !!!" << this; + h->complete = true; + if (!h->node.valid()) { + qWarning() << "OSGNode::componentComplete - node is not valid!" << this; } } -bool OSGNode::isComponentComplete() -{ - return h->complete; -} - - void OSGNode::emitNodeChanged() { - if (isComponentComplete()) { + if (h->complete) { emit nodeChanged(node()); } } diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGNode.hpp b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGNode.hpp index 57448a2af..97c62888f 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGNode.hpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGNode.hpp @@ -61,6 +61,9 @@ public: osg::Node *node() const; void setNode(osg::Node *node); +signals: + void nodeChanged(osg::Node *node) const; + protected: bool isDirty(int mask = 0xFFFF) const; void setDirty(int mask = 0xFFFF); @@ -69,18 +72,13 @@ protected: void classBegin(); void componentComplete(); - bool isComponentComplete(); - void emitNodeChanged(); -signals: - void nodeChanged(osg::Node *node) const; + virtual void update(); private: struct Hidden; Hidden *const h; - - virtual void update(); }; } // namespace osgQtQuick diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGShapeNode.cpp b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGShapeNode.cpp index a0cff9da5..294c80882 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGShapeNode.cpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGShapeNode.cpp @@ -78,7 +78,7 @@ public: // TODO turn into generic shape node... // see http://trac.openscenegraph.org/projects/osg//wiki/Support/Tutorials/TransformsAndStates -OSGShapeNode::OSGShapeNode(QObject *parent) : OSGNode(parent), h(new Hidden(this)) +OSGShapeNode::OSGShapeNode(QObject *parent) : Inherited(parent), h(new Hidden(this)) { setDirty(Type); } @@ -105,6 +105,8 @@ void OSGShapeNode::setShapeType(ShapeType::Enum type) void OSGShapeNode::update() { + Inherited::update(); + if (isDirty(Type)) { h->updateNode(); } diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGShapeNode.hpp b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGShapeNode.hpp index d11f069b3..6095476e7 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGShapeNode.hpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGShapeNode.hpp @@ -42,6 +42,8 @@ public: class OSGQTQUICK_EXPORT OSGShapeNode : public OSGNode { Q_OBJECT Q_PROPERTY(osgQtQuick::ShapeType::Enum shapeType READ shapeType WRITE setShapeType NOTIFY shapeTypeChanged) + typedef OSGNode Inherited; + public: OSGShapeNode(QObject *parent = 0); virtual ~OSGShapeNode(); @@ -52,11 +54,12 @@ public: signals: void shapeTypeChanged(ShapeType::Enum); +protected: + virtual void update(); + private: struct Hidden; Hidden *const h; - - virtual void update(); }; } // namespace osgQtQuick diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGSkyNode.cpp b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGSkyNode.cpp index 75f46d688..8eff4c2e2 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGSkyNode.cpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGSkyNode.cpp @@ -223,7 +223,7 @@ private slots: /* class OSGSkyNode */ -OSGSkyNode::OSGSkyNode(QObject *parent) : OSGNode(parent), h(new Hidden(this)) +OSGSkyNode::OSGSkyNode(QObject *parent) : Inherited(parent), h(new Hidden(this)) { setDirty(DateTime | Light); } @@ -305,6 +305,8 @@ void OSGSkyNode::setMinimumAmbientLight(double ambient) void OSGSkyNode::update() { + Inherited::update(); + if (isDirty(Scene)) { h->updateSkyNode(); } diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGSkyNode.hpp b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGSkyNode.hpp index 8ae64c7df..fbfe900df 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGSkyNode.hpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGSkyNode.hpp @@ -49,11 +49,12 @@ class OSGQTQUICK_EXPORT OSGSkyNode : public OSGNode { // TODO rename to sceneNode Q_OBJECT Q_PROPERTY(osgQtQuick::OSGNode *sceneData READ sceneNode WRITE setSceneNode NOTIFY sceneNodeChanged) Q_PROPERTY(osgQtQuick::OSGViewport * viewport READ viewport WRITE setViewport NOTIFY viewportChanged) - Q_PROPERTY(bool sunLightEnabled READ sunLightEnabled WRITE setSunLightEnabled NOTIFY sunLightEnabledChanged) Q_PROPERTY(QDateTime dateTime READ dateTime WRITE setDateTime NOTIFY dateTimeChanged) Q_PROPERTY(double minimumAmbientLight READ minimumAmbientLight WRITE setMinimumAmbientLight NOTIFY minimumAmbientLightChanged) + typedef OSGNode Inherited; + public: OSGSkyNode(QObject *parent = 0); virtual ~OSGSkyNode(); @@ -81,11 +82,12 @@ signals: void dateTimeChanged(QDateTime arg); void minimumAmbientLightChanged(double arg); +protected: + virtual void update(); + private: struct Hidden; Hidden *const h; - - virtual void update(); }; } // namespace osgQtQuick diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGTextNode.cpp b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGTextNode.cpp index 43e9a2924..ded1d61a3 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGTextNode.cpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGTextNode.cpp @@ -90,7 +90,7 @@ public: /* class OSGTextNode */ -OSGTextNode::OSGTextNode(QObject *parent) : OSGNode(parent), h(new Hidden(this)) +OSGTextNode::OSGTextNode(QObject *parent) : Inherited(parent), h(new Hidden(this)) { setDirty(Text | Color); } @@ -130,6 +130,8 @@ void OSGTextNode::setColor(const QColor &color) void OSGTextNode::update() { + Inherited::update(); + if (isDirty(Text)) { h->updateText(); } diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGTextNode.hpp b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGTextNode.hpp index 21cc7d5d9..587a71901 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGTextNode.hpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGTextNode.hpp @@ -38,6 +38,8 @@ class OSGQTQUICK_EXPORT OSGTextNode : public OSGNode { Q_OBJECT Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged) Q_PROPERTY(QColor color READ color WRITE setColor NOTIFY colorChanged) + typedef OSGNode Inherited; + public: explicit OSGTextNode(QObject *parent = 0); virtual ~OSGTextNode(); @@ -52,11 +54,12 @@ signals: void textChanged(const QString &text); void colorChanged(const QColor &color); +protected: + virtual void update(); + private: struct Hidden; Hidden *const h; - - virtual void update(); }; } // namespace osgQtQuick diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGTransformNode.cpp b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGTransformNode.cpp index ad62d58ea..46f79ba18 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGTransformNode.cpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGTransformNode.cpp @@ -138,7 +138,7 @@ private slots: /* class OSGTransformNode */ -OSGTransformNode::OSGTransformNode(QObject *parent) : OSGNode(parent), h(new Hidden(this)) +OSGTransformNode::OSGTransformNode(QObject *parent) : Inherited(parent), h(new Hidden(this)) {} OSGTransformNode::~OSGTransformNode() @@ -204,6 +204,8 @@ void OSGTransformNode::setPosition(QVector3D arg) void OSGTransformNode::update() { + Inherited::update(); + if (isDirty(Child)) { h->updateChildNode(); } diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGTransformNode.hpp b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGTransformNode.hpp index 430269dec..5b619fcad 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGTransformNode.hpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGTransformNode.hpp @@ -39,11 +39,12 @@ class OSGQTQUICK_EXPORT OSGTransformNode : public OSGNode { Q_OBJECT // TODO rename to childNode Q_PROPERTY(osgQtQuick::OSGNode *modelData READ childNode WRITE setChildNode NOTIFY childNodeChanged) - Q_PROPERTY(QVector3D scale READ scale WRITE setScale NOTIFY scaleChanged) Q_PROPERTY(QVector3D attitude READ attitude WRITE setAttitude NOTIFY attitudeChanged) Q_PROPERTY(QVector3D position READ position WRITE setPosition NOTIFY positionChanged) + typedef OSGNode Inherited; + public: OSGTransformNode(QObject *parent = 0); virtual ~OSGTransformNode(); @@ -67,11 +68,12 @@ signals: void attitudeChanged(QVector3D arg); void positionChanged(QVector3D arg); +protected: + virtual void update(); + private: struct Hidden; Hidden *const h; - - virtual void update(); }; } // namespace osgQtQuick diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGViewport.cpp b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGViewport.cpp index 5e52e9d30..da7d6e32c 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/OSGViewport.cpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/OSGViewport.cpp @@ -72,7 +72,7 @@ which will separate the clip plane calculations of the helicopter from those of the earth. * TODO : add OSGView to handle multiple views for a given OSGViewport -*/ + */ /* that's a typical error when working with high-resolution (retina) @@ -95,7 +95,7 @@ I think osgQt already handles this correctly, so you shouldn't have to worry about this if you use the classes provided by osgQt ... -*/ + */ namespace osgQtQuick { enum DirtyFlag { Scene = 1 << 0, Camera = 1 << 1 }; diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGCameraManipulator.cpp b/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGCameraManipulator.cpp index 6a381fe2e..929520054 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGCameraManipulator.cpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGCameraManipulator.cpp @@ -149,7 +149,8 @@ void OSGCameraManipulator::classBegin() void OSGCameraManipulator::componentComplete() { qDebug() << "OSGCameraManipulator::componentComplete" << this; - h->updateSceneNode(); + update(); + clearDirty(); } osgGA::CameraManipulator *OSGCameraManipulator::manipulator() const @@ -168,7 +169,9 @@ osgGA::CameraManipulator *OSGCameraManipulator::asCameraManipulator() const } void OSGCameraManipulator::update() -{} +{ + h->updateSceneNode(); +} } // namespace osgQtQuick #include "OSGCameraManipulator.moc" diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGCameraManipulator.hpp b/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGCameraManipulator.hpp index cca9d726a..0b16dcbd4 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGCameraManipulator.hpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGCameraManipulator.hpp @@ -69,11 +69,12 @@ protected: osgGA::CameraManipulator *manipulator() const; void setManipulator(osgGA::CameraManipulator *manipulator); +protected: + virtual void update(); + private: struct Hidden; Hidden *const h; - - virtual void update(); }; } // namespace osgQtQuick diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGEarthManipulator.cpp b/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGEarthManipulator.cpp index b751fd108..b8a5bc804 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGEarthManipulator.cpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGEarthManipulator.cpp @@ -57,7 +57,7 @@ public: /* class OSGEarthManipulator */ -OSGEarthManipulator::OSGEarthManipulator(QObject *parent) : OSGCameraManipulator(parent), h(new Hidden(this)) +OSGEarthManipulator::OSGEarthManipulator(QObject *parent) : Inherited(parent), h(new Hidden(this)) {} OSGEarthManipulator::~OSGEarthManipulator() diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGEarthManipulator.hpp b/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGEarthManipulator.hpp index 3104b7a0d..9fc829fe9 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGEarthManipulator.hpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGEarthManipulator.hpp @@ -37,6 +37,8 @@ namespace osgQtQuick { class OSGQTQUICK_EXPORT OSGEarthManipulator : public OSGCameraManipulator { Q_OBJECT + typedef OSGCameraManipulator Inherited; + public: explicit OSGEarthManipulator(QObject *parent = 0); virtual ~OSGEarthManipulator(); diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGGeoTransformManipulator.cpp b/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGGeoTransformManipulator.cpp index 5035bed02..7c6eefdb9 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGGeoTransformManipulator.cpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGGeoTransformManipulator.cpp @@ -203,7 +203,7 @@ void MyManipulator::updateCamera(osg::Camera & camera) /* class OSGGeoTransformManipulator */ -OSGGeoTransformManipulator::OSGGeoTransformManipulator(QObject *parent) : OSGCameraManipulator(parent), h(new Hidden(this)) +OSGGeoTransformManipulator::OSGGeoTransformManipulator(QObject *parent) : Inherited(parent), h(new Hidden(this)) {} OSGGeoTransformManipulator::~OSGGeoTransformManipulator() @@ -258,18 +258,10 @@ void OSGGeoTransformManipulator::setPosition(QVector3D arg) } } -// TODO factorize up -void OSGGeoTransformManipulator::componentComplete() -{ - OSGCameraManipulator::componentComplete(); - - qDebug() << "OSGGeoTransformManipulator::componentComplete" << this; - update(); - clearDirty(); -} - void OSGGeoTransformManipulator::update() { + Inherited::update(); + h->updatePosition(); h->updateAttitude(); h->updateManipulator(); diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGGeoTransformManipulator.hpp b/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGGeoTransformManipulator.hpp index a8bdc52c9..7906c533b 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGGeoTransformManipulator.hpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGGeoTransformManipulator.hpp @@ -41,6 +41,8 @@ class OSGQTQUICK_EXPORT OSGGeoTransformManipulator : public OSGCameraManipulator Q_PROPERTY(bool clampToTerrain READ clampToTerrain WRITE setClampToTerrain NOTIFY clampToTerrainChanged) Q_PROPERTY(bool intoTerrain READ intoTerrain NOTIFY intoTerrainChanged) + typedef OSGCameraManipulator Inherited; + public: explicit OSGGeoTransformManipulator(QObject *parent = 0); virtual ~OSGGeoTransformManipulator(); @@ -62,9 +64,6 @@ signals: void clampToTerrainChanged(bool arg); void intoTerrainChanged(bool arg); -protected: - void componentComplete(); - private: struct Hidden; Hidden *const h; diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGNodeTrackerManipulator.cpp b/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGNodeTrackerManipulator.cpp index a832d4928..8053093c5 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGNodeTrackerManipulator.cpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGNodeTrackerManipulator.cpp @@ -122,7 +122,7 @@ private slots: /* class OSGNodeTrackerManipulator */ -OSGNodeTrackerManipulator::OSGNodeTrackerManipulator(QObject *parent) : OSGCameraManipulator(parent), h(new Hidden(this)) +OSGNodeTrackerManipulator::OSGNodeTrackerManipulator(QObject *parent) : Inherited(parent), h(new Hidden(this)) {} OSGNodeTrackerManipulator::~OSGNodeTrackerManipulator() @@ -156,11 +156,10 @@ void OSGNodeTrackerManipulator::setTrackerMode(TrackerMode::Enum mode) } } -void OSGNodeTrackerManipulator::componentComplete() +void OSGNodeTrackerManipulator::update() { - OSGCameraManipulator::componentComplete(); + Inherited::update(); - qDebug() << "OSGNodeTrackerManipulator::componentComplete" << this; h->updateTrackerMode(); h->updateTrackNode(); } diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGNodeTrackerManipulator.hpp b/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGNodeTrackerManipulator.hpp index 378271e13..f631a29ca 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGNodeTrackerManipulator.hpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGNodeTrackerManipulator.hpp @@ -45,6 +45,8 @@ class OSGQTQUICK_EXPORT OSGNodeTrackerManipulator : public OSGCameraManipulator Q_OBJECT Q_PROPERTY(osgQtQuick::OSGNode *trackNode READ trackNode WRITE setTrackNode NOTIFY trackNodeChanged) Q_PROPERTY(osgQtQuick::TrackerMode::Enum trackerMode READ trackerMode WRITE setTrackerMode NOTIFY trackerModeChanged) + typedef OSGCameraManipulator Inherited; + public: explicit OSGNodeTrackerManipulator(QObject *parent = 0); virtual ~OSGNodeTrackerManipulator(); @@ -59,12 +61,11 @@ signals: void trackNodeChanged(OSGNode *node); void trackerModeChanged(TrackerMode::Enum); -protected: - void componentComplete(); - private: struct Hidden; Hidden *const h; + + virtual void update(); }; } // namespace osgQtQuick diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGTrackballManipulator.cpp b/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGTrackballManipulator.cpp index 99a3f6ca3..2c8a426fc 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGTrackballManipulator.cpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGTrackballManipulator.cpp @@ -57,7 +57,7 @@ public: /* class OSGTrackballManipulator */ -OSGTrackballManipulator::OSGTrackballManipulator(QObject *parent) : OSGCameraManipulator(parent), h(new Hidden(this)) +OSGTrackballManipulator::OSGTrackballManipulator(QObject *parent) : Inherited(parent), h(new Hidden(this)) {} OSGTrackballManipulator::~OSGTrackballManipulator() diff --git a/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGTrackballManipulator.hpp b/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGTrackballManipulator.hpp index 4ce01eeef..c5a5fbe4e 100644 --- a/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGTrackballManipulator.hpp +++ b/ground/gcs/src/libs/osgearth/osgQtQuick/ga/OSGTrackballManipulator.hpp @@ -37,6 +37,8 @@ namespace osgQtQuick { class OSGQTQUICK_EXPORT OSGTrackballManipulator : public OSGCameraManipulator { Q_OBJECT + typedef OSGCameraManipulator Inherited; + public: explicit OSGTrackballManipulator(QObject *parent = 0); virtual ~OSGTrackballManipulator();