Show
Ignore:
Timestamp:
12/18/14 18:47:08 (5 hours ago)
Author:
robert
Message:

From Aitor Moreno, LAS plugin - depends upon boost and liblas and liblas-c

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgWidget/WindowManager.cpp

    r13041 r13376  
    209209 
    210210    ss 
    211         << "At XY Coords: " << x << ", " << _height - y 
     211        << "At XY Coords: " << x << ", " << y 
    212212        << " ( diff " << xdiff << ", " << ydiff << " )" 
    213213        << std::endl 
     
    297297// any intersections were found. It will break after processing the first pickable Window 
    298298// it finds. 
    299 bool WindowManager::pickAtXY(float x, float y, WidgetList& wl) { 
     299bool WindowManager::pickAtXY(float x, float y, WidgetList& wl) 
     300{ 
    300301    Intersections intr; 
    301302 
    302     if(_view->computeIntersections(x, y, intr, _nodeMask)) { 
     303     
     304    osg::Camera* camera = _view->getCamera(); 
     305    osgViewer::GraphicsWindow* gw = dynamic_cast<osgViewer::GraphicsWindow*>(camera->getGraphicsContext()); 
     306    if (gw) 
     307    { 
     308        _view->computeIntersections(camera, osgUtil::Intersector::WINDOW, x, y, intr, _nodeMask); 
     309    } 
     310         
     311    if (!intr.empty()) 
     312    { 
    303313        // Get the first Window at the XY coordinates; if you want a Window to be 
    304314        // non-pickable, set the NodeMask to something else. 
     
    348358} 
    349359 
    350 /* 
    351 bool WindowManager::pickAtXY(float x, float y, WidgetList& wl) { 
    352     Intersections intr; 
    353  
    354     if(!_view->computeIntersections(x, y, intr, _nodeMask)) return false; 
    355  
    356     typedef std::vector<osg::observer_ptr<Window> > WindowVector; 
    357  
    358     WindowVector windows; 
    359  
    360     Window* activeWin = 0; 
    361  
    362     for(Intersections::iterator i = intr.begin(); i != intr.end(); i++) { 
    363         Window* win = dynamic_cast<Window*>(i->nodePath.back()->getParent(0)); 
    364  
    365         if( 
    366             !win || 
    367             (win->getVisibilityMode() == Window::VM_PARTIAL && !win->isPointerXYWithinVisible(x, y)) 
    368         ) { 
    369             continue; 
    370         } 
    371  
    372         if(activeWin != win) { 
    373             activeWin = win; 
    374  
    375             windows.push_back(win); 
    376         } 
    377     } 
    378  
    379     if(!windows.size()) return false; 
    380  
    381     std::sort(windows.begin(), windows.end(), WindowBinNumberCompare()); 
    382  
    383     for(WindowVector::iterator i = windows.begin(); i != windows.end(); i++) { 
    384         warn() << "- " << i->get()->getName() << " " << i->get()->getOrCreateStateSet()->getBinNumber() << std::endl; 
    385     } 
    386  
    387     warn() << std::endl; 
    388  
    389     return false; 
    390 } 
    391 */ 
    392360 
    393361bool WindowManager::setFocused(Window* window) {