#include "SMESH_ControlsDef.hxx"
#include <VTKViewer_ExtractUnstructuredGrid.h>
-//#include "QAD_Config.h"
+#include "SUIT_Session.h"
+#include "SUIT_ResourceMgr.h"
+
#include <qstringlist.h>
#include <vtkTimeStamp.h>
vtkTextProperty* aScalarBarTitleProp = vtkTextProperty::New();
-/* if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarTitleColor" ) ) {
- QStringList aTColor = QStringList::split( ":", QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleColor" ), false );
- aScalarBarTitleProp->SetColor( ( aTColor.count() > 0 ? aTColor[0].toInt()/255. : 1.0 ),
- ( aTColor.count() > 1 ? aTColor[1].toInt()/255. : 1.0 ),
- ( aTColor.count() > 2 ? aTColor[2].toInt()/255. : 1.0 ) );
- }
- else*/
- aScalarBarTitleProp->SetColor( 1.0, 1.0, 1.0 );
+ SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
+ if( !mgr )
+ return;
+
+ QColor aTColor = mgr->colorValue( "ScalarBarTitleColor", "SMESH", QColor( 255, 255, 255 ) );
+ aScalarBarTitleProp->SetColor( aTColor.red()/255., aTColor.green()/255., aTColor.blue()/255. );
aScalarBarTitleProp->SetFontFamilyToArial();
- /*if( QAD_CONFIG->hasSetting( "SMESH:ScalarBarTitleFont" ) ){
- if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleFont" ) == "Arial" )
+
+ if( mgr->hasValue( "ScalarBarTitleFont", "SMESH" ) ){
+ QString str = mgr->stringValue( "ScalarBarTitleFont", "SMESH" );
+ if ( str == "Arial" )
aScalarBarTitleProp->SetFontFamilyToArial();
- else if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleFont" ) == "Courier" )
+ else if ( str == "Courier" )
aScalarBarTitleProp->SetFontFamilyToCourier();
- else if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleFont" ) == "Times" )
+ else if ( str == "Times" )
aScalarBarTitleProp->SetFontFamilyToTimes();
- }*/
+ }
- /*if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleBold" ) == "true" )
+ if ( mgr->stringValue( "ScalarBarTitleBold", "SMESH" ) == "true" )
aScalarBarTitleProp->BoldOn();
- else*/
+ else
aScalarBarTitleProp->BoldOff();
- /*if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleItalic" ) == "true" )
+ if ( mgr->stringValue( "ScalarBarTitleItalic", "SMESH" ) == "true" )
aScalarBarTitleProp->ItalicOn();
- else*/
+ else
aScalarBarTitleProp->ItalicOff();
- /*if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarTitleShadow" ) == "true" )
+ if ( mgr->stringValue( "ScalarBarTitleShadow", "SMESH" ) == "true" )
aScalarBarTitleProp->ShadowOn();
- else*/
+ else
aScalarBarTitleProp->ShadowOff();
myScalarBarActor->SetTitleTextProperty( aScalarBarTitleProp );
vtkTextProperty* aScalarBarLabelProp = vtkTextProperty::New();
- /*if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarLabelColor" ) ) {
- QStringList aTColor = QStringList::split( ":", QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelColor" ), false );
- aScalarBarLabelProp->SetColor( ( aTColor.count() > 0 ? aTColor[0].toInt()/255. : 1.0 ),
- ( aTColor.count() > 1 ? aTColor[1].toInt()/255. : 1.0 ),
- ( aTColor.count() > 2 ? aTColor[2].toInt()/255. : 1.0 ) );
- }
- else*/
- aScalarBarLabelProp->SetColor( 1.0, 1.0, 1.0 );
+ aTColor = mgr->colorValue( "ScalarBarLabelColor", "SMESH", QColor( 255, 255, 255 ) );
+ aScalarBarLabelProp->SetColor( aTColor.red()/255., aTColor.green()/255., aTColor.blue()/255. );
aScalarBarLabelProp->SetFontFamilyToArial();
- /*if( QAD_CONFIG->hasSetting( "SMESH:ScalarBarLabelFont" ) ){
- if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelFont" ) == "Arial" )
+ if( mgr->hasValue( "ScalarBarLabelFont", "SMESH" ) )
+ {
+ QString str = mgr->stringValue( "ScalarBarLabelFont", "SMESH" );
+ if( str == "Arial" )
aScalarBarLabelProp->SetFontFamilyToArial();
- else if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelFont" ) == "Courier" )
+ else if( str == "Courier" )
aScalarBarLabelProp->SetFontFamilyToCourier();
- else if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelFont" ) == "Times" )
+ else if( str == "Times" )
aScalarBarLabelProp->SetFontFamilyToTimes();
- }*/
+ }
- /*if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelBold" ) == "true" )
+ if( mgr->stringValue( "ScalarBarLabelBold", "SMESH" ) == "true" )
aScalarBarLabelProp->BoldOn();
- else*/
+ else
aScalarBarLabelProp->BoldOff();
- /*if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelItalic" ) == "true" )
+ if ( mgr->stringValue( "ScalarBarLabelItalic", "SMESH" ) == "true" )
aScalarBarLabelProp->ItalicOn();
- else*/
+ else
aScalarBarLabelProp->ItalicOff();
- /*if ( QAD_CONFIG->getSetting( "SMESH:ScalarBarLabelShadow" ) == "true" )
+ if( mgr->stringValue( "ScalarBarLabelShadow", "SMESH" ) == "true" )
aScalarBarLabelProp->ShadowOn();
- else*/
+ else
aScalarBarLabelProp->ShadowOff();
myScalarBarActor->SetLabelTextProperty( aScalarBarLabelProp );
aScalarBarLabelProp->Delete();
- /*if ( QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" )
+ if( mgr->stringValue( "ScalarBarOrientation", "SMESH" ) == "Horizontal" )
myScalarBarActor->SetOrientationToHorizontal();
- else*/
+ else
myScalarBarActor->SetOrientationToVertical();
- float aXVal = 0.01; //QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" ? 0.20 : 0.01;
- //if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarXPosition" ) )
- // aXVal = QAD_CONFIG->getSetting( "SMESH:ScalarBarXPosition" ).toFloat();
- float aYVal = 0.1; //QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" ? 0.01 : 0.1;
- //if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarYPosition" ) )
- // aYVal = QAD_CONFIG->getSetting( "SMESH:ScalarBarYPosition" ).toFloat();
+ float aXVal = mgr->stringValue( "ScalarBarOrientation", "SMESH" ) == "Horizontal" ? 0.20 : 0.01;
+ if( mgr->hasValue( "ScalarBarXPosition", "SMESH" ) )
+ aXVal = mgr->doubleValue( "ScalarBarXPosition", "SMESH", aXVal );
+ float aYVal = mgr->stringValue( "ScalarBarOrientation", "SMESH" ) == "Horizontal" ? 0.01 : 0.1;
+ if( mgr->hasValue( "ScalarBarYPosition", "SMESH" ) )
+ aYVal = mgr->doubleValue( "ScalarBarYPosition", "SMESH", aYVal );
myScalarBarActor->SetPosition( aXVal, aYVal );
- float aWVal = 0.1; //QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" ? 0.60 : 0.10;
- //if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarWidth" ) )
- // aWVal = QAD_CONFIG->getSetting( "SMESH:ScalarBarWidth" ).toFloat();
+ float aWVal = mgr->stringValue( "ScalarBarOrientation", "SMESH" ) == "Horizontal" ? 0.60 : 0.10;
+ if( mgr->hasValue( "ScalarBarWidth", "SMESH" ) )
+ aWVal = mgr->doubleValue( "ScalarBarWidth", "SMESH", aWVal );
myScalarBarActor->SetWidth( aWVal );
- float aHVal = 0.8; //QAD_CONFIG->getSetting("SMESH:ScalarBarOrientation") == "Horizontal" ? 0.12 : 0.80;
- //if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarHeight" ) )
- // aHVal = QAD_CONFIG->getSetting( "SMESH:ScalarBarHeight" ).toFloat();
+ float aHVal = mgr->stringValue( "ScalarBarOrientation", "SMESH" ) == "Horizontal" ? 0.12 : 0.80;
+ if( mgr->hasValue( "ScalarBarHeight", "SMESH" ) )
+ aHVal = mgr->doubleValue( "ScalarBarHeight", "SMESH", aHVal );
myScalarBarActor->SetHeight( aHVal );
int anIntVal = 5;
- //if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarNbOfLabels" ) )
- // anIntVal = QAD_CONFIG->getSetting("SMESH:ScalarBarNbOfLabels").toInt();
- myScalarBarActor->SetNumberOfLabels(anIntVal == 0? 5: anIntVal);
+ if( mgr->hasValue( "ScalarBarNbOfLabels", "SMESH" ) )
+ anIntVal = mgr->integerValue( "ScalarBarNbOfLabels", "SMESH", anIntVal );
+ myScalarBarActor->SetNumberOfLabels( anIntVal == 0 ? 5: anIntVal );
anIntVal = 64;
- //if ( QAD_CONFIG->hasSetting( "SMESH:ScalarBarNbOfColors" ) )
- // anIntVal = QAD_CONFIG->getSetting("SMESH:ScalarBarNbOfColors").toInt();
- myScalarBarActor->SetMaximumNumberOfColors(anIntVal == 0? 64: anIntVal);
+ if( mgr->hasValue( "ScalarBarNbOfColors", "SMESH" ) )
+ anIntVal = mgr->integerValue( "ScalarBarNbOfColors", "SMESH", anIntVal );
+ myScalarBarActor->SetMaximumNumberOfColors( anIntVal == 0 ? 64 : anIntVal );
//Definition of points numbering pipeline
SetControlMode(eControl theMode,
bool theCheckEntityMode)
{
+ SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
+ if( !mgr )
+ return;
+
myControlMode = eNone;
- //theCheckEntityMode &= QAD_CONFIG->getSetting("SMESH:DispayEntity") == "true";
+ theCheckEntityMode &= mgr->stringValue( "DispayEntity", "SMESH" ) == "true";
my1DActor->GetMapper()->SetScalarVisibility(false);
my2DActor->GetMapper()->SetScalarVisibility(false);
//SetIsShrunkable(theGrid->GetNumberOfCells() > 10);
SetIsShrunkable(true);
-
- //QString aMode = QAD_CONFIG->getSetting("SMESH:DisplayMode");
+
+ SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
+ if( !mgr )
+ return false;
+
+ QString aMode = mgr->stringValue( "DisplayMode", "SMESH" );
SetRepresentation(-1);
- /*
+
if(aMode.compare("Wireframe") == 0){
SetRepresentation(eEdge);
}else if(aMode.compare("Shading") == 0){
}else if(aMode.compare("Nodes") == 0){
SetRepresentation(ePoint);
}
- */
- /*aMode = QAD_CONFIG->getSetting("SMESH:Shrink");
+
+ aMode = mgr->stringValue( "Shrink", "SMESH" );
if(aMode == "yes"){
SetShrink();
- }*/
+ }
myTimeStamp->Modified();
Modified();
#include "SMESH_ActorUtils.h"
-//#include "QAD_Config.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Session.h"
+
#include "utilities.h"
#include <vtkUnstructuredGrid.h>
namespace SMESH{
- float GetFloat(const QString& theValue, float theDefault){
- if(theValue.isEmpty()) return theDefault;
- //QString aValue = QAD_CONFIG->getSetting(theValue);
- //if(aValue.isEmpty())
- return theDefault;
- //return aValue.toFloat();
+ float GetFloat( const QString& theValue, float theDefault )
+ {
+ int pos = theValue.find( ":" );
+ float val = theDefault;
+ if( pos>=0 )
+ {
+ QString val = theValue.right( theValue.length()-pos-1 ),
+ sect = theValue.left( pos );
+ if( !val.isEmpty() && !sect.isEmpty() )
+ val = GetFloat( val, sect, theDefault );
+ }
+ return val;
+ }
+
+ float GetFloat( const QString& theValue, const QString& theSection, float theDefault )
+ {
+ float val = theDefault;
+ SUIT_ResourceMgr* mgr = SUIT_Session::session()->resourceMgr();
+ if( mgr )
+ val = (float) mgr->doubleValue( theValue, theSection, theDefault );
+
+ return val;
}
void WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid, const char* theFileName){
namespace SMESH{
- float GetFloat(const QString& theValue, float theDefault = 0);
+ float GetFloat( const QString& theValue, float theDefault = 0 );
+ float GetFloat( const QString& theName, const QString& theSection, float theDefault = 0 );
void WriteUnstructuredGrid(vtkUnstructuredGrid* theGrid, const char* theFileName);
}
case 1133:{
SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
- new SMESHGUI_TransparencyDlg( SMESHGUI::desktop(), "", false );
+ new SMESHGUI_TransparencyDlg( SMESHGUI::GetSMESHGUI(), "", false );
return;
}}
SALOME_ListIteratorOfListIO It( selected );
float Shrink = anActor->GetShrinkFactor();
SMESHGUI_Preferences_ColorDlg *aDlg =
- new SMESHGUI_Preferences_ColorDlg(SMESHGUI::desktop(),"");
+ new SMESHGUI_Preferences_ColorDlg( SMESHGUI::GetSMESHGUI(), "" );
aDlg->SetColor(1, c);
aDlg->SetColor(2, e);
aDlg->SetColor(3, n);
SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
SMESHGUI_Preferences_ColorDlg *aDlg =
- new SMESHGUI_Preferences_ColorDlg(SMESHGUI::desktop(), "");
+ new SMESHGUI_Preferences_ColorDlg( SMESHGUI::GetSMESHGUI(), "" );
QColor color = mgr->colorValue( "SMESH", "SettingsFillColor", QColor(0, 170, 255) );
aDlg->SetColor(1, color);
aStudyBuilder->CommitCommand();
/* Clear any previous selection */
- SALOME_ListIO selected1;
- aSel->setSelectedObjects( selected1 );
+ aSel->setSelectedObjects( SALOME_ListIO() );
SMESHGUI::GetSMESHGUI()->updateObjBrowser();
}
}
case 201:
{
- SalomeApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
- SALOME_ListIO selected;
- if( aSel )
- aSel->selectedObjects( selected );
-
- SMESHGUI_Preferences_ScalarBarDlg::ScalarBarProperties( desktop(), aSel );
+ SMESHGUI_Preferences_ScalarBarDlg::ScalarBarProperties( this );
break;
}
}
}
}
- SALOME_ListIO selected1;
- aSel->setSelectedObjects( selected1 );
+ aSel->setSelectedObjects( SALOME_ListIO() );
break;
}
else if ( theCommandID == 811 ) aMode = SMESHGUI_GroupOpDlg::INTERSECT;
else aMode = SMESHGUI_GroupOpDlg::CUT;
- ( new SMESHGUI_GroupOpDlg( desktop(), SMESHGUI::selectionMgr(), aMode ) )->show();
+ ( new SMESHGUI_GroupOpDlg( this, aMode ) )->show();
break;
}
EmitSignalDeactivateDialog();
- new SMESHGUI_DeleteGroupDlg(this);
+ new SMESHGUI_DeleteGroupDlg( this );
break;
}
IOs.Clear();
IOs.Append( It.Value() );
aSel->setSelectedObjects( IOs );
- new SMESHGUI_StandardMeshInfosDlg(desktop(), "", false);
+ new SMESHGUI_StandardMeshInfosDlg( this, "", false);
}
// restore selection
aSel->setSelectedObjects( selected );
}
else
- new SMESHGUI_StandardMeshInfosDlg(desktop(), "", false);
+ new SMESHGUI_StandardMeshInfosDlg( this, "", false);
break;
}
case 1005:
{
- SMESHGUI_Preferences_ScalarBarDlg::ScalarBarPreferences( desktop() );
+ SMESHGUI_Preferences_ScalarBarDlg::ScalarBarPreferences( this );
break;
}
case 10070:
{
- ( new SMESHGUI_PrecisionDlg( desktop() ) )->exec();
+ ( new SMESHGUI_PrecisionDlg( this ) )->exec();
break;
}
case 1006:
{
SMESHGUI_Preferences_SelectionDlg* aDlg =
- new SMESHGUI_Preferences_SelectionDlg(desktop());
+ new SMESHGUI_Preferences_SelectionDlg( this );
QColor aColor = mgr->colorValue( "SMESH", "SettingsPreSelectColor", Qt::cyan );
aDlg->SetColor(1, aColor);
Handle(SALOME_InteractiveObject) IObject = It.Value();
SMESH::RemoveHypothesisOrAlgorithmOnMesh(IObject);
}
- SALOME_ListIO selected1;
- aSel->setSelectedObjects( selected1 );
+ aSel->setSelectedObjects( SALOME_ListIO() );
updateObjBrowser();
break;
}
if(checkLock(aStudy)) break;
if( vtkwnd ) {
EmitSignalDeactivateDialog();
- new SMESHGUI_RenumberingDlg(desktop(), "", selectionMgr(), 0);
+ new SMESHGUI_RenumberingDlg( this, "", 0);
}
else
{
if(checkLock(aStudy)) break;
if ( vtkwnd ) {
EmitSignalDeactivateDialog();
- new SMESHGUI_RenumberingDlg(desktop(), "", selectionMgr(), 1);
+ new SMESHGUI_RenumberingDlg( this, "", 1);
}
else
{
QString caption = tr(QString("SMESH_ADD_%1_TITLE").arg(elemName));
QString grBoxTitle = tr(QString("SMESH_ADD_%1").arg(elemName));
- QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", iconName));
- QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+ QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", iconName));
+ QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
if (!name)
setName("SMESHGUI_AddMeshElementDlg");
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
{
- QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+ QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
if (!name)
setName("SMESHGUI_AddSubMeshDlg");
setCaption(tr("SMESH_ADD_SUBMESH"));
parentItem = new QListViewItem(ListAlgoDefinition, aHypData->PluginName);
parentItem->setOpen(true);
QListViewItem* aItem = new QListViewItem(parentItem, aHypData->Label, HypList[i]);
- QPixmap aPixMap (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr(aHypData->IconId)));
+ QPixmap aPixMap (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr(aHypData->IconId)));
if (!aPixMap.isNull())
aItem->setPixmap(0, aPixMap);
}
-// SMESH SMESHGUI : GUI for SMESH 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
-//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
-//
-//
-//
-// File : SMESHGUI_CreatePatternDlg.cxx
-// Author : Sergey LITONIN
-// Module : SMESH
-
-#include "SMESHGUI_CreatePatternDlg.h"
-
-#include "SMESHGUI.h"
-#include "SMESHGUI_SpinBox.h"
-#include "SMESHGUI_PatternWidget.h"
-#include "SMESHGUI_Utils.h"
-#include "SMESHGUI_VTKUtils.h"
-#include "SMESHGUI_PatternUtils.h"
-#include "SMESHGUI_GEOMGenUtils.h"
-
-#include "SMESH_NumberFilter.hxx"
-
-#include "SUIT_ResourceMgr.h"
-#include "SUIT_Desktop.h"
-#include "SUIT_FileDlg.h"
-
-#include "SalomeApp_Study.h"
-#include "SalomeApp_DataOwner.h"
-#include "SalomeApp_SelectionMgr.h"
-#include "SalomeApp_Tools.h"
-
-#include "SALOMEDS_SObject.hxx"
-
-#include "SALOME_ListIO.hxx"
-#include "SVTK_ViewModel.h"
-#include "SVTK_ViewWindow.h"
-#include "SVTK_Selector.h"
-#include "SVTK_Selection.h"
-
-// OCCT Includes
-#include <TColStd_MapOfInteger.hxx>
-
-// QT Includes
-#include <qframe.h>
-#include <qlayout.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qradiobutton.h>
-#include <qcheckbox.h>
-#include <qbuttongroup.h>
-#include <qmessagebox.h>
-#include <qapplication.h>
-
-#define SPACING 5
-#define MARGIN 10
-
-/*!
- * Class : SMESHGUI_CreatePatternDlg
- * Description : Dialog to specify filters for VTK viewer
- */
-
-//=======================================================================
-// function : SMESHGUI_CreatePatternDlg()
-// purpose : Constructor
-//=======================================================================
-SMESHGUI_CreatePatternDlg::SMESHGUI_CreatePatternDlg( SMESHGUI* theModule,
- const int theType,
- const char* theName)
- : QDialog( SMESH::GetDesktop( theModule ), theName, false,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
- mySMESHGUI( theModule ),
- mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
- myViewWindow( SMESH::GetViewWindow( theModule ) ),
- mySelector( myViewWindow->GetSelector() )
-{
- setCaption(tr("CAPTION"));
-
- QVBoxLayout* aDlgLay = new QVBoxLayout (this, MARGIN, SPACING);
-
- QFrame* aMainFrame = createMainFrame (this);
- QFrame* aBtnFrame = createButtonFrame(this);
-
- aDlgLay->addWidget(aMainFrame);
- aDlgLay->addWidget(aBtnFrame);
-
- aDlgLay->setStretchFactor(aMainFrame, 1);
-
- Init(theType);
-}
-
-//=======================================================================
-// function : createMainFrame()
-// purpose : Create frame containing dialog's input fields
-//=======================================================================
-QFrame* SMESHGUI_CreatePatternDlg::createMainFrame (QWidget* theParent)
-{
- QPixmap iconSlct (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
- QPixmap icon2d (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_PATTERN_2d")));
- QPixmap icon3d (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_PATTERN_3d")));
- QPixmap iconSample2d (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_PATTERN_SAMPLE_2D")));
-
- QGroupBox* aMainGrp = new QGroupBox(1, Qt::Horizontal, theParent);
- aMainGrp->setFrameStyle(QFrame::NoFrame);
- aMainGrp->setInsideMargin(0);
-
- // Pattern type group
-
- myTypeGrp = new QButtonGroup (1, Qt::Vertical, tr("PATTERN_TYPE"), aMainGrp);
- mySwitch2d = new QRadioButton (myTypeGrp);
- mySwitch3d = new QRadioButton (myTypeGrp);
- mySwitch2d->setPixmap(icon2d);
- mySwitch3d->setPixmap(icon3d);
- myTypeGrp->insert(mySwitch2d, Type_2d);
- myTypeGrp->insert(mySwitch3d, Type_3d);
-
- QGroupBox* aPatternGrp = new QGroupBox(1, Qt::Horizontal, tr("PATTERN"), aMainGrp);
-
- // Mesh and pattern name group
-
- QGroupBox* aMeshGrp = new QGroupBox(1, Qt::Vertical, aPatternGrp);
- aMeshGrp->setFrameStyle(QFrame::NoFrame);
- aMeshGrp->setInsideMargin(0);
-
- new QLabel(tr("MESH_OR_SUBMESH"), aMeshGrp);
-
- QPushButton* aSelBtn = new QPushButton(aMeshGrp);
- aSelBtn->setPixmap(iconSlct);
- myMeshEdit = new QLineEdit(aMeshGrp);
- myMeshEdit->setReadOnly(true);
-
- QGroupBox* aPattGrp = new QGroupBox(1, Qt::Vertical, aPatternGrp);
- aPattGrp->setFrameStyle(QFrame::NoFrame);
- aPattGrp->setInsideMargin(0);
-
- new QLabel(tr("PATTERN_NAME"), aPattGrp);
- myName = new QLineEdit(aPattGrp);
-
- // Picture 2d
-
- myPicture2d = new SMESHGUI_PatternWidget(aPatternGrp),
- myPicture2d->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));
-
- // Project check box
-
- myProjectChk = new QCheckBox(tr("PROJECT"), aPatternGrp);
-
- // Connect signals and slots
-
- connect(myTypeGrp, SIGNAL(clicked(int) ), SLOT(onTypeChanged(int)));
- connect(myProjectChk, SIGNAL(toggled(bool)), SLOT(onProject(bool) ));
- connect(aSelBtn, SIGNAL(clicked() ), SLOT(onSelBtnClicked()));
-
- return aMainGrp;
-}
-
-//=======================================================================
-// function : createButtonFrame()
-// purpose : Create frame containing buttons
-//=======================================================================
-QFrame* SMESHGUI_CreatePatternDlg::createButtonFrame (QWidget* theParent)
-{
- QFrame* aFrame = new QFrame(theParent);
- aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);
-
- myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame);
- mySaveBtn = new QPushButton(tr("SAVE" ), aFrame);
- myCloseBtn = new QPushButton(tr("SMESH_BUT_CANCEL"), aFrame);
-
- QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
-
- QHBoxLayout* aLay = new QHBoxLayout(aFrame, MARGIN, SPACING);
-
- aLay->addWidget(myOkBtn);
- aLay->addWidget(mySaveBtn);
- aLay->addItem(aSpacer);
- aLay->addWidget(myCloseBtn);
-
- connect(myOkBtn, SIGNAL(clicked()), SLOT(onOk()));
- connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));
- connect(mySaveBtn, SIGNAL(clicked()), SLOT(onSave()));
-
- return aFrame;
-}
-
-//=======================================================================
-// function : ~SMESHGUI_CreatePatternDlg()
-// purpose : Destructor
-//=======================================================================
-SMESHGUI_CreatePatternDlg::~SMESHGUI_CreatePatternDlg()
-{
- // no need to delete child widgets, Qt does it all for us
-}
-
-//=======================================================================
-// function : onProject()
-// purpose : SLOT. Called when state of "Project nodes on ther face"
-// checkbox is changed
-//=======================================================================
-void SMESHGUI_CreatePatternDlg::onProject (bool)
-{
- loadFromObject(false);
- displayPreview();
-}
-
-//=======================================================================
-// function : Init()
-// purpose : Init dialog fields, connect signals and slots, show dialog
-//=======================================================================
-void SMESHGUI_CreatePatternDlg::Init( const int theType )
-{
- myIsLoaded = false;
- myType = -1;
- myNbPoints = -1;
- mySubMesh = SMESH::SMESH_subMesh::_nil();
- myMesh = SMESH::SMESH_Mesh::_nil();
- myGeomObj = GEOM::GEOM_Object::_nil();
- myPattern = SMESH::SMESH_Pattern::_nil();
-
- erasePreview();
-
- mySMESHGUI->SetActiveDialogBox((QDialog*)this);
-
- // selection and SMESHGUI
- connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
- connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
- connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
-
- mySwitch2d->setEnabled(theType == Type_2d);
- mySwitch3d->setEnabled(theType == Type_3d);
-
- if (theType == Type_2d)
- myProjectChk->show();
- else
- myProjectChk->hide();
-
- myTypeGrp->setButton(theType);
- onTypeChanged(theType);
-
- myName->setText(getDefaultName());
- myMeshEdit->setText("");
-
- setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
- qApp->processEvents();
- updateGeometry();
- myPicture2d->updateGeometry();
- adjustSize();
- resize(minimumSize());
-
- activateSelection();
- onSelectionDone();
-
- int x, y;
- mySMESHGUI->DefineDlgPosition(this, x, y);
- this->move(x, y);
- this->show();
-}
-
-//=======================================================================
-// function : SetMesh()
-// purpose : Set mesh to dialog
-//=======================================================================
-void SMESHGUI_CreatePatternDlg::SetMesh (SMESH::SMESH_Mesh_ptr thePtr)
-{
- myMesh = SMESH::SMESH_Mesh::_duplicate(thePtr);
- mySubMesh = SMESH::SMESH_subMesh::_nil();
-
- bool isValidMesh = false;
- if (!myMesh->_is_nil())
- {
- _PTR(SObject) aSobj = SMESH::FindSObject(myMesh.in());
- //Handle(SALOME_InteractiveObject) anIObj =
- // new SALOME_InteractiveObject(aSobj->GetID().c_str(), "SMESH");
- SUIT_DataOwnerPtr anIObj (new SalomeApp_DataOwner(aSobj->GetID().c_str()));
-
- isValidMesh = mySelectionMgr->isOk(anIObj);
- }
-
- if (isValidMesh) {
- _PTR(SObject) aSO = SMESH::FindSObject(myMesh.in());
- myMeshEdit->setText(aSO->GetName().c_str());
- myGeomObj = SMESH::GetGeom(aSO);
- } else {
- myMeshEdit->setText("");
- myGeomObj = GEOM::GEOM_Object::_nil();
- }
-
- if (myType == Type_2d) {
- loadFromObject(false);
- displayPreview();
- }
-}
-
-//=======================================================================
-// function : isValid()
-// purpose : Verify validity of entry data
-//=======================================================================
-bool SMESHGUI_CreatePatternDlg::isValid()
-{
- if (myGeomObj->_is_nil()) {
- QMessageBox::information(SMESH::GetDesktop( mySMESHGUI ),
- tr("SMESH_INSUFFICIENT_DATA"),
- tr("SMESHGUI_INVALID_PARAMETERS"),
- QMessageBox::Ok);
- return false;
- }
- else
- return true;
-}
-
-//=======================================================================
-// function : getDefaultName()
-// purpose : Get default pattern name
-//=======================================================================
-QString SMESHGUI_CreatePatternDlg::getDefaultName() const
-{
- return myType == Type_2d ? tr("DEFAULT_2D") : tr("DEFAULT_3D");
-}
-
-//=======================================================================
-// function : onSave()
-// purpose : SLOT called when "Save" button pressed. Build pattern and
-// save it to disk
-//=======================================================================
-void SMESHGUI_CreatePatternDlg::onSave()
-{
- try {
- if (!isValid())
- return;
-
- if (!myIsLoaded)
- loadFromObject(true);
-
- // Load pattern from object
- if (!myIsLoaded)
- return;
-
- ///////////////////////////////////////////////////////
- SUIT_FileDlg* aDlg = new SUIT_FileDlg (this, false);
- aDlg->setCaption(tr("SAVE_PATTERN"));
- aDlg->setMode(QFileDialog::AnyFile);
- aDlg->setFilters(tr("PATTERN_FILT"));
- if (myName->text() != "")
- aDlg->setSelection(myName->text());
-
- if (aDlg->exec() != Accepted)
- return;
-
- QString fName = aDlg->selectedFile();
- if (fName.isEmpty())
- return;
-
- if (QFileInfo(fName).extension().isEmpty())
- fName = autoExtension(fName);
-
- fName = QDir::convertSeparators(fName);
-
- QString aData (myPattern->GetString());
- long aLen = aData.length();
-
- QFile aFile (fName);
- aFile.open(IO_WriteOnly);
- long aWritten = aFile.writeBlock(aData, aLen);
- aFile.close();
-
- if (aWritten != aLen) {
- QMessageBox::information(SMESH::GetDesktop( mySMESHGUI ), tr("SMESH_ERROR"),
- tr("ERROR_OF_SAVING"), QMessageBox::Ok);
- } else {
- //SUIT_Application::getDesktop()->setSelectionModes(ActorSelection);
- myViewWindow->SetSelectionMode(ActorSelection);
- disconnect(mySelectionMgr, 0, this, 0);
- disconnect(mySMESHGUI, 0, this, 0);
- mySMESHGUI->ResetState();
- accept();
- emit NewPattern();
- }
- } catch (const SALOME::SALOME_Exception& S_ex) {
- SalomeApp_Tools::QtCatchCorbaException(S_ex);
- } catch (...) {
- }
-}
-
-//=======================================================================
-// function : GetPatternName()
-// purpose : Get name of pattern
-//=======================================================================
-QString SMESHGUI_CreatePatternDlg::GetPatternName() const
-{
- return myName->text();
-}
-
-//=======================================================================
-// function : GetPattern()
-// purpose : Get result pattern
-//=======================================================================
-SMESH::SMESH_Pattern_ptr SMESHGUI_CreatePatternDlg::GetPattern()
-{
- return myPattern.in();
-}
-
-//=======================================================================
-// function : onOk()
-// purpose : SLOT called when "Ok" button pressed.
-//=======================================================================
-void SMESHGUI_CreatePatternDlg::onOk()
-{
- try {
- if (!isValid())
- return;
-
- if (!myIsLoaded)
- loadFromObject(true);
-
- // Load pattern from object
- if (!myIsLoaded) {
- return;
- } else {
- //SUIT_Application::getDesktop()->setSelectionModes(ActorSelection);
- myViewWindow->SetSelectionMode(ActorSelection);
- disconnect(mySelectionMgr, 0, this, 0);
- disconnect(mySMESHGUI, 0, this, 0);
- mySMESHGUI->ResetState();
- accept();
- emit NewPattern();
- }
- } catch (const SALOME::SALOME_Exception& S_ex) {
- SalomeApp_Tools::QtCatchCorbaException(S_ex);
- } catch (...) {
- }
-}
-
-//=======================================================================
-// function : onClose()
-// purpose : SLOT called when "Close" button pressed. Close dialog
-//=======================================================================
-void SMESHGUI_CreatePatternDlg::onClose()
-{
- myViewWindow->SetSelectionMode(ActorSelection);
- disconnect(mySelectionMgr, 0, this, 0);
- disconnect(mySMESHGUI, 0, this, 0);
- mySMESHGUI->ResetState();
- reject();
- emit Close();
-}
-
-//=======================================================================
-// function : loadFromObject()
-// purpose : Load pattern from geom object corresponding to the mesh/submesh
-//=======================================================================
-bool SMESHGUI_CreatePatternDlg::loadFromObject (const bool theMess)
-{
- try {
- myIsLoaded = false;
-
- if (myPattern->_is_nil())
- myPattern = SMESH::GetPattern();
-
- if (myMesh->_is_nil() && mySubMesh->_is_nil() || myGeomObj->_is_nil())
- return false;
-
- SMESH::SMESH_Mesh_ptr aMesh = mySubMesh->_is_nil() ? myMesh.in() : mySubMesh->GetFather();
-
- myIsLoaded = myType == Type_2d
- ? myPattern->LoadFromFace(aMesh, myGeomObj, myProjectChk->isChecked())
- : myPattern->LoadFrom3DBlock(aMesh, myGeomObj);
-
- if (!myIsLoaded && theMess) {
- QString aMess;
- SMESH::SMESH_Pattern::ErrorCode aCode = myPattern->GetErrorCode();
-
- if (aCode == SMESH::SMESH_Pattern::ERR_LOAD_EMPTY_SUBMESH ) aMess = tr("ERR_LOAD_EMPTY_SUBMESH");
- else if (aCode == SMESH::SMESH_Pattern::ERR_LOADF_NARROW_FACE ) aMess = tr("ERR_LOADF_NARROW_FACE");
- else if (aCode == SMESH::SMESH_Pattern::ERR_LOADF_CLOSED_FACE ) aMess = tr("ERR_LOADF_CLOSED_FACE");
- else if (aCode == SMESH::SMESH_Pattern::ERR_LOADV_BAD_SHAPE ) aMess = tr("ERR_LOADV_BAD_SHAPE");
- else if (aCode == SMESH::SMESH_Pattern::ERR_LOADV_COMPUTE_PARAMS) aMess = tr("ERR_LOADV_COMPUTE_PARAMS");
- else aMess = tr("ERROR_OF_CREATION");
-
- QMessageBox::information(SMESH::GetDesktop( mySMESHGUI ),
- tr("SMESH_ERROR"), aMess, QMessageBox::Ok);
- }
- } catch (const SALOME::SALOME_Exception& S_ex) {
- SalomeApp_Tools::QtCatchCorbaException(S_ex);
- }
-
- return myIsLoaded;
-}
-
-//=======================================================================
-// function : onSelectionDone()
-// purpose : SLOT called when selection changed
-//=======================================================================
-void SMESHGUI_CreatePatternDlg::onSelectionDone()
-{
- try {
- SALOME_ListIO aList;
- mySelectionMgr->selectedObjects(aList, SVTK_Viewer::Type());
- if (aList.Extent() != 1)
- return;
-
- // Get mesh or sub-mesh from selection
- Handle(SALOME_InteractiveObject) anIO = aList.First();
- SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIO);
- SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIO);
- if (aMesh->_is_nil() && aSubMesh->_is_nil())
- return;
-
- // Get geom object corresponding to the mesh
- _PTR(SObject) aSO;
- if (!aMesh->_is_nil())
- aSO = SMESH::FindSObject(aMesh.in());
- else
- aSO = SMESH::FindSObject(aSubMesh.in());
-
- GEOM::GEOM_Object_var aGeomObj = SMESH::GetGeom(aSO);
- if (aGeomObj->_is_nil())
- return;
-
- myGeomObj = aGeomObj;
-
- // init class fields
- if (!aMesh->_is_nil()) {
- myMesh = aMesh;
- mySubMesh = SMESH::SMESH_subMesh::_nil();
- } else {
- mySubMesh = aSubMesh;
- myMesh = SMESH::SMESH_Mesh::_nil();
- }
-
- QString aName;
- SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aName);
- myMeshEdit->setText(aName);
-
- if (myType == Type_2d) {
- loadFromObject(true);
- displayPreview();
- }
- } catch (...) {
- myMesh = SMESH::SMESH_Mesh::_nil();
- mySubMesh = SMESH::SMESH_subMesh::_nil();
- myGeomObj = GEOM::GEOM_Object::_nil();
- erasePreview();
- }
-}
-
-//=======================================================================
-// function : onDeactivate()
-// purpose : SLOT called when dialog must be deativated
-//=======================================================================
-void SMESHGUI_CreatePatternDlg::onDeactivate()
-{
- disconnect(mySelectionMgr, 0, this, 0);
- setEnabled(false);
-}
-
-//=======================================================================
-// function : enterEvent()
-// purpose : Event filter
-//=======================================================================
-void SMESHGUI_CreatePatternDlg::enterEvent (QEvent*)
-{
- mySMESHGUI->EmitSignalDeactivateDialog();
- setEnabled(true);
- activateSelection();
- connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
-}
-
-//=================================================================================
-// function : closeEvent()
-// purpose : Close dialog box
-//=================================================================================
-void SMESHGUI_CreatePatternDlg::closeEvent (QCloseEvent*)
-{
- onClose();
-}
-
-//=======================================================================
-// function : onSelBtnClicked()
-// purpose : SLOT. Called when -> button clicked.
-//=======================================================================
-void SMESHGUI_CreatePatternDlg::onSelBtnClicked()
-{
- onSelectionDone();
-}
-
-//================================================================
-// function : autoExtension()
-// purpose : Append extension to the file name
-//================================================================
-QString SMESHGUI_CreatePatternDlg::autoExtension (const QString& theFileName) const
-{
- QString anExt = theFileName.section('.', -1);
- return anExt != "smp" && anExt != "SMP" ? theFileName + ".smp" : theFileName;
-}
-
-//=======================================================================
-// function : displayPreview()
-// purpose : Display preview
-//=======================================================================
-void SMESHGUI_CreatePatternDlg::displayPreview()
-{
- // Redisplay preview in dialog
- try {
- if (!myIsLoaded) {
- erasePreview();
- } else {
- SMESH::point_array_var pnts = myPattern->GetPoints();
- SMESH::long_array_var keyPoints = myPattern->GetKeyPoints();
- SMESH::array_of_long_array_var elemPoints = myPattern->GetElementPoints(false);
-
- if (pnts->length() == 0 ||
- keyPoints->length() == 0 ||
- elemPoints->length() == 0) {
- myIsLoaded = false;
- erasePreview();
- return;
- }
-
- PointVector aPoints (pnts->length());
- QValueVector<int> aKeyPoints (keyPoints->length());
- ConnectivityVector anElemPoints (elemPoints->length());
-
- for (int i = 0, n = pnts->length(); i < n; i++)
- aPoints[ i ] = pnts[ i ];
-
- for (int i2 = 0, n2 = keyPoints->length(); i2 < n2; i2++)
- aKeyPoints[ i2 ] = keyPoints[ i2 ];
-
- for (int i3 = 0, n3 = elemPoints->length(); i3 < n3; i3++) {
- QValueVector<int> aVec (elemPoints[ i3 ].length());
- for (int i4 = 0, n4 = elemPoints[ i3 ].length(); i4 < n4; i4++)
- aVec[ i4 ] = elemPoints[ i3 ][ i4 ];
-
- anElemPoints[ i3 ] = aVec;
- }
-
- myPicture2d->SetPoints(aPoints, aKeyPoints, anElemPoints);
- }
-
- return;
-
- } catch (const SALOME::SALOME_Exception& S_ex) {
- SalomeApp_Tools::QtCatchCorbaException(S_ex);
- } catch (...) {
- }
- erasePreview();
-}
-
-//=======================================================================
-// function : erasePreview()
-// purpose : Erase preview
-//=======================================================================
-void SMESHGUI_CreatePatternDlg::erasePreview()
-{
- // Erase preview in 2D viewer
- myPicture2d->SetPoints(PointVector(), QValueVector<int>(), ConnectivityVector());
-}
-
-//=======================================================================
-// function : activateSelection()
-// purpose : Activate selection in accordance with current pattern type
-//=======================================================================
-void SMESHGUI_CreatePatternDlg::activateSelection()
-{
- mySelectionMgr->clearFilters();
- //SUIT_Application::getDesktop()->setSelectionModes(ActorSelection);
- myViewWindow->SetSelectionMode(ActorSelection);
-
- if (myType == Type_2d) {
- mySelectionMgr->installFilter(new SMESH_NumberFilter
- ("SMESH", TopAbs_SHAPE, -1, TopAbs_FACE));
- } else {
- TColStd_MapOfInteger aTypes;
- aTypes.Add(TopAbs_SHELL);
- aTypes.Add(TopAbs_SOLID);
- mySelectionMgr->installFilter(new SMESH_NumberFilter
- ("SMESH", TopAbs_FACE, 6, aTypes, GEOM::GEOM_Object::_nil(), true));
- }
-}
-
-//=======================================================================
-// function : onTypeChanged()
-// purpose : SLOT. Called when pattern type changed.
-// Change dialog's look and feel
-//=======================================================================
-void SMESHGUI_CreatePatternDlg::onTypeChanged (int theType)
-{
- if (myType == theType)
- return;
-
- myType = theType;
-
- if (theType == Type_2d)
- myPicture2d->show();
- else
- myPicture2d->hide();
-}
+// SMESH SMESHGUI : GUI for SMESH component\r
+//\r
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,\r
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS\r
+//\r
+// This library is free software; you can redistribute it and/or\r
+// modify it under the terms of the GNU Lesser General Public\r
+// License as published by the Free Software Foundation; either\r
+// version 2.1 of the License.\r
+//\r
+// This library is distributed in the hope that it will be useful,\r
+// but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+// Lesser General Public License for more details.\r
+//\r
+// You should have received a copy of the GNU Lesser General Public\r
+// License along with this library; if not, write to the Free Software\r
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
+//\r
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org\r
+//\r
+//\r
+//\r
+// File : SMESHGUI_CreatePatternDlg.cxx\r
+// Author : Sergey LITONIN\r
+// Module : SMESH\r
+\r
+#include "SMESHGUI_CreatePatternDlg.h"\r
+\r
+#include "SMESHGUI.h"\r
+#include "SMESHGUI_SpinBox.h"\r
+#include "SMESHGUI_PatternWidget.h"\r
+#include "SMESHGUI_Utils.h"\r
+#include "SMESHGUI_VTKUtils.h"\r
+#include "SMESHGUI_PatternUtils.h"\r
+#include "SMESHGUI_GEOMGenUtils.h"\r
+\r
+#include "SMESH_NumberFilter.hxx"\r
+\r
+#include "SUIT_ResourceMgr.h"\r
+#include "SUIT_Desktop.h"\r
+#include "SUIT_FileDlg.h"\r
+\r
+#include "SalomeApp_Study.h"\r
+#include "SalomeApp_DataOwner.h"\r
+#include "SalomeApp_SelectionMgr.h"\r
+#include "SalomeApp_Tools.h"\r
+\r
+#include "SALOMEDS_SObject.hxx"\r
+\r
+#include "SALOME_ListIO.hxx"\r
+#include "SVTK_ViewModel.h"\r
+#include "SVTK_ViewWindow.h"\r
+#include "SVTK_Selector.h"\r
+#include "SVTK_Selection.h"\r
+\r
+// OCCT Includes\r
+#include <TColStd_MapOfInteger.hxx>\r
+\r
+// QT Includes\r
+#include <qframe.h>\r
+#include <qlayout.h>\r
+#include <qlineedit.h>\r
+#include <qpushbutton.h>\r
+#include <qgroupbox.h>\r
+#include <qlabel.h>\r
+#include <qradiobutton.h>\r
+#include <qcheckbox.h>\r
+#include <qbuttongroup.h>\r
+#include <qmessagebox.h>\r
+#include <qapplication.h>\r
+\r
+#define SPACING 5\r
+#define MARGIN 10\r
+\r
+/*!\r
+ * Class : SMESHGUI_CreatePatternDlg\r
+ * Description : Dialog to specify filters for VTK viewer\r
+ */\r
+\r
+//=======================================================================\r
+// function : SMESHGUI_CreatePatternDlg()\r
+// purpose : Constructor\r
+//=======================================================================\r
+SMESHGUI_CreatePatternDlg::SMESHGUI_CreatePatternDlg( SMESHGUI* theModule,\r
+ const int theType,\r
+ const char* theName)\r
+ : QDialog( SMESH::GetDesktop( theModule ), theName, false,\r
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),\r
+ mySMESHGUI( theModule ),\r
+ mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),\r
+ myViewWindow( SMESH::GetViewWindow( theModule ) ),\r
+ mySelector( myViewWindow->GetSelector() )\r
+{\r
+ setCaption(tr("CAPTION"));\r
+\r
+ QVBoxLayout* aDlgLay = new QVBoxLayout (this, MARGIN, SPACING);\r
+\r
+ QFrame* aMainFrame = createMainFrame (this);\r
+ QFrame* aBtnFrame = createButtonFrame(this);\r
+\r
+ aDlgLay->addWidget(aMainFrame);\r
+ aDlgLay->addWidget(aBtnFrame);\r
+\r
+ aDlgLay->setStretchFactor(aMainFrame, 1);\r
+\r
+ Init(theType);\r
+}\r
+\r
+//=======================================================================\r
+// function : createMainFrame()\r
+// purpose : Create frame containing dialog's input fields\r
+//=======================================================================\r
+QFrame* SMESHGUI_CreatePatternDlg::createMainFrame (QWidget* theParent)\r
+{\r
+ QPixmap iconSlct (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));\r
+ QPixmap icon2d (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_PATTERN_2d")));\r
+ QPixmap icon3d (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_PATTERN_3d")));\r
+ QPixmap iconSample2d (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_PATTERN_SAMPLE_2D")));\r
+\r
+ QGroupBox* aMainGrp = new QGroupBox(1, Qt::Horizontal, theParent);\r
+ aMainGrp->setFrameStyle(QFrame::NoFrame);\r
+ aMainGrp->setInsideMargin(0);\r
+\r
+ // Pattern type group\r
+\r
+ myTypeGrp = new QButtonGroup (1, Qt::Vertical, tr("PATTERN_TYPE"), aMainGrp);\r
+ mySwitch2d = new QRadioButton (myTypeGrp);\r
+ mySwitch3d = new QRadioButton (myTypeGrp);\r
+ mySwitch2d->setPixmap(icon2d);\r
+ mySwitch3d->setPixmap(icon3d);\r
+ myTypeGrp->insert(mySwitch2d, Type_2d);\r
+ myTypeGrp->insert(mySwitch3d, Type_3d);\r
+\r
+ QGroupBox* aPatternGrp = new QGroupBox(1, Qt::Horizontal, tr("PATTERN"), aMainGrp);\r
+\r
+ // Mesh and pattern name group\r
+\r
+ QGroupBox* aMeshGrp = new QGroupBox(1, Qt::Vertical, aPatternGrp);\r
+ aMeshGrp->setFrameStyle(QFrame::NoFrame);\r
+ aMeshGrp->setInsideMargin(0);\r
+\r
+ new QLabel(tr("MESH_OR_SUBMESH"), aMeshGrp);\r
+\r
+ QPushButton* aSelBtn = new QPushButton(aMeshGrp);\r
+ aSelBtn->setPixmap(iconSlct);\r
+ myMeshEdit = new QLineEdit(aMeshGrp);\r
+ myMeshEdit->setReadOnly(true);\r
+\r
+ QGroupBox* aPattGrp = new QGroupBox(1, Qt::Vertical, aPatternGrp);\r
+ aPattGrp->setFrameStyle(QFrame::NoFrame);\r
+ aPattGrp->setInsideMargin(0);\r
+\r
+ new QLabel(tr("PATTERN_NAME"), aPattGrp);\r
+ myName = new QLineEdit(aPattGrp);\r
+\r
+ // Picture 2d\r
+\r
+ myPicture2d = new SMESHGUI_PatternWidget(aPatternGrp),\r
+ myPicture2d->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding));\r
+\r
+ // Project check box\r
+\r
+ myProjectChk = new QCheckBox(tr("PROJECT"), aPatternGrp);\r
+\r
+ // Connect signals and slots\r
+\r
+ connect(myTypeGrp, SIGNAL(clicked(int) ), SLOT(onTypeChanged(int)));\r
+ connect(myProjectChk, SIGNAL(toggled(bool)), SLOT(onProject(bool) ));\r
+ connect(aSelBtn, SIGNAL(clicked() ), SLOT(onSelBtnClicked()));\r
+\r
+ return aMainGrp;\r
+}\r
+\r
+//=======================================================================\r
+// function : createButtonFrame()\r
+// purpose : Create frame containing buttons\r
+//=======================================================================\r
+QFrame* SMESHGUI_CreatePatternDlg::createButtonFrame (QWidget* theParent)\r
+{\r
+ QFrame* aFrame = new QFrame(theParent);\r
+ aFrame->setFrameStyle(QFrame::Box | QFrame::Sunken);\r
+\r
+ myOkBtn = new QPushButton(tr("SMESH_BUT_OK" ), aFrame);\r
+ mySaveBtn = new QPushButton(tr("SAVE" ), aFrame);\r
+ myCloseBtn = new QPushButton(tr("SMESH_BUT_CANCEL"), aFrame);\r
+\r
+ QSpacerItem* aSpacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);\r
+\r
+ QHBoxLayout* aLay = new QHBoxLayout(aFrame, MARGIN, SPACING);\r
+\r
+ aLay->addWidget(myOkBtn);\r
+ aLay->addWidget(mySaveBtn);\r
+ aLay->addItem(aSpacer);\r
+ aLay->addWidget(myCloseBtn);\r
+\r
+ connect(myOkBtn, SIGNAL(clicked()), SLOT(onOk()));\r
+ connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose()));\r
+ connect(mySaveBtn, SIGNAL(clicked()), SLOT(onSave()));\r
+\r
+ return aFrame;\r
+}\r
+\r
+//=======================================================================\r
+// function : ~SMESHGUI_CreatePatternDlg()\r
+// purpose : Destructor\r
+//=======================================================================\r
+SMESHGUI_CreatePatternDlg::~SMESHGUI_CreatePatternDlg()\r
+{\r
+ // no need to delete child widgets, Qt does it all for us\r
+}\r
+\r
+//=======================================================================\r
+// function : onProject()\r
+// purpose : SLOT. Called when state of "Project nodes on ther face"\r
+// checkbox is changed\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::onProject (bool)\r
+{\r
+ loadFromObject(false);\r
+ displayPreview();\r
+}\r
+\r
+//=======================================================================\r
+// function : Init()\r
+// purpose : Init dialog fields, connect signals and slots, show dialog\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::Init( const int theType )\r
+{\r
+ myIsLoaded = false;\r
+ myType = -1;\r
+ myNbPoints = -1;\r
+ mySubMesh = SMESH::SMESH_subMesh::_nil();\r
+ myMesh = SMESH::SMESH_Mesh::_nil();\r
+ myGeomObj = GEOM::GEOM_Object::_nil();\r
+ myPattern = SMESH::SMESH_Pattern::_nil();\r
+\r
+ erasePreview();\r
+\r
+ mySMESHGUI->SetActiveDialogBox((QDialog*)this);\r
+\r
+ // selection and SMESHGUI\r
+ connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));\r
+ connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));\r
+ connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));\r
+\r
+ mySwitch2d->setEnabled(theType == Type_2d);\r
+ mySwitch3d->setEnabled(theType == Type_3d);\r
+\r
+ if (theType == Type_2d)\r
+ myProjectChk->show();\r
+ else\r
+ myProjectChk->hide();\r
+\r
+ myTypeGrp->setButton(theType);\r
+ onTypeChanged(theType);\r
+\r
+ myName->setText(getDefaultName());\r
+ myMeshEdit->setText("");\r
+\r
+ setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));\r
+ qApp->processEvents();\r
+ updateGeometry();\r
+ myPicture2d->updateGeometry();\r
+ adjustSize();\r
+ resize(minimumSize());\r
+\r
+ activateSelection();\r
+ onSelectionDone();\r
+\r
+ int x, y;\r
+ mySMESHGUI->DefineDlgPosition(this, x, y);\r
+ this->move(x, y);\r
+ this->show();\r
+}\r
+\r
+//=======================================================================\r
+// function : SetMesh()\r
+// purpose : Set mesh to dialog\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::SetMesh (SMESH::SMESH_Mesh_ptr thePtr)\r
+{\r
+ myMesh = SMESH::SMESH_Mesh::_duplicate(thePtr);\r
+ mySubMesh = SMESH::SMESH_subMesh::_nil();\r
+\r
+ bool isValidMesh = false;\r
+ if (!myMesh->_is_nil())\r
+ {\r
+ _PTR(SObject) aSobj = SMESH::FindSObject(myMesh.in());\r
+ //Handle(SALOME_InteractiveObject) anIObj =\r
+ // new SALOME_InteractiveObject(aSobj->GetID().c_str(), "SMESH");\r
+ SUIT_DataOwnerPtr anIObj (new SalomeApp_DataOwner(aSobj->GetID().c_str()));\r
+\r
+ isValidMesh = mySelectionMgr->isOk(anIObj);\r
+ }\r
+\r
+ if (isValidMesh) {\r
+ _PTR(SObject) aSO = SMESH::FindSObject(myMesh.in());\r
+ myMeshEdit->setText(aSO->GetName().c_str());\r
+ myGeomObj = SMESH::GetGeom(aSO);\r
+ } else {\r
+ myMeshEdit->setText("");\r
+ myGeomObj = GEOM::GEOM_Object::_nil();\r
+ }\r
+\r
+ if (myType == Type_2d) {\r
+ loadFromObject(false);\r
+ displayPreview();\r
+ }\r
+}\r
+\r
+//=======================================================================\r
+// function : isValid()\r
+// purpose : Verify validity of entry data\r
+//=======================================================================\r
+bool SMESHGUI_CreatePatternDlg::isValid()\r
+{\r
+ if (myGeomObj->_is_nil()) {\r
+ QMessageBox::information(SMESH::GetDesktop( mySMESHGUI ),\r
+ tr("SMESH_INSUFFICIENT_DATA"),\r
+ tr("SMESHGUI_INVALID_PARAMETERS"),\r
+ QMessageBox::Ok);\r
+ return false;\r
+ }\r
+ else\r
+ return true;\r
+}\r
+\r
+//=======================================================================\r
+// function : getDefaultName()\r
+// purpose : Get default pattern name\r
+//=======================================================================\r
+QString SMESHGUI_CreatePatternDlg::getDefaultName() const\r
+{\r
+ return myType == Type_2d ? tr("DEFAULT_2D") : tr("DEFAULT_3D");\r
+}\r
+\r
+//=======================================================================\r
+// function : onSave()\r
+// purpose : SLOT called when "Save" button pressed. Build pattern and\r
+// save it to disk\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::onSave()\r
+{\r
+ try {\r
+ if (!isValid())\r
+ return;\r
+\r
+ if (!myIsLoaded)\r
+ loadFromObject(true);\r
+\r
+ // Load pattern from object\r
+ if (!myIsLoaded)\r
+ return;\r
+\r
+ ///////////////////////////////////////////////////////\r
+ SUIT_FileDlg* aDlg = new SUIT_FileDlg (this, false);\r
+ aDlg->setCaption(tr("SAVE_PATTERN"));\r
+ aDlg->setMode(QFileDialog::AnyFile);\r
+ aDlg->setFilters(tr("PATTERN_FILT"));\r
+ if (myName->text() != "")\r
+ aDlg->setSelection(myName->text());\r
+\r
+ if (aDlg->exec() != Accepted)\r
+ return;\r
+\r
+ QString fName = aDlg->selectedFile();\r
+ if (fName.isEmpty())\r
+ return;\r
+\r
+ if (QFileInfo(fName).extension().isEmpty())\r
+ fName = autoExtension(fName);\r
+\r
+ fName = QDir::convertSeparators(fName);\r
+\r
+ QString aData (myPattern->GetString());\r
+ long aLen = aData.length();\r
+\r
+ QFile aFile (fName);\r
+ aFile.open(IO_WriteOnly);\r
+ long aWritten = aFile.writeBlock(aData, aLen);\r
+ aFile.close();\r
+\r
+ if (aWritten != aLen) {\r
+ QMessageBox::information(SMESH::GetDesktop( mySMESHGUI ), tr("SMESH_ERROR"),\r
+ tr("ERROR_OF_SAVING"), QMessageBox::Ok);\r
+ } else {\r
+ //SUIT_Application::getDesktop()->setSelectionModes(ActorSelection);\r
+ myViewWindow->SetSelectionMode(ActorSelection);\r
+ disconnect(mySelectionMgr, 0, this, 0);\r
+ disconnect(mySMESHGUI, 0, this, 0);\r
+ mySMESHGUI->ResetState();\r
+ accept();\r
+ emit NewPattern();\r
+ }\r
+ } catch (const SALOME::SALOME_Exception& S_ex) {\r
+ SalomeApp_Tools::QtCatchCorbaException(S_ex);\r
+ } catch (...) {\r
+ }\r
+}\r
+\r
+//=======================================================================\r
+// function : GetPatternName()\r
+// purpose : Get name of pattern\r
+//=======================================================================\r
+QString SMESHGUI_CreatePatternDlg::GetPatternName() const\r
+{\r
+ return myName->text();\r
+}\r
+\r
+//=======================================================================\r
+// function : GetPattern()\r
+// purpose : Get result pattern\r
+//=======================================================================\r
+SMESH::SMESH_Pattern_ptr SMESHGUI_CreatePatternDlg::GetPattern()\r
+{\r
+ return myPattern.in();\r
+}\r
+\r
+//=======================================================================\r
+// function : onOk()\r
+// purpose : SLOT called when "Ok" button pressed.\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::onOk()\r
+{\r
+ try {\r
+ if (!isValid())\r
+ return;\r
+\r
+ if (!myIsLoaded)\r
+ loadFromObject(true);\r
+\r
+ // Load pattern from object\r
+ if (!myIsLoaded) {\r
+ return;\r
+ } else {\r
+ //SUIT_Application::getDesktop()->setSelectionModes(ActorSelection);\r
+ myViewWindow->SetSelectionMode(ActorSelection);\r
+ disconnect(mySelectionMgr, 0, this, 0);\r
+ disconnect(mySMESHGUI, 0, this, 0);\r
+ mySMESHGUI->ResetState();\r
+ accept();\r
+ emit NewPattern();\r
+ }\r
+ } catch (const SALOME::SALOME_Exception& S_ex) {\r
+ SalomeApp_Tools::QtCatchCorbaException(S_ex);\r
+ } catch (...) {\r
+ }\r
+}\r
+\r
+//=======================================================================\r
+// function : onClose()\r
+// purpose : SLOT called when "Close" button pressed. Close dialog\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::onClose()\r
+{\r
+ myViewWindow->SetSelectionMode(ActorSelection);\r
+ disconnect(mySelectionMgr, 0, this, 0);\r
+ disconnect(mySMESHGUI, 0, this, 0);\r
+ mySMESHGUI->ResetState();\r
+ reject();\r
+ emit Close();\r
+}\r
+\r
+//=======================================================================\r
+// function : loadFromObject()\r
+// purpose : Load pattern from geom object corresponding to the mesh/submesh\r
+//=======================================================================\r
+bool SMESHGUI_CreatePatternDlg::loadFromObject (const bool theMess)\r
+{\r
+ try {\r
+ myIsLoaded = false;\r
+\r
+ if (myPattern->_is_nil())\r
+ myPattern = SMESH::GetPattern();\r
+\r
+ if (myMesh->_is_nil() && mySubMesh->_is_nil() || myGeomObj->_is_nil())\r
+ return false;\r
+\r
+ SMESH::SMESH_Mesh_ptr aMesh = mySubMesh->_is_nil() ? myMesh.in() : mySubMesh->GetFather();\r
+\r
+ myIsLoaded = myType == Type_2d\r
+ ? myPattern->LoadFromFace(aMesh, myGeomObj, myProjectChk->isChecked())\r
+ : myPattern->LoadFrom3DBlock(aMesh, myGeomObj);\r
+\r
+ if (!myIsLoaded && theMess) {\r
+ QString aMess;\r
+ SMESH::SMESH_Pattern::ErrorCode aCode = myPattern->GetErrorCode();\r
+\r
+ if (aCode == SMESH::SMESH_Pattern::ERR_LOAD_EMPTY_SUBMESH ) aMess = tr("ERR_LOAD_EMPTY_SUBMESH");\r
+ else if (aCode == SMESH::SMESH_Pattern::ERR_LOADF_NARROW_FACE ) aMess = tr("ERR_LOADF_NARROW_FACE");\r
+ else if (aCode == SMESH::SMESH_Pattern::ERR_LOADF_CLOSED_FACE ) aMess = tr("ERR_LOADF_CLOSED_FACE");\r
+ else if (aCode == SMESH::SMESH_Pattern::ERR_LOADV_BAD_SHAPE ) aMess = tr("ERR_LOADV_BAD_SHAPE");\r
+ else if (aCode == SMESH::SMESH_Pattern::ERR_LOADV_COMPUTE_PARAMS) aMess = tr("ERR_LOADV_COMPUTE_PARAMS");\r
+ else aMess = tr("ERROR_OF_CREATION");\r
+\r
+ QMessageBox::information(SMESH::GetDesktop( mySMESHGUI ),\r
+ tr("SMESH_ERROR"), aMess, QMessageBox::Ok);\r
+ }\r
+ } catch (const SALOME::SALOME_Exception& S_ex) {\r
+ SalomeApp_Tools::QtCatchCorbaException(S_ex);\r
+ }\r
+\r
+ return myIsLoaded;\r
+}\r
+\r
+//=======================================================================\r
+// function : onSelectionDone()\r
+// purpose : SLOT called when selection changed\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::onSelectionDone()\r
+{\r
+ try {\r
+ SALOME_ListIO aList;\r
+ mySelectionMgr->selectedObjects(aList, SVTK_Viewer::Type());\r
+ if (aList.Extent() != 1)\r
+ return;\r
+\r
+ // Get mesh or sub-mesh from selection\r
+ Handle(SALOME_InteractiveObject) anIO = aList.First();\r
+ SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIO);\r
+ SMESH::SMESH_subMesh_var aSubMesh = SMESH::IObjectToInterface<SMESH::SMESH_subMesh>(anIO);\r
+ if (aMesh->_is_nil() && aSubMesh->_is_nil())\r
+ return;\r
+\r
+ // Get geom object corresponding to the mesh\r
+ _PTR(SObject) aSO;\r
+ if (!aMesh->_is_nil())\r
+ aSO = SMESH::FindSObject(aMesh.in());\r
+ else\r
+ aSO = SMESH::FindSObject(aSubMesh.in());\r
+\r
+ GEOM::GEOM_Object_var aGeomObj = SMESH::GetGeom(aSO);\r
+ if (aGeomObj->_is_nil())\r
+ return;\r
+\r
+ myGeomObj = aGeomObj;\r
+\r
+ // init class fields\r
+ if (!aMesh->_is_nil()) {\r
+ myMesh = aMesh;\r
+ mySubMesh = SMESH::SMESH_subMesh::_nil();\r
+ } else {\r
+ mySubMesh = aSubMesh;\r
+ myMesh = SMESH::SMESH_Mesh::_nil();\r
+ }\r
+\r
+ QString aName;\r
+ SMESH::GetNameOfSelectedIObjects(mySelectionMgr, aName);\r
+ myMeshEdit->setText(aName);\r
+\r
+ if (myType == Type_2d) {\r
+ loadFromObject(true);\r
+ displayPreview();\r
+ }\r
+ } catch (...) {\r
+ myMesh = SMESH::SMESH_Mesh::_nil();\r
+ mySubMesh = SMESH::SMESH_subMesh::_nil();\r
+ myGeomObj = GEOM::GEOM_Object::_nil();\r
+ erasePreview();\r
+ }\r
+}\r
+\r
+//=======================================================================\r
+// function : onDeactivate()\r
+// purpose : SLOT called when dialog must be deativated\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::onDeactivate()\r
+{\r
+ disconnect(mySelectionMgr, 0, this, 0);\r
+ setEnabled(false);\r
+}\r
+\r
+//=======================================================================\r
+// function : enterEvent()\r
+// purpose : Event filter\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::enterEvent (QEvent*)\r
+{\r
+ mySMESHGUI->EmitSignalDeactivateDialog();\r
+ setEnabled(true);\r
+ activateSelection();\r
+ connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));\r
+}\r
+\r
+//=================================================================================\r
+// function : closeEvent()\r
+// purpose : Close dialog box\r
+//=================================================================================\r
+void SMESHGUI_CreatePatternDlg::closeEvent (QCloseEvent*)\r
+{\r
+ onClose();\r
+}\r
+\r
+//=======================================================================\r
+// function : onSelBtnClicked()\r
+// purpose : SLOT. Called when -> button clicked.\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::onSelBtnClicked()\r
+{\r
+ onSelectionDone();\r
+}\r
+\r
+//================================================================\r
+// function : autoExtension()\r
+// purpose : Append extension to the file name\r
+//================================================================\r
+QString SMESHGUI_CreatePatternDlg::autoExtension (const QString& theFileName) const\r
+{\r
+ QString anExt = theFileName.section('.', -1);\r
+ return anExt != "smp" && anExt != "SMP" ? theFileName + ".smp" : theFileName;\r
+}\r
+\r
+//=======================================================================\r
+// function : displayPreview()\r
+// purpose : Display preview\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::displayPreview()\r
+{\r
+ // Redisplay preview in dialog\r
+ try {\r
+ if (!myIsLoaded) {\r
+ erasePreview();\r
+ } else {\r
+ SMESH::point_array_var pnts = myPattern->GetPoints();\r
+ SMESH::long_array_var keyPoints = myPattern->GetKeyPoints();\r
+ SMESH::array_of_long_array_var elemPoints = myPattern->GetElementPoints(false);\r
+\r
+ if (pnts->length() == 0 ||\r
+ keyPoints->length() == 0 ||\r
+ elemPoints->length() == 0) {\r
+ myIsLoaded = false;\r
+ erasePreview();\r
+ return;\r
+ }\r
+\r
+ PointVector aPoints (pnts->length());\r
+ QValueVector<int> aKeyPoints (keyPoints->length());\r
+ ConnectivityVector anElemPoints (elemPoints->length());\r
+\r
+ for (int i = 0, n = pnts->length(); i < n; i++)\r
+ aPoints[ i ] = pnts[ i ];\r
+\r
+ for (int i2 = 0, n2 = keyPoints->length(); i2 < n2; i2++)\r
+ aKeyPoints[ i2 ] = keyPoints[ i2 ];\r
+\r
+ for (int i3 = 0, n3 = elemPoints->length(); i3 < n3; i3++) {\r
+ QValueVector<int> aVec (elemPoints[ i3 ].length());\r
+ for (int i4 = 0, n4 = elemPoints[ i3 ].length(); i4 < n4; i4++)\r
+ aVec[ i4 ] = elemPoints[ i3 ][ i4 ];\r
+\r
+ anElemPoints[ i3 ] = aVec;\r
+ }\r
+\r
+ myPicture2d->SetPoints(aPoints, aKeyPoints, anElemPoints);\r
+ }\r
+\r
+ return;\r
+\r
+ } catch (const SALOME::SALOME_Exception& S_ex) {\r
+ SalomeApp_Tools::QtCatchCorbaException(S_ex);\r
+ } catch (...) {\r
+ }\r
+ erasePreview();\r
+}\r
+\r
+//=======================================================================\r
+// function : erasePreview()\r
+// purpose : Erase preview\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::erasePreview()\r
+{\r
+ // Erase preview in 2D viewer\r
+ myPicture2d->SetPoints(PointVector(), QValueVector<int>(), ConnectivityVector());\r
+}\r
+\r
+//=======================================================================\r
+// function : activateSelection()\r
+// purpose : Activate selection in accordance with current pattern type\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::activateSelection()\r
+{\r
+ mySelectionMgr->clearFilters();\r
+ //SUIT_Application::getDesktop()->setSelectionModes(ActorSelection);\r
+ myViewWindow->SetSelectionMode(ActorSelection);\r
+\r
+ if (myType == Type_2d) {\r
+ mySelectionMgr->installFilter(new SMESH_NumberFilter\r
+ ("SMESH", TopAbs_SHAPE, -1, TopAbs_FACE));\r
+ } else {\r
+ TColStd_MapOfInteger aTypes;\r
+ aTypes.Add(TopAbs_SHELL);\r
+ aTypes.Add(TopAbs_SOLID);\r
+ mySelectionMgr->installFilter(new SMESH_NumberFilter\r
+ ("SMESH", TopAbs_FACE, 6, aTypes, GEOM::GEOM_Object::_nil(), true));\r
+ }\r
+}\r
+\r
+//=======================================================================\r
+// function : onTypeChanged()\r
+// purpose : SLOT. Called when pattern type changed.\r
+// Change dialog's look and feel\r
+//=======================================================================\r
+void SMESHGUI_CreatePatternDlg::onTypeChanged (int theType)\r
+{\r
+ if (myType == theType)\r
+ return;\r
+\r
+ myType = theType;\r
+\r
+ if (theType == Type_2d)\r
+ myPicture2d->show();\r
+ else\r
+ myPicture2d->hide();\r
+}\r
Q_OBJECT
public:
- SMESHGUI_DeleteGroupDlg (SMESHGUI* theModule);
+ SMESHGUI_DeleteGroupDlg( SMESHGUI* );
virtual ~SMESHGUI_DeleteGroupDlg();
void Init ();
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
{
- QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+ QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
if (!name)
setName("SMESHGUI_EditHypothesesDlg");
setCaption(tr("SMESH_EDIT_HYPOTHESES"));
myViewWindow( SMESH::GetViewWindow( theModule ) ),
mySelector( myViewWindow->GetSelector() )
{
- QPixmap edgeImage (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
- QPixmap faceImage (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
- QPixmap selectImage (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
- QPixmap addImage (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_APPEND")));
- QPixmap removeImage (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_REMOVE")));
+ SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
+ QPixmap edgeImage ( mgr->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
+ QPixmap faceImage ( mgr->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
+ QPixmap selectImage ( mgr->loadPixmap("SMESH", tr("ICON_SELECT")));
+ QPixmap addImage ( mgr->loadPixmap("SMESH", tr("ICON_APPEND")));
+ QPixmap removeImage ( mgr->loadPixmap("SMESH", tr("ICON_REMOVE")));
myType = -1;
myViewWindow( SMESH::GetViewWindow( theModule ) ),
mySelector( myViewWindow->GetSelector() )
{
- QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
- QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
- QPixmap image2 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+ QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
+ QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
+ QPixmap image2 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
resize(303, 185);
setCaption(tr("EXTRUSION_ALONG_LINE"));
aCriteria->length(n);
long aPrecision = -1;
- SUIT_ResourceMgr* mgr = SMESHGUI::resourceMgr();
+ SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
if (mgr && mgr->hasValue("SMESH", "ControlsPrecision")) {
QString aStr = mgr->stringValue("SMESH", "ControlsPrecision");
myCreate = create;
myCurrentLineEdit = 0;
- QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+ QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
if (create)
setCaption(tr("SMESH_CREATE_GROUP_TITLE"));
myElements->clear();
- if (aNbSel == 0 ) {
+ if (aNbSel != 1 ) {
myGroup = SMESH::SMESH_Group::_nil();
myMesh = SMESH::SMESH_Mesh::_nil();
myIsBusy = false;
return;
} else if (myCurrentLineEdit == myGeomGroupLine) {
- if (aNbSel == 0) {
+ if (aNbSel != 1) {
myGeomGroup = GEOM::GEOM_Object::_nil();
myIsBusy = false;
return;
#include "SMESHGUI.h"
#include "SMESHGUI_Utils.h"
+#include "SMESHGUI_VTKUtils.h"
#include "SMESH_TypeFilter.hxx"
#include "SalomeApp_SelectionMgr.h"
#include "SVTK_Selection.h"
+#include "SVTK_ViewWindow.h"
+#include "SVTK_Selector.h"
#include "SALOME_ListIO.hxx"
// QT Includes
// name : SMESHGUI_GroupOpDlg::SMESHGUI_GroupOpDlg
// Purpose : Constructor
//=======================================================================
-SMESHGUI_GroupOpDlg::SMESHGUI_GroupOpDlg (QWidget* theParent,
- SalomeApp_SelectionMgr* theSelection,
- const int theMode)
- : QDialog(theParent, "SMESHGUI_GroupOpDlg", false,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+SMESHGUI_GroupOpDlg::SMESHGUI_GroupOpDlg( SMESHGUI* theModule, const int theMode )
+ : QDialog( SMESH::GetDesktop( theModule ), "SMESHGUI_GroupOpDlg", false,
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
+ mySMESHGUI( theModule ),
+ mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+ myViewWindow( SMESH::GetViewWindow( theModule ) ),
+ mySelector( myViewWindow->GetSelector() )
{
myMode = theMode;
aDlgLay->setStretchFactor(aMainFrame, 1);
- Init(theSelection);
+ Init();
}
//=======================================================================
myEdit1->setReadOnly(true);
myEdit2->setReadOnly(true);
- QPixmap aPix (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+ QPixmap aPix (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
myBtn1->setPixmap(aPix);
myBtn2->setPixmap(aPix);
// name : SMESHGUI_GroupOpDlg::Init
// Purpose : Init dialog fields, connect signals and slots, show dialog
//=======================================================================
-void SMESHGUI_GroupOpDlg::Init (SalomeApp_SelectionMgr* theSelection)
+void SMESHGUI_GroupOpDlg::Init()
{
- mySelectionMgr = theSelection;
- SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();
- aSMESHGUI->SetActiveDialogBox((QDialog*)this);
+ mySMESHGUI->SetActiveDialogBox((QDialog*)this);
myFocusWg = myEdit1;
myGroup1 = SMESH::SMESH_GroupBase::_nil();
// selection and SMESHGUI
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone()));
- connect(aSMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
- connect(aSMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(ClickOnClose()));
+ connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
+ connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(ClickOnClose()));
connect(myBtn1, SIGNAL(clicked()), this, SLOT(onFocusChanged()));
connect(myBtn2, SIGNAL(clicked()), this, SLOT(onFocusChanged()));
int x, y;
- aSMESHGUI->DefineDlgPosition(this, x, y);
+ mySMESHGUI->DefineDlgPosition(this, x, y);
this->move(x, y);
this->show();
// set selection mode
-#ifdef NEW_GUI
- mySelectionMgr->setSelectionModes(ActorSelection, true);
-#else
- mySelectionMgr->setSelectionModes(ActorSelection);
-#endif
+ myViewWindow->SetSelectionMode(ActorSelection);
mySelectionMgr->installFilter(new SMESH_TypeFilter (GROUP));
return;
//=======================================================================
bool SMESHGUI_GroupOpDlg::onApply()
{
- if (!isValid() || SMESHGUI::GetSMESHGUI()->isActiveStudyLocked())
+ if (!isValid() || mySMESHGUI->isActiveStudyLocked())
return false;
SMESH::SMESH_Mesh_ptr aMesh = myGroup1->GetMesh();
else aNewGrp = aMesh->CutGroups(myGroup1, myGroup2, aName.latin1());
if (!aNewGrp->_is_nil()) {
- SMESHGUI::GetSMESHGUI()->updateObjBrowser(true);
+ mySMESHGUI->updateObjBrowser(true);
reset();
return true;
} else {
//=======================================================================
void SMESHGUI_GroupOpDlg::onClose()
{
- mySelectionMgr->setSelectionModes(ActorSelection);
+ myViewWindow->SetSelectionMode(ActorSelection);
disconnect(mySelectionMgr, 0, this, 0);
- disconnect(SMESHGUI::GetSMESHGUI(), 0, this, 0);
- SMESHGUI::GetSMESHGUI()->ResetState();
+ disconnect(mySMESHGUI, 0, this, 0);
+ mySMESHGUI->ResetState();
mySelectionMgr->clearFilters();
reject();
}
//=======================================================================
void SMESHGUI_GroupOpDlg::enterEvent (QEvent*)
{
- SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
+ mySMESHGUI->EmitSignalDeactivateDialog();
setEnabled(true);
-#ifdef NEW_GUI
- mySelectionMgr->setSelectionModes(ActorSelection, true);
-#else
- mySelectionMgr->setSelectionModes(ActorSelection);
-#endif
+ myViewWindow->SetSelectionMode(ActorSelection);
mySelectionMgr->installFilter(new SMESH_TypeFilter (GROUP));
}
class QPushButton;
class SalomeApp_SelectionMgr;
class QLineEdit;
+class SMESHGUI;
+class SVTK_ViewWindow;
+class SVTK_Selector;
/*
Class : SMESHGUI_GroupOpDlg
enum { UNION, INTERSECT, CUT };
public:
- SMESHGUI_GroupOpDlg( QWidget*, SalomeApp_SelectionMgr*, const int );
+ SMESHGUI_GroupOpDlg( SMESHGUI*, const int );
virtual ~SMESHGUI_GroupOpDlg();
- void Init( SalomeApp_SelectionMgr* ) ;
+ void Init();
private:
QPushButton* myBtn1;
QPushButton* myBtn2;
+ SMESHGUI* mySMESHGUI;
SalomeApp_SelectionMgr* mySelectionMgr;
int myMode;
+ SVTK_ViewWindow* myViewWindow;
+ SVTK_Selector* mySelector;
QLineEdit* myFocusWg;
mySMESHGUI( theModule ),
mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
{
- QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+ QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
if (!name)
setName("SMESHGUI_InitMeshDlg");
myViewWindow( SMESH::GetViewWindow( theModule ) ),
mySelector( myViewWindow->GetSelector() )
{
- QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_MERGE_NODES")));
- QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+ QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_MERGE_NODES")));
+ QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
if (!name)
setName("SMESHGUI_MergeNodesDlg");
myActor = 0;
- mySMESHGUI = SMESHGUI::GetSMESHGUI();
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
myMeshOrSubMeshFilter = new SMESH_TypeFilter (MESHorSUBMESH);
aTopLayout->setSpacing(6); aTopLayout->setMargin(11);
// select button & label
- QPixmap image0(SMESHGUI::resourceMgr()->loadPixmap("SMESH",tr("ICON_SELECT")));
+ QPixmap image0(SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH",tr("ICON_SELECT")));
mySelectBtn = new QPushButton(this, "mySelectBtn");
mySelectBtn->setPixmap(image0);
mySelectBtn->setSizePolicy(QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed));
//=======================================================================
QFrame* SMESHGUI_MeshPatternDlg::createMainFrame (QWidget* theParent)
{
- QPixmap iconSlct (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
- QPixmap icon2d (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_PATTERN_2d")));
- QPixmap icon3d (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_PATTERN_3d")));
- QPixmap iconOpen (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_FILE_OPEN")));
+ SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
+ QPixmap iconSlct ( mgr->loadPixmap("SMESH", tr("ICON_SELECT")));
+ QPixmap icon2d ( mgr->loadPixmap("SMESH", tr("ICON_PATTERN_2d")));
+ QPixmap icon3d ( mgr->loadPixmap("SMESH", tr("ICON_PATTERN_3d")));
+ QPixmap iconOpen ( mgr->loadPixmap("SMESH", tr("ICON_FILE_OPEN")));
- QPixmap iconSample2d (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_PATTERN_SAMPLE_2D")));
- QPixmap iconSample3d (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_PATTERN_SAMPLE_3D")));
+ QPixmap iconSample2d ( mgr->loadPixmap("SMESH", tr("ICON_PATTERN_SAMPLE_2D")));
+ QPixmap iconSample3d ( mgr->loadPixmap("SMESH", tr("ICON_PATTERN_SAMPLE_3D")));
QGroupBox* aMainGrp = new QGroupBox (1, Qt::Horizontal, theParent);
aMainGrp->setFrameStyle(QFrame::NoFrame);
bool toCreatePolyedrs = myCreatePolyedrsChk->isChecked();
if ( myPattern->MakeMesh( myMesh, toCreatePolygons, toCreatePolyedrs ) ) {
mySelectionMgr->clearSelected();
- SUIT_ResourceMgr* mgr = SMESHGUI::resourceMgr();
+ SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
bool autoUpdate = false;
if (mgr && mgr->stringValue("SMESH", "AutomaticUpdate").compare("true") == 0)
autoUpdate = true;
{
QFrame* aFrame = new QFrame(theParent);
- QPixmap iconMoveNode (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_MOVE_NODE")));
- QPixmap iconSelect (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+ QPixmap iconMoveNode (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_MOVE_NODE")));
+ QPixmap iconSelect (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
QButtonGroup* aPixGrp = new QButtonGroup(1, Qt::Vertical, tr("MESH_NODE"), aFrame);
aPixGrp->setExclusive(TRUE);
aMainGrp->setFrameStyle(QFrame::NoFrame);
aMainGrp->setInsideMargin(0);
- QPixmap aPix (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+ QPixmap aPix (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
// "Selected cells" group
mySelGrp = new QGroupBox(1, Qt::Horizontal, aMainGrp);
{
mySimulation = new SMESH::TNodeSimulation(myViewWindow);
- QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_NODE")));
+ QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_NODE")));
if (!name)
setName("SMESHGUI_NodesDlg");
resize(303, 185);
#include "SMESHGUI.h"
#include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_Utils.h"
+#include "SUIT_Desktop.h"
#include "SUIT_ResourceMgr.h"
#include <qgroupbox.h>
// name : SMESHGUI_PrecisionDlg::SMESHGUI_PrecisionDlg
// Purpose : Constructor
//=======================================================================
-SMESHGUI_PrecisionDlg::SMESHGUI_PrecisionDlg (QWidget* theParent)
- : QDialog(theParent, "SMESHGUI_PrecisionDlg", true,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+SMESHGUI_PrecisionDlg::SMESHGUI_PrecisionDlg ( SMESHGUI* theModule )
+ : QDialog( SMESH::GetDesktop( theModule ), "SMESHGUI_PrecisionDlg", true,
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
+ mySMESHGUI( theModule )
{
setCaption(tr("CAPTION"));
{
bool isOk = false;
int aVal = DEFAULT_VAL;
- SUIT_ResourceMgr* mgr = SMESHGUI::resourceMgr();
+ SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
if (mgr && mgr->hasValue("SMESH", "ControlsPrecision")) {
QString aStr = mgr->stringValue("SMESH", "ControlsPrecision");
aVal = aStr.toInt(&isOk);
onNotUse();
- SMESHGUI* aSMESHGUI = SMESHGUI::GetSMESHGUI();
- aSMESHGUI->SetActiveDialogBox((QDialog*)this);
- connect(aSMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
+ mySMESHGUI->SetActiveDialogBox((QDialog*)this);
+ connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose()));
}
//=======================================================================
//=======================================================================
void SMESHGUI_PrecisionDlg::onOk()
{
- SUIT_ResourceMgr* mgr = SMESHGUI::resourceMgr();
+ SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
if (myNotUseChk->isChecked()) {
if (mgr) {
mgr->remove("SMESH", "ControlsPrecision");
SMESH::SetControlsPrecision(aVal);
}
- disconnect(SMESHGUI::GetSMESHGUI(), 0, this, 0);
- SMESHGUI::GetSMESHGUI()->ResetState() ;
+ disconnect(mySMESHGUI, 0, this, 0);
+ mySMESHGUI->ResetState() ;
accept();
}
//=======================================================================
void SMESHGUI_PrecisionDlg::onClose()
{
- disconnect(SMESHGUI::GetSMESHGUI(), 0, this, 0);
+ disconnect( mySMESHGUI, 0, this, 0);
reject();
}
class QPushButton;
class QCheckBox;
class QFrame;
+class SMESHGUI;
/*
Class : SMESHGUI_PrecisionDlg
Q_OBJECT
public:
- SMESHGUI_PrecisionDlg( QWidget* parent );
+ SMESHGUI_PrecisionDlg( SMESHGUI* );
virtual ~SMESHGUI_PrecisionDlg();
void closeEvent( QCloseEvent* );
private:
-
+ SMESHGUI* mySMESHGUI;
QSpinBox* mySpinBox;
QPushButton* myOKBtn;
QPushButton* myCancelBtn;
#include "SMESHGUI_Preferences_ColorDlg.h"
#include "SMESHGUI.h"
+#include "SMESHGUI_Utils.h"
#include "utilities.h"
#include <qspinbox.h>
#include <qcolor.h>
+#include "SUIT_Desktop.h"
+
using namespace std;
//=================================================================================
// The dialog will by default be modeless, unless you
// set'modal' to TRUE to construct a modal dialog.
//=================================================================================
-SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg (QWidget* parent,
- const char* name)
- : QDialog(parent, name, true, WStyle_Customize |
- WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+SMESHGUI_Preferences_ColorDlg::SMESHGUI_Preferences_ColorDlg( SMESHGUI* theModule, const char* name)
+ : QDialog( SMESH::GetDesktop( theModule ), name, true, WStyle_Customize |
+ WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
+ mySMESHGUI( theModule )
{
if (!name)
setName("SMESHGUI_Preferences_ColorDlg");
//=================================================================================
void SMESHGUI_Preferences_ColorDlg::Init()
{
- mySMESHGUI = SMESHGUI::GetSMESHGUI();
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
/* signals and slots connections */
Q_OBJECT
public:
- SMESHGUI_Preferences_ColorDlg( QWidget* parent = 0, const char* name = 0 );
+ SMESHGUI_Preferences_ColorDlg( SMESHGUI*, const char* name = 0 );
~SMESHGUI_Preferences_ColorDlg();
void SetColor(int type, QColor color);
#include "SMESHGUI.h"
#include "SMESHGUI_VTKUtils.h"
+#include "SMESHGUI_Utils.h"
#include "SMESH_Actor.h"
+#include "SUIT_Desktop.h"
#include "SUIT_ResourceMgr.h"
#include "SalomeApp_SelectionMgr.h"
* Gets the only instance of "Scalar Bar Properties" dialog box
*/
//=================================================================================================
-void SMESHGUI_Preferences_ScalarBarDlg::ScalarBarProperties (QWidget* parent,
- SalomeApp_SelectionMgr* Sel)
+void SMESHGUI_Preferences_ScalarBarDlg::ScalarBarProperties( SMESHGUI* theModule )
{
if (!myDlg) {
- myDlg = new SMESHGUI_Preferences_ScalarBarDlg (parent, Sel, false);
+ myDlg = new SMESHGUI_Preferences_ScalarBarDlg( theModule, false);
myDlg->show();
} else {
myDlg->show();
* Opens "Scalar Bar Preferences" dialog box
*/
//=================================================================================================
-void SMESHGUI_Preferences_ScalarBarDlg::ScalarBarPreferences (QWidget* parent)
+void SMESHGUI_Preferences_ScalarBarDlg::ScalarBarPreferences( SMESHGUI* theModule )
{
SMESHGUI_Preferences_ScalarBarDlg* aDlg =
- new SMESHGUI_Preferences_ScalarBarDlg (parent, 0, true);
+ new SMESHGUI_Preferences_ScalarBarDlg( theModule, true);
aDlg->exec();
}
* Constructor
*/
//=================================================================================================
-SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg (QWidget* parent,
- SalomeApp_SelectionMgr* Sel,
- bool modal)
- : QDialog(parent, 0, modal, WStyle_Customize | WStyle_NormalBorder |
- WStyle_Title | WStyle_SysMenu | WDestructiveClose)
+SMESHGUI_Preferences_ScalarBarDlg::SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI* theModule, bool property, bool modal )
+ : QDialog( SMESH::GetDesktop( theModule ), 0, modal, WStyle_Customize | WStyle_NormalBorder |
+ WStyle_Title | WStyle_SysMenu | WDestructiveClose ),
+ mySMESHGUI( theModule ),
+ mySelectionMgr( property ? SMESH::GetSelectionMgr( theModule ) : 0 )
{
setName("SMESHGUI_Preferences_ScalarBarDlg");
- setCaption(Sel ? tr("SMESH_PROPERTIES_SCALARBAR") : tr("SMESH_PREFERENCES_SCALARBAR"));
+ setCaption( property ? tr("SMESH_PROPERTIES_SCALARBAR") : tr("SMESH_PREFERENCES_SCALARBAR"));
setSizeGripEnabled(TRUE);
- mySelectionMgr = Sel;
myActor = 0;
/******************************************************************************/
/***************************************************************/
// Init
// --> first init from preferences
- SUIT_ResourceMgr* mgr = SMESHGUI::resourceMgr();
+ SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
QColor titleColor (255, 255, 255);
if (mgr && mgr->hasValue("SMESH", "ScalarBarTitleColor")) {
connect( myApplyBtn, SIGNAL( clicked() ), this, SLOT( onApply() ) );
connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ), this, SLOT( onSelectionChanged() ) );
}
- connect( SMESHGUI::GetSMESHGUI(), SIGNAL( SignalCloseAllDialogs() ), this, SLOT( onCancel() ) ) ;
+ connect( mySMESHGUI, SIGNAL( SignalCloseAllDialogs() ), this, SLOT( onCancel() ) ) ;
}
//=================================================================================================
SMESH::RepaintCurrentView();
} else {
// Scalar Bar preferences
- SUIT_ResourceMgr* mgr = SMESHGUI::resourceMgr();
+ SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
if (!mgr) return false;
QColor titleColor = myTitleColorBtn->paletteBackgroundColor();
class QToolButton;
class QRadioButton;
class QSpinBox;
+class SMESHGUI;
class QtxDblSpinBox;
public:
~SMESHGUI_Preferences_ScalarBarDlg();
- static void ScalarBarPreferences( QWidget* parent );
- static void ScalarBarProperties ( QWidget* parent, SalomeApp_SelectionMgr* Sel );
+ static void ScalarBarPreferences( SMESHGUI* );
+ static void ScalarBarProperties ( SMESHGUI* );
protected:
- SMESHGUI_Preferences_ScalarBarDlg( QWidget* parent = 0, SalomeApp_SelectionMgr* Sel = 0, bool modal = FALSE );
+ SMESHGUI_Preferences_ScalarBarDlg( SMESHGUI*, bool, bool modal = FALSE );
static SMESHGUI_Preferences_ScalarBarDlg* myDlg;
void closeEvent( QCloseEvent* e );
void setOriginAndSize( const double x, const double y, const double w, const double h );
void onOrientationChanged();
private:
+ SMESHGUI* mySMESHGUI;
SalomeApp_SelectionMgr* mySelectionMgr;
SMESH_Actor* myActor;
double myIniX, myIniY, myIniW, myIniH;
#include "SMESHGUI_Preferences_SelectionDlg.h"
#include "SMESHGUI.h"
+#include "SMESHGUI_Utils.h"
+
+#include "SUIT_Desktop.h"
+
#include <qgroupbox.h>
#include <qlayout.h>
#include <qlabel.h>
// class : SMESHGUI_Preferences_SelectionDlg()
// purpose :
//=================================================================================
-SMESHGUI_Preferences_SelectionDlg::SMESHGUI_Preferences_SelectionDlg( QWidget* parent, const char* name )
- : QDialog( parent, name, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
+SMESHGUI_Preferences_SelectionDlg::SMESHGUI_Preferences_SelectionDlg( SMESHGUI* theModule, const char* name )
+ : QDialog( SMESH::GetDesktop( theModule ), name, true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
+ mySMESHGUI( theModule )
{
if ( !name ) setName( "SMESHGUI_Preferences_SelectionDlg" );
setCaption( tr( "SMESH_PREF_SELECTION" ) );
/* Move widget on the botton right corner of main widget */
int x, y ;
- SMESHGUI::GetSMESHGUI()->DefineDlgPosition(this, x, y);
+ mySMESHGUI->DefineDlgPosition(this, x, y);
this->move(x, y);
}
class QPushButton;
class QSpinBox;
class QColor;
+class SMESHGUI;
class SMESHGUI_LineEdit : public QLineEdit
{
Q_OBJECT
public:
- SMESHGUI_Preferences_SelectionDlg( QWidget* parent = 0, const char* name = 0 );
+ SMESHGUI_Preferences_SelectionDlg( SMESHGUI*, const char* name = 0 );
~SMESHGUI_Preferences_SelectionDlg();
void SetColor(int type, QColor color);
void onSelectColor();
private:
+ SMESHGUI* mySMESHGUI;
QPushButton* myColor[3];
QSpinBox* myWidth[2];
QLineEdit* myPrecision[2];
mySMESHGUI(theModule),
myBusy(false)
{
- QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_REM_ELEMENT")));
- QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+ QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_REM_ELEMENT")));
+ QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
if (!name)
setName("SMESHGUI_RemoveElementsDlg");
mySMESHGUI(theModule),
myBusy(false)
{
- QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_REM_NODE")));
- QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+ QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_REM_NODE")));
+ QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
if (!name)
setName("SMESHGUI_RemoveNodesDlg");
#include "SMESH_TypeFilter.hxx"
#include "SMDS_Mesh.hxx"
+#include "SUIT_Desktop.h"
#include "SUIT_Session.h"
#include "SALOME_ListIO.hxx"
// class : SMESHGUI_RenumberingDlg()
// purpose :
//=================================================================================
-SMESHGUI_RenumberingDlg::SMESHGUI_RenumberingDlg (QWidget* parent, const char* name,
- SalomeApp_SelectionMgr* Sel,
+SMESHGUI_RenumberingDlg::SMESHGUI_RenumberingDlg( SMESHGUI* theModule, const char* name,
const int unit, bool modal, WFlags fl)
- : QDialog(parent, name, modal, WStyle_Customize | WStyle_NormalBorder |
- WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose)
+ : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
+ WStyle_Title | WStyle_SysMenu | Qt::WDestructiveClose),
+ mySMESHGUI( theModule ),
+ mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
{
myUnit = unit;
GroupMeshLayout->addWidget(LineEditMesh, 0, 2);
SMESHGUI_RenumberingDlgLayout->addWidget(GroupMesh, 1, 0);
- Init(Sel); /* Initialisations */
+ Init(); /* Initialisations */
}
//=================================================================================
// function : Init()
// purpose :
//=================================================================================
-void SMESHGUI_RenumberingDlg::Init (SalomeApp_SelectionMgr* Sel)
+void SMESHGUI_RenumberingDlg::Init()
{
GroupMesh->show();
myConstructorId = 0;
Constructor1->setChecked(TRUE);
- mySelectionMgr = Sel;
- mySMESHGUI = SMESHGUI::GetSMESHGUI();
mySMESHGUI->SetActiveDialogBox((QDialog*)this);
myMesh = SMESH::SMESH_Mesh::_nil();
Q_OBJECT
public:
- SMESHGUI_RenumberingDlg (QWidget* parent = 0,
+ SMESHGUI_RenumberingDlg( SMESHGUI*,
const char* name = 0,
- SalomeApp_SelectionMgr* Sel = 0,
const int unit = 0,
bool modal = FALSE,
WFlags fl = 0);
~SMESHGUI_RenumberingDlg();
private:
-
- void Init( SalomeApp_SelectionMgr* Sel ) ;
+ void Init();
void closeEvent( QCloseEvent* e ) ;
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
void hideEvent ( QHideEvent * ); /* ESC key */
myViewWindow( SMESH::GetViewWindow( theModule ) ),
mySelector( myViewWindow->GetSelector() )
{
- QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
- QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
- QPixmap image2 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+ SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
+ QPixmap image0 ( mgr->loadPixmap("SMESH", tr("ICON_DLG_EDGE")));
+ QPixmap image1 ( mgr->loadPixmap("SMESH", tr("ICON_DLG_TRIANGLE")));
+ QPixmap image2 ( mgr->loadPixmap("SMESH", tr("ICON_SELECT")));
if (!name)
setName("SMESHGUI_RevolutionDlg");
myViewWindow( SMESH::GetViewWindow( theModule ) ),
mySelector( myViewWindow->GetSelector() )
{
- QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_ROTATION")));
- QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+ QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_ROTATION")));
+ QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
if (!name)
setName("SMESHGUI_RotationDlg");
myViewWindow( SMESH::GetViewWindow( theModule ) ),
mySelector( myViewWindow->GetSelector() )
{
- QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_FREEBORDERS")));
- QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_CONFORM_FREEBORDERS")));
- QPixmap image2 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_BORDERTOSIDE")));
- QPixmap image3 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_SIDEELEMENTS")));
- QPixmap image4 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+ SUIT_ResourceMgr* mgr = SMESH::GetResourceMgr( mySMESHGUI );
+ QPixmap image0 (mgr->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_FREEBORDERS")));
+ QPixmap image1 (mgr->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_CONFORM_FREEBORDERS")));
+ QPixmap image2 (mgr->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_BORDERTOSIDE")));
+ QPixmap image3 (mgr->loadPixmap("SMESH", tr("ICON_SMESH_SEWING_SIDEELEMENTS")));
+ QPixmap image4 (mgr->loadPixmap("SMESH", tr("ICON_SELECT")));
if (!name)
setName("SMESHGUI_SewingDlg");
{
QGroupBox* aMainGrp = new QGroupBox(1, Qt::Vertical, tr("EDGE_BETWEEN"), theParent);
- QPixmap aPix (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+ QPixmap aPix (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
new QLabel(tr("SMESH_EDGE"), aMainGrp);
(new QPushButton(aMainGrp))->setPixmap(aPix);
myViewWindow( SMESH::GetViewWindow( theModule ) ),
mySelector( myViewWindow->GetSelector() )
{
- QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_DLG_SMOOTHING")));
- QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+ QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_DLG_SMOOTHING")));
+ QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
if (!name)
setName("SMESHGUI_SmoothingDlg");
#include "SALOMEDSClient_Study.hxx"
#include "SALOMEDSClient_SObject.hxx"
+#include "SUIT_Desktop.h"
#include "SUIT_Session.h"
#include "SUIT_OverrideCursor.h"
* Constructor
*/
//=================================================================================
-SMESHGUI_StandardMeshInfosDlg::SMESHGUI_StandardMeshInfosDlg (QWidget* parent, const char* name,
+SMESHGUI_StandardMeshInfosDlg::SMESHGUI_StandardMeshInfosDlg( SMESHGUI* theModule, const char* name,
bool modal, WFlags fl)
- : QDialog(parent, name, modal, WStyle_Customize | WStyle_NormalBorder |
- WStyle_Title | WStyle_SysMenu | WDestructiveClose)
+ : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
+ WStyle_Title | WStyle_SysMenu | WDestructiveClose),
+ mySMESHGUI( theModule ),
+ mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
{
if (!name)
setName("SMESHGUI_StandardMeshInfosDlg");
aDlgLayout->addWidget(myButtonsGroup, 2, 0);
- mySelectionMgr = SMESHGUI::selectionMgr();
- SMESHGUI::GetSMESHGUI()->SetActiveDialogBox(this);
+ mySMESHGUI->SetActiveDialogBox(this);
// connect signals
- connect(myOkBtn, SIGNAL(clicked()), this, SLOT(close()));
- connect(mySelectBtn, SIGNAL(clicked()), this, SLOT(onStartSelection()));
- connect(SMESHGUI::GetSMESHGUI(), SIGNAL(SignalCloseAllDialogs()), this, SLOT(close()));
- connect(SMESHGUI::GetSMESHGUI(), SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
- connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
+ connect( myOkBtn, SIGNAL(clicked()), this, SLOT(close()));
+ connect( mySelectBtn, SIGNAL(clicked()), this, SLOT(onStartSelection()));
+ connect( mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(close()));
+ connect( mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
+ connect( mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
// resize and move dialog, then show
this->setMinimumSize(270, 428);
int x, y;
- SMESHGUI::GetSMESHGUI()->DefineDlgPosition(this, x, y);
+ mySMESHGUI->DefineDlgPosition(this, x, y);
this->move(x, y);
this->show();
void SMESHGUI_StandardMeshInfosDlg::closeEvent (QCloseEvent* e)
{
mySelectionMgr->clearFilters();
- SMESHGUI::GetSMESHGUI()->ResetState();
+ mySMESHGUI->ResetState();
QDialog::closeEvent(e);
}
void SMESHGUI_StandardMeshInfosDlg::ActivateThisDialog()
{
/* Emit a signal to deactivate any active dialog */
- SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
+ mySMESHGUI->EmitSignalDeactivateDialog();
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
}
class QLineEdit;
class QTextBrowser;
class SalomeApp_SelectionMgr;
+class SMESHGUI;
+
class SMESHGUI_StandardMeshInfosDlg : public QDialog
{
Q_OBJECT
public:
- SMESHGUI_StandardMeshInfosDlg( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
+ SMESHGUI_StandardMeshInfosDlg( SMESHGUI*, const char* name = 0, bool modal = FALSE, WFlags fl = 0 );
~SMESHGUI_StandardMeshInfosDlg();
protected:
void onStartSelection();
private:
+ SMESHGUI* mySMESHGUI;
SalomeApp_SelectionMgr* mySelectionMgr;
bool myStartSelection;
bool myIsActiveWindow;
myViewWindow( SMESH::GetViewWindow( theModule ) ),
mySelector( myViewWindow->GetSelector() )
{
- QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_POINT")));
- QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_AXIS")));
- QPixmap image2 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_PLANE")));
- QPixmap image3 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+ QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_POINT")));
+ QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_AXIS")));
+ QPixmap image2 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_SYMMETRY_PLANE")));
+ QPixmap image3 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
if (!name)
setName("SMESHGUI_SymmetryDlg");
myViewWindow( SMESH::GetViewWindow( theModule ) ),
mySelector( myViewWindow->GetSelector() )
{
- QPixmap image0 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_TRANSLATION_POINTS")));
- QPixmap image1 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SMESH_TRANSLATION_VECTOR")));
- QPixmap image2 (SMESHGUI::resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT")));
+ QPixmap image0 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_TRANSLATION_POINTS")));
+ QPixmap image1 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SMESH_TRANSLATION_VECTOR")));
+ QPixmap image2 (SMESH::GetResourceMgr( mySMESHGUI )->loadPixmap("SMESH", tr("ICON_SELECT")));
if (!name)
setName("SMESHGUI_TranslationDlg");
#include "SMESHGUI.h"
#include "SMESHGUI_VTKUtils.h"
-
+#include "SMESHGUI_Utils.h"
#include "SMESH_Actor.h"
+#include "SUIT_Desktop.h"
#include "SUIT_OverrideCursor.h"
#include "SALOME_ListIO.hxx"
// purpose :
//
//=================================================================================
-SMESHGUI_TransparencyDlg::SMESHGUI_TransparencyDlg (QWidget* parent,
+SMESHGUI_TransparencyDlg::SMESHGUI_TransparencyDlg( SMESHGUI* theModule,
const char* name,
bool modal,
WFlags fl)
- : QDialog(parent, name, modal, WStyle_Customize | WStyle_NormalBorder |
- WStyle_Title | WStyle_SysMenu | WDestructiveClose)
+ : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder |
+ WStyle_Title | WStyle_SysMenu | WDestructiveClose ),
+ mySMESHGUI( theModule ),
+ mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ),
+ myViewWindow( SMESH::GetViewWindow( theModule ) )
{
if (!name)
setName("SMESHGUI_TransparencyDlg");
SMESHGUI_TransparencyDlgLayout->addWidget(GroupC1, 0, 0);
SMESHGUI_TransparencyDlgLayout->addWidget(GroupButtons, 1, 0);
- mySelectionMgr = SMESHGUI::selectionMgr();
-
// Initial state
this->onSelectionChanged();
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(Slider1, SIGNAL(valueChanged(int)), this, SLOT(SetTransparency()));
connect(Slider1, SIGNAL(sliderMoved(int)), this, SLOT(ValueHasChanged()));
- connect(SMESHGUI::GetSMESHGUI(), SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnOk()));
+ connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnOk()));
connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
/* Move widget on the botton right corner of main widget */
int x, y;
- SMESHGUI::GetSMESHGUI()->DefineDlgPosition(this, x, y);
+ mySMESHGUI->DefineDlgPosition(this, x, y);
this->move(x, y);
this->show();
}
//=================================================================================
void SMESHGUI_TransparencyDlg::SetTransparency()
{
- if (SVTK_ViewWindow* aVTKViewWindow = SMESH::GetCurrentVtkView()) {
+ if( myViewWindow ) {
SUIT_OverrideCursor wc;
float opacity = this->Slider1->value() / 100.;
if (anActor)
anActor->SetOpacity(opacity);
}
- aVTKViewWindow->Repaint();
+ myViewWindow->Repaint();
}
ValueHasChanged();
}
//=================================================================================
void SMESHGUI_TransparencyDlg::onSelectionChanged()
{
- if (SVTK_ViewWindow* aVTKViewWindow = SMESH::GetCurrentVtkView()) {
+ if( myViewWindow ) {
int opacity = 100;
SALOME_ListIO aList;
class QPushButton;
class QSlider;
class SalomeApp_SelectionMgr;
+class SVTK_Selector;
+class SVTK_ViewWindow;
+class SMESHGUI;
//=================================================================================
// class : SMESHGUI_TransparencyDlg
Q_OBJECT
public:
- SMESHGUI_TransparencyDlg( QWidget* parent = 0,
+ SMESHGUI_TransparencyDlg( SMESHGUI*,
const char* name = 0,
bool modal = false,
WFlags fl = 0 );
private :
- SalomeApp_SelectionMgr* mySelectionMgr;
+ SMESHGUI* mySMESHGUI;
+ SalomeApp_SelectionMgr* mySelectionMgr;
+ SVTK_ViewWindow* myViewWindow;
- QPushButton* buttonOk;
- QLabel* TextLabelOpaque;
- QLabel* ValueLab;
- QLabel* TextLabelTransparent;
- QSlider* Slider1;
+ QPushButton* buttonOk;
+ QLabel* TextLabelOpaque;
+ QLabel* ValueLab;
+ QLabel* TextLabelTransparent;
+ QSlider* Slider1;
public slots:
return theModule->getApp()->selectionMgr();
}
+ SUIT_ResourceMgr*
+ GetResourceMgr( const SalomeApp_Module* )
+ {
+ return SUIT_Session::session()->resourceMgr();
+ }
_PTR(Study)
GetCStudy(const SalomeApp_Study* theStudy)
class SUIT_ViewWindow;
class SUIT_Desktop;
class SUIT_Study;
+class SUIT_ResourceMgr;
class CAM_Module;
SalomeApp_Study*
GetAppStudy(const CAM_Module* theModule);
+ SUIT_ResourceMgr*
+ GetResourceMgr( const SalomeApp_Module* );
+
_PTR(Study)
GetCStudy(const SalomeApp_Study* theStudy);
#include "SMESHGUI_aParameter.h"
#include "SMESHGUI.h"
#include "SMESHGUI_SpinBox.h"
+#include "SMESHGUI_Utils.h"
#include "SUIT_Tools.h"
#include "SUIT_Desktop.h"
//
//======================================================================================
SMESHGUI_aParameterDlg::SMESHGUI_aParameterDlg
- (std::list<SMESHGUI_aParameterPtr> params,
- QWidget* parent,
+ ( SMESHGUI* theModule,
+ std::list<SMESHGUI_aParameterPtr> params,
QString title,
bool modal)
-: QDialog(parent, "MyParameterDialog", modal, WStyle_Customize |
- WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
- myParamList(params)
+: QDialog( SMESH::GetDesktop( theModule ), "MyParameterDialog", modal, WStyle_Customize |
+ WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu),
+ myParamList(params),
+ mySMESHGUI(theModule)
{
/* creating widgets */
init();
setCaption(title);
/* Move widget on the botton right corner of main widget */
- SUIT_Tools::centerWidget(this, parent);
+ SUIT_Tools::centerWidget(this, SMESH::GetDesktop( theModule ) );
}
//======================================================================================
/* signals and slots connections */
connect(myButtonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect(myButtonCancel, SIGNAL(clicked()), this, SLOT(reject()));
-
- /* Retrieve SMESHGUI */
- mySMESHGUI = SMESHGUI::GetSMESHGUI();
}
//======================================================================================
// function : Parameters()
// purpose : return a list of parameters from a dialog box
//=======================================================================
-bool SMESHGUI_aParameterDlg::Parameters (list<SMESHGUI_aParameterPtr> params,
+bool SMESHGUI_aParameterDlg::Parameters( SMESHGUI* theModule,
+ list<SMESHGUI_aParameterPtr> params,
const char *aTitle)
{
if (!params.empty()) {
SMESHGUI_aParameterDlg *Dialog =
- new SMESHGUI_aParameterDlg(params, SMESHGUI::desktop(), aTitle, TRUE);
+ new SMESHGUI_aParameterDlg( theModule, params, aTitle, TRUE);
return (Dialog->exec() == QDialog::Accepted);
}
return false;
Q_OBJECT
public:
- SMESHGUI_aParameterDlg (std::list<SMESHGUI_aParameterPtr> params,
- QWidget* parent = 0,
+ SMESHGUI_aParameterDlg( SMESHGUI*,
+ std::list<SMESHGUI_aParameterPtr> params,
QString title = QString::null,
bool modal = TRUE);
~SMESHGUI_aParameterDlg();
/* Parameter function */
- static bool Parameters (std::list<SMESHGUI_aParameterPtr> params, const char *aTitle);
+ static bool Parameters( SMESHGUI*, std::list<SMESHGUI_aParameterPtr> params, const char *aTitle);
protected:
void init();
StdMeshersGUI_Parameters::GetParameters( theHyp, paramList );
bool modified = false;
- if ( SMESHGUI_aParameterDlg::Parameters( paramList, QObject::tr("SMESH_VALUE")) )
+ if ( SMESHGUI_aParameterDlg::Parameters( SMESHGUI::GetSMESHGUI(), paramList, QObject::tr("SMESH_VALUE")) )
modified = StdMeshersGUI_Parameters::SetParameters( theHyp, paramList );
if ( modified ) {