X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_ComputeDlg.cxx;h=b5720d7970379a272dfa9264dbf978c1fba86ab0;hp=429531fd28919106e398c59cf2775f7339b2e467;hb=c4d4c3be32adf37c4ff99664205b4f15e1560674;hpb=8b8b2deedb4a7c0d3683037a91c1a340e426828c diff --git a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx index 429531fd2..b5720d797 100644 --- a/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_ComputeDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2019 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -54,6 +54,7 @@ #include #include #include +#include #include // SALOME KERNEL includes @@ -95,12 +96,13 @@ // VTK includes #include +#include // STL includes #include #include -#ifndef WIN32 +#if !defined WIN32 && !defined __APPLE__ #include #endif @@ -108,6 +110,7 @@ #define MARGIN 11 #define COLONIZE(str) (QString(str).contains(":") > 0 ? QString(str) : QString(str) + " :" ) +#define __SHAPE_RGB__ 250, 0, 250 enum TCol { COL_ALGO = 0, COL_SHAPE, COL_ERROR, COL_SHAPEID, COL_PUBLISHED, COL_BAD_MESH, NB_COLUMNS @@ -147,10 +150,10 @@ namespace SMESH { myProperty = vtkProperty::New(); myProperty->SetRepresentationToWireframe(); - myProperty->SetColor( 250, 0, 250 ); - myProperty->SetAmbientColor( 250, 0, 250 ); - myProperty->SetDiffuseColor( 250, 0, 250 ); - //myProperty->SetSpecularColor( 250, 0, 250 ); + myProperty->SetColor( __SHAPE_RGB__ ); + myProperty->SetAmbientColor( __SHAPE_RGB__ ); + myProperty->SetDiffuseColor( __SHAPE_RGB__ ); + //myProperty->SetSpecularColor( __SHAPE_RGB__ ); myProperty->SetLineWidth( 5 ); } // ----------------------------------------------------------------------- @@ -271,20 +274,25 @@ namespace SMESH GEOM_Actor* getActor(const TopoDS_Shape& shape) { int index = myIndexToShape.FindIndex( shape ) - 1; - if ( index < 0 || index >= myActors.size() ) + if ( index < 0 || index >= (int) myActors.size() ) return 0; GEOM_Actor* & actor = myActors[ index ]; if ( !actor ) { actor = GEOM_Actor::New(); if ( actor ) { actor->SetShape(shape,0,0); - actor->SetProperty(myProperty); - actor->SetShadingProperty(myProperty); - actor->SetWireframeProperty(myProperty); - actor->SetPreviewProperty(myProperty); + // actor->SetProperty(myProperty); + // actor->SetShadingProperty(myProperty); + // actor->SetWireframeProperty(myProperty); + // actor->SetPreviewProperty(myProperty); actor->PickableOff(); - // if ( shape.ShapeType() == TopAbs_EDGE ) - // actor->SubShapeOn(); + // + actor->SetWidth( myProperty->GetLineWidth() ); + actor->SetIsosWidth( myProperty->GetLineWidth() ); + actor->SetIsosColor( __SHAPE_RGB__ ); + actor->SetColor( __SHAPE_RGB__ ); + // if ( shape.ShapeType() == TopAbs_EDGE ) + // actor->SubShapeOn(); myViewWindow->AddActor( actor ); } } @@ -371,9 +379,7 @@ namespace SMESH _PTR(SObject) so = SMESH::FindSObject(aMainShape); if ( subShapeID == 1 || !so ) return so; - _PTR(ChildIterator) it; - if (_PTR(Study) study = SMESH::GetActiveStudyDocument()) - it = study->NewChildIterator(so); + _PTR(ChildIterator) it = SMESH::getStudy()->NewChildIterator(so); _PTR(SObject) subSO; if ( it ) { for ( it->InitEx(true); !subSO && it->More(); it->Next() ) { @@ -569,7 +575,7 @@ QFrame* SMESHGUI_ComputeDlg::createMainFrame (QWidget* theParent, bool ForEval) myTable->hideColumn( COL_PUBLISHED ); myTable->hideColumn( COL_SHAPEID ); myTable->hideColumn( COL_BAD_MESH ); - myTable->horizontalHeader()->setResizeMode( COL_ERROR, QHeaderView::Interactive ); + myTable->horizontalHeader()->setSectionResizeMode( COL_ERROR, QHeaderView::Interactive ); myTable->setWordWrap( true ); myTable->horizontalHeader()->setStretchLastSection( true ); myTable->setMinimumWidth( 500 ); @@ -647,7 +653,7 @@ SMESHGUI_BaseComputeOp::SMESHGUI_BaseComputeOp() myBadMeshDisplayer = 0; //myHelpFileName = "/files/about_meshes.htm"; // V3 - myHelpFileName = "about_meshes_page.html"; // V4 + myHelpFileName = "about_meshes.html"; // V4 } SMESH::SMESH_Mesh_ptr SMESHGUI_BaseComputeOp::getMesh() @@ -673,6 +679,7 @@ void SMESHGUI_BaseComputeOp::startOperation() myMesh = SMESH::SMESH_Mesh::_nil(); myMainShape = GEOM::GEOM_Object::_nil(); + myCurShape = GEOM::GEOM_Object::_nil(); // check selection LightApp_SelectionMgr *Sel = selectionMgr(); @@ -688,7 +695,23 @@ void SMESHGUI_BaseComputeOp::startOperation() } myIObject = selected.First(); - myMesh = SMESH::GetMeshByIO(myIObject); + CORBA::Object_var anObj = SMESH::IObjectToObject( myIObject ); + + myMesh = SMESH::SMESH_Mesh::_narrow(anObj); + if ( myMesh->_is_nil() ) + { + SMESH::SMESH_subMesh_var aSubMesh = SMESH::SMESH_subMesh::_narrow(anObj); + if ( !aSubMesh->_is_nil() ) + { + myMesh = aSubMesh->GetFather(); + myCurShape = aSubMesh->GetSubShape(); + } + } + else + { + myCurShape = myMesh->GetShapeToMesh(); + } + if (myMesh->_is_nil()) { SUIT_MessageBox::warning(desktop(), tr("SMESH_WRN_WARNING"), @@ -696,6 +719,7 @@ void SMESHGUI_BaseComputeOp::startOperation() onCancel(); return; } + myMainShape = myMesh->GetShapeToMesh(); SMESHGUI_Operation::startOperation(); @@ -732,10 +756,11 @@ void SMESHGUI_ComputeDlg_QThread::cancel() //================================================================================ //================================================================================ -SMESHGUI_ComputeDlg_QThreadQDialog::SMESHGUI_ComputeDlg_QThreadQDialog(QWidget * parent, - SMESH::SMESH_Gen_var gen, - SMESH::SMESH_Mesh_var mesh, - GEOM::GEOM_Object_var mainShape) +SMESHGUI_ComputeDlg_QThreadQDialog:: +SMESHGUI_ComputeDlg_QThreadQDialog(QWidget * parent, + SMESH::SMESH_Gen_var gen, + SMESH::SMESH_Mesh_var mesh, + GEOM::GEOM_Object_var mainShape) : QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint | @@ -755,7 +780,7 @@ SMESHGUI_ComputeDlg_QThreadQDialog::SMESHGUI_ComputeDlg_QThreadQDialog(QWidget QLabel * nbElemsName = new QLabel(tr("SMESH_MESHINFO_ELEMENTS"), this ); nbNodesLabel = new QLabel("0", this ); nbElemsLabel = new QLabel("0", this ); -#ifndef WIN32 +#if !defined WIN32 && !defined __APPLE__ QLabel * freeRAMName = new QLabel(tr("SMESH_FREERAM"), this ); freeRAMLabel = new QLabel("", this ); #endif @@ -771,7 +796,7 @@ SMESHGUI_ComputeDlg_QThreadQDialog::SMESHGUI_ComputeDlg_QThreadQDialog(QWidget layout->addWidget(nbNodesLabel, row++, 1); layout->addWidget(nbElemsName, row, 0); layout->addWidget(nbElemsLabel, row++, 1); -#ifndef WIN32 +#if !defined WIN32 && !defined __APPLE__ layout->addWidget(freeRAMName, row, 0); layout->addWidget(freeRAMLabel, row++, 1); #endif @@ -811,7 +836,7 @@ void SMESHGUI_ComputeDlg_QThreadQDialog::timerEvent(QTimerEvent *event) { nbNodesLabel->setText( QString("%1").arg( qthread.getMesh()->NbNodes() )); nbElemsLabel->setText( QString("%1").arg( qthread.getMesh()->NbElements() )); -#ifndef WIN32 +#if !defined WIN32 && !defined __APPLE__ struct sysinfo si; const int err = sysinfo( &si ); if ( err ) @@ -871,10 +896,8 @@ void SMESHGUI_BaseComputeOp::computeMesh() myMesh->Clear(); SUIT_OverrideCursor aWaitCursor; try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 OCC_CATCH_SIGNALS; -#endif - SMESHGUI_ComputeDlg_QThreadQDialog qthreaddialog(desktop(), gen, myMesh, myMainShape); + SMESHGUI_ComputeDlg_QThreadQDialog qthreaddialog(desktop(), gen, myMesh, myCurShape); qthreaddialog.exec(); computeFailed = !qthreaddialog.result(); } @@ -882,12 +905,10 @@ void SMESHGUI_BaseComputeOp::computeMesh() memoryLack = true; } try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 OCC_CATCH_SIGNALS; -#endif aCompErrors = gen->GetComputeErrors( myMesh, myMainShape ); // check if there are memory problems - for ( int i = 0; (i < aCompErrors->length()) && !memoryLack; ++i ) + for ( CORBA::ULong i = 0; (i < aCompErrors->length()) && !memoryLack; ++i ) memoryLack = ( aCompErrors[ i ].code == SMESH::COMPERR_MEMORY_PB ); } catch(const SALOME::SALOME_Exception & S_ex) { @@ -900,9 +921,6 @@ void SMESHGUI_BaseComputeOp::computeMesh() // NPAL16631: if ( !memoryLack ) { - SMESH::ModifiedMesh( aMeshSObj, - !computeFailed && aHypErrors.isEmpty(), - myMesh->NbNodes() == 0); update( UF_ObjBrowser | UF_Model ); // SHOW MESH @@ -916,60 +934,78 @@ void SMESHGUI_BaseComputeOp::computeMesh() if ( !memoryLack ) { // List of objects that will be updated automatically - QList< QPair< SMESH::SMESH_IDSource_var, _PTR(SObject) > > aListToUpdate; - SMESH::SMESH_IDSource_var aMeshObj = SMESH::SObjectToInterface( aMeshSObj ); + typedef QList< QPair< SMESH::SMESH_IDSource_var, _PTR(SObject) > > TListOf_IDSrc_SObj; + TListOf_IDSrc_SObj aListToUpdate; + SMESH::SMESH_IDSource_var aMeshObj = + SMESH::SObjectToInterface( aMeshSObj ); // put Mesh into list - aListToUpdate.append( QPair< SMESH::SMESH_IDSource_var, _PTR(SObject) >(aMeshObj, aMeshSObj) ); + aListToUpdate.append( TListOf_IDSrc_SObj::value_type( aMeshObj, aMeshSObj )); SMESH::submesh_array_var aSubMeshes = myMesh->GetSubMeshes(); // put SubMeshes into list - for ( int i = 0; i < aSubMeshes->length(); i++ ) { + for ( CORBA::ULong i = 0; i < aSubMeshes->length(); i++ ) + { SMESH::SMESH_subMesh_var sm = aSubMeshes[i]; if ( CORBA::is_nil( sm ) ) continue; _PTR(SObject) smSObj = SMESH::ObjectToSObject( sm ); if ( !smSObj ) continue; - SMESH::SMESH_IDSource_var aSubMeshObj = SMESH::SObjectToInterface( smSObj ); - aListToUpdate.append( QPair< SMESH::SMESH_IDSource_var, _PTR(SObject) >(aSubMeshObj, smSObj) ); + SMESH::SMESH_IDSource_var aSubMeshObj = + SMESH::SObjectToInterface( smSObj ); + SMESH_Actor *anActor = SMESH::FindActorByObject( aSubMeshObj ); + if ( anActor /*&& anActor->GetVisibility()*/ ) + aListToUpdate.append( TListOf_IDSrc_SObj::value_type( aSubMeshObj, smSObj )); } // put Groups into list - SMESH::ListOfGroups_var aGroups = myMesh->GetGroups(); - for ( size_t i = 0; i < aGroups->length(); ++i ) { + SMESH::ListOfGroups_var aGroups = myMesh->GetGroups(); + for ( size_t i = 0; i < aGroups->length(); ++i ) + { SMESH::SMESH_GroupBase_var aGrp = aGroups[i]; if ( CORBA::is_nil( aGrp ) ) continue; - SMESH::SMESH_Group_var aStdGroup = SMESH::SMESH_Group::_narrow( aGrp ); - SMESH::SMESH_GroupOnGeom_var aGeomGroup = SMESH::SMESH_GroupOnGeom::_narrow( aGrp ); - SMESH::SMESH_GroupOnFilter_var aFltGroup = SMESH::SMESH_GroupOnFilter::_narrow( aGrp ); - if ( !aStdGroup->_is_nil() ) continue; // don't update the standalone groups + SMESH::SMESH_Group_var aStdGroup = SMESH::SMESH_Group::_narrow( aGrp ); + if ( !aStdGroup->_is_nil() ) continue; // don't update standalone groups _PTR(SObject) aGroupSO = SMESH::FindSObject( aGrp ); if ( !aGroupSO ) continue; - SMESH::SMESH_IDSource_var aGroupObj = SMESH::SObjectToInterface( aGroupSO ); - aListToUpdate.append( QPair< SMESH::SMESH_IDSource_var, _PTR(SObject) >(aGroupObj, aGroupSO) ); + SMESH::SMESH_IDSource_var aGroupObj = + SMESH::SObjectToInterface( aGroupSO ); + SMESH_Actor *anActor = SMESH::FindActorByObject( aGroupObj ); + if ( anActor /*&& anActor->GetVisibility()*/ ) + aListToUpdate.append( TListOf_IDSrc_SObj::value_type( aGroupObj, aGroupSO )); } // update mesh, sub-mesh and groups, if it's possible - QList< QPair< SMESH::SMESH_IDSource_var, _PTR(SObject) > >::iterator anIter; - for( anIter = aListToUpdate.begin(); anIter != aListToUpdate.end(); anIter++ ) { - SMESH::SMESH_Mesh_var aMesh = SMESH::SMESH_Mesh::_narrow( SMESH::SObjectToObject( (*anIter).second )); - if ( getSMESHGUI()->automaticUpdate( (*anIter).first, &entities, &limitExceeded, &hidden, &nbElements ) ) + TListOf_IDSrc_SObj::iterator anIter; + for ( anIter = aListToUpdate.begin(); anIter != aListToUpdate.end(); anIter++ ) + { + SMESH::SMESH_Mesh_var aMesh = + SMESH::SMESH_Mesh::_narrow( SMESH::SObjectToObject( (*anIter).second )); + + if ( getSMESHGUI()->automaticUpdate( (*anIter).first, &entities, &limitExceeded, + &hidden, &nbElements ) ) { try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 OCC_CATCH_SIGNALS; -#endif - bool toDisplay = false; - - if ( !aMesh->_is_nil() ) { // display a mesh only - toDisplay = true; + std::string entry = (*anIter).second->GetID(); + if ( !aMesh->_is_nil() ) // display only a mesh + { SMESH_Actor *anActor = SMESH::FindActorByObject( aMesh ); - if ( !anActor ) anActor = SMESH::CreateActor( (*anIter).second->GetStudy(), (*anIter).second->GetID().c_str(), true ); + if ( !anActor ) anActor = SMESH::CreateActor( entry.c_str(), /*clearLog =*/true ); if ( anActor ) // actor is not created for an empty mesh { anActor->SetEntityMode( entities ); - SMESH::DisplayActor( SMESH::GetActiveWindow(), anActor ); + //SMESH::DisplayActor( SMESH::GetActiveWindow(), anActor ); -- 23615 } } - Handle(SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject - ( (*anIter).second->GetID().c_str(), "SMESH", (*anIter).second->GetName().c_str() ); - SMESH::Update(anIO, toDisplay); + else + { + SMESH_Actor *anActor = SMESH::FindActorByEntry( entry.c_str() ); + anActor->Update(); + if ( !anActor->GetVisibility() ) + continue; + } + SMESH::UpdateView( SMESH::eDisplay, entry.c_str() ); + + if ( SVTK_ViewWindow* vtkWnd = SMESH::GetVtkViewWindow(SMESH::GetActiveWindow() )) + if ( vtkWnd->getRenderer() ) + vtkWnd->getRenderer()->ResetCameraClippingRange(); if ( limitExceeded && !aMesh->_is_nil() ) { @@ -981,7 +1017,10 @@ void SMESHGUI_BaseComputeOp::computeMesh() if ( hidden & SMESH_Actor::eBallElem ) hiddenMsg << tr( "SMESH_BALLS" ); SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ), - tr( "SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED" ).arg( nbElements ).arg( limitSize ).arg( hiddenMsg.join(", ") ) ); + tr( "SMESH_WRN_SIZE_INC_LIMIT_EXCEEDED" ). + arg( nbElements ). + arg( limitSize ). + arg( hiddenMsg.join(", "))); } } catch (...) { @@ -1000,12 +1039,12 @@ void SMESHGUI_BaseComputeOp::computeMesh() { SUIT_MessageBox::warning( desktop(), tr( "SMESH_WRN_WARNING" ), - tr( "SMESH_WRN_SIZE_LIMIT_EXCEEDED" ).arg( nbElements ).arg( limitSize ) ); + tr( "SMESH_WRN_SIZE_LIMIT_EXCEEDED" ). + arg( nbElements ).arg( limitSize ) ); } } } - LightApp_SelectionMgr *Sel = selectionMgr(); - if ( Sel ) + if ( LightApp_SelectionMgr *Sel = selectionMgr() ) { SALOME_ListIO selected; selected.Append( myIObject ); @@ -1017,10 +1056,11 @@ void SMESHGUI_BaseComputeOp::computeMesh() if ( memoryLack ) aMemoryReserve.release(); - myCompDlg->setWindowTitle(tr( computeFailed ? "SMESH_WRN_COMPUTE_FAILED" : "SMESH_COMPUTE_SUCCEED")); + myCompDlg->setWindowTitle + ( tr( computeFailed ? "SMESH_WRN_COMPUTE_FAILED" : "SMESH_COMPUTE_SUCCEED" )); // SHOW ERRORS - + bool noCompError = ( !aCompErrors.operator->() || aCompErrors->length() == 0 ); bool noHypoError = ( aHypErrors.isEmpty() ); @@ -1081,7 +1121,7 @@ void SMESHGUI_BaseComputeOp::showComputeResult( const bool theMemoryLack, else { bool onlyWarnings = !theNoCompError; // == valid mesh computed but there are errors reported - for ( int i = 0; i < theCompErrors->length() && onlyWarnings; ++i ) + for ( CORBA::ULong i = 0; i < theCompErrors->length() && onlyWarnings; ++i ) onlyWarnings = ( theCompErrors[ i ].code == SMESH::COMPERR_WARNING || theCompErrors[ i ].code == SMESH::COMPERR_NO_MESH_ON_SHAPE ); @@ -1097,7 +1137,7 @@ void SMESHGUI_BaseComputeOp::showComputeResult( const bool theMemoryLack, aCompDlg->myFullInfo->hide(); } - // pbs of hypo dfinitions + // pbs of hypo definitions if ( theNoHypoError ) { aCompDlg->myHypErrorGroup->hide(); } else { @@ -1136,7 +1176,7 @@ void SMESHGUI_BaseComputeOp::showComputeResult( const bool theMemoryLack, tbl->setColumnWidth( COL_ERROR, 200 ); bool hasBadMesh = false; - for ( int row = 0; row < theCompErrors->length(); ++row ) + for ( int row = 0; row < (int) theCompErrors->length(); ++row ) { SMESH::ComputeError & err = theCompErrors[ row ]; @@ -1184,7 +1224,7 @@ void SMESHGUI_BaseComputeOp::showComputeResult( const bool theMemoryLack, currentCellChanged(); // to update buttons } } - // show dialog and wait, becase Compute can be invoked from Preview operation + // show dialog and wait, because Compute can be invoked from Preview operation //aCompDlg->exec(); // this way it becomes modal - impossible to rotate model in the Viewer aCompDlg->show(); } @@ -1218,8 +1258,8 @@ void SMESHGUI_BaseComputeOp::stopOperation() void SMESHGUI_BaseComputeOp::onPublishShape() { - GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen(); - SALOMEDS::Study_var study = SMESHGUI::GetSMESHGen()->GetCurrentStudy(); + GEOM::GEOM_Object_var meshShape = myMesh->GetShapeToMesh(); + GEOM::GEOM_Gen_var geomGen = SMESH::GetGEOMGen( meshShape ); QStringList entryList; QList rows; @@ -1234,12 +1274,13 @@ void SMESHGUI_BaseComputeOp::onPublishShape() if ( !SMESH::getSubShapeSO( 1, myMainShape )) // the main shape not published { QString name = GEOMBase::GetDefaultName( SMESH::shapeTypeName( myMainShape, "MAIN_SHAPE" )); - SALOMEDS::SObject_wrap so = - geomGen->AddInStudy( study, myMainShape, name.toLatin1().data(), GEOM::GEOM_Object::_nil()); + SALOMEDS::SObject_wrap so = geomGen->AddInStudy( myMainShape, + name.toUtf8().data(), + GEOM::GEOM_Object::_nil()); // look for myMainShape in the table for ( int r = 0, nr = table()->rowCount(); r < nr; ++r ) { if ( table()->item( r, COL_SHAPEID )->text() == "1" ) { - if ( so->_is_nil() ) { + if ( !so->_is_nil() ) { CORBA::String_var name = so->GetName(); CORBA::String_var entry = so->GetID(); QString shapeText = QString("%1 (%2)").arg( name.in() ).arg( entry.in() ); @@ -1252,7 +1293,8 @@ void SMESHGUI_BaseComputeOp::onPublishShape() if ( curSub == 1 ) continue; } QString name = GEOMBase::GetDefaultName( SMESH::shapeTypeName( shape, "ERROR_SHAPE" )); - SALOMEDS::SObject_wrap so = geomGen->AddInStudy( study, shape, name.toLatin1().data(), myMainShape); + SALOMEDS::SObject_wrap so = geomGen->AddInStudy( shape, + name.toUtf8().data(), myMainShape); if ( !so->_is_nil() ) { CORBA::String_var name = so->GetName(); CORBA::String_var entry = so->GetID(); @@ -1296,7 +1338,7 @@ void SMESHGUI_BaseComputeOp::onShowBadMesh() prop->SetPointSize( aPointSize * 3 ); prop->SetColor( 250, 0, 250 ); myBadMeshDisplayer->GetActor()->SetProperty( prop ); - myBadMeshDisplayer->SetData( aMeshData._retn() ); + myBadMeshDisplayer->SetData( aMeshData.in() ); prop->Delete(); } } @@ -1323,7 +1365,7 @@ void SMESHGUI_BaseComputeOp::onGroupOfBadMesh() else grName = "bad mesh of " + grName; SMESH::SMESH_Gen_var gen = getSMESHGUI()->GetSMESHGen(); SMESH::ListOfGroups_var groups - ( gen->MakeGroupsOfBadInputElements(myMesh,curSub,grName.toLatin1().data()) ); + ( gen->MakeGroupsOfBadInputElements(myMesh,curSub,grName.toUtf8().data()) ); update( UF_ObjBrowser | UF_Model ); if( LightApp_Application* anApp = dynamic_cast( application() )) { @@ -1482,13 +1524,13 @@ QTableWidget* SMESHGUI_BaseComputeOp::table() SMESHGUI_ComputeOp::SMESHGUI_ComputeOp() : SMESHGUI_BaseComputeOp() { - myHelpFileName = "constructing_meshes_page.html#compute_anchor"; + myHelpFileName = "constructing_meshes.html#compute-anchor"; } //================================================================================ /*! - * \brief Desctructor + * \brief Destructor */ //================================================================================ @@ -1542,15 +1584,15 @@ LightApp_Dialog* SMESHGUI_ComputeOp::dlg() const //================================================================================ /*! * \brief Constructor -*/ + */ //================================================================================ SMESHGUI_PrecomputeOp::SMESHGUI_PrecomputeOp() : SMESHGUI_BaseComputeOp(), - myDlg( 0 ), - myOrderMgr( 0 ), myActiveDlg( 0 ), - myPreviewDisplayer( 0 ) + myDlg( 0 ), + myPreviewDisplayer( 0 ), + myOrderMgr( 0 ) { } @@ -1592,7 +1634,7 @@ LightApp_Dialog* SMESHGUI_PrecomputeOp::dlg() const void SMESHGUI_PrecomputeOp::startOperation() { - myHelpFileName = "constructing_meshes_page.html#preview_anchor"; // other anchor onCompute() + myHelpFileName = "constructing_meshes.html#preview-anchor"; // other anchor onCompute() if ( !myDlg ) { @@ -1692,7 +1734,7 @@ void SMESHGUI_PrecomputeOp::initDialog() QList modes; QMap modeMap; - _PTR(SObject) pMesh = studyDS()->FindObjectID( myIObject->getEntry() ); + _PTR(SObject) pMesh = SMESH::getStudy()->FindObjectID( myIObject->getEntry() ); getAssignedAlgos( pMesh, modeMap ); if ( modeMap.contains( SMESH::DIM_3D ) ) { @@ -1710,7 +1752,7 @@ void SMESHGUI_PrecomputeOp::initDialog() myOrderMgr = new SMESHGUI_MeshOrderMgr( myDlg->getMeshOrderBox() ); myOrderMgr->SetMesh( myMesh ); bool isOrder = myOrderMgr->GetMeshOrder(myPrevOrder); - myDlg->getMeshOrderBox()->setShown(isOrder); + myDlg->getMeshOrderBox()->setVisible(isOrder); if ( !isOrder ) { delete myOrderMgr; myOrderMgr = 0; @@ -1721,21 +1763,21 @@ void SMESHGUI_PrecomputeOp::initDialog() //================================================================================ /*! - * \brief detect asigned mesh algorithms + * \brief detect assigned mesh algorithms */ //================================================================================ -void SMESHGUI_PrecomputeOp::getAssignedAlgos(_PTR(SObject) theMesh, +void SMESHGUI_PrecomputeOp::getAssignedAlgos(_PTR(SObject) theMesh, QMap& theModeMap) { if ( !theMesh ) return; + _PTR(SObject) aHypFolder; _PTR(GenericAttribute) anAttr; int aPart = SMESH::Tag_RefOnAppliedAlgorithms; - if ( theMesh->FindSubObject( aPart, aHypFolder ) ) + if ( theMesh->FindSubObject( aPart, aHypFolder )) { - _PTR(ChildIterator) anIter = - SMESH::GetActiveStudyDocument()->NewChildIterator( aHypFolder ); + _PTR(ChildIterator) anIter = SMESH::getStudy()->NewChildIterator( aHypFolder ); for ( ; anIter->More(); anIter->Next() ) { _PTR(SObject) anObj = anIter->Value(); @@ -1773,13 +1815,12 @@ void SMESHGUI_PrecomputeOp::getAssignedAlgos(_PTR(SObject) theMesh, } // check sub-meshes - for ( aPart = SMESH::Tag_SubMeshOnEdge; aPart < SMESH::Tag_LastSubMesh; ++aPart ) + for ( aPart = SMESH::Tag_SubMeshOnEdge; aPart <= SMESH::Tag_LastSubMesh; ++aPart ) { if ( !theMesh->FindSubObject( aPart, aHypFolder )) continue; - _PTR(ChildIterator) anIter = - SMESH::GetActiveStudyDocument()->NewChildIterator( aHypFolder ); + _PTR(ChildIterator) anIter = SMESH::getStudy()->NewChildIterator( aHypFolder ); for ( anIter->InitEx(true); anIter->More(); anIter->Next() ) { _PTR(SObject) anObj = anIter->Value(); @@ -1830,7 +1871,7 @@ void SMESHGUI_PrecomputeOp::onCompute() myOrderMgr->SetMeshOrder(); myMapShapeId.clear(); myActiveDlg = computeDlg(); - myHelpFileName = "constructing_meshes_page.html#compute_anchor"; + myHelpFileName = "constructing_meshes.html#compute-anchor"; computeMesh(); } @@ -1932,19 +1973,16 @@ void SMESHGUI_PrecomputeOp::onPreview() SMESH::long_array_var aShapesId = new SMESH::long_array(); try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 OCC_CATCH_SIGNALS; -#endif SMESH::MeshPreviewStruct_var previewData = gen->Precompute(myMesh, myMainShape, (SMESH::Dimension)dim, aShapesId); - SMESH::MeshPreviewStruct* previewRes = previewData._retn(); - if ( previewRes && previewRes->nodesXYZ.length() > 0 ) + if ( & previewData.in() && previewData->nodesXYZ.length() > 0 ) { computeFailed = false; - myPreviewDisplayer->SetData( previewRes ); - // append shape indeces with computed mesh entities + myPreviewDisplayer->SetData( previewData ); + // append shape indices with computed mesh entities for ( int i = 0, n = aShapesId->length(); i < n; i++ ) myMapShapeId[ aShapesId[ i ] ] = 0; } @@ -1957,12 +1995,10 @@ void SMESHGUI_PrecomputeOp::onPreview() } try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 OCC_CATCH_SIGNALS; -#endif aCompErrors = gen->GetComputeErrors( myMesh, myMainShape ); // check if there are memory problems - for ( int i = 0; (i < aCompErrors->length()) && !memoryLack; ++i ) + for ( CORBA::ULong i = 0; (i < aCompErrors->length()) && !memoryLack; ++i ) memoryLack = ( aCompErrors[ i ].code == SMESH::COMPERR_MEMORY_PB ); } catch(const SALOME::SALOME_Exception & S_ex){ @@ -1995,7 +2031,8 @@ void SMESHGUI_PrecomputeOp::onPreview() if ( isShowError ) { myDlg->hide(); - aCompDlg->setWindowTitle(tr( computeFailed ? "SMESH_WRN_COMPUTE_FAILED" : "SMESH_COMPUTE_SUCCEED")); + aCompDlg->setWindowTitle + ( tr( computeFailed ? "SMESH_WRN_COMPUTE_FAILED" : "SMESH_COMPUTE_SUCCEED" )); showComputeResult( memoryLack, noCompError, aCompErrors, noHypoError, aHypErrors ); } } @@ -2075,7 +2112,7 @@ void SMESHGUI_PrecomputeDlg::setPreviewModes( const QList& theModes ) int SMESHGUI_PrecomputeDlg::getPreviewMode() const { - return myPreviewMode->currentId(); + return myPreviewMode->currentId().toInt(); } //================================================================================ @@ -2099,13 +2136,13 @@ SMESHGUI_MeshOrderBox* SMESHGUI_PrecomputeDlg::getMeshOrderBox() const SMESHGUI_EvaluateOp::SMESHGUI_EvaluateOp() : SMESHGUI_BaseComputeOp() { - myHelpFileName = "constructing_meshes_page.html#evaluate_anchor"; + myHelpFileName = "constructing_meshes.html#evaluate-anchor"; } //================================================================================ /*! - * \brief Desctructor + * \brief Destructor */ //================================================================================ @@ -2174,9 +2211,7 @@ void SMESHGUI_BaseComputeOp::evaluateMesh() } SUIT_OverrideCursor aWaitCursor; try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 OCC_CATCH_SIGNALS; -#endif aRes = gen->Evaluate(myMesh, myMainShape); } catch(const SALOME::SALOME_Exception & S_ex){ @@ -2184,9 +2219,7 @@ void SMESHGUI_BaseComputeOp::evaluateMesh() } try { -#if (OCC_VERSION_MAJOR << 16 | OCC_VERSION_MINOR << 8 | OCC_VERSION_MAINTENANCE) > 0x060100 OCC_CATCH_SIGNALS; -#endif aCompErrors = gen->GetComputeErrors( myMesh, myMainShape ); } catch(const SALOME::SALOME_Exception & S_ex){ @@ -2198,10 +2231,11 @@ void SMESHGUI_BaseComputeOp::evaluateMesh() aMemoryReserve.release(); evaluateFailed = ( aCompErrors->length() > 0 ); - myCompDlg->setWindowTitle(tr( evaluateFailed ? "SMESH_WRN_EVALUATE_FAILED" : "SMESH_EVALUATE_SUCCEED")); + myCompDlg->setWindowTitle + ( tr( evaluateFailed ? "SMESH_WRN_EVALUATE_FAILED" : "SMESH_EVALUATE_SUCCEED" )); // SHOW ERRORS - + bool noCompError = ( !aCompErrors.operator->() || aCompErrors->length() == 0 ); bool noHypoError = ( aHypErrors.isEmpty() ); @@ -2293,7 +2327,7 @@ void SMESHGUI_BaseComputeOp::showEvaluateResult(const SMESH::long_array& theRes, tbl->setColumnWidth( COL_ERROR, 200 ); bool hasBadMesh = false; - for ( int row = 0; row < theCompErrors->length(); ++row ) + for ( int row = 0; row < (int) theCompErrors->length(); ++row ) { SMESH::ComputeError & err = theCompErrors[ row ]; @@ -2343,7 +2377,7 @@ void SMESHGUI_BaseComputeOp::showEvaluateResult(const SMESH::long_array& theRes, currentCellChanged(); // to update buttons } } - // show dialog and wait, becase Compute can be invoked from Preview operation + // show dialog and wait, because Compute can be invoked from Preview operation //aCompDlg->exec(); // this way it becomes modal - impossible to rotate model in the Viewer aCompDlg->show(); }