osgEarth 2.1.1

/home/cube/sources/osgearth/src/osgEarthUtil/Controls

Go to the documentation of this file.
00001 /* -*-c++-*- */
00002 /* osgEarth - Dynamic map generation toolkit for OpenSceneGraph
00003  * Copyright 2008-2010 Pelican Mapping
00004  * http://osgearth.org
00005  *
00006  * osgEarth is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU Lesser General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public License
00017  * along with this program.  If not, see <http://www.gnu.org/licenses/>
00018  */
00019 #ifndef OSGEARTHUTIL_CONTROLS
00020 #define OSGEARTHUTIL_CONTROLS
00021 
00022 #include <osgEarthUtil/Common>
00023 #include <osgEarth/Common>
00024 #include <osgEarth/Units>
00025 #include <osg/Drawable>
00026 #include <osg/Geode>
00027 #include <osg/MatrixTransform>
00028 #include <osg/MixinVector>
00029 #include <osgGA/GUIEventHandler>
00030 #include <osgViewer/View>
00031 #include <osgText/Font>
00032 #include <osgText/Text>
00033 #include <vector>
00034 #include <queue>
00035 
00045 namespace osgEarth { namespace Util { namespace Controls
00046 {
00047     using namespace osgEarth;
00048 
00049     typedef std::vector< osg::ref_ptr<osg::Drawable> > DrawableList;
00050 
00051     typedef std::map< class Control*, osg::Geode* > GeodeTable;
00052 
00053     // holds 4-sided gutter dimensions (for margins and padding) .. no-export, header-only.
00054     struct Gutter
00055     {
00056         Gutter()
00057             : _top(0), _right(0), _bottom(0), _left(0) { }
00058         Gutter( float top, float right, float bottom, float left )
00059             : _top(top), _right(right), _bottom(bottom), _left(left) { }
00060         Gutter( float y, float x )
00061             : _top(y), _right(x), _bottom(y), _left(x) { }
00062         Gutter( float all )
00063             : _top(all), _right(all), _bottom(all), _left(all) { }
00064         bool operator !=( const Gutter& rhs ) const {
00065             return top() != rhs.top() || right() != rhs.right() || bottom() != rhs.bottom() || left() != rhs.left(); }
00066 
00067         float top()  const { return _top; }
00068         float left() const { return _left; }
00069         float right() const { return _right; }
00070         float bottom() const { return _bottom; }
00071 
00072         float x() const { return _left + _right; }
00073         float y() const { return _top + _bottom; }
00074 
00075         osg::Vec2f size() const { return osg::Vec2f(x(), y()); }
00076 
00077         osg::Vec2f offset() const { return osg::Vec2f( _left, _top ); }
00078 
00079     private:
00080         float _top, _right, _bottom, _left;
00081     };
00082 
00083     // internal state class
00084     struct ControlContext
00085     {
00086         ControlContext() : _viewContextID(~0) { }
00087         osg::View* _view;
00088         osg::ref_ptr<const osg::Viewport> _vp;
00089         unsigned int _viewContextID;
00090         std::queue< osg::ref_ptr<class Control> > _active;
00091         const osg::FrameStamp* _frameStamp;
00092     };
00093 
00094     // base class for control events
00095     class ControlEventHandler : public osg::Referenced
00096     {
00097     public:
00099         virtual void onClick( class Control* control ) { }
00100 
00102         virtual void onClick( class Control* control, int mouseButtonMask ) { onClick(control); }
00103 
00105         virtual void onClick( class Control* control, const osg::Vec2f& pos, int mouseButtonMask ) { onClick(control, mouseButtonMask); }
00106 
00108         virtual void onValueChanged( class Control* control, bool value ) { }
00109         virtual void onValueChanged( class Control* control, double value ) { }
00110         virtual void onValueChanged( class Control* control, float value ) { }
00111         virtual void onValueChanged( class Control* control, int value ) { }
00112         virtual void onValueChanged( class Control* control, const osg::Vec3f& value ) { }
00113         virtual void onValueChanged( class Control* control, const osg::Vec2f& value ) { }
00114         virtual void onValueChanged( class Control* control, const osg::Vec3d& value ) { }
00115         virtual void onValueChanged( class Control* control, const osg::Vec2d& value ) { }
00116         virtual void onValueChanged( class Control* control, const std::string& value ) { }
00117         virtual void onValueChanged( class Control* control, void* value ) { }
00118     };
00119 
00120     typedef std::list< osg::ref_ptr<ControlEventHandler> > ControlEventHandlerList;
00121 
00126     class OSGEARTHUTIL_EXPORT Control : public osg::Referenced
00127     {
00128     public:
00129         enum Alignment
00130         {
00131             ALIGN_NONE, ALIGN_LEFT, ALIGN_CENTER, ALIGN_RIGHT, ALIGN_TOP, ALIGN_BOTTOM
00132         };
00133 
00134         enum Dock
00135         {
00136             DOCK_NONE, DOCK_LEFT, DOCK_RIGHT, DOCK_TOP, DOCK_BOTTOM, DOCK_FILL
00137         };
00138 
00139     public:
00140         Control();
00141 
00142         void setX( float value );
00143         const osgEarth::optional<float>& x() const { return _x; }
00144         void clearX() { _x.unset(); dirty(); }
00145 
00146         void setY( float value );
00147         const osgEarth::optional<float>& y() const { return _y; }
00148         void clearY() { _y.unset(); dirty(); }
00149 
00150         void setPosition( float x, float y );
00151 
00152         void setWidth( float value );
00153         const osgEarth::optional<float>& width() const { return _width; }
00154         void clearWidth() { _width.unset(); dirty(); }
00155 
00156         void setHeight( float value );
00157         const osgEarth::optional<float>& height() const { return _height; }
00158         void clearHeight() { _height.unset(); dirty(); }
00159 
00160         void setSize( float w, float h );
00161 
00162         void setMargin( const Gutter& value );
00163         const Gutter& margin() const { return _margin; }
00164 
00165         // space between container and its content
00166         void setPadding( const Gutter& value );
00167         void setPadding( float globalValue );
00168         const Gutter& padding() const { return _padding; }
00169 
00170         void setVertAlign( const Alignment& value );
00171         const optional<Alignment>& vertAlign() const { return _valign; }
00172 
00173         void setHorizAlign( const Alignment& value );
00174         const optional<Alignment>& horizAlign() const { return _halign; }
00175 
00176         void setHorizFill( bool value, float minWidth =0.0f );
00177         bool horizFill() const { return _hfill; }
00178 
00179         void setVertFill( bool value, float minHeight =0.0f );
00180         const bool vertFill() const { return _vfill; }
00181 
00182         void setVisible( bool value );
00183         const bool visible() const { return _visible; }
00184 
00185         void setForeColor( const osg::Vec4f& value );
00186         void setForeColor( float r, float g, float b, float a ) { setForeColor( osg::Vec4f(r,g,b,a) ); }
00187         const osgEarth::optional<osg::Vec4f> foreColor() const { return _foreColor; }
00188         void clearForeColor() { _foreColor.unset(); dirty(); }
00189 
00190         void setBackColor( const osg::Vec4f& value );
00191         void setBackColor( float r, float g, float b, float a ) { setBackColor( osg::Vec4f(r,g,b,a) ); }
00192         const osgEarth::optional<osg::Vec4f>& backColor() const { return _backColor; }
00193         void clearBackColor() { _backColor.unset(); dirty(); }
00194 
00195         void setActiveColor( const osg::Vec4f& value );
00196         void setActiveColor( float r, float g, float b, float a ) { setActiveColor( osg::Vec4f(r,g,b,a) ); }
00197         const osgEarth::optional<osg::Vec4f>& activeColor() const { return _activeColor; }
00198         void clearActiveColor() { _activeColor.unset(); dirty(); }
00199 
00200         bool getParent( osg::ref_ptr<Control>& out ) const;
00201 
00202         void setActive( bool value );
00203         bool getActive() const { return _active; }
00204 
00205         void setAbsorbEvents( bool value ) { _absorbEvents = value; }
00206         bool getAbsorbEvents() const { return _absorbEvents; }
00207 
00208         void addEventHandler( ControlEventHandler* handler );
00209 
00210     public:
00211         
00212         // mark the control as dirty so that it will regenerate on the next pass.
00213         virtual void dirty();
00214         bool isDirty() const { return _dirty; }
00215 
00216         virtual void calcSize( const ControlContext& context, osg::Vec2f& out_size );
00217         virtual void calcFill( const ControlContext& context ) { }
00218         virtual void calcPos ( const ControlContext& context, const osg::Vec2f& cursor, const osg::Vec2f& parentSize );
00219         virtual void draw    ( const ControlContext& context, DrawableList& out_drawables );
00220 
00221         // actual rendering region on the control surface
00222         const osg::Vec2f& renderPos() const { return _renderPos; }
00223         const osg::Vec2f& renderSize() const { return _renderSize; }
00224 
00225         // does the control contain the point?
00226         bool intersects( float x, float y ) const;
00227 
00228         void setParent( class Control* c ) { _parent = c; }
00229 
00230     protected:
00231         bool _dirty;
00232         osg::Vec2f _renderPos; // rendering position (includes padding offset)
00233         osg::Vec2f _renderSize; // rendering size (includes padding)
00234 
00235         // adjusts renderpos for alignment.
00236         void align();
00237 
00238         friend class ControlCanvas;
00239         friend class Container;
00240 
00241         virtual bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa, ControlContext& cx );
00242 
00243         ControlEventHandlerList _eventHandlers;
00244 
00245     private:
00246         osgEarth::optional<float> _x, _y, _width, _height;
00247         bool _hfill, _vfill;
00248         Gutter _margin;
00249         Gutter _padding;
00250         bool _visible;
00251         optional<Alignment> _valign, _halign;
00252         optional<osg::Vec4f> _backColor, _foreColor, _activeColor;
00253         osg::observer_ptr<Control> _parent;
00254         bool _active;
00255         bool _absorbEvents;
00256         osg::ref_ptr<osg::Geometry> _geom;
00257     };
00258 
00259     typedef std::vector< osg::ref_ptr<Control> > ControlVector;
00260 
00264     class OSGEARTHUTIL_EXPORT LabelControl : public Control
00265     {
00266     public:
00267         LabelControl(
00268             const std::string& value ="",
00269             float fontSize =18.0f,
00270             const osg::Vec4f& foreColor =osg::Vec4f(1,1,1,1) );
00271 
00272         LabelControl(
00273             const std::string& value,
00274             const osg::Vec4f& foreColor );
00275 
00276         void setText( const std::string& value );
00277         const std::string& text() const { return _text; }
00278 
00279         void setFont( osgText::Font* font );
00280         osgText::Font* font() const { return _font.get(); }
00281 
00282         void setFontSize( float value );
00283         float fontSize() const { return _fontSize; }
00284 
00285         void setHaloColor( const osg::Vec4f& value );
00286         const optional<osg::Vec4f>& haloColor() const { return _haloColor; }
00287 
00288     public: // Control
00289         virtual void calcSize( const ControlContext& context, osg::Vec2f& out_size );
00290         //virtual void calcPos ( const ControlContext& context, const osg::Vec2f& cursor, const osg::Vec2f& parentSize );
00291         virtual void draw    ( const ControlContext& context, DrawableList& out_drawables );
00292 
00293     private:
00294         std::string _text;
00295         osg::ref_ptr<osgText::Font> _font;
00296         float _fontSize;
00297         osg::ref_ptr<osgText::Text> _drawable;
00298         osg::Vec3 _bmin, _bmax;
00299         optional<osg::Vec4f> _haloColor;
00300     };
00301 
00305     class OSGEARTHUTIL_EXPORT ImageControl : public Control
00306     {
00307     public:
00308         ImageControl( osg::Image* image =0L );
00309 
00310         void setImage( osg::Image* image );
00311         osg::Image* getImage() const { return _image.get(); }
00312 
00314         void setRotation( const Angular& angle );
00315         const Angular& getRotation() const { return _rotation; }
00316 
00319         void setFixSizeForRotation( bool value );
00320         bool getFixSizeForRotation() const { return _fixSizeForRot; }
00321 
00322     public: // Control
00323         virtual void calcSize( const ControlContext& context, osg::Vec2f& out_size );
00324         virtual void draw( const ControlContext& cx, DrawableList& out );
00325 
00326     private:
00327         osg::ref_ptr<osg::Image> _image;
00328         Angular _rotation;
00329         bool _fixSizeForRot;
00330         osg::Geometry* _geom;
00331     };
00332 
00336     class OSGEARTHUTIL_EXPORT HSliderControl : public Control
00337     {
00338     public:
00339         HSliderControl( float min = 0.0f, float max = 100.0f, float value = 50.0f );
00340 
00341         void setMin( float min, bool notify =true );
00342         float getMin() const { return _min; }
00343 
00344         void setMax( float max, bool notify =true );
00345         float getMax() const { return _max; }
00346 
00347         void setValue( float value, bool notify =true );
00348         float getValue() const { return _value; }
00349 
00350     public: // Control
00351         //virtual void calcSize( const ControlContext& context, osg::Vec2f& out_size );
00352         virtual void draw( const ControlContext& cx, DrawableList& out );
00353 
00354     protected:
00355         virtual bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa, ControlContext& cx );
00356 
00357         void fireValueChanged();
00358 
00359     private:
00360         float _min, _max, _value;
00361     };
00362 
00366     class OSGEARTHUTIL_EXPORT CheckBoxControl : public Control
00367     {
00368     public:
00369         CheckBoxControl( bool checked =false );
00370         CheckBoxControl( bool checked, ControlEventHandler* callback );
00371 
00372         void setValue( bool value );
00373         bool getValue() const { return _value; }
00374 
00375     public:
00376         virtual void draw( const ControlContext& cx, DrawableList& out );
00377 
00378     protected:
00379         virtual bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa, ControlContext& cx );
00380 
00381         void fireValueChanged();
00382 
00383     private:
00384         bool _value;
00385     };
00386 
00387     typedef std::vector< osg::ref_ptr<Control> > ControlList;
00388 
00393     class OSGEARTHUTIL_EXPORT Frame : public ImageControl
00394     {
00395     public:
00396         Frame();
00397 
00398     public: // Control
00399         virtual void calcPos ( const ControlContext& context, const osg::Vec2f& cursor, const osg::Vec2f& parentSize );
00400         virtual void draw( const ControlContext& context, DrawableList& drawables );
00401     };
00402 
00406     class OSGEARTHUTIL_EXPORT RoundedFrame : public Frame
00407     {
00408     public:
00409         RoundedFrame();
00410 
00411     public:
00412         virtual void draw( const ControlContext& cx, DrawableList& drawables );
00413     };
00414 
00420     class OSGEARTHUTIL_EXPORT Container : public Control
00421     {
00422     public:
00423         Container();
00424 
00425         // the Frame connected to this container. can be NULL for no frame.
00426         void setFrame( Frame* frame );
00427         Frame* getFrame() const { return _frame.get(); }
00428         
00429         // space between children
00430         void setChildSpacing( float value );
00431         float childSpacing() const { return _spacing; }
00432 
00433         // horiz alignment to set on children (that do not already have alignment explicity set)
00434         void setChildHorizAlign( Alignment align );
00435         const optional<Alignment>& childHorizAlign() const { return _childhalign; }
00436 
00437         // vert alignment to set on children (that do not already have alignment explicity set)
00438         void setChildVertAlign( Alignment align );
00439         const optional<Alignment>& childVertAlign() const { return _childvalign; }
00440 
00441         // default add function.
00442         virtual void addControl( Control* control, int index =-1 ) =0;
00443 
00444         // default multiple-add function.
00445         virtual void addControls( const ControlVector& controls );
00446 
00447         // access to the child list.
00448         virtual const ControlList& children() const =0;
00449 
00450         // clear the controls list.
00451         virtual void clearControls() =0;
00452 
00453     public:
00454         virtual void calcSize( const ControlContext& context, osg::Vec2f& out_size );
00455         virtual void calcFill( const ControlContext& context );
00456         virtual void calcPos ( const ControlContext& context, const osg::Vec2f& cursor, const osg::Vec2f& parentSize );
00457         virtual void draw( const ControlContext& context, DrawableList& drawables );
00458 
00459     protected:
00460         virtual bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa, ControlContext& cx );
00461 
00462         void applyChildAligns();
00463         
00464         //void setChildRenderSize( Control* child, float w, float h ) { child->_renderSize.set( w, h ); }
00465         float& renderWidth(Control* child) { return child->_renderSize.x(); }
00466         float& renderHeight(Control* child) { return child->_renderSize.y(); }
00467 
00468     private:
00469         osg::ref_ptr<Frame> _frame;
00470         float _spacing;
00471         optional<Alignment> _childhalign;
00472         optional<Alignment> _childvalign;
00473         
00474         ControlList& mutable_children() { return const_cast<ControlList&>(children()); }
00475     };
00476 
00480     class OSGEARTHUTIL_EXPORT VBox : public Container
00481     {
00482     public:
00483         VBox();
00484 
00485     public: // Container
00486         virtual void addControl( Control* control, int index =-1 );
00487         virtual const ControlList& children() const { return _controls; }
00488         virtual void clearControls();
00489 
00490     public: // Control        
00491         virtual void calcSize( const ControlContext& context, osg::Vec2f& out_size );
00492         virtual void calcFill( const ControlContext& context );
00493         virtual void calcPos ( const ControlContext& context, const osg::Vec2f& cursor, const osg::Vec2f& parentSize );
00494         virtual void draw( const ControlContext& context, DrawableList& drawables );
00495 
00496     private:
00497         ControlList _controls;
00498     };
00499 
00503     class OSGEARTHUTIL_EXPORT HBox : public Container
00504     {
00505     public:
00506         HBox();
00507 
00508     public: // Container
00509         virtual void addControl( Control* control, int index =-1 );
00510         virtual const ControlList& children() const { return _controls; }
00511         virtual void clearControls();
00512 
00513     public: // Control        
00514         virtual void calcSize( const ControlContext& context, osg::Vec2f& out_size );
00515         virtual void calcFill( const ControlContext& context );
00516         virtual void calcPos ( const ControlContext& context, const osg::Vec2f& cursor, const osg::Vec2f& parentSize );
00517         virtual void draw( const ControlContext& context, DrawableList& drawables );
00518 
00519     private:
00520         ControlList _controls;
00521     };
00522 
00526     class OSGEARTHUTIL_EXPORT Grid : public Container
00527     {
00528     public:
00529         Grid();
00530 
00531         void setControl( int col, int row, Control* control );
00532 
00533         unsigned getNumRows() const { return _rows.size(); }
00534         unsigned getNumColumns() const { return _colWidths.size(); }
00535 
00536     public: // Container
00537         virtual void addControl( Control* control, int index =-1 );
00538         virtual const ControlList& children() const { return _children; }
00539         virtual void clearControls();
00540 
00541         // adds the controls as a row at the bottom of the grid.
00542         virtual void addControls( const ControlVector& controls );
00543 
00544     public: // Control        
00545         virtual void calcSize( const ControlContext& context, osg::Vec2f& out_size );
00546         virtual void calcFill( const ControlContext& context );
00547         virtual void calcPos ( const ControlContext& context, const osg::Vec2f& cursor, const osg::Vec2f& parentSize );
00548         virtual void draw( const ControlContext& context, DrawableList& drawables );
00549 
00550     private:
00551         typedef std::vector< osg::ref_ptr<Control> > Row;
00552         typedef std::vector< Row > RowVector;
00553         RowVector _rows;
00554         ControlList _children;
00555         
00556         osg::ref_ptr<Control>& cell(int col, int row);
00557         void expandToInclude(int cols, int rows);
00558         
00559         std::vector<float> _rowHeights, _colWidths;
00560     };
00561 
00562     class OSGEARTHUTIL_EXPORT RefNodeVector :
00563         public osg::Referenced,
00564         public osg::MixinVector<osg::Node*> { };
00565 
00571     class OSGEARTHUTIL_EXPORT ControlNode : public osg::Node
00572     {
00573     public:
00575         ControlNode( Control* control, float priority =0.0f );
00576 
00578         Control* getControl() const { return _control.get(); }
00579 
00581         float getPriority() const { return _priority; }
00582 
00584         optional<osg::Vec2f>& anchorPoint() { return _anchor; }
00585         const optional<osg::Vec2f>& anchorPoint() const { return _anchor; }
00586 
00587 
00588     public: // osg::Node overrides
00589 
00590         virtual void traverse( osg::NodeVisitor& nv );
00591 
00592         virtual osg::BoundingSphere computeBound() const;
00593 
00594     protected:
00595 
00596         struct PerViewData
00597         {
00598             PerViewData();
00599             bool                              _obscured;
00600             osg::Vec3f                        _screenPos;
00601             float                             _visibleTime;
00602             unsigned                          _visitFrame;
00603             osg::ref_ptr<osg::Uniform>        _uniform;
00604             osg::observer_ptr<osg::Camera>    _canvas;
00605         };
00606         typedef std::map<osg::View*,PerViewData> PerViewDataMap;
00607 
00608         PerViewDataMap         _perViewData;
00609         osg::ref_ptr<Control>  _control;
00610         float                  _priority;
00611         optional<osg::Vec2f>   _anchor;
00612 
00613         PerViewData& getData( osg::View* view ) { return _perViewData[view]; }
00614 
00615         friend class ControlNodeBin;
00616     };
00617 
00622     class OSGEARTHUTIL_EXPORT ControlNodeBin : public osg::Group
00623     {
00624     public:
00625         ControlNodeBin();
00626 
00628         void addNode( ControlNode* node );
00629 
00631         void setFading( bool value );
00632 
00633     private:
00634         typedef std::pair<float, osg::ref_ptr<ControlNode> > ControlNodePair;
00635         typedef std::multimap<float, osg::ref_ptr<ControlNode> > ControlNodeCollection;
00636         ControlNodeCollection _controlNodes;
00637 
00638         typedef std::pair<Control*, ControlNodeCollection::iterator> ControlIndexPair;
00639         typedef std::map<Control*, ControlNodeCollection::iterator> ControlIndex;
00640         ControlIndex _index;
00641 
00642         typedef std::map<ControlNode*, osg::MatrixTransform*> RenderNodeTable;
00643         typedef std::pair<ControlNode*, osg::MatrixTransform*> RenderNodePair;
00644         RenderNodeTable _renderNodes;
00645 
00646         osg::ref_ptr<osg::Group>      _group;
00647         std::vector<osg::BoundingBox> _taken;
00648         bool                          _sortByDistance;
00649         bool                          _fading;
00650         bool                          _sortingEnabled;
00651 
00652         friend class ControlCanvas;
00653         friend class ControlNode;
00654 
00655         void draw( const ControlContext& context, bool newContext, int bin );
00656         osg::Group* getControlGroup() const { return _group.get(); }
00657     };
00658 
00662     class OSGEARTHUTIL_EXPORT ControlCanvas : public osg::Camera
00663     {
00664     public:
00666         static ControlCanvas* get( osg::View* view, bool installCanvasInSceneData =false );
00667 
00668     public:
00670         void addControl( Control* control );
00671 
00673         void removeControl( Control* control );
00674 
00676         Control* getControlAtMouse( float x, float y ) const;
00677 
00679         void setAllowControlNodeOverlap( bool value );
00680 
00681     public:
00682         // internal- no need to call directly
00683         void update( const osg::FrameStamp* frameStamp );
00684 
00685         // internal - no need to call directly
00686         void setControlContext( const ControlContext& );
00687 
00688     public:
00689         virtual void traverse( osg::NodeVisitor& nv ); // override
00690 
00691         virtual ~ControlCanvas();
00692 
00697         ControlCanvas( osgViewer::View* view );
00698 
00699     protected:
00700 
00701         ControlList     _controls;
00702         GeodeTable      _geodeTable;
00703         ControlContext  _context;
00704         bool            _contextDirty;
00705 
00706         osg::ref_ptr<ControlNodeBin> _controlNodeBin;
00707 
00708     private:
00709         friend struct ControlCanvasEventHandler;
00710         friend class ControlNode;
00711 
00712         ControlCanvas( osgViewer::View* view, bool registerCanvas );
00713         void init( osgViewer::View* view, bool registerCanvas );
00714 
00715         bool handle( const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa );
00716 
00717         // a static registry of canvases in the scene graph.
00718         typedef std::map<osg::View*, ControlCanvas*> ViewCanvasMap;
00719         static ViewCanvasMap      _viewCanvasMap;        
00720         static OpenThreads::Mutex _viewCanvasMapMutex;
00721 
00723         ControlNodeBin* getControlNodeBin() { return _controlNodeBin.get(); }
00724     };
00725 
00726 
00727 } } } // namespace osgEarth::Util::Controls
00728 
00729 #endif // OSGEARTHUTIL_CONTROLS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines