osgEarth 2.1.1
Public Member Functions | Public Attributes

KMLUIBuilder Struct Reference

Collaboration diagram for KMLUIBuilder:

List of all members.

Public Member Functions

 KMLUIBuilder (ControlCanvas *canvas)
void apply (osg::Node &node)

Public Attributes

ControlCanvas_canvas
Grid_grid

Detailed Description

Visitor that builds a UI control for a loaded KML file.

Definition at line 229 of file osgearth_viewer.cpp.


Constructor & Destructor Documentation

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 );
    }

Member Function Documentation

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);
    }

Here is the call graph for this function:


Member Data Documentation

Definition at line 265 of file osgearth_viewer.cpp.

Definition at line 266 of file osgearth_viewer.cpp.


The documentation for this struct was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines