mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-15 00:30:33 +05:00
Added missing directive #include <OCCViewer_ViewModel.h>
This commit is contained in:
parent
ab9aa28a64
commit
d46f50f94a
@ -1,22 +1,22 @@
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
|
||||
//
|
||||
// File : OperationGUI_ClippingDlg.cxx
|
||||
@ -34,8 +34,11 @@
|
||||
#include <SUIT_ViewManager.h>
|
||||
#include <SVTK_ViewWindow.h>
|
||||
#include <SVTK_ViewModel.h>
|
||||
|
||||
#include <OCCViewer_ViewModel.h>
|
||||
#include <OCCViewer_ViewWindow.h>
|
||||
#include <OCCViewer_ViewPort3d.h>
|
||||
|
||||
#include <VTKViewer.h>
|
||||
|
||||
// OCC Includes
|
||||
@ -48,7 +51,7 @@
|
||||
|
||||
//=================================================================================
|
||||
// class : OperationGUI_ClippingDlg()
|
||||
// purpose :
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
OperationGUI_ClippingDlg::OperationGUI_ClippingDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
|
||||
: GEOMBase_Skeleton( theGeometryGUI, parent, false )
|
||||
@ -126,68 +129,68 @@ void OperationGUI_ClippingDlg::Init()
|
||||
SUIT_ViewWindow* anActiveWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
|
||||
if ( !anActiveWindow )
|
||||
return;
|
||||
|
||||
|
||||
if ( anActiveWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) {
|
||||
SVTK_ViewWindow* aVTKFrame = dynamic_cast<SVTK_ViewWindow*>( anActiveWindow );
|
||||
if ( !aVTKFrame )
|
||||
return;
|
||||
|
||||
|
||||
TextLabelNear->setText( tr( "Near" ) );
|
||||
TextLabelFar->setText( tr( "Far" ) );
|
||||
|
||||
|
||||
TypeCB->hide();
|
||||
|
||||
|
||||
vtkRenderer* aRenderer = aVTKFrame->getRenderer();
|
||||
if ( !aRenderer ) return;
|
||||
|
||||
|
||||
vtkCamera* anActiveCamera = aRenderer->GetActiveCamera();
|
||||
if ( anActiveCamera == NULL ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Find the plane equation for the camera view plane
|
||||
double vn[3];
|
||||
anActiveCamera->GetViewPlaneNormal( vn );
|
||||
double position[3];
|
||||
anActiveCamera->GetPosition( position );
|
||||
|
||||
|
||||
vtkFloatingPointType bounds[6];
|
||||
aRenderer->ComputeVisiblePropBounds( bounds );
|
||||
|
||||
|
||||
double center[3];
|
||||
center[0] = ( bounds[0] + bounds[1] ) / 2.0;
|
||||
center[1] = ( bounds[2] + bounds[3] ) / 2.0;
|
||||
center[2] = ( bounds[4] + bounds[5] ) / 2.0;
|
||||
|
||||
|
||||
double width = sqrt( ( bounds[1]-bounds[0] ) * ( bounds[1]-bounds[0] ) +
|
||||
( bounds[3]-bounds[2] ) * ( bounds[3]-bounds[2] ) +
|
||||
( bounds[5]-bounds[4] ) * ( bounds[5]-bounds[4] ) );
|
||||
|
||||
|
||||
double distance = sqrt( ( position[0]-center[0] ) * ( position[0]-center[0] ) +
|
||||
( position[1]-center[1] ) * ( position[1]-center[1] ) +
|
||||
( position[2]-center[2] ) * ( position[2]-center[2] ) );
|
||||
|
||||
|
||||
vtkFloatingPointType range[2] = { distance - width/2.0, distance + width/2.0 };
|
||||
|
||||
|
||||
SpinBox_Near->setValue( range[0] );
|
||||
SpinBox_Far->setValue( range[1] );
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
else if ( anActiveWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) {
|
||||
OCCViewer_ViewWindow* aOCCFrame = dynamic_cast<OCCViewer_ViewWindow*>( anActiveWindow );
|
||||
|
||||
|
||||
TextLabelNear->setText( tr( "Depth" ) );
|
||||
TextLabelFar->setText( tr( "Thickness" ) );
|
||||
|
||||
|
||||
Handle(V3d_View) view3d = ( (OCCViewer_ViewPort3d*)aOCCFrame->getViewPort() )->getView();
|
||||
|
||||
double depth, thickness;
|
||||
|
||||
double depth, thickness;
|
||||
int ztype = view3d->ZClipping( depth, thickness );
|
||||
SpinBox_Near->setValue( depth );
|
||||
SpinBox_Far->setValue( thickness );
|
||||
TypeCB->setCurrentIndex( ztype );
|
||||
|
||||
|
||||
//Handle(V3d_Plane) aPlane = new V3d_Plane( aOCCFrame->getViewer()->getViewer3d() ,0, 0, 1, -100);
|
||||
//aPlane->Display(view3d);
|
||||
}
|
||||
@ -203,40 +206,40 @@ bool OperationGUI_ClippingDlg::ClickOnApply()
|
||||
SUIT_ViewWindow* anActiveWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
|
||||
if ( !anActiveWindow )
|
||||
return false;
|
||||
|
||||
|
||||
if ( anActiveWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) {
|
||||
SVTK_ViewWindow* aVTKFrame = dynamic_cast<SVTK_ViewWindow*>( anActiveWindow );
|
||||
if ( !aVTKFrame )
|
||||
return false;
|
||||
|
||||
|
||||
vtkRenderer* aRenderer = aVTKFrame->getRenderer();
|
||||
if ( !aRenderer ) return false;
|
||||
|
||||
|
||||
vtkCamera* anActiveCamera = aRenderer->GetActiveCamera();
|
||||
if ( anActiveCamera == NULL ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
vtkFloatingPointType range[2] = { SpinBox_Near->value(), SpinBox_Far->value() };
|
||||
if ( range[0] < 0.0 ) range[0] = 0.0;
|
||||
anActiveCamera->SetClippingRange( range );
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
else if ( anActiveWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) {
|
||||
OCCViewer_ViewWindow* aOCCFrame = dynamic_cast<OCCViewer_ViewWindow*>( anActiveWindow );
|
||||
|
||||
|
||||
Handle(V3d_View) view3d = ( (OCCViewer_ViewPort3d*)aOCCFrame->getViewPort() )->getView();
|
||||
|
||||
|
||||
double depth = SpinBox_Near->value();
|
||||
double thickness = SpinBox_Far->value();
|
||||
int aType = TypeCB->currentIndex();
|
||||
|
||||
|
||||
view3d->SetZClippingType( V3d_TypeOfZclipping( aType ) );
|
||||
view3d->SetZClippingDepth( depth );
|
||||
view3d->SetZClippingWidth( thickness );
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -278,60 +281,60 @@ void OperationGUI_ClippingDlg::onReset()
|
||||
SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
|
||||
if ( !anActiveWindow )
|
||||
return;
|
||||
|
||||
|
||||
if ( anActiveWindow->getViewManager()->getType() == SVTK_Viewer::Type() ) {
|
||||
SVTK_ViewWindow* aVTKFrame = dynamic_cast<SVTK_ViewWindow*>( anActiveWindow );
|
||||
if ( !aVTKFrame )
|
||||
return;
|
||||
|
||||
|
||||
vtkRenderer* aRenderer = aVTKFrame->getRenderer();
|
||||
if ( !aRenderer ) return;
|
||||
|
||||
|
||||
vtkCamera* anActiveCamera = aRenderer->GetActiveCamera();
|
||||
if ( anActiveCamera == NULL ) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Find the plane equation for the camera view plane
|
||||
double vn[3];
|
||||
anActiveCamera->GetViewPlaneNormal( vn );
|
||||
double position[3];
|
||||
anActiveCamera->GetPosition( position );
|
||||
|
||||
|
||||
vtkFloatingPointType bounds[6];
|
||||
aRenderer->ComputeVisiblePropBounds( bounds );
|
||||
|
||||
|
||||
double center[3];
|
||||
center[0] = ( bounds[0] + bounds[1] ) / 2.0;
|
||||
center[1] = ( bounds[2] + bounds[3] ) / 2.0;
|
||||
center[2] = ( bounds[4] + bounds[5] ) / 2.0;
|
||||
|
||||
|
||||
double width = sqrt( ( bounds[1]-bounds[0] ) * ( bounds[1]-bounds[0] ) +
|
||||
( bounds[3]-bounds[2] ) * ( bounds[3]-bounds[2] ) +
|
||||
( bounds[5]-bounds[4] ) * ( bounds[5]-bounds[4] ) );
|
||||
|
||||
|
||||
double distance = sqrt( ( position[0]-center[0] ) * ( position[0]-center[0] ) +
|
||||
( position[1]-center[1] ) * ( position[1]-center[1] ) +
|
||||
( position[2]-center[2] ) * ( position[2]-center[2] ) );
|
||||
|
||||
|
||||
vtkFloatingPointType range[2] = { distance - width/2.0, distance + width/2.0 };
|
||||
|
||||
|
||||
SpinBox_Near->setValue( range[0] );
|
||||
SpinBox_Far->setValue( range[1] );
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
else if ( anActiveWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) {
|
||||
OCCViewer_ViewWindow* aOCCFrame = dynamic_cast<OCCViewer_ViewWindow*>( anActiveWindow );
|
||||
|
||||
|
||||
TextLabelNear->setText( tr( "Depth" ) );
|
||||
TextLabelFar->setText( tr( "Thickness" ) );
|
||||
|
||||
|
||||
Handle(V3d_View) view3d = ( (OCCViewer_ViewPort3d*)aOCCFrame->getViewPort() )->getView();
|
||||
|
||||
|
||||
view3d->SetZClippingType( V3d_TypeOfZclipping( 0 ) );
|
||||
view3d->ZFitAll();
|
||||
double depth, thickness;
|
||||
double depth, thickness;
|
||||
int ztype= view3d->ZClipping( depth, thickness );
|
||||
SpinBox_Near->setValue( 0 );
|
||||
SpinBox_Far->setValue( 1000 );
|
||||
|
Loading…
Reference in New Issue
Block a user