#include <Standard_math.hxx>#include "Python.h"#include "SMESHGUI.h"#include "SMESHGUI_AddMeshElementDlg.h"#include "SMESHGUI_AddQuadraticElementDlg.h"#include "SMESHGUI_BuildCompoundDlg.h"#include "SMESHGUI_ClippingDlg.h"#include "SMESHGUI_ComputeDlg.h"#include "SMESHGUI_ConvToQuadOp.h"#include "SMESHGUI_CreatePolyhedralVolumeDlg.h"#include "SMESHGUI_DeleteGroupDlg.h"#include "SMESHGUI_Displayer.h"#include "SMESHGUI_MergeDlg.h"#include "SMESHGUI_ExtrusionAlongPathDlg.h"#include "SMESHGUI_ExtrusionDlg.h"#include "SMESHGUI_FileInfoDlg.h"#include "SMESHGUI_FileValidator.h"#include "SMESHGUI_FilterDlg.h"#include "SMESHGUI_FilterLibraryDlg.h"#include "SMESHGUI_FindElemByPointDlg.h"#include "SMESHGUI_GroupDlg.h"#include "SMESHGUI_GroupOnShapeDlg.h"#include "SMESHGUI_GroupOpDlg.h"#include "SMESHGUI_Hypotheses.h"#include "SMESHGUI_Make2DFrom3DOp.h"#include "SMESHGUI_MakeNodeAtPointDlg.h"#include "SMESHGUI_Measurements.h"#include "SMESHGUI_MeshInfo.h"#include "SMESHGUI_MeshOp.h"#include "SMESHGUI_MeshOrderOp.h"#include "SMESHGUI_MeshPatternDlg.h"#include "SMESHGUI_MultiEditDlg.h"#include "SMESHGUI_NodesDlg.h"#include "SMESHGUI_Preferences_ColorDlg.h"#include "SMESHGUI_Preferences_ScalarBarDlg.h"#include "SMESHGUI_RemoveElementsDlg.h"#include "SMESHGUI_RemoveNodesDlg.h"#include "SMESHGUI_RenumberingDlg.h"#include "SMESHGUI_RevolutionDlg.h"#include "SMESHGUI_RotationDlg.h"#include "SMESHGUI_Selection.h"#include "SMESHGUI_SewingDlg.h"#include "SMESHGUI_SingleEditDlg.h"#include "SMESHGUI_SmoothingDlg.h"#include "SMESHGUI_SymmetryDlg.h"#include "SMESHGUI_TranslationDlg.h"#include "SMESHGUI_ScaleDlg.h"#include "SMESHGUI_TransparencyDlg.h"#include "SMESHGUI_DuplicateNodesDlg.h"#include "SMESHGUI_CopyMeshDlg.h"#include "SMESHGUI_Utils.h"#include "SMESHGUI_MeshUtils.h"#include "SMESHGUI_GroupUtils.h"#include "SMESHGUI_FilterUtils.h"#include "SMESHGUI_PatternUtils.h"#include "SMESHGUI_VTKUtils.h"#include "SMESHGUI_HypothesesUtils.h"#include <SMESH_Client.hxx>#include <SMESH_Actor.h>#include <SMESH_ScalarBarActor.h>#include <SMESH_ActorUtils.h>#include <SMESH_TypeFilter.hxx>#include "SMESH_ControlsDef.hxx"#include <SalomeApp_Tools.h>#include <SalomeApp_Study.h>#include <SalomeApp_Application.h>#include <SalomeApp_CheckFileDlg.h>#include <LightApp_DataOwner.h>#include <LightApp_Preferences.h>#include <LightApp_SelectionMgr.h>#include <LightApp_UpdateFlags.h>#include <LightApp_NameDlg.h>#include <SVTK_ViewWindow.h>#include <SVTK_ViewModel.h>#include <SVTK_ViewManager.h>#include <VTKViewer_Algorithm.h>#include <SUIT_MessageBox.h>#include <SUIT_ResourceMgr.h>#include <SUIT_FileDlg.h>#include <SUIT_Desktop.h>#include <SUIT_OverrideCursor.h>#include <SUIT_Session.h>#include <QtxPopupMgr.h>#include <QtxFontEdit.h>#include <SALOME_ListIO.hxx>#include <SALOME_ListIteratorOfListIO.hxx>#include <SPlot2d_ViewModel.h>#include <SPlot2d_Histogram.h>#include <SALOMEconfig.h>#include <CORBA_CLIENT_HEADER(SALOMEDS_Attributes)>#include <CORBA_CLIENT_HEADER(SMESH_MeshEditor)>#include <CORBA_CLIENT_HEADER(SMESH_Measurements)>#include <QMenu>#include <QTextStream>#include <boost/shared_ptr.hpp>#include <vtkCamera.h>#include <vtkRenderer.h>#include <vtkPlane.h>#include <vtkCallbackCommand.h>#include <vtkLookupTable.h>#include <SALOMEDS_Study.hxx>#include <SALOMEDSClient_StudyBuilder.hxx>#include <SALOMEDSClient_SComponent.hxx>#include <SALOMEDSClient_ClientFactory.hxx>#include <SALOMEDSClient_IParameters.hxx>#include <Standard_ErrorHandler.hxx>#include <NCollection_DataMap.hxx>Go to the source code of this file.
Data Structures | |
| struct | TPlaneData |
| struct | TPlaneInfo |
Defines | |
| #define | WITHGENERICOBJ |
Typedefs | |
| typedef std::list< TPlaneData > | TPlaneDataList |
| typedef std::map< int, TPlaneDataList > | TPlaneDataMap |
| typedef std::list< vtkActor * > | TActorList |
| typedef std::list< TPlaneInfo > | TPlaneInfoList |
| typedef std::map< int, TPlaneInfoList > | TPlaneInfoMap |
Functions | |
| void | ImportMeshesFromFile (SMESH::SMESH_Gen_ptr theComponentMesh, int theCommandID) |
| void | ExportMeshToFile (int theCommandID) |
| void | SetDisplayMode (int theCommandID, SMESHGUI_StudyId2MarkerMap &theMarkerMap) |
| void | SetDisplayEntity (int theCommandID) |
| void | Control (int theCommandID) |
| void | InverseEntityMode (unsigned int &theOutputMode, unsigned int theMode) |
| void | AutoColor () |
| QString | functorToString (SMESH::Controls::FunctorPtr f) |
| void | SaveDistribution () |
| void | ShowDistribution () |
| void | PlotDistribution () |
| void | DisableAutoColor () |
| bool | CheckOIType (const Handle(SALOME_InteractiveObject)&theIO, MeshObjectType theType, const QString theInTypeName, QString &theOutTypeName) |
| QString | CheckTypeObject (const Handle(SALOME_InteractiveObject)&theIO) |
| QString | CheckHomogeneousSelection () |
| CAM_Module * | createModule () |
| Standard_EXPORT SMESHGUI * | GetComponentGUI () |
| static int | isStudyLocked (_PTR(Study) theStudy) |
| static bool | checkLock (_PTR(Study) theStudy) |
Variables | |
| const char | gSeparator = '_' |
| const char | gDigitsSep = ':' |
| const char | gPathSep = '|' |
| #define WITHGENERICOBJ |
Definition at line 165 of file SMESHGUI.cxx.
| typedef std::list<vtkActor*> TActorList |
Definition at line 5106 of file SMESHGUI.cxx.
| typedef std::list<TPlaneData> TPlaneDataList |
Definition at line 5103 of file SMESHGUI.cxx.
| typedef std::map<int, TPlaneDataList> TPlaneDataMap |
Definition at line 5104 of file SMESHGUI.cxx.
| typedef std::list<TPlaneInfo> TPlaneInfoList |
Definition at line 5112 of file SMESHGUI.cxx.
| typedef std::map<int, TPlaneInfoList> TPlaneInfoMap |
Definition at line 5113 of file SMESHGUI.cxx.
| void AutoColor | ( | ) |
Definition at line 695 of file SMESHGUI.cxx.
References _PTR(), SMESH.EDGE, SMESH.ELEM0D, SMESH.FindActorByEntry(), Handle(), SMESH.NODE, and SMESH.RepaintCurrentView().
Referenced by SMESHGUI.OnGUIEvent().
{
SALOME_ListIO selected;
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
if( !app )
return;
LightApp_SelectionMgr* aSel = app->selectionMgr();
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
if( !aSel || !appStudy )
return;
aSel->selectedObjects( selected );
if( selected.IsEmpty() )
return;
Handle(SALOME_InteractiveObject) anIObject = selected.First();
_PTR(Study) aStudy = appStudy->studyDS();
_PTR(SObject) aMainSObject( aStudy->FindObjectID( anIObject->getEntry() ) );
SMESH::SMESH_Mesh_var aMainObject = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject);
if( aMainObject->_is_nil() )
return;
aMainObject->SetAutoColor( true ); // mesh groups are re-colored here
SMESH::ListOfGroups aListOfGroups = *aMainObject->GetGroups();
for( int i = 0, n = aListOfGroups.length(); i < n; i++ )
{
SMESH::SMESH_GroupBase_var aGroupObject = aListOfGroups[i];
SALOMEDS::Color aColor = aGroupObject->GetColor();
_PTR(SObject) aGroupSObject = SMESH::FindSObject(aGroupObject);
if (aGroupSObject) {
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(aGroupSObject->GetID().c_str())) {
if( aGroupObject->GetType() == SMESH::NODE )
anActor->SetNodeColor( aColor.R, aColor.G, aColor.B );
else if( aGroupObject->GetType() == SMESH::EDGE )
anActor->SetEdgeColor( aColor.R, aColor.G, aColor.B );
else if( aGroupObject->GetType() == SMESH::ELEM0D )
anActor->Set0DColor( aColor.R, aColor.G, aColor.B );
else
anActor->SetSufaceColor( aColor.R, aColor.G, aColor.B );
}
}
}
SMESH::RepaintCurrentView();
}
| QString CheckHomogeneousSelection | ( | ) |
Definition at line 1349 of file SMESHGUI.cxx.
References CheckTypeObject(), Handle(), and SMESHGUI.selectionMgr().
{
//SUIT_Study* aStudy = SMESH::GetActiveStudy();
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
SALOME_ListIO selected;
if( aSel )
aSel->selectedObjects( selected );
QString RefType = CheckTypeObject(selected.First());
SALOME_ListIteratorOfListIO It(selected);
for ( ; It.More(); It.Next())
{
Handle(SALOME_InteractiveObject) IObject = It.Value();
QString Type = CheckTypeObject(IObject);
if (Type.compare(RefType) != 0)
return "Heterogeneous Selection";
}
return RefType;
}
| static bool checkLock | ( | _PTR(Study) | theStudy | ) | [static] |
Definition at line 1828 of file SMESHGUI.cxx.
References SMESHGUI.desktop(), and isStudyLocked().
Referenced by SMESHGUI.isActiveStudyLocked(), and SMESHGUI.OnGUIEvent().
{
if (isStudyLocked(theStudy)) {
SUIT_MessageBox::warning( SMESHGUI::desktop(),
QObject::tr("WRN_WARNING"),
QObject::tr("WRN_STUDY_LOCKED") );
return true;
}
return false;
}
| bool CheckOIType | ( | const Handle(SALOME_InteractiveObject)& | theIO, |
| MeshObjectType | theType, | ||
| const QString | theInTypeName, | ||
| QString & | theOutTypeName | ||
| ) |
Definition at line 1304 of file SMESHGUI.cxx.
References SMESH_TypeFilter.isOk().
Referenced by CheckTypeObject().
{
SMESH_TypeFilter aTypeFilter( theType );
QString entry;
if( !theIO.IsNull() )
{
entry = theIO->getEntry();
LightApp_DataOwner owner( entry );
if ( aTypeFilter.isOk( &owner )) {
theOutTypeName = theInTypeName;
return true;
}
}
return false;
}
| QString CheckTypeObject | ( | const Handle(SALOME_InteractiveObject)& | theIO | ) |
Definition at line 1324 of file SMESHGUI.cxx.
References _PTR(), ALGORITHM, CheckOIType(), GROUP, HYPOTHESIS, and SUBMESH.
Referenced by CheckHomogeneousSelection(), and SMESHGUI.OnEditDelete().
{
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
_PTR(SObject) aSObj = aStudy->FindObjectID(theIO->getEntry());
if (aSObj) {
_PTR(SComponent) aSComp = aSObj->GetFatherComponent();
CORBA::String_var anID = aSComp->GetID().c_str();
if (!strcmp(anID.in(),theIO->getEntry()))
return "Component";
}
QString aTypeName;
if (
CheckOIType ( theIO, HYPOTHESIS, "Hypothesis", aTypeName ) ||
CheckOIType ( theIO, ALGORITHM, "Algorithm", aTypeName ) ||
CheckOIType ( theIO, MESH, "Mesh", aTypeName ) ||
CheckOIType ( theIO, SUBMESH, "SubMesh", aTypeName ) ||
CheckOIType ( theIO, GROUP, "Group", aTypeName )
)
return aTypeName;
return "NoType";
}
| void Control | ( | int | theCommandID | ) |
Definition at line 1204 of file SMESHGUI.cxx.
References SMESH_Actor.eArea, SMESH_Actor.eAspectRatio, SMESH_Actor.eAspectRatio3D, SMESH_Actor.eBareBorderFace, SMESH_Actor.eBareBorderVolume, SMESH_Actor.eFreeBorders, SMESH_Actor.eFreeEdges, SMESH_Actor.eFreeFaces, SMESH_Actor.eFreeNodes, SMESH_Actor.eLength, SMESH_Actor.eLength2D, SMESH_Actor.eMaxElementLength2D, SMESH_Actor.eMaxElementLength3D, SMESH_Actor.eMinimumAngle, SMESH_Actor.eMultiConnection, SMESH_Actor.eMultiConnection2D, SMESH_Actor.eNone, SMESH_Actor.eOverConstrainedFace, SMESH_Actor.eOverConstrainedVolume, SMESH_Actor.eSkew, SMESH_Actor.eTaper, SMESH_Actor.eVolume3D, SMESH_Actor.eWarping, SMESH.FindActorByEntry(), functorToString(), Handle(), SMESH.ProcessIn2DViewers(), SMESH.RepaintCurrentView(), and SMESHGUI.selectionMgr().
Referenced by SMESHGUI.OnGUIEvent(), SMESHGUI_MeshOp.setDefaultName(), SMESHGUI_ConvToQuadDlg.SMESHGUI_ConvToQuadDlg(), SMESHGUI_Make2DFrom3DDlg.SMESHGUI_Make2DFrom3DDlg(), and SMESHGUI_MeshDlg.SMESHGUI_MeshDlg().
{
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
SALOME_ListIO selected;
if( aSel )
aSel->selectedObjects( selected );
if( !selected.IsEmpty() ){
Handle(SALOME_InteractiveObject) anIO = selected.First();
if(!anIO.IsNull()){
SMESH_Actor::eControl aControl = SMESH_Actor::eNone;
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(anIO->getEntry())){
switch ( theCommandID ){
case 6001:
aControl = SMESH_Actor::eLength;
break;
case 6018:
aControl = SMESH_Actor::eLength2D;
break;
case 6002:
aControl = SMESH_Actor::eFreeEdges;
break;
case 6003:
aControl = SMESH_Actor::eFreeBorders;
break;
case 6004:
aControl = SMESH_Actor::eMultiConnection;
break;
case 6005:
aControl = SMESH_Actor::eFreeNodes;
break;
case 6019:
aControl = SMESH_Actor::eMultiConnection2D;
break;
case 6011:
aControl = SMESH_Actor::eArea;
break;
case 6012:
aControl = SMESH_Actor::eTaper;
break;
case 6013:
aControl = SMESH_Actor::eAspectRatio;
break;
case 6017:
aControl = SMESH_Actor::eAspectRatio3D;
break;
case 6014:
aControl = SMESH_Actor::eMinimumAngle;
break;
case 6015:
aControl = SMESH_Actor::eWarping;
break;
case 6016:
aControl = SMESH_Actor::eSkew;
break;
case 6009:
aControl = SMESH_Actor::eVolume3D;
break;
case 6021:
aControl = SMESH_Actor::eFreeFaces;
break;
case 6022:
aControl = SMESH_Actor::eMaxElementLength2D;
break;
case 6023:
aControl = SMESH_Actor::eMaxElementLength3D;
break;
case 6024:
aControl = SMESH_Actor::eBareBorderVolume;
break;
case 6025:
aControl = SMESH_Actor::eBareBorderFace;
break;
case 6026:
aControl = SMESH_Actor::eOverConstrainedVolume;
break;
case 6027:
aControl = SMESH_Actor::eOverConstrainedFace;
break;
}
anActor->SetControlMode(aControl);
anActor->GetScalarBarActor()->SetTitle( functorToString( anActor->GetFunctor() ).toLatin1().constData() );
SMESH::RepaintCurrentView();
#ifndef DISABLE_PLOT2DVIEWER
if(anActor->GetPlot2Histogram()) {
SPlot2d_Histogram* aHistogram = anActor->UpdatePlot2Histogram();
QString functorName = functorToString( anActor->GetFunctor());
QString aHistogramName("%1 : %2");
aHistogramName = aHistogramName.arg(anIO->getName()).arg(functorName);
aHistogram->setName(aHistogramName);
aHistogram->setHorTitle(functorName);
SMESH::ProcessIn2DViewers(anActor);
}
#endif
}
}
}
}
| CAM_Module* createModule | ( | ) |
Definition at line 1534 of file SMESHGUI.cxx.
{
return new SMESHGUI();
}
| void DisableAutoColor | ( | ) |
Definition at line 928 of file SMESHGUI.cxx.
References Handle(), and SMESHGUI.selectionMgr().
Referenced by SMESHGUI.OnGUIEvent().
{
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
SALOME_ListIO selected;
if( aSel )
aSel->selectedObjects( selected );
if(selected.Extent()){
Handle(SALOME_InteractiveObject) anIObject = selected.First();
SMESH::SMESH_Mesh_var aMesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIObject);
if ( !aMesh->_is_nil() ) {
aMesh->SetAutoColor( false );
}
}
}
| void ExportMeshToFile | ( | int | theCommandID | ) |
Definition at line 318 of file SMESHGUI.cxx.
References SMESHGUI.automaticUpdate(), SMESHGUI.desktop(), SMESHGUI.GetSMESHGen(), Handle(), SMESHGUI_FileValidator.isOverwrite(), SMESH.MED_V2_1, SMESH.MED_V2_2, SMESHGUI.selectionMgr(), and SMESH.UpdateView().
Referenced by SMESHGUI.OnGUIEvent().
{
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
SALOME_ListIO selected;
if( aSel )
aSel->selectedObjects( selected );
// actually, the following condition can't be met (added for insurance)
if( selected.Extent() == 0 ||
( selected.Extent() > 1 && theCommandID != 122 && theCommandID != 125 ) )
return;
bool hasDuplicatedMeshNames = false;
QList< QPair< SMESH::SMESH_Mesh_var, QString > > aMeshList;
QList< QPair< SMESH::SMESH_Mesh_var, QString > >::iterator aMeshIter;
SALOME_ListIteratorOfListIO It( selected );
for( ; It.More(); It.Next() ) {
Handle(SALOME_InteractiveObject) anIObject = It.Value();
SMESH::SMESH_Mesh_var aMeshItem = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>( anIObject );
if ( aMeshItem->_is_nil() ) {
SUIT_MessageBox::warning( SMESHGUI::desktop(),
QObject::tr( "SMESH_WRN_WARNING" ),
QObject::tr( "SMESH_BAD_MESH_SELECTION" ));
return;
}
QString aMeshName = anIObject->getName();
// check for duplications
for( aMeshIter = aMeshList.begin(); aMeshIter != aMeshList.end(); aMeshIter++ ) {
if( aMeshName == (*aMeshIter).second ) {
hasDuplicatedMeshNames = true;
break;
}
}
aMeshList.append( QPair< SMESH::SMESH_Mesh_var, QString >( aMeshItem, aMeshName ) );
}
if( hasDuplicatedMeshNames ) {
int aRet = SUIT_MessageBox::warning(SMESHGUI::desktop(),
QObject::tr("SMESH_WRN_WARNING"),
QObject::tr("SMESH_EXPORT_MED_DUPLICATED_MESH_NAMES"),
QObject::tr("SMESH_BUT_YES"),
QObject::tr("SMESH_BUT_NO"), 0, 1);
if (aRet != 0)
return;
}
aMeshIter = aMeshList.begin();
SMESH::SMESH_Mesh_var aMesh = (*aMeshIter).first;
QString aMeshName = (*aMeshIter).second;
QList<SALOMEDS::Color> aReservedColors;
QString aFilter, aTitle = QObject::tr("SMESH_EXPORT_MESH");
QMap<QString, SMESH::MED_VERSION> aFilterMap;
QMap<QString, int> aFilterMapSTL;
switch ( theCommandID ) {
case 125:
case 122:
{
for( aMeshIter = aMeshList.begin(); aMeshIter != aMeshList.end(); aMeshIter++ ) {
SMESH::SMESH_Mesh_var aMeshItem = (*aMeshIter).first;
if (aMeshItem->HasDuplicatedGroupNamesMED()) {
int aRet = SUIT_MessageBox::warning
(SMESHGUI::desktop(),
QObject::tr("SMESH_WRN_WARNING"),
QObject::tr("SMESH_EXPORT_MED_DUPLICATED_GRP").arg((*aMeshIter).second),
QObject::tr("SMESH_BUT_YES"),
QObject::tr("SMESH_BUT_NO"), 0, 1);
if (aRet != 0)
return;
}
}
// PAL18696
//QString v21 (aMesh->GetVersionString(SMESH::MED_V2_1, 2));
QString v22 (aMesh->GetVersionString(SMESH::MED_V2_2, 2));
//aFilterMap.insert( QObject::tr( "MED_VX_FILES_FILTER" ).arg( v21 ) + " (*.med)", SMESH::MED_V2_1 );
aFilterMap.insert( QObject::tr( "MED_VX_FILES_FILTER" ).arg( v22 ) + " (*.med)", SMESH::MED_V2_2 );
}
break;
case 124:
case 121:
aFilter = QObject::tr( "DAT_FILES_FILTER" ) + " (*.dat)";
break;
case 126:
case 123:
{
if (aMesh->NbPyramids()) {
int aRet = SUIT_MessageBox::warning
(SMESHGUI::desktop(),
QObject::tr("SMESH_WRN_WARNING"),
QObject::tr("SMESH_EXPORT_UNV").arg(aMeshName),
QObject::tr("SMESH_BUT_YES"),
QObject::tr("SMESH_BUT_NO"), 0, 1);
if (aRet != 0)
return;
}
aFilter = QObject::tr( "IDEAS_FILES_FILTER" ) + " (*.unv)";
}
break;
case 141:
{
// export STL
/*
there must be check on others mesh elements not equal triangles
*/
// if (aMesh->NbTriangles() < 1) {
// SUIT_MessageBox::warning
// (SMESHGUI::desktop(),
// QObject::tr("SMESH_WRN_WARNING"),
// QObject::tr("SMESH_EXPORT_STL1").arg(aMeshName));
// return;
// }
// if (!(aMesh->NbElements() - aMesh->NbTriangles())) {
// int aRet = SUIT_MessageBox::warning
// (SMESHGUI::desktop(),
// QObject::tr("SMESH_WRN_WARNING"),
// QObject::tr("SMESH_EXPORT_STL2").arg(aMeshName),
// QObject::tr("SMESH_BUT_YES"),
// QObject::tr("SMESH_BUT_NO"), 0, 1);
// if (aRet != 0)
// return;
// }
aFilterMapSTL.insert( QObject::tr( "STL_ASCII_FILES_FILTER" ) + " (*.stl)", 1 ); // 1 - ASCII mode
aFilterMapSTL.insert( QObject::tr( "STL_BIN_FILES_FILTER" ) + " (*.stl)", 0 ); // 0 - Binary mode
}
break;
default:
return;
}
QString aFilename;
SMESH::MED_VERSION aFormat;
// Init the parameter with the default value
bool aIsASCII_STL = true;
bool toCreateGroups = false;
SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
if ( resMgr )
toCreateGroups = resMgr->booleanValue( "SMESH", "auto_groups", false );
bool toOverwrite = true;
QString anInitialPath = "";
if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
anInitialPath = QDir::currentPath();
if ( theCommandID != 122 && theCommandID != 125 && theCommandID != 141) {
if ( anInitialPath.isEmpty() ) anInitialPath = SUIT_FileDlg::getLastVisitedPath();
aFilename = SUIT_FileDlg::getFileName(SMESHGUI::desktop(), anInitialPath + QString("/") + aMeshName,
aFilter, aTitle, false);
}
else if(theCommandID == 141) { // Export to STL
QStringList filters;
QMap<QString, int>::const_iterator it = aFilterMapSTL.begin();
for ( ; it != aFilterMapSTL.end(); ++it )
filters.push_back( it.key() );
SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
fd->setWindowTitle( aTitle );
fd->setNameFilters( filters );
fd->selectNameFilter( QObject::tr( "STL_ASCII_FILES_FILTER" ) + " (*.stl)" );
if ( !anInitialPath.isEmpty() )
fd->setDirectory( anInitialPath );
fd->selectFile(aMeshName);
bool is_ok = false;
while (!is_ok) {
if ( fd->exec() )
aFilename = fd->selectedFile();
aIsASCII_STL = (aFilterMapSTL[fd->selectedNameFilter()]) == 1 ? true: false;
is_ok = true;
}
delete fd;
}
else { // Export to MED
QStringList filters;
QString aDefaultFilter;
QMap<QString, SMESH::MED_VERSION>::const_iterator it = aFilterMap.begin();
for ( ; it != aFilterMap.end(); ++it ) {
filters.push_back( it.key() );
if (it.value() == SMESH::MED_V2_2)
aDefaultFilter = it.key();
}
//SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg
( SMESHGUI::desktop(), false, QObject::tr("SMESH_AUTO_GROUPS"), true, true );
fd->setWindowTitle( aTitle );
fd->setNameFilters( filters );
//fd->setSelectedNameFilter( QObject::tr("MED 2.2 (*.med)") );
fd->selectNameFilter(aDefaultFilter);
fd->SetChecked(toCreateGroups);
if ( !anInitialPath.isEmpty() )
fd->setDirectory( anInitialPath );
fd->selectFile(aMeshName);
SMESHGUI_FileValidator* fv = new SMESHGUI_FileValidator( fd );
fd->setValidator( fv );
bool is_ok = false;
while (!is_ok) {
if ( fd->exec() )
aFilename = fd->selectedFile();
else {
aFilename = QString::null;
break;
}
aFormat = aFilterMap[fd->selectedNameFilter()];
toOverwrite = fv->isOverwrite();
is_ok = true;
if ( !aFilename.isEmpty() ) {
for( aMeshIter = aMeshList.begin(); aMeshIter != aMeshList.end(); aMeshIter++ ) {
SMESH::SMESH_Mesh_var aMeshItem = (*aMeshIter).first;
if( (aMeshItem->NbPolygons()>0 || aMeshItem->NbPolyhedrons()>0)
&& aFormat==SMESH::MED_V2_1) {
int aRet = SUIT_MessageBox::warning(SMESHGUI::desktop(),
QObject::tr("SMESH_WRN_WARNING"),
QObject::tr("SMESH_EXPORT_MED_V2_1").arg((*aMeshIter).second),
QObject::tr("SMESH_BUT_YES"),
QObject::tr("SMESH_BUT_NO"), 0, 1);
if (aRet != 0) {
is_ok = false;
break;
}
}
}
if( !toOverwrite ) {
SMESH::MED_VERSION aVersion = SMESH::MED_V2_1;
bool isVersionOk = SMESHGUI::GetSMESHGen()->GetMEDVersion( aFilename.toLatin1().constData(), aVersion );
if( !isVersionOk || aVersion != aFormat ) {
int aRet = SUIT_MessageBox::warning(SMESHGUI::desktop(),
QObject::tr("SMESH_WRN_WARNING"),
QObject::tr("SMESH_EXPORT_MED_VERSION_COLLISION").arg(aFilename),
QObject::tr("SMESH_BUT_YES"),
QObject::tr("SMESH_BUT_NO"), 0, 1);
if (aRet == 0)
toOverwrite = true;
else
is_ok = false;
}
QStringList aMeshNamesCollisionList;
SMESH::string_array_var aMeshNames = SMESHGUI::GetSMESHGen()->GetMeshNames( aFilename.toLatin1().constData() );
for( int i = 0, n = aMeshNames->length(); i < n; i++ ) {
QString anExistingMeshName( aMeshNames[ i ] );
for( aMeshIter = aMeshList.begin(); aMeshIter != aMeshList.end(); aMeshIter++ ) {
QString anExportMeshName = (*aMeshIter).second;
if( anExportMeshName == anExistingMeshName ) {
aMeshNamesCollisionList.append( anExportMeshName );
break;
}
}
}
if( !aMeshNamesCollisionList.isEmpty() ) {
QString aMeshNamesCollisionString = aMeshNamesCollisionList.join( ", " );
int aRet = SUIT_MessageBox::warning(SMESHGUI::desktop(),
QObject::tr("SMESH_WRN_WARNING"),
QObject::tr("SMESH_EXPORT_MED_MESH_NAMES_COLLISION").arg(aMeshNamesCollisionString),
QObject::tr("SMESH_BUT_YES"),
QObject::tr("SMESH_BUT_NO"),
QObject::tr("SMESH_BUT_CANCEL"), 0, 2);
if (aRet == 0)
toOverwrite = true;
else if (aRet == 2)
is_ok = false;
}
}
}
}
toCreateGroups = fd->IsChecked();
delete fd;
}
if ( !aFilename.isEmpty() ) {
// Check whether the file already exists and delete it if yes
QFile aFile( aFilename );
if ( aFile.exists() && toOverwrite )
aFile.remove();
SUIT_OverrideCursor wc;
try {
bool Renumber = false;
// PAL 14172 : Check of we have to renumber or not from the preferences before export
if (resMgr)
Renumber= resMgr->booleanValue("SMESH","renumbering");
if (Renumber){
SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
aMeshEditor->RenumberNodes();
aMeshEditor->RenumberElements();
if ( SMESHGUI::automaticUpdate() )
SMESH::UpdateView();
}
switch ( theCommandID ) {
case 125:
case 122: {
int aMeshIndex = 0;
for( aMeshIter = aMeshList.begin(); aMeshIter != aMeshList.end(); aMeshIter++, aMeshIndex++ ) {
SMESH::SMESH_Mesh_var aMeshItem = (*aMeshIter).first;
if( !aMeshItem->_is_nil() )
aMeshItem->ExportToMEDX( aFilename.toLatin1().data(), toCreateGroups, aFormat, toOverwrite && aMeshIndex == 0 );
}
}
break;
case 124:
case 121:
aMesh->ExportDAT( aFilename.toLatin1().data() );
break;
case 126:
case 123:
aMesh->ExportUNV( aFilename.toLatin1().data() );
break;
case 141:
aMesh->ExportSTL( aFilename.toLatin1().data(), aIsASCII_STL );
break;
default:
break;
}
}
catch (const SALOME::SALOME_Exception& S_ex){
wc.suspend();
SUIT_MessageBox::warning(SMESHGUI::desktop(),
QObject::tr("SMESH_WRN_WARNING"),
QObject::tr("SMESH_EXPORT_FAILED"));
wc.resume();
}
}
}
| QString functorToString | ( | SMESH::Controls::FunctorPtr | f | ) |
Definition at line 743 of file SMESHGUI.cxx.
Referenced by Control(), PlotDistribution(), and SaveDistribution().
{
QString type = QObject::tr( "UNKNOWN_CONTROL" );
if ( dynamic_cast< SMESH::Controls::Volume* >( f.get() ) )
type = QObject::tr( "VOLUME_3D_ELEMENTS" );
else if ( dynamic_cast< SMESH::Controls::MaxElementLength2D* >( f.get() ) )
type = QObject::tr( "MAX_ELEMENT_LENGTH_2D" );
else if ( dynamic_cast< SMESH::Controls::MaxElementLength3D* >( f.get() ) )
type = QObject::tr( "MAX_ELEMENT_LENGTH_3D" );
else if ( dynamic_cast< SMESH::Controls::MinimumAngle* >( f.get() ) )
type = QObject::tr( "MINIMUMANGLE_ELEMENTS" );
else if ( dynamic_cast< SMESH::Controls::AspectRatio* >( f.get() ) )
type = QObject::tr( "ASPECTRATIO_ELEMENTS" );
else if ( dynamic_cast< SMESH::Controls::AspectRatio3D* >( f.get() ) )
type = QObject::tr( "ASPECTRATIO_3D_ELEMENTS" );
else if ( dynamic_cast< SMESH::Controls::Warping* >( f.get() ) )
type = QObject::tr( "WARP_ELEMENTS" );
else if ( dynamic_cast< SMESH::Controls::Taper* >( f.get() ) )
type = QObject::tr( "TAPER_ELEMENTS" );
else if ( dynamic_cast< SMESH::Controls::Skew* >( f.get() ) )
type = QObject::tr( "SKEW_ELEMENTS" );
else if ( dynamic_cast< SMESH::Controls::Area* >( f.get() ) )
type = QObject::tr( "AREA_ELEMENTS" );
else if ( dynamic_cast< SMESH::Controls::Length* >( f.get() ) )
type = QObject::tr( "LENGTH_EDGES" );
else if ( dynamic_cast< SMESH::Controls::Length2D* >( f.get() ) )
type = QObject::tr( "LENGTH2D_EDGES" );
else if ( dynamic_cast< SMESH::Controls::MultiConnection* >( f.get() ) )
type = QObject::tr( "MULTI_BORDERS" );
else if ( dynamic_cast< SMESH::Controls::MultiConnection2D* >( f.get() ) )
type = QObject::tr( "MULTI2D_BORDERS" );
else if ( dynamic_cast< SMESH::Controls::FreeNodes* >( f.get() ) )
type = QObject::tr( "FREE_NODES" );
else if ( dynamic_cast< SMESH::Controls::FreeEdges* >( f.get() ) )
type = QObject::tr( "FREE_EDGES" );
else if ( dynamic_cast< SMESH::Controls::FreeBorders* >( f.get() ) )
type = QObject::tr( "FREE_BORDERS" );
else if ( dynamic_cast< SMESH::Controls::FreeFaces* >( f.get() ) )
type = QObject::tr( "FREE_FACES" );
else if ( dynamic_cast< SMESH::Controls::BareBorderVolume* >( f.get() ) )
type = QObject::tr( "BARE_BORDER_VOLUME" );
else if ( dynamic_cast< SMESH::Controls::BareBorderFace* >( f.get() ) )
type = QObject::tr( "BARE_BORDER_FACE" );
else if ( dynamic_cast< SMESH::Controls::OverConstrainedVolume* >( f.get() ) )
type = QObject::tr( "OVER_CONSTRAINED_VOLUME" );
else if ( dynamic_cast< SMESH::Controls::OverConstrainedFace* >( f.get() ) )
type = QObject::tr( "OVER_CONSTRAINED_FACE" );
return type;
}
| Standard_EXPORT SMESHGUI* GetComponentGUI | ( | ) |
Definition at line 1672 of file SMESHGUI.cxx.
References SMESHGUI.GetSMESHGUI().
{
return SMESHGUI::GetSMESHGUI();
}
| void ImportMeshesFromFile | ( | SMESH::SMESH_Gen_ptr | theComponentMesh, |
| int | theCommandID | ||
| ) |
Definition at line 184 of file SMESHGUI.cxx.
References _PTR(), batchmode_smesh.aPixmap, SMESHGUI.desktop(), SMESH.DRS_OK, SMESH_flight_skin.filename, SMESHGUI.GetSMESHGUI(), SMESH_AdvancedEditor.res, and SMESH.SetName().
Referenced by SMESHGUI.OnGUIEvent().
{
QStringList filter;
std::string myExtension;
if ( theCommandID == 113 ) {
filter.append( QObject::tr( "MED_FILES_FILTER" ) + " (*.med)" );
filter.append( QObject::tr( "ALL_FILES_FILTER" ) + " (*)" );
}
else if ( theCommandID == 112 ) {
filter.append( QObject::tr( "IDEAS_FILES_FILTER" ) + " (*.unv)" );
}
else if ( theCommandID == 111 ) {
filter.append( QObject::tr( "DAT_FILES_FILTER" ) + " (*.dat)" );
}
else if ( theCommandID == 140 ) {
filter.append( QObject::tr( "STL_ASCII_FILES_FILTER" ) + " (*.stl)" );
}
QString anInitialPath = "";
if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
anInitialPath = QDir::currentPath();
QStringList filenames = SUIT_FileDlg::getOpenFileNames( SMESHGUI::desktop(),
anInitialPath,
filter,
QObject::tr( "SMESH_IMPORT_MESH" ) );
if ( filenames.count() > 0 ) {
SUIT_OverrideCursor wc;
_PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
QStringList errors;
QStringList anEntryList;
bool isEmpty = false;
for ( QStringList::ConstIterator it = filenames.begin(); it != filenames.end(); ++it ) {
QString filename = *it;
SMESH::mesh_array_var aMeshes = new SMESH::mesh_array;
try {
switch ( theCommandID ) {
case 111:
{
// DAT format (currently unsupported)
errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
arg( QObject::tr( "SMESH_ERR_NOT_SUPPORTED_FORMAT" ) ) );
break;
}
case 112:
{
// UNV format
aMeshes->length( 1 );
aMeshes[0] = theComponentMesh->CreateMeshesFromUNV( filename.toLatin1().constData() );
if ( aMeshes[0]->_is_nil() )
errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
arg( QObject::tr( "SMESH_ERR_UNKNOWN_IMPORT_ERROR" ) ) );
break;
}
case 113:
{
// MED format
SMESH::DriverMED_ReadStatus res;
aMeshes = theComponentMesh->CreateMeshesFromMED( filename.toLatin1().constData(), res );
if ( res != SMESH::DRS_OK ) {
errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
arg( QObject::tr( QString( "SMESH_DRS_%1" ).arg( res ).toLatin1().data() ) ) );
}
break;
}
case 140:
{
// STL format
aMeshes->length( 1 );
aMeshes[0] = theComponentMesh->CreateMeshesFromSTL( filename.toLatin1().constData() );
if ( aMeshes[0]->_is_nil() ) {
errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
arg( QObject::tr( "SMESH_ERR_UNKNOWN_IMPORT_ERROR" ) ) );
}
break;
}
}
}
catch ( const SALOME::SALOME_Exception& S_ex ) {
errors.append( QString( "%1 :\n\t%2" ).arg( filename ).
arg( QObject::tr( "SMESH_ERR_UNKNOWN_IMPORT_ERROR" ) ) );
}
for ( int i = 0, iEnd = aMeshes->length(); i < iEnd; i++ ) {
_PTR(SObject) aMeshSO = SMESH::FindSObject( aMeshes[i] );
if ( aMeshSO ) {
_PTR(StudyBuilder) aBuilder = aStudy->NewBuilder();
_PTR(AttributePixMap) aPixmap = aBuilder->FindOrCreateAttribute( aMeshSO, "AttributePixMap" );
aPixmap->SetPixMap( "ICON_SMESH_TREE_MESH_IMPORTED" );
if ( theCommandID == 112 ) // mesh names aren't taken from the file for UNV import
SMESH::SetName( aMeshSO, QFileInfo(filename).fileName() );
anEntryList.append( aMeshSO->GetID().c_str() );
#ifdef WITHGENERICOBJ
// obj has been published in study. Its refcount has been incremented.
// It is safe to decrement its refcount
// so that it will be destroyed when the entry in study will be removed
aMeshes[i]->UnRegister();
#endif
}
else {
isEmpty = true;
}
}
}
// update Object browser
SMESHGUI::GetSMESHGUI()->updateObjBrowser();
// browse to the published meshes
if( LightApp_Application* anApp =
dynamic_cast<LightApp_Application*>( SUIT_Session::session()->activeApplication() ) )
anApp->browseObjects( anEntryList );
// show Error message box if there were errors
if ( errors.count() > 0 ) {
SUIT_MessageBox::critical( SMESHGUI::desktop(),
QObject::tr( "SMESH_ERROR" ),
QObject::tr( "SMESH_IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ) );
}
// show warning message box, if some imported mesh is empty
if ( isEmpty ) {
SUIT_MessageBox::warning( SMESHGUI::desktop(),
QObject::tr( "SMESH_WRN_WARNING" ),
QObject::tr( "SMESH_DRS_SOME_EMPTY" ) );
}
}
}
Definition at line 647 of file SMESHGUI.cxx.
Referenced by SetDisplayEntity().
{
bool anIsNotPresent = ~theOutputMode & theMode;
if(anIsNotPresent)
theOutputMode |= theMode;
else
theOutputMode &= ~theMode;
}
| static int isStudyLocked | ( | _PTR(Study) | theStudy | ) | [static] |
Definition at line 1824 of file SMESHGUI.cxx.
Referenced by checkLock().
{
return theStudy->GetProperties()->IsLocked();
}
| void PlotDistribution | ( | ) |
Definition at line 883 of file SMESHGUI.cxx.
References SMESH_Actor.eNone, SMESH.FindActorByEntry(), functorToString(), SMESH_Actor.GetControlMode(), SMESH_Actor.GetFunctor(), Handle(), SMESHGUI.selectionMgr(), and SMESH_Actor.UpdatePlot2Histogram().
Referenced by SMESHGUI.OnGUIEvent().
{
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
if( !app )
return;
LightApp_SelectionMgr* aSel = SMESHGUI::selectionMgr();
SALOME_ListIO selected;
if ( aSel )
aSel->selectedObjects( selected );
if ( selected.Extent() == 1 ) {
Handle(SALOME_InteractiveObject) anIO = selected.First();
if ( anIO->hasEntry() ) {
//Find Actor by entry before getting Plot2d viewer,
//because after call getViewManager( Plot2d_Viewer::Type(), true ) active window is Plot2d Viewer
SMESH_Actor* anActor = SMESH::FindActorByEntry( anIO->getEntry() );
SUIT_ViewManager* aViewManager = app->getViewManager( Plot2d_Viewer::Type(), true ); // create if necessary
if( !aViewManager )
return;
SPlot2d_Viewer* aView = dynamic_cast<SPlot2d_Viewer*>(aViewManager->getViewModel());
if ( !aView )
return;
Plot2d_ViewFrame* aPlot = aView->getActiveViewFrame();
if ( !aPlot )
return;
if ( anActor && anActor->GetControlMode() != SMESH_Actor::eNone ) {
SPlot2d_Histogram* aHistogram = anActor->UpdatePlot2Histogram();
QString functorName = functorToString( anActor->GetFunctor());
QString aHistogramName("%1 : %2");
aHistogramName = aHistogramName.arg(anIO->getName()).arg(functorName);
aHistogram->setName(aHistogramName);
aHistogram->setHorTitle(functorName);
aHistogram->setVerTitle(QObject::tr("DISTRIBUTION_NB_ENT"));
aPlot->displayObject(aHistogram, true);
}
}
}
}
| void SaveDistribution | ( | ) |
Definition at line 793 of file SMESHGUI.cxx.
References SMESHGUI.desktop(), SMESH_Actor.eNone, SMESH.FindActorByEntry(), functorToString(), SMESH_Actor.GetControlMode(), SMESH_Actor.GetFunctor(), SMESH.Controls.NumericalFunctor.GetHistogram(), SMESH_Actor.GetScalarBarActor(), Handle(), SMESH_test.ids, PAL_MESH_041_mesh.mesh, and SMESHGUI.selectionMgr().
Referenced by SMESHGUI.OnGUIEvent().
{
LightApp_SelectionMgr* aSel = SMESHGUI::selectionMgr();
SALOME_ListIO selected;
if ( aSel )
aSel->selectedObjects( selected );
if ( selected.Extent() == 1 ) {
Handle(SALOME_InteractiveObject) anIO = selected.First();
if ( anIO->hasEntry() ) {
SMESH_Actor* anActor = SMESH::FindActorByEntry( anIO->getEntry() );
if ( anActor && anActor->GetScalarBarActor() && anActor->GetControlMode() != SMESH_Actor::eNone ) {
SMESH_ScalarBarActor* aScalarBarActor = anActor->GetScalarBarActor();
SMESH::Controls::FunctorPtr aFunctor = anActor->GetFunctor();
if ( aScalarBarActor && aFunctor ) {
SMESH::Controls::NumericalFunctor* aNumFun = dynamic_cast<SMESH::Controls::NumericalFunctor*>( aFunctor.get() );
if ( aNumFun ) {
std::vector<int> elements;
SMESH::SMESH_Mesh_var mesh = SMESH::IObjectToInterface<SMESH::SMESH_Mesh>(anIO);
if ( mesh->_is_nil() ) {
SMESH::SMESH_IDSource_var idSource =
SMESH::IObjectToInterface<SMESH::SMESH_IDSource>(anIO);
if ( !idSource->_is_nil() )
{
SMESH::long_array_var ids = idSource->GetIDs();
elements.resize( ids->length() );
for ( unsigned i = 0; i < elements.size(); ++i )
elements[i] = ids[i];
}
}
int nbIntervals = aScalarBarActor->GetMaximumNumberOfColors();
vtkLookupTable* lookupTable =
static_cast<vtkLookupTable*>(aScalarBarActor->GetLookupTable());
double * minmax = lookupTable->GetRange();
std::vector<int> nbEvents;
std::vector<double> funValues;
aNumFun->GetHistogram( nbIntervals, nbEvents, funValues, elements, minmax );
QString anInitialPath = "";
if ( SUIT_FileDlg::getLastVisitedPath().isEmpty() )
anInitialPath = QDir::currentPath();
QString aMeshName = anIO->getName();
QStringList filter;
filter.append( QObject::tr( "TEXT_FILES_FILTER" ) + " (*.txt)" );
filter.append( QObject::tr( "ALL_FILES_FILTER" ) + " (*)" );
QString aFilename = anInitialPath + "/" + aMeshName + "_" +
functorToString( aFunctor ).toLower().simplified().replace( QRegExp( " |-" ), "_" ) + ".txt";
aFilename = SUIT_FileDlg::getFileName( SMESHGUI::desktop(),
aFilename,
filter,
QObject::tr( "SMESH_SAVE_DISTRIBUTION" ),
false );
if ( !aFilename.isEmpty() ) {
QFile f( aFilename );
if ( f.open( QFile::WriteOnly | QFile::Truncate ) ) {
QTextStream out( &f );
out << "# Mesh: " << aMeshName << endl;
out << "# Control: " << functorToString( aFunctor ) << endl;
out << "#" << endl;
out.setFieldWidth( 10 );
for ( int i = 0; i < qMin( nbEvents.size(), funValues.size()-1 ); i++ )
out << funValues[i] << "\t" << funValues[i+1] << "\t" << nbEvents[i] << endl;
f.close();
}
}
}
}
}
}
}
}
| void SetDisplayEntity | ( | int | theCommandID | ) |
Definition at line 657 of file SMESHGUI.cxx.
References SMESH_Actor.e0DElements, SMESH_Actor.eAllEntity, SMESH_Actor.eEdges, SMESH_Actor.eFaces, SMESH_Actor.eVolumes, SMESH.FindActorByEntry(), Handle(), InverseEntityMode(), and SMESHGUI.selectionMgr().
Referenced by SMESHGUI.OnGUIEvent().
{
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
SALOME_ListIO selected;
if( aSel )
aSel->selectedObjects( selected );
if(selected.Extent() >= 1){
SALOME_ListIteratorOfListIO It( selected );
for( ; It.More(); It.Next()){
Handle(SALOME_InteractiveObject) IObject = It.Value();
if(IObject->hasEntry()){
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
unsigned int aMode = anActor->GetEntityMode();
switch(theCommandID){
case 216:
InverseEntityMode(aMode,SMESH_Actor::e0DElements);
break;
case 217:
InverseEntityMode(aMode,SMESH_Actor::eEdges);
break;
case 218:
InverseEntityMode(aMode,SMESH_Actor::eFaces);
break;
case 219:
InverseEntityMode(aMode,SMESH_Actor::eVolumes);
break;
case 220:
aMode = SMESH_Actor::eAllEntity;
break;
}
if(aMode)
anActor->SetEntityMode(aMode);
}
}
}
}
}
| void SetDisplayMode | ( | int | theCommandID, |
| SMESHGUI_StudyId2MarkerMap & | theMarkerMap | ||
| ) |
Definition at line 943 of file SMESHGUI.cxx.
References _PTR(), SMESH_Actor.eArcs, SMESH.EDGE, SMESH_Actor.eEdge, SMESH_Actor.eLines, SMESHGUI.EmitSignalDeactivateDialog(), SMESH_Actor.ePoint, SMESH_Actor.eSurface, SMESH.FindActorByEntry(), SMESHGUI_Preferences_ColorDlg.GetBooleanValue(), SMESHGUI_Preferences_ColorDlg.GetColor(), SMESHGUI_Preferences_ColorDlg.getCustomMarkerID(), SMESHGUI_Preferences_ColorDlg.getCustomMarkerMap(), SMESHGUI_Preferences_ColorDlg.GetDoubleValue(), SMESHGUI_Preferences_ColorDlg.GetIntValue(), SMESHGUI_Preferences_ColorDlg.getMarkerType(), SMESHGUI.GetSMESHGUI(), SMESHGUI_Preferences_ColorDlg.getStandardMarkerScale(), SMESH.GetViewWindow(), Handle(), SMESH.NODE, SMESH.RepaintCurrentView(), SMESHGUI.selectionMgr(), SMESHGUI_Preferences_ColorDlg.SetBooleanValue(), SMESHGUI_Preferences_ColorDlg.SetColor(), SMESHGUI_Preferences_ColorDlg.setCustomMarker(), SMESHGUI_Preferences_ColorDlg.setCustomMarkerMap(), SMESHGUI_Preferences_ColorDlg.SetDoubleValue(), SMESHGUI_Preferences_ColorDlg.SetIntValue(), and SMESHGUI_Preferences_ColorDlg.setStandardMarker().
Referenced by SMESHGUI.OnGUIEvent().
{
SALOME_ListIO selected;
SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
if( !app )
return;
LightApp_SelectionMgr *aSel = SMESHGUI::selectionMgr();
SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
if( !aSel || !appStudy )
return;
if( theCommandID == 1134 ) { // Clipping dialog can be activated without selection
if( SMESHGUI* aModule = SMESHGUI::GetSMESHGUI() ) {
aModule->EmitSignalDeactivateDialog();
if( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( aModule ) )
(new SMESHGUI_ClippingDlg( aModule, aViewWindow ))->show();
}
return;
}
_PTR(Study) aStudy = appStudy->studyDS();
aSel->selectedObjects( selected );
if(selected.Extent() >= 1){
switch(theCommandID){
case 1133:{
SMESHGUI::GetSMESHGUI()->EmitSignalDeactivateDialog();
(new SMESHGUI_TransparencyDlg( SMESHGUI::GetSMESHGUI() ))->show();
return;
}
case 1132:{
QColor c, e, b, n, c0D, o;
int size0D = 0;
int Edgewidth = 0;
vtkFloatingPointType Shrink = 0.0;
vtkFloatingPointType faces_orientation_scale = 0.0;
bool faces_orientation_3dvectors = false;
VTK::MarkerType aMarkerTypeCurrent = VTK::MT_NONE;
VTK::MarkerScale aMarkerScaleCurrent = VTK::MS_NONE;
int aMarkerTextureCurrent = 0;
SALOME_ListIteratorOfListIO It( selected );
for( ; It.More(); It.Next()){
Handle(SALOME_InteractiveObject) IObject = It.Value();
if(IObject->hasEntry()){
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
vtkFloatingPointType color[3];
anActor->GetSufaceColor(color[0], color[1], color[2]);
int c0 = int (color[0] * 255);
int c1 = int (color[1] * 255);
int c2 = int (color[2] * 255);
c.setRgb(c0, c1, c2);
vtkFloatingPointType edgecolor[3];
anActor->GetEdgeColor(edgecolor[0], edgecolor[1], edgecolor[2]);
c0 = int (edgecolor[0] * 255);
c1 = int (edgecolor[1] * 255);
c2 = int (edgecolor[2] * 255);
e.setRgb(c0, c1, c2);
vtkFloatingPointType backfacecolor[3];
anActor->GetBackSufaceColor(backfacecolor[0], backfacecolor[1], backfacecolor[2]);
c0 = int (backfacecolor[0] * 255);
c1 = int (backfacecolor[1] * 255);
c2 = int (backfacecolor[2] * 255);
b.setRgb(c0, c1, c2);
vtkFloatingPointType nodecolor[3];
anActor->GetNodeColor(nodecolor[0], nodecolor[1], nodecolor[2]);
c0 = int (nodecolor[0] * 255);
c1 = int (nodecolor[1] * 255);
c2 = int (nodecolor[2] * 255);
n.setRgb(c0, c1, c2);
vtkFloatingPointType color0D[3];
anActor->Get0DColor(color0D[0], color0D[1], color0D[2]);
c0 = int (color0D[0] * 255);
c1 = int (color0D[1] * 255);
c2 = int (color0D[2] * 255);
c0D.setRgb(c0, c1, c2);
size0D = (int)anActor->Get0DSize();
if(size0D == 0)
size0D = 1;
Edgewidth = (int)anActor->GetLineWidth();
if(Edgewidth == 0)
Edgewidth = 1;
Shrink = anActor->GetShrinkFactor();
vtkFloatingPointType faces_orientation_color[3];
anActor->GetFacesOrientationColor(faces_orientation_color);
c0 = int (faces_orientation_color[0] * 255);
c1 = int (faces_orientation_color[1] * 255);
c2 = int (faces_orientation_color[2] * 255);
o.setRgb(c0, c1, c2);
faces_orientation_scale = anActor->GetFacesOrientationScale();
faces_orientation_3dvectors = anActor->GetFacesOrientation3DVectors();
aMarkerTypeCurrent = anActor->GetMarkerType();
aMarkerScaleCurrent = anActor->GetMarkerScale();
aMarkerTextureCurrent = anActor->GetMarkerTexture();
// even if there are multiple objects in the selection,
// we need only the first one to get values for the dialog
break;
}
}
}
SMESHGUI_Preferences_ColorDlg *aDlg =
new SMESHGUI_Preferences_ColorDlg( SMESHGUI::GetSMESHGUI() );
aDlg->SetColor(1, c);
aDlg->SetColor(2, e);
aDlg->SetColor(3, n);
aDlg->SetColor(4, b);
aDlg->SetColor(5, c0D);
aDlg->SetColor(6, o);
aDlg->SetIntValue(1, Edgewidth);
aDlg->SetIntValue(2, int(Shrink*100.));
aDlg->SetIntValue(3, size0D);
aDlg->SetDoubleValue(1, faces_orientation_scale);
aDlg->SetBooleanValue(1, faces_orientation_3dvectors);
aDlg->setCustomMarkerMap( theMarkerMap[ aStudy->StudyId() ] );
if( aMarkerTypeCurrent != VTK::MT_USER )
aDlg->setStandardMarker( aMarkerTypeCurrent, aMarkerScaleCurrent );
else
aDlg->setCustomMarker( aMarkerTextureCurrent );
if(aDlg->exec()){
QColor color = aDlg->GetColor(1);
QColor edgecolor = aDlg->GetColor(2);
QColor nodecolor = aDlg->GetColor(3);
QColor backfacecolor = aDlg->GetColor(4);
QColor color0D = aDlg->GetColor(5);
QColor faces_orientation_color = aDlg->GetColor(6);
/* Point marker */
theMarkerMap[ aStudy->StudyId() ] = aDlg->getCustomMarkerMap();
SALOME_ListIteratorOfListIO It( selected );
for( ; It.More(); It.Next()){
Handle(SALOME_InteractiveObject) IObject = It.Value();
if(IObject->hasEntry()){
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
/* actor color and backface color */
anActor->SetSufaceColor(vtkFloatingPointType (color.red()) / 255.,
vtkFloatingPointType (color.green()) / 255.,
vtkFloatingPointType (color.blue()) / 255.);
anActor->SetBackSufaceColor(vtkFloatingPointType (backfacecolor.red()) / 255.,
vtkFloatingPointType (backfacecolor.green()) / 255.,
vtkFloatingPointType (backfacecolor.blue()) / 255.);
/* edge color */
anActor->SetEdgeColor(vtkFloatingPointType (edgecolor.red()) / 255.,
vtkFloatingPointType (edgecolor.green()) / 255.,
vtkFloatingPointType (edgecolor.blue()) / 255.);
/* Shrink factor and size edges */
anActor->SetShrinkFactor(aDlg->GetIntValue(2) / 100.);
anActor->SetLineWidth(aDlg->GetIntValue(1));
/* Nodes color and size */
anActor->SetNodeColor(vtkFloatingPointType (nodecolor.red()) / 255.,
vtkFloatingPointType (nodecolor.green()) / 255.,
vtkFloatingPointType (nodecolor.blue()) / 255.);
/* 0D elements */
anActor->Set0DColor(vtkFloatingPointType (color0D.red()) / 255.,
vtkFloatingPointType (color0D.green()) / 255.,
vtkFloatingPointType (color0D.blue()) / 255.);
anActor->Set0DSize(aDlg->GetIntValue(3));
/* Faces orientation */
vtkFloatingPointType c[3] = {vtkFloatingPointType(faces_orientation_color.redF()),
vtkFloatingPointType(faces_orientation_color.greenF()),
vtkFloatingPointType(faces_orientation_color.blueF())};
anActor->SetFacesOrientationColor(c);
anActor->SetFacesOrientationScale(aDlg->GetDoubleValue(1));
anActor->SetFacesOrientation3DVectors(aDlg->GetBooleanValue(1));
VTK::MarkerType aMarkerTypeNew = aDlg->getMarkerType();
VTK::MarkerScale aMarkerScaleNew = aDlg->getStandardMarkerScale();
int aMarkerTextureNew = aDlg->getCustomMarkerID();
if( aMarkerTypeNew != VTK::MT_USER )
anActor->SetMarkerStd( aMarkerTypeNew, aMarkerScaleNew );
else {
const VTK::MarkerMap& aMarkerMap = theMarkerMap[ aStudy->StudyId() ];
VTK::MarkerMap::const_iterator anIter = aMarkerMap.find( aMarkerTextureNew );
if( anIter != aMarkerMap.end() )
anActor->SetMarkerTexture( aMarkerTextureNew, anIter->second.second );
}
SMESH::SMESH_GroupBase_var aGroupObject = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject);
if( !aGroupObject->_is_nil() )
{
SMESH::ElementType anElementType = aGroupObject->GetType();
QColor aColor;
switch( anElementType )
{
case SMESH::NODE: aColor = nodecolor; break;
case SMESH::EDGE: aColor = edgecolor; break;
default: aColor = color; break;
}
SALOMEDS::Color aGroupColor;
aGroupColor.R = (float)aColor.red() / 255.0;
aGroupColor.G = (float)aColor.green() / 255.0;
aGroupColor.B = (float)aColor.blue() / 255.0;
aGroupObject->SetColor( aGroupColor );
}
}
}
}
SMESH::RepaintCurrentView();
}
delete aDlg;
return;
}
}
SALOME_ListIteratorOfListIO It( selected );
for( ; It.More(); It.Next()){
Handle(SALOME_InteractiveObject) IObject = It.Value();
if(IObject->hasEntry()){
if(SMESH_Actor *anActor = SMESH::FindActorByEntry(IObject->getEntry())){
switch(theCommandID){
case 211:
anActor->SetRepresentation(SMESH_Actor::eEdge);
break;
case 212:
anActor->SetRepresentation(SMESH_Actor::eSurface);
break;
case 213:
if(anActor->IsShrunk())
anActor->UnShrink();
else
anActor->SetShrink();
break;
case 215:
anActor->SetRepresentation(SMESH_Actor::ePoint);
break;
case 231:
if(anActor->GetQuadratic2DRepresentation() != SMESH_Actor::eLines)
anActor->SetQuadratic2DRepresentation(SMESH_Actor::eLines);
break;
case 232:
if(anActor->GetQuadratic2DRepresentation() != SMESH_Actor::eArcs)
anActor->SetQuadratic2DRepresentation(SMESH_Actor::eArcs);
break;
}
}
}
}
SMESH::RepaintCurrentView();
}
}
| void ShowDistribution | ( | ) |
Definition at line 864 of file SMESHGUI.cxx.
References SMESH_Actor.eNone, SMESH.FindActorByEntry(), SMESH_Actor.GetControlMode(), SMESH_ScalarBarActor.GetDistributionVisibility(), SMESH_Actor.GetScalarBarActor(), Handle(), SMESHGUI.selectionMgr(), and SMESH_ScalarBarActor.SetDistributionVisibility().
Referenced by SMESHGUI.OnGUIEvent().
{
LightApp_SelectionMgr* aSel = SMESHGUI::selectionMgr();
SALOME_ListIO selected;
if ( aSel )
aSel->selectedObjects( selected );
if ( selected.Extent() == 1 ) {
Handle(SALOME_InteractiveObject) anIO = selected.First();
if ( anIO->hasEntry() ) {
SMESH_Actor* anActor = SMESH::FindActorByEntry( anIO->getEntry() );
if ( anActor && anActor->GetScalarBarActor() && anActor->GetControlMode() != SMESH_Actor::eNone ) {
SMESH_ScalarBarActor *aScalarBarActor = anActor->GetScalarBarActor();
aScalarBarActor->SetDistributionVisibility(!aScalarBarActor->GetDistributionVisibility());
}
}
}
}
| const char gDigitsSep = ':' |
Definition at line 4835 of file SMESHGUI.cxx.
Referenced by SMESHGUI.storeVisualParameters().
| const char gPathSep = '|' |
Definition at line 4836 of file SMESHGUI.cxx.
Referenced by SMESHGUI.storeVisualParameters().
| const char gSeparator = '_' |
Definition at line 4834 of file SMESHGUI.cxx.
Referenced by SMESHGUI.storeVisualParameters().