-// Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2020 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
#include <vector>
#include <set>
-#ifndef WIN32
+#if !defined WIN32 && !defined __APPLE__
#include <sys/sysinfo.h>
#endif
_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() ) {
myTable->hideColumn( COL_PUBLISHED );
myTable->hideColumn( COL_SHAPEID );
myTable->hideColumn( COL_BAD_MESH );
-#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0)
- myTable->horizontalHeader()->setResizeMode( COL_ERROR, QHeaderView::Interactive );
-#else
myTable->horizontalHeader()->setSectionResizeMode( COL_ERROR, QHeaderView::Interactive );
-#endif
myTable->setWordWrap( true );
myTable->horizontalHeader()->setStretchLastSection( true );
myTable->setMinimumWidth( 500 );
myBadMeshDisplayer = 0;
//myHelpFileName = "/files/about_meshes.htm"; // V3
- myHelpFileName = "about_meshes_page.html"; // V4
+ myHelpFileName = "about_meshes.html"; // V4
+}
+
+//================================================================================
+/*!
+ * \brief Gets dialog of this operation
+ * \retval LightApp_Dialog* - pointer to dialog of this operation
+ */
+//================================================================================
+
+LightApp_Dialog* SMESHGUI_BaseComputeOp::dlg() const
+{
+ return myCompDlg;
}
+//================================================================================
+/*!
+ * \brief Return a selected mesh
+ */
+//================================================================================
+
SMESH::SMESH_Mesh_ptr SMESHGUI_BaseComputeOp::getMesh()
{
LightApp_SelectionMgr* Sel = selectionMgr();
return myMesh->_is_nil() ? aMesh._retn() : SMESH::SMESH_Mesh::_duplicate( myMesh );
}
+//================================================================================
+/*!
+ * \brief check the same operations on the same mesh
+ */
+//================================================================================
+
+bool SMESHGUI_BaseComputeOp::isValid( SUIT_Operation* theOp ) const
+{
+ SMESHGUI_BaseComputeOp* baseOp = dynamic_cast<SMESHGUI_BaseComputeOp*>( theOp );
+ bool ret = true;
+ if ( !myMesh->_is_nil() && baseOp ) {
+ SMESH::SMESH_Mesh_var aMesh = baseOp->getMesh();
+ if ( !aMesh->_is_nil() && aMesh->GetId() == myMesh->GetId() ) ret = false;
+ }
+ return ret;
+}
+
//================================================================================
/*!
* \brief Start operation
return;
}
+ myCompDlg->myMeshName->setText( SMESH::GetName( myIObject ));
+
myMainShape = myMesh->GetShapeToMesh();
SMESHGUI_Operation::startOperation();
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
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
{
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 )
bool shapeOK = myMainShape->_is_nil() ? !hasShape : hasShape;
if ( shapeOK )
{
- myCompDlg->myMeshName->setText( aMeshSObj->GetName().c_str() );
SMESH::SMESH_Gen_var gen = getSMESHGUI()->GetSMESHGen();
SMESH::algo_error_array_var errors = gen->GetAlgoState(myMesh,myMainShape);
if ( errors->length() > 0 ) {
// NPAL16631: if ( !memoryLack )
{
- _PTR(SObject) sobj = SMESH::GetActiveStudyDocument()->FindObjectID(myIObject->getEntry());
- SMESH::ModifiedMesh( sobj,
- !computeFailed && aHypErrors.isEmpty(),
- myMesh->NbNodes() == 0);
update( UF_ObjBrowser | UF_Model );
// SHOW MESH
SMESH::SMESH_IDSource_var aSubMeshObj =
SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( smSObj );
SMESH_Actor *anActor = SMESH::FindActorByObject( aSubMeshObj );
- if ( anActor && anActor->GetVisibility() )
+ if ( anActor /*&& anActor->GetVisibility()*/ )
aListToUpdate.append( TListOf_IDSrc_SObj::value_type( aSubMeshObj, smSObj ));
}
// put Groups into list
SMESH::SMESH_IDSource_var aGroupObj =
SMESH::SObjectToInterface<SMESH::SMESH_IDSource>( aGroupSO );
SMESH_Actor *anActor = SMESH::FindActorByObject( aGroupObj );
- if ( anActor && anActor->GetVisibility() )
+ if ( anActor /*&& anActor->GetVisibility()*/ )
aListToUpdate.append( TListOf_IDSrc_SObj::value_type( aGroupObj, aGroupSO ));
}
{
try {
OCC_CATCH_SIGNALS;
- bool toDisplay = false;
+ std::string entry = (*anIter).second->GetID();
if ( !aMesh->_is_nil() ) // display only a mesh
{
- toDisplay = true;
SMESH_Actor *anActor = SMESH::FindActorByObject( aMesh );
- if ( !anActor ) anActor = SMESH::CreateActor( (*anIter).second->GetStudy(),
- (*anIter).second->GetID().c_str(),
- /*clearLog =*/ 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);
- if( SVTK_ViewWindow* vtkWnd = SMESH::GetVtkViewWindow(SMESH::GetActiveWindow() ) ) {
- if( vtkWnd->getRenderer() ){
- vtkWnd->getRenderer()->ResetCameraClippingRange();
- }
- }
+ 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() )
{
aCompDlg->myFullInfo->hide();
}
- // pbs of hypo dfinitions
+ // pbs of hypo definitions
if ( theNoHypoError ) {
aCompDlg->myHypErrorGroup->hide();
} else {
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();
}
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<int> rows;
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(),
+ 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() );
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();
prop->SetPointSize( aPointSize * 3 );
prop->SetColor( 250, 0, 250 );
myBadMeshDisplayer->GetActor()->SetProperty( prop );
- myBadMeshDisplayer->SetData( aMeshData._retn() );
+ myBadMeshDisplayer->SetData( aMeshData.in() );
prop->Delete();
}
}
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<LightApp_Application*>( application() ))
{
SMESHGUI_ComputeOp::SMESHGUI_ComputeOp()
: SMESHGUI_BaseComputeOp()
{
- myHelpFileName = "constructing_meshes_page.html#compute_anchor";
+ myHelpFileName = "constructing_meshes.html#compute-anchor";
}
//================================================================================
/*!
- * \brief Desctructor
+ * \brief Destructor
*/
//================================================================================
computeMesh();
}
-//================================================================================
-/*!
- * \brief check the same operations on the same mesh
- */
-//================================================================================
-
-bool SMESHGUI_BaseComputeOp::isValid( SUIT_Operation* theOp ) const
-{
- SMESHGUI_BaseComputeOp* baseOp = dynamic_cast<SMESHGUI_BaseComputeOp*>( theOp );
- bool ret = true;
- if ( !myMesh->_is_nil() && baseOp ) {
- SMESH::SMESH_Mesh_var aMesh = baseOp->getMesh();
- if ( !aMesh->_is_nil() && aMesh->GetId() == myMesh->GetId() ) ret = false;
- }
- return ret;
-}
-
//================================================================================
/*!
* \brief Gets dialog of this operation
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 )
{
QList<int> modes;
QMap<int, int> 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 ) )
{
//================================================================================
/*!
- * \brief detect asigned mesh algorithms
+ * \brief detect assigned mesh algorithms
*/
//================================================================================
int aPart = SMESH::Tag_RefOnAppliedAlgorithms;
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();
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();
myOrderMgr->SetMeshOrder();
myMapShapeId.clear();
myActiveDlg = computeDlg();
- myHelpFileName = "constructing_meshes_page.html#compute_anchor";
+ myHelpFileName = "constructing_meshes.html#compute-anchor";
computeMesh();
}
bool computeFailed = true, memoryLack = false;
SMESHGUI_ComputeDlg* aCompDlg = computeDlg();
- aCompDlg->myMeshName->setText( aMeshSObj->GetName().c_str() );
SMESHGUI* gui = getSMESHGUI();
SMESH::SMESH_Gen_var gen = gui->GetSMESHGen();
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;
}
}
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 ( CORBA::ULong i = 0; (i < aCompErrors->length()) && !memoryLack; ++i )
SMESHGUI_EvaluateOp::SMESHGUI_EvaluateOp()
: SMESHGUI_BaseComputeOp()
{
- myHelpFileName = "constructing_meshes_page.html#evaluate_anchor";
+ myHelpFileName = "constructing_meshes.html#evaluate-anchor";
}
//================================================================================
/*!
- * \brief Desctructor
+ * \brief Destructor
*/
//================================================================================
bool shapeOK = myMainShape->_is_nil() ? !hasShape : hasShape;
if ( shapeOK )
{
- myCompDlg->myMeshName->setText( aMeshSObj->GetName().c_str() );
SMESH::SMESH_Gen_var gen = getSMESHGUI()->GetSMESHGen();
SMESH::algo_error_array_var errors = gen->GetAlgoState(myMesh,myMainShape);
if ( errors->length() > 0 ) {
}
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){
}
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){
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();
}
return myCompDlg;
}
+//================================================================================
+/*!
+ * \brief SMESHGUI_BaseComputeOp constructor
+ */
+//================================================================================
+
+SMESHGUI_ShowErrorsOp::SMESHGUI_ShowErrorsOp():
+ SMESHGUI_BaseComputeOp()
+{
+}
+
+//================================================================================
+/*!
+ * \brief Start SMESHGUI_ShowErrorsOp
+ */
+//================================================================================
+
+void SMESHGUI_ShowErrorsOp::startOperation()
+{
+ SMESHGUI_BaseComputeOp::startOperation();
+
+ if ( myMesh->_is_nil() )
+ return;
+
+ SMESH::SMESH_Gen_var gen = getSMESHGUI()->GetSMESHGen();
+ SMESH::compute_error_array_var compErrors = gen->GetComputeErrors( myMesh, myMainShape );
+ QString hypErrors;
+ if ( compErrors->length() == 0 )
+ return;
+
+ showComputeResult( /*MemoryLack=*/false, /*NoCompError=*/false, compErrors,
+ /*NoHypoError=*/true, hypErrors );
+
+ SMESHGUI_ComputeDlg* aCompDlg = computeDlg();
+ aCompDlg->setWindowTitle( tr( "SMESH_WRN_COMPUTE_FAILED" ));
+ aCompDlg->myFullInfo->hide();
+ aCompDlg->myBriefInfo->hide();
+
+ return;
+}