void CameraObject::ReleaseControl( View * triggeredView ) { m_trackingCamera = false; PerViewElementCont::iterator it = m_perViewElements.begin(); while( it != m_perViewElements.end() ) { View * v = (*it).first; PerViewElements & elem = (*it).second; if( triggeredView != v ) v->ReleaseControl( this ); // Move back image from overlay renderer to main renderer v->GetOverlayRenderer()->RemoveActor( elem.cameraImageActor ); v->GetRenderer()->AddActor( elem.cameraImageActor ); elem.cameraActor->VisibilityOn(); elem.cameraAxesActor->VisibilityOn(); for( int i = 0; i < elem.anotations.size(); ++i ) { v->GetOverlayRenderer()->RemoveViewProp( elem.anotations[i] ); v->GetRenderer()->AddViewProp( elem.anotations[i] ); } // Recover backup camera v->GetRenderer()->SetActiveCamera( elem.cameraBackup ); v->GetOverlayRenderer()->SetActiveCamera( elem.cameraBackup ); v->GetOverlayRenderer2()->SetActiveCamera( elem.cameraBackup ); elem.cameraBackup->UnRegister( this ); elem.cameraBackup = 0; ++it; } }
void CameraObject::SetTrackCamera( bool t ) { if( t == m_trackingCamera ) return; if( t ) { m_trackingCamera = true; PerViewElementCont::iterator it = m_perViewElements.begin(); while( it != m_perViewElements.end() ) { View * v = (*it).first; PerViewElements & elem = (*it).second; // Tell the view we are taking control v->TakeControl( this ); // Move image to overlay renderer and hide other parts of the cam elem.cameraActor->VisibilityOff(); elem.cameraAxesActor->VisibilityOff(); v->GetRenderer()->RemoveActor( elem.cameraImageActor ); v->GetOverlayRenderer()->AddActor( elem.cameraImageActor ); // Move anotations to overlay renderer for( int i = 0; i < elem.anotations.size(); ++i ) { v->GetRenderer()->RemoveViewProp( elem.anotations[i] ); v->GetOverlayRenderer()->AddViewProp( elem.anotations[i] ); } // Set this camera to control the view elem.cameraBackup = v->GetRenderer()->GetActiveCamera(); elem.cameraBackup->Register( this ); v->GetRenderer()->SetActiveCamera( m_camera ); v->GetOverlayRenderer()->SetActiveCamera( m_camera ); v->GetOverlayRenderer2()->SetActiveCamera( m_camera ); ++it; } } else { this->ReleaseControl( 0 ); } emit ParamsModified(); }