mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-14 02:30:35 +05:00
RNV: remove unused functionality.
This commit is contained in:
parent
0e8a37cc0c
commit
39c4bbe53d
@ -2604,10 +2604,6 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>MEN_CIRCLE</source>
|
||||
<translation>Circle</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_CLIPPING</source>
|
||||
<translation>Clipping Range</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_CLOSE_CONTOUR</source>
|
||||
<translation>Close Contour</translation>
|
||||
@ -3648,10 +3644,6 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>STB_CIRCLE</source>
|
||||
<translation>Create a circle</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_CLIPPING</source>
|
||||
<translation>Clipping range</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_CLOSE_CONTOUR</source>
|
||||
<translation>Perform close contour</translation>
|
||||
@ -4284,10 +4276,6 @@ Please, select face, shell or solid and try again</translation>
|
||||
<source>TOP_CIRCLE</source>
|
||||
<translation>Create a circle</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_CLIPPING</source>
|
||||
<translation>Clipping range</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_CLOSE_CONTOUR</source>
|
||||
<translation>Perform close contour</translation>
|
||||
|
@ -2596,10 +2596,6 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
|
||||
<source>MEN_CIRCLE</source>
|
||||
<translation>Cercle</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_CLIPPING</source>
|
||||
<translation>Plage de découpe</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_CLOSE_CONTOUR</source>
|
||||
<translation>Fermer le contour</translation>
|
||||
@ -3640,10 +3636,6 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
|
||||
<source>STB_CIRCLE</source>
|
||||
<translation>Créer un cercle</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_CLIPPING</source>
|
||||
<translation>Intervalle de découpe</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_CLOSE_CONTOUR</source>
|
||||
<translation>Fermer le contour</translation>
|
||||
@ -4276,10 +4268,6 @@ Choisissez une face, une coque ou un solide et essayez de nouveau</translation>
|
||||
<source>TOP_CIRCLE</source>
|
||||
<translation>Créer un cercle</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_CLIPPING</source>
|
||||
<translation>Intervalle de découpe</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_CLOSE_CONTOUR</source>
|
||||
<translation>Fermer le contour</translation>
|
||||
|
@ -2599,10 +2599,6 @@
|
||||
<source>MEN_CIRCLE</source>
|
||||
<translation>円</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_CLIPPING</source>
|
||||
<translation>クリップの範囲</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>MEN_CLOSE_CONTOUR</source>
|
||||
<translation>輪郭を閉じる</translation>
|
||||
@ -3643,10 +3639,6 @@
|
||||
<source>STB_CIRCLE</source>
|
||||
<translation>円を作成</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_CLIPPING</source>
|
||||
<translation>切り抜き範囲</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>STB_CLOSE_CONTOUR</source>
|
||||
<translation>スケッチを終了</translation>
|
||||
@ -4279,10 +4271,6 @@
|
||||
<source>TOP_CIRCLE</source>
|
||||
<translation>円を作成</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_CLIPPING</source>
|
||||
<translation>切り抜き範囲</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>TOP_CLOSE_CONTOUR</source>
|
||||
<translation>スケッチを終了</translation>
|
||||
|
@ -615,7 +615,6 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
|
||||
case GEOMOp::OpArchimede: // MENU OPERATION - ARCHIMEDE
|
||||
case GEOMOp::OpFillet3d: // MENU OPERATION - FILLET
|
||||
case GEOMOp::OpChamfer: // MENU OPERATION - CHAMFER
|
||||
case GEOMOp::OpClipping: // MENU OPERATION - CLIPPING RANGE
|
||||
case GEOMOp::OpShapesOnShape: // MENU OPERATION - GET SHAPES ON SHAPE
|
||||
case GEOMOp::OpFillet2d: // MENU OPERATION - FILLET 2D
|
||||
case GEOMOp::OpFillet1d: // MENU OPERATION - FILLET 1D
|
||||
@ -1002,7 +1001,6 @@ void GeometryGUI::initialize( CAM_Application* app )
|
||||
createGeomAction( GEOMOp::OpArchimede, "ARCHIMEDE" );
|
||||
createGeomAction( GEOMOp::OpFillet3d, "FILLET" );
|
||||
createGeomAction( GEOMOp::OpChamfer, "CHAMFER" );
|
||||
//createGeomAction( GEOMOp::OpClipping, "CLIPPING" );
|
||||
createGeomAction( GEOMOp::OpShapesOnShape, "GET_SHAPES_ON_SHAPE" );
|
||||
createGeomAction( GEOMOp::OpSharedShapes, "GET_SHARED_SHAPES" );
|
||||
createGeomAction( GEOMOp::OpTransferData, "TRANSFER_DATA" );
|
||||
@ -1274,7 +1272,6 @@ void GeometryGUI::initialize( CAM_Application* app )
|
||||
createMenu( GEOMOp::OpChamfer, operId, -1 );
|
||||
createMenu( GEOMOp::OpExtrudedBoss, operId, -1 );
|
||||
createMenu( GEOMOp::OpExtrudedCut, operId, -1 );
|
||||
//createMenu( GEOMOp::OpClipping, operId, -1 );
|
||||
|
||||
int repairId = createMenu( tr( "MEN_REPAIR" ), -1, -1, 10 );
|
||||
createMenu( GEOMOp::OpShapeProcess, repairId, -1 );
|
||||
|
@ -161,7 +161,6 @@ namespace GEOMOp {
|
||||
OpShapesOnShape = 3704, // MENU OPERATION - GET SHAPES ON SHAPE
|
||||
OpFillet2d = 3705, // MENU OPERATION - FILLET 2D
|
||||
OpFillet1d = 3706, // MENU OPERATION - FILLET 1D
|
||||
OpClipping = 3707, // MENU OPERATION - CLIPPING RANGE
|
||||
OpSharedShapes = 3708, // MENU OPERATION - GET SHARED SHAPES
|
||||
OpExtrudedBoss = 3709, // MENU OPERATION - ETRUDED BOSS
|
||||
OpExtrudedCut = 3710, // MENU OPERATION - ETRUDED CUT
|
||||
|
@ -74,7 +74,6 @@ SET(OperationGUI_HEADERS
|
||||
OperationGUI_GetSharedShapesDlg.h
|
||||
OperationGUI_ExtractionDlg.h
|
||||
OperationGUI_ExtrudedFeatureDlg.h
|
||||
OperationGUI_ClippingDlg.h
|
||||
OperationGUI_TransferDataDlg.h
|
||||
)
|
||||
|
||||
@ -89,7 +88,6 @@ SET(_moc_HEADERS
|
||||
OperationGUI_GetSharedShapesDlg.h
|
||||
OperationGUI_ExtractionDlg.h
|
||||
OperationGUI_ExtrudedFeatureDlg.h
|
||||
OperationGUI_ClippingDlg.h
|
||||
OperationGUI_TransferDataDlg.h
|
||||
)
|
||||
|
||||
@ -112,7 +110,6 @@ SET(OperationGUI_SOURCES
|
||||
OperationGUI_ChamferDlg.cxx
|
||||
OperationGUI_ExtractionDlg.cxx
|
||||
OperationGUI_ExtrudedFeatureDlg.cxx
|
||||
OperationGUI_ClippingDlg.cxx
|
||||
OperationGUI_TransferDataDlg.cxx
|
||||
${_moc_SOURCES}
|
||||
${_uic_files}
|
||||
|
@ -35,7 +35,6 @@
|
||||
#include "OperationGUI_FilletDlg.h" // Method FILLET
|
||||
#include "OperationGUI_Fillet1d2dDlg.h" // Method FILLET 2D and FILLET 1D
|
||||
#include "OperationGUI_ChamferDlg.h" // Method CHAMFER
|
||||
#include "OperationGUI_ClippingDlg.h" // Clipping dialog box
|
||||
#include "OperationGUI_GetShapesOnShapeDlg.h"
|
||||
#include "OperationGUI_GetSharedShapesDlg.h"
|
||||
#include "OperationGUI_ExtrudedFeatureDlg.h" // Methods EXTRUDED BOSS / CUT
|
||||
@ -76,7 +75,6 @@ bool OperationGUI::OnGUIEvent (int theCommandID, SUIT_Desktop* parent)
|
||||
case GEOMOp::OpArchimede: (new OperationGUI_ArchimedeDlg (getGeometryGUI(), parent))->show(); break;
|
||||
case GEOMOp::OpFillet3d: (new OperationGUI_FilletDlg (getGeometryGUI(), parent))->show(); break;
|
||||
case GEOMOp::OpChamfer: (new OperationGUI_ChamferDlg (getGeometryGUI(), parent))->show(); break;
|
||||
case GEOMOp::OpClipping: (new OperationGUI_ClippingDlg (getGeometryGUI(), parent))->show(); break;
|
||||
case GEOMOp::OpShapesOnShape: (new OperationGUI_GetShapesOnShapeDlg(getGeometryGUI(), parent))->show(); break;
|
||||
case GEOMOp::OpSharedShapes: (new OperationGUI_GetSharedShapesDlg (getGeometryGUI(), parent))->show(); break;
|
||||
case GEOMOp::OpExtrudedBoss: (new OperationGUI_ExtrudedFeatureDlg (BOSS, getGeometryGUI(), parent))->show(); break;
|
||||
|
@ -1,344 +0,0 @@
|
||||
// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 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, or (at your option) any later version.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
// File : OperationGUI_ClippingDlg.cxx
|
||||
// Author : Michael Zorin, Open CASCADE S.A.S. (mikhail.zorin@opencascade.com)
|
||||
//
|
||||
#include "OperationGUI_ClippingDlg.h"
|
||||
|
||||
#include <DlgRef.h>
|
||||
#include <GeometryGUI.h>
|
||||
#include <GEOMBase.h>
|
||||
#include <SalomeApp_DoubleSpinBox.h>
|
||||
|
||||
#include <SUIT_Session.h>
|
||||
#include <SUIT_Desktop.h>
|
||||
#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
|
||||
#include <V3d_View.hxx>
|
||||
#include <V3d.hxx>
|
||||
|
||||
// VTK Includes
|
||||
#include <vtkCamera.h>
|
||||
#include <vtkRenderer.h>
|
||||
|
||||
//=================================================================================
|
||||
// class : OperationGUI_ClippingDlg()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
OperationGUI_ClippingDlg::OperationGUI_ClippingDlg( GeometryGUI* theGeometryGUI, QWidget* parent )
|
||||
: GEOMBase_Skeleton( theGeometryGUI, parent, false )
|
||||
{
|
||||
setWindowTitle( tr( "Change clipping range" ) );
|
||||
|
||||
mainFrame()->GroupConstructors->setAttribute( Qt::WA_DeleteOnClose );
|
||||
mainFrame()->GroupConstructors->close();
|
||||
mainFrame()->GroupBoxName->setAttribute( Qt::WA_DeleteOnClose );
|
||||
mainFrame()->GroupBoxName->close();
|
||||
|
||||
/***************************************************************/
|
||||
GroupArguments = new QGroupBox( centralWidget() );
|
||||
QGridLayout* GroupArgumentsLayout = new QGridLayout( GroupArguments );
|
||||
GroupArgumentsLayout->setSpacing( 6 );
|
||||
GroupArgumentsLayout->setMargin( 9 );
|
||||
|
||||
// Controls
|
||||
TextLabelNear = new QLabel( tr( "Near" ), GroupArguments );
|
||||
GroupArgumentsLayout->addWidget( TextLabelNear, 0, 0 );
|
||||
|
||||
SpinBox_Near = new SalomeApp_DoubleSpinBox( GroupArguments );
|
||||
initSpinBox( SpinBox_Near, COORD_MIN, COORD_MAX, 10.0, "length_precision" );
|
||||
GroupArgumentsLayout->addWidget( SpinBox_Near, 0, 1 );
|
||||
|
||||
TextLabelFar = new QLabel( tr( "Far" ), GroupArguments );
|
||||
GroupArgumentsLayout->addWidget( TextLabelFar, 0, 2 );
|
||||
|
||||
SpinBox_Far = new SalomeApp_DoubleSpinBox( GroupArguments );
|
||||
initSpinBox( SpinBox_Far, COORD_MIN, COORD_MAX, 10.0, "length_precision" );
|
||||
GroupArgumentsLayout->addWidget( SpinBox_Far, 0, 3 );
|
||||
|
||||
resetButton = new QPushButton( tr( "Reset" ), GroupArguments );
|
||||
GroupArgumentsLayout->addWidget( resetButton, 0, 4 );
|
||||
|
||||
TypeCB = new QComboBox( GroupArguments );
|
||||
TypeCB->addItem( tr( "OFF" ) );
|
||||
TypeCB->addItem( tr( "BACK" ) );
|
||||
TypeCB->addItem( tr( "FRONT" ) );
|
||||
TypeCB->addItem( tr( "SLICE" ) );
|
||||
GroupArgumentsLayout->addWidget( TypeCB, 1, 0, 1, 5 );
|
||||
|
||||
QVBoxLayout* layout = new QVBoxLayout( centralWidget() );
|
||||
layout->setMargin( 0 ); layout->setSpacing( 6 );
|
||||
layout->addWidget( GroupArguments );
|
||||
|
||||
/* signals and slots connections */
|
||||
connect( buttonOk(), SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
|
||||
connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
|
||||
|
||||
connect( resetButton, SIGNAL( clicked() ), this, SLOT( onReset() ) ) ;
|
||||
|
||||
setHelpFileName( "none.htm" );
|
||||
|
||||
Init();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ~ OperationGUI_ClippingDlg()
|
||||
// purpose : Destroys the object and frees any allocated resources
|
||||
//=================================================================================
|
||||
OperationGUI_ClippingDlg::~ OperationGUI_ClippingDlg()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
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 );
|
||||
|
||||
double 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] ) );
|
||||
|
||||
double 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;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
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;
|
||||
}
|
||||
|
||||
double 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;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void OperationGUI_ClippingDlg::ClickOnOk()
|
||||
{
|
||||
setIsApplyAndClose( true );
|
||||
if ( ClickOnApply() )
|
||||
ClickOnCancel();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : onActivate()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void OperationGUI_ClippingDlg::onActivate()
|
||||
{
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : enterEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void OperationGUI_ClippingDlg::enterEvent( QEvent* )
|
||||
{
|
||||
this->setEnabled( true );
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : onReset()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void OperationGUI_ClippingDlg::onReset()
|
||||
{
|
||||
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;
|
||||
|
||||
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 );
|
||||
|
||||
double 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] ) );
|
||||
|
||||
double 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;
|
||||
int ztype= view3d->ZClipping( depth, thickness );
|
||||
SpinBox_Near->setValue( 0 );
|
||||
SpinBox_Far->setValue( 1000 );
|
||||
TypeCB->setCurrentIndex( ztype );
|
||||
}
|
||||
}
|
@ -1,75 +0,0 @@
|
||||
// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
|
||||
//
|
||||
// Copyright (C) 2003-2007 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, or (at your option) any later version.
|
||||
//
|
||||
// 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
|
||||
//
|
||||
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
// File : OperationGUI_ClippingDlg.h
|
||||
// Author : Michael Zorin, Open CASCADE S.A.S. (mikhail.zorin@opencascade.com)
|
||||
//
|
||||
#ifndef OPERATIONGUI_CLIPPINGDLG_H
|
||||
#define OPERATIONGUI_CLIPPINGDLG_H
|
||||
|
||||
#include <GEOMBase_Skeleton.h>
|
||||
|
||||
class QGroupBox;
|
||||
class QLabel;
|
||||
class QPushButton;
|
||||
class QComboBox;
|
||||
class SalomeApp_DoubleSpinBox;
|
||||
|
||||
enum ViewerTypes { VTK, OCC, OTHER };
|
||||
|
||||
//=================================================================================
|
||||
// class : OperationGUI_ClippingDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class OperationGUI_ClippingDlg : public GEOMBase_Skeleton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
OperationGUI_ClippingDlg( GeometryGUI*, QWidget* = 0 );
|
||||
~OperationGUI_ClippingDlg();
|
||||
|
||||
private:
|
||||
void Init();
|
||||
|
||||
void enterEvent( QEvent* );
|
||||
|
||||
private:
|
||||
ViewerTypes myViewerType;
|
||||
|
||||
QGroupBox* GroupArguments;
|
||||
QLabel* TextLabelNear;
|
||||
SalomeApp_DoubleSpinBox* SpinBox_Near;
|
||||
QLabel* TextLabelFar;
|
||||
SalomeApp_DoubleSpinBox* SpinBox_Far;
|
||||
QPushButton* resetButton;
|
||||
QComboBox* TypeCB;
|
||||
|
||||
private slots:
|
||||
void ClickOnOk();
|
||||
bool ClickOnApply();
|
||||
void onActivate();
|
||||
void onReset();
|
||||
};
|
||||
|
||||
#endif // OPERATIONGUI_CLIPPINGDLG_H
|
Loading…
Reference in New Issue
Block a user