-// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2020 CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#define SPACING 6
#define MARGIN 11
+namespace
+{
+ enum { MANUAL_MODE = 0, SEARCH_MODE }; // how a node to move is specified
+}
+
/*!
* \brief Dialog to publish a sub-shape of the mesh main shape
* by selecting mesh elements
myDestDX->hide();
myDestDY->hide();
myDestDZ->hide();
- if (myNodeToMoveGrp->isVisible()) {myNodeToMoveGrp->hide();}
+ if (myNodeToMoveGrp->isVisible()) myNodeToMoveGrp->hide();
+ myDestBtn->setChecked( true );
break;
}
}
SMESHGUI_MakeNodeAtPointOp::SMESHGUI_MakeNodeAtPointOp()
{
mySimulation = 0;
+ mySMESHGUI = 0;
myDlg = new SMESHGUI_MakeNodeAtPointDlg;
myFilter = 0;
- myHelpFileName = "mesh_through_point_page.html";
+ myHelpFileName = "mesh_through_point.html";
myNoPreview = false;
myUpdateDestination = false;
myDestCoordChanged = true;
// connect signals and slots
- connect(myDlg->myDestinationX, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
- connect(myDlg->myDestinationY, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
- connect(myDlg->myDestinationZ, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
- connect(myDlg->myDestDX, SIGNAL (valueChanged(double)), this, SLOT(onDestCoordChanged()));
- connect(myDlg->myDestDY, SIGNAL (valueChanged(double)), this, SLOT(onDestCoordChanged()));
- connect(myDlg->myDestDZ, SIGNAL (valueChanged(double)), this, SLOT(onDestCoordChanged()));
- connect(myDlg->myId,SIGNAL (textChanged(const QString&)),SLOT(redisplayPreview()));
- connect(myDlg->myPreviewChkBox, SIGNAL (toggled(bool)),SLOT(redisplayPreview()));
+ connect(myDlg->myDestinationX, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
+ connect(myDlg->myDestinationY, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
+ connect(myDlg->myDestinationZ, SIGNAL (valueChanged(double)), this, SLOT(redisplayPreview()));
+ connect(myDlg->myDestDX, SIGNAL (valueChanged(double)), this, SLOT(onDestCoordChanged()));
+ connect(myDlg->myDestDY, SIGNAL (valueChanged(double)), this, SLOT(onDestCoordChanged()));
+ connect(myDlg->myDestDZ, SIGNAL (valueChanged(double)), this, SLOT(onDestCoordChanged()));
+ connect(myDlg->myId, SIGNAL (textChanged(const QString&)),SLOT(redisplayPreview()));
+ connect(myDlg->myPreviewChkBox, SIGNAL (toggled(bool)), SLOT(redisplayPreview()));
+ connect(myDlg->myButtonGroup, SIGNAL (buttonClicked(int)), SLOT(redisplayPreview()));
// IPAL22913: TC6.5.0: selected in "Move node" dialog box node is not highlighted
// note: this slot seems to be lost together with removed obsolete SMESHGUI_MoveNodesDlg class
// init simulation with a current View
if ( mySimulation ) delete mySimulation;
- mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( getSMESHGUI() ));
+ mySMESHGUI = getSMESHGUI();
+ mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI ) );
+ connect(mySMESHGUI, SIGNAL (SignalActivatedViewManager()), this, SLOT(onOpenView()));
+ connect(mySMESHGUI, SIGNAL (SignalCloseView()), this, SLOT(onCloseView()));
vtkProperty* aProp = vtkProperty::New();
aProp->SetRepresentationToWireframe();
aProp->SetColor(250, 0, 250);
myDlg->myDestDZ->setReadOnly(true);
myDlg->myRButNodeToMove->setChecked(true);
- myDlg->ConstructorsClicked(GetConstructorId());
+ myDlg->ConstructorsClicked( GetConstructorId() );
myDlg->show();
onSelectionDone(); // init myMeshActor
-
- if ( myMeshActor ) {
-// myMeshActor->SetRepresentation( VTK_WIREFRAME );
- myMeshActor->SetPointRepresentation(true);
- SMESH::RepaintCurrentView();
- redisplayPreview();
- }
}
//=================================================================================
void SMESHGUI_MakeNodeAtPointOp::stopOperation()
{
myNoPreview = true;
- mySimulation->SetVisibility(false);
+ if ( mySimulation )
+ {
+ mySimulation->SetVisibility(false);
+ delete mySimulation;
+ mySimulation = 0;
+ }
if ( myMeshActor ) {
- myMeshActor->SetPointRepresentation(false);
- SMESH::RepaintCurrentView();
myMeshActor = 0;
}
+ SMESH::SetPointRepresentation( false );
+ SMESH::RepaintCurrentView();
+
+ disconnect(mySMESHGUI, SIGNAL (SignalActivatedViewManager()), this, SLOT(onOpenView()));
+ disconnect(mySMESHGUI, SIGNAL (SignalCloseView()), this, SLOT(onCloseView()));
selectionMgr()->removeFilter( myFilter );
SMESHGUI_SelectionOp::stopOperation();
}
bool SMESHGUI_MakeNodeAtPointOp::onApply()
{
- if( isStudyLocked() )
+ if( SMESHGUI::isStudyLocked() )
return false;
if ( !myMeshActor ) {
if (aMeshEditor->_is_nil())
return true;
- aMesh->SetParameters( aParameters.join(":").toLatin1().constData() );
+ aMesh->SetParameters( aParameters.join(":").toUtf8().constData() );
bool ok;
int anId = myDlg->myId->text().toInt( &ok );
{
if ( !myDlg->isVisible() || !myDlg->isEnabled() )
return;
+
+ myNoPreview = true;
try {
SALOME_ListIO aList;
selectionMgr()->selectedObjects(aList, SVTK_Viewer::Type());
Handle(SALOME_InteractiveObject) anIO = aList.First();
SMESH_Actor* aMeshActor = SMESH::FindActorByEntry(anIO->getEntry());
+ if (( myDlg->myIdBtn->isChecked() && myDlg->myIdBtn->isEnabled() ) ||
+ ( !myDlg->myNodeToMoveGrp->isVisible() ))
+ myMeshActor = aMeshActor;
+
if (!aMeshActor) { // coord by geom
if ( myDlg->myDestBtn->isChecked() ) {
GEOM::GEOM_Object_var geom = SMESH::IObjectToInterface<GEOM::GEOM_Object>(anIO);
if ( GEOMBase::GetShape(geom, aShape) &&
aShape.ShapeType() == TopAbs_VERTEX ) {
gp_Pnt P = BRep_Tool::Pnt(aShape);
- myNoPreview = true;
myDlg->myDestinationX->SetValue(P.X());
myDlg->myDestinationY->SetValue(P.Y());
myDlg->myDestinationZ->SetValue(P.Z());
- myNoPreview = false;
- redisplayPreview();
}
}
+ myNoPreview = false;
+ redisplayPreview();
return;
}
}
- if ( !myMeshActor )
- myMeshActor = aMeshActor;
-
QString aString;
int nbElems = SMESH::GetNameOfSelectedElements(selector(),anIO, aString);
if (nbElems == 1) {
if (SMDS_Mesh* aMesh = aMeshActor->GetObject()->GetMesh()) {
if (const SMDS_MeshNode* aNode = aMesh->FindNode(aString.toInt())) {
- myNoPreview = true;
if ( myDlg->myDestBtn->isChecked() ) { // set coord
myDlg->myDestinationX->SetValue(aNode->X());
myDlg->myDestinationY->SetValue(aNode->Y());
myDlg->myDestinationZ->SetValue(aNode->Z());
- myNoPreview = false;
- redisplayPreview();
}
else if ( myDlg->myIdBtn->isChecked() &&
myDlg->myIdBtn->isEnabled() ) { // set node to move
myDlg->myId->setText(aString);
- myNoPreview = false;
+ myDlg->myCurrentX->SetValue( aNode->X() );
+ myDlg->myCurrentY->SetValue( aNode->Y() );
+ myDlg->myCurrentZ->SetValue( aNode->Z() );
redisplayPreview();
}
- if (const SMDS_MeshNode* aCurrentNode = aMesh->FindNode(myDlg->myId->text().toInt())) {
- double x = aCurrentNode->X();
- double y = aCurrentNode->Y();
- double z = aCurrentNode->Z();
- double dx = myDlg->myDestinationX->GetValue() - x;
- double dy = myDlg->myDestinationY->GetValue() - y;
- double dz = myDlg->myDestinationZ->GetValue() - z;
- myDlg->myCurrentX->SetValue(x);
- myDlg->myCurrentY->SetValue(y);
- myDlg->myCurrentZ->SetValue(z);
- myDlg->myDestDX->SetValue(dx);
- myDlg->myDestDY->SetValue(dy);
- myDlg->myDestDZ->SetValue(dz);
- myDlg->myDestDX->setReadOnly(false);
- myDlg->myDestDY->setReadOnly(false);
- myDlg->myDestDZ->setReadOnly(false);
- }
+ double x = myDlg->myCurrentX->GetValue();
+ double y = myDlg->myCurrentY->GetValue();
+ double z = myDlg->myCurrentZ->GetValue();
+ double dx = myDlg->myDestinationX->GetValue() - x;
+ double dy = myDlg->myDestinationY->GetValue() - y;
+ double dz = myDlg->myDestinationZ->GetValue() - z;
+ myDlg->myDestDX->SetValue(dx);
+ myDlg->myDestDY->SetValue(dy);
+ myDlg->myDestDZ->SetValue(dz);
+ myDlg->myDestDX->setReadOnly(false);
+ myDlg->myDestDY->setReadOnly(false);
+ myDlg->myDestDZ->setReadOnly(false);
}
}
}
} catch (...) {
}
+
+ myNoPreview = false;
+ redisplayPreview();
}
//================================================================================
return;
myNoPreview = true;
+ if ( !myMeshActor && GetConstructorId() == SEARCH_MODE )
+ onSelectionDone();
+
SMESH::MeshPreviewStruct_var aMeshPreviewStruct;
bool moveShown = false;
if ( myMeshActor)
{
- const bool isPreview = myDlg->myPreviewChkBox->isChecked();
+ const bool isPreview = myDlg->myPreviewChkBox->isChecked();
const bool isMoveNode = myDlg->myRButMoveWithoutNode->isChecked();
QString msg;
if ( isValid( msg ) )
myDlg->myDestinationX->SetValue(x);
myDlg->myDestinationY->SetValue(y);
myDlg->myDestinationZ->SetValue(z);
- }
- if ( myDestCoordChanged ) {
- dx = myDlg->myDestinationX->GetValue() - myDlg->myCurrentX->GetValue();
- dy = myDlg->myDestinationY->GetValue() - myDlg->myCurrentY->GetValue();
- dz = myDlg->myDestinationZ->GetValue() - myDlg->myCurrentZ->GetValue();
myDlg->myDestDX->SetValue(dx);
myDlg->myDestDY->SetValue(dy);
myDlg->myDestDZ->SetValue(dz);
}
- else {
- dx = myDlg->myDestDX->GetValue() + myDlg->myCurrentX->GetValue();;
- dy = myDlg->myDestDY->GetValue() + myDlg->myCurrentY->GetValue();;
- dz = myDlg->myDestDZ->GetValue() + myDlg->myCurrentZ->GetValue();;
- myDlg->myDestinationX->SetValue(dx);
- myDlg->myDestinationY->SetValue(dy);
- myDlg->myDestinationZ->SetValue(dz);
+ else
+ {
+ if ( myDestCoordChanged ) {
+ dx = myDlg->myDestinationX->GetValue() - x;
+ dy = myDlg->myDestinationY->GetValue() - y;
+ dz = myDlg->myDestinationZ->GetValue() - z;
+ myDlg->myDestDX->SetValue(dx);
+ myDlg->myDestDY->SetValue(dy);
+ myDlg->myDestDZ->SetValue(dz);
+ }
+ else {
+ dx = myDlg->myDestDX->GetValue() + x;
+ dy = myDlg->myDestDY->GetValue() + y;
+ dz = myDlg->myDestDZ->GetValue() + z;
+ myDlg->myDestinationX->SetValue(dx);
+ myDlg->myDestinationY->SetValue(dy);
+ myDlg->myDestinationZ->SetValue(dz);
+ }
}
myDlg->myCurrentX->SetValue(x);
myDlg->myCurrentY->SetValue(y);
}
}
}
- }catch (...) {
+ }
+ catch (...) {
}
}
}
aMeshPreviewStruct->elementConnectivities.length(1);
aMeshPreviewStruct->elementConnectivities[0] = 0;
}
-
+ if (!mySimulation)
+ mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI ));
// display data
- if ( aMeshPreviewStruct.operator->() )
+ if ( & aMeshPreviewStruct.in() )
{
- mySimulation->SetData(aMeshPreviewStruct._retn());
+ mySimulation->SetData( aMeshPreviewStruct.in() );
}
else
{
myNoPreview = false;
}
+//=================================================================================
+/*!
+ * \brief SLOT called when the viewer opened
+ */
+//=================================================================================
+void SMESHGUI_MakeNodeAtPointOp::onOpenView()
+{
+ if ( mySimulation ) {
+ mySimulation->SetVisibility(false);
+ SMESH::SetPointRepresentation(false);
+ }
+ else {
+ mySimulation = new SMESHGUI_MeshEditPreview(SMESH::GetViewWindow( mySMESHGUI ));
+ }
+}
+
+//=================================================================================
+/*!
+ * \brief SLOT called when the viewer closed
+ */
+//=================================================================================
+void SMESHGUI_MakeNodeAtPointOp::onCloseView()
+{
+ delete mySimulation;
+ mySimulation = 0;
+}
+
//================================================================================
/*!
* \brief SLOT called when the node id is manually changed
void SMESHGUI_MakeNodeAtPointOp::activateSelection()
{
selectionMgr()->clearFilters();
- SMESH::SetPointRepresentation(false);
+ SMESH::SetPointRepresentation( true );
selectionMgr()->installFilter( myFilter );
setSelectionMode( NodeSelection );
}