Commit be7648fc authored by Frédéric Larue's avatar Frédéric Larue

Function to recover the scene bounding box added to GLViewer.

parent 4a558998
...@@ -545,26 +545,28 @@ void GLViewer::frameItems( QList<GenericUIData*> &items ) ...@@ -545,26 +545,28 @@ void GLViewer::frameItems( QList<GenericUIData*> &items )
void GLViewer::frameAll() void GLViewer::frameAll()
{ {
if( !m_Displayables.empty() ) if( !m_Displayables.empty() )
{ frameBox( sceneBox() );
Box3f box; }
for( DisplayableMap::iterator dispInfo=m_Displayables.begin(); dispInfo!=m_Displayables.end(); ++dispInfo )
{
Box3f objectBox;
dispInfo->second.displayable->boundingBox( objectBox );
if( !objectBox.IsNull() ) Box3f GLViewer::sceneBox() const
{ {
Box3f::CornerSet objectBoxCorners; Box3f box;
objectBox.Corners( objectBoxCorners );
for( auto c=objectBoxCorners.begin(); c!=objectBoxCorners.end(); ++c ) for( auto &dispInfo : m_Displayables )
box.Add( dispInfo->second.GetTransform().map(*c) ); {
} const Box3f &objectBox = dispInfo.second.boundingBox;
} if( !objectBox.IsNull() )
{
Box3f::CornerSet objectBoxCorners;
objectBox.Corners( objectBoxCorners );
frameBox( box ); for( auto &c : objectBoxCorners )
box.Add( dispInfo.second.GetTransform().map(c) );
}
} }
return box;
} }
......
...@@ -362,6 +362,7 @@ public: ...@@ -362,6 +362,7 @@ public:
virtual void frameItem( GenericUIData* item ); virtual void frameItem( GenericUIData* item );
virtual void frameItems( QList<GenericUIData*> &items ); virtual void frameItems( QList<GenericUIData*> &items );
virtual void frameAll(); virtual void frameAll();
Box3f sceneBox() const;
inline bool isSelectionEnabled() const { return m_SelectionEnabled; } inline bool isSelectionEnabled() const { return m_SelectionEnabled; }
inline const SelectionTool& currentSelectionTool() const { return *m_SelectionCurrentTool; } inline const SelectionTool& currentSelectionTool() const { return *m_SelectionCurrentTool; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment