// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
#include "OperationGUI_ClippingDlg.h"
#include "DlgRef_SpinBox.h"
-#include "QAD_Application.h"
-#include "QAD_Desktop.h"
-#include "QAD_RightFrame.h"
-#include "VTKViewer_ViewFrame.h"
-#include "OCCViewer_ViewFrame.h"
-#include "QAD_MessageBox.h"
-#include "utilities.h"
+#include "SUIT_Session.h"
+#include "SUIT_ViewWindow.h"
+#include "SVTK_ViewWindow.h"
+#include "SVTK_ViewModel.h"
+
+#include "OCCViewer_ViewWindow.h"
#include "OCCViewer_ViewPort3d.h"
-#include "OCCViewer_Viewer3d.h"
+
+#include "utilities.h"
#include <V3d_View.hxx>
#include <V3d.hxx>
#include <qcombobox.h>
// VTK Includes
+#include "VTKViewer.h"
#include <vtkCamera.h>
#include <vtkRenderer.h>
// class : OperationGUI_ClippingDlg()
// purpose :
//=================================================================================
-OperationGUI_ClippingDlg::OperationGUI_ClippingDlg( QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl )
- : GEOMBase_Skeleton( parent, "OperationGUI_ClippingDlg", 0, false,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+OperationGUI_ClippingDlg::OperationGUI_ClippingDlg(GeometryGUI* theGeometryGUI, QWidget* parent)
+ : GEOMBase_Skeleton(theGeometryGUI, parent, "OperationGUI_ClippingDlg", false,
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
setCaption( tr( "Change clipping range" ) );
-
+
GroupConstructors->close();
GroupBoxName->close();
GroupArgumentsLayout->setAlignment( Qt::AlignTop );
GroupArgumentsLayout->setSpacing( 6 );
GroupArgumentsLayout->setMargin( 11 );
-
+
// Controls
TextLabelNear = new QLabel( GroupArguments, "TextLabelNear" );
TextLabelNear->setText( tr( "Near" ) );
- //mzn TextLabelNear->setFixedWidth(74);
+ TextLabelNear->setFixedWidth(74);
GroupArgumentsLayout->addWidget( TextLabelNear, 0, 0 );
SpinBox_Near = new DlgRef_SpinBox( GroupArguments, "SpinBox_Near");
TextLabelFar = new QLabel( GroupArguments, "TextLabelFar" );
TextLabelFar->setText( tr( "Far" ) );
- //mzn TextLabelFar->setFixedWidth(74);
+ TextLabelFar->setFixedWidth(74);
GroupArgumentsLayout->addWidget( TextLabelFar, 0, 2 );
-
+
SpinBox_Far = new DlgRef_SpinBox( GroupArguments, "SpinBox_Far");
GroupArgumentsLayout->addWidget( SpinBox_Far, 0, 3 );
-
+
resetButton = new QPushButton( GroupArguments, "resetButton" );
resetButton->setText( tr( "Reset" ) );
GroupArgumentsLayout->addWidget( resetButton, 0, 4 );
TypeCB->insertItem(tr("FRONT"));
TypeCB->insertItem(tr("SLICE"));
GroupArgumentsLayout->addMultiCellWidget( TypeCB, 1, 1, 0, 4 );
-
+
Layout1->addWidget( GroupArguments, 2, 0 );
-
+
/* Initialisations */
SpinBox_Near->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
SpinBox_Far->RangeStepAndValidator( -999999.999, +999999.999, 10.0, 3 );
-
- //GeometryGUI* aGeomGUI = GeometryGUI::GetGeomGUI();
-
+
/* signals and slots connections */
- connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
- connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
- connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
-
+ connect( buttonOk , SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
+ connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
+
connect( resetButton, SIGNAL (clicked() ), this, SLOT( onReset() ) ) ;
-
- // connect( aGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( onDeactivate() ) ) ;
- //connect( aGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
+
+ setHelpFileName("none.htm");
Init();
}
// no need to delete child widgets, Qt does it all for us
}
-
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
void OperationGUI_ClippingDlg::Init()
{
- QAD_ViewFrame* aFrame = QAD_Application::getDesktop()->getActiveApp()->
- getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame();
+ SUIT_ViewWindow* anActiveWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
+ if (!anActiveWindow)
+ return;
- VTKViewer_ViewFrame* aVTKFrame = dynamic_cast<VTKViewer_ViewFrame*>( aFrame );
- if ( aVTKFrame )
- {
+ 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" ) );
double position[3];
anActiveCamera->GetPosition(position);
- float bounds[6];
+ vtkFloatingPointType bounds[6];
aRenderer->ComputeVisiblePropBounds(bounds);
double center[3];
(position[1]-center[1])*(position[1]-center[1]) +
(position[2]-center[2])*(position[2]-center[2]));
- float range[2] = {distance - width/2.0, distance + width/2.0};
+ vtkFloatingPointType range[2] = {distance - width/2.0, distance + width/2.0};
SpinBox_Near->SetValue(range[0]);
SpinBox_Far->SetValue(range[1]);
return;
}
-
- OCCViewer_ViewFrame* aOCCFrame = dynamic_cast<OCCViewer_ViewFrame*>( aFrame );
- if ( aOCCFrame )
+ else if ( anActiveWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() )
{
+ OCCViewer_ViewWindow* aOCCFrame = dynamic_cast<OCCViewer_ViewWindow*>( anActiveWindow );
+
TextLabelNear->setText( tr( "Depth" ) );
TextLabelFar->setText( tr( "Thickness" ) );
//=================================================================================
bool OperationGUI_ClippingDlg::ClickOnApply()
{
- QAD_ViewFrame* aFrame = QAD_Application::getDesktop()->getActiveApp()->
- getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame();
+ SUIT_ViewWindow* anActiveWindow = SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
+ if (!anActiveWindow)
+ return false;
- VTKViewer_ViewFrame* aVTKFrame = dynamic_cast<VTKViewer_ViewFrame*>( aFrame );
- if ( aVTKFrame )
+ 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;
return false;
}
- float range[2] = { SpinBox_Near->GetValue(), SpinBox_Far->GetValue() };
+ vtkFloatingPointType range[2] = { SpinBox_Near->GetValue(), SpinBox_Far->GetValue() };
if (range[0] < 0.0) range[0] = 0.0;
anActiveCamera->SetClippingRange( range );
return true;
}
-
- OCCViewer_ViewFrame* aOCCFrame = dynamic_cast<OCCViewer_ViewFrame*>( aFrame );
- if ( aOCCFrame )
+ 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->GetValue();
ClickOnCancel();
}
-
-//=================================================================================
-// function : ClickOnCancel()
-// purpose :
-//=================================================================================
-void OperationGUI_ClippingDlg::ClickOnCancel()
-{
- GEOMBase_Skeleton::ClickOnCancel();
-}
-
-
//=================================================================================
// function : onActivate()
// purpose :
GEOMBase_Skeleton::ActivateThisDialog();
}
-
-//=================================================================================
-// function : onDeactivate()
-// purpose : public slot to deactivate if active
-//=================================================================================
-void OperationGUI_ClippingDlg::DeactivateActiveDialog()
-{
- return;
-}
-
//=================================================================================
// function : enterEvent()
// purpose :
//=================================================================================
-void OperationGUI_ClippingDlg::enterEvent(QEvent* e)
+void OperationGUI_ClippingDlg::enterEvent(QEvent*)
{
this->setEnabled(true);
return;
}
-
//=================================================================================
// function : closeEvent
// purpose :
QDialog::closeEvent( e );
}
-
//=================================================================================
// function : onReset()
// purpose :
//=================================================================================
void OperationGUI_ClippingDlg::onReset()
{
- QAD_ViewFrame* aFrame = QAD_Application::getDesktop()->getActiveApp()->
- getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame();
+ SUIT_ViewWindow* anActiveWindow =
+ SUIT_Session::session()->activeApplication()->desktop()->activeWindow();
+ if (!anActiveWindow)
+ return;
- VTKViewer_ViewFrame* aVTKFrame = dynamic_cast<VTKViewer_ViewFrame*>( aFrame );
- if ( aVTKFrame )
+ 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;
double position[3];
anActiveCamera->GetPosition(position);
- float bounds[6];
+ vtkFloatingPointType bounds[6];
aRenderer->ComputeVisiblePropBounds(bounds);
double center[3];
(position[1]-center[1])*(position[1]-center[1]) +
(position[2]-center[2])*(position[2]-center[2]));
- float range[2] = {distance - width/2.0, distance + width/2.0};
+ vtkFloatingPointType range[2] = {distance - width/2.0, distance + width/2.0};
SpinBox_Near->SetValue(range[0]);
SpinBox_Far->SetValue(range[1]);
return;
}
-
- OCCViewer_ViewFrame* aOCCFrame = dynamic_cast<OCCViewer_ViewFrame*>( aFrame );
- if ( aOCCFrame )
+ else if ( anActiveWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() )
{
+ OCCViewer_ViewWindow* aOCCFrame = dynamic_cast<OCCViewer_ViewWindow*>( anActiveWindow );
+
TextLabelNear->setText( tr( "Depth" ) );
TextLabelFar->setText( tr( "Thickness" ) );
TypeCB->setCurrentItem(ztype);
}
-
-
return;
}