typedef std::vector<vtkIdType> TVTKIds;
void SetPosition(SMESH_Actor* theActor,
- vtkIdType theType,
- const TVTKIds& theIds,
- bool theReset=true)
+ vtkIdType theType,
+ const TVTKIds& theIds,
+ bool theReset=true)
{
vtkUnstructuredGrid *aGrid = theActor->GetUnstructuredGrid();
myGrid->SetPoints(aGrid->GetPoints());
vtkIdList *anIds = vtkIdList::New();
for (int i = 0, iEnd = theIds.size(); i < iEnd; i++)
- anIds->InsertId(i,theIds[i]);
+ anIds->InsertId(i,theIds[i]);
myGrid->InsertNextCell(theType,anIds);
if(theIds.size()!=0){
- myGrid->InsertNextCell(theType,anIds);
- myGrid->Modified();
+ myGrid->InsertNextCell(theType,anIds);
+ myGrid->Modified();
}
-
+
anIds->Delete();
SetVisibility(true);
~TPolySimulation(){
if( myViewWindow )
- myViewWindow->RemoveActor(myPreviewActor);
+ myViewWindow->RemoveActor(myPreviewActor);
myPreviewActor->Delete();
{
case 0 :
{
- if ( myActor ){
+ if ( myActor ){
myActor->SetPointRepresentation(true);
- }
+ }
else
SMESH::SetPointRepresentation(true);
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(NodeSelection);
-
- AddButton->setEnabled(false);
- RemoveButton->setEnabled(false);
- TextLabelIds->setText( tr( "SMESH_ID_NODES" ) );
- myFacesByNodesLabel->show();
- myFacesByNodes->clear();
- myFacesByNodes->show();
- AddButton->show();
- RemoveButton->show();
- Preview->show();
- break;
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(NodeSelection);
+
+ AddButton->setEnabled(false);
+ RemoveButton->setEnabled(false);
+ TextLabelIds->setText( tr( "SMESH_ID_NODES" ) );
+ myFacesByNodesLabel->show();
+ myFacesByNodes->clear();
+ myFacesByNodes->show();
+ AddButton->show();
+ RemoveButton->show();
+ Preview->show();
+ break;
}
case 1 :
{
- if( myActor ){
- myActor->SetPointRepresentation(false);
- } else {
- SMESH::SetPointRepresentation(false);
- }
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->SetSelectionMode(FaceSelection);
-
- TextLabelIds->setText( tr( "SMESH_ID_FACES" ) );
- myFacesByNodesLabel->hide();
- myFacesByNodes->hide();
- AddButton->hide();
- RemoveButton->hide();
- Preview->show();
- break;
+ if( myActor ){
+ myActor->SetPointRepresentation(false);
+ } else {
+ SMESH::SetPointRepresentation(false);
+ }
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->SetSelectionMode(FaceSelection);
+
+ TextLabelIds->setText( tr( "SMESH_ID_FACES" ) );
+ myFacesByNodesLabel->hide();
+ myFacesByNodes->hide();
+ AddButton->hide();
+ RemoveButton->hide();
+ Preview->show();
+ break;
}
}
if(checkEditLine(false) == -1) {return;}
busy = true;
if (GetConstructorId() == 0)
- {
- SMESH::long_array_var anIdsOfNodes = new SMESH::long_array;
- SMESH::long_array_var aQuantities = new SMESH::long_array;
-
- aQuantities->length( myFacesByNodes->count() );
-
- TColStd_ListOfInteger aNodesIds;
-
- int aNbQuantities = 0;
- for (int i = 0; i < myFacesByNodes->count(); i++ ) {
- QStringList anIds = myFacesByNodes->item(i)->text().split( " ", QString::SkipEmptyParts );
- for (QStringList::iterator it = anIds.begin(); it != anIds.end(); ++it)
- aNodesIds.Append( (*it).toInt() );
-
- aQuantities[aNbQuantities++] = anIds.count();
- }
-
- anIdsOfNodes->length(aNodesIds.Extent());
-
- int aNbIdsOfNodes = 0;
- TColStd_ListIteratorOfListOfInteger It;
- It.Initialize(aNodesIds);
- for( ;It.More();It.Next())
- anIdsOfNodes[aNbIdsOfNodes++] = It.Value();
-
- try{
- SUIT_OverrideCursor aWaitCursor;
- SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
- aMeshEditor->AddPolyhedralVolume(anIdsOfNodes, aQuantities);
- }catch(SALOME::SALOME_Exception& exc){
- INFOS("Follow exception was cought:\n\t"<<exc.details.text);
- }catch(std::exception& exc){
- INFOS("Follow exception was cought:\n\t"<<exc.what());
- }catch(...){
- INFOS("Unknown exception was cought !!!");
- }
- }
+ {
+ SMESH::long_array_var anIdsOfNodes = new SMESH::long_array;
+ SMESH::long_array_var aQuantities = new SMESH::long_array;
+
+ aQuantities->length( myFacesByNodes->count() );
+
+ TColStd_ListOfInteger aNodesIds;
+
+ int aNbQuantities = 0;
+ for (int i = 0; i < myFacesByNodes->count(); i++ ) {
+ QStringList anIds = myFacesByNodes->item(i)->text().split( " ", QString::SkipEmptyParts );
+ for (QStringList::iterator it = anIds.begin(); it != anIds.end(); ++it)
+ aNodesIds.Append( (*it).toInt() );
+
+ aQuantities[aNbQuantities++] = anIds.count();
+ }
+
+ anIdsOfNodes->length(aNodesIds.Extent());
+
+ int aNbIdsOfNodes = 0;
+ TColStd_ListIteratorOfListOfInteger It;
+ It.Initialize(aNodesIds);
+ for( ;It.More();It.Next())
+ anIdsOfNodes[aNbIdsOfNodes++] = It.Value();
+
+ try{
+ SUIT_OverrideCursor aWaitCursor;
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+ aMeshEditor->AddPolyhedralVolume(anIdsOfNodes, aQuantities);
+ }catch(SALOME::SALOME_Exception& exc){
+ INFOS("Follow exception was cought:\n\t"<<exc.details.text);
+ }catch(std::exception& exc){
+ INFOS("Follow exception was cought:\n\t"<<exc.what());
+ }catch(...){
+ INFOS("Unknown exception was cought !!!");
+ }
+ }
else if (GetConstructorId() == 1)
- {
- SMESH::long_array_var anIdsOfFaces = new SMESH::long_array;
-
- QStringList aListId = myEditCurrentArgument->text().split( " ", QString::SkipEmptyParts );
- anIdsOfFaces->length(aListId.count());
- for ( int i = 0; i < aListId.count(); i++ )
- anIdsOfFaces[i] = aListId[i].toInt();
-
- try{
- SUIT_OverrideCursor aWaitCursor;
- SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
- aMeshEditor->AddPolyhedralVolumeByFaces(anIdsOfFaces);
- }catch(SALOME::SALOME_Exception& exc){
- INFOS("Follow exception was cought:\n\t"<<exc.details.text);
- }catch(std::exception& exc){
- INFOS("Follow exception was cought:\n\t"<<exc.what());
- }catch(...){
- INFOS("Unknown exception was cought !!!");
- }
- }
+ {
+ SMESH::long_array_var anIdsOfFaces = new SMESH::long_array;
+
+ QStringList aListId = myEditCurrentArgument->text().split( " ", QString::SkipEmptyParts );
+ anIdsOfFaces->length(aListId.count());
+ for ( int i = 0; i < aListId.count(); i++ )
+ anIdsOfFaces[i] = aListId[i].toInt();
+
+ try{
+ SUIT_OverrideCursor aWaitCursor;
+ SMESH::SMESH_MeshEditor_var aMeshEditor = myMesh->GetMeshEditor();
+ aMeshEditor->AddPolyhedralVolumeByFaces(anIdsOfFaces);
+ }catch(SALOME::SALOME_Exception& exc){
+ INFOS("Follow exception was cought:\n\t"<<exc.details.text);
+ }catch(std::exception& exc){
+ INFOS("Follow exception was cought:\n\t"<<exc.what());
+ }catch(...){
+ INFOS("Unknown exception was cought !!!");
+ }
+ }
//SALOME_ListIO aList;
//mySelectionMgr->setSelectedObjects( aList );
SMESH::UpdateView();
if( myActor ){
- unsigned int anEntityMode = myActor->GetEntityMode();
- myActor->SetEntityMode(SMESH_Actor::eVolumes | anEntityMode);
+ unsigned int anEntityMode = myActor->GetEntityMode();
+ myActor->SetEntityMode(SMESH_Actor::eVolumes | anEntityMode);
}
//ConstructorsClicked( GetConstructorId() );
busy = false;
ClickOnCancel();
}
-
+
//=================================================================================
// function : ClickOnCancel()
// purpose :
platform = "application";
#endif
SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
- tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
- arg(app->resourceMgr()->stringValue("ExternalBrowser",
- platform)).
- arg(myHelpFileName));
+ tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+ arg(app->resourceMgr()->stringValue("ExternalBrowser",
+ platform)).
+ arg(myHelpFileName));
}
}
if (GetConstructorId() == 0)
{
if ( aMesh ) {
- TColStd_MapOfInteger newIndices;
+ TColStd_MapOfInteger newIndices;
- QStringList aListId = theNewText.split( " ", QString::SkipEmptyParts );
- for ( int i = 0; i < aListId.count(); i++ ) {
- const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() );
- if ( n ) {
- newIndices.Add(n->GetID());
- myNbOkElements++;
- }
- }
+ QStringList aListId = theNewText.split( " ", QString::SkipEmptyParts );
+ for ( int i = 0; i < aListId.count(); i++ ) {
+ const SMDS_MeshNode * n = aMesh->FindNode( aListId[ i ].toInt() );
+ if ( n ) {
+ newIndices.Add(n->GetID());
+ myNbOkElements++;
+ }
+ }
- mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false );
+ mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false );
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->highlight( myActor->getIO(), true, true );
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->highlight( myActor->getIO(), true, true );
- if ( myNbOkElements>0 && aListId.count()>=3)
- AddButton->setEnabled(true);
- else
- AddButton->setEnabled(false);
+ if ( myNbOkElements>0 && aListId.count()>=3)
+ AddButton->setEnabled(true);
+ else
+ AddButton->setEnabled(false);
- displaySimulation();
+ displaySimulation();
}
} else if (GetConstructorId() == 1)
{
- myNbOkElements = 0;
- buttonOk->setEnabled( false );
- buttonApply->setEnabled( false );
+ myNbOkElements = 0;
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
- // check entered ids of faces and hilight them
- QStringList aListId;
- if ( aMesh ) {
- TColStd_MapOfInteger newIndices;
+ // check entered ids of faces and hilight them
+ QStringList aListId;
+ if ( aMesh ) {
+ TColStd_MapOfInteger newIndices;
- aListId = theNewText.split( " ", QString::SkipEmptyParts );
-
- for ( int i = 0; i < aListId.count(); i++ ) {
- const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
- if ( e ) {
- newIndices.Add(e->GetID());
- myNbOkElements++;
- }
- }
-
- mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false );
- if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
- aViewWindow->highlight( myActor->getIO(), true, true );
+ aListId = theNewText.split( " ", QString::SkipEmptyParts );
+
+ for ( int i = 0; i < aListId.count(); i++ ) {
+ const SMDS_MeshElement * e = aMesh->FindElement( aListId[ i ].toInt() );
+ if ( e ) {
+ newIndices.Add(e->GetID());
+ myNbOkElements++;
+ }
+ }
+
+ mySelector->AddOrRemoveIndex( myActor->getIO(), newIndices, false );
+ if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
+ aViewWindow->highlight( myActor->getIO(), true, true );
- if ( myNbOkElements ) {
- if (aListId.count()>1){
- buttonOk->setEnabled( true );
- buttonApply->setEnabled( true );
- }
- else{
- buttonOk->setEnabled( false );
- buttonApply->setEnabled( false );
- }
- if(aListId.count()>1)
- displaySimulation();
- }
- }
+ if ( myNbOkElements ) {
+ if (aListId.count()>1){
+ buttonOk->setEnabled( true );
+ buttonApply->setEnabled( true );
+ }
+ else{
+ buttonOk->setEnabled( false );
+ buttonApply->setEnabled( false );
+ }
+ if(aListId.count()>1)
+ displaySimulation();
+ }
+ }
}
busy = false;
}
case 0:{ // nodes
const SMDS_MeshNode * aNode = aMesh->FindNode( aListId[ i ].toInt() );
if( !aNode ){
- SUIT_MessageBox::warning(this,
- tr("SMESH_POLYEDRE_CREATE_ERROR"),
- tr("The incorrect indices of nodes!"));
-
- myEditCurrentArgument->clear();
- myEditCurrentArgument->setText( aString );
- return -1;
+ SUIT_MessageBox::warning(this,
+ tr("SMESH_POLYEDRE_CREATE_ERROR"),
+ tr("The incorrect indices of nodes!"));
+
+ myEditCurrentArgument->clear();
+ myEditCurrentArgument->setText( aString );
+ return -1;
}
break;
bool aElemIsOK = true;
const SMDS_MeshElement * aElem = aMesh->FindElement( aListId[ i ].toInt() );
if (!aElem)
- {
- aElemIsOK = false;
- }
+ {
+ aElemIsOK = false;
+ }
else
- {
- SMDSAbs_ElementType aType = aMesh->GetElementType( aElem->GetID(),true );
- if (aType != SMDSAbs_Face){
- aElemIsOK = false;
- }
- }
+ {
+ SMDSAbs_ElementType aType = aMesh->GetElementType( aElem->GetID(),true );
+ if (aType != SMDSAbs_Face){
+ aElemIsOK = false;
+ }
+ }
if (!aElemIsOK){
- SUIT_MessageBox::warning(this,
- tr("SMESH_POLYEDRE_CREATE_ERROR"),
- tr("The incorrect indices of faces!"));
-
- myEditCurrentArgument->clear();
- myEditCurrentArgument->setText( aString );
- return -1;
+ SUIT_MessageBox::warning(this,
+ tr("SMESH_POLYEDRE_CREATE_ERROR"),
+ tr("The incorrect indices of faces!"));
+
+ myEditCurrentArgument->clear();
+ myEditCurrentArgument->setText( aString );
+ return -1;
}
break;
}
vtkIdType aType = VTK_CONVEX_POINT_SET;
SMDS_Mesh* aMesh = 0;
if ( myActor ){
- aMesh = myActor->GetObject()->GetMesh();
+ aMesh = myActor->GetObject()->GetMesh();
}
if (GetConstructorId() == 0 && aMesh){
- if (!AddButton->isEnabled()){
- mySimulation->ResetGrid(true);
- for (int i = 0; i < myFacesByNodes->count(); i++) {
- QStringList anIds = myFacesByNodes->item(i)->text().split( " ", QString::SkipEmptyParts );
- SMESH::TPolySimulation::TVTKIds aVTKIds_faces;
- for (QStringList::iterator it = anIds.begin(); it != anIds.end(); ++it){
- const SMDS_MeshNode* aNode = aMesh->FindNode( (*it).toInt() );
- if (!aNode) continue;
- vtkIdType aId = myActor->GetObject()->GetNodeVTKId( (*it).toInt() );
- aVTKIds.push_back(aId);
- aVTKIds_faces.push_back(aId);
- }
- if(!Preview->isChecked()){
- aType = VTK_POLYGON;
- mySimulation->SetPosition(myActor, aType, aVTKIds_faces,false);
- }
- }
- if(myFacesByNodes->count() == 0){
- mySimulation->SetVisibility(false);
- } else {
- mySimulation->SetVisibility(true);
- }
- if(Preview->isChecked()){
- mySimulation->SetPosition(myActor, aType, aVTKIds);
- }
- } else {
- // add ids from edit line
- QStringList anEditIds = myEditCurrentArgument->text().split( " ", QString::SkipEmptyParts );
- for ( int i = 0; i < anEditIds.count(); i++ )
- aVTKIds.push_back( myActor->GetObject()->GetNodeVTKId( anEditIds[ i ].toInt() ));
- aType = VTK_POLYGON;
- mySimulation->SetPosition(myActor, aType, aVTKIds);
- }
+ if (!AddButton->isEnabled()){
+ mySimulation->ResetGrid(true);
+ for (int i = 0; i < myFacesByNodes->count(); i++) {
+ QStringList anIds = myFacesByNodes->item(i)->text().split( " ", QString::SkipEmptyParts );
+ SMESH::TPolySimulation::TVTKIds aVTKIds_faces;
+ for (QStringList::iterator it = anIds.begin(); it != anIds.end(); ++it){
+ const SMDS_MeshNode* aNode = aMesh->FindNode( (*it).toInt() );
+ if (!aNode) continue;
+ vtkIdType aId = myActor->GetObject()->GetNodeVTKId( (*it).toInt() );
+ aVTKIds.push_back(aId);
+ aVTKIds_faces.push_back(aId);
+ }
+ if(!Preview->isChecked()){
+ aType = VTK_POLYGON;
+ mySimulation->SetPosition(myActor, aType, aVTKIds_faces,false);
+ }
+ }
+ if(myFacesByNodes->count() == 0){
+ mySimulation->SetVisibility(false);
+ } else {
+ mySimulation->SetVisibility(true);
+ }
+ if(Preview->isChecked()){
+ mySimulation->SetPosition(myActor, aType, aVTKIds);
+ }
+ } else {
+ // add ids from edit line
+ QStringList anEditIds = myEditCurrentArgument->text().split( " ", QString::SkipEmptyParts );
+ for ( int i = 0; i < anEditIds.count(); i++ )
+ aVTKIds.push_back( myActor->GetObject()->GetNodeVTKId( anEditIds[ i ].toInt() ));
+ aType = VTK_POLYGON;
+ mySimulation->SetPosition(myActor, aType, aVTKIds);
+ }
}else if(GetConstructorId() == 1 && aMesh){
- QStringList aListId = myEditCurrentArgument->text().split( " ", QString::SkipEmptyParts );
- for ( int i = 0; i < aListId.count(); i++ )
- {
- const SMDS_MeshElement * anElem = aMesh->FindElement( aListId[ i ].toInt() );
- if ( !anElem ) continue;
- SMDSAbs_ElementType aFaceType = aMesh->GetElementType( anElem->GetID(),true );
- if (aFaceType != SMDSAbs_Face) continue;
-
- SMDS_ElemIteratorPtr anIter = anElem->nodesIterator();
- SMESH::TPolySimulation::TVTKIds aVTKIds_faces;
- while( anIter->more() )
- if ( const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next() ){
- vtkIdType aId = myActor->GetObject()->GetNodeVTKId( aNode->GetID() );
- aVTKIds.push_back(aId);
- aVTKIds_faces.push_back(aId);
- }
- if(!Preview->isChecked()){
- aType = VTK_POLYGON;
- mySimulation->SetPosition(myActor, aType, aVTKIds_faces);
- }
- }
- if(Preview->isChecked())
- mySimulation->SetPosition(myActor, aType, aVTKIds);
+ QStringList aListId = myEditCurrentArgument->text().split( " ", QString::SkipEmptyParts );
+ for ( int i = 0; i < aListId.count(); i++ )
+ {
+ const SMDS_MeshElement * anElem = aMesh->FindElement( aListId[ i ].toInt() );
+ if ( !anElem ) continue;
+ SMDSAbs_ElementType aFaceType = aMesh->GetElementType( anElem->GetID(),true );
+ if (aFaceType != SMDSAbs_Face) continue;
+
+ SMDS_ElemIteratorPtr anIter = anElem->nodesIterator();
+ SMESH::TPolySimulation::TVTKIds aVTKIds_faces;
+ while( anIter->more() )
+ if ( const SMDS_MeshNode* aNode = (SMDS_MeshNode*)anIter->next() ){
+ vtkIdType aId = myActor->GetObject()->GetNodeVTKId( aNode->GetID() );
+ aVTKIds.push_back(aId);
+ aVTKIds_faces.push_back(aId);
+ }
+ if(!Preview->isChecked()){
+ aType = VTK_POLYGON;
+ mySimulation->SetPosition(myActor, aType, aVTKIds_faces);
+ }
+ }
+ if(Preview->isChecked())
+ mySimulation->SetPosition(myActor, aType, aVTKIds);
}
SMESH::UpdateView();
}