osgEarth 2.1.1
|
Public Member Functions | |
KMLUIBuilder (ControlCanvas *canvas) | |
void | apply (osg::Node &node) |
Public Attributes | |
ControlCanvas * | _canvas |
Grid * | _grid |
Visitor that builds a UI control for a loaded KML file.
Definition at line 229 of file osgearth_viewer.cpp.
KMLUIBuilder::KMLUIBuilder | ( | ControlCanvas * | canvas | ) | [inline] |
Definition at line 231 of file osgearth_viewer.cpp.
: osg::NodeVisitor(osg::NodeVisitor::TRAVERSE_ALL_CHILDREN), _canvas(canvas) { _grid = new Grid(); _grid->setAbsorbEvents( true ); _grid->setPadding( 5 ); _grid->setVertAlign( Control::ALIGN_TOP ); _grid->setHorizAlign( Control::ALIGN_LEFT ); _grid->setBackColor( Color(Color::Black,0.5) ); _canvas->addControl( _grid ); }
void KMLUIBuilder::apply | ( | osg::Node & | node | ) | [inline] |
Definition at line 242 of file osgearth_viewer.cpp.
{ AnnotationData* data = dynamic_cast<AnnotationData*>( node.getUserData() ); if ( data ) { ControlVector row; CheckBoxControl* cb = new CheckBoxControl( node.getNodeMask() != 0, new ToggleNodeHandler( &node ) ); cb->setSize( 12, 12 ); row.push_back( cb ); std::string name = data->getName().empty() ? "<unnamed>" : data->getName(); LabelControl* label = new LabelControl( name, 14.0f ); label->setMargin(Gutter(0,0,0,(this->getNodePath().size()-3)*20)); if ( data->getViewpoint() ) { label->addEventHandler( new ClickViewpointHandler(*data->getViewpoint()) ); label->setActiveColor( Color::Blue ); } row.push_back( label ); _grid->addControls( row ); } traverse(node); }
Definition at line 265 of file osgearth_viewer.cpp.
Definition at line 266 of file osgearth_viewer.cpp.