void onClick( Control* control, int mouseButtonMask ) { //Remove the add point handler if it's valid if (s_addPointHandler.valid()) { osgEarth::removeEventHandler( s_viewer, s_addPointHandler.get() ); s_addPointHandler = NULL; } if (!s_editor.valid()) { Style style = s_featureNode->getStyle(); style.getOrCreate<LineSymbol>()->stroke()->stipple() = 0x00FF; s_featureNode->setStyle( style ); s_editor = new FeatureEditor( s_featureNode ); s_root->addChild( s_editor.get() ); } }
void onClick( Control* control, int mouseButtonMask ) { //remove the editor if it's valid if (s_editor.valid()) { s_root->removeChild( s_editor.get() ); s_editor = NULL; // Unset the stipple on the line Style style = s_featureNode->getStyle(); style.get<LineSymbol>()->stroke()->stipple().unset(); s_featureNode->setStyle( style ); } //Add the new add point handler if (!s_addPointHandler.valid()) { s_addPointHandler = new AddPointHandler( s_featureNode.get() ); s_addPointHandler->setIntersectionMask( 0x1 ); s_viewer->addEventHandler( s_addPointHandler.get() ); } }