osgEarth 2.1.1
|
Public Member Functions | |
ViewportHandler (ControlCanvas *cs) | |
bool | handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
Public Attributes | |
ControlCanvas * | _cs |
int | _width |
int | _height |
bool | _first |
Definition at line 1711 of file Controls.cpp.
osgEarth::Util::Controls::ViewportHandler::ViewportHandler | ( | ControlCanvas * | cs | ) | [inline] |
bool osgEarth::Util::Controls::ViewportHandler::handle | ( | const osgGA::GUIEventAdapter & | ea, |
osgGA::GUIActionAdapter & | aa | ||
) | [inline] |
Definition at line 1715 of file Controls.cpp.
{ if ( ea.getEventType() == osgGA::GUIEventAdapter::RESIZE || _first ) { osg::Camera* cam = aa.asView()->getCamera(); if ( cam && cam->getViewport() ) { const osg::Viewport* vp = cam->getViewport(); if ( _first || vp->width() != _width || vp->height() != _height ) { _cs->setProjectionMatrix(osg::Matrix::ortho2D( 0, vp->width()-1, 0, vp->height()-1 ) ); ControlContext cx; cx._view = aa.asView(); cx._vp = new osg::Viewport( 0, 0, vp->width(), vp->height() ); cx._viewContextID = aa.asView()->getCamera()->getGraphicsContext()->getState()->getContextID(); _cs->setControlContext( cx ); _width = (int)vp->width(); _height = (int)vp->height(); } if ( vp->width() != 0 && vp->height() != 0 ) { _first = false; } } } return false; }
Definition at line 1744 of file Controls.cpp.
Definition at line 1746 of file Controls.cpp.
Definition at line 1745 of file Controls.cpp.
Definition at line 1745 of file Controls.cpp.