Notification when CircleNodeEditor changes from Draggers

classic Classic list List threaded Threaded
2 messages Options
Thomas_Lerman Thomas_Lerman
Reply | Threaded
Open this post in threaded view
|

Notification when CircleNodeEditor changes from Draggers

Good day folks, it has been a while. I will preface this with . . . I am still on an old version of osgEarth, so cannot push. However, I did take a look at the newest code and did not find the fix in there.

I am wanting to be notified when CircleNodeEditor and EllipseNodeEditor changes from the user moving one of the Draggers. On:

*** EllipseNodeEditor: I found that I could do this with:
class MyEllipseNodeEditor : public osgEarth::Annotation::EllipseNodeEditor
{
public:
	MyEllipseNodeEditor(osgEarth::Annotation::EllipseNode* ellipseNode) :
		osgEarth::Annotation::EllipseNodeEditor(ellipseNode) { }

	virtual void updateDraggers(void)
	{
		osgEarth::Annotation::EllipseNodeEditor::updateDraggers();
		osgEarth::Annotation::EllipseNode* ellipse = static_cast<osgEarth::Annotation::EllipseNode*>(_node.get());
		double majorR = ellipse->getRadiusMajor().as(osgEarth::Units::METERS);
		double minorR = ellipse->getRadiusMinor().as(osgEarth::Units::METERS);
		. . .
	}
};

and updateDraggers() is called within:
* EllipseNodeEditor::EllipseNodeEditor() obviously constructor
* EllipseNodeEditor::updateDraggers() when the center Dragger changes
* SetEllipseRadiusCallback::onPositionChanged() for the radii Draggers

*** CircleNodeEditor: I found that I could do this with:
class MyCircleNodeEditor : public osgEarth::Annotation::CircleNodeEditor
{
public:
	MyCircleNodeEditor(osgEarth::Annotation::CircleNode* circleNode) :
		osgEarth::Annotation::CircleNodeEditor(circleNode) { }

	virtual void updateDraggers(void)
	{
		osgEarth::Annotation::CircleNodeEditor::updateDraggers();
		osgEarth::Annotation::CircleNode* circle = static_cast<osgEarth::Annotation::CircleNode*>(_node.get());
		double radius = circle->getRadius().as(osgEarth::Units::METERS);
		. . .
	}
};

and updateDraggers() is called within:
* CircleNodeEditor::CircleNodeEditor() obviously constructor
* CircleNodeEditor::updateDraggers() when the center Dragger changes

However, it is not called for the following:
* SetRadiusCallback::onPositionChanged() for the radius Dragger

So, I cannot get notification when the radius Dragger is moved. Adding the call:
          _editor->updateDraggers();
takes care of this. Are there any concerns with this?
gwaldron gwaldron
Reply | Threaded
Open this post in threaded view
|

Re: Notification when CircleNodeEditor changes from Draggers

Thomas,
No concerns at all. If it works, go with it :)

We do not really support the Editor objects anymore - they have not seen any attention in a long time. There's a chance we will relocate them to a separate NodeKit in the future.
Glenn Waldron / Pelican Mapping