mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-02-23 15:55:37 +05:00
DCQ : New Architecture...
This commit is contained in:
parent
531fd06639
commit
eb29abbc33
@ -42,6 +42,8 @@ using namespace std;
|
|||||||
#include "BasicGUI_PlaneDlg.h" // Method PLANE
|
#include "BasicGUI_PlaneDlg.h" // Method PLANE
|
||||||
#include "BasicGUI_WorkingPlaneDlg.h" // Method WORKING PLANE
|
#include "BasicGUI_WorkingPlaneDlg.h" // Method WORKING PLANE
|
||||||
|
|
||||||
|
static BasicGUI* myBasicGUI = 0;
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : BasicGUI()
|
// function : BasicGUI()
|
||||||
// purpose : Constructor
|
// purpose : Constructor
|
||||||
@ -64,60 +66,73 @@ BasicGUI::~BasicGUI()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// function : GetOrCreateGUI()
|
||||||
|
// purpose : Gets or create an object 'GUI' with initialisations
|
||||||
|
// : Returns 'GUI' as a pointer
|
||||||
|
//=======================================================================
|
||||||
|
BasicGUI* BasicGUI::GetOrCreateGUI()
|
||||||
|
{
|
||||||
|
myBasicGUI = new BasicGUI();
|
||||||
|
return myBasicGUI;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : OnGUIEvent()
|
// function : OnGUIEvent()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool BasicGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
bool BasicGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
||||||
{
|
{
|
||||||
myGeomGUI->EmitSignalDeactivateDialog();
|
BasicGUI::GetOrCreateGUI();
|
||||||
SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection());
|
myBasicGUI->myGeomGUI->EmitSignalDeactivateDialog();
|
||||||
|
SALOME_Selection* Sel = SALOME_Selection::Selection(myBasicGUI->myGeomGUI->GetActiveStudy()->getSelection());
|
||||||
|
|
||||||
switch (theCommandID)
|
switch (theCommandID)
|
||||||
{
|
{
|
||||||
case 4011: // POINT
|
case 4011: // POINT
|
||||||
{
|
{
|
||||||
Handle(AIS_InteractiveContext) ic;
|
Handle(AIS_InteractiveContext) ic;
|
||||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
|
if(myBasicGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
|
||||||
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myBasicGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
||||||
ic = v3d->getAISContext();
|
ic = v3d->getAISContext();
|
||||||
}
|
}
|
||||||
BasicGUI_PointDlg *aDlg = new BasicGUI_PointDlg(parent, "", this, Sel, ic);
|
BasicGUI_PointDlg *aDlg = new BasicGUI_PointDlg(parent, "", myBasicGUI, Sel, ic);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4012: // LINE
|
case 4012: // LINE
|
||||||
{
|
{
|
||||||
BasicGUI_LineDlg *aDlg = new BasicGUI_LineDlg(parent, "", this, Sel);
|
BasicGUI_LineDlg *aDlg = new BasicGUI_LineDlg(parent, "", myBasicGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4013: // CIRCLE
|
case 4013: // CIRCLE
|
||||||
{
|
{
|
||||||
BasicGUI_CircleDlg *aDlg = new BasicGUI_CircleDlg(parent, "", this, Sel);
|
BasicGUI_CircleDlg *aDlg = new BasicGUI_CircleDlg(parent, "", myBasicGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4014: // ELLIPSE
|
case 4014: // ELLIPSE
|
||||||
{
|
{
|
||||||
BasicGUI_EllipseDlg *aDlg = new BasicGUI_EllipseDlg(parent, "", this, Sel);
|
BasicGUI_EllipseDlg *aDlg = new BasicGUI_EllipseDlg(parent, "", myBasicGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4015: // ARC
|
case 4015: // ARC
|
||||||
{
|
{
|
||||||
BasicGUI_ArcDlg *aDlg = new BasicGUI_ArcDlg(parent, "", this, Sel);
|
BasicGUI_ArcDlg *aDlg = new BasicGUI_ArcDlg(parent, "", myBasicGUI, Sel);
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
case 4016: // VECTOR
|
case 4016: // VECTOR
|
||||||
{
|
{
|
||||||
BasicGUI_VectorDlg *aDlg = new BasicGUI_VectorDlg(parent, "", this, Sel);
|
BasicGUI_VectorDlg *aDlg = new BasicGUI_VectorDlg(parent, "", myBasicGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4017: // PLANE
|
case 4017: // PLANE
|
||||||
{
|
{
|
||||||
BasicGUI_PlaneDlg *aDlg = new BasicGUI_PlaneDlg(parent, "", this, Sel);
|
BasicGUI_PlaneDlg *aDlg = new BasicGUI_PlaneDlg(parent, "", myBasicGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4018: // WORKING PLANE
|
case 4018: // WORKING PLANE
|
||||||
{
|
{
|
||||||
BasicGUI_WorkingPlaneDlg *aDlg = new BasicGUI_WorkingPlaneDlg(parent, "", this, Sel);
|
BasicGUI_WorkingPlaneDlg *aDlg = new BasicGUI_WorkingPlaneDlg(parent, "", myBasicGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -350,3 +365,13 @@ void BasicGUI::MakeWorkingPlane(const gp_Pnt P, const gp_Dir D)
|
|||||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
|
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=====================================================================================
|
||||||
|
// EXPORTED METHODS
|
||||||
|
//=====================================================================================
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
bool OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
||||||
|
{return BasicGUI::OnGUIEvent(theCommandID, parent);}
|
||||||
|
}
|
||||||
|
@ -44,7 +44,8 @@ public :
|
|||||||
BasicGUI();
|
BasicGUI();
|
||||||
~BasicGUI();
|
~BasicGUI();
|
||||||
|
|
||||||
bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
|
static BasicGUI* GetOrCreateGUI();
|
||||||
|
static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
|
||||||
|
|
||||||
void MakePointAndDisplay(const double x, const double y, const double z);
|
void MakePointAndDisplay(const double x, const double y, const double z);
|
||||||
void MakeLineAndDisplay(const gp_Pnt InitPoint, const gp_Pnt LastPoint);
|
void MakeLineAndDisplay(const gp_Pnt InitPoint, const gp_Pnt LastPoint);
|
||||||
@ -57,7 +58,6 @@ public :
|
|||||||
const Standard_Real dz, const Standard_Real TrimSize);
|
const Standard_Real dz, const Standard_Real TrimSize);
|
||||||
void MakeWorkingPlane(const gp_Pnt P, const gp_Dir D);
|
void MakeWorkingPlane(const gp_Pnt P, const gp_Dir D);
|
||||||
|
|
||||||
private:
|
|
||||||
GEOMBase_Context* myGeomGUI;
|
GEOMBase_Context* myGeomGUI;
|
||||||
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
|
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
|
||||||
|
|
||||||
|
@ -155,6 +155,7 @@ void BasicGUI_ArcDlg::ClickOnApply()
|
|||||||
void BasicGUI_ArcDlg::SelectionIntoArgument()
|
void BasicGUI_ArcDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
myGeomGUI->EraseSimulationShape();
|
myGeomGUI->EraseSimulationShape();
|
||||||
|
mySimulationTopoDs.Nullify();
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
QString aString = ""; /* name of selection */
|
QString aString = ""; /* name of selection */
|
||||||
|
|
||||||
@ -200,6 +201,7 @@ void BasicGUI_ArcDlg::SelectionIntoArgument()
|
|||||||
void BasicGUI_ArcDlg::SetEditCurrentArgument()
|
void BasicGUI_ArcDlg::SetEditCurrentArgument()
|
||||||
{
|
{
|
||||||
QPushButton* send = (QPushButton*)sender();
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
mySelection->ClearFilters();
|
||||||
|
|
||||||
if(send == GroupPoints->PushButton1) {
|
if(send == GroupPoints->PushButton1) {
|
||||||
GroupPoints->LineEdit1->setFocus();
|
GroupPoints->LineEdit1->setFocus();
|
||||||
@ -274,7 +276,7 @@ void BasicGUI_ArcDlg::enterEvent(QEvent* e)
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void BasicGUI_ArcDlg::MakeArcSimulationAndDisplay()
|
void BasicGUI_ArcDlg::MakeArcSimulationAndDisplay()
|
||||||
{
|
{
|
||||||
myGeomGUI->EraseSimulationShape();
|
myGeomGUI->EraseSimulationShape();
|
||||||
mySimulationTopoDs.Nullify();
|
mySimulationTopoDs.Nullify();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -92,7 +92,7 @@ void BasicGUI_CircleDlg::Init()
|
|||||||
myRadius = 100.0;
|
myRadius = 100.0;
|
||||||
myOkPoint1 = myOkDir = false;
|
myOkPoint1 = myOkDir = false;
|
||||||
|
|
||||||
myEdgeFilter = new GEOM_EdgeFilter(StdSelect_Line, myGeom);
|
myEdgeFilter = new GEOM_ShapeTypeFilter(TopAbs_EDGE, myGeom);
|
||||||
myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom);
|
myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom);
|
||||||
mySelection->AddFilter(myVertexFilter);
|
mySelection->AddFilter(myVertexFilter);
|
||||||
|
|
||||||
@ -152,6 +152,7 @@ void BasicGUI_CircleDlg::ClickOnApply()
|
|||||||
|
|
||||||
if(myOkPoint1 && myOkDir)
|
if(myOkPoint1 && myOkDir)
|
||||||
myBasicGUI->MakeCircleAndDisplay(myPoint1, myDir, myRadius);
|
myBasicGUI->MakeCircleAndDisplay(myPoint1, myDir, myRadius);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -162,6 +163,7 @@ void BasicGUI_CircleDlg::ClickOnApply()
|
|||||||
void BasicGUI_CircleDlg::SelectionIntoArgument()
|
void BasicGUI_CircleDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
myGeomGUI->EraseSimulationShape();
|
myGeomGUI->EraseSimulationShape();
|
||||||
|
mySimulationTopoDs.Nullify();
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
QString aString = ""; /* name of selection */
|
QString aString = ""; /* name of selection */
|
||||||
|
|
||||||
@ -184,7 +186,7 @@ void BasicGUI_CircleDlg::SelectionIntoArgument()
|
|||||||
GroupPoints->LineEdit1->setText(aString);
|
GroupPoints->LineEdit1->setText(aString);
|
||||||
myOkPoint1 = true;
|
myOkPoint1 = true;
|
||||||
}
|
}
|
||||||
else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
|
else if(myEditCurrentArgument == GroupPoints->LineEdit2) {
|
||||||
BRepAdaptor_Curve curv(TopoDS::Edge(S));
|
BRepAdaptor_Curve curv(TopoDS::Edge(S));
|
||||||
myDir = curv.Line().Direction();
|
myDir = curv.Line().Direction();
|
||||||
GroupPoints->LineEdit2->setText(aString);
|
GroupPoints->LineEdit2->setText(aString);
|
||||||
@ -204,6 +206,7 @@ void BasicGUI_CircleDlg::SelectionIntoArgument()
|
|||||||
void BasicGUI_CircleDlg::SetEditCurrentArgument()
|
void BasicGUI_CircleDlg::SetEditCurrentArgument()
|
||||||
{
|
{
|
||||||
QPushButton* send = (QPushButton*)sender();
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
mySelection->ClearFilters();
|
||||||
|
|
||||||
if(send == GroupPoints->PushButton1) {
|
if(send == GroupPoints->PushButton1) {
|
||||||
GroupPoints->LineEdit1->setFocus();
|
GroupPoints->LineEdit1->setFocus();
|
||||||
@ -259,7 +262,7 @@ void BasicGUI_CircleDlg::ActivateThisDialog()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void BasicGUI_CircleDlg::enterEvent(QEvent* e)
|
void BasicGUI_CircleDlg::enterEvent(QEvent* e)
|
||||||
{
|
{
|
||||||
if (GroupConstructors->isEnabled())
|
if(GroupConstructors->isEnabled())
|
||||||
return;
|
return;
|
||||||
this->ActivateThisDialog();
|
this->ActivateThisDialog();
|
||||||
return;
|
return;
|
||||||
@ -270,14 +273,10 @@ void BasicGUI_CircleDlg::enterEvent(QEvent* e)
|
|||||||
// function : ValueChangedInSpinBox()
|
// function : ValueChangedInSpinBox()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void BasicGUI_CircleDlg::ValueChangedInSpinBox( double newValue )
|
void BasicGUI_CircleDlg::ValueChangedInSpinBox(double newValue)
|
||||||
{
|
{
|
||||||
myGeomGUI->EraseSimulationShape();
|
|
||||||
mySimulationTopoDs.Nullify();
|
|
||||||
|
|
||||||
myRadius = newValue;
|
myRadius = newValue;
|
||||||
|
if(myOkPoint1 && myOkDir)
|
||||||
if (myOkPoint1 && myOkDir)
|
|
||||||
MakeCircleSimulationAndDisplay();
|
MakeCircleSimulationAndDisplay();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,6 @@
|
|||||||
|
|
||||||
#include "BasicGUI.h"
|
#include "BasicGUI.h"
|
||||||
|
|
||||||
#include "GEOM_EdgeFilter.hxx"
|
|
||||||
|
|
||||||
#include <gp_Dir.hxx>
|
#include <gp_Dir.hxx>
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -59,7 +57,7 @@ private :
|
|||||||
|
|
||||||
double step;
|
double step;
|
||||||
Handle(GEOM_ShapeTypeFilter) myVertexFilter;
|
Handle(GEOM_ShapeTypeFilter) myVertexFilter;
|
||||||
Handle(GEOM_EdgeFilter) myEdgeFilter; /* Filter selection */
|
Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* Filter selection */
|
||||||
|
|
||||||
gp_Pnt myPoint1;
|
gp_Pnt myPoint1;
|
||||||
gp_Dir myDir;
|
gp_Dir myDir;
|
||||||
|
@ -95,7 +95,7 @@ void BasicGUI_EllipseDlg::Init()
|
|||||||
myMinorRadius = 100.0;
|
myMinorRadius = 100.0;
|
||||||
myOkPoint = myOkDir = false;
|
myOkPoint = myOkDir = false;
|
||||||
|
|
||||||
myEdgeFilter = new GEOM_EdgeFilter(StdSelect_Line, myGeom);
|
myEdgeFilter = new GEOM_ShapeTypeFilter(TopAbs_EDGE, myGeom);
|
||||||
myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom);
|
myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom);
|
||||||
mySelection->AddFilter(myVertexFilter);
|
mySelection->AddFilter(myVertexFilter);
|
||||||
|
|
||||||
@ -169,7 +169,8 @@ void BasicGUI_EllipseDlg::ClickOnApply()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void BasicGUI_EllipseDlg::SelectionIntoArgument()
|
void BasicGUI_EllipseDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
myGeomGUI->EraseSimulationShape();
|
myGeomGUI->EraseSimulationShape();
|
||||||
|
mySimulationTopoDs.Nullify();
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
QString aString = ""; /* name of selection */
|
QString aString = ""; /* name of selection */
|
||||||
|
|
||||||
@ -212,6 +213,7 @@ void BasicGUI_EllipseDlg::SelectionIntoArgument()
|
|||||||
void BasicGUI_EllipseDlg::SetEditCurrentArgument()
|
void BasicGUI_EllipseDlg::SetEditCurrentArgument()
|
||||||
{
|
{
|
||||||
QPushButton* send = (QPushButton*)sender();
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
mySelection->ClearFilters();
|
||||||
|
|
||||||
if(send == GroupPoints->PushButton1) {
|
if(send == GroupPoints->PushButton1) {
|
||||||
GroupPoints->LineEdit1->setFocus();
|
GroupPoints->LineEdit1->setFocus();
|
||||||
@ -278,10 +280,8 @@ void BasicGUI_EllipseDlg::enterEvent(QEvent* e)
|
|||||||
// function : ValueChangedInSpinBox()
|
// function : ValueChangedInSpinBox()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void BasicGUI_EllipseDlg::ValueChangedInSpinBox( double newValue )
|
void BasicGUI_EllipseDlg::ValueChangedInSpinBox(double newValue)
|
||||||
{
|
{
|
||||||
myGeomGUI->EraseSimulationShape();
|
|
||||||
mySimulationTopoDs.Nullify();
|
|
||||||
QObject* send = (QObject*)sender();
|
QObject* send = (QObject*)sender();
|
||||||
|
|
||||||
if(send == GroupPoints->SpinBox_DX )
|
if(send == GroupPoints->SpinBox_DX )
|
||||||
|
@ -33,8 +33,6 @@
|
|||||||
|
|
||||||
#include "BasicGUI.h"
|
#include "BasicGUI.h"
|
||||||
|
|
||||||
#include "GEOM_EdgeFilter.hxx"
|
|
||||||
|
|
||||||
#include <gp_Dir.hxx>
|
#include <gp_Dir.hxx>
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -58,7 +56,7 @@ private :
|
|||||||
|
|
||||||
double step;
|
double step;
|
||||||
Handle(GEOM_ShapeTypeFilter) myVertexFilter;
|
Handle(GEOM_ShapeTypeFilter) myVertexFilter;
|
||||||
Handle(GEOM_EdgeFilter) myEdgeFilter; /* Filter selection */
|
Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* Filter selection */
|
||||||
|
|
||||||
gp_Pnt myPoint; /* Central point of ellipse */
|
gp_Pnt myPoint; /* Central point of ellipse */
|
||||||
bool myOkPoint; /* true when myPoint is defined */
|
bool myOkPoint; /* true when myPoint is defined */
|
||||||
|
@ -153,6 +153,7 @@ void BasicGUI_LineDlg::ClickOnApply()
|
|||||||
void BasicGUI_LineDlg::SelectionIntoArgument()
|
void BasicGUI_LineDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
myGeomGUI->EraseSimulationShape();
|
myGeomGUI->EraseSimulationShape();
|
||||||
|
mySimulationTopoDs.Nullify();
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
QString aString = ""; /* name of selection */
|
QString aString = ""; /* name of selection */
|
||||||
|
|
||||||
@ -179,12 +180,8 @@ void BasicGUI_LineDlg::SelectionIntoArgument()
|
|||||||
myOkPoint2 = true;
|
myOkPoint2 = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(myOkPoint1 && myOkPoint2 && myPoint1.Distance(myPoint2) > Precision::Confusion() ) {
|
if(myOkPoint1 && myOkPoint2 && myPoint1.Distance(myPoint2) > Precision::Confusion())
|
||||||
mySimulationTopoDs = BRepBuilderAPI_MakeEdge(myPoint1, myPoint2).Shape();
|
this->MakeLineSimulationAndDisplay();
|
||||||
/* Try to add an arrow at simulation shape */
|
|
||||||
bool notNeedToTest = this->AddArrowToSimulation(mySimulationTopoDs);
|
|
||||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,6 +193,7 @@ void BasicGUI_LineDlg::SelectionIntoArgument()
|
|||||||
void BasicGUI_LineDlg::SetEditCurrentArgument()
|
void BasicGUI_LineDlg::SetEditCurrentArgument()
|
||||||
{
|
{
|
||||||
QPushButton* send = (QPushButton*)sender();
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
mySelection->ClearFilters();
|
||||||
|
|
||||||
if(send == GroupPoints->PushButton1) {
|
if(send == GroupPoints->PushButton1) {
|
||||||
GroupPoints->LineEdit1->setFocus();
|
GroupPoints->LineEdit1->setFocus();
|
||||||
@ -251,7 +249,7 @@ void BasicGUI_LineDlg::ActivateThisDialog()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void BasicGUI_LineDlg::enterEvent(QEvent* e)
|
void BasicGUI_LineDlg::enterEvent(QEvent* e)
|
||||||
{
|
{
|
||||||
if(GroupConstructors->isEnabled())
|
if(GroupConstructors->isEnabled())
|
||||||
return;
|
return;
|
||||||
this->ActivateThisDialog();
|
this->ActivateThisDialog();
|
||||||
return;
|
return;
|
||||||
@ -259,23 +257,32 @@ void BasicGUI_LineDlg::enterEvent(QEvent* e)
|
|||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : AddArrowToSimulation()
|
// function : MakeLineSimulationAndDisplay()
|
||||||
// purpose : An arrow (cone topology) is added to 'modifiedShape'
|
// purpose : An arrow (cone topology) is added to 'modifiedShape'
|
||||||
// : to simulate a vector or an 'oriented line' display. The result is in 'modifiedShape'.
|
// : to simulate a vector or an 'oriented line' display. The result is in 'modifiedShape'.
|
||||||
// : If an arrow can't be added returns false and 'modifiedShape' isn't modified !
|
// : If an arrow can't be added returns false and 'modifiedShape' isn't modified !
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
bool BasicGUI_LineDlg::AddArrowToSimulation(TopoDS_Shape& modifiedShape)
|
void BasicGUI_LineDlg::MakeLineSimulationAndDisplay()
|
||||||
{
|
{
|
||||||
TopoDS_Shape arrow;
|
myGeomGUI->EraseSimulationShape();
|
||||||
/* Try to add a cone simulation shape to show direction of a linear edge */
|
mySimulationTopoDs.Nullify();
|
||||||
if(myGeomGUI->CreateArrowForLinearEdge(modifiedShape, arrow)) {
|
|
||||||
TopoDS_Compound Comp;
|
try {
|
||||||
BRep_Builder B;
|
mySimulationTopoDs = BRepBuilderAPI_MakeEdge(myPoint1, myPoint2).Shape();
|
||||||
B.MakeCompound (Comp);
|
TopoDS_Shape arrow;
|
||||||
B.Add(Comp, modifiedShape);
|
if(myGeomGUI->CreateArrowForLinearEdge(mySimulationTopoDs, arrow)) {
|
||||||
B.Add(Comp, arrow);
|
TopoDS_Compound Comp;
|
||||||
modifiedShape = Comp;
|
BRep_Builder B;
|
||||||
return true;
|
B.MakeCompound (Comp);
|
||||||
|
B.Add(Comp, mySimulationTopoDs);
|
||||||
|
B.Add(Comp, arrow);
|
||||||
|
mySimulationTopoDs = Comp;
|
||||||
|
}
|
||||||
|
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||||
}
|
}
|
||||||
return false;
|
catch(Standard_Failure) {
|
||||||
|
MESSAGE("Exception catched in MakeLineSimulationAndDisplay");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ public:
|
|||||||
private :
|
private :
|
||||||
void Init();
|
void Init();
|
||||||
void enterEvent(QEvent* e);
|
void enterEvent(QEvent* e);
|
||||||
bool AddArrowToSimulation(TopoDS_Shape& modifiedShape);
|
void MakeLineSimulationAndDisplay();
|
||||||
|
|
||||||
BasicGUI* myBasicGUI;
|
BasicGUI* myBasicGUI;
|
||||||
Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* Filter selection */
|
Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* Filter selection */
|
||||||
|
@ -194,6 +194,7 @@ void BasicGUI_PlaneDlg::ConstructorsClicked(int constructorId)
|
|||||||
myConstructorId = constructorId;
|
myConstructorId = constructorId;
|
||||||
mySelection->ClearFilters();
|
mySelection->ClearFilters();
|
||||||
myGeomGUI->EraseSimulationShape();
|
myGeomGUI->EraseSimulationShape();
|
||||||
|
mySimulationTopoDs.Nullify();
|
||||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||||
myOkPoint1 = myOkDirection = myOkCoordinates = myOkPlanarFace = false;
|
myOkPoint1 = myOkDirection = myOkCoordinates = myOkPlanarFace = false;
|
||||||
|
|
||||||
@ -366,7 +367,7 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument()
|
|||||||
myGeomGUI->GetBipointDxDyDz(Pfirst, Plast, myDx, myDy, myDz);
|
myGeomGUI->GetBipointDxDyDz(Pfirst, Plast, myDx, myDy, myDz);
|
||||||
GroupPointDirection->LineEdit2->setText(aString);
|
GroupPointDirection->LineEdit2->setText(aString);
|
||||||
myOkDirection = true;
|
myOkDirection = true;
|
||||||
this->myTrimSize = GroupPointDirection->SpinBox_DX->GetValue();
|
myTrimSize = GroupPointDirection->SpinBox_DX->GetValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -377,7 +378,7 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument()
|
|||||||
myDx = GroupPointPlusCoordinates->SpinBox_DX->GetValue();
|
myDx = GroupPointPlusCoordinates->SpinBox_DX->GetValue();
|
||||||
myDy = GroupPointPlusCoordinates->SpinBox_DY->GetValue();
|
myDy = GroupPointPlusCoordinates->SpinBox_DY->GetValue();
|
||||||
myDz = GroupPointPlusCoordinates->SpinBox_DZ->GetValue();
|
myDz = GroupPointPlusCoordinates->SpinBox_DZ->GetValue();
|
||||||
this->myTrimSize = GroupPointPlusCoordinates->SpinBox_S->GetValue();
|
myTrimSize = GroupPointPlusCoordinates->SpinBox_S->GetValue();
|
||||||
myOkPoint1 = true;
|
myOkPoint1 = true;
|
||||||
myOkCoordinates = true;
|
myOkCoordinates = true;
|
||||||
}
|
}
|
||||||
@ -394,14 +395,14 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument()
|
|||||||
myDx = (ax.Direction()).X();
|
myDx = (ax.Direction()).X();
|
||||||
myDy = (ax.Direction()).Y();
|
myDy = (ax.Direction()).Y();
|
||||||
myDz = (ax.Direction()).Z();
|
myDz = (ax.Direction()).Z();
|
||||||
this->myTrimSize = GroupFace->SpinBox_DX->GetValue();
|
myTrimSize = GroupFace->SpinBox_DX->GetValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Call method simulation */
|
/* Call method simulation */
|
||||||
if((myOkPoint1 && myOkDirection) || (myOkPoint1 && myOkCoordinates) || myOkPlanarFace) {
|
if((myOkPoint1 && myOkDirection) || (myOkPoint1 && myOkCoordinates) || myOkPlanarFace) {
|
||||||
if(myDx*myDx + myDy*myDy + myDz*myDz > Precision::Confusion()*Precision::Confusion())
|
if(myDx*myDx + myDy*myDy + myDz*myDz > Precision::Confusion()*Precision::Confusion())
|
||||||
MakePlaneSimulationAndDisplay(myPoint1, myDx, myDy, myDz, myTrimSize) ;
|
this->MakePlaneSimulationAndDisplay();
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -414,7 +415,7 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument()
|
|||||||
void BasicGUI_PlaneDlg::SetEditCurrentArgument()
|
void BasicGUI_PlaneDlg::SetEditCurrentArgument()
|
||||||
{
|
{
|
||||||
QPushButton* send = (QPushButton*)sender();
|
QPushButton* send = (QPushButton*)sender();
|
||||||
mySelection->ClearFilters() ;
|
mySelection->ClearFilters();
|
||||||
|
|
||||||
switch (myConstructorId)
|
switch (myConstructorId)
|
||||||
{
|
{
|
||||||
@ -430,7 +431,6 @@ void BasicGUI_PlaneDlg::SetEditCurrentArgument()
|
|||||||
myEditCurrentArgument = GroupPointDirection->LineEdit2;
|
myEditCurrentArgument = GroupPointDirection->LineEdit2;
|
||||||
/* Edge filter here */
|
/* Edge filter here */
|
||||||
mySelection->AddFilter(myEdgeFilter);
|
mySelection->AddFilter(myEdgeFilter);
|
||||||
SelectionIntoArgument();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -441,7 +441,6 @@ void BasicGUI_PlaneDlg::SetEditCurrentArgument()
|
|||||||
myEditCurrentArgument = GroupPointPlusCoordinates->LineEdit1;
|
myEditCurrentArgument = GroupPointPlusCoordinates->LineEdit1;
|
||||||
/* Vertex filter here */
|
/* Vertex filter here */
|
||||||
mySelection->AddFilter(myVertexFilter);
|
mySelection->AddFilter(myVertexFilter);
|
||||||
SelectionIntoArgument();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -452,12 +451,12 @@ void BasicGUI_PlaneDlg::SetEditCurrentArgument()
|
|||||||
myEditCurrentArgument = GroupFace->LineEdit1;
|
myEditCurrentArgument = GroupFace->LineEdit1;
|
||||||
/* Face filter here */
|
/* Face filter here */
|
||||||
mySelection->AddFilter(myFaceFilter);
|
mySelection->AddFilter(myFaceFilter);
|
||||||
SelectionIntoArgument();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ;
|
this->SelectionIntoArgument();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -515,35 +514,26 @@ void BasicGUI_PlaneDlg::enterEvent(QEvent* e)
|
|||||||
// function : ValueChangedInSpinBox()
|
// function : ValueChangedInSpinBox()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void BasicGUI_PlaneDlg::ValueChangedInSpinBox( double newValue )
|
void BasicGUI_PlaneDlg::ValueChangedInSpinBox(double newValue)
|
||||||
{
|
{
|
||||||
myGeomGUI->EraseSimulationShape();
|
QObject* send = (QObject*)sender();
|
||||||
mySimulationTopoDs.Nullify();
|
|
||||||
QObject* send = (QObject*)sender() ;
|
|
||||||
|
|
||||||
if(send == GroupPointPlusCoordinates->SpinBox_DX) {
|
if(send == GroupPointPlusCoordinates->SpinBox_DX)
|
||||||
myDx = newValue;
|
myDx = newValue;
|
||||||
myDy = GroupPointPlusCoordinates->SpinBox_DY->GetValue();
|
else if(send == GroupPointPlusCoordinates->SpinBox_DY)
|
||||||
myDz = GroupPointPlusCoordinates->SpinBox_DZ->GetValue();
|
|
||||||
} else if(send == GroupPointPlusCoordinates->SpinBox_DY) {
|
|
||||||
myDx = GroupPointPlusCoordinates->SpinBox_DX->GetValue();
|
|
||||||
myDy = newValue;
|
myDy = newValue;
|
||||||
myDz = GroupPointPlusCoordinates->SpinBox_DZ->GetValue();
|
else if(send == GroupPointPlusCoordinates->SpinBox_DZ)
|
||||||
} else if(send == GroupPointPlusCoordinates->SpinBox_DZ) {
|
|
||||||
myDx = GroupPointPlusCoordinates->SpinBox_DX->GetValue();
|
|
||||||
myDy = GroupPointPlusCoordinates->SpinBox_DY->GetValue();
|
|
||||||
myDz = newValue;
|
myDz = newValue;
|
||||||
} else if(send == GroupPointDirection->SpinBox_DX || send == GroupPointPlusCoordinates->SpinBox_S || send == GroupFace->SpinBox_DX) {
|
else if(send == GroupPointDirection->SpinBox_DX || send == GroupPointPlusCoordinates->SpinBox_S || send == GroupFace->SpinBox_DX) {
|
||||||
myTrimSize = newValue;
|
myTrimSize = newValue;
|
||||||
} else
|
} else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if((myOkPoint1 && myOkDirection) || (myOkPoint1 && myOkCoordinates) || myOkPlanarFace) {
|
if((myOkPoint1 && myOkDirection) || (myOkPoint1 && myOkCoordinates) || myOkPlanarFace) {
|
||||||
if (myDx*myDx + myDy*myDy + myDz*myDz > Precision::Confusion() * Precision::Confusion())
|
if(myDx*myDx + myDy*myDy + myDz*myDz > Precision::Confusion() * Precision::Confusion())
|
||||||
MakePlaneSimulationAndDisplay( myPoint1, myDx, myDy, myDz, myTrimSize);
|
this->MakePlaneSimulationAndDisplay();
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -551,23 +541,21 @@ void BasicGUI_PlaneDlg::ValueChangedInSpinBox( double newValue )
|
|||||||
// function : MakePlaneSimulationAndDisplay(()
|
// function : MakePlaneSimulationAndDisplay(()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void BasicGUI_PlaneDlg::MakePlaneSimulationAndDisplay(const gp_Pnt& P1,
|
void BasicGUI_PlaneDlg::MakePlaneSimulationAndDisplay()
|
||||||
const Standard_Real dx,
|
|
||||||
const Standard_Real dy,
|
|
||||||
const Standard_Real dz,
|
|
||||||
const Standard_Real trimsize)
|
|
||||||
{
|
{
|
||||||
|
myGeomGUI->EraseSimulationShape();
|
||||||
|
mySimulationTopoDs.Nullify();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
gp_Dir aDirection(dx, dy, dz);
|
gp_Dir aDirection(myDx, myDy, myDz);
|
||||||
/* We make a trimmed plane */
|
/* We make a trimmed plane */
|
||||||
gp_Pln gplane(P1, aDirection);
|
gp_Pln gplane(myPoint1, aDirection);
|
||||||
mySimulationTopoDs = BRepBuilderAPI_MakeFace(gplane, -trimsize, +trimsize, -trimsize, +trimsize);
|
mySimulationTopoDs = BRepBuilderAPI_MakeFace(gplane, -myTrimSize, +myTrimSize, -myTrimSize, +myTrimSize);
|
||||||
|
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||||
}
|
}
|
||||||
catch(Standard_Failure) {
|
catch(Standard_Failure) {
|
||||||
MESSAGE( "Exception catched in MakePlaneSimulation" << endl );
|
MESSAGE( "Exception catched in MakePlaneSimulation" << endl );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
@ -53,6 +53,7 @@ public:
|
|||||||
private :
|
private :
|
||||||
void Init();
|
void Init();
|
||||||
void enterEvent(QEvent* e);
|
void enterEvent(QEvent* e);
|
||||||
|
void MakePlaneSimulationAndDisplay();
|
||||||
|
|
||||||
BasicGUI* myBasicGUI;
|
BasicGUI* myBasicGUI;
|
||||||
|
|
||||||
@ -87,9 +88,6 @@ private slots:
|
|||||||
void SetEditCurrentArgument();
|
void SetEditCurrentArgument();
|
||||||
void ConstructorsClicked(int constructorId);
|
void ConstructorsClicked(int constructorId);
|
||||||
void ValueChangedInSpinBox(double newValue);
|
void ValueChangedInSpinBox(double newValue);
|
||||||
void MakePlaneSimulationAndDisplay(const gp_Pnt& P, const Standard_Real dx,
|
|
||||||
const Standard_Real dy, const Standard_Real dz,
|
|
||||||
const Standard_Real trimSize);
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -181,6 +181,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
|
|||||||
myConstructorId = constructorId;
|
myConstructorId = constructorId;
|
||||||
mySelection->ClearFilters();
|
mySelection->ClearFilters();
|
||||||
myGeomGUI->EraseSimulationShape();
|
myGeomGUI->EraseSimulationShape();
|
||||||
|
mySimulationTopoDs.Nullify();
|
||||||
disconnect(mySelection, 0, this, 0);
|
disconnect(mySelection, 0, this, 0);
|
||||||
|
|
||||||
switch (constructorId)
|
switch (constructorId)
|
||||||
@ -300,6 +301,7 @@ void BasicGUI_PointDlg::ClickOnApply()
|
|||||||
void BasicGUI_PointDlg::SelectionIntoArgument()
|
void BasicGUI_PointDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
myGeomGUI->EraseSimulationShape();
|
myGeomGUI->EraseSimulationShape();
|
||||||
|
mySimulationTopoDs.Nullify();
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
QString aString = ""; /* name of selection */
|
QString aString = ""; /* name of selection */
|
||||||
|
|
||||||
@ -350,9 +352,6 @@ void BasicGUI_PointDlg::LineEditReturnPressed()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void BasicGUI_PointDlg::SetEditCurrentArgument()
|
void BasicGUI_PointDlg::SetEditCurrentArgument()
|
||||||
{
|
{
|
||||||
if(myConstructorId != 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
QPushButton* send = (QPushButton*)sender();
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
|
||||||
if(send == GroupPoints->PushButton1) {
|
if(send == GroupPoints->PushButton1) {
|
||||||
@ -411,11 +410,9 @@ void BasicGUI_PointDlg::ActivateThisDialog( )
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void BasicGUI_PointDlg::ValueChangedInSpinBox(double newValue)
|
void BasicGUI_PointDlg::ValueChangedInSpinBox(double newValue)
|
||||||
{
|
{
|
||||||
myGeomGUI->EraseSimulationShape();
|
|
||||||
mySimulationTopoDs.Nullify();
|
|
||||||
|
|
||||||
DlgRef_SpinBox* send = (DlgRef_SpinBox*)sender();
|
DlgRef_SpinBox* send = (DlgRef_SpinBox*)sender();
|
||||||
double vx, vy, vz;
|
double vx, vy, vz;
|
||||||
|
|
||||||
if(send == GroupDimensions->SpinBox_DX) {
|
if(send == GroupDimensions->SpinBox_DX) {
|
||||||
vx = newValue;
|
vx = newValue;
|
||||||
vy = GroupDimensions->SpinBox_DY->GetValue();
|
vy = GroupDimensions->SpinBox_DY->GetValue();
|
||||||
|
@ -128,7 +128,6 @@ void BasicGUI_WorkingPlaneDlg::ClickOnOk()
|
|||||||
void BasicGUI_WorkingPlaneDlg::ClickOnApply()
|
void BasicGUI_WorkingPlaneDlg::ClickOnApply()
|
||||||
{
|
{
|
||||||
myGeomGUI->GetDesktop()->putInfo(tr(""));
|
myGeomGUI->GetDesktop()->putInfo(tr(""));
|
||||||
mySelection->ClearFilters();
|
|
||||||
if(myOkPlane)
|
if(myOkPlane)
|
||||||
myBasicGUI->MakeWorkingPlane(myLoc, myDir);
|
myBasicGUI->MakeWorkingPlane(myLoc, myDir);
|
||||||
|
|
||||||
@ -147,8 +146,7 @@ void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument()
|
|||||||
|
|
||||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
|
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
|
||||||
if(nbSel != 1) {
|
if(nbSel != 1) {
|
||||||
if(myEditCurrentArgument == GroupWPlane->LineEdit1)
|
myOkPlane = false;
|
||||||
myOkPlane = false;
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,15 +155,13 @@ void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument()
|
|||||||
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
|
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(myEditCurrentArgument == GroupWPlane->LineEdit1) {
|
BRepAdaptor_Surface surf(TopoDS::Face(S));
|
||||||
BRepAdaptor_Surface surf(TopoDS::Face(S));
|
gp_Pln Plane = surf.Plane();
|
||||||
gp_Pln Plane = surf.Plane();
|
myLoc = Plane.Location();
|
||||||
myLoc = Plane.Location();
|
myDir = Plane.Axis().Direction();
|
||||||
myDir = Plane.Axis().Direction();
|
|
||||||
|
|
||||||
GroupWPlane->LineEdit1->setText(aString);
|
GroupWPlane->LineEdit1->setText(aString);
|
||||||
myOkPlane = true;
|
myOkPlane = true;
|
||||||
}
|
|
||||||
|
|
||||||
/* no simulation */
|
/* no simulation */
|
||||||
return;
|
return;
|
||||||
@ -178,14 +174,8 @@ void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void BasicGUI_WorkingPlaneDlg::SetEditCurrentArgument()
|
void BasicGUI_WorkingPlaneDlg::SetEditCurrentArgument()
|
||||||
{
|
{
|
||||||
QPushButton* send = (QPushButton*)sender();
|
GroupWPlane->LineEdit1->setFocus();
|
||||||
|
this->SelectionIntoArgument();
|
||||||
if(send == GroupWPlane->PushButton1) {
|
|
||||||
GroupWPlane->LineEdit1->setFocus();
|
|
||||||
myEditCurrentArgument = GroupWPlane->LineEdit1;
|
|
||||||
mySelection->AddFilter(myFaceFilter);
|
|
||||||
SelectionIntoArgument();
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -196,12 +186,6 @@ void BasicGUI_WorkingPlaneDlg::SetEditCurrentArgument()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void BasicGUI_WorkingPlaneDlg::LineEditReturnPressed()
|
void BasicGUI_WorkingPlaneDlg::LineEditReturnPressed()
|
||||||
{
|
{
|
||||||
QLineEdit* send = (QLineEdit*)sender();
|
|
||||||
if(send == GroupWPlane->LineEdit1)
|
|
||||||
myEditCurrentArgument = GroupWPlane->LineEdit1;
|
|
||||||
else
|
|
||||||
return;
|
|
||||||
|
|
||||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -29,14 +29,13 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
#include "BooleanGUI.h"
|
#include "BooleanGUI.h"
|
||||||
|
|
||||||
#include "QAD_Application.h"
|
|
||||||
#include "SALOMEGUI_QtCatchCorbaException.hxx"
|
|
||||||
|
|
||||||
#include "BooleanGUI_FuseDlg.h" // Method FUSE
|
#include "BooleanGUI_FuseDlg.h" // Method FUSE
|
||||||
#include "BooleanGUI_CommonDlg.h" // Method COMMON
|
#include "BooleanGUI_CommonDlg.h" // Method COMMON
|
||||||
#include "BooleanGUI_CutDlg.h" // Method CUT
|
#include "BooleanGUI_CutDlg.h" // Method CUT
|
||||||
#include "BooleanGUI_SectionDlg.h" // Method SECTION
|
#include "BooleanGUI_SectionDlg.h" // Method SECTION
|
||||||
|
|
||||||
|
static BooleanGUI* myBooleanGUI = 0;
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : BooleanGUI()
|
// function : BooleanGUI()
|
||||||
// purpose : Constructor
|
// purpose : Constructor
|
||||||
@ -59,35 +58,48 @@ BooleanGUI::~BooleanGUI()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// function : GetOrCreateGUI()
|
||||||
|
// purpose : Gets or create an object 'GUI' with initialisations
|
||||||
|
// : Returns 'GUI' as a pointer
|
||||||
|
//=======================================================================
|
||||||
|
BooleanGUI* BooleanGUI::GetOrCreateGUI()
|
||||||
|
{
|
||||||
|
myBooleanGUI = new BooleanGUI();
|
||||||
|
return myBooleanGUI;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : OnGUIEvent()
|
// function : OnGUIEvent()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool BooleanGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
bool BooleanGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
||||||
{
|
{
|
||||||
myGeomGUI->EmitSignalDeactivateDialog();
|
BooleanGUI::GetOrCreateGUI();
|
||||||
SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection());
|
myBooleanGUI->myGeomGUI->EmitSignalDeactivateDialog();
|
||||||
|
SALOME_Selection* Sel = SALOME_Selection::Selection(myBooleanGUI->myGeomGUI->GetActiveStudy()->getSelection());
|
||||||
|
|
||||||
switch (theCommandID)
|
switch (theCommandID)
|
||||||
{
|
{
|
||||||
case 5011: // FUSE
|
case 5011: // FUSE
|
||||||
{
|
{
|
||||||
BooleanGUI_FuseDlg *aDlg = new BooleanGUI_FuseDlg(parent, "", this, Sel);
|
BooleanGUI_FuseDlg *aDlg = new BooleanGUI_FuseDlg(parent, "", myBooleanGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 5012: // COMMON
|
case 5012: // COMMON
|
||||||
{
|
{
|
||||||
BooleanGUI_CommonDlg *aDlg = new BooleanGUI_CommonDlg(parent, "", this, Sel);
|
BooleanGUI_CommonDlg *aDlg = new BooleanGUI_CommonDlg(parent, "", myBooleanGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 5013: // CUT
|
case 5013: // CUT
|
||||||
{
|
{
|
||||||
BooleanGUI_CutDlg *aDlg = new BooleanGUI_CutDlg(parent, "", this, Sel);
|
BooleanGUI_CutDlg *aDlg = new BooleanGUI_CutDlg(parent, "", myBooleanGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 5014: // SECTION
|
case 5014: // SECTION
|
||||||
{
|
{
|
||||||
BooleanGUI_SectionDlg *aDlg = new BooleanGUI_SectionDlg(parent, "", this, Sel);
|
BooleanGUI_SectionDlg *aDlg = new BooleanGUI_SectionDlg(parent, "", myBooleanGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -126,3 +138,13 @@ void BooleanGUI::MakeBooleanAndDisplay(GEOM::GEOM_Shape_ptr Shape1, GEOM::GEOM_S
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=====================================================================================
|
||||||
|
// EXPORTED METHODS
|
||||||
|
//=====================================================================================
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
bool OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
||||||
|
{return BooleanGUI::OnGUIEvent(theCommandID, parent);}
|
||||||
|
}
|
||||||
|
@ -43,13 +43,13 @@ public :
|
|||||||
BooleanGUI();
|
BooleanGUI();
|
||||||
~BooleanGUI();
|
~BooleanGUI();
|
||||||
|
|
||||||
bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
|
static BooleanGUI* GetOrCreateGUI();
|
||||||
|
static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
|
||||||
|
|
||||||
void MakeBooleanAndDisplay(GEOM::GEOM_Shape_ptr Shape1,
|
void MakeBooleanAndDisplay(GEOM::GEOM_Shape_ptr Shape1,
|
||||||
GEOM::GEOM_Shape_ptr Shape2,
|
GEOM::GEOM_Shape_ptr Shape2,
|
||||||
const short operation);
|
const short operation);
|
||||||
|
|
||||||
private:
|
|
||||||
GEOMBase_Context* myGeomGUI;
|
GEOMBase_Context* myGeomGUI;
|
||||||
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
|
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
|
||||||
|
|
||||||
|
@ -47,6 +47,8 @@ using namespace std;
|
|||||||
#include "BuildGUI_SolidDlg.h" // Method SOLID
|
#include "BuildGUI_SolidDlg.h" // Method SOLID
|
||||||
#include "BuildGUI_CompoundDlg.h" // Method COMPOUND
|
#include "BuildGUI_CompoundDlg.h" // Method COMPOUND
|
||||||
|
|
||||||
|
static BuildGUI* myBuildGUI = 0;
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : BuildGUI()
|
// function : BuildGUI()
|
||||||
// purpose : Constructor
|
// purpose : Constructor
|
||||||
@ -69,52 +71,68 @@ BuildGUI::~BuildGUI()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// function : GetOrCreateGUI()
|
||||||
|
// purpose : Gets or create an object 'GUI' with initialisations
|
||||||
|
// : Returns 'GUI' as a pointer
|
||||||
|
//=======================================================================
|
||||||
|
BuildGUI* BuildGUI::GetOrCreateGUI()
|
||||||
|
{
|
||||||
|
myBuildGUI = new BuildGUI();
|
||||||
|
return myBuildGUI;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : OnGUIEvent()
|
// function : OnGUIEvent()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool BuildGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
bool BuildGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
||||||
{
|
{
|
||||||
myGeomGUI->EmitSignalDeactivateDialog();
|
BuildGUI::GetOrCreateGUI();
|
||||||
SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection());
|
myBuildGUI->myGeomGUI->EmitSignalDeactivateDialog();
|
||||||
|
SALOME_Selection* Sel = SALOME_Selection::Selection(myBuildGUI->myGeomGUI->GetActiveStudy()->getSelection());
|
||||||
|
|
||||||
switch (theCommandID)
|
switch (theCommandID)
|
||||||
{
|
{
|
||||||
case 407: // EXPLODE : use ic
|
case 407: // EXPLODE : use ic
|
||||||
{
|
{
|
||||||
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
Handle(AIS_InteractiveContext) ic;
|
||||||
Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
|
if(myBuildGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
|
||||||
BuildGUI_SubShapeDlg *aDlg = new BuildGUI_SubShapeDlg(parent, "", this, Sel, ic);
|
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myBuildGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
||||||
|
ic = v3d->getAISContext();
|
||||||
|
}
|
||||||
|
BuildGUI_SubShapeDlg *aDlg = new BuildGUI_SubShapeDlg(parent, "", myBuildGUI, Sel, ic);
|
||||||
break ;
|
break ;
|
||||||
}
|
}
|
||||||
case 4081: // GEOM::EDGE
|
case 4081: // GEOM::EDGE
|
||||||
{
|
{
|
||||||
BuildGUI_EdgeDlg *aDlg = new BuildGUI_EdgeDlg(parent, "", this, Sel);
|
BuildGUI_EdgeDlg *aDlg = new BuildGUI_EdgeDlg(parent, "", myBuildGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4082: // GEOM::WIRE
|
case 4082: // GEOM::WIRE
|
||||||
{
|
{
|
||||||
BuildGUI_WireDlg *aDlg = new BuildGUI_WireDlg(parent, "", this, Sel);
|
BuildGUI_WireDlg *aDlg = new BuildGUI_WireDlg(parent, "", myBuildGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4083: // GEOM::FACE
|
case 4083: // GEOM::FACE
|
||||||
{
|
{
|
||||||
BuildGUI_FaceDlg *aDlg = new BuildGUI_FaceDlg(parent, "", this, Sel);
|
BuildGUI_FaceDlg *aDlg = new BuildGUI_FaceDlg(parent, "", myBuildGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4084: // GEOM::SHELL
|
case 4084: // GEOM::SHELL
|
||||||
{
|
{
|
||||||
BuildGUI_ShellDlg *aDlg = new BuildGUI_ShellDlg(parent, "", this, Sel);
|
BuildGUI_ShellDlg *aDlg = new BuildGUI_ShellDlg(parent, "", myBuildGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4085: // GEOM::SOLID
|
case 4085: // GEOM::SOLID
|
||||||
{
|
{
|
||||||
BuildGUI_SolidDlg *aDlg = new BuildGUI_SolidDlg(parent, "", this, Sel);
|
BuildGUI_SolidDlg *aDlg = new BuildGUI_SolidDlg(parent, "", myBuildGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4086: // GEOM::COMPOUND
|
case 4086: // GEOM::COMPOUND
|
||||||
{
|
{
|
||||||
BuildGUI_CompoundDlg *aDlg = new BuildGUI_CompoundDlg(parent, "", this, Sel);
|
BuildGUI_CompoundDlg *aDlg = new BuildGUI_CompoundDlg(parent, "", myBuildGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -370,58 +388,59 @@ bool BuildGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* Shape
|
|||||||
|
|
||||||
anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap");
|
anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap");
|
||||||
aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
|
aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
|
||||||
MESSAGE( " Type " << S.ShapeType() )
|
MESSAGE(" Type " << S.ShapeType())
|
||||||
if ( S.ShapeType() == TopAbs_COMPOUND ) {
|
if (S.ShapeType() == TopAbs_COMPOUND)
|
||||||
aPixmap->SetPixMap( "ICON_OBJBROWSER_COMPOUND" );
|
aPixmap->SetPixMap("ICON_OBJBROWSER_COMPOUND");
|
||||||
} else if ( S.ShapeType() == TopAbs_COMPSOLID ) {
|
else if(S.ShapeType() == TopAbs_COMPSOLID)
|
||||||
aPixmap->SetPixMap( "ICON_OBJBROWSER_COMPSOLID" );
|
aPixmap->SetPixMap("ICON_OBJBROWSER_COMPSOLID");
|
||||||
} else if ( S.ShapeType() == TopAbs_SOLID ) {
|
else if(S.ShapeType() == TopAbs_SOLID)
|
||||||
aPixmap->SetPixMap( "ICON_OBJBROWSER_SOLID" );
|
aPixmap->SetPixMap("ICON_OBJBROWSER_SOLID");
|
||||||
} else if ( S.ShapeType() == TopAbs_SHELL ) {
|
else if(S.ShapeType() == TopAbs_SHELL)
|
||||||
aPixmap->SetPixMap( "ICON_OBJBROWSER_SHELL" );
|
aPixmap->SetPixMap("ICON_OBJBROWSER_SHELL");
|
||||||
} else if ( S.ShapeType() == TopAbs_FACE ) {
|
else if(S.ShapeType() == TopAbs_FACE)
|
||||||
aPixmap->SetPixMap( "ICON_OBJBROWSER_FACE" );
|
aPixmap->SetPixMap("ICON_OBJBROWSER_FACE");
|
||||||
} else if ( S.ShapeType() == TopAbs_WIRE ) {
|
else if(S.ShapeType() == TopAbs_WIRE)
|
||||||
aPixmap->SetPixMap( "ICON_OBJBROWSER_WIRE" );
|
aPixmap->SetPixMap("ICON_OBJBROWSER_WIRE");
|
||||||
} else if ( S.ShapeType() == TopAbs_EDGE ) {
|
else if(S.ShapeType() == TopAbs_EDGE)
|
||||||
aPixmap->SetPixMap( "ICON_OBJBROWSER_EDGE" );
|
aPixmap->SetPixMap("ICON_OBJBROWSER_EDGE");
|
||||||
} else if ( S.ShapeType() == TopAbs_VERTEX ) {
|
else if(S.ShapeType() == TopAbs_VERTEX)
|
||||||
aPixmap->SetPixMap( "ICON_OBJBROWSER_VERTEX" );
|
aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX");
|
||||||
}
|
|
||||||
|
|
||||||
MESSAGE ( " aPixmap->GetPixMap " << aPixmap->GetPixMap() )
|
MESSAGE(" aPixmap->GetPixMap " << aPixmap->GetPixMap())
|
||||||
|
|
||||||
SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
|
SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
|
||||||
aStudyBuilder->Addreference(newObj1, newObj);
|
aStudyBuilder->Addreference(newObj1, newObj);
|
||||||
IO->setEntry(newObj->GetID());
|
IO->setEntry(newObj->GetID());
|
||||||
|
|
||||||
aResult->StudyShapeId( newObj->GetID() );
|
aResult->StudyShapeId(newObj->GetID());
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
allreadyexist = true;
|
allreadyexist = true;
|
||||||
if ( !myGeomGUI->SObjectExist(theObj, aResult->Name()) ) {
|
if(!myGeomGUI->SObjectExist(theObj, aResult->Name())) {
|
||||||
SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj);
|
SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj);
|
||||||
aStudyBuilder->Addreference(newObj1, SO);
|
aStudyBuilder->Addreference(newObj1, SO);
|
||||||
IO->setEntry(SO->GetID());
|
IO->setEntry(SO->GetID());
|
||||||
aResult->StudyShapeId( SO->GetID() );
|
aResult->StudyShapeId(SO->GetID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
result->setIO( IO );
|
result->setIO(IO);
|
||||||
result->setName( nameG );
|
result->setName(nameG);
|
||||||
if ( !allreadyexist )
|
if(!allreadyexist)
|
||||||
ic->Display(result);
|
ic->Display(result);
|
||||||
|
|
||||||
} else if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK ) {
|
}
|
||||||
|
else if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
|
||||||
VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
|
VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
|
||||||
|
|
||||||
int themode = myRenderInter->GetDisplayMode();
|
int themode = myRenderInter->GetDisplayMode();
|
||||||
vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
|
vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
|
||||||
vtkRenderWindow *renWin = theRenderer->GetRenderWindow();
|
vtkRenderWindow *renWin = theRenderer->GetRenderWindow();
|
||||||
|
|
||||||
Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(),"GEOM");
|
Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM");
|
||||||
|
|
||||||
if ( SO->_is_nil() ) {
|
if(SO->_is_nil()) {
|
||||||
SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject( theObj );
|
SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(theObj);
|
||||||
anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
|
anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
|
||||||
anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
|
anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
|
||||||
anIOR->SetValue(aResult->Name());
|
anIOR->SetValue(aResult->Name());
|
||||||
@ -431,45 +450,44 @@ bool BuildGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* Shape
|
|||||||
|
|
||||||
anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap");
|
anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap");
|
||||||
aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
|
aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
|
||||||
if ( S.ShapeType() == TopAbs_COMPOUND ) {
|
if(S.ShapeType() == TopAbs_COMPOUND)
|
||||||
aPixmap->SetPixMap( "ICON_OBJBROWSER_COMPOUND" );
|
aPixmap->SetPixMap("ICON_OBJBROWSER_COMPOUND");
|
||||||
} else if ( S.ShapeType() == TopAbs_COMPSOLID ) {
|
else if(S.ShapeType() == TopAbs_COMPSOLID)
|
||||||
aPixmap->SetPixMap( "ICON_OBJBROWSER_COMPSOLID" );
|
aPixmap->SetPixMap("ICON_OBJBROWSER_COMPSOLID");
|
||||||
} else if ( S.ShapeType() == TopAbs_SOLID ) {
|
else if(S.ShapeType() == TopAbs_SOLID)
|
||||||
aPixmap->SetPixMap( "ICON_OBJBROWSER_SOLID" );
|
aPixmap->SetPixMap("ICON_OBJBROWSER_SOLID");
|
||||||
} else if ( S.ShapeType() == TopAbs_SHELL ) {
|
else if(S.ShapeType() == TopAbs_SHELL)
|
||||||
aPixmap->SetPixMap( "ICON_OBJBROWSER_SHELL" );
|
aPixmap->SetPixMap("ICON_OBJBROWSER_SHELL");
|
||||||
} else if ( S.ShapeType() == TopAbs_FACE ) {
|
else if(S.ShapeType() == TopAbs_FACE)
|
||||||
aPixmap->SetPixMap( "ICON_OBJBROWSER_FACE" );
|
aPixmap->SetPixMap("ICON_OBJBROWSER_FACE");
|
||||||
} else if ( S.ShapeType() == TopAbs_WIRE ) {
|
else if(S.ShapeType() == TopAbs_WIRE)
|
||||||
aPixmap->SetPixMap( "ICON_OBJBROWSER_WIRE" );
|
aPixmap->SetPixMap("ICON_OBJBROWSER_WIRE");
|
||||||
} else if ( S.ShapeType() == TopAbs_EDGE ) {
|
else if(S.ShapeType() == TopAbs_EDGE)
|
||||||
aPixmap->SetPixMap( "ICON_OBJBROWSER_EDGE" );
|
aPixmap->SetPixMap("ICON_OBJBROWSER_EDGE");
|
||||||
} else if ( S.ShapeType() == TopAbs_VERTEX ) {
|
else if(S.ShapeType() == TopAbs_VERTEX)
|
||||||
aPixmap->SetPixMap( "ICON_OBJBROWSER_VERTEX" );
|
aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX");
|
||||||
}
|
|
||||||
|
|
||||||
SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
|
SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
|
||||||
aStudyBuilder->Addreference(newObj1, newObj);
|
aStudyBuilder->Addreference(newObj1, newObj);
|
||||||
IO->setEntry(newObj->GetID());
|
IO->setEntry(newObj->GetID());
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
allreadyexist = true;
|
allreadyexist = true;
|
||||||
if ( !myGeomGUI->SObjectExist(theObj, aResult->Name()) ) {
|
if(!myGeomGUI->SObjectExist(theObj, aResult->Name())) {
|
||||||
SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj);
|
SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj);
|
||||||
aStudyBuilder->Addreference(newObj1, SO);
|
aStudyBuilder->Addreference(newObj1, SO);
|
||||||
IO->setEntry(SO->GetID());
|
IO->setEntry(SO->GetID());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !allreadyexist ) {
|
if(!allreadyexist) {
|
||||||
vtkActorCollection* theActors =
|
vtkActorCollection* theActors = GEOM_AssemblyBuilder::BuildActors(S,0,themode,Standard_True);
|
||||||
GEOM_AssemblyBuilder::BuildActors(S,0,themode,Standard_True);
|
|
||||||
theActors->InitTraversal();
|
theActors->InitTraversal();
|
||||||
vtkActor* anActor = (vtkActor*)theActors->GetNextActor();
|
vtkActor* anActor = (vtkActor*)theActors->GetNextActor();
|
||||||
while(!(anActor==NULL)) {
|
while(!(anActor==NULL)) {
|
||||||
GEOM_Actor* GActor = GEOM_Actor::SafeDownCast( anActor );
|
GEOM_Actor* GActor = GEOM_Actor::SafeDownCast(anActor);
|
||||||
GActor->setIO( IO );
|
GActor->setIO(IO);
|
||||||
GActor->setName( nameG );
|
GActor->setName(nameG);
|
||||||
theRenderer->AddActor(GActor);
|
theRenderer->AddActor(GActor);
|
||||||
renWin->Render();
|
renWin->Render();
|
||||||
anActor = (vtkActor*)theActors->GetNextActor();
|
anActor = (vtkActor*)theActors->GetNextActor();
|
||||||
@ -480,10 +498,10 @@ bool BuildGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* Shape
|
|||||||
|
|
||||||
/* commit transaction */
|
/* commit transaction */
|
||||||
op->finish();
|
op->finish();
|
||||||
|
|
||||||
myGeomGUI->GetActiveStudy()->updateObjBrowser();
|
myGeomGUI->GetActiveStudy()->updateObjBrowser();
|
||||||
myGeomGUI->GetDesktop()->putInfo (tr("GEOM_PRP_READY"));
|
myGeomGUI->GetDesktop()->putInfo (tr("GEOM_PRP_READY"));
|
||||||
return true ;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -491,27 +509,21 @@ bool BuildGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* Shape
|
|||||||
// function : OnSubShapeGetSelected()
|
// function : OnSubShapeGetSelected()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=====================================================================================
|
//=====================================================================================
|
||||||
bool BuildGUI::OnSubShapeGetSelected( const TopoDS_Shape& ShapeTopo,
|
bool BuildGUI::OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType, Standard_Integer& aLocalContextId, bool& myUseLocalContext)
|
||||||
const char* ShapeTopoIOR,
|
|
||||||
const int SubShapeType,
|
|
||||||
Standard_Integer& aLocalContextId,
|
|
||||||
bool& myUseLocalContext )
|
|
||||||
{
|
{
|
||||||
//* Test the type of viewer */
|
//* Test the type of viewer */
|
||||||
if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) {
|
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument();
|
||||||
|
SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(ShapeTopoIOR);
|
||||||
|
if(theObj->_is_nil()) {
|
||||||
|
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument();
|
|
||||||
SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR( ShapeTopoIOR );
|
|
||||||
if ( theObj->_is_nil() ) {
|
|
||||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY"));
|
|
||||||
return false ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
||||||
Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
|
Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
|
||||||
|
|
||||||
if( myUseLocalContext == false ) {
|
if( myUseLocalContext == false ) {
|
||||||
/* local context is from DialogBox */
|
/* local context is from DialogBox */
|
||||||
@ -524,12 +536,13 @@ bool BuildGUI::OnSubShapeGetSelected( const TopoDS_Shape& ShapeTopo,
|
|||||||
|
|
||||||
TopoDS_Shape mainShape;
|
TopoDS_Shape mainShape;
|
||||||
bool main = false;
|
bool main = false;
|
||||||
while ( !main ) {
|
while(!main) {
|
||||||
if ( aShape->IsMainShape() ) {
|
if(aShape->IsMainShape()) {
|
||||||
mainShape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape);
|
mainShape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape);
|
||||||
main = true;
|
main = true;
|
||||||
} else
|
}
|
||||||
aShape = myGeom->GetIORFromString( aShape->MainName() );
|
else
|
||||||
|
aShape = myGeom->GetIORFromString(aShape->MainName());
|
||||||
}
|
}
|
||||||
|
|
||||||
GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID;
|
GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID;
|
||||||
@ -540,85 +553,85 @@ bool BuildGUI::OnSubShapeGetSelected( const TopoDS_Shape& ShapeTopo,
|
|||||||
TopoDS_Compound compound;
|
TopoDS_Compound compound;
|
||||||
ic->InitSelected(); /* to init again */
|
ic->InitSelected(); /* to init again */
|
||||||
BRep_Builder B;
|
BRep_Builder B;
|
||||||
B.MakeCompound( compound );
|
B.MakeCompound(compound);
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
/* We create a unique compound containing all the sub shapes selected by user as attribute of the main shape */
|
/* We create a unique compound containing all the sub shapes selected by user as attribute of the main shape */
|
||||||
/* the compound is homogenous by selection */
|
/* the compound is homogenous by selection */
|
||||||
while(ic->MoreSelected()) {
|
while(ic->MoreSelected()) {
|
||||||
int index = myGeomGUI->GetIndex( ic->SelectedShape(), mainShape, SubShapeType );
|
int index = myGeomGUI->GetIndex(ic->SelectedShape(), mainShape, SubShapeType);
|
||||||
ListOfID[i] = index ;
|
ListOfID[i] = index;
|
||||||
B.Add( compound, ic->SelectedShape() );
|
B.Add(compound, ic->SelectedShape());
|
||||||
i++;
|
i++;
|
||||||
ic->NextSelected();
|
ic->NextSelected();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Test if user has selected sub shapes */
|
/* Test if user has selected sub shapes */
|
||||||
if( ListOfID->length() < 1 )
|
if(ListOfID->length() < 1)
|
||||||
return false ;
|
return false;
|
||||||
|
|
||||||
GEOM::GEOM_Shape_var aResult ;
|
GEOM::GEOM_Shape_var aResult;
|
||||||
try {
|
try {
|
||||||
aResult = myGeom->SubShape( aShape, SubShapeType, ListOfID );
|
aResult = myGeom->SubShape(aShape, SubShapeType, ListOfID);
|
||||||
}
|
}
|
||||||
catch (const SALOME::SALOME_Exception& S_ex) {
|
catch (const SALOME::SALOME_Exception& S_ex) {
|
||||||
QtCatchCorbaException(S_ex);
|
QtCatchCorbaException(S_ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* local context from DialogBox */
|
/* local context from DialogBox */
|
||||||
ic->CloseLocalContext(aLocalContextId) ;
|
ic->CloseLocalContext(aLocalContextId);
|
||||||
myUseLocalContext = false ;
|
myUseLocalContext = false ;
|
||||||
|
|
||||||
char* nameG = (char *)malloc(20);
|
char* nameG = (char *)malloc(20);
|
||||||
Standard_CString Type;
|
Standard_CString Type;
|
||||||
|
|
||||||
Handle(GEOM_AISShape) result;
|
Handle(GEOM_AISShape) result;
|
||||||
Handle(GEOM_InteractiveObject) IO ;
|
Handle(GEOM_InteractiveObject) IO;
|
||||||
|
|
||||||
// if ( !myGeomGUI->SObjectExist(theObj, aResult->Name()) ) {
|
if(nbSelected == 1) {
|
||||||
if ( nbSelected == 1 ) {
|
TopExp_Explorer Exp (compound, TopAbs_ShapeEnum(SubShapeType));
|
||||||
TopExp_Explorer Exp ( compound, TopAbs_ShapeEnum(SubShapeType) );
|
if(Exp.More()) {
|
||||||
if ( Exp.More() ) {
|
if(myGeomGUI->GetShapeTypeString(Exp.Current(),Type)) {
|
||||||
if ( myGeomGUI->GetShapeTypeString(Exp.Current(),Type) ) {
|
aResult->NameType(Type);
|
||||||
aResult->NameType( Type );
|
sprintf (nameG, "%s_%d", Type, myGeomGUI->GetIndex( Exp.Current(), mainTopo, SubShapeType));
|
||||||
sprintf (nameG, "%s_%d", Type, myGeomGUI->GetIndex( Exp.Current(), mainTopo, SubShapeType ) );
|
}
|
||||||
} else {
|
else {
|
||||||
aResult->NameType( tr("GEOM_SHAPE") );
|
aResult->NameType(tr("GEOM_SHAPE"));
|
||||||
sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->GetNbGeom()++ );
|
sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->GetNbGeom()++);
|
||||||
}
|
}
|
||||||
result = new GEOM_AISShape( Exp.Current(), nameG );
|
result = new GEOM_AISShape(Exp.Current(), nameG);
|
||||||
IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM");
|
IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if ( myGeomGUI->GetShapeTypeString(compound,Type) ) {
|
if ( myGeomGUI->GetShapeTypeString(compound,Type)) {
|
||||||
aResult->NameType( Type );
|
aResult->NameType(Type);
|
||||||
sprintf (nameG, "%s_%d", Type, myGeomGUI->GetNbGeom()++ );
|
sprintf (nameG, "%s_%d", Type, myGeomGUI->GetNbGeom()++);
|
||||||
} else {
|
} else {
|
||||||
aResult->NameType( tr("GEOM_SHAPE") );
|
aResult->NameType(tr("GEOM_SHAPE"));
|
||||||
sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->GetNbGeom()++ );
|
sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->GetNbGeom()++);
|
||||||
}
|
}
|
||||||
result = new GEOM_AISShape( compound, nameG );
|
result = new GEOM_AISShape(compound, nameG);
|
||||||
IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM");
|
IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM");
|
||||||
}
|
}
|
||||||
|
|
||||||
SALOMEDS::SObject_var SO = aStudy->FindObjectIOR( aResult->Name() );
|
SALOMEDS::SObject_var SO = aStudy->FindObjectIOR(aResult->Name());
|
||||||
|
|
||||||
/* open transaction */
|
/* open transaction */
|
||||||
QAD_Operation* op = new SALOMEGUI_ImportOperation( myGeomGUI->GetActiveStudy() );
|
QAD_Operation* op = new SALOMEGUI_ImportOperation(myGeomGUI->GetActiveStudy());
|
||||||
op->start();
|
op->start();
|
||||||
|
|
||||||
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
|
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
|
||||||
SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->entry());
|
SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->entry());
|
||||||
SALOMEDS::GenericAttribute_var anAttr;
|
SALOMEDS::GenericAttribute_var anAttr;
|
||||||
SALOMEDS::AttributeName_var aName;
|
SALOMEDS::AttributeName_var aName;
|
||||||
SALOMEDS::AttributeIOR_var anIOR;
|
SALOMEDS::AttributeIOR_var anIOR;
|
||||||
SALOMEDS::AttributePixMap_var aPixmap;
|
SALOMEDS::AttributePixMap_var aPixmap;
|
||||||
|
|
||||||
bool allreadyexist = false;
|
bool allreadyexist = false;
|
||||||
|
|
||||||
if ( SO->_is_nil() ) {
|
if(SO->_is_nil()) {
|
||||||
SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject( theObj );
|
SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(theObj);
|
||||||
anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
|
anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
|
||||||
anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
|
anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
|
||||||
anIOR->SetValue(aResult->Name());
|
anIOR->SetValue(aResult->Name());
|
||||||
@ -628,32 +641,32 @@ bool BuildGUI::OnSubShapeGetSelected( const TopoDS_Shape& ShapeTopo,
|
|||||||
|
|
||||||
anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap");
|
anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap");
|
||||||
aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
|
aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
|
||||||
if ( result->Shape().ShapeType() == TopAbs_COMPOUND ) {
|
if(result->Shape().ShapeType() == TopAbs_COMPOUND)
|
||||||
aPixmap->SetPixMap( "ICON_OBJBROWSER_COMPOUND" );
|
aPixmap->SetPixMap("ICON_OBJBROWSER_COMPOUND");
|
||||||
} else if ( result->Shape().ShapeType() == TopAbs_COMPSOLID ) {
|
else if(result->Shape().ShapeType() == TopAbs_COMPSOLID)
|
||||||
aPixmap->SetPixMap( "ICON_OBJBROWSER_COMPSOLID" );
|
aPixmap->SetPixMap("ICON_OBJBROWSER_COMPSOLID");
|
||||||
} else if ( result->Shape().ShapeType() == TopAbs_SOLID ) {
|
else if(result->Shape().ShapeType() == TopAbs_SOLID)
|
||||||
aPixmap->SetPixMap( "ICON_OBJBROWSER_SOLID" );
|
aPixmap->SetPixMap("ICON_OBJBROWSER_SOLID");
|
||||||
} else if ( result->Shape().ShapeType() == TopAbs_SHELL ) {
|
else if(result->Shape().ShapeType() == TopAbs_SHELL)
|
||||||
aPixmap->SetPixMap( "ICON_OBJBROWSER_SHELL" );
|
aPixmap->SetPixMap("ICON_OBJBROWSER_SHELL");
|
||||||
} else if ( result->Shape().ShapeType() == TopAbs_FACE ) {
|
else if(result->Shape().ShapeType() == TopAbs_FACE)
|
||||||
aPixmap->SetPixMap( "ICON_OBJBROWSER_FACE" );
|
aPixmap->SetPixMap("ICON_OBJBROWSER_FACE");
|
||||||
} else if ( result->Shape().ShapeType() == TopAbs_WIRE ) {
|
else if(result->Shape().ShapeType() == TopAbs_WIRE)
|
||||||
aPixmap->SetPixMap( "ICON_OBJBROWSER_WIRE" );
|
aPixmap->SetPixMap("ICON_OBJBROWSER_WIRE");
|
||||||
} else if ( result->Shape().ShapeType() == TopAbs_EDGE ) {
|
else if(result->Shape().ShapeType() == TopAbs_EDGE)
|
||||||
aPixmap->SetPixMap( "ICON_OBJBROWSER_EDGE" );
|
aPixmap->SetPixMap("ICON_OBJBROWSER_EDGE");
|
||||||
} else if ( result->Shape().ShapeType() == TopAbs_VERTEX ) {
|
else if(result->Shape().ShapeType() == TopAbs_VERTEX)
|
||||||
aPixmap->SetPixMap( "ICON_OBJBROWSER_VERTEX" );
|
aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX");
|
||||||
}
|
|
||||||
|
|
||||||
SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
|
SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
|
||||||
aStudyBuilder->Addreference(newObj1, newObj);
|
aStudyBuilder->Addreference(newObj1, newObj);
|
||||||
|
|
||||||
IO->setEntry(newObj->GetID());
|
IO->setEntry(newObj->GetID());
|
||||||
aResult->StudyShapeId(newObj->GetID());
|
aResult->StudyShapeId(newObj->GetID());
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
allreadyexist = true;
|
allreadyexist = true;
|
||||||
if ( !myGeomGUI->SObjectExist(theObj, aResult->Name()) ) {
|
if(!myGeomGUI->SObjectExist(theObj, aResult->Name())) {
|
||||||
SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj);
|
SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj);
|
||||||
aStudyBuilder->Addreference(newObj1, SO);
|
aStudyBuilder->Addreference(newObj1, SO);
|
||||||
|
|
||||||
@ -665,10 +678,10 @@ bool BuildGUI::OnSubShapeGetSelected( const TopoDS_Shape& ShapeTopo,
|
|||||||
/* commit transaction */
|
/* commit transaction */
|
||||||
op->finish();
|
op->finish();
|
||||||
|
|
||||||
result->setIO( IO );
|
result->setIO(IO);
|
||||||
result->setName( nameG );
|
result->setName(nameG);
|
||||||
|
|
||||||
if ( !allreadyexist )
|
if(!allreadyexist)
|
||||||
ic->Display(result);
|
ic->Display(result);
|
||||||
|
|
||||||
GEOMBase_Display* myDisplayGUI = new GEOMBase_Display();
|
GEOMBase_Display* myDisplayGUI = new GEOMBase_Display();
|
||||||
@ -678,3 +691,13 @@ bool BuildGUI::OnSubShapeGetSelected( const TopoDS_Shape& ShapeTopo,
|
|||||||
myGeomGUI->GetDesktop()->putInfo (tr("GEOM_PRP_READY"));
|
myGeomGUI->GetDesktop()->putInfo (tr("GEOM_PRP_READY"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=====================================================================================
|
||||||
|
// EXPORTED METHODS
|
||||||
|
//=====================================================================================
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
bool OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
||||||
|
{return BuildGUI::OnGUIEvent(theCommandID, parent);}
|
||||||
|
}
|
||||||
|
@ -43,7 +43,8 @@ public :
|
|||||||
BuildGUI();
|
BuildGUI();
|
||||||
~BuildGUI();
|
~BuildGUI();
|
||||||
|
|
||||||
bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
|
static BuildGUI* GetOrCreateGUI();
|
||||||
|
static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
|
||||||
|
|
||||||
void MakeLinearEdgeAndDisplay(const gp_Pnt P1, const gp_Pnt P2);
|
void MakeLinearEdgeAndDisplay(const gp_Pnt P1, const gp_Pnt P2);
|
||||||
void MakeWireAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR);
|
void MakeWireAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR);
|
||||||
@ -57,7 +58,6 @@ public :
|
|||||||
bool OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType,
|
bool OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType,
|
||||||
Standard_Integer& aLocalContextId, bool& myUseLocalContext);
|
Standard_Integer& aLocalContextId, bool& myUseLocalContext);
|
||||||
|
|
||||||
private:
|
|
||||||
GEOMBase_Context* myGeomGUI;
|
GEOMBase_Context* myGeomGUI;
|
||||||
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
|
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ bool GEOMBase_Display::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
|||||||
{
|
{
|
||||||
switch (theCommandID)
|
switch (theCommandID)
|
||||||
{
|
{
|
||||||
case 211: // SHADING/WIREFRAME - MENU
|
case 211: // MENU VIEW - WIREFRAME/SHADING
|
||||||
{
|
{
|
||||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
|
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
|
||||||
QApplication::setOverrideCursor(waitCursor);
|
QApplication::setOverrideCursor(waitCursor);
|
||||||
@ -121,7 +121,7 @@ bool GEOMBase_Display::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 212: // DISPLAY ALL - MENU
|
case 212: // MENU VIEW - DISPLAY ALL
|
||||||
{
|
{
|
||||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK)
|
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK)
|
||||||
((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->DisplayAll();
|
((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->DisplayAll();
|
||||||
@ -129,7 +129,15 @@ bool GEOMBase_Display::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
|||||||
this->OnDisplayAll();
|
this->OnDisplayAll();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 214: // ERASE ALL - MENU
|
case 213: // MENU VIEW - DISPLAY ONLY
|
||||||
|
{
|
||||||
|
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK)
|
||||||
|
this->OnVTKDisplayOnly();
|
||||||
|
else if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC)
|
||||||
|
this->OnDisplayOnly();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 214: // MENU VIEW - ERASE ALL
|
||||||
{
|
{
|
||||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK)
|
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK)
|
||||||
((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->EraseAll();
|
((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->EraseAll();
|
||||||
@ -142,7 +150,12 @@ bool GEOMBase_Display::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 8021: // WIREFRAME/SHADING - POPUP VIEWER
|
case 215: // MENU VIEW - ERASE ONLY
|
||||||
|
{
|
||||||
|
this->OnErase();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 8031: // POPUP VIEWER - WIREFRAME/SHADING
|
||||||
{
|
{
|
||||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
|
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
|
||||||
// VTK
|
// VTK
|
||||||
@ -184,32 +197,6 @@ bool GEOMBase_Display::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
|||||||
QApplication::restoreOverrideCursor();
|
QApplication::restoreOverrideCursor();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 8022 : // ERASE - POPUP VIEWER
|
|
||||||
{
|
|
||||||
this->OnErase();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 8023: // DISPLAY ONLY - POPUP VIEWER
|
|
||||||
{
|
|
||||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK)
|
|
||||||
this->OnVTKDisplayOnly();
|
|
||||||
else if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC)
|
|
||||||
this->OnDisplayOnly();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 9022 : // ERASE - OBJBROSER POPUP
|
|
||||||
{
|
|
||||||
this->OnErase();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 9023 : // DISPLAY ONLY - OBJBROSER POPUP
|
|
||||||
{
|
|
||||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK)
|
|
||||||
this->OnVTKDisplayOnly();
|
|
||||||
else if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC)
|
|
||||||
this->OnDisplayOnly();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
|
parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
|
||||||
|
@ -37,7 +37,6 @@ using namespace std;
|
|||||||
|
|
||||||
#include "OCCViewer_Viewer3d.h"
|
#include "OCCViewer_Viewer3d.h"
|
||||||
#include "VTKViewer_ViewFrame.h"
|
#include "VTKViewer_ViewFrame.h"
|
||||||
#include "GEOM_AssemblyBuilder.h"
|
|
||||||
|
|
||||||
#include "SALOME_ListIteratorOfListIO.hxx"
|
#include "SALOME_ListIteratorOfListIO.hxx"
|
||||||
#include "SALOMEGUI_NameDlg.h"
|
#include "SALOMEGUI_NameDlg.h"
|
||||||
@ -85,10 +84,6 @@ bool GEOMBase_Tools::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
|||||||
SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection());
|
SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection());
|
||||||
|
|
||||||
SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument();
|
SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument();
|
||||||
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
|
|
||||||
|
|
||||||
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
|
||||||
Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
|
|
||||||
|
|
||||||
switch (theCommandID)
|
switch (theCommandID)
|
||||||
{
|
{
|
||||||
@ -171,23 +166,24 @@ bool GEOMBase_Tools::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
|||||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
|
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
||||||
|
Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
|
||||||
|
|
||||||
QString SCr = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorRed");
|
QString SCr = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorRed");
|
||||||
QString SCg = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorGreen");
|
QString SCg = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorGreen");
|
||||||
QString SCb = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorBlue");
|
QString SCb = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorBlue");
|
||||||
QColor color;
|
QColor color;
|
||||||
if(!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty()) {
|
if(!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty()) {
|
||||||
color = QColor (SCr.toInt(), SCg.toInt(), SCb.toInt());
|
color = QColor (SCr.toInt(), SCg.toInt(), SCb.toInt());
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
Quantity_Color Default = Quantity_Color();
|
Quantity_Color Default = Quantity_Color();
|
||||||
color = QColor ((int)Default.Red() * 255.0,
|
color = QColor ((int)Default.Red() * 255.0, (int)Default.Green()* 255.0, (int)Default.Blue() * 255.0);
|
||||||
(int)Default.Green()* 255.0,
|
|
||||||
(int)Default.Blue() * 255.0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor c = QColorDialog::getColor(color, myGeomGUI->GetDesktop());
|
QColor c = QColorDialog::getColor(color, myGeomGUI->GetDesktop());
|
||||||
if(c.isValid()) {
|
if(c.isValid()) {
|
||||||
myGeomGUI->GetShadingColor() = Quantity_Color(c.red() / 255.0, c.green() / 255.0,
|
myGeomGUI->GetShadingColor() = Quantity_Color(c.red() / 255.0, c.green() / 255.0, c.blue() / 255.0, Quantity_TOC_RGB);
|
||||||
c.blue() / 255.0, Quantity_TOC_RGB);
|
|
||||||
|
|
||||||
AIS_ListOfInteractive List;
|
AIS_ListOfInteractive List;
|
||||||
ic->DisplayedObjects(List);
|
ic->DisplayedObjects(List);
|
||||||
@ -218,6 +214,9 @@ bool GEOMBase_Tools::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
|||||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
|
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
||||||
|
Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
|
||||||
|
|
||||||
QString IsoU = QAD_CONFIG->getSetting("Geometry:SettingsIsoU");
|
QString IsoU = QAD_CONFIG->getSetting("Geometry:SettingsIsoU");
|
||||||
QString IsoV = QAD_CONFIG->getSetting("Geometry:SettingsIsoV");
|
QString IsoV = QAD_CONFIG->getSetting("Geometry:SettingsIsoV");
|
||||||
if(!IsoU.isEmpty())
|
if(!IsoU.isEmpty())
|
||||||
@ -324,239 +323,6 @@ bool GEOMBase_Tools::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
case 903: // DISPLAY OBJECT BROWSER
|
|
||||||
{
|
|
||||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
|
|
||||||
// VTK
|
|
||||||
QApplication::setOverrideCursor(Qt::waitCursor);
|
|
||||||
|
|
||||||
SALOMEDS::SObject_var fatherSF =
|
|
||||||
aStudy->FindObjectID(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->entry());
|
|
||||||
|
|
||||||
SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
|
|
||||||
|
|
||||||
for(;It.More();It.Next()) {
|
|
||||||
Handle(SALOME_InteractiveObject) IObject = It.Value();
|
|
||||||
SALOMEDS::SObject_var obj = aStudy->FindObjectID(IObject->getEntry());
|
|
||||||
|
|
||||||
VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
|
|
||||||
|
|
||||||
SALOMEDS::GenericAttribute_var anAttr;
|
|
||||||
SALOMEDS::AttributeName_var aName;
|
|
||||||
SALOMEDS::AttributeIOR_var anIOR;
|
|
||||||
|
|
||||||
if(myRenderInter->isInViewer(IObject)) {
|
|
||||||
myRenderInter->Display(IObject);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
// Create new actor
|
|
||||||
if (!obj->_is_nil()) {
|
|
||||||
if(obj->FindAttribute(anAttr, "AttributeIOR")) {
|
|
||||||
// this SObject may be GEOM module root SObject
|
|
||||||
SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(obj);
|
|
||||||
bool useSubItems = false;
|
|
||||||
while(anIter->More() && !useSubItems) {
|
|
||||||
SALOMEDS::SObject_var subobj = anIter->Value();
|
|
||||||
SALOMEDS::GenericAttribute_var aTmpAttr;
|
|
||||||
if(subobj->FindAttribute(aTmpAttr, "AttributeIOR")) {
|
|
||||||
anAttr = aTmpAttr;
|
|
||||||
obj = subobj;
|
|
||||||
useSubItems = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
anIter->Next();
|
|
||||||
}
|
|
||||||
|
|
||||||
while(useSubItems?anIter->More():!anAttr->_is_nil()) {
|
|
||||||
anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
|
|
||||||
GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(anIOR->Value());
|
|
||||||
TopoDS_Shape Shape = myGeomGUI->GetShapeReader().GetShape(myGeom,aShape);
|
|
||||||
|
|
||||||
if (obj->FindAttribute(anAttr, "AttributeName")) {
|
|
||||||
aName = SALOMEDS::AttributeName::_narrow(anAttr);
|
|
||||||
vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
|
|
||||||
vtkActorCollection* theAllActors = theRenderer->GetActors();
|
|
||||||
theAllActors->InitTraversal();
|
|
||||||
vtkActor* actor = (vtkActor*)theAllActors->GetNextActor();
|
|
||||||
Handle(SALOME_InteractiveObject) anIObj;
|
|
||||||
// don't create new study object if it already exists
|
|
||||||
bool isDisplayed = false;
|
|
||||||
while(!(actor==NULL)) {
|
|
||||||
SALOME_Actor* Gactor = SALOME_Actor::SafeDownCast(actor);
|
|
||||||
if(Gactor!=NULL) {
|
|
||||||
if(Gactor->hasIO()) {
|
|
||||||
if(strcmp(Gactor->getIO()->getEntry(),obj->GetID())==0) {
|
|
||||||
isDisplayed = true;
|
|
||||||
anIObj = Gactor->getIO();
|
|
||||||
if(!anIObj.IsNull())
|
|
||||||
myRenderInter->Display(anIObj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
actor=(vtkActor*)(theAllActors->GetNextActor());
|
|
||||||
}
|
|
||||||
if(!isDisplayed) {
|
|
||||||
// open transaction
|
|
||||||
QAD_Operation* op = new SALOMEGUI_ImportOperation(myGeomGUI->GetActiveStudy());
|
|
||||||
op->start();
|
|
||||||
|
|
||||||
SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
|
|
||||||
aStudyBuilder->Addreference(newObj1, obj);
|
|
||||||
// commit transaction
|
|
||||||
op->finish();
|
|
||||||
|
|
||||||
vtkRenderWindow *renWin = theRenderer->GetRenderWindow();
|
|
||||||
int themode = myRenderInter->GetDisplayMode();
|
|
||||||
|
|
||||||
vtkActorCollection* theActors =
|
|
||||||
GEOM_AssemblyBuilder::BuildActors(Shape,0,themode,Standard_True);
|
|
||||||
theActors->InitTraversal();
|
|
||||||
vtkActor* anActor = (vtkActor*)theActors->GetNextActor();
|
|
||||||
while(!(anActor==NULL)) {
|
|
||||||
GEOM_Actor* GActor = GEOM_Actor::SafeDownCast( anActor );
|
|
||||||
Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(), myGeomGUI->GetFatherior(),"GEOM");
|
|
||||||
IO->setEntry(obj->GetID());
|
|
||||||
GActor->setIO(IO);
|
|
||||||
GActor->setName(IObject->getName());
|
|
||||||
|
|
||||||
theRenderer->AddActor(GActor);
|
|
||||||
renWin->Render();
|
|
||||||
anActor = (vtkActor*)theActors->GetNextActor();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// next item iteration
|
|
||||||
if(useSubItems) {
|
|
||||||
anIter->Next();
|
|
||||||
anAttr = SALOMEDS::GenericAttribute::_nil();
|
|
||||||
while (anIter->More() && anAttr->_is_nil()) {
|
|
||||||
SALOMEDS::SObject_var subobject = anIter->Value();
|
|
||||||
SALOMEDS::GenericAttribute_var aTmpAttribute;
|
|
||||||
if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) {
|
|
||||||
anAttr = aTmpAttribute;
|
|
||||||
obj = subobject;
|
|
||||||
} else anIter->Next();
|
|
||||||
}
|
|
||||||
} else anAttr = SALOMEDS::GenericAttribute::_nil();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
myGeomGUI->GetActiveStudy()->updateObjBrowser(true);
|
|
||||||
QApplication::restoreOverrideCursor();
|
|
||||||
|
|
||||||
} else if (myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
|
|
||||||
QApplication::setOverrideCursor( Qt::waitCursor );
|
|
||||||
SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
|
|
||||||
for(;It.More();It.Next()) {
|
|
||||||
Handle(SALOME_InteractiveObject) IObject = It.Value();
|
|
||||||
|
|
||||||
SALOMEDS::SObject_var fatherSF =
|
|
||||||
aStudy->FindObjectID(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->entry());
|
|
||||||
SALOMEDS::GenericAttribute_var anAttr;
|
|
||||||
SALOMEDS::AttributeName_var aName;
|
|
||||||
SALOMEDS::AttributeIOR_var anIOR;
|
|
||||||
|
|
||||||
if(v3d->isInViewer(IObject, true)) {
|
|
||||||
Standard_Boolean found;
|
|
||||||
Handle(GEOM_AISShape) aSh = myGeomGUI->ConvertIOinGEOMAISShape(IObject, found, true);
|
|
||||||
if(found) {
|
|
||||||
ic->Display(aSh);
|
|
||||||
ic->AddOrRemoveCurrentObject(aSh, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
SALOMEDS::SObject_var obj = aStudy->FindObjectID(IObject->getEntry());
|
|
||||||
if(!obj->_is_nil()) {
|
|
||||||
if(obj->FindAttribute(anAttr, "AttributeIOR")) {
|
|
||||||
// this SObject may be GEOM module root SObject
|
|
||||||
SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(obj);
|
|
||||||
bool useSubItems = false;
|
|
||||||
while(anIter->More() && !useSubItems) {
|
|
||||||
SALOMEDS::SObject_var subobj = anIter->Value();
|
|
||||||
SALOMEDS::GenericAttribute_var aTmpAttr;
|
|
||||||
if(subobj->FindAttribute(aTmpAttr, "AttributeIOR")) {
|
|
||||||
anAttr = aTmpAttr;
|
|
||||||
obj = subobj;
|
|
||||||
useSubItems = true;
|
|
||||||
} else anIter->Next();
|
|
||||||
}
|
|
||||||
while(useSubItems?anIter->More():!anAttr->_is_nil()) {
|
|
||||||
anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
|
|
||||||
GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(anIOR->Value());
|
|
||||||
TopoDS_Shape Shape = myGeomGUI->GetShapeReader().GetShape(myGeom,aShape);
|
|
||||||
if(obj->FindAttribute(anAttr, "AttributeName")) {
|
|
||||||
aName = SALOMEDS::AttributeName::_narrow(anAttr);
|
|
||||||
// searchin for already displayed objects with the same shape
|
|
||||||
AIS_ListOfInteractive aDisplayed;
|
|
||||||
ic->DisplayedObjects(aDisplayed);
|
|
||||||
AIS_ListIteratorOfListOfInteractive anIObjects(aDisplayed);
|
|
||||||
Handle(AIS_Shape) anAISShape;
|
|
||||||
for(;anIObjects.More();anIObjects.Next()) {
|
|
||||||
anAISShape = Handle(AIS_Shape)::DownCast(anIObjects.Value());
|
|
||||||
if(!anAISShape.IsNull()) {
|
|
||||||
if(anAISShape->Shape().IsSame(Shape))
|
|
||||||
break;
|
|
||||||
anAISShape.Nullify();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(!anAISShape.IsNull()) {
|
|
||||||
if(!ic->IsDisplayed(anAISShape))
|
|
||||||
ic->Display(anAISShape);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(!useSubItems) {
|
|
||||||
// open transaction
|
|
||||||
QAD_Operation* op = new SALOMEGUI_ImportOperation(myGeomGUI->GetActiveStudy());
|
|
||||||
op->start();
|
|
||||||
|
|
||||||
SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
|
|
||||||
aStudyBuilder->Addreference(newObj1, obj);
|
|
||||||
// commit transaction
|
|
||||||
op->finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
Handle(GEOM_AISShape) aSh = new GEOM_AISShape(Shape, aName->Value());
|
|
||||||
aSh->SetShadingColor(myGeomGUI->GetShadingColor());
|
|
||||||
Handle(GEOM_InteractiveObject) IO =
|
|
||||||
new GEOM_InteractiveObject(anIOR->Value(), myGeomGUI->GetFatherior(), "GEOM");
|
|
||||||
IO->setEntry(obj->GetID());
|
|
||||||
aSh->setIO(IO);
|
|
||||||
aSh->setName(aName->Value());
|
|
||||||
ic->Display(aSh);
|
|
||||||
if(!useSubItems)
|
|
||||||
ic->AddOrRemoveCurrentObject(aSh, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// next item iteration
|
|
||||||
if (useSubItems) {
|
|
||||||
anIter->Next();
|
|
||||||
anAttr=SALOMEDS::GenericAttribute::_nil();
|
|
||||||
while(anIter->More() && anAttr->_is_nil()) {
|
|
||||||
SALOMEDS::SObject_var subobject = anIter->Value();
|
|
||||||
SALOMEDS::GenericAttribute_var aTmpAttribute;
|
|
||||||
if(subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) {
|
|
||||||
anAttr = aTmpAttribute;
|
|
||||||
obj = subobject;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
anIter->Next();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
anAttr = SALOMEDS::GenericAttribute::_nil();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
myGeomGUI->GetActiveStudy()->updateObjBrowser(true);
|
|
||||||
QApplication::restoreOverrideCursor();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case 5103: // CHECK GEOMETRY
|
case 5103: // CHECK GEOMETRY
|
||||||
{
|
{
|
||||||
@ -596,10 +362,7 @@ bool GEOMBase_Tools::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
|||||||
Quantity_Color CSFColor;
|
Quantity_Color CSFColor;
|
||||||
Shape->Color(CSFColor);
|
Shape->Color(CSFColor);
|
||||||
|
|
||||||
QColor c = QColorDialog::getColor(QColor(CSFColor.Red() * 255.0,
|
QColor c = QColorDialog::getColor(QColor(CSFColor.Red() * 255.0, CSFColor.Green()* 255.0, CSFColor.Blue() * 255.0), myGeomGUI->GetDesktop());
|
||||||
CSFColor.Green()* 255.0,
|
|
||||||
CSFColor.Blue() * 255.0),
|
|
||||||
myGeomGUI->GetDesktop());
|
|
||||||
|
|
||||||
if(c.isValid()) {
|
if(c.isValid()) {
|
||||||
CSFColor = Quantity_Color (c.red()/255., c.green()/255., c.blue()/255., Quantity_TOC_RGB);
|
CSFColor = Quantity_Color (c.red()/255., c.green()/255., c.blue()/255., Quantity_TOC_RGB);
|
||||||
@ -623,6 +386,12 @@ bool GEOMBase_Tools::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
|||||||
}
|
}
|
||||||
case 8033: // TRANSPARENCY - POPUP VIEWER
|
case 8033: // TRANSPARENCY - POPUP VIEWER
|
||||||
{
|
{
|
||||||
|
OCCViewer_Viewer3d* v3d;
|
||||||
|
Handle(AIS_InteractiveContext) ic;
|
||||||
|
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) {
|
||||||
|
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
||||||
|
Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
|
||||||
|
}
|
||||||
GEOMBase_TransparencyDlg *aDlg = new GEOMBase_TransparencyDlg(parent, "", Sel, ic);
|
GEOMBase_TransparencyDlg *aDlg = new GEOMBase_TransparencyDlg(parent, "", Sel, ic);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -631,6 +400,9 @@ bool GEOMBase_Tools::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
|||||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
|
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
||||||
|
Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
|
||||||
|
|
||||||
ic->InitCurrent();
|
ic->InitCurrent();
|
||||||
if(ic->MoreCurrent()) {
|
if(ic->MoreCurrent()) {
|
||||||
Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
|
Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
|
||||||
@ -701,6 +473,7 @@ bool GEOMBase_Tools::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
|||||||
Engines::Component_var comp = myGeomGUI->GetDesktop()->getEngine("FactoryServer","GEOM");
|
Engines::Component_var comp = myGeomGUI->GetDesktop()->getEngine("FactoryServer","GEOM");
|
||||||
if (!CORBA::is_nil(comp)) {
|
if (!CORBA::is_nil(comp)) {
|
||||||
SALOMEDS::Driver_var driver = SALOMEDS::Driver::_narrow(comp);
|
SALOMEDS::Driver_var driver = SALOMEDS::Driver::_narrow(comp);
|
||||||
|
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
|
||||||
aStudyBuilder->LoadWith(aStudy->FindComponent("GEOM"),driver);
|
aStudyBuilder->LoadWith(aStudy->FindComponent("GEOM"),driver);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -34,10 +34,13 @@ using namespace std;
|
|||||||
#include <Prs3d_Drawer.hxx>
|
#include <Prs3d_Drawer.hxx>
|
||||||
#include <Prs3d_IsoAspect.hxx>
|
#include <Prs3d_IsoAspect.hxx>
|
||||||
#include <BRep_Tool.hxx>
|
#include <BRep_Tool.hxx>
|
||||||
|
#include <OSD_SharedLibrary.hxx>
|
||||||
|
|
||||||
// SALOME Includes
|
// SALOME Includes
|
||||||
#include "QAD_RightFrame.h"
|
#include "QAD_RightFrame.h"
|
||||||
#include "QAD_Resource.h"
|
#include "QAD_Resource.h"
|
||||||
|
#include "QAD_Tools.h"
|
||||||
|
#include "QAD_Config.h"
|
||||||
|
|
||||||
#include "OCCViewer_ViewPort.h"
|
#include "OCCViewer_ViewPort.h"
|
||||||
#include "OCCViewer_ViewPort3d.h"
|
#include "OCCViewer_ViewPort3d.h"
|
||||||
@ -50,19 +53,11 @@ using namespace std;
|
|||||||
|
|
||||||
#include "GEOMBase_Tools.h"
|
#include "GEOMBase_Tools.h"
|
||||||
#include "GEOMBase_Sketcher.h"
|
#include "GEOMBase_Sketcher.h"
|
||||||
#include "BasicGUI.h"
|
// #include "BasicGUI_PointDlg.h"
|
||||||
#include "BasicGUI_PointDlg.h"
|
|
||||||
#include "PrimitiveGUI.h"
|
|
||||||
#include "GenerationGUI.h"
|
|
||||||
#include "BuildGUI.h"
|
|
||||||
#include "BooleanGUI.h"
|
|
||||||
#include "TransformationGUI.h"
|
|
||||||
#include "OperationGUI.h"
|
|
||||||
#include "RepairGUI.h"
|
|
||||||
#include "MeasureGUI.h"
|
|
||||||
|
|
||||||
/* The object itself created in the static method 'GetOrCreateGEOMBase()' */
|
/* The object itself created in the static method 'GetOrCreateGEOMBase()' */
|
||||||
static GEOMBase_Context* GeomGUI = 0;
|
static GEOMBase_Context* GeomGUI = 0;
|
||||||
|
typedef bool OneDim(int, QAD_Desktop*);
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// class : CustomItem
|
// class : CustomItem
|
||||||
@ -125,6 +120,50 @@ GEOMBase_Context* GeometryGUI::GetOrCreateGeometryGUI(QAD_Desktop* desktop)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// function : OnGUIEvent() [static]
|
||||||
|
// purpose : manage all events on GUI
|
||||||
|
//=======================================================================
|
||||||
|
bool GeometryGUI::LoadLibrary(int theCommandID, QAD_Desktop* parent, QString GUILibrary)
|
||||||
|
{
|
||||||
|
QCString libs;
|
||||||
|
QFileInfo fileInfo;
|
||||||
|
QString GUILib, fileString, dir;
|
||||||
|
|
||||||
|
OSD_SharedLibrary myGUILibrary = OSD_SharedLibrary();
|
||||||
|
|
||||||
|
if(libs = getenv("LD_LIBRARY_PATH")) {
|
||||||
|
QStringList dirList = QStringList::split(":", libs, false); // skip empty entries
|
||||||
|
for(int i = dirList.count()-1; i >= 0; i--) {
|
||||||
|
dir = dirList[i];
|
||||||
|
fileString = QAD_Tools::addSlash(dir) + GUILibrary;
|
||||||
|
fileInfo.setFile(fileString);
|
||||||
|
if(fileInfo.exists()) {
|
||||||
|
GUILib = fileInfo.fileName();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
myGUILibrary.SetName(TCollection_AsciiString((char*)GUILib.latin1()).ToCString());
|
||||||
|
bool ok = myGUILibrary.DlOpen(OSD_RTLD_LAZY);
|
||||||
|
if(!ok) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
OSD_Function osdF = myGUILibrary.DlSymb("OnGUIEvent");
|
||||||
|
OneDim (*f1) = NULL;
|
||||||
|
if(osdF != NULL) {
|
||||||
|
f1 = (bool (*) (int, QAD_Desktop*)) osdF;
|
||||||
|
(*f1)(theCommandID, parent);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : OnGUIEvent() [static]
|
// function : OnGUIEvent() [static]
|
||||||
// purpose : manage all events on GUI
|
// purpose : manage all events on GUI
|
||||||
@ -156,94 +195,142 @@ bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
|||||||
if (GeomGUI->GetState() == CURRENT_SKETCH && theCommandID != 404 && theCommandID != 4041 && theCommandID != 4042 && theCommandID != 4043 && theCommandID != 4044 && theCommandID != 4045 && theCommandID != 4046 && theCommandID != 4047 && theCommandID != 4048 && theCommandID != 4051 && theCommandID != 4052 && theCommandID != 4053 && theCommandID != 4061 && theCommandID != 4062 && theCommandID != 4063 && theCommandID != 4064 && theCommandID != 4065)
|
if (GeomGUI->GetState() == CURRENT_SKETCH && theCommandID != 404 && theCommandID != 4041 && theCommandID != 4042 && theCommandID != 4043 && theCommandID != 4044 && theCommandID != 4045 && theCommandID != 4046 && theCommandID != 4047 && theCommandID != 4048 && theCommandID != 4051 && theCommandID != 4052 && theCommandID != 4053 && theCommandID != 4061 && theCommandID != 4062 && theCommandID != 4063 && theCommandID != 4064 && theCommandID != 4065)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// cout<<"GeometryGUI::OnGUIEvent : theCommandID = "<<theCommandID<<endl;
|
||||||
// QString theCommandID_str = itoa(theCommandID);
|
// QString theCommandID_str = itoa(theCommandID);
|
||||||
// theCommandID_str.truncate(3);
|
// theCommandID_str.truncate(3);
|
||||||
// int theCommandID_Group = theCommandID_str.toInt();
|
// int theCommandID_Group = theCommandID_str.toInt();
|
||||||
if(theCommandID == 31 || theCommandID == 33 || theCommandID == 111 ||
|
if(theCommandID == 111 || // MENU FILE - IMPORT BREP
|
||||||
theCommandID == 112 || theCommandID == 113 || theCommandID == 121 ||
|
theCommandID == 112 || // MENU FILE - IMPORT IGES
|
||||||
theCommandID == 122 || theCommandID == 123 || theCommandID == 411 ||
|
theCommandID == 113 || // MENU FILE - IMPORT STEP
|
||||||
theCommandID == 412 || theCommandID == 413 || theCommandID == 414 ||
|
theCommandID == 121 || // MENU FILE - EXPORT BREP
|
||||||
theCommandID == 415 || theCommandID == 804 || theCommandID == 901 ||
|
theCommandID == 122 || // MENU FILE - EXPORT IGES
|
||||||
theCommandID == 903 || theCommandID == 5103 || theCommandID == 8032 ||
|
theCommandID == 123 || // MENU FILE - EXPORT STEP
|
||||||
theCommandID == 8033 || theCommandID == 8034 || theCommandID == 9024) {
|
theCommandID == 31 || // MENU EDIT - COPY
|
||||||
|
theCommandID == 33 || // MENU EDIT - DELETE
|
||||||
|
theCommandID == 411 || // MENU SETTINGS - COPY
|
||||||
|
theCommandID == 412 || // MENU SETTINGS - ADD IN STUDY
|
||||||
|
theCommandID == 413 || // MENU SETTINGS - SHADING COLOR
|
||||||
|
theCommandID == 414 || // MENU SETTINGS - ISOS
|
||||||
|
theCommandID == 415 || // MENU SETTINGS - STEP VALUE FOR SPIN BOXES
|
||||||
|
theCommandID == 5103 || // MENU TOOLS - CHECK GEOMETRY
|
||||||
|
theCommandID == 8032 || // POPUP VIEWER - COLOR
|
||||||
|
theCommandID == 8033 || // POPUP VIEWER - TRANSPARENCY
|
||||||
|
theCommandID == 8034 || // POPUP VIEWER - ISOS
|
||||||
|
theCommandID == 804 || // POPUP VIEWER - ADD IN STUDY
|
||||||
|
theCommandID == 901 || // OBJECT BROWSER - RENAME
|
||||||
|
theCommandID == 9024) { // OBJECT BROWSER - OPEN
|
||||||
GEOMBase_Tools* myToolsGUI = new GEOMBase_Tools();
|
GEOMBase_Tools* myToolsGUI = new GEOMBase_Tools();
|
||||||
myToolsGUI->OnGUIEvent(theCommandID, parent);
|
myToolsGUI->OnGUIEvent(theCommandID, parent);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(theCommandID == 404 || theCommandID == 4041 || theCommandID == 4042 ||
|
if(theCommandID == 211 || // MENU VIEW - WIREFRAME/SHADING
|
||||||
theCommandID == 4043 || theCommandID == 4044 || theCommandID == 4045 ||
|
theCommandID == 212 || // MENU VIEW - DISPLAY ALL
|
||||||
theCommandID == 4046 || theCommandID == 4047 || theCommandID == 4048 ||
|
theCommandID == 213 || // MENU VIEW - DISPLAY ONLY
|
||||||
theCommandID == 4051 || theCommandID == 4052 || theCommandID == 4053 ||
|
theCommandID == 214 || // MENU VIEW - ERASE ALL
|
||||||
theCommandID == 4061 || theCommandID == 4062 || theCommandID == 4063 ||
|
theCommandID == 215 || // MENU VIEW - ERASE ONLY
|
||||||
theCommandID == 4064 || theCommandID == 4065) {
|
theCommandID == 8031) { // POPUP VIEWER - WIREFRAME/SHADING
|
||||||
GEOMBase_Sketcher* mySketcherGUI = new GEOMBase_Sketcher();
|
|
||||||
mySketcherGUI->OnGUIEvent(theCommandID, parent);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if(theCommandID == 211 || theCommandID == 212 || theCommandID == 214 ||
|
|
||||||
theCommandID == 8021 || theCommandID == 8022 || theCommandID == 8023 ||
|
|
||||||
theCommandID == 9022 || theCommandID == 9023) {
|
|
||||||
GEOMBase_Display* myDisplayGUI = new GEOMBase_Display();
|
GEOMBase_Display* myDisplayGUI = new GEOMBase_Display();
|
||||||
myDisplayGUI->OnGUIEvent(theCommandID, parent);
|
myDisplayGUI->OnGUIEvent(theCommandID, parent);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(theCommandID == 4011 || theCommandID == 4012 || theCommandID == 4013 ||
|
if(theCommandID == 404 || // SKETCHER
|
||||||
theCommandID == 4014 || theCommandID == 4015 || theCommandID == 4016 ||
|
theCommandID == 4041 || // SKETCHER - POPUP VIEWER - SEGMENT
|
||||||
theCommandID == 4017 || theCommandID == 4018) {
|
theCommandID == 4042 || // SKETCHER - POPUP VIEWER - ARC
|
||||||
BasicGUI* myBasicGUI = new BasicGUI();
|
theCommandID == 4043 || // SKETCHER - POPUP VIEWER - SET ANGLE
|
||||||
myBasicGUI->OnGUIEvent(theCommandID, parent);
|
theCommandID == 4044 || // SKETCHER - POPUP VIEWER - SET X
|
||||||
|
theCommandID == 4045 || // SKETCHER - POPUP VIEWER - SET Y
|
||||||
|
theCommandID == 4046 || // SKETCHER - POPUP VIEWER - DELETE
|
||||||
|
theCommandID == 4047 || // SKETCHER - POPUP VIEWER - END
|
||||||
|
theCommandID == 4048 || // SKETCHER - POPUP VIEWER - CLOSE
|
||||||
|
theCommandID == 4051 || // SKETCHER - MENU - SET PLANE
|
||||||
|
theCommandID == 4052 || // SKETCHER - MENU - TANGENT
|
||||||
|
theCommandID == 4053 || // SKETCHER - MENU - PERPENDICULAR
|
||||||
|
theCommandID == 4061 || // SKETCHER - MENU - LENGTH
|
||||||
|
theCommandID == 4062 || // SKETCHER - MENU - ANGLE
|
||||||
|
theCommandID == 4063 || // SKETCHER - MENU - RADIUS
|
||||||
|
theCommandID == 4064 || // SKETCHER - MENU - X
|
||||||
|
theCommandID == 4065) { // SKETCHER - MENU - Y
|
||||||
|
GEOMBase_Sketcher* mySketcherGUI = new GEOMBase_Sketcher();
|
||||||
|
mySketcherGUI->OnGUIEvent(theCommandID, parent);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if(theCommandID == 4021 || theCommandID == 4022 || theCommandID == 4023 ||
|
if(theCommandID == 4011 || // MENU BASIC - POINT
|
||||||
theCommandID == 4024 || theCommandID == 4025) {
|
theCommandID == 4012 || // MENU BASIC - LINE
|
||||||
PrimitiveGUI* myPrimitiveGUI = new PrimitiveGUI();
|
theCommandID == 4013 || // MENU BASIC - CIRCLE
|
||||||
myPrimitiveGUI->OnGUIEvent(theCommandID, parent);
|
theCommandID == 4014 || // MENU BASIC - ELLIPSE
|
||||||
return true;
|
theCommandID == 4015 || // MENU BASIC - ARC
|
||||||
|
theCommandID == 4016 || // MENU BASIC - VECTOR
|
||||||
|
theCommandID == 4017 || // MENU BASIC - PLANE
|
||||||
|
theCommandID == 4018) { // MENU BASIC - WPLANE
|
||||||
|
bool testlib = GeometryGUI::LoadLibrary(theCommandID, parent, "libBasicGUI.so");
|
||||||
|
return testlib;
|
||||||
}
|
}
|
||||||
if(theCommandID == 4031 || theCommandID == 4032 ||
|
if(theCommandID == 4021 || // MENU PRIMITIVE - BOX
|
||||||
theCommandID == 4033 || theCommandID == 4034) {
|
theCommandID == 4022 || // MENU PRIMITIVE - CYLINDER
|
||||||
GenerationGUI* myGenerationGUI = new GenerationGUI();
|
theCommandID == 4023 || // MENU PRIMITIVE - SPHERE
|
||||||
myGenerationGUI->OnGUIEvent(theCommandID, parent);
|
theCommandID == 4024 || // MENU PRIMITIVE - TORUS
|
||||||
return true;
|
theCommandID == 4025) { // MENU PRIMITIVE - CONE
|
||||||
|
bool testlib = GeometryGUI::LoadLibrary(theCommandID, parent, "libPrimitiveGUI.so");
|
||||||
|
return testlib;
|
||||||
}
|
}
|
||||||
if(theCommandID == 407 || theCommandID == 4081 || theCommandID == 4082 ||
|
if(theCommandID == 4031 || // MENU GENERATION - PRISM
|
||||||
theCommandID == 4083 || theCommandID == 4084 || theCommandID == 4085 ||
|
theCommandID == 4032 || // MENU GENERATION - REVOLUTION
|
||||||
theCommandID == 4086) {
|
theCommandID == 4033 || // MENU GENERATION - FILLING
|
||||||
BuildGUI* myBuildGUI = new BuildGUI();
|
theCommandID == 4034) { // MENU GENERATION - PIPE
|
||||||
myBuildGUI->OnGUIEvent(theCommandID, parent);
|
bool testlib = GeometryGUI::LoadLibrary(theCommandID, parent, "libGenerationGUI.so");
|
||||||
return true;
|
return testlib;
|
||||||
}
|
}
|
||||||
if(theCommandID == 5011 || theCommandID == 5012 ||
|
if(theCommandID == 407 || // MENU BUILD - EXPLODE
|
||||||
theCommandID == 5013 || theCommandID == 5014) {
|
theCommandID == 4081 || // MENU BUILD - EDGE
|
||||||
BooleanGUI* myBooleanGUI = new BooleanGUI();
|
theCommandID == 4082 || // MENU BUILD - WIRE
|
||||||
myBooleanGUI->OnGUIEvent(theCommandID, parent);
|
theCommandID == 4083 || // MENU BUILD - FACE
|
||||||
return true;
|
theCommandID == 4084 || // MENU BUILD - SHELL
|
||||||
|
theCommandID == 4085 || // MENU BUILD - SOLID
|
||||||
|
theCommandID == 4086) { // MENU BUILD - COMPUND
|
||||||
|
bool testlib = GeometryGUI::LoadLibrary(theCommandID, parent, "libBuildGUI.so");
|
||||||
|
return testlib;
|
||||||
}
|
}
|
||||||
if(theCommandID == 5021 || theCommandID == 5022 || theCommandID == 5023 ||
|
if(theCommandID == 5011 || // MENU BOOLEAN - FUSE
|
||||||
theCommandID == 5024 || theCommandID == 5025 || theCommandID == 5026) {
|
theCommandID == 5012 || // MENU BOOLEAN - COMMON
|
||||||
TransformationGUI* myTransformationGUI = new TransformationGUI();
|
theCommandID == 5013 || // MENU BOOLEAN - CUT
|
||||||
myTransformationGUI->OnGUIEvent(theCommandID, parent);
|
theCommandID == 5014) { // MENU BOOLEAN - SECTION
|
||||||
return true;
|
bool testlib = GeometryGUI::LoadLibrary(theCommandID, parent, "libBooleanGUI.so");
|
||||||
|
return testlib;
|
||||||
}
|
}
|
||||||
if(theCommandID == 503 || theCommandID == 504 ||
|
if(theCommandID == 5021 || // MENU TRANSFORMATION - TRANSLATION
|
||||||
theCommandID == 505 || theCommandID == 506) {
|
theCommandID == 5022 || // MENU TRANSFORMATION - ROTATION
|
||||||
OperationGUI* myOperationGUI = new OperationGUI();
|
theCommandID == 5023 || // MENU TRANSFORMATION - MIRROR
|
||||||
myOperationGUI->OnGUIEvent(theCommandID, parent);
|
theCommandID == 5024 || // MENU TRANSFORMATION - SCALE
|
||||||
return true;
|
theCommandID == 5025 || // MENU TRANSFORMATION - MULTI-TRANSLATION
|
||||||
|
theCommandID == 5026) { // MENU TRANSFORMATION - MULTI-ROTATION
|
||||||
|
bool testlib = GeometryGUI::LoadLibrary(theCommandID, parent, "libTransformationGUI.so");
|
||||||
|
return testlib;
|
||||||
}
|
}
|
||||||
if(theCommandID == 601 || theCommandID == 602 ||
|
if(theCommandID == 503 || // MENU OPERATION - PARTITION
|
||||||
theCommandID == 603 || theCommandID == 604) {
|
theCommandID == 504 || // MENU OPERATION - ARCHIMEDE
|
||||||
RepairGUI* myRepairGUI = new RepairGUI();
|
theCommandID == 505 || // MENU OPERATION - FILLET
|
||||||
myRepairGUI->OnGUIEvent(theCommandID, parent);
|
theCommandID == 506) { // MENU OPERATION - CHAMFER
|
||||||
return true;
|
bool testlib = GeometryGUI::LoadLibrary(theCommandID, parent, "libOperationGUI.so");
|
||||||
|
return testlib;
|
||||||
}
|
}
|
||||||
if(theCommandID == 701 || theCommandID == 702 || theCommandID == 703 ||
|
if(theCommandID == 601 || // MENU REPAIR - SEWING
|
||||||
theCommandID == 7041 || theCommandID == 7042 ||
|
theCommandID == 602 || // MENU REPAIR - ORIENTATION
|
||||||
theCommandID == 705 || theCommandID == 706 || theCommandID == 707) {
|
theCommandID == 603 || // MENU REPAIR - SUPPRESS FACES
|
||||||
MeasureGUI* myMeasureGUI = new MeasureGUI();
|
theCommandID == 604) { // MENU REPAIR - SUPPRESS HOLE
|
||||||
myMeasureGUI->OnGUIEvent(theCommandID, parent);
|
bool testlib = GeometryGUI::LoadLibrary(theCommandID, parent, "libRepairGUI.so");
|
||||||
return true;
|
return testlib;
|
||||||
|
}
|
||||||
|
if(theCommandID == 701 || // MENU MEASURE - PROPERTIES
|
||||||
|
theCommandID == 702 || // MENU MEASURE - CDG
|
||||||
|
theCommandID == 703 || // MENU MEASURE - INERTIA
|
||||||
|
theCommandID == 7041 || // MENU MEASURE - BOUNDING BOX
|
||||||
|
theCommandID == 7042 || // MENU MEASURE - MIN DISTANCE
|
||||||
|
theCommandID == 705 || // MENU MEASURE - TOLERANCE
|
||||||
|
theCommandID == 706 || // MENU MEASURE - WHATIS
|
||||||
|
theCommandID == 707) { // MENU MEASURE - CHECK
|
||||||
|
bool testlib = GeometryGUI::LoadLibrary(theCommandID, parent, "libMeasureGUI.so");
|
||||||
|
return testlib;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -291,28 +378,28 @@ bool GeometryGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(GeomGUI->GetState() == POINT_METHOD) {
|
else if(GeomGUI->GetState() == POINT_METHOD) {
|
||||||
GeomGUI->EraseSimulationShape();
|
// GeomGUI->EraseSimulationShape();
|
||||||
BasicGUI_PointDlg *DialogPt = (BasicGUI_PointDlg*)(GeomGUI->GetActiveDialogBox());
|
// BasicGUI_PointDlg *DialogPt = (BasicGUI_PointDlg*)(GeomGUI->GetActiveDialogBox());
|
||||||
|
|
||||||
if(DialogPt->UseLocalContext()) {
|
// if(DialogPt->UseLocalContext()) {
|
||||||
ic->InitSelected();
|
// ic->InitSelected();
|
||||||
if(pe->state() == Qt::ShiftButton)
|
// if(pe->state() == Qt::ShiftButton)
|
||||||
v3d->getAISSelector()->shiftSelect(); /* Append selection */
|
// v3d->getAISSelector()->shiftSelect(); /* Append selection */
|
||||||
else
|
// else
|
||||||
v3d->getAISSelector()->select(); /* New selection */
|
// v3d->getAISSelector()->select(); /* New selection */
|
||||||
|
|
||||||
if(ic->MoreSelected())
|
// if(ic->MoreSelected())
|
||||||
thePoint = BRep_Tool::Pnt( TopoDS::Vertex(ic->SelectedShape()));
|
// thePoint = BRep_Tool::Pnt( TopoDS::Vertex(ic->SelectedShape()));
|
||||||
else
|
// else
|
||||||
thePoint = GeomGUI->ConvertClickToPoint(pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView());
|
// thePoint = GeomGUI->ConvertClickToPoint(pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView());
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
thePoint = GeomGUI->ConvertClickToPoint(pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView());
|
// thePoint = GeomGUI->ConvertClickToPoint(pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView());
|
||||||
|
|
||||||
if(DialogPt != 0)
|
// if(DialogPt != 0)
|
||||||
DialogPt->PointIntoCoordinates(thePoint, true); /* display point */
|
// DialogPt->PointIntoCoordinates(thePoint, true); /* display point */
|
||||||
else
|
// else
|
||||||
GeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT"));
|
// GeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT"));
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,8 @@ public :
|
|||||||
~GeometryGUI();
|
~GeometryGUI();
|
||||||
|
|
||||||
static GEOMBase_Context* GetOrCreateGeometryGUI(QAD_Desktop* desktop);
|
static GEOMBase_Context* GetOrCreateGeometryGUI(QAD_Desktop* desktop);
|
||||||
/* static GEOMBase_Context* GetGeomGUI(); */
|
|
||||||
|
static bool LoadLibrary(int theCommandID, QAD_Desktop* parent, QString GUILibrary);
|
||||||
|
|
||||||
/* Managed by IAPP */
|
/* Managed by IAPP */
|
||||||
Standard_EXPORT static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
|
Standard_EXPORT static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
|
||||||
|
@ -61,6 +61,6 @@ LIB_SERVER_IDL =
|
|||||||
CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
|
CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
|
||||||
CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
|
CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
|
||||||
|
|
||||||
LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lGEOMBase -lBasicGUI -lPrimitiveGUI -lGenerationGUI -lBuildGUI -lBooleanGUI -lTransformationGUI -lOperationGUI -lRepairGUI -lMeasureGUI $(OCC_KERNEL_LIBS) $(OCC_MODELER_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome
|
LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lGEOMBase $(OCC_KERNEL_LIBS) $(OCC_MODELER_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome
|
||||||
|
|
||||||
@CONCLUDE@
|
@CONCLUDE@
|
||||||
|
@ -34,6 +34,8 @@ using namespace std;
|
|||||||
#include "GenerationGUI_FillingDlg.h" // Method FILLING
|
#include "GenerationGUI_FillingDlg.h" // Method FILLING
|
||||||
#include "GenerationGUI_PipeDlg.h" // Method PIPE
|
#include "GenerationGUI_PipeDlg.h" // Method PIPE
|
||||||
|
|
||||||
|
static GenerationGUI* myGenerationGUI = 0;
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : GenerationGUI()
|
// function : GenerationGUI()
|
||||||
// purpose : Constructor
|
// purpose : Constructor
|
||||||
@ -56,35 +58,48 @@ GenerationGUI::~GenerationGUI()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// function : GetOrCreateGUI()
|
||||||
|
// purpose : Gets or create an object 'GUI' with initialisations
|
||||||
|
// : Returns 'GUI' as a pointer
|
||||||
|
//=======================================================================
|
||||||
|
GenerationGUI* GenerationGUI::GetOrCreateGUI()
|
||||||
|
{
|
||||||
|
myGenerationGUI = new GenerationGUI();
|
||||||
|
return myGenerationGUI;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : OnGUIEvent()
|
// function : OnGUIEvent()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool GenerationGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
bool GenerationGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
||||||
{
|
{
|
||||||
myGeomGUI->EmitSignalDeactivateDialog();
|
GenerationGUI::GetOrCreateGUI();
|
||||||
SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection());
|
myGenerationGUI->myGeomGUI->EmitSignalDeactivateDialog();
|
||||||
|
SALOME_Selection* Sel = SALOME_Selection::Selection(myGenerationGUI->myGeomGUI->GetActiveStudy()->getSelection());
|
||||||
|
|
||||||
switch (theCommandID)
|
switch (theCommandID)
|
||||||
{
|
{
|
||||||
case 4031: // PRISM
|
case 4031: // PRISM
|
||||||
{
|
{
|
||||||
GenerationGUI_PrismDlg *aDlg = new GenerationGUI_PrismDlg(parent, "", this, Sel);
|
GenerationGUI_PrismDlg *aDlg = new GenerationGUI_PrismDlg(parent, "", myGenerationGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4032: // REVOL
|
case 4032: // REVOL
|
||||||
{
|
{
|
||||||
GenerationGUI_RevolDlg *aDlg = new GenerationGUI_RevolDlg(parent, "", this, Sel);
|
GenerationGUI_RevolDlg *aDlg = new GenerationGUI_RevolDlg(parent, "", myGenerationGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4033: // FILLING
|
case 4033: // FILLING
|
||||||
{
|
{
|
||||||
GenerationGUI_FillingDlg *aDlg = new GenerationGUI_FillingDlg(parent, "", this, Sel);
|
GenerationGUI_FillingDlg *aDlg = new GenerationGUI_FillingDlg(parent, "", myGenerationGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4034: // PIPE
|
case 4034: // PIPE
|
||||||
{
|
{
|
||||||
GenerationGUI_PipeDlg *aDlg = new GenerationGUI_PipeDlg(parent, "", this, Sel);
|
GenerationGUI_PipeDlg *aDlg = new GenerationGUI_PipeDlg(parent, "", myGenerationGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -218,3 +233,13 @@ void GenerationGUI::MakePipeAndDisplay(GEOM::GEOM_Shape_ptr aPath, GEOM::GEOM_Sh
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=====================================================================================
|
||||||
|
// EXPORTED METHODS
|
||||||
|
//=====================================================================================
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
bool OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
||||||
|
{return GenerationGUI::OnGUIEvent(theCommandID, parent);}
|
||||||
|
}
|
||||||
|
@ -43,7 +43,8 @@ public :
|
|||||||
GenerationGUI();
|
GenerationGUI();
|
||||||
~GenerationGUI();
|
~GenerationGUI();
|
||||||
|
|
||||||
bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
|
static GenerationGUI* GetOrCreateGUI();
|
||||||
|
static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
|
||||||
|
|
||||||
void MakePrismAndDisplay(GEOM::GEOM_Shape_ptr BaseShape, const gp_Pnt P1, const gp_Pnt P2);
|
void MakePrismAndDisplay(GEOM::GEOM_Shape_ptr BaseShape, const gp_Pnt P1, const gp_Pnt P2);
|
||||||
void MakeRevolutionAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Pnt loc,
|
void MakeRevolutionAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Pnt loc,
|
||||||
@ -52,7 +53,6 @@ public :
|
|||||||
const double tol3d, const double tol2d, const short nbiter);
|
const double tol3d, const double tol2d, const short nbiter);
|
||||||
void MakePipeAndDisplay(GEOM::GEOM_Shape_ptr aPath, GEOM::GEOM_Shape_ptr aBase);
|
void MakePipeAndDisplay(GEOM::GEOM_Shape_ptr aPath, GEOM::GEOM_Shape_ptr aBase);
|
||||||
|
|
||||||
private:
|
|
||||||
GEOMBase_Context* myGeomGUI;
|
GEOMBase_Context* myGeomGUI;
|
||||||
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
|
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
|
||||||
|
|
||||||
|
@ -162,7 +162,6 @@ void GenerationGUI_FillingDlg::ClickOnApply()
|
|||||||
|
|
||||||
if(myOkSectionShape)
|
if(myOkSectionShape)
|
||||||
myGenerationGUI->MakeFillingAndDisplay(myGeomShape, myMinDeg, myMaxDeg, myTol3D, myTol2D, myNbIter);
|
myGenerationGUI->MakeFillingAndDisplay(myGeomShape, myMinDeg, myMaxDeg, myTol3D, myTol2D, myNbIter);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,13 +208,14 @@ void GenerationGUI_FillingDlg::SelectionIntoArgument()
|
|||||||
void GenerationGUI_FillingDlg::SetEditCurrentArgument()
|
void GenerationGUI_FillingDlg::SetEditCurrentArgument()
|
||||||
{
|
{
|
||||||
QPushButton* send = (QPushButton*)sender();
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
mySelection->ClearFilters();
|
||||||
|
|
||||||
if(send == GroupPoints->PushButton1) {
|
if(send == GroupPoints->PushButton1) {
|
||||||
GroupPoints->LineEdit1->setFocus();
|
GroupPoints->LineEdit1->setFocus();
|
||||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
mySelection->AddFilter(myCompoundFilter);
|
mySelection->AddFilter(myCompoundFilter);
|
||||||
|
this->SelectionIntoArgument();
|
||||||
}
|
}
|
||||||
this->SelectionIntoArgument();
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -30,8 +30,6 @@ using namespace std;
|
|||||||
#include "GenerationGUI_PipeDlg.h"
|
#include "GenerationGUI_PipeDlg.h"
|
||||||
|
|
||||||
#include <BRepOffsetAPI_MakePipe.hxx>
|
#include <BRepOffsetAPI_MakePipe.hxx>
|
||||||
// #include <Standard_ErrorHandler.hxx>
|
|
||||||
// #include <Standard_Failure.hxx>
|
|
||||||
#include <BRepAlgoAPI.hxx>
|
#include <BRepAlgoAPI.hxx>
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -149,6 +147,8 @@ void GenerationGUI_PipeDlg::ClickOnApply()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void GenerationGUI_PipeDlg::SelectionIntoArgument()
|
void GenerationGUI_PipeDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
|
myGeomGUI->EraseSimulationShape();
|
||||||
|
mySimulationTopoDs.Nullify();
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
QString aString = ""; /* name of selection */
|
QString aString = ""; /* name of selection */
|
||||||
|
|
||||||
@ -185,25 +185,8 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
|
|||||||
myShape2 = S;
|
myShape2 = S;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(myOkShape1 && myOkShape2 && !myShape1.IsNull() && !myShape2.IsNull()) {
|
if(myOkShape1 && myOkShape2)
|
||||||
//Make preview
|
this->MakePipeSimulationAndDisplay();
|
||||||
TopoDS_Shape tds;
|
|
||||||
TopoDS_Wire aWire;
|
|
||||||
|
|
||||||
if(myShape2.ShapeType() == TopAbs_WIRE)
|
|
||||||
aWire = TopoDS::Wire(myShape2);
|
|
||||||
else if(myShape2.ShapeType() == TopAbs_EDGE) {
|
|
||||||
TopoDS_Edge aEdge = TopoDS::Edge(myShape2);
|
|
||||||
aWire = BRepBuilderAPI_MakeWire(aEdge);
|
|
||||||
}
|
|
||||||
|
|
||||||
tds = BRepOffsetAPI_MakePipe(aWire,myShape1);
|
|
||||||
if(BRepAlgoAPI::IsValid(tds)) {
|
|
||||||
//Draw Pipe
|
|
||||||
mySimulationTopoDs = tds;
|
|
||||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,3 +257,37 @@ void GenerationGUI_PipeDlg::ActivateThisDialog()
|
|||||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : MakeMirrorSimulationAndDisplay()
|
||||||
|
// purpose : S1 is a shape and S2 a mirror.
|
||||||
|
//=================================================================================
|
||||||
|
void GenerationGUI_PipeDlg::MakePipeSimulationAndDisplay()
|
||||||
|
{
|
||||||
|
myGeomGUI->EraseSimulationShape();
|
||||||
|
mySimulationTopoDs.Nullify();
|
||||||
|
|
||||||
|
try {
|
||||||
|
TopoDS_Wire aWire;
|
||||||
|
|
||||||
|
if(myShape2.ShapeType() == TopAbs_WIRE)
|
||||||
|
aWire = TopoDS::Wire(myShape2);
|
||||||
|
else if(myShape2.ShapeType() == TopAbs_EDGE) {
|
||||||
|
TopoDS_Edge aEdge = TopoDS::Edge(myShape2);
|
||||||
|
aWire = BRepBuilderAPI_MakeWire(aEdge);
|
||||||
|
}
|
||||||
|
|
||||||
|
TopoDS_Shape tds = BRepOffsetAPI_MakePipe(aWire,myShape1);
|
||||||
|
if(BRepAlgoAPI::IsValid(tds)) {
|
||||||
|
//Draw Pipe
|
||||||
|
mySimulationTopoDs = tds;
|
||||||
|
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch(Standard_Failure) {
|
||||||
|
MESSAGE("Exception catched in MakeMirrorSimulationAndDisplay");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
@ -49,6 +49,7 @@ public:
|
|||||||
private:
|
private:
|
||||||
void Init();
|
void Init();
|
||||||
void enterEvent(QEvent* e);
|
void enterEvent(QEvent* e);
|
||||||
|
void MakePipeSimulationAndDisplay();
|
||||||
|
|
||||||
GenerationGUI* myGenerationGUI;
|
GenerationGUI* myGenerationGUI;
|
||||||
|
|
||||||
|
@ -95,7 +95,6 @@ void GenerationGUI_PrismDlg::Init()
|
|||||||
myOkBase = myOkLine = false;
|
myOkBase = myOkLine = false;
|
||||||
|
|
||||||
myEdgeFilter = new GEOM_ShapeTypeFilter(TopAbs_EDGE, myGeom);
|
myEdgeFilter = new GEOM_ShapeTypeFilter(TopAbs_EDGE, myGeom);
|
||||||
mySelection->AddFilter(myEdgeFilter);
|
|
||||||
|
|
||||||
/* Get setting of step value from file configuration */
|
/* Get setting of step value from file configuration */
|
||||||
QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep");
|
QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep");
|
||||||
@ -116,6 +115,7 @@ void GenerationGUI_PrismDlg::Init()
|
|||||||
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||||
|
|
||||||
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||||
|
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double)));
|
||||||
connect(GroupPoints->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(ReverseVector(int)));
|
connect(GroupPoints->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(ReverseVector(int)));
|
||||||
|
|
||||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
|
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
|
||||||
@ -179,6 +179,8 @@ void GenerationGUI_PrismDlg::ClickOnApply()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void GenerationGUI_PrismDlg::SelectionIntoArgument()
|
void GenerationGUI_PrismDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
|
myGeomGUI->EraseSimulationShape();
|
||||||
|
mySimulationTopoDs.Nullify();
|
||||||
myEditCurrentArgument->setText("");
|
myEditCurrentArgument->setText("");
|
||||||
QString aString = ""; /* name of selection */
|
QString aString = ""; /* name of selection */
|
||||||
|
|
||||||
@ -198,7 +200,7 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
|
|||||||
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
|
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
gp_Pnt aPoint1, aPoint2 ;
|
gp_Pnt aPoint1, aPoint2;
|
||||||
|
|
||||||
if(myEditCurrentArgument == GroupPoints->LineEdit1) {
|
if(myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||||
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
|
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
|
||||||
@ -217,8 +219,7 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(myOkBase && myOkLine)
|
if(myOkBase && myOkLine)
|
||||||
MakePrismSimulationAndDisplay(myBaseTopo);
|
this->MakePrismSimulationAndDisplay();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -230,6 +231,7 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
|
|||||||
void GenerationGUI_PrismDlg::SetEditCurrentArgument()
|
void GenerationGUI_PrismDlg::SetEditCurrentArgument()
|
||||||
{
|
{
|
||||||
QPushButton* send = (QPushButton*)sender();
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
mySelection->ClearFilters();
|
||||||
|
|
||||||
if(send == GroupPoints->PushButton1) {
|
if(send == GroupPoints->PushButton1) {
|
||||||
GroupPoints->LineEdit1->setFocus();
|
GroupPoints->LineEdit1->setFocus();
|
||||||
@ -298,16 +300,9 @@ void GenerationGUI_PrismDlg::ActivateThisDialog()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void GenerationGUI_PrismDlg::ValueChangedInSpinBox(double newValue)
|
void GenerationGUI_PrismDlg::ValueChangedInSpinBox(double newValue)
|
||||||
{
|
{
|
||||||
myGeomGUI->EraseSimulationShape();
|
myHeight = newValue;
|
||||||
mySimulationTopoDs.Nullify();
|
if(myOkBase && myOkLine)
|
||||||
QObject* send = (QObject*)sender();
|
this->MakePrismSimulationAndDisplay();
|
||||||
|
|
||||||
if(send == GroupPoints->SpinBox_DX) {
|
|
||||||
myHeight = newValue;
|
|
||||||
|
|
||||||
if(myOkBase && myOkLine)
|
|
||||||
MakePrismSimulationAndDisplay(myBaseTopo);
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,14 +313,11 @@ void GenerationGUI_PrismDlg::ValueChangedInSpinBox(double newValue)
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void GenerationGUI_PrismDlg::ReverseVector(int state)
|
void GenerationGUI_PrismDlg::ReverseVector(int state)
|
||||||
{
|
{
|
||||||
myGeomGUI->EraseSimulationShape();
|
|
||||||
mySimulationTopoDs.Nullify();
|
|
||||||
|
|
||||||
myDx = -myDx;
|
myDx = -myDx;
|
||||||
myDy = -myDy;
|
myDy = -myDy;
|
||||||
myDz = -myDz;
|
myDz = -myDz;
|
||||||
if(myOkBase && myOkLine)
|
if(myOkBase && myOkLine)
|
||||||
MakePrismSimulationAndDisplay(myBaseTopo);
|
this->MakePrismSimulationAndDisplay();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,18 +326,24 @@ void GenerationGUI_PrismDlg::ReverseVector(int state)
|
|||||||
// function : MakePrismSimulationAndDisplay()
|
// function : MakePrismSimulationAndDisplay()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void GenerationGUI_PrismDlg::MakePrismSimulationAndDisplay(const TopoDS_Shape& S)
|
void GenerationGUI_PrismDlg::MakePrismSimulationAndDisplay()
|
||||||
{
|
{
|
||||||
|
myGeomGUI->EraseSimulationShape();
|
||||||
|
mySimulationTopoDs.Nullify();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
gp_Vec Vec(myDx, myDy, myDz );
|
gp_Vec Vec(myDx, myDy, myDz);
|
||||||
Vec.Normalize();
|
Vec.Normalize();
|
||||||
Vec *= myHeight;
|
Vec *= myHeight;
|
||||||
mySimulationTopoDs = BRepPrimAPI_MakePrism(S, Vec, Standard_False).Shape();
|
mySimulationTopoDs = BRepPrimAPI_MakePrism(myBaseTopo, Vec, Standard_False).Shape();
|
||||||
|
if(mySimulationTopoDs.IsNull())
|
||||||
|
return;
|
||||||
|
else
|
||||||
|
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||||
}
|
}
|
||||||
catch(Standard_Failure) {
|
catch(Standard_Failure) {
|
||||||
MESSAGE( "Exception catched in MakePrismSimulationAndDisplay" << endl ) ;
|
MESSAGE("Exception catched in MakePrismSimulationAndDisplay" << endl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ public:
|
|||||||
private :
|
private :
|
||||||
void Init();
|
void Init();
|
||||||
void enterEvent(QEvent* e);
|
void enterEvent(QEvent* e);
|
||||||
void MakePrismSimulationAndDisplay(const TopoDS_Shape& S);
|
void MakePrismSimulationAndDisplay();
|
||||||
|
|
||||||
GenerationGUI* myGenerationGUI;
|
GenerationGUI* myGenerationGUI;
|
||||||
|
|
||||||
|
@ -30,24 +30,9 @@ using namespace std;
|
|||||||
#include "GenerationGUI_RevolDlg.h"
|
#include "GenerationGUI_RevolDlg.h"
|
||||||
|
|
||||||
#include <BRepAdaptor_Curve.hxx>
|
#include <BRepAdaptor_Curve.hxx>
|
||||||
|
#include <BRepPrimAPI_MakeRevol.hxx>
|
||||||
#include "QAD_Config.h"
|
#include "QAD_Config.h"
|
||||||
|
|
||||||
#include <qbuttongroup.h>
|
|
||||||
#include <qcheckbox.h>
|
|
||||||
#include <qgroupbox.h>
|
|
||||||
#include <qlabel.h>
|
|
||||||
#include <qlineedit.h>
|
|
||||||
#include <qpushbutton.h>
|
|
||||||
#include <qradiobutton.h>
|
|
||||||
#include <qlayout.h>
|
|
||||||
#include <qvariant.h>
|
|
||||||
#include <qtooltip.h>
|
|
||||||
#include <qwhatsthis.h>
|
|
||||||
#include <qimage.h>
|
|
||||||
#include <qvalidator.h>
|
|
||||||
#include <qpixmap.h>
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : GenerationGUI_RevolDlg()
|
// class : GenerationGUI_RevolDlg()
|
||||||
// purpose : Constructs a GenerationGUI_RevolDlg which is a child of 'parent', with the
|
// purpose : Constructs a GenerationGUI_RevolDlg which is a child of 'parent', with the
|
||||||
@ -56,125 +41,34 @@ using namespace std;
|
|||||||
// TRUE to construct a modal dialog.
|
// TRUE to construct a modal dialog.
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
GenerationGUI_RevolDlg::GenerationGUI_RevolDlg(QWidget* parent, const char* name, GenerationGUI* theGenerationGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
|
GenerationGUI_RevolDlg::GenerationGUI_RevolDlg(QWidget* parent, const char* name, GenerationGUI* theGenerationGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
|
||||||
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
|
:GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
|
||||||
{
|
{
|
||||||
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_REVOL")));
|
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_REVOL")));
|
||||||
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
|
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
|
||||||
|
|
||||||
if ( !name )
|
setCaption(tr("GEOM_REVOLUTION_TITLE"));
|
||||||
setName( "GenerationGUI_RevolDlg" );
|
|
||||||
resize( 303, 251 );
|
|
||||||
setCaption( tr( "GEOM_REVOLUTION_TITLE" ) );
|
|
||||||
setSizeGripEnabled( TRUE );
|
|
||||||
GenerationGUI_RevolDlgLayout = new QGridLayout( this );
|
|
||||||
GenerationGUI_RevolDlgLayout->setSpacing( 6 );
|
|
||||||
GenerationGUI_RevolDlgLayout->setMargin( 11 );
|
|
||||||
|
|
||||||
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
|
/***************************************************************/
|
||||||
GroupConstructors->setTitle( tr( "GEOM_REVOLUTION" ) );
|
GroupConstructors->setTitle(tr("GEOM_REVOLUTION"));
|
||||||
GroupConstructors->setExclusive( TRUE );
|
RadioButton1->setPixmap(image0);
|
||||||
GroupConstructors->setColumnLayout(0, Qt::Vertical );
|
RadioButton2->close(TRUE);
|
||||||
GroupConstructors->layout()->setSpacing( 0 );
|
RadioButton3->close(TRUE);
|
||||||
GroupConstructors->layout()->setMargin( 0 );
|
|
||||||
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
|
|
||||||
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
|
|
||||||
GroupConstructorsLayout->setSpacing( 6 );
|
|
||||||
GroupConstructorsLayout->setMargin( 11 );
|
|
||||||
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
|
|
||||||
Constructor1->setText( tr( "" ) );
|
|
||||||
Constructor1->setPixmap( image0 );
|
|
||||||
Constructor1->setChecked( TRUE );
|
|
||||||
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
|
|
||||||
Constructor1->setMinimumSize( QSize( 50, 0 ) );
|
|
||||||
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
|
|
||||||
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
|
|
||||||
GroupConstructorsLayout->addItem( spacer, 0, 1 );
|
|
||||||
GenerationGUI_RevolDlgLayout->addWidget( GroupConstructors, 0, 0 );
|
|
||||||
|
|
||||||
/***************************************************************/
|
GroupPoints = new DlgRef_2Sel1Spin1Check(this, "GroupPoints");
|
||||||
GroupButtons = new QGroupBox( this, "GroupButtons" );
|
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
|
||||||
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
|
GroupPoints->TextLabel1->setText(tr("GEOM_OBJECT"));
|
||||||
GroupButtons->setTitle( tr( "" ) );
|
GroupPoints->TextLabel2->setText(tr("GEOM_AXIS"));
|
||||||
GroupButtons->setColumnLayout(0, Qt::Vertical );
|
GroupPoints->TextLabel3->setText(tr("GEOM_ANGLE"));
|
||||||
GroupButtons->layout()->setSpacing( 0 );
|
GroupPoints->CheckButton1->setText(tr("GEOM_REVERSE"));
|
||||||
GroupButtons->layout()->setMargin( 0 );
|
GroupPoints->PushButton1->setPixmap(image1);
|
||||||
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
|
GroupPoints->PushButton2->setPixmap(image1);
|
||||||
GroupButtonsLayout->setAlignment( Qt::AlignTop );
|
|
||||||
GroupButtonsLayout->setSpacing( 6 );
|
|
||||||
GroupButtonsLayout->setMargin( 11 );
|
|
||||||
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
|
|
||||||
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
|
|
||||||
buttonCancel->setAutoDefault( TRUE );
|
|
||||||
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
|
|
||||||
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
|
|
||||||
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
|
|
||||||
buttonApply->setAutoDefault( TRUE );
|
|
||||||
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
|
|
||||||
QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
|
|
||||||
GroupButtonsLayout->addItem( spacer_9, 0, 2 );
|
|
||||||
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
|
|
||||||
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
|
|
||||||
buttonOk->setAutoDefault( TRUE );
|
|
||||||
buttonOk->setDefault( TRUE );
|
|
||||||
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
|
|
||||||
GenerationGUI_RevolDlgLayout->addWidget( GroupButtons, 2, 0 );
|
|
||||||
|
|
||||||
/***************************************************************/
|
|
||||||
GroupC1 = new QGroupBox( this, "GroupC1" );
|
|
||||||
GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) );
|
|
||||||
GroupC1->setFrameShape( QGroupBox::Box );
|
|
||||||
GroupC1->setFrameShadow( QGroupBox::Sunken );
|
|
||||||
GroupC1->setColumnLayout(0, Qt::Vertical );
|
|
||||||
GroupC1->layout()->setSpacing( 0 );
|
|
||||||
GroupC1->layout()->setMargin( 0 );
|
|
||||||
GroupC1Layout = new QGridLayout( GroupC1->layout() );
|
|
||||||
GroupC1Layout->setAlignment( Qt::AlignTop );
|
|
||||||
GroupC1Layout->setSpacing( 6 );
|
|
||||||
GroupC1Layout->setMargin( 11 );
|
|
||||||
|
|
||||||
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
|
Layout1->addWidget(GroupPoints, 1, 0);
|
||||||
TextLabelC1A1->setText( tr( "GEOM_OBJECT" ) );
|
/***************************************************************/
|
||||||
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
|
|
||||||
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
|
|
||||||
TextLabelC1A1->setFrameShadow( QLabel::Plain );
|
|
||||||
GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
|
|
||||||
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
|
|
||||||
SelectButtonC1A1->setText( tr( "" ) );
|
|
||||||
SelectButtonC1A1->setPixmap( image1 );
|
|
||||||
SelectButtonC1A1->setToggleButton( FALSE );
|
|
||||||
SelectButtonC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0,
|
|
||||||
SelectButtonC1A1->sizePolicy().hasHeightForWidth() ) );
|
|
||||||
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
|
|
||||||
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
|
|
||||||
GroupC1Layout->addMultiCellWidget( LineEditC1A1, 0, 0, 2, 3 );
|
|
||||||
|
|
||||||
TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
|
/* Initialisations */
|
||||||
TextLabelC1A2->setText( tr( "GEOM_AXIS" ) );
|
myGenerationGUI = theGenerationGUI;
|
||||||
TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
|
Init();
|
||||||
GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
|
|
||||||
SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" );
|
|
||||||
SelectButtonC1A2->setText( tr( "" ) );
|
|
||||||
SelectButtonC1A2->setPixmap( image1 );
|
|
||||||
SelectButtonC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0,
|
|
||||||
SelectButtonC1A2->sizePolicy().hasHeightForWidth() ) );
|
|
||||||
GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 );
|
|
||||||
LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
|
|
||||||
GroupC1Layout->addMultiCellWidget( LineEditC1A2, 1, 1, 2, 3 );
|
|
||||||
|
|
||||||
CheckBoxReverse = new QCheckBox( GroupC1, "CheckBoxReverse" );
|
|
||||||
CheckBoxReverse->setText( tr( "GEOM_REVERSE" ) );
|
|
||||||
GroupC1Layout->addMultiCellWidget( CheckBoxReverse, 2, 2, 0, 1 );
|
|
||||||
TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" );
|
|
||||||
TextLabelC1A3->setText( tr( "GEOM_ANGLE" ) );
|
|
||||||
TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) );
|
|
||||||
GroupC1Layout->addWidget( TextLabelC1A3, 2, 2 );
|
|
||||||
SpinBox_C1A3 = new DlgRef_SpinBox( GroupC1, "GeomSpinBox_C1A3" ) ;
|
|
||||||
GroupC1Layout->addWidget( SpinBox_C1A3, 2, 3 );
|
|
||||||
|
|
||||||
GenerationGUI_RevolDlgLayout->addWidget( GroupC1, 1, 0 );
|
|
||||||
/***************************************************************/
|
|
||||||
myGenerationGUI = theGenerationGUI;
|
|
||||||
Init(Sel) ; /* Initialisations */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -184,7 +78,7 @@ GenerationGUI_RevolDlg::GenerationGUI_RevolDlg(QWidget* parent, const char* name
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
GenerationGUI_RevolDlg::~GenerationGUI_RevolDlg()
|
GenerationGUI_RevolDlg::~GenerationGUI_RevolDlg()
|
||||||
{
|
{
|
||||||
// no need to delete child widgets, Qt does it all for us
|
// no need to delete child widgets, Qt does it all for us
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -192,96 +86,46 @@ GenerationGUI_RevolDlg::~GenerationGUI_RevolDlg()
|
|||||||
// function : Init()
|
// function : Init()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void GenerationGUI_RevolDlg::Init( SALOME_Selection* Sel )
|
void GenerationGUI_RevolDlg::Init()
|
||||||
{
|
{
|
||||||
|
/* init variables */
|
||||||
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
|
|
||||||
|
myAngle = 45.0;
|
||||||
|
myOkBase = myOkAxis = false;
|
||||||
|
|
||||||
|
myEdgeFilter = new GEOM_ShapeTypeFilter(TopAbs_EDGE, myGeom);
|
||||||
|
|
||||||
/* Get setting of step value from file configuration */
|
/* Get setting of step value from file configuration */
|
||||||
double step ;
|
QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep");
|
||||||
QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ;
|
step = St.toDouble();
|
||||||
step = St.toDouble() ;
|
|
||||||
|
|
||||||
/* min, max, step and decimals for spin boxes */
|
/* min, max, step and decimals for spin boxes & initial values */
|
||||||
SpinBox_C1A3->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ;
|
GroupPoints->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3);
|
||||||
SpinBox_C1A3->SetValue( 45.0 ) ; /* = myAngle */
|
GroupPoints->SpinBox_DX->SetValue(myAngle);
|
||||||
myAngle = 45.0 ;
|
|
||||||
|
|
||||||
GroupC1->show();
|
|
||||||
myConstructorId = 0 ;
|
|
||||||
Constructor1->setChecked( TRUE );
|
|
||||||
myEditCurrentArgument = LineEditC1A1 ;
|
|
||||||
mySelection = Sel;
|
|
||||||
myGeomGUI = GEOMBase_Context::GetGeomGUI() ;
|
|
||||||
|
|
||||||
myOkBase = false ;
|
|
||||||
myOkAxis = false ;
|
|
||||||
|
|
||||||
mySimulationTopoDs.Nullify() ;
|
|
||||||
myBase.Nullify() ;
|
|
||||||
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
|
|
||||||
|
|
||||||
// TODO : previous selection into argument
|
|
||||||
|
|
||||||
/* Filter definitions */
|
|
||||||
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
|
|
||||||
myGeom = GEOM::GEOM_Gen::_narrow(comp);
|
|
||||||
myEdgeFilter = new GEOM_EdgeFilter( StdSelect_Line, myGeom );
|
|
||||||
|
|
||||||
/* signals and slots connections */
|
/* signals and slots connections */
|
||||||
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
|
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||||
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
|
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||||
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
|
|
||||||
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
|
|
||||||
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
|
|
||||||
connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
|
|
||||||
|
|
||||||
connect( SpinBox_C1A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
|
|
||||||
connect( CheckBoxReverse, SIGNAL (stateChanged(int) ), this, SLOT( ReverseAngle(int) ) ) ;
|
|
||||||
|
|
||||||
connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
|
|
||||||
connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
|
|
||||||
|
|
||||||
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
|
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||||
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||||
/* to close dialog if study change */
|
|
||||||
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
|
|
||||||
|
|
||||||
/* Move widget on the botton right corner of main widget */
|
|
||||||
int x, y ;
|
|
||||||
myGeomGUI->DefineDlgPosition( this, x, y ) ;
|
|
||||||
this->move( x, y ) ;
|
|
||||||
this->show() ; /* displays Dialog */
|
|
||||||
|
|
||||||
return ;
|
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||||
|
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||||
|
|
||||||
|
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||||
|
connect(GroupPoints->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(ReverseVector(int)));
|
||||||
|
|
||||||
|
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
|
||||||
|
|
||||||
|
/* displays Dialog */
|
||||||
|
GroupPoints->show();
|
||||||
|
this->show();
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : ReverseAngle()
|
|
||||||
// purpose : 'state' not used here
|
|
||||||
//=================================================================================
|
|
||||||
void GenerationGUI_RevolDlg::ReverseAngle(int state)
|
|
||||||
{
|
|
||||||
myAngle = -myAngle ;
|
|
||||||
SpinBox_C1A3->SetValue( myAngle ) ;
|
|
||||||
|
|
||||||
if(myOkBase && myOkAxis) {
|
|
||||||
MakeRevolutionSimulationAndDisplay(myBase) ;
|
|
||||||
} else {
|
|
||||||
myGeomGUI->EraseSimulationShape() ;
|
|
||||||
mySimulationTopoDs.Nullify() ;
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : ConstructorsClicked()
|
|
||||||
// purpose : Radio button management
|
|
||||||
//=================================================================================
|
|
||||||
void GenerationGUI_RevolDlg::ConstructorsClicked(int constructorId)
|
|
||||||
{
|
|
||||||
/* only a constructor now */
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnOk()
|
// function : ClickOnOk()
|
||||||
@ -289,49 +133,27 @@ void GenerationGUI_RevolDlg::ConstructorsClicked(int constructorId)
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void GenerationGUI_RevolDlg::ClickOnOk()
|
void GenerationGUI_RevolDlg::ClickOnOk()
|
||||||
{
|
{
|
||||||
this->ClickOnApply() ;
|
this->ClickOnApply();
|
||||||
this->ClickOnCancel() ;
|
ClickOnCancel();
|
||||||
|
return;
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnApply()
|
// function : ClickOnApply()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void GenerationGUI_RevolDlg::ClickOnApply()
|
void GenerationGUI_RevolDlg::ClickOnApply()
|
||||||
{
|
{
|
||||||
myGeomGUI->EraseSimulationShape() ;
|
myGeomGUI->GetDesktop()->putInfo(tr(""));
|
||||||
mySimulationTopoDs.Nullify() ;
|
if (mySimulationTopoDs.IsNull())
|
||||||
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
|
return;
|
||||||
|
myGeomGUI->EraseSimulationShape();
|
||||||
|
mySimulationTopoDs.Nullify();
|
||||||
|
|
||||||
switch(myConstructorId)
|
if(myOkBase && myOkAxis)
|
||||||
{
|
myGenerationGUI->MakeRevolutionAndDisplay(myGeomShape, myLoc, myDir, myAngle*PI180);
|
||||||
case 0 :
|
return;
|
||||||
{
|
|
||||||
if(myOkBase && myOkAxis) {
|
|
||||||
myGenerationGUI->MakeRevolutionAndDisplay( myGeomShape, myLoc, myDir, myAngle*PI180 ) ;
|
|
||||||
}
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : ClickOnCancel()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void GenerationGUI_RevolDlg::ClickOnCancel()
|
|
||||||
{
|
|
||||||
mySelection->ClearFilters() ;
|
|
||||||
myGeomGUI->EraseSimulationShape() ;
|
|
||||||
mySimulationTopoDs.Nullify() ;
|
|
||||||
disconnect( mySelection, 0, this, 0 );
|
|
||||||
myGeomGUI->ResetState() ;
|
|
||||||
reject() ;
|
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -341,58 +163,49 @@ void GenerationGUI_RevolDlg::ClickOnCancel()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void GenerationGUI_RevolDlg::SelectionIntoArgument()
|
void GenerationGUI_RevolDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
myGeomGUI->EraseSimulationShape() ;
|
myGeomGUI->EraseSimulationShape();
|
||||||
mySimulationTopoDs.Nullify() ;
|
mySimulationTopoDs.Nullify();
|
||||||
|
myEditCurrentArgument->setText("");
|
||||||
QString aString = ""; /* name of selection */
|
QString aString = ""; /* name of selection */
|
||||||
|
|
||||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
|
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
|
||||||
if ( nbSel != 1 ) {
|
if(nbSel != 1) {
|
||||||
if ( myEditCurrentArgument == LineEditC1A1 ) {
|
if(myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||||
LineEditC1A1->setText("") ;
|
myOkBase = false;
|
||||||
myOkBase = false ;
|
else if(myEditCurrentArgument == GroupPoints->LineEdit2)
|
||||||
}
|
myOkAxis = false;
|
||||||
else if ( myEditCurrentArgument == LineEditC1A2 ) {
|
return;
|
||||||
LineEditC1A2->setText("") ;
|
|
||||||
myOkAxis = false ;
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* nbSel == 1 ! */
|
// nbSel == 1
|
||||||
TopoDS_Shape S;
|
TopoDS_Shape S;
|
||||||
Standard_Boolean testResult ;
|
Standard_Boolean testResult;
|
||||||
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
|
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
|
||||||
|
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
|
||||||
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
|
return;
|
||||||
return ;
|
|
||||||
|
|
||||||
if ( myEditCurrentArgument == LineEditC1A1 ) {
|
|
||||||
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
|
|
||||||
if( !testResult )
|
|
||||||
return ;
|
|
||||||
|
|
||||||
/* test if appropriate shape for revol */
|
if(myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||||
TopAbs_ShapeEnum aType = S.ShapeType() ;
|
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
|
||||||
if(aType != TopAbs_VERTEX && aType != TopAbs_EDGE && aType != TopAbs_WIRE && aType != TopAbs_FACE && aType != TopAbs_SHELL && aType != TopAbs_COMPOUND )
|
if(!testResult)
|
||||||
return ;
|
return;
|
||||||
|
TopAbs_ShapeEnum aType = S.ShapeType();
|
||||||
LineEditC1A1->setText(aString) ;
|
if(aType != TopAbs_VERTEX && aType != TopAbs_EDGE && aType != TopAbs_WIRE && aType != TopAbs_FACE && aType != TopAbs_SHELL && aType != TopAbs_COMPOUND)
|
||||||
myBase = S ;
|
return;
|
||||||
myOkBase = true ;
|
myEditCurrentArgument->setText(aString);
|
||||||
}
|
myOkBase = true;
|
||||||
else if ( myEditCurrentArgument == LineEditC1A2 /*&& myGeomGUI->LinearLocationAndDirection(S, myLoc, myDir) */) {
|
myBase = S;
|
||||||
|
}
|
||||||
|
else if(myEditCurrentArgument == GroupPoints->LineEdit2) {
|
||||||
BRepAdaptor_Curve curv(TopoDS::Edge(S));
|
BRepAdaptor_Curve curv(TopoDS::Edge(S));
|
||||||
myDir = curv.Line().Direction();
|
myDir = curv.Line().Direction();
|
||||||
myLoc = curv.Line().Location();
|
myLoc = curv.Line().Location();
|
||||||
LineEditC1A2->setText(aString) ;
|
myEditCurrentArgument->setText(aString);
|
||||||
myOkAxis = true ;
|
myOkAxis = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( myOkBase && myOkAxis ) {
|
if(myOkBase && myOkAxis)
|
||||||
MakeRevolutionSimulationAndDisplay( myBase) ;
|
this->MakeRevolutionSimulationAndDisplay();
|
||||||
}
|
return;
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -403,86 +216,39 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument()
|
|||||||
void GenerationGUI_RevolDlg::SetEditCurrentArgument()
|
void GenerationGUI_RevolDlg::SetEditCurrentArgument()
|
||||||
{
|
{
|
||||||
QPushButton* send = (QPushButton*)sender();
|
QPushButton* send = (QPushButton*)sender();
|
||||||
switch (myConstructorId)
|
mySelection->ClearFilters();
|
||||||
{
|
|
||||||
case 0: /* default constructor */
|
if(send == GroupPoints->PushButton1) {
|
||||||
{
|
GroupPoints->LineEdit1->setFocus();
|
||||||
if(send == SelectButtonC1A1) {
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
LineEditC1A1->setFocus() ;
|
}
|
||||||
myEditCurrentArgument = LineEditC1A1;
|
else if(send == GroupPoints->PushButton2) {
|
||||||
mySelection->ClearFilters() ;
|
GroupPoints->LineEdit2->setFocus();
|
||||||
}
|
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||||
else if(send == SelectButtonC1A2) {
|
mySelection->AddFilter(myEdgeFilter);
|
||||||
LineEditC1A2->setFocus() ;
|
}
|
||||||
myEditCurrentArgument = LineEditC1A2;
|
this->SelectionIntoArgument();
|
||||||
mySelection->AddFilter(myEdgeFilter) ;
|
|
||||||
}
|
return;
|
||||||
SelectionIntoArgument() ;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : LineEditReturnPressed()
|
// function : LineEditReturnPressed()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void GenerationGUI_RevolDlg::LineEditReturnPressed()
|
void GenerationGUI_RevolDlg::LineEditReturnPressed()
|
||||||
{
|
{
|
||||||
QLineEdit* send = (QLineEdit*)sender();
|
QLineEdit* send = (QLineEdit*)sender();
|
||||||
if( send == LineEditC1A1 )
|
if(send == GroupPoints->LineEdit1)
|
||||||
myEditCurrentArgument = LineEditC1A1 ;
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
else if ( send == LineEditC1A2 )
|
else if (send == GroupPoints->LineEdit2)
|
||||||
myEditCurrentArgument = LineEditC1A2 ;
|
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||||
else
|
else
|
||||||
return ;
|
return;
|
||||||
|
|
||||||
/* User name of object input management */
|
|
||||||
/* If successfull the selection is changed and signal emitted... */
|
|
||||||
/* so SelectionIntoArgument() is automatically called. */
|
|
||||||
const QString objectUserName = myEditCurrentArgument->text() ;
|
|
||||||
QWidget* thisWidget = (QWidget*)this ;
|
|
||||||
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
|
|
||||||
myEditCurrentArgument->setText( objectUserName ) ;
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||||
//=================================================================================
|
return;
|
||||||
// function : ValueChangedInSpinBox()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void GenerationGUI_RevolDlg::ValueChangedInSpinBox( double newValue )
|
|
||||||
{
|
|
||||||
myAngle = newValue ;
|
|
||||||
if ( myOkBase && myOkAxis ) {
|
|
||||||
MakeRevolutionSimulationAndDisplay(myBase) ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
myGeomGUI->EraseSimulationShape() ;
|
|
||||||
mySimulationTopoDs.Nullify() ;
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : DeactivateActiveDialog()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void GenerationGUI_RevolDlg::DeactivateActiveDialog()
|
|
||||||
{
|
|
||||||
if ( GroupConstructors->isEnabled() ) {
|
|
||||||
GroupConstructors->setEnabled(false) ;
|
|
||||||
GroupC1->setEnabled(false) ;
|
|
||||||
GroupButtons->setEnabled(false) ;
|
|
||||||
disconnect( mySelection, 0, this, 0 );
|
|
||||||
myGeomGUI->EraseSimulationShape() ;
|
|
||||||
mySelection->ClearFilters() ;
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -492,39 +258,51 @@ void GenerationGUI_RevolDlg::DeactivateActiveDialog()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void GenerationGUI_RevolDlg::ActivateThisDialog()
|
void GenerationGUI_RevolDlg::ActivateThisDialog()
|
||||||
{
|
{
|
||||||
/* Emit a signal to deactivate the active dialog */
|
GEOMBase_Skeleton::ActivateThisDialog();
|
||||||
myGeomGUI->EmitSignalDeactivateDialog() ;
|
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||||
GroupConstructors->setEnabled(true) ;
|
if(!mySimulationTopoDs.IsNull())
|
||||||
GroupC1->setEnabled(true) ;
|
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||||
GroupButtons->setEnabled(true) ;
|
return;
|
||||||
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
|
||||||
if( !mySimulationTopoDs.IsNull() )
|
|
||||||
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
|
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : enterEvent()
|
// function : enterEvent()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void GenerationGUI_RevolDlg::enterEvent(QEvent* e)
|
void GenerationGUI_RevolDlg::enterEvent(QEvent* e)
|
||||||
{
|
{
|
||||||
if ( GroupConstructors->isEnabled() )
|
if (GroupConstructors->isEnabled())
|
||||||
return ;
|
return;
|
||||||
ActivateThisDialog() ;
|
this->ActivateThisDialog();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : closeEvent()
|
// function : ValueChangedInSpinBox()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void GenerationGUI_RevolDlg::closeEvent( QCloseEvent* e )
|
void GenerationGUI_RevolDlg::ValueChangedInSpinBox(double newValue)
|
||||||
|
{
|
||||||
|
myAngle = newValue;
|
||||||
|
if(myOkBase && myOkAxis)
|
||||||
|
this->MakeRevolutionSimulationAndDisplay();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : ReverseAngle()
|
||||||
|
// purpose : 'state' not used here
|
||||||
|
//=================================================================================
|
||||||
|
void GenerationGUI_RevolDlg::ReverseAngle(int state)
|
||||||
{
|
{
|
||||||
this->ClickOnCancel() ; /* same than click on cancel button */
|
myAngle = -myAngle;
|
||||||
|
GroupPoints->SpinBox_DX->SetValue(myAngle);
|
||||||
|
if(myOkBase && myOkAxis)
|
||||||
|
this->MakeRevolutionSimulationAndDisplay();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -532,25 +310,23 @@ void GenerationGUI_RevolDlg::closeEvent( QCloseEvent* e )
|
|||||||
// function : MakeRevolutionSimulationAndDisplay()
|
// function : MakeRevolutionSimulationAndDisplay()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void GenerationGUI_RevolDlg::MakeRevolutionSimulationAndDisplay( const TopoDS_Shape& S)
|
void GenerationGUI_RevolDlg::MakeRevolutionSimulationAndDisplay()
|
||||||
{
|
{
|
||||||
myGeomGUI->EraseSimulationShape() ;
|
myGeomGUI->EraseSimulationShape();
|
||||||
mySimulationTopoDs.Nullify() ;
|
mySimulationTopoDs.Nullify();
|
||||||
|
|
||||||
if( S.IsNull() )
|
TopAbs_ShapeEnum aType = myBase.ShapeType();
|
||||||
return ;
|
if(aType != TopAbs_VERTEX && aType != TopAbs_EDGE && aType != TopAbs_WIRE && aType != TopAbs_FACE && aType != TopAbs_SHELL && aType !=TopAbs_COMPOUND)
|
||||||
|
return;
|
||||||
TopAbs_ShapeEnum aType = S.ShapeType() ;
|
|
||||||
if(aType != TopAbs_VERTEX && aType != TopAbs_EDGE && aType != TopAbs_WIRE && aType != TopAbs_FACE && aType != TopAbs_SHELL && aType !=TopAbs_COMPOUND )
|
|
||||||
return ;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
gp_Ax1 AX( this->myLoc, this->myDir);
|
gp_Ax1 AX(myLoc, myDir);
|
||||||
mySimulationTopoDs = BRepPrimAPI_MakeRevol(S, AX, this->myAngle*PI180 );
|
mySimulationTopoDs = BRepPrimAPI_MakeRevol(myBase, AX, myAngle*PI180);
|
||||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs) ;
|
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||||
}
|
}
|
||||||
catch(Standard_Failure) {
|
catch(Standard_Failure) {
|
||||||
MESSAGE( "Exception catched in MakeRevolutionSimulationAndDisplay" ) ;
|
MESSAGE("Exception catched in MakeRevolutionSimulationAndDisplay");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return ;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -29,35 +29,18 @@
|
|||||||
#ifndef DIALOGBOX_REVOLUTION_H
|
#ifndef DIALOGBOX_REVOLUTION_H
|
||||||
#define DIALOGBOX_REVOLUTION_H
|
#define DIALOGBOX_REVOLUTION_H
|
||||||
|
|
||||||
|
#include "GEOMBase_Skeleton.h"
|
||||||
|
#include "DlgRef_2Sel1Spin1Check.h"
|
||||||
|
|
||||||
#include "GenerationGUI.h"
|
#include "GenerationGUI.h"
|
||||||
#include "DlgRef_SpinBox.h"
|
|
||||||
#include "GEOM_EdgeFilter.hxx"
|
|
||||||
|
|
||||||
#include <gp_Pnt.hxx>
|
|
||||||
#include <gp_Dir.hxx>
|
#include <gp_Dir.hxx>
|
||||||
#include <BRepPrimAPI_MakeRevol.hxx>
|
|
||||||
|
|
||||||
#include <qvariant.h>
|
|
||||||
#include <qdialog.h>
|
|
||||||
#include <qvalidator.h>
|
|
||||||
|
|
||||||
class QVBoxLayout;
|
|
||||||
class QHBoxLayout;
|
|
||||||
class QGridLayout;
|
|
||||||
class QButtonGroup;
|
|
||||||
class QCheckBox;
|
|
||||||
class QGroupBox;
|
|
||||||
class QLabel;
|
|
||||||
class QLineEdit;
|
|
||||||
class QPushButton;
|
|
||||||
class QRadioButton;
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : GenerationGUI_RevolDlg
|
// class : GenerationGUI_RevolDlg
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
class GenerationGUI_RevolDlg : public QDialog
|
class GenerationGUI_RevolDlg : public GEOMBase_Skeleton
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -66,66 +49,35 @@ public:
|
|||||||
~GenerationGUI_RevolDlg();
|
~GenerationGUI_RevolDlg();
|
||||||
|
|
||||||
private :
|
private :
|
||||||
|
void Init();
|
||||||
|
void enterEvent(QEvent* e);
|
||||||
|
void MakeRevolutionSimulationAndDisplay();
|
||||||
|
|
||||||
GenerationGUI* myGenerationGUI;
|
GenerationGUI* myGenerationGUI;
|
||||||
GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */
|
|
||||||
GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */
|
|
||||||
SALOME_Selection* mySelection ; /* User shape selection */
|
|
||||||
TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */
|
|
||||||
TopoDS_Shape myBase ;
|
|
||||||
GEOM::GEOM_Shape_var myGeomShape ; /* is myBase */
|
|
||||||
|
|
||||||
gp_Pnt myLoc ;
|
double step;
|
||||||
gp_Dir myDir ;
|
Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* Filters selection */
|
||||||
|
|
||||||
Standard_Real myAngle ;
|
TopoDS_Shape myBase;
|
||||||
|
GEOM::GEOM_Shape_var myGeomShape; /* is myBase */
|
||||||
|
gp_Pnt myLoc;
|
||||||
|
gp_Dir myDir;
|
||||||
|
Standard_Real myAngle;
|
||||||
|
bool myOkBase;
|
||||||
|
bool myOkAxis;
|
||||||
|
|
||||||
bool myOkBase ;
|
DlgRef_2Sel1Spin1Check* GroupPoints;
|
||||||
bool myOkAxis ;
|
|
||||||
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
|
|
||||||
int myConstructorId ; /* Current constructor id = radio button id */
|
|
||||||
Handle(GEOM_EdgeFilter) myEdgeFilter; /* Filter selection */
|
|
||||||
|
|
||||||
void closeEvent( QCloseEvent* e ) ;
|
|
||||||
void enterEvent( QEvent* e);
|
|
||||||
void Init( SALOME_Selection* Sel ) ;
|
|
||||||
void MakeRevolutionSimulationAndDisplay( const TopoDS_Shape& S) ;
|
|
||||||
|
|
||||||
QButtonGroup* GroupConstructors;
|
|
||||||
QRadioButton* Constructor1;
|
|
||||||
QGroupBox* GroupButtons;
|
|
||||||
QPushButton* buttonOk;
|
|
||||||
QPushButton* buttonCancel;
|
|
||||||
QPushButton* buttonApply;
|
|
||||||
QGroupBox* GroupC1;
|
|
||||||
QPushButton* SelectButtonC1A2;
|
|
||||||
QLineEdit* LineEditC1A1;
|
|
||||||
QLineEdit* LineEditC1A2;
|
|
||||||
QPushButton* SelectButtonC1A1;
|
|
||||||
QLabel* TextLabelC1A1;
|
|
||||||
QLabel* TextLabelC1A2;
|
|
||||||
DlgRef_SpinBox* SpinBox_C1A3 ; /* for angle */
|
|
||||||
QLabel* TextLabelC1A3;
|
|
||||||
QCheckBox* CheckBoxReverse;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void ConstructorsClicked(int constructorId);
|
|
||||||
void ClickOnOk();
|
void ClickOnOk();
|
||||||
void ClickOnCancel();
|
|
||||||
void ClickOnApply();
|
void ClickOnApply();
|
||||||
void SetEditCurrentArgument() ;
|
void ActivateThisDialog();
|
||||||
void SelectionIntoArgument() ;
|
void LineEditReturnPressed();
|
||||||
void LineEditReturnPressed() ;
|
void SelectionIntoArgument();
|
||||||
void DeactivateActiveDialog() ;
|
void SetEditCurrentArgument();
|
||||||
void ActivateThisDialog() ;
|
void ReverseAngle(int state);
|
||||||
void ReverseAngle(int state) ;
|
void ValueChangedInSpinBox(double newValue);
|
||||||
void ValueChangedInSpinBox( double newValue ) ;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
QGridLayout* GenerationGUI_RevolDlgLayout;
|
|
||||||
QGridLayout* GroupConstructorsLayout;
|
|
||||||
QGridLayout* GroupButtonsLayout;
|
|
||||||
QGridLayout* GroupC1Layout;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOGBOX_REVOLUTION_H
|
#endif // DIALOGBOX_REVOLUTION_H
|
||||||
|
@ -38,6 +38,8 @@ using namespace std;
|
|||||||
#include "MeasureGUI_WhatisDlg.h" // Method WHATIS
|
#include "MeasureGUI_WhatisDlg.h" // Method WHATIS
|
||||||
#include "MeasureGUI_CheckShape.h" // Method CHECKSHAPE
|
#include "MeasureGUI_CheckShape.h" // Method CHECKSHAPE
|
||||||
|
|
||||||
|
static MeasureGUI* myMeasureGUI = 0;
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : MeasureGUI()
|
// function : MeasureGUI()
|
||||||
// purpose : Constructor
|
// purpose : Constructor
|
||||||
@ -60,14 +62,27 @@ MeasureGUI::~MeasureGUI()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// function : GetOrCreateGUI()
|
||||||
|
// purpose : Gets or create an object 'GUI' with initialisations
|
||||||
|
// : Returns 'GUI' as a pointer
|
||||||
|
//=======================================================================
|
||||||
|
MeasureGUI* MeasureGUI::GetOrCreateGUI()
|
||||||
|
{
|
||||||
|
myMeasureGUI = new MeasureGUI();
|
||||||
|
return myMeasureGUI;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : OnGUIEvent()
|
// function : OnGUIEvent()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool MeasureGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
bool MeasureGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
||||||
{
|
{
|
||||||
myGeomGUI->EmitSignalDeactivateDialog();
|
MeasureGUI::GetOrCreateGUI();
|
||||||
SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection());
|
myMeasureGUI->myGeomGUI->EmitSignalDeactivateDialog();
|
||||||
|
SALOME_Selection* Sel = SALOME_Selection::Selection(myMeasureGUI->myGeomGUI->GetActiveStudy()->getSelection());
|
||||||
|
|
||||||
switch (theCommandID)
|
switch (theCommandID)
|
||||||
{
|
{
|
||||||
@ -78,7 +93,7 @@ bool MeasureGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
|||||||
}
|
}
|
||||||
case 702: // CDG : Center of mass
|
case 702: // CDG : Center of mass
|
||||||
{
|
{
|
||||||
MeasureGUI_CenterMassDlg *aDlg = new MeasureGUI_CenterMassDlg(parent, "", this, Sel);
|
MeasureGUI_CenterMassDlg *aDlg = new MeasureGUI_CenterMassDlg(parent, "", myMeasureGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 703: // INERTIA
|
case 703: // INERTIA
|
||||||
@ -142,3 +157,13 @@ void MeasureGUI::MakeCDGAndDisplay(GEOM::GEOM_Shape_ptr Shape)
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=====================================================================================
|
||||||
|
// EXPORTED METHODS
|
||||||
|
//=====================================================================================
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
bool OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
||||||
|
{return MeasureGUI::OnGUIEvent(theCommandID, parent);}
|
||||||
|
}
|
||||||
|
@ -43,11 +43,11 @@ public :
|
|||||||
MeasureGUI();
|
MeasureGUI();
|
||||||
~MeasureGUI();
|
~MeasureGUI();
|
||||||
|
|
||||||
bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
|
static MeasureGUI* GetOrCreateGUI();
|
||||||
|
static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
|
||||||
|
|
||||||
void MakeCDGAndDisplay(GEOM::GEOM_Shape_ptr Shape);
|
void MakeCDGAndDisplay(GEOM::GEOM_Shape_ptr Shape);
|
||||||
|
|
||||||
private:
|
|
||||||
GEOMBase_Context* myGeomGUI;
|
GEOMBase_Context* myGeomGUI;
|
||||||
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
|
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
|
||||||
|
|
||||||
|
@ -40,6 +40,8 @@ using namespace std;
|
|||||||
#include "OperationGUI_FilletDlg.h" // Method FILLET
|
#include "OperationGUI_FilletDlg.h" // Method FILLET
|
||||||
#include "OperationGUI_ChamferDlg.h" // Method CHAMFER
|
#include "OperationGUI_ChamferDlg.h" // Method CHAMFER
|
||||||
|
|
||||||
|
static OperationGUI* myOperationGUI = 0;
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : OperationGUI()
|
// function : OperationGUI()
|
||||||
// purpose : Constructor
|
// purpose : Constructor
|
||||||
@ -62,45 +64,58 @@ OperationGUI::~OperationGUI()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// function : GetOrCreateGUI()
|
||||||
|
// purpose : Gets or create an object 'GUI' with initialisations
|
||||||
|
// : Returns 'GUI' as a pointer
|
||||||
|
//=======================================================================
|
||||||
|
OperationGUI* OperationGUI::GetOrCreateGUI()
|
||||||
|
{
|
||||||
|
myOperationGUI = new OperationGUI();
|
||||||
|
return myOperationGUI;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : OnGUIEvent()
|
// function : OnGUIEvent()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool OperationGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
bool OperationGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
||||||
{
|
{
|
||||||
myGeomGUI->EmitSignalDeactivateDialog();
|
OperationGUI::GetOrCreateGUI();
|
||||||
SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection());
|
myOperationGUI->myGeomGUI->EmitSignalDeactivateDialog();
|
||||||
|
SALOME_Selection* Sel = SALOME_Selection::Selection(myOperationGUI->myGeomGUI->GetActiveStudy()->getSelection());
|
||||||
|
|
||||||
switch (theCommandID)
|
switch (theCommandID)
|
||||||
{
|
{
|
||||||
case 503: // PARTITION
|
case 503: // PARTITION
|
||||||
{
|
{
|
||||||
OperationGUI_PartitionDlg *aDlg = new OperationGUI_PartitionDlg(parent, "", this, Sel);
|
OperationGUI_PartitionDlg *aDlg = new OperationGUI_PartitionDlg(parent, "", myOperationGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 504: // ARCHIMEDE
|
case 504: // ARCHIMEDE
|
||||||
{
|
{
|
||||||
OperationGUI_ArchimedeDlg *aDlg = new OperationGUI_ArchimedeDlg(parent, "", this, Sel);
|
OperationGUI_ArchimedeDlg *aDlg = new OperationGUI_ArchimedeDlg(parent, "", myOperationGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 505: // FILLET
|
case 505: // FILLET
|
||||||
{
|
{
|
||||||
Handle(AIS_InteractiveContext) ic;
|
Handle(AIS_InteractiveContext) ic;
|
||||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
|
if(myOperationGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
|
||||||
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myOperationGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
||||||
ic = v3d->getAISContext();
|
ic = v3d->getAISContext();
|
||||||
}
|
}
|
||||||
OperationGUI_FilletDlg *aDlg = new OperationGUI_FilletDlg(parent, "", this, Sel, ic);
|
OperationGUI_FilletDlg *aDlg = new OperationGUI_FilletDlg(parent, "", myOperationGUI, Sel, ic);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 506: // CHAMFER
|
case 506: // CHAMFER
|
||||||
{
|
{
|
||||||
Handle(AIS_InteractiveContext) ic;
|
Handle(AIS_InteractiveContext) ic;
|
||||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
|
if(myOperationGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
|
||||||
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myOperationGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
||||||
ic = v3d->getAISContext();
|
ic = v3d->getAISContext();
|
||||||
}
|
}
|
||||||
OperationGUI_ChamferDlg *aDlg = new OperationGUI_ChamferDlg(parent, "", this, Sel, ic);
|
OperationGUI_ChamferDlg *aDlg = new OperationGUI_ChamferDlg(parent, "", myOperationGUI, Sel, ic);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -437,3 +452,13 @@ bool OperationGUI::OnChamferGetSelected(const TopoDS_Shape& ShapeTopo, const cha
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=====================================================================================
|
||||||
|
// EXPORTED METHODS
|
||||||
|
//=====================================================================================
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
bool OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
||||||
|
{return OperationGUI::OnGUIEvent(theCommandID, parent);}
|
||||||
|
}
|
||||||
|
@ -43,7 +43,8 @@ public :
|
|||||||
OperationGUI();
|
OperationGUI();
|
||||||
~OperationGUI();
|
~OperationGUI();
|
||||||
|
|
||||||
bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
|
static OperationGUI* GetOrCreateGUI();
|
||||||
|
static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
|
||||||
|
|
||||||
void MakePartitionAndDisplay(const GEOM::GEOM_Gen::ListOfIOR& listShapesIOR,
|
void MakePartitionAndDisplay(const GEOM::GEOM_Gen::ListOfIOR& listShapesIOR,
|
||||||
const GEOM::GEOM_Gen::ListOfIOR& listToolsIOR,
|
const GEOM::GEOM_Gen::ListOfIOR& listToolsIOR,
|
||||||
@ -69,7 +70,6 @@ public :
|
|||||||
Standard_Integer& aLocalContextId,
|
Standard_Integer& aLocalContextId,
|
||||||
bool& myUseLocalContext);
|
bool& myUseLocalContext);
|
||||||
|
|
||||||
private:
|
|
||||||
GEOMBase_Context* myGeomGUI;
|
GEOMBase_Context* myGeomGUI;
|
||||||
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
|
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
|
||||||
|
|
||||||
|
@ -35,6 +35,8 @@ using namespace std;
|
|||||||
#include "PrimitiveGUI_TorusDlg.h" // Method TORUS
|
#include "PrimitiveGUI_TorusDlg.h" // Method TORUS
|
||||||
#include "PrimitiveGUI_ConeDlg.h" // Method CONE
|
#include "PrimitiveGUI_ConeDlg.h" // Method CONE
|
||||||
|
|
||||||
|
static PrimitiveGUI* myPrimitiveGUI = 0;
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : PrimitiveGUI()
|
// function : PrimitiveGUI()
|
||||||
// purpose : Constructor
|
// purpose : Constructor
|
||||||
@ -57,40 +59,53 @@ PrimitiveGUI::~PrimitiveGUI()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// function : GetOrCreateGUI()
|
||||||
|
// purpose : Gets or create an object 'GUI' with initialisations
|
||||||
|
// : Returns 'GUI' as a pointer
|
||||||
|
//=======================================================================
|
||||||
|
PrimitiveGUI* PrimitiveGUI::GetOrCreateGUI()
|
||||||
|
{
|
||||||
|
myPrimitiveGUI = new PrimitiveGUI();
|
||||||
|
return myPrimitiveGUI;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : OnGUIEvent()
|
// function : OnGUIEvent()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool PrimitiveGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
bool PrimitiveGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
||||||
{
|
{
|
||||||
myGeomGUI->EmitSignalDeactivateDialog();
|
PrimitiveGUI::GetOrCreateGUI();
|
||||||
SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection());
|
myPrimitiveGUI->myGeomGUI->EmitSignalDeactivateDialog();
|
||||||
|
SALOME_Selection* Sel = SALOME_Selection::Selection(myPrimitiveGUI->myGeomGUI->GetActiveStudy()->getSelection());
|
||||||
|
|
||||||
switch (theCommandID)
|
switch (theCommandID)
|
||||||
{
|
{
|
||||||
case 4021: // BOX
|
case 4021: // BOX
|
||||||
{
|
{
|
||||||
PrimitiveGUI_BoxDlg *aDlg = new PrimitiveGUI_BoxDlg(parent, "", this, Sel);
|
PrimitiveGUI_BoxDlg *aDlg = new PrimitiveGUI_BoxDlg(parent, "", myPrimitiveGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4022: // CYLINDER
|
case 4022: // CYLINDER
|
||||||
{
|
{
|
||||||
PrimitiveGUI_CylinderDlg *aDlg = new PrimitiveGUI_CylinderDlg(parent, "", this, Sel);
|
PrimitiveGUI_CylinderDlg *aDlg = new PrimitiveGUI_CylinderDlg(parent, "", myPrimitiveGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4023: // SPHERE
|
case 4023: // SPHERE
|
||||||
{
|
{
|
||||||
PrimitiveGUI_SphereDlg *aDlg = new PrimitiveGUI_SphereDlg(parent, "", this, Sel);
|
PrimitiveGUI_SphereDlg *aDlg = new PrimitiveGUI_SphereDlg(parent, "", myPrimitiveGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4024: // TORUS
|
case 4024: // TORUS
|
||||||
{
|
{
|
||||||
PrimitiveGUI_TorusDlg *aDlg = new PrimitiveGUI_TorusDlg(parent, "", this, Sel);
|
PrimitiveGUI_TorusDlg *aDlg = new PrimitiveGUI_TorusDlg(parent, "", myPrimitiveGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 4025: // CONE
|
case 4025: // CONE
|
||||||
{
|
{
|
||||||
PrimitiveGUI_ConeDlg *aDlg = new PrimitiveGUI_ConeDlg(parent, "", this, Sel);
|
PrimitiveGUI_ConeDlg *aDlg = new PrimitiveGUI_ConeDlg(parent, "", myPrimitiveGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -234,3 +249,13 @@ void PrimitiveGUI::MakeConeAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir,
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=====================================================================================
|
||||||
|
// EXPORTED METHODS
|
||||||
|
//=====================================================================================
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
bool OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
||||||
|
{return PrimitiveGUI::OnGUIEvent(theCommandID, parent);}
|
||||||
|
}
|
||||||
|
@ -44,7 +44,8 @@ public :
|
|||||||
PrimitiveGUI();
|
PrimitiveGUI();
|
||||||
~PrimitiveGUI();
|
~PrimitiveGUI();
|
||||||
|
|
||||||
bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
|
static PrimitiveGUI* GetOrCreateGUI();
|
||||||
|
static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
|
||||||
|
|
||||||
void MakeBoxAndDisplay(const gp_Pnt P1, const gp_Pnt P2);
|
void MakeBoxAndDisplay(const gp_Pnt P1, const gp_Pnt P2);
|
||||||
void MakeCylinderAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir,
|
void MakeCylinderAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir,
|
||||||
@ -55,7 +56,6 @@ public :
|
|||||||
void MakeConeAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir,
|
void MakeConeAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir,
|
||||||
const double Radius1, const double Radius2, const double aHeight);
|
const double Radius1, const double Radius2, const double aHeight);
|
||||||
|
|
||||||
private:
|
|
||||||
GEOMBase_Context* myGeomGUI;
|
GEOMBase_Context* myGeomGUI;
|
||||||
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
|
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ void PrimitiveGUI_BoxDlg::ConstructorsClicked(int constructorId)
|
|||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
GroupPoints->hide();
|
GroupPoints->hide();
|
||||||
resize( 0, 0 );
|
resize(0, 0);
|
||||||
GroupDimensions->show();
|
GroupDimensions->show();
|
||||||
|
|
||||||
double initValue = 200.0;
|
double initValue = 200.0;
|
||||||
@ -372,12 +372,21 @@ void PrimitiveGUI_BoxDlg::ValueChangedInSpinBox(double newValue)
|
|||||||
QObject* send = (QObject*)sender();
|
QObject* send = (QObject*)sender();
|
||||||
double vx, vy, vz;
|
double vx, vy, vz;
|
||||||
|
|
||||||
if(send == GroupDimensions->SpinBox_DX)
|
if(send == GroupDimensions->SpinBox_DX) {
|
||||||
vx = newValue;
|
vx = newValue;
|
||||||
else if(send == GroupDimensions->SpinBox_DY)
|
vy = GroupDimensions->SpinBox_DY->GetValue();
|
||||||
|
vz = GroupDimensions->SpinBox_DZ->GetValue();
|
||||||
|
}
|
||||||
|
else if(send == GroupDimensions->SpinBox_DY) {
|
||||||
|
vx = GroupDimensions->SpinBox_DX->GetValue();
|
||||||
vy = newValue;
|
vy = newValue;
|
||||||
else if(send == GroupDimensions->SpinBox_DZ)
|
vz = GroupDimensions->SpinBox_DZ->GetValue();
|
||||||
|
}
|
||||||
|
else if(send == GroupDimensions->SpinBox_DZ) {
|
||||||
|
vx = GroupDimensions->SpinBox_DX->GetValue();
|
||||||
|
vy = GroupDimensions->SpinBox_DY->GetValue();
|
||||||
vz = newValue;
|
vz = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
myPoint1.SetCoord(0.0, 0.0, 0.0);
|
myPoint1.SetCoord(0.0, 0.0, 0.0);
|
||||||
myPoint2.SetCoord(vx, vy, vz);
|
myPoint2.SetCoord(vx, vy, vz);
|
||||||
|
@ -313,6 +313,7 @@ void PrimitiveGUI_ConeDlg::SetEditCurrentArgument()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
QPushButton* send = (QPushButton*)sender();
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
mySelection->ClearFilters();
|
||||||
|
|
||||||
if(send == GroupPoints->PushButton1) {
|
if(send == GroupPoints->PushButton1) {
|
||||||
GroupPoints->LineEdit1->setFocus();
|
GroupPoints->LineEdit1->setFocus();
|
||||||
|
@ -300,6 +300,7 @@ void PrimitiveGUI_CylinderDlg::SetEditCurrentArgument()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
QPushButton* send = (QPushButton*)sender();
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
mySelection->ClearFilters();
|
||||||
|
|
||||||
if(send == GroupPoints->PushButton1) {
|
if(send == GroupPoints->PushButton1) {
|
||||||
GroupPoints->LineEdit1->setFocus();
|
GroupPoints->LineEdit1->setFocus();
|
||||||
|
@ -292,6 +292,7 @@ void PrimitiveGUI_TorusDlg::SetEditCurrentArgument()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
QPushButton* send = (QPushButton*)sender();
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
mySelection->ClearFilters();
|
||||||
|
|
||||||
if(send == GroupPoints->PushButton1) {
|
if(send == GroupPoints->PushButton1) {
|
||||||
GroupPoints->LineEdit1->setFocus();
|
GroupPoints->LineEdit1->setFocus();
|
||||||
|
@ -37,6 +37,8 @@ using namespace std;
|
|||||||
#include "RepairGUI_SuppressFacesDlg.h" // Method SUPPRESS FACES
|
#include "RepairGUI_SuppressFacesDlg.h" // Method SUPPRESS FACES
|
||||||
#include "RepairGUI_SuppressHoleDlg.h" // Method SUPPRESS HOLE
|
#include "RepairGUI_SuppressHoleDlg.h" // Method SUPPRESS HOLE
|
||||||
|
|
||||||
|
static RepairGUI* myRepairGUI = 0;
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : RepairGUI()
|
// function : RepairGUI()
|
||||||
// purpose : Constructor
|
// purpose : Constructor
|
||||||
@ -59,45 +61,58 @@ RepairGUI::~RepairGUI()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// function : GetOrCreateGUI()
|
||||||
|
// purpose : Gets or create an object 'GUI' with initialisations
|
||||||
|
// : Returns 'GUI' as a pointer
|
||||||
|
//=======================================================================
|
||||||
|
RepairGUI* RepairGUI::GetOrCreateGUI()
|
||||||
|
{
|
||||||
|
myRepairGUI = new RepairGUI();
|
||||||
|
return myRepairGUI;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : OnGUIEvent()
|
// function : OnGUIEvent()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool RepairGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
bool RepairGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
||||||
{
|
{
|
||||||
myGeomGUI->EmitSignalDeactivateDialog();
|
RepairGUI::GetOrCreateGUI();
|
||||||
SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection());
|
myRepairGUI->myGeomGUI->EmitSignalDeactivateDialog();
|
||||||
|
SALOME_Selection* Sel = SALOME_Selection::Selection(myRepairGUI->myGeomGUI->GetActiveStudy()->getSelection());
|
||||||
|
|
||||||
switch (theCommandID)
|
switch (theCommandID)
|
||||||
{
|
{
|
||||||
case 601: // SEWING
|
case 601: // SEWING
|
||||||
{
|
{
|
||||||
RepairGUI_SewingDlg *aDlg = new RepairGUI_SewingDlg(parent, "", this, Sel);
|
RepairGUI_SewingDlg *aDlg = new RepairGUI_SewingDlg(parent, "", myRepairGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 602: // ORIENTATION
|
case 602: // ORIENTATION
|
||||||
{
|
{
|
||||||
RepairGUI_OrientationDlg *aDlg = new RepairGUI_OrientationDlg(parent, "", this, Sel);
|
RepairGUI_OrientationDlg *aDlg = new RepairGUI_OrientationDlg(parent, "", myRepairGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 603: // SUPPRESS FACES : use ic
|
case 603: // SUPPRESS FACES : use ic
|
||||||
{
|
{
|
||||||
Handle(AIS_InteractiveContext) ic;
|
Handle(AIS_InteractiveContext) ic;
|
||||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
|
if(myRepairGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
|
||||||
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myRepairGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
||||||
ic = v3d->getAISContext();
|
ic = v3d->getAISContext();
|
||||||
}
|
}
|
||||||
RepairGUI_SuppressFacesDlg *aDlg = new RepairGUI_SuppressFacesDlg(parent, "", this, Sel, ic);
|
RepairGUI_SuppressFacesDlg *aDlg = new RepairGUI_SuppressFacesDlg(parent, "", myRepairGUI, Sel, ic);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 604: // SUPPRESS HOLES : use ic
|
case 604: // SUPPRESS HOLES : use ic
|
||||||
{
|
{
|
||||||
Handle(AIS_InteractiveContext) ic;
|
Handle(AIS_InteractiveContext) ic;
|
||||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
|
if(myRepairGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
|
||||||
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myRepairGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
||||||
ic = v3d->getAISContext();
|
ic = v3d->getAISContext();
|
||||||
}
|
}
|
||||||
RepairGUI_SuppressHoleDlg *aDlg = new RepairGUI_SuppressHoleDlg(parent, "", this, Sel, ic);
|
RepairGUI_SuppressHoleDlg *aDlg = new RepairGUI_SuppressHoleDlg(parent, "", myRepairGUI, Sel, ic);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -331,3 +346,13 @@ bool RepairGUI::OnSuppressFaces( const TopoDS_Shape& ShapeTopo,
|
|||||||
myGeomGUI->GetDesktop()->putInfo (tr("GEOM_PRP_READY"));
|
myGeomGUI->GetDesktop()->putInfo (tr("GEOM_PRP_READY"));
|
||||||
return true ;
|
return true ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=====================================================================================
|
||||||
|
// EXPORTED METHODS
|
||||||
|
//=====================================================================================
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
bool OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
||||||
|
{return RepairGUI::OnGUIEvent(theCommandID, parent);}
|
||||||
|
}
|
||||||
|
@ -43,7 +43,8 @@ public :
|
|||||||
RepairGUI();
|
RepairGUI();
|
||||||
~RepairGUI();
|
~RepairGUI();
|
||||||
|
|
||||||
bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
|
static RepairGUI* GetOrCreateGUI();
|
||||||
|
static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
|
||||||
|
|
||||||
void MakeSewingAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR,
|
void MakeSewingAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR,
|
||||||
const Standard_Real precision);
|
const Standard_Real precision);
|
||||||
@ -59,7 +60,6 @@ public :
|
|||||||
const Standard_Integer& aLocalContextId,
|
const Standard_Integer& aLocalContextId,
|
||||||
bool& myUseLocalContext);
|
bool& myUseLocalContext);
|
||||||
|
|
||||||
private:
|
|
||||||
GEOMBase_Context* myGeomGUI;
|
GEOMBase_Context* myGeomGUI;
|
||||||
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
|
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
|
||||||
|
|
||||||
|
@ -36,6 +36,8 @@ using namespace std;
|
|||||||
#include "TransformationGUI_MultiTranslationDlg.h" // Method MULTI TRANSLATION
|
#include "TransformationGUI_MultiTranslationDlg.h" // Method MULTI TRANSLATION
|
||||||
#include "TransformationGUI_MultiRotationDlg.h" // Method MULTI ROTATION
|
#include "TransformationGUI_MultiRotationDlg.h" // Method MULTI ROTATION
|
||||||
|
|
||||||
|
static TransformationGUI* myTransformationGUI = 0;
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : TransformationGUI()
|
// function : TransformationGUI()
|
||||||
// purpose : Constructor
|
// purpose : Constructor
|
||||||
@ -58,45 +60,58 @@ TransformationGUI::~TransformationGUI()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=======================================================================
|
||||||
|
// function : GetOrCreateGUI()
|
||||||
|
// purpose : Gets or create an object 'GUI' with initialisations
|
||||||
|
// : Returns 'GUI' as a pointer
|
||||||
|
//=======================================================================
|
||||||
|
TransformationGUI* TransformationGUI::GetOrCreateGUI()
|
||||||
|
{
|
||||||
|
myTransformationGUI = new TransformationGUI();
|
||||||
|
return myTransformationGUI;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
// function : OnGUIEvent()
|
// function : OnGUIEvent()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
bool TransformationGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
bool TransformationGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
||||||
{
|
{
|
||||||
myGeomGUI->EmitSignalDeactivateDialog();
|
TransformationGUI::GetOrCreateGUI();
|
||||||
SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection());
|
myTransformationGUI->myGeomGUI->EmitSignalDeactivateDialog();
|
||||||
|
SALOME_Selection* Sel = SALOME_Selection::Selection(myTransformationGUI->myGeomGUI->GetActiveStudy()->getSelection());
|
||||||
|
|
||||||
switch (theCommandID)
|
switch (theCommandID)
|
||||||
{
|
{
|
||||||
case 5021: // TRANSLATION
|
case 5021: // TRANSLATION
|
||||||
{
|
{
|
||||||
TransformationGUI_TranslationDlg *aDlg = new TransformationGUI_TranslationDlg(parent, "", this, Sel);
|
TransformationGUI_TranslationDlg *aDlg = new TransformationGUI_TranslationDlg(parent, "", myTransformationGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 5022: // ROTATION
|
case 5022: // ROTATION
|
||||||
{
|
{
|
||||||
TransformationGUI_RotationDlg *aDlg = new TransformationGUI_RotationDlg(parent, "", this, Sel);
|
TransformationGUI_RotationDlg *aDlg = new TransformationGUI_RotationDlg(parent, "", myTransformationGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 5023: // MIRROR
|
case 5023: // MIRROR
|
||||||
{
|
{
|
||||||
TransformationGUI_MirrorDlg *aDlg = new TransformationGUI_MirrorDlg(parent, "", this, Sel);
|
TransformationGUI_MirrorDlg *aDlg = new TransformationGUI_MirrorDlg(parent, "", myTransformationGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 5024: // SCALE
|
case 5024: // SCALE
|
||||||
{
|
{
|
||||||
TransformationGUI_ScaleDlg *aDlg = new TransformationGUI_ScaleDlg(parent, "", this, Sel );
|
TransformationGUI_ScaleDlg *aDlg = new TransformationGUI_ScaleDlg(parent, "", myTransformationGUI, Sel );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 5025: // MULTI TRANSLATION
|
case 5025: // MULTI TRANSLATION
|
||||||
{
|
{
|
||||||
TransformationGUI_MultiTranslationDlg *aDlg = new TransformationGUI_MultiTranslationDlg(parent, "", this, Sel);
|
TransformationGUI_MultiTranslationDlg *aDlg = new TransformationGUI_MultiTranslationDlg(parent, "", myTransformationGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case 5026: // MULTI ROTATION
|
case 5026: // MULTI ROTATION
|
||||||
{
|
{
|
||||||
TransformationGUI_MultiRotationDlg *aDlg = new TransformationGUI_MultiRotationDlg(parent, "", this, Sel);
|
TransformationGUI_MultiRotationDlg *aDlg = new TransformationGUI_MultiRotationDlg(parent, "", myTransformationGUI, Sel);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
@ -318,3 +333,13 @@ void TransformationGUI::MakeMultiRotation2DAndDisplay(GEOM::GEOM_Shape_ptr Shape
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=====================================================================================
|
||||||
|
// EXPORTED METHODS
|
||||||
|
//=====================================================================================
|
||||||
|
extern "C"
|
||||||
|
{
|
||||||
|
bool OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
||||||
|
{return TransformationGUI::OnGUIEvent(theCommandID, parent);}
|
||||||
|
}
|
||||||
|
@ -30,6 +30,7 @@
|
|||||||
#define TRANSFORMATIONGUI_H
|
#define TRANSFORMATIONGUI_H
|
||||||
|
|
||||||
#include "GEOMBase_Display.h"
|
#include "GEOMBase_Display.h"
|
||||||
|
#include "QAD_Config.h"
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : TransformationGUI
|
// class : TransformationGUI
|
||||||
@ -43,7 +44,8 @@ public :
|
|||||||
TransformationGUI();
|
TransformationGUI();
|
||||||
~TransformationGUI();
|
~TransformationGUI();
|
||||||
|
|
||||||
bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
|
static TransformationGUI* GetOrCreateGUI();
|
||||||
|
static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
|
||||||
|
|
||||||
void MakeTranslationAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Vec V);
|
void MakeTranslationAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Vec V);
|
||||||
void MakeRotationAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Pnt loc,
|
void MakeRotationAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Pnt loc,
|
||||||
@ -62,7 +64,6 @@ public :
|
|||||||
const gp_Dir Dir, const gp_Pnt Loc, const double Ang,
|
const gp_Dir Dir, const gp_Pnt Loc, const double Ang,
|
||||||
const short NbTimes1, const double Step, const short NbTimes2);
|
const short NbTimes1, const double Step, const short NbTimes2);
|
||||||
|
|
||||||
private:
|
|
||||||
GEOMBase_Context* myGeomGUI;
|
GEOMBase_Context* myGeomGUI;
|
||||||
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
|
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
|
||||||
|
|
||||||
|
@ -29,25 +29,10 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
#include "TransformationGUI_MirrorDlg.h"
|
#include "TransformationGUI_MirrorDlg.h"
|
||||||
|
|
||||||
|
#include <BRepBuilderAPI_Transform.hxx>
|
||||||
#include <Geom_Plane.hxx>
|
#include <Geom_Plane.hxx>
|
||||||
#include <BRep_Tool.hxx>
|
#include <BRep_Tool.hxx>
|
||||||
|
|
||||||
#include <qbuttongroup.h>
|
|
||||||
#include <qgroupbox.h>
|
|
||||||
#include <qlabel.h>
|
|
||||||
#include <qlineedit.h>
|
|
||||||
#include <qpushbutton.h>
|
|
||||||
#include <qradiobutton.h>
|
|
||||||
#include <qlayout.h>
|
|
||||||
#include <qvariant.h>
|
|
||||||
#include <qtooltip.h>
|
|
||||||
#include <qwhatsthis.h>
|
|
||||||
#include <qimage.h>
|
|
||||||
#include <qpixmap.h>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : TransformationGUI_MirrorDlg()
|
// class : TransformationGUI_MirrorDlg()
|
||||||
// purpose : Constructs a TransformationGUI_MirrorDlg which is a child of 'parent', with the
|
// purpose : Constructs a TransformationGUI_MirrorDlg which is a child of 'parent', with the
|
||||||
@ -55,112 +40,33 @@ using namespace std;
|
|||||||
// The dialog will by default be modeless, unless you set 'modal' to
|
// The dialog will by default be modeless, unless you set 'modal' to
|
||||||
// TRUE to construct a modal dialog.
|
// TRUE to construct a modal dialog.
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
TransformationGUI_MirrorDlg::TransformationGUI_MirrorDlg( QWidget* parent, const char* name, TransformationGUI* theTransformationGUI, SALOME_Selection* Sel, bool modal, WFlags fl )
|
TransformationGUI_MirrorDlg::TransformationGUI_MirrorDlg(QWidget* parent, const char* name, TransformationGUI* theTransformationGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
|
||||||
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
|
:GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
|
||||||
{
|
{
|
||||||
|
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_MIRROR")));
|
||||||
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_MIRROR")));
|
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
|
||||||
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
|
|
||||||
|
|
||||||
if ( !name )
|
setCaption(tr("GEOM_MIRROR_TITLE"));
|
||||||
setName( "TransformationGUI_MirrorDlg" );
|
|
||||||
resize( 303, 225 );
|
|
||||||
setCaption( tr( "GEOM_MIRROR_TITLE" ) );
|
|
||||||
setSizeGripEnabled( TRUE );
|
|
||||||
TransformationGUI_MirrorDlgLayout = new QGridLayout( this );
|
|
||||||
TransformationGUI_MirrorDlgLayout->setSpacing( 6 );
|
|
||||||
TransformationGUI_MirrorDlgLayout->setMargin( 11 );
|
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
GroupButtons = new QGroupBox( this, "GroupButtons" );
|
GroupConstructors->setTitle(tr("GEOM_MIRROR"));
|
||||||
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
|
RadioButton1->setPixmap(image0);
|
||||||
GroupButtons->setTitle( tr( "" ) );
|
RadioButton2->close(TRUE);
|
||||||
GroupButtons->setColumnLayout(0, Qt::Vertical );
|
RadioButton3->close(TRUE);
|
||||||
GroupButtons->layout()->setSpacing( 0 );
|
|
||||||
GroupButtons->layout()->setMargin( 0 );
|
|
||||||
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
|
|
||||||
GroupButtonsLayout->setAlignment( Qt::AlignTop );
|
|
||||||
GroupButtonsLayout->setSpacing( 6 );
|
|
||||||
GroupButtonsLayout->setMargin( 11 );
|
|
||||||
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
|
|
||||||
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
|
|
||||||
buttonCancel->setAutoDefault( TRUE );
|
|
||||||
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
|
|
||||||
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
|
|
||||||
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
|
|
||||||
buttonApply->setAutoDefault( TRUE );
|
|
||||||
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
|
|
||||||
QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
|
|
||||||
GroupButtonsLayout->addItem( spacer_9, 0, 2 );
|
|
||||||
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
|
|
||||||
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
|
|
||||||
buttonOk->setAutoDefault( TRUE );
|
|
||||||
buttonOk->setDefault( TRUE );
|
|
||||||
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
|
|
||||||
|
|
||||||
TransformationGUI_MirrorDlgLayout->addWidget( GroupButtons, 2, 0 );
|
GroupPoints = new DlgRef_2Sel_QTD(this, "GroupPoints");
|
||||||
|
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
|
||||||
|
GroupPoints->TextLabel1->setText(tr("GEOM_OBJECT"));
|
||||||
|
GroupPoints->TextLabel2->setText(tr("GEOM_PLANE_MIRROR"));
|
||||||
|
GroupPoints->PushButton1->setPixmap(image1);
|
||||||
|
GroupPoints->PushButton2->setPixmap(image1);
|
||||||
|
|
||||||
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
|
Layout1->addWidget(GroupPoints, 1, 0);
|
||||||
GroupConstructors->setTitle( tr( "GEOM_MIRROR" ) );
|
/***************************************************************/
|
||||||
GroupConstructors->setExclusive( TRUE );
|
|
||||||
GroupConstructors->setColumnLayout(0, Qt::Vertical );
|
|
||||||
GroupConstructors->layout()->setSpacing( 0 );
|
|
||||||
GroupConstructors->layout()->setMargin( 0 );
|
|
||||||
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
|
|
||||||
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
|
|
||||||
GroupConstructorsLayout->setSpacing( 6 );
|
|
||||||
GroupConstructorsLayout->setMargin( 11 );
|
|
||||||
QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
|
|
||||||
GroupConstructorsLayout->addItem( spacer_2, 0, 1 );
|
|
||||||
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
|
|
||||||
Constructor1->setText( tr( "" ) );
|
|
||||||
Constructor1->setPixmap( image0 );
|
|
||||||
Constructor1->setChecked( TRUE );
|
|
||||||
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
|
|
||||||
Constructor1->setMinimumSize( QSize( 50, 0 ) );
|
|
||||||
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
|
|
||||||
TransformationGUI_MirrorDlgLayout->addWidget( GroupConstructors, 0, 0 );
|
|
||||||
|
|
||||||
/***************************************************************/
|
/* Initialisations */
|
||||||
GroupC1 = new QGroupBox( this, "GroupC1" );
|
myTransformationGUI = theTransformationGUI;
|
||||||
GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) );
|
Init();
|
||||||
GroupC1->setColumnLayout(0, Qt::Vertical );
|
|
||||||
GroupC1->layout()->setSpacing( 0 );
|
|
||||||
GroupC1->layout()->setMargin( 0 );
|
|
||||||
GroupC1Layout = new QGridLayout( GroupC1->layout() );
|
|
||||||
GroupC1Layout->setAlignment( Qt::AlignTop );
|
|
||||||
GroupC1Layout->setSpacing( 6 );
|
|
||||||
GroupC1Layout->setMargin( 11 );
|
|
||||||
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
|
|
||||||
TextLabelC1A1->setText( tr( "GEOM_OBJECT" ) );
|
|
||||||
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
|
|
||||||
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
|
|
||||||
TextLabelC1A1->setFrameShadow( QLabel::Plain );
|
|
||||||
GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
|
|
||||||
TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
|
|
||||||
TextLabelC1A2->setText( tr( "GEOM_PLANE_MIRROR" ) );
|
|
||||||
TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
|
|
||||||
TextLabelC1A2->setFrameShape( QLabel::NoFrame );
|
|
||||||
TextLabelC1A2->setFrameShadow( QLabel::Plain );
|
|
||||||
GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
|
|
||||||
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
|
|
||||||
SelectButtonC1A1->setText( tr( "" ) );
|
|
||||||
SelectButtonC1A1->setPixmap( image1 );
|
|
||||||
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
|
|
||||||
SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" );
|
|
||||||
SelectButtonC1A2->setText( tr( "" ) );
|
|
||||||
SelectButtonC1A2->setPixmap( image1 );
|
|
||||||
GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 );
|
|
||||||
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
|
|
||||||
LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) );
|
|
||||||
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
|
|
||||||
LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
|
|
||||||
GroupC1Layout->addWidget( LineEditC1A2, 1, 2 );
|
|
||||||
TransformationGUI_MirrorDlgLayout->addWidget( GroupC1, 1, 0 );
|
|
||||||
|
|
||||||
/* Initialisation */
|
|
||||||
myTransformationGUI = theTransformationGUI;
|
|
||||||
Init( Sel ) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -174,97 +80,49 @@ TransformationGUI_MirrorDlg::~TransformationGUI_MirrorDlg()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : Init()
|
// function : Init()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_MirrorDlg::Init( SALOME_Selection* Sel )
|
void TransformationGUI_MirrorDlg::Init()
|
||||||
{
|
{
|
||||||
mySelection = Sel ;
|
/* init variables */
|
||||||
myShape1.Nullify() ;
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
myShape2.Nullify() ;
|
|
||||||
mySimulationTopoDs.Nullify() ;
|
|
||||||
myConstructorId = 0 ;
|
|
||||||
|
|
||||||
myGeomGUI = GEOMBase_Context::GetGeomGUI() ;
|
|
||||||
GroupC1->show();
|
|
||||||
|
|
||||||
myEditCurrentArgument = LineEditC1A1 ;
|
myOkShape1 = myOkShape2 = false;
|
||||||
Constructor1->setChecked( TRUE );
|
|
||||||
myOkShape1 = myOkShape2 = false ;
|
|
||||||
|
|
||||||
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
|
/* Vertices Filter for all arguments */
|
||||||
|
myFaceFilter = new GEOM_FaceFilter(StdSelect_Plane, myGeom);
|
||||||
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
|
|
||||||
myGeom = GEOM::GEOM_Gen::_narrow(comp);
|
|
||||||
/* Filter definition */
|
|
||||||
|
|
||||||
myFaceFilter = new GEOM_FaceFilter( StdSelect_Plane, myGeom );
|
|
||||||
|
|
||||||
// TODO previous selection into argument ?
|
|
||||||
|
|
||||||
/* signals and slots connections */
|
/* signals and slots connections */
|
||||||
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
|
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||||
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
|
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||||
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
|
|
||||||
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
|
|
||||||
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
|
|
||||||
connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
|
|
||||||
|
|
||||||
connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
|
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||||
connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
|
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||||
|
|
||||||
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||||
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
|
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||||
/* to close dialog if study change */
|
|
||||||
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
|
|
||||||
|
|
||||||
/* Move widget on the botton right corner of main widget */
|
|
||||||
int x, y ;
|
|
||||||
myGeomGUI->DefineDlgPosition( this, x, y ) ;
|
|
||||||
this->move( x, y ) ;
|
|
||||||
this->show() ; /* Displays Dialog */
|
|
||||||
|
|
||||||
return ;
|
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||||
|
|
||||||
|
/* displays Dialog */
|
||||||
|
GroupPoints->show();
|
||||||
|
this->show();
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : ConstructorsClicked()
|
|
||||||
// purpose : Radio button management
|
|
||||||
//=================================================================================
|
|
||||||
void TransformationGUI_MirrorDlg::ConstructorsClicked(int constructorId)
|
|
||||||
{
|
|
||||||
GEOMBase_Context::GetGeomGUI()->EraseSimulationShape() ;
|
|
||||||
|
|
||||||
switch (constructorId)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
GroupC1->show();
|
|
||||||
myConstructorId = constructorId ;
|
|
||||||
myEditCurrentArgument = LineEditC1A1 ;
|
|
||||||
LineEditC1A2->setText(tr("")) ;
|
|
||||||
Constructor1->setChecked( TRUE );
|
|
||||||
myOkShape1 = myOkShape2 = false ;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnOk()
|
// function : ClickOnOk()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_MirrorDlg::ClickOnOk()
|
void TransformationGUI_MirrorDlg::ClickOnOk()
|
||||||
{
|
{
|
||||||
this->ClickOnApply() ;
|
this->ClickOnApply();
|
||||||
this->ClickOnCancel() ;
|
ClickOnCancel();
|
||||||
|
return;
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -273,138 +131,68 @@ void TransformationGUI_MirrorDlg::ClickOnOk()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_MirrorDlg::ClickOnApply()
|
void TransformationGUI_MirrorDlg::ClickOnApply()
|
||||||
{
|
{
|
||||||
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
|
myGeomGUI->GetDesktop()->putInfo(tr(""));
|
||||||
switch(myConstructorId)
|
if (mySimulationTopoDs.IsNull())
|
||||||
{
|
return;
|
||||||
case 0 :
|
myGeomGUI->EraseSimulationShape();
|
||||||
{
|
mySimulationTopoDs.Nullify();
|
||||||
if(myOkShape1 && myOkShape2) {
|
|
||||||
myTransformationGUI->MakeMirrorAndDisplay(myGeomShape1 ,myGeomShape2 ) ;
|
if(myOkShape1 && myOkShape2)
|
||||||
}
|
myTransformationGUI->MakeMirrorAndDisplay(myGeomShape1, myGeomShape2);
|
||||||
break ;
|
return;
|
||||||
}
|
|
||||||
}
|
|
||||||
// accept();
|
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : ClickOnCancel()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void TransformationGUI_MirrorDlg::ClickOnCancel()
|
|
||||||
{
|
|
||||||
mySelection->ClearFilters() ;
|
|
||||||
myGeomGUI->EraseSimulationShape() ;
|
|
||||||
mySimulationTopoDs.Nullify() ;
|
|
||||||
disconnect( mySelection, 0, this, 0 );
|
|
||||||
myGeomGUI->ResetState() ;
|
|
||||||
reject() ;
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SelectionIntoArgument()
|
// function : SelectionIntoArgument()
|
||||||
// purpose : Called when selection has changed
|
// purpose : Called when selection has changed
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_MirrorDlg::SelectionIntoArgument()
|
void TransformationGUI_MirrorDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
myEditCurrentArgument->setText("") ;
|
myGeomGUI->EraseSimulationShape();
|
||||||
myGeomGUI->EraseSimulationShape() ;
|
mySimulationTopoDs.Nullify();
|
||||||
mySimulationTopoDs.Nullify() ;
|
myEditCurrentArgument->setText("");
|
||||||
|
|
||||||
QString aString = ""; /* name of selection */
|
QString aString = ""; /* name of selection */
|
||||||
|
|
||||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
|
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
|
||||||
if ( nbSel != 1 ) {
|
if(nbSel != 1) {
|
||||||
switch (myConstructorId)
|
if(myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||||
{
|
myOkShape1 = false;
|
||||||
case 0:
|
else if(myEditCurrentArgument == GroupPoints->LineEdit2)
|
||||||
{
|
myOkShape2 = false;
|
||||||
if ( myEditCurrentArgument == LineEditC1A1 ) {
|
return;
|
||||||
myOkShape1 = false ;
|
|
||||||
}
|
|
||||||
else if ( myEditCurrentArgument == LineEditC1A2 ) {
|
|
||||||
myOkShape2 = false ;
|
|
||||||
}
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* nbSel == 1 */
|
// nbSel == 1
|
||||||
TopoDS_Shape S;
|
TopoDS_Shape S;
|
||||||
Standard_Boolean testResult ;
|
Standard_Boolean testResult;
|
||||||
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
|
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
|
||||||
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
|
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
|
||||||
return ;
|
return;
|
||||||
|
|
||||||
if ( myEditCurrentArgument == LineEditC1A1 ) {
|
if(myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||||
myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
|
myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
|
||||||
if( !testResult )
|
if(!testResult)
|
||||||
|
return;
|
||||||
|
myShape1 = S;
|
||||||
|
myEditCurrentArgument->setText(aString);
|
||||||
|
myOkShape1 = true;
|
||||||
|
}
|
||||||
|
else if(myEditCurrentArgument == GroupPoints->LineEdit2) {
|
||||||
|
myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
|
||||||
|
if(!testResult)
|
||||||
return ;
|
return ;
|
||||||
myShape1 = S ;
|
myShape2 = S;
|
||||||
LineEditC1A1->setText(aString) ;
|
myEditCurrentArgument->setText(aString);
|
||||||
myOkShape1 = true ;
|
myOkShape2 = true;
|
||||||
}
|
|
||||||
else if ( myEditCurrentArgument == LineEditC1A2 ) {
|
|
||||||
myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
|
|
||||||
if( !testResult )
|
|
||||||
return ;
|
|
||||||
myShape2 = S ;
|
|
||||||
LineEditC1A2->setText(aString) ;
|
|
||||||
myOkShape2 = true ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(myOkShape1 && myOkShape2) {
|
if(myOkShape1 && myOkShape2)
|
||||||
MakeMirrorSimulationAndDisplay( myShape1, myShape2 ) ;
|
MakeMirrorSimulationAndDisplay();
|
||||||
}
|
return;
|
||||||
|
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : MakeMirrorSimulationAndDisplay()
|
|
||||||
// purpose : S1 is a shape and S2 a mirror.
|
|
||||||
//=================================================================================
|
|
||||||
void TransformationGUI_MirrorDlg::MakeMirrorSimulationAndDisplay( const TopoDS_Shape& S1, const TopoDS_Shape& S2 )
|
|
||||||
{
|
|
||||||
this->mySimulationTopoDs.Nullify() ;
|
|
||||||
|
|
||||||
try {
|
|
||||||
Handle(Geom_Surface) surf = BRep_Tool::Surface(TopoDS::Face(S2)) ;
|
|
||||||
Handle(Geom_Plane) myPlane = Handle(Geom_Plane)::DownCast(surf) ;
|
|
||||||
const gp_Ax3 pos = myPlane->Position() ;
|
|
||||||
const gp_Pnt loc = pos.Location() ; /* location of the plane */
|
|
||||||
const gp_Dir dir = pos.Direction() ; /* Main direction of the plane (Z axis) */
|
|
||||||
|
|
||||||
/* plane used for mirroring */
|
|
||||||
gp_Ax2 pln(loc, dir) ;
|
|
||||||
gp_Trsf theTransformation ;
|
|
||||||
theTransformation.SetMirror(pln) ;
|
|
||||||
BRepBuilderAPI_Transform myBRepTransformation( S1, theTransformation, Standard_False ) ;
|
|
||||||
|
|
||||||
this->mySimulationTopoDs = myBRepTransformation.Shape() ;
|
|
||||||
if( this->mySimulationTopoDs.IsNull() )
|
|
||||||
return ;
|
|
||||||
else
|
|
||||||
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
|
|
||||||
}
|
|
||||||
catch(Standard_Failure) {
|
|
||||||
MESSAGE( "Exception catched in MakeMirrorSimulationAndDisplay" ) ;
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SetEditCurrentArgument()
|
// function : SetEditCurrentArgument()
|
||||||
// purpose :
|
// purpose :
|
||||||
@ -412,82 +200,39 @@ void TransformationGUI_MirrorDlg::MakeMirrorSimulationAndDisplay( const TopoDS_S
|
|||||||
void TransformationGUI_MirrorDlg::SetEditCurrentArgument()
|
void TransformationGUI_MirrorDlg::SetEditCurrentArgument()
|
||||||
{
|
{
|
||||||
QPushButton* send = (QPushButton*)sender();
|
QPushButton* send = (QPushButton*)sender();
|
||||||
|
mySelection->ClearFilters();
|
||||||
|
|
||||||
switch (myConstructorId)
|
if(send == GroupPoints->PushButton1) {
|
||||||
{
|
GroupPoints->LineEdit1->setFocus();
|
||||||
case 0:
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
{
|
}
|
||||||
if( send == SelectButtonC1A1 ) {
|
else if(send == GroupPoints->PushButton2) {
|
||||||
LineEditC1A1->setFocus() ;
|
GroupPoints->LineEdit2->setFocus();
|
||||||
myEditCurrentArgument = LineEditC1A1 ;
|
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||||
mySelection->ClearFilters() ;
|
mySelection->AddFilter(myFaceFilter);
|
||||||
SelectionIntoArgument() ;
|
}
|
||||||
}
|
this->SelectionIntoArgument();
|
||||||
else if(send == SelectButtonC1A2) {
|
|
||||||
LineEditC1A2->setFocus() ;
|
return;
|
||||||
myEditCurrentArgument = LineEditC1A2;
|
|
||||||
mySelection->AddFilter(myFaceFilter) ;
|
|
||||||
SelectionIntoArgument() ;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : LineEditReturnPressed()
|
// function : LineEditReturnPressed()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_MirrorDlg::LineEditReturnPressed()
|
void TransformationGUI_MirrorDlg::LineEditReturnPressed()
|
||||||
{
|
{
|
||||||
QLineEdit* send = (QLineEdit*)sender();
|
QLineEdit* send = (QLineEdit*)sender();
|
||||||
if( send == LineEditC1A1 )
|
if(send == GroupPoints->LineEdit1)
|
||||||
myEditCurrentArgument = LineEditC1A1 ;
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
else if ( send == LineEditC1A2 )
|
else if(send == GroupPoints->LineEdit2)
|
||||||
myEditCurrentArgument = LineEditC1A2 ;
|
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||||
else
|
else
|
||||||
return ;
|
return;
|
||||||
|
|
||||||
/* User name of object input management */
|
|
||||||
/* If successfull the selection is changed and signal emitted... */
|
|
||||||
/* so SelectionIntoArgument() is automatically called. */
|
|
||||||
const QString objectUserName = myEditCurrentArgument->text() ;
|
|
||||||
QWidget* thisWidget = (QWidget*)this ;
|
|
||||||
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
|
|
||||||
myEditCurrentArgument->setText( objectUserName ) ;
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||||
|
return;
|
||||||
//=================================================================================
|
|
||||||
// function : DeactivateActiveDialog()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void TransformationGUI_MirrorDlg::DeactivateActiveDialog()
|
|
||||||
{
|
|
||||||
if ( GroupConstructors->isEnabled() ) {
|
|
||||||
GroupConstructors->setEnabled(false) ;
|
|
||||||
GroupC1->setEnabled(false) ;
|
|
||||||
GroupButtons->setEnabled(false) ;
|
|
||||||
disconnect( mySelection, 0, this, 0 );
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : closeEvent()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void TransformationGUI_MirrorDlg::closeEvent( QCloseEvent* e )
|
|
||||||
{
|
|
||||||
this->ClickOnCancel() ; /* same than click on cancel button */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -495,26 +240,60 @@ void TransformationGUI_MirrorDlg::closeEvent( QCloseEvent* e )
|
|||||||
// function : enterEvent()
|
// function : enterEvent()
|
||||||
// purpose : when mouse enter onto the QWidget
|
// purpose : when mouse enter onto the QWidget
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_MirrorDlg::enterEvent( QEvent * )
|
void TransformationGUI_MirrorDlg::enterEvent(QEvent * e)
|
||||||
{
|
{
|
||||||
if ( GroupConstructors->isEnabled() )
|
if(GroupConstructors->isEnabled())
|
||||||
return ;
|
return;
|
||||||
ActivateThisDialog() ;
|
this->ActivateThisDialog();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ActivateThisDialog()
|
// function : ActivateThisDialog()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_MirrorDlg::ActivateThisDialog()
|
void TransformationGUI_MirrorDlg::ActivateThisDialog()
|
||||||
{
|
{
|
||||||
/* Emit a signal to deactivate any active dialog */
|
GEOMBase_Skeleton::ActivateThisDialog();
|
||||||
myGeomGUI->EmitSignalDeactivateDialog() ;
|
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||||
GroupConstructors->setEnabled(true) ;
|
if(!mySimulationTopoDs.IsNull())
|
||||||
GroupC1->setEnabled(true) ;
|
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||||
GroupButtons->setEnabled(true) ;
|
return;
|
||||||
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
}
|
||||||
return ;
|
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : MakeMirrorSimulationAndDisplay()
|
||||||
|
// purpose : S1 is a shape and S2 a mirror.
|
||||||
|
//=================================================================================
|
||||||
|
void TransformationGUI_MirrorDlg::MakeMirrorSimulationAndDisplay()
|
||||||
|
{
|
||||||
|
myGeomGUI->EraseSimulationShape();
|
||||||
|
mySimulationTopoDs.Nullify();
|
||||||
|
|
||||||
|
try {
|
||||||
|
Handle(Geom_Surface) surf = BRep_Tool::Surface(TopoDS::Face(myShape2));
|
||||||
|
Handle(Geom_Plane) myPlane = Handle(Geom_Plane)::DownCast(surf);
|
||||||
|
const gp_Ax3 pos = myPlane->Position();
|
||||||
|
const gp_Pnt loc = pos.Location(); /* location of the plane */
|
||||||
|
const gp_Dir dir = pos.Direction(); /* Main direction of the plane (Z axis) */
|
||||||
|
|
||||||
|
/* plane used for mirroring */
|
||||||
|
gp_Ax2 pln(loc, dir);
|
||||||
|
gp_Trsf theTransformation;
|
||||||
|
theTransformation.SetMirror(pln);
|
||||||
|
BRepBuilderAPI_Transform myBRepTransformation(myShape1, theTransformation, Standard_False);
|
||||||
|
|
||||||
|
this->mySimulationTopoDs = myBRepTransformation.Shape();
|
||||||
|
if(mySimulationTopoDs.IsNull())
|
||||||
|
return;
|
||||||
|
else
|
||||||
|
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||||
|
}
|
||||||
|
catch(Standard_Failure) {
|
||||||
|
MESSAGE("Exception catched in MakeMirrorSimulationAndDisplay");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
@ -29,89 +29,51 @@
|
|||||||
#ifndef DIALOGBOX_MIRROR_H
|
#ifndef DIALOGBOX_MIRROR_H
|
||||||
#define DIALOGBOX_MIRROR_H
|
#define DIALOGBOX_MIRROR_H
|
||||||
|
|
||||||
|
#include "GEOMBase_Skeleton.h"
|
||||||
|
#include "DlgRef_2Sel_QTD.h"
|
||||||
|
|
||||||
#include "TransformationGUI.h"
|
#include "TransformationGUI.h"
|
||||||
|
|
||||||
#include <BRepBuilderAPI_Transform.hxx>
|
|
||||||
#include "GEOM_FaceFilter.hxx"
|
#include "GEOM_FaceFilter.hxx"
|
||||||
|
|
||||||
#include <qvariant.h>
|
|
||||||
#include <qdialog.h>
|
|
||||||
|
|
||||||
class QVBoxLayout;
|
|
||||||
class QHBoxLayout;
|
|
||||||
class QGridLayout;
|
|
||||||
class QButtonGroup;
|
|
||||||
class QGroupBox;
|
|
||||||
class QLabel;
|
|
||||||
class QLineEdit;
|
|
||||||
class QPushButton;
|
|
||||||
class QRadioButton;
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : TransformationGUI_MirrorDlg
|
// class : TransformationGUI_MirrorDlg
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
class TransformationGUI_MirrorDlg : public QDialog
|
class TransformationGUI_MirrorDlg : public GEOMBase_Skeleton
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TransformationGUI_MirrorDlg( QWidget* parent = 0, const char* name = 0, TransformationGUI* theTransformationGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
|
TransformationGUI_MirrorDlg(QWidget* parent = 0, const char* name = 0, TransformationGUI* theTransformationGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
|
||||||
~TransformationGUI_MirrorDlg();
|
~TransformationGUI_MirrorDlg();
|
||||||
|
|
||||||
private :
|
private :
|
||||||
TransformationGUI* myTransformationGUI;
|
void Init();
|
||||||
void closeEvent( QCloseEvent* e ) ;
|
void enterEvent(QEvent* e);
|
||||||
void enterEvent( QEvent* e); /* Mouse enter the QWidget */
|
void MakeMirrorSimulationAndDisplay();
|
||||||
void Init( SALOME_Selection* Sel ) ;
|
|
||||||
void MakeMirrorSimulationAndDisplay( const TopoDS_Shape& S1, const TopoDS_Shape& S2 ) ;
|
TransformationGUI* myTransformationGUI;
|
||||||
|
|
||||||
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */
|
|
||||||
GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */
|
|
||||||
SALOME_Selection* mySelection ; /* User shape selection */
|
|
||||||
TopoDS_Shape myShape1 ; /* topology used */
|
|
||||||
TopoDS_Shape myShape2 ; /* topology used */
|
|
||||||
GEOM::GEOM_Shape_var myGeomShape1 ; /* is myShape1 */
|
|
||||||
GEOM::GEOM_Shape_var myGeomShape2 ; /* is myShape2 */
|
|
||||||
TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */
|
|
||||||
bool myOkShape1 ;
|
|
||||||
bool myOkShape2 ; /* to check when arguments are defined */
|
|
||||||
int myConstructorId ; /* Current constructor id = radio button id */
|
|
||||||
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
|
|
||||||
Handle(GEOM_FaceFilter) myFaceFilter; /* To filter selections */
|
Handle(GEOM_FaceFilter) myFaceFilter; /* To filter selections */
|
||||||
|
|
||||||
QGroupBox* GroupButtons;
|
TopoDS_Shape myShape1; /* topology used */
|
||||||
QPushButton* buttonApply;
|
TopoDS_Shape myShape2; /* topology used */
|
||||||
QPushButton* buttonOk;
|
GEOM::GEOM_Shape_var myGeomShape1; /* is myShape1 */
|
||||||
QPushButton* buttonCancel;
|
GEOM::GEOM_Shape_var myGeomShape2; /* is myShape2 */
|
||||||
QButtonGroup* GroupConstructors;
|
bool myOkShape1;
|
||||||
QRadioButton* Constructor1;
|
bool myOkShape2; /* to check when arguments are defined */
|
||||||
QGroupBox* GroupC1;
|
|
||||||
QLabel* TextLabelC1A1;
|
DlgRef_2Sel_QTD* GroupPoints;
|
||||||
QLabel* TextLabelC1A2;
|
|
||||||
QPushButton* SelectButtonC1A1;
|
|
||||||
QPushButton* SelectButtonC1A2;
|
|
||||||
QLineEdit* LineEditC1A1;
|
|
||||||
QLineEdit* LineEditC1A2;
|
|
||||||
|
|
||||||
private slots :
|
private slots :
|
||||||
|
|
||||||
void ConstructorsClicked(int constructorId);
|
|
||||||
void ClickOnOk();
|
void ClickOnOk();
|
||||||
void ClickOnCancel();
|
|
||||||
void ClickOnApply();
|
void ClickOnApply();
|
||||||
void SetEditCurrentArgument() ;
|
void ActivateThisDialog();
|
||||||
void SelectionIntoArgument() ;
|
void LineEditReturnPressed();
|
||||||
void LineEditReturnPressed() ;
|
void SelectionIntoArgument();
|
||||||
void DeactivateActiveDialog() ;
|
void SetEditCurrentArgument();
|
||||||
void ActivateThisDialog() ;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
QGridLayout* TransformationGUI_MirrorDlgLayout;
|
|
||||||
QGridLayout* GroupButtonsLayout;
|
|
||||||
QGridLayout* GroupConstructorsLayout;
|
|
||||||
QGridLayout* GroupC1Layout;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOGBOX_MIRROR_H
|
#endif // DIALOGBOX_MIRROR_H
|
||||||
|
@ -30,25 +30,10 @@ using namespace std;
|
|||||||
#include "TransformationGUI_RotationDlg.h"
|
#include "TransformationGUI_RotationDlg.h"
|
||||||
|
|
||||||
#include "QAD_Config.h"
|
#include "QAD_Config.h"
|
||||||
|
//#include <TopLoc_Location.hxx>
|
||||||
|
#include <BRepBuilderAPI_Transform.hxx>
|
||||||
#include <BRepAdaptor_Curve.hxx>
|
#include <BRepAdaptor_Curve.hxx>
|
||||||
|
|
||||||
#include <qbuttongroup.h>
|
|
||||||
#include <qcheckbox.h>
|
|
||||||
#include <qgroupbox.h>
|
|
||||||
#include <qlabel.h>
|
|
||||||
#include <qlineedit.h>
|
|
||||||
#include <qpushbutton.h>
|
|
||||||
#include <qradiobutton.h>
|
|
||||||
#include <qlayout.h>
|
|
||||||
#include <qvariant.h>
|
|
||||||
#include <qtooltip.h>
|
|
||||||
#include <qwhatsthis.h>
|
|
||||||
#include <qimage.h>
|
|
||||||
#include <qvalidator.h>
|
|
||||||
#include <qpixmap.h>
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : TransformationGUI_RotationDlg()
|
// class : TransformationGUI_RotationDlg()
|
||||||
// purpose : Constructs a TransformationGUI_RotationDlg which is a child of 'parent', with the
|
// purpose : Constructs a TransformationGUI_RotationDlg which is a child of 'parent', with the
|
||||||
@ -56,227 +41,92 @@ using namespace std;
|
|||||||
// The dialog will by default be modeless, unless you set 'modal' to
|
// The dialog will by default be modeless, unless you set 'modal' to
|
||||||
// TRUE to construct a modal dialog.
|
// TRUE to construct a modal dialog.
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
TransformationGUI_RotationDlg::TransformationGUI_RotationDlg( QWidget* parent, const char* name, TransformationGUI* theTransformationGUI, SALOME_Selection* Sel, bool modal, WFlags fl )
|
TransformationGUI_RotationDlg::TransformationGUI_RotationDlg(QWidget* parent, const char* name, TransformationGUI* theTransformationGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
|
||||||
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
|
:GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
|
||||||
{
|
{
|
||||||
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_ROTATION")));
|
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_ROTATION")));
|
||||||
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
|
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
|
||||||
|
|
||||||
if ( !name )
|
setCaption(tr("GEOM_ROTATION_TITLE"));
|
||||||
setName( "TransformationGUI_RotationDlg" );
|
|
||||||
resize( 303, 251 );
|
|
||||||
setCaption( tr( "GEOM_ROTATION_TITLE" ) );
|
|
||||||
setSizeGripEnabled( TRUE );
|
|
||||||
TransformationGUI_RotationDlgLayout = new QGridLayout( this );
|
|
||||||
TransformationGUI_RotationDlgLayout->setSpacing( 6 );
|
|
||||||
TransformationGUI_RotationDlgLayout->setMargin( 11 );
|
|
||||||
|
|
||||||
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
|
/***************************************************************/
|
||||||
GroupConstructors->setTitle( tr( "GEOM_ROTATION" ) );
|
GroupConstructors->setTitle(tr("GEOM_ROTATION"));
|
||||||
GroupConstructors->setExclusive( TRUE );
|
RadioButton1->setPixmap(image0);
|
||||||
GroupConstructors->setColumnLayout(0, Qt::Vertical );
|
RadioButton2->close(TRUE);
|
||||||
GroupConstructors->layout()->setSpacing( 0 );
|
RadioButton3->close(TRUE);
|
||||||
GroupConstructors->layout()->setMargin( 0 );
|
|
||||||
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
|
|
||||||
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
|
|
||||||
GroupConstructorsLayout->setSpacing( 6 );
|
|
||||||
GroupConstructorsLayout->setMargin( 11 );
|
|
||||||
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
|
|
||||||
Constructor1->setText( tr( "" ) );
|
|
||||||
Constructor1->setPixmap( image0 );
|
|
||||||
Constructor1->setChecked( TRUE );
|
|
||||||
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
|
|
||||||
Constructor1->setMinimumSize( QSize( 50, 0 ) );
|
|
||||||
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
|
|
||||||
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
|
|
||||||
GroupConstructorsLayout->addItem( spacer, 0, 1 );
|
|
||||||
TransformationGUI_RotationDlgLayout->addWidget( GroupConstructors, 0, 0 );
|
|
||||||
|
|
||||||
/***************************************************************/
|
GroupPoints = new DlgRef_2Sel1Spin1Check(this, "GroupPoints");
|
||||||
GroupButtons = new QGroupBox( this, "GroupButtons" );
|
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
|
||||||
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
|
GroupPoints->TextLabel1->setText(tr("GEOM_OBJECT"));
|
||||||
GroupButtons->setTitle( tr( "" ) );
|
GroupPoints->TextLabel2->setText(tr("GEOM_AXIS"));
|
||||||
GroupButtons->setColumnLayout(0, Qt::Vertical );
|
GroupPoints->TextLabel3->setText(tr("GEOM_ANGLE"));
|
||||||
GroupButtons->layout()->setSpacing( 0 );
|
GroupPoints->CheckButton1->setText(tr("GEOM_REVERSE"));
|
||||||
GroupButtons->layout()->setMargin( 0 );
|
GroupPoints->PushButton1->setPixmap(image1);
|
||||||
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
|
GroupPoints->PushButton2->setPixmap(image1);
|
||||||
GroupButtonsLayout->setAlignment( Qt::AlignTop );
|
|
||||||
GroupButtonsLayout->setSpacing( 6 );
|
|
||||||
GroupButtonsLayout->setMargin( 11 );
|
|
||||||
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
|
|
||||||
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
|
|
||||||
buttonCancel->setAutoDefault( TRUE );
|
|
||||||
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
|
|
||||||
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
|
|
||||||
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
|
|
||||||
buttonApply->setAutoDefault( TRUE );
|
|
||||||
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
|
|
||||||
QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
|
|
||||||
GroupButtonsLayout->addItem( spacer_9, 0, 2 );
|
|
||||||
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
|
|
||||||
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
|
|
||||||
buttonOk->setAutoDefault( TRUE );
|
|
||||||
buttonOk->setDefault( TRUE );
|
|
||||||
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
|
|
||||||
TransformationGUI_RotationDlgLayout->addWidget( GroupButtons, 2, 0 );
|
|
||||||
|
|
||||||
/***************************************************************/
|
Layout1->addWidget(GroupPoints, 1, 0);
|
||||||
GroupC1 = new QGroupBox( this, "GroupC1" );
|
/***************************************************************/
|
||||||
GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) );
|
|
||||||
GroupC1->setFrameShape( QGroupBox::Box );
|
|
||||||
GroupC1->setFrameShadow( QGroupBox::Sunken );
|
|
||||||
GroupC1->setColumnLayout(0, Qt::Vertical );
|
|
||||||
GroupC1->layout()->setSpacing( 0 );
|
|
||||||
GroupC1->layout()->setMargin( 0 );
|
|
||||||
GroupC1Layout = new QGridLayout( GroupC1->layout() );
|
|
||||||
GroupC1Layout->setAlignment( Qt::AlignTop );
|
|
||||||
GroupC1Layout->setSpacing( 6 );
|
|
||||||
GroupC1Layout->setMargin( 11 );
|
|
||||||
SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" );
|
|
||||||
SelectButtonC1A2->setText( tr( "" ) );
|
|
||||||
SelectButtonC1A2->setPixmap( image1 );
|
|
||||||
SelectButtonC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0,
|
|
||||||
SelectButtonC1A2->sizePolicy().hasHeightForWidth() ) );
|
|
||||||
GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 );
|
|
||||||
|
|
||||||
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
|
|
||||||
GroupC1Layout->addMultiCellWidget( LineEditC1A1, 0, 0, 2, 3 );
|
|
||||||
LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
|
|
||||||
GroupC1Layout->addMultiCellWidget( LineEditC1A2, 1, 1, 2, 3 );
|
|
||||||
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
|
|
||||||
SelectButtonC1A1->setText( tr( "" ) );
|
|
||||||
SelectButtonC1A1->setPixmap( image1 );
|
|
||||||
SelectButtonC1A1->setToggleButton( FALSE );
|
|
||||||
SelectButtonC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0,
|
|
||||||
SelectButtonC1A1->sizePolicy().hasHeightForWidth() ) );
|
|
||||||
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
|
|
||||||
|
|
||||||
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
|
/* Initialisations */
|
||||||
TextLabelC1A1->setText( tr( "GEOM_OBJECT" ) );
|
myTransformationGUI = theTransformationGUI;
|
||||||
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
|
Init();
|
||||||
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
|
|
||||||
TextLabelC1A1->setFrameShadow( QLabel::Plain );
|
|
||||||
GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
|
|
||||||
TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
|
|
||||||
TextLabelC1A2->setText( tr( "GEOM_AXIS" ) );
|
|
||||||
TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
|
|
||||||
GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
|
|
||||||
|
|
||||||
SpinBox_C1A3 = new DlgRef_SpinBox( GroupC1, "GeomSpinBox_C1A3" ) ;
|
|
||||||
GroupC1Layout->addWidget( SpinBox_C1A3, 2, 3 );
|
|
||||||
|
|
||||||
TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" );
|
|
||||||
TextLabelC1A3->setText( tr( "GEOM_ANGLE" ) );
|
|
||||||
TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) );
|
|
||||||
GroupC1Layout->addWidget( TextLabelC1A3, 2, 2 );
|
|
||||||
CheckBoxReverse = new QCheckBox( GroupC1, "CheckBoxReverse" );
|
|
||||||
CheckBoxReverse->setText( tr( "GEOM_REVERSE" ) );
|
|
||||||
GroupC1Layout->addMultiCellWidget( CheckBoxReverse, 2, 2, 0, 1 );
|
|
||||||
TransformationGUI_RotationDlgLayout->addWidget( GroupC1, 1, 0 );
|
|
||||||
myTransformationGUI = theTransformationGUI;
|
|
||||||
Init(Sel) ; /* Initialisations */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ~TransformationGUI_RotationDlg()
|
// function : ~TransformationGUI_RotationDlg()
|
||||||
// purpose : Destroys the object and frees any allocated resources
|
// purpose : Destroys the object and frees any allocated resources
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
TransformationGUI_RotationDlg::~TransformationGUI_RotationDlg()
|
TransformationGUI_RotationDlg::~TransformationGUI_RotationDlg()
|
||||||
{
|
{
|
||||||
// no need to delete child widgets, Qt does it all for us
|
// no need to delete child widgets, Qt does it all for us
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : Init()
|
// function : Init()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_RotationDlg::Init( SALOME_Selection* Sel )
|
void TransformationGUI_RotationDlg::Init()
|
||||||
{
|
{
|
||||||
|
/* init variables */
|
||||||
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
|
|
||||||
|
myAngle = 45.0;
|
||||||
|
myOkBase = myOkAxis = false;
|
||||||
|
|
||||||
|
myEdgeFilter = new GEOM_ShapeTypeFilter(TopAbs_EDGE, myGeom);
|
||||||
|
|
||||||
/* Get setting of step value from file configuration */
|
/* Get setting of step value from file configuration */
|
||||||
double step ;
|
QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep");
|
||||||
QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ;
|
step = St.toDouble();
|
||||||
step = St.toDouble() ;
|
|
||||||
|
|
||||||
/* min, max, step and decimals for spin boxes */
|
/* min, max, step and decimals for spin boxes & initial values */
|
||||||
SpinBox_C1A3->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ;
|
GroupPoints->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3);
|
||||||
SpinBox_C1A3->SetValue( 45.0 ) ; /* = myAngle */
|
GroupPoints->SpinBox_DX->SetValue(myAngle);
|
||||||
myAngle = 45.0 ;
|
|
||||||
|
|
||||||
GroupC1->show();
|
|
||||||
myConstructorId = 0 ;
|
|
||||||
Constructor1->setChecked( TRUE );
|
|
||||||
myEditCurrentArgument = LineEditC1A1 ;
|
|
||||||
mySelection = Sel;
|
|
||||||
myGeomGUI = GEOMBase_Context::GetGeomGUI() ;
|
|
||||||
myOkBase = myOkAxis = false ;
|
|
||||||
mySimulationTopoDs.Nullify() ;
|
|
||||||
myBase.Nullify() ;
|
|
||||||
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
|
|
||||||
|
|
||||||
// TODO : set previous selection into argument ?
|
|
||||||
|
|
||||||
/* Filter definitions */
|
|
||||||
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
|
|
||||||
myGeom = GEOM::GEOM_Gen::_narrow(comp);
|
|
||||||
myEdgeFilter = new GEOM_EdgeFilter( StdSelect_Line, myGeom );
|
|
||||||
|
|
||||||
/* signals and slots connections */
|
/* signals and slots connections */
|
||||||
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
|
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||||
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
|
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||||
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
|
|
||||||
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
|
|
||||||
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
|
|
||||||
connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
|
|
||||||
|
|
||||||
connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
|
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||||
connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
|
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||||
|
|
||||||
connect( SpinBox_C1A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
|
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||||
connect( CheckBoxReverse, SIGNAL (stateChanged(int) ), this, SLOT( ReverseAngle(int) ) ) ;
|
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||||
|
|
||||||
|
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||||
|
connect(GroupPoints->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(ReverseVector(int)));
|
||||||
|
|
||||||
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
|
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
|
||||||
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
|
||||||
/* to close dialog if study change */
|
|
||||||
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
|
|
||||||
|
|
||||||
/* Move widget on the botton right corner of main widget */
|
|
||||||
int x, y ;
|
|
||||||
myGeomGUI->DefineDlgPosition( this, x, y ) ;
|
|
||||||
this->move( x, y ) ;
|
|
||||||
this->show() ; /* displays Dialog */
|
|
||||||
|
|
||||||
return ;
|
/* displays Dialog */
|
||||||
|
GroupPoints->show();
|
||||||
|
this->show();
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : ReverseAngle()
|
|
||||||
// purpose : 'state' not used here
|
|
||||||
//=================================================================================
|
|
||||||
void TransformationGUI_RotationDlg::ReverseAngle(int state)
|
|
||||||
{
|
|
||||||
myAngle = -myAngle ;
|
|
||||||
SpinBox_C1A3->SetValue( myAngle ) ;
|
|
||||||
if( myOkBase && myOkAxis ) {
|
|
||||||
MakeRotationSimulationAndDisplay( myBase ) ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
myGeomGUI->EraseSimulationShape() ;
|
|
||||||
mySimulationTopoDs.Nullify() ;
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : ConstructorsClicked()
|
|
||||||
// purpose : Radio button management
|
|
||||||
//=================================================================================
|
|
||||||
void TransformationGUI_RotationDlg::ConstructorsClicked(int constructorId)
|
|
||||||
{
|
|
||||||
/* only a constructor now */
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnOk()
|
// function : ClickOnOk()
|
||||||
@ -284,48 +134,27 @@ void TransformationGUI_RotationDlg::ConstructorsClicked(int constructorId)
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_RotationDlg::ClickOnOk()
|
void TransformationGUI_RotationDlg::ClickOnOk()
|
||||||
{
|
{
|
||||||
this->ClickOnApply() ;
|
this->ClickOnApply();
|
||||||
this->ClickOnCancel() ;
|
ClickOnCancel();
|
||||||
return ;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnApply()
|
// function : ClickOnApply()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_RotationDlg::ClickOnApply()
|
void TransformationGUI_RotationDlg::ClickOnApply()
|
||||||
{
|
{
|
||||||
myGeomGUI->EraseSimulationShape() ;
|
myGeomGUI->GetDesktop()->putInfo(tr(""));
|
||||||
mySimulationTopoDs.Nullify() ;
|
if (mySimulationTopoDs.IsNull())
|
||||||
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
|
return;
|
||||||
|
myGeomGUI->EraseSimulationShape();
|
||||||
|
mySimulationTopoDs.Nullify();
|
||||||
|
|
||||||
switch(myConstructorId)
|
if(myOkBase && myOkAxis)
|
||||||
{
|
myTransformationGUI->MakeRotationAndDisplay(myGeomShape, myLoc, myDir, myAngle*PI180);
|
||||||
case 0 :
|
return;
|
||||||
{
|
|
||||||
if(myOkBase && myOkAxis) {
|
|
||||||
myTransformationGUI->MakeRotationAndDisplay( myGeomShape, myLoc, myDir, myAngle*PI180) ;
|
|
||||||
}
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : ClickOnCancel()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void TransformationGUI_RotationDlg::ClickOnCancel()
|
|
||||||
{
|
|
||||||
mySelection->ClearFilters() ;
|
|
||||||
myGeomGUI->EraseSimulationShape() ;
|
|
||||||
mySimulationTopoDs.Nullify() ;
|
|
||||||
disconnect( mySelection, 0, this, 0 );
|
|
||||||
myGeomGUI->ResetState() ;
|
|
||||||
reject() ;
|
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -335,52 +164,46 @@ void TransformationGUI_RotationDlg::ClickOnCancel()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_RotationDlg::SelectionIntoArgument()
|
void TransformationGUI_RotationDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
myGeomGUI->EraseSimulationShape() ;
|
myGeomGUI->EraseSimulationShape();
|
||||||
mySimulationTopoDs.Nullify() ;
|
mySimulationTopoDs.Nullify();
|
||||||
|
myEditCurrentArgument->setText("");
|
||||||
QString aString = ""; /* name of future selection */
|
QString aString = ""; /* name of selection */
|
||||||
|
|
||||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
|
|
||||||
if ( nbSel != 1 ) {
|
|
||||||
if ( myEditCurrentArgument == LineEditC1A1 ) {
|
|
||||||
LineEditC1A1->setText("") ;
|
|
||||||
myOkBase = false ;
|
|
||||||
}
|
|
||||||
else if ( myEditCurrentArgument == LineEditC1A2 ) {
|
|
||||||
LineEditC1A2->setText("") ;
|
|
||||||
myOkAxis = false ;
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* nbSel == 1 ! */
|
|
||||||
TopoDS_Shape S;
|
|
||||||
Standard_Boolean testResult ;
|
|
||||||
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
|
|
||||||
|
|
||||||
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
|
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
|
||||||
return ;
|
if(nbSel != 1) {
|
||||||
|
if(myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||||
if ( myEditCurrentArgument == LineEditC1A1 ) {
|
myOkBase = false;
|
||||||
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
|
else if(myEditCurrentArgument == GroupPoints->LineEdit2)
|
||||||
if( !testResult )
|
myOkAxis = false;
|
||||||
return ;
|
return;
|
||||||
LineEditC1A1->setText(aString) ;
|
}
|
||||||
myBase = S ;
|
|
||||||
myOkBase = true ;
|
// nbSel == 1
|
||||||
}
|
TopoDS_Shape S;
|
||||||
else if ( myEditCurrentArgument == LineEditC1A2 /*&& myGeomGUI->LinearLocationAndDirection(S, myLoc, myDir) */) {
|
Standard_Boolean testResult;
|
||||||
|
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
|
||||||
|
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||||
|
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
|
||||||
|
if(!testResult)
|
||||||
|
return;
|
||||||
|
myEditCurrentArgument->setText(aString);
|
||||||
|
myOkBase = true;
|
||||||
|
myBase = S;
|
||||||
|
}
|
||||||
|
else if(myEditCurrentArgument == GroupPoints->LineEdit2) {
|
||||||
BRepAdaptor_Curve curv(TopoDS::Edge(S));
|
BRepAdaptor_Curve curv(TopoDS::Edge(S));
|
||||||
myDir = curv.Line().Direction();
|
myDir = curv.Line().Direction();
|
||||||
myLoc = curv.Line().Location();
|
myLoc = curv.Line().Location();
|
||||||
LineEditC1A2->setText(aString) ;
|
myEditCurrentArgument->setText(aString);
|
||||||
myOkAxis = true ;
|
myOkAxis = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( myOkBase && myOkAxis ) {
|
if(myOkBase && myOkAxis)
|
||||||
MakeRotationSimulationAndDisplay( myBase) ;
|
this->MakeRotationSimulationAndDisplay();
|
||||||
}
|
return;
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -391,25 +214,20 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
|
|||||||
void TransformationGUI_RotationDlg::SetEditCurrentArgument()
|
void TransformationGUI_RotationDlg::SetEditCurrentArgument()
|
||||||
{
|
{
|
||||||
QPushButton* send = (QPushButton*)sender();
|
QPushButton* send = (QPushButton*)sender();
|
||||||
switch (myConstructorId)
|
mySelection->ClearFilters();
|
||||||
{
|
|
||||||
case 0: /* default constructor */
|
if(send == GroupPoints->PushButton1) {
|
||||||
{
|
GroupPoints->LineEdit1->setFocus();
|
||||||
if(send == SelectButtonC1A1) {
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
LineEditC1A1->setFocus() ;
|
}
|
||||||
myEditCurrentArgument = LineEditC1A1;
|
else if(send == GroupPoints->PushButton2) {
|
||||||
mySelection->ClearFilters() ;
|
GroupPoints->LineEdit2->setFocus();
|
||||||
}
|
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||||
else if(send == SelectButtonC1A2) {
|
mySelection->AddFilter(myEdgeFilter);
|
||||||
LineEditC1A2->setFocus() ;
|
}
|
||||||
myEditCurrentArgument = LineEditC1A2;
|
this->SelectionIntoArgument();
|
||||||
mySelection->AddFilter(myEdgeFilter) ;
|
|
||||||
}
|
return;
|
||||||
SelectionIntoArgument() ;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -419,59 +237,16 @@ void TransformationGUI_RotationDlg::SetEditCurrentArgument()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_RotationDlg::LineEditReturnPressed()
|
void TransformationGUI_RotationDlg::LineEditReturnPressed()
|
||||||
{
|
{
|
||||||
QLineEdit* send = (QLineEdit*)sender();
|
QLineEdit* send = (QLineEdit*)sender();
|
||||||
if( send == LineEditC1A1 )
|
if(send == GroupPoints->LineEdit1)
|
||||||
myEditCurrentArgument = LineEditC1A1 ;
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
else if ( send == LineEditC1A2 )
|
else if (send == GroupPoints->LineEdit2)
|
||||||
myEditCurrentArgument = LineEditC1A2 ;
|
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||||
else
|
else
|
||||||
return ;
|
return;
|
||||||
|
|
||||||
/* User name of object input management */
|
|
||||||
/* If successfull the selection is changed and signal emitted... */
|
|
||||||
/* so SelectionIntoArgument() is automatically called. */
|
|
||||||
const QString objectUserName = myEditCurrentArgument->text() ;
|
|
||||||
QWidget* thisWidget = (QWidget*)this ;
|
|
||||||
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
|
|
||||||
myEditCurrentArgument->setText( objectUserName ) ;
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||||
//=================================================================================
|
return;
|
||||||
// function : ValueChangedInSpinBox()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void TransformationGUI_RotationDlg::ValueChangedInSpinBox( double newValue )
|
|
||||||
{
|
|
||||||
myAngle = newValue ;
|
|
||||||
if (myOkBase && myOkAxis) {
|
|
||||||
MakeRotationSimulationAndDisplay(myBase) ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
myGeomGUI->EraseSimulationShape() ;
|
|
||||||
mySimulationTopoDs.Nullify() ;
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : DeactivateActiveDialog()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void TransformationGUI_RotationDlg::DeactivateActiveDialog()
|
|
||||||
{
|
|
||||||
if ( GroupConstructors->isEnabled() ) {
|
|
||||||
GroupConstructors->setEnabled(false) ;
|
|
||||||
GroupC1->setEnabled(false) ;
|
|
||||||
GroupButtons->setEnabled(false) ;
|
|
||||||
disconnect( mySelection, 0, this, 0 );
|
|
||||||
myGeomGUI->EraseSimulationShape() ;
|
|
||||||
mySelection->ClearFilters() ;
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -481,39 +256,37 @@ void TransformationGUI_RotationDlg::DeactivateActiveDialog()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_RotationDlg::ActivateThisDialog()
|
void TransformationGUI_RotationDlg::ActivateThisDialog()
|
||||||
{
|
{
|
||||||
/* Emit a signal to deactivate the active dialog */
|
GEOMBase_Skeleton::ActivateThisDialog();
|
||||||
myGeomGUI->EmitSignalDeactivateDialog() ;
|
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||||
GroupConstructors->setEnabled(true) ;
|
if(!mySimulationTopoDs.IsNull())
|
||||||
GroupC1->setEnabled(true) ;
|
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||||
GroupButtons->setEnabled(true) ;
|
return;
|
||||||
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
|
||||||
if( !mySimulationTopoDs.IsNull() )
|
|
||||||
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
|
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : enterEvent()
|
// function : enterEvent()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_RotationDlg::enterEvent(QEvent* e)
|
void TransformationGUI_RotationDlg::enterEvent(QEvent* e)
|
||||||
{
|
{
|
||||||
if ( GroupConstructors->isEnabled() )
|
if (GroupConstructors->isEnabled())
|
||||||
return ;
|
return;
|
||||||
ActivateThisDialog() ;
|
this->ActivateThisDialog();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : closeEvent()
|
// function : ValueChangedInSpinBox()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_RotationDlg::closeEvent( QCloseEvent* e )
|
void TransformationGUI_RotationDlg::ValueChangedInSpinBox(double newValue)
|
||||||
{
|
{
|
||||||
this->ClickOnCancel() ; /* same than click on cancel button */
|
myAngle = newValue;
|
||||||
|
if(myOkBase && myOkAxis)
|
||||||
|
MakeRotationSimulationAndDisplay();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -521,24 +294,36 @@ void TransformationGUI_RotationDlg::closeEvent( QCloseEvent* e )
|
|||||||
// function : MakeRotationSimulationAndDisplay()
|
// function : MakeRotationSimulationAndDisplay()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_RotationDlg::MakeRotationSimulationAndDisplay( const TopoDS_Shape& S)
|
void TransformationGUI_RotationDlg::MakeRotationSimulationAndDisplay()
|
||||||
{
|
{
|
||||||
myGeomGUI->EraseSimulationShape() ;
|
myGeomGUI->EraseSimulationShape();
|
||||||
|
mySimulationTopoDs.Nullify();
|
||||||
if( S.IsNull() )
|
|
||||||
return ;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
gp_Ax1 AX( this->myLoc, this->myDir ) ;
|
gp_Ax1 AX(myLoc, myDir);
|
||||||
gp_Trsf theTransformation ;
|
gp_Trsf theTransformation;
|
||||||
theTransformation.SetRotation(AX, this->myAngle*PI180 ) ;
|
theTransformation.SetRotation(AX, myAngle*PI180);
|
||||||
BRepBuilderAPI_Transform myBRepTransformation(S, theTransformation, Standard_False) ;
|
BRepBuilderAPI_Transform myBRepTransformation(myBase, theTransformation, Standard_False);
|
||||||
this->mySimulationTopoDs = myBRepTransformation.Shape() ;
|
this->mySimulationTopoDs = myBRepTransformation.Shape();
|
||||||
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
|
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||||
}
|
}
|
||||||
catch(Standard_Failure) {
|
catch(Standard_Failure) {
|
||||||
MESSAGE( "Exception catched in MakeRotationSimulationAndDisplay" ) ;
|
MESSAGE("Exception catched in MakeRotationSimulationAndDisplay");
|
||||||
return ;
|
return;
|
||||||
}
|
}
|
||||||
return ;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : ReverseAngle()
|
||||||
|
// purpose : 'state' not used here
|
||||||
|
//=================================================================================
|
||||||
|
void TransformationGUI_RotationDlg::ReverseAngle(int state)
|
||||||
|
{
|
||||||
|
myAngle = -myAngle;
|
||||||
|
GroupPoints->SpinBox_DX->SetValue(myAngle);
|
||||||
|
if(myOkBase && myOkAxis)
|
||||||
|
MakeRotationSimulationAndDisplay();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
@ -29,101 +29,55 @@
|
|||||||
#ifndef DIALOGBOX_ROTATION_H
|
#ifndef DIALOGBOX_ROTATION_H
|
||||||
#define DIALOGBOX_ROTATION_H
|
#define DIALOGBOX_ROTATION_H
|
||||||
|
|
||||||
|
#include "GEOMBase_Skeleton.h"
|
||||||
|
#include "DlgRef_2Sel1Spin1Check.h"
|
||||||
|
|
||||||
#include "TransformationGUI.h"
|
#include "TransformationGUI.h"
|
||||||
|
|
||||||
#include "GEOM_EdgeFilter.hxx"
|
|
||||||
#include "DlgRef_SpinBox.h"
|
|
||||||
|
|
||||||
#include <TopLoc_Location.hxx>
|
|
||||||
#include <BRepBuilderAPI_Transform.hxx>
|
|
||||||
#include <gp_Dir.hxx>
|
#include <gp_Dir.hxx>
|
||||||
|
|
||||||
#include <qvariant.h>
|
|
||||||
#include <qdialog.h>
|
|
||||||
|
|
||||||
class QVBoxLayout;
|
|
||||||
class QHBoxLayout;
|
|
||||||
class QGridLayout;
|
|
||||||
class QButtonGroup;
|
|
||||||
class QCheckBox;
|
|
||||||
class QGroupBox;
|
|
||||||
class QLabel;
|
|
||||||
class QLineEdit;
|
|
||||||
class QPushButton;
|
|
||||||
class QRadioButton;
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : TransformationGUI_RotationDlg
|
// class : TransformationGUI_RotationDlg
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
class TransformationGUI_RotationDlg : public QDialog
|
class TransformationGUI_RotationDlg : public GEOMBase_Skeleton
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TransformationGUI_RotationDlg( QWidget* parent = 0, const char* name = 0, TransformationGUI* theTransformationGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
|
TransformationGUI_RotationDlg(QWidget* parent = 0, const char* name = 0, TransformationGUI* theTransformationGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
|
||||||
~TransformationGUI_RotationDlg();
|
~TransformationGUI_RotationDlg();
|
||||||
|
|
||||||
private :
|
private :
|
||||||
|
void Init();
|
||||||
|
void enterEvent(QEvent* e);
|
||||||
|
void MakeRotationSimulationAndDisplay();
|
||||||
|
|
||||||
TransformationGUI* myTransformationGUI;
|
TransformationGUI* myTransformationGUI;
|
||||||
GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */
|
|
||||||
GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */
|
|
||||||
SALOME_Selection* mySelection ; /* User shape selection */
|
|
||||||
TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */
|
|
||||||
TopoDS_Shape myBase ;
|
|
||||||
GEOM::GEOM_Shape_var myGeomShape ; /* is myBase */
|
|
||||||
|
|
||||||
gp_Pnt myLoc ;
|
double step;
|
||||||
gp_Dir myDir ;
|
Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* Filters selection */
|
||||||
Standard_Real myAngle ;
|
|
||||||
|
|
||||||
bool myOkBase ;
|
|
||||||
bool myOkAxis ;
|
|
||||||
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
|
|
||||||
int myConstructorId ; /* Current constructor id = radio button id */
|
|
||||||
Handle(GEOM_EdgeFilter) myEdgeFilter; /* Filter selection */
|
|
||||||
|
|
||||||
void closeEvent( QCloseEvent* e ) ;
|
TopoDS_Shape myBase;
|
||||||
void enterEvent( QEvent* e);
|
GEOM::GEOM_Shape_var myGeomShape; /* is myBase */
|
||||||
void Init( SALOME_Selection* Sel ) ;
|
gp_Pnt myLoc;
|
||||||
void MakeRotationSimulationAndDisplay( const TopoDS_Shape& S) ;
|
gp_Dir myDir;
|
||||||
|
Standard_Real myAngle;
|
||||||
|
bool myOkBase;
|
||||||
|
bool myOkAxis;
|
||||||
|
|
||||||
QButtonGroup* GroupConstructors;
|
DlgRef_2Sel1Spin1Check* GroupPoints;
|
||||||
QRadioButton* Constructor1;
|
|
||||||
QGroupBox* GroupButtons;
|
|
||||||
QPushButton* buttonOk;
|
|
||||||
QPushButton* buttonCancel;
|
|
||||||
QPushButton* buttonApply;
|
|
||||||
QGroupBox* GroupC1;
|
|
||||||
QPushButton* SelectButtonC1A2;
|
|
||||||
QLineEdit* LineEditC1A1;
|
|
||||||
QLineEdit* LineEditC1A2;
|
|
||||||
QPushButton* SelectButtonC1A1;
|
|
||||||
QLabel* TextLabelC1A1;
|
|
||||||
QLabel* TextLabelC1A2;
|
|
||||||
DlgRef_SpinBox* SpinBox_C1A3 ; /* for angle */
|
|
||||||
QLabel* TextLabelC1A3;
|
|
||||||
QCheckBox* CheckBoxReverse;
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
|
||||||
void ConstructorsClicked(int constructorId);
|
|
||||||
void ClickOnOk();
|
void ClickOnOk();
|
||||||
void ClickOnCancel();
|
|
||||||
void ClickOnApply();
|
void ClickOnApply();
|
||||||
void SetEditCurrentArgument() ;
|
void ActivateThisDialog();
|
||||||
void SelectionIntoArgument() ;
|
void LineEditReturnPressed();
|
||||||
void LineEditReturnPressed() ;
|
void SelectionIntoArgument();
|
||||||
void DeactivateActiveDialog() ;
|
void SetEditCurrentArgument();
|
||||||
void ActivateThisDialog() ;
|
void ReverseAngle(int state);
|
||||||
void ReverseAngle(int state) ;
|
void ValueChangedInSpinBox(double newValue);
|
||||||
void ValueChangedInSpinBox( double newValue ) ;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
QGridLayout* TransformationGUI_RotationDlgLayout;
|
|
||||||
QGridLayout* GroupConstructorsLayout;
|
|
||||||
QGridLayout* GroupButtonsLayout;
|
|
||||||
QGridLayout* GroupC1Layout;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOGBOX_ROTATION_H
|
#endif // DIALOGBOX_ROTATION_H
|
||||||
|
@ -31,21 +31,6 @@ using namespace std;
|
|||||||
|
|
||||||
#include <BRepBuilderAPI_Transform.hxx>
|
#include <BRepBuilderAPI_Transform.hxx>
|
||||||
|
|
||||||
#include <qbuttongroup.h>
|
|
||||||
#include <qgroupbox.h>
|
|
||||||
#include <qlabel.h>
|
|
||||||
#include <qlineedit.h>
|
|
||||||
#include <qpushbutton.h>
|
|
||||||
#include <qradiobutton.h>
|
|
||||||
#include <qlayout.h>
|
|
||||||
#include <qvariant.h>
|
|
||||||
#include <qtooltip.h>
|
|
||||||
#include <qwhatsthis.h>
|
|
||||||
#include <qimage.h>
|
|
||||||
#include <qvalidator.h>
|
|
||||||
#include <qpixmap.h>
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : TransformationGUI_ScaleDlg()
|
// class : TransformationGUI_ScaleDlg()
|
||||||
// purpose : Constructs a TransformationGUI_ScaleDlg which is a child of 'parent', with the
|
// purpose : Constructs a TransformationGUI_ScaleDlg which is a child of 'parent', with the
|
||||||
@ -53,118 +38,37 @@ using namespace std;
|
|||||||
// The dialog will by default be modeless, unless you set 'modal' to
|
// The dialog will by default be modeless, unless you set 'modal' to
|
||||||
// TRUE to construct a modal dialog.
|
// TRUE to construct a modal dialog.
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg( QWidget* parent, const char* name, TransformationGUI* theTransformationGUI, SALOME_Selection* Sel, bool modal, WFlags fl )
|
TransformationGUI_ScaleDlg::TransformationGUI_ScaleDlg(QWidget* parent, const char* name, TransformationGUI* theTransformationGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
|
||||||
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
|
:GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
|
||||||
{
|
{
|
||||||
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_SCALE")));
|
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SCALE")));
|
||||||
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
|
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
|
||||||
|
|
||||||
if ( !name )
|
setCaption(tr("GEOM_SCALE_TITLE"));
|
||||||
setName( "TransformationGUI_ScaleDlg" );
|
|
||||||
resize( 303, 253 );
|
|
||||||
setCaption( tr( "GEOM_SCALE_TITLE" ) );
|
|
||||||
setSizeGripEnabled( TRUE );
|
|
||||||
TransformationGUI_ScaleDlgLayout = new QGridLayout( this );
|
|
||||||
TransformationGUI_ScaleDlgLayout->setSpacing( 6 );
|
|
||||||
TransformationGUI_ScaleDlgLayout->setMargin( 11 );
|
|
||||||
|
|
||||||
/***************************************************************/
|
|
||||||
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
|
|
||||||
GroupConstructors->setTitle( tr( "GEOM_SCALE" ) );
|
|
||||||
GroupConstructors->setExclusive( TRUE );
|
|
||||||
GroupConstructors->setColumnLayout(0, Qt::Vertical );
|
|
||||||
GroupConstructors->layout()->setSpacing( 0 );
|
|
||||||
GroupConstructors->layout()->setMargin( 0 );
|
|
||||||
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
|
|
||||||
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
|
|
||||||
GroupConstructorsLayout->setSpacing( 6 );
|
|
||||||
GroupConstructorsLayout->setMargin( 11 );
|
|
||||||
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
|
|
||||||
GroupConstructorsLayout->addItem( spacer, 0, 1 );
|
|
||||||
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
|
|
||||||
Constructor1->setText( tr( "" ) );
|
|
||||||
Constructor1->setPixmap( image0 );
|
|
||||||
Constructor1->setChecked( TRUE );
|
|
||||||
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
|
|
||||||
Constructor1->setMinimumSize( QSize( 50, 0 ) );
|
|
||||||
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
|
|
||||||
TransformationGUI_ScaleDlgLayout->addWidget( GroupConstructors, 0, 0 );
|
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
GroupC1 = new QGroupBox( this, "GroupC1" );
|
GroupConstructors->setTitle(tr("GEOM_SCALE"));
|
||||||
GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) );
|
RadioButton1->setPixmap(image0);
|
||||||
GroupC1->setColumnLayout(0, Qt::Vertical );
|
RadioButton2->close(TRUE);
|
||||||
GroupC1->layout()->setSpacing( 0 );
|
RadioButton3->close(TRUE);
|
||||||
GroupC1->layout()->setMargin( 0 );
|
|
||||||
GroupC1Layout = new QGridLayout( GroupC1->layout() );
|
|
||||||
GroupC1Layout->setAlignment( Qt::AlignTop );
|
|
||||||
GroupC1Layout->setSpacing( 6 );
|
|
||||||
GroupC1Layout->setMargin( 11 );
|
|
||||||
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
|
|
||||||
TextLabelC1A1->setText( tr( "GEOM_OBJECT" ) );
|
|
||||||
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
|
|
||||||
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
|
|
||||||
TextLabelC1A1->setFrameShadow( QLabel::Plain );
|
|
||||||
GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
|
|
||||||
TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" );
|
|
||||||
TextLabelC1A2->setText( tr( "GEOM_CENTRAL_POINT" ) );
|
|
||||||
TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
|
|
||||||
TextLabelC1A2->setFrameShape( QLabel::NoFrame );
|
|
||||||
TextLabelC1A2->setFrameShadow( QLabel::Plain );
|
|
||||||
GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
|
|
||||||
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
|
|
||||||
SelectButtonC1A1->setText( tr( "" ) );
|
|
||||||
SelectButtonC1A1->setPixmap( image1 );
|
|
||||||
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
|
|
||||||
SelectButtonC1A2 = new QPushButton( GroupC1, "SelectButtonC1A2" );
|
|
||||||
SelectButtonC1A2->setText( tr( "" ) );
|
|
||||||
SelectButtonC1A2->setPixmap( image1 );
|
|
||||||
GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 );
|
|
||||||
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
|
|
||||||
LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) );
|
|
||||||
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
|
|
||||||
LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
|
|
||||||
GroupC1Layout->addWidget( LineEditC1A2, 1, 2 );
|
|
||||||
LineEditC1A3 = new QLineEdit( GroupC1, "LineEditC1A3" );
|
|
||||||
GroupC1Layout->addWidget( LineEditC1A3, 2, 2 );
|
|
||||||
TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" );
|
|
||||||
TextLabelC1A3->setText( tr( "GEOM_SCALE_FACTOR" ) );
|
|
||||||
TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) );
|
|
||||||
GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 );
|
|
||||||
TransformationGUI_ScaleDlgLayout->addWidget( GroupC1, 1, 0 );
|
|
||||||
|
|
||||||
/***************************************************************/
|
GroupPoints = new DlgRef_2Sel1Spin(this, "GroupPoints");
|
||||||
GroupButtons = new QGroupBox( this, "GroupButtons" );
|
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
|
||||||
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
|
GroupPoints->TextLabel1->setText(tr("GEOM_OBJECT"));
|
||||||
GroupButtons->setTitle( tr( "" ) );
|
GroupPoints->TextLabel2->setText(tr("GEOM_CENTRAL_POINT"));
|
||||||
GroupButtons->setColumnLayout(0, Qt::Vertical );
|
GroupPoints->TextLabel3->setText(tr("GEOM_SCALE_FACTOR"));
|
||||||
GroupButtons->layout()->setSpacing( 0 );
|
GroupPoints->PushButton1->setPixmap(image1);
|
||||||
GroupButtons->layout()->setMargin( 0 );
|
GroupPoints->PushButton2->setPixmap(image1);
|
||||||
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
|
|
||||||
GroupButtonsLayout->setAlignment( Qt::AlignTop );
|
Layout1->addWidget(GroupPoints, 1, 0);
|
||||||
GroupButtonsLayout->setSpacing( 6 );
|
/***************************************************************/
|
||||||
GroupButtonsLayout->setMargin( 11 );
|
|
||||||
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
|
/* Initialisations */
|
||||||
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
|
myTransformationGUI = theTransformationGUI;
|
||||||
buttonCancel->setAutoDefault( TRUE );
|
Init();
|
||||||
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
|
|
||||||
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
|
|
||||||
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
|
|
||||||
buttonApply->setAutoDefault( TRUE );
|
|
||||||
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
|
|
||||||
QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
|
|
||||||
GroupButtonsLayout->addItem( spacer_9, 0, 2 );
|
|
||||||
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
|
|
||||||
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
|
|
||||||
buttonOk->setAutoDefault( TRUE );
|
|
||||||
buttonOk->setDefault( TRUE );
|
|
||||||
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
|
|
||||||
TransformationGUI_ScaleDlgLayout->addWidget( GroupButtons, 2, 0 );
|
|
||||||
myTransformationGUI = theTransformationGUI;
|
|
||||||
/* Initialisation */
|
|
||||||
Init( Sel ) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ~TransformationGUI_ScaleDlg()
|
// function : ~TransformationGUI_ScaleDlg()
|
||||||
// purpose : Destroys the object and frees any allocated resources
|
// purpose : Destroys the object and frees any allocated resources
|
||||||
@ -179,237 +83,141 @@ TransformationGUI_ScaleDlg::~TransformationGUI_ScaleDlg()
|
|||||||
// function : Init()
|
// function : Init()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_ScaleDlg::Init( SALOME_Selection* Sel )
|
void TransformationGUI_ScaleDlg::Init()
|
||||||
{
|
{
|
||||||
|
/* init variables */
|
||||||
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
|
|
||||||
LineEditC1A3->setMaxLength( 10 );
|
myPoint1.SetCoord(0.0, 0.0, 0.0);
|
||||||
QDoubleValidator *Va = new QDoubleValidator( -999999, +999999, 3, LineEditC1A3 ) ;
|
myOkPoint1 = myOkBaseTopo = false;
|
||||||
LineEditC1A3->setValidator( Va ) ;
|
myFactor = 2.0;
|
||||||
|
|
||||||
GroupC1->show();
|
myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom);
|
||||||
myConstructorId = 0 ;
|
|
||||||
Constructor1->setChecked( TRUE );
|
|
||||||
myEditCurrentArgument = LineEditC1A1 ;
|
|
||||||
mySelection = Sel;
|
|
||||||
myGeomGUI = GEOMBase_Context::GetGeomGUI() ;
|
|
||||||
myPoint1.SetCoord( 0.0, 0.0, 0.0 );
|
|
||||||
myOkPoint1 = myOkBaseTopo = false ;
|
|
||||||
myFactor = 2.0 ;
|
|
||||||
LineEditC1A3->setText("2.0") ;
|
|
||||||
mySimulationTopoDs.Nullify() ;
|
|
||||||
myBaseTopo.Nullify() ;
|
|
||||||
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
|
|
||||||
|
|
||||||
// TODO : previous selection into argument ?
|
/* Get setting of step value from file configuration */
|
||||||
|
QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep");
|
||||||
|
step = St.toDouble();
|
||||||
|
|
||||||
/* Filters definition */
|
/* min, max, step and decimals for spin boxes & initial values */
|
||||||
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
|
GroupPoints->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3);
|
||||||
myGeom = GEOM::GEOM_Gen::_narrow(comp);
|
GroupPoints->SpinBox_DX->SetValue(myFactor);
|
||||||
myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom );
|
|
||||||
mySelection->AddFilter(myVertexFilter) ; /* first filter used */
|
|
||||||
|
|
||||||
/* signals and slots connections */
|
/* signals and slots connections */
|
||||||
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
|
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||||
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
|
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||||
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
|
|
||||||
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
|
|
||||||
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
|
|
||||||
connect( SelectButtonC1A2, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
|
|
||||||
|
|
||||||
connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
|
|
||||||
connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
|
|
||||||
|
|
||||||
connect( LineEditC1A3, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ;
|
|
||||||
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
|
|
||||||
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
|
||||||
/* to close dialog if study change */
|
|
||||||
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
|
|
||||||
|
|
||||||
/* Move widget on the botton right corner of main widget */
|
|
||||||
int x, y ;
|
|
||||||
myGeomGUI->DefineDlgPosition( this, x, y ) ;
|
|
||||||
this->move( x, y ) ;
|
|
||||||
this->show() ; /* displays Dialog */
|
|
||||||
|
|
||||||
return ;
|
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||||
|
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||||
|
|
||||||
|
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||||
|
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||||
|
|
||||||
|
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||||
|
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double)));
|
||||||
|
|
||||||
|
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
|
||||||
|
|
||||||
|
/* displays Dialog */
|
||||||
|
GroupPoints->show();
|
||||||
|
this->show();
|
||||||
|
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : ConstructorsClicked()
|
|
||||||
// purpose : Radio button management
|
|
||||||
//=================================================================================
|
|
||||||
void TransformationGUI_ScaleDlg::ConstructorsClicked(int constructorId)
|
|
||||||
{
|
|
||||||
myGeomGUI->EraseSimulationShape() ;
|
|
||||||
|
|
||||||
switch (constructorId)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
GroupC1->show();
|
|
||||||
myConstructorId = constructorId ;
|
|
||||||
myEditCurrentArgument = LineEditC1A1 ;
|
|
||||||
Constructor1->setChecked( TRUE );
|
|
||||||
LineEditC1A1->setText(tr("")) ;
|
|
||||||
LineEditC1A2->setText(tr("")) ;
|
|
||||||
myOkPoint1 = myOkBaseTopo = false ;
|
|
||||||
myFactor = 2.0 ;
|
|
||||||
/* filter for next selections */
|
|
||||||
mySelection->ClearFilters() ;
|
|
||||||
mySelection->AddFilter( myVertexFilter );
|
|
||||||
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnOk()
|
// function : ClickOnOk()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_ScaleDlg::ClickOnOk()
|
void TransformationGUI_ScaleDlg::ClickOnOk()
|
||||||
{
|
{
|
||||||
this->ClickOnApply() ;
|
this->ClickOnApply();
|
||||||
this->ClickOnCancel() ;
|
ClickOnCancel();
|
||||||
|
return;
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnApply()
|
// function : ClickOnApply()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_ScaleDlg::ClickOnApply()
|
void TransformationGUI_ScaleDlg::ClickOnApply()
|
||||||
{
|
{
|
||||||
myGeomGUI->EraseSimulationShape() ;
|
myGeomGUI->GetDesktop()->putInfo(tr(""));
|
||||||
mySimulationTopoDs.Nullify() ;
|
if (mySimulationTopoDs.IsNull())
|
||||||
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
|
return;
|
||||||
|
myGeomGUI->EraseSimulationShape();
|
||||||
|
mySimulationTopoDs.Nullify();
|
||||||
|
|
||||||
switch(myConstructorId)
|
if(myOkBaseTopo && myOkPoint1)
|
||||||
{
|
myTransformationGUI->MakeScaleAndDisplay(myGeomShape, myPoint1, myFactor);
|
||||||
case 0 :
|
return;
|
||||||
{
|
|
||||||
if( myOkBaseTopo && myOkPoint1 )
|
|
||||||
myTransformationGUI->MakeScaleAndDisplay(myGeomShape, myPoint1, myFactor ) ;
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// accept();
|
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : ClickOnCancel()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void TransformationGUI_ScaleDlg::ClickOnCancel()
|
|
||||||
{
|
|
||||||
mySelection->ClearFilters() ;
|
|
||||||
myGeomGUI->EraseSimulationShape() ;
|
|
||||||
mySimulationTopoDs.Nullify() ;
|
|
||||||
disconnect( mySelection, 0, this, 0 );
|
|
||||||
myGeomGUI->ResetState() ;
|
|
||||||
reject() ;
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : LineEditReturnPressed()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void TransformationGUI_ScaleDlg::LineEditReturnPressed()
|
|
||||||
{
|
|
||||||
QLineEdit* send = (QLineEdit*)sender();
|
|
||||||
if( send == LineEditC1A1 )
|
|
||||||
myEditCurrentArgument = LineEditC1A1 ;
|
|
||||||
else if ( send == LineEditC1A2 )
|
|
||||||
myEditCurrentArgument = LineEditC1A2 ;
|
|
||||||
else
|
|
||||||
return ;
|
|
||||||
|
|
||||||
/* User name of object input management */
|
|
||||||
/* If successfull the selection is changed and signal emitted... */
|
|
||||||
/* so SelectionIntoArgument() is automatically called. */
|
|
||||||
const QString objectUserName = myEditCurrentArgument->text() ;
|
|
||||||
QWidget* thisWidget = (QWidget*)this ;
|
|
||||||
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
|
|
||||||
myEditCurrentArgument->setText( objectUserName ) ;
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : TextChangedInLineEdit()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void TransformationGUI_ScaleDlg::TextChangedInLineEdit(const QString& newText)
|
|
||||||
{
|
|
||||||
QLineEdit* send = (QLineEdit*)sender();
|
|
||||||
if(send == LineEditC1A3) {
|
|
||||||
myGeomGUI->EraseSimulationShape() ;
|
|
||||||
myFactor = newText.toFloat();
|
|
||||||
if( fabs(myFactor) > 0.00001 && myOkBaseTopo && myOkPoint1 )
|
|
||||||
MakeScaleSimulationAndDisplay(myBaseTopo) ;
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : SelectionIntoArgument()
|
// function : SelectionIntoArgument()
|
||||||
// purpose : Called when selection as changed or other case
|
// purpose : Called when selection as changed or other case
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_ScaleDlg::SelectionIntoArgument()
|
void TransformationGUI_ScaleDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
myEditCurrentArgument->setText("") ;
|
myGeomGUI->EraseSimulationShape();
|
||||||
myGeomGUI->EraseSimulationShape() ;
|
mySimulationTopoDs.Nullify();
|
||||||
mySimulationTopoDs.Nullify() ;
|
myEditCurrentArgument->setText("");
|
||||||
|
|
||||||
QString aString = ""; /* name of selection */
|
QString aString = ""; /* name of selection */
|
||||||
|
|
||||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
|
|
||||||
if ( nbSel != 1 ) {
|
|
||||||
if ( myEditCurrentArgument == LineEditC1A1 ) {
|
|
||||||
myEditCurrentArgument->setText("") ;
|
|
||||||
myOkBaseTopo = false ;
|
|
||||||
}
|
|
||||||
else if ( myEditCurrentArgument == LineEditC1A2 ) {
|
|
||||||
myEditCurrentArgument->setText("") ;
|
|
||||||
myOkPoint1 = false ;
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
// nbSel == 1
|
|
||||||
TopoDS_Shape S;
|
|
||||||
Standard_Boolean testResult ;
|
|
||||||
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
|
|
||||||
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
|
|
||||||
return ;
|
|
||||||
|
|
||||||
/* Constructor */
|
|
||||||
if ( myEditCurrentArgument == LineEditC1A1 ) {
|
|
||||||
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
|
|
||||||
if( !testResult )
|
|
||||||
return ;
|
|
||||||
myEditCurrentArgument->setText(aString) ;
|
|
||||||
myBaseTopo = S ;
|
|
||||||
myOkBaseTopo = true ;
|
|
||||||
}
|
|
||||||
else if ( myEditCurrentArgument == LineEditC1A2 && myGeomGUI->VertexToPoint(S, myPoint1) ) {
|
|
||||||
myEditCurrentArgument->setText(aString) ;
|
|
||||||
myOkPoint1 = true ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( myOkBaseTopo && myOkPoint1 ) {
|
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
|
||||||
MakeScaleSimulationAndDisplay( myBaseTopo ) ;
|
if (nbSel != 1) {
|
||||||
|
if(myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||||
|
myOkBaseTopo = false;
|
||||||
|
else if (myEditCurrentArgument == GroupPoints->LineEdit2)
|
||||||
|
myOkPoint1 = false;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return ;
|
|
||||||
|
/* nbSel == 1 */
|
||||||
|
TopoDS_Shape S;
|
||||||
|
Standard_Boolean testResult;
|
||||||
|
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
|
||||||
|
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* gp_Pnt : not used */
|
||||||
|
if(myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||||
|
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
|
||||||
|
if(!testResult)
|
||||||
|
return ;
|
||||||
|
GroupPoints->LineEdit1->setText(aString);
|
||||||
|
myBaseTopo = S;
|
||||||
|
myOkBaseTopo = true;
|
||||||
|
}
|
||||||
|
else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomGUI->VertexToPoint(S, myPoint1)) {
|
||||||
|
GroupPoints->LineEdit2->setText(aString);
|
||||||
|
myOkPoint1 = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(myOkPoint1 && myOkBaseTopo)
|
||||||
|
this->MakeScaleSimulationAndDisplay();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// function : LineEditReturnPressed()
|
||||||
|
// purpose :
|
||||||
|
//=================================================================================
|
||||||
|
void TransformationGUI_ScaleDlg::LineEditReturnPressed()
|
||||||
|
{
|
||||||
|
QLineEdit* send = (QLineEdit*)sender();
|
||||||
|
if(send == GroupPoints->LineEdit1)
|
||||||
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
|
else if (send == GroupPoints->LineEdit2)
|
||||||
|
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||||
|
else
|
||||||
|
return;
|
||||||
|
|
||||||
|
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -420,46 +228,21 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument()
|
|||||||
void TransformationGUI_ScaleDlg::SetEditCurrentArgument()
|
void TransformationGUI_ScaleDlg::SetEditCurrentArgument()
|
||||||
{
|
{
|
||||||
QPushButton* send = (QPushButton*)sender();
|
QPushButton* send = (QPushButton*)sender();
|
||||||
switch (myConstructorId)
|
mySelection->ClearFilters();
|
||||||
{
|
|
||||||
case 0: /* default constructor */
|
|
||||||
{
|
|
||||||
if(send == SelectButtonC1A1) {
|
|
||||||
LineEditC1A1->setFocus() ;
|
|
||||||
myEditCurrentArgument = LineEditC1A1;
|
|
||||||
mySelection->ClearFilters() ;
|
|
||||||
SelectionIntoArgument() ;
|
|
||||||
}
|
|
||||||
else if(send == SelectButtonC1A2) {
|
|
||||||
LineEditC1A2->setFocus() ;
|
|
||||||
myEditCurrentArgument = LineEditC1A2;
|
|
||||||
mySelection->AddFilter(myVertexFilter) ;
|
|
||||||
SelectionIntoArgument() ;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if(send == GroupPoints->PushButton1) {
|
||||||
//=================================================================================
|
GroupPoints->LineEdit1->setFocus();
|
||||||
// function : DeactivateActiveDialog()
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void TransformationGUI_ScaleDlg::DeactivateActiveDialog()
|
|
||||||
{
|
|
||||||
if ( GroupConstructors->isEnabled() ) {
|
|
||||||
GroupConstructors->setEnabled(false) ;
|
|
||||||
GroupC1->setEnabled(false) ;
|
|
||||||
GroupButtons->setEnabled(false) ;
|
|
||||||
disconnect( mySelection, 0, this, 0 );
|
|
||||||
myGeomGUI->EraseSimulationShape() ;
|
|
||||||
mySelection->ClearFilters() ;
|
|
||||||
}
|
}
|
||||||
return ;
|
else if(send == GroupPoints->PushButton2) {
|
||||||
}
|
GroupPoints->LineEdit2->setFocus();
|
||||||
|
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||||
|
mySelection->AddFilter(myVertexFilter);
|
||||||
|
}
|
||||||
|
this->SelectionIntoArgument();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
@ -468,17 +251,11 @@ void TransformationGUI_ScaleDlg::DeactivateActiveDialog()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_ScaleDlg::ActivateThisDialog()
|
void TransformationGUI_ScaleDlg::ActivateThisDialog()
|
||||||
{
|
{
|
||||||
/* Emit a signal to deactivate the active dialog */
|
GEOMBase_Skeleton::ActivateThisDialog();
|
||||||
myGeomGUI->EmitSignalDeactivateDialog() ;
|
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||||
GroupConstructors->setEnabled(true) ;
|
if(!mySimulationTopoDs.IsNull())
|
||||||
GroupC1->setEnabled(true) ;
|
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||||
GroupButtons->setEnabled(true) ;
|
return;
|
||||||
|
|
||||||
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
|
||||||
if( !mySimulationTopoDs.IsNull() )
|
|
||||||
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
|
|
||||||
|
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -488,19 +265,23 @@ void TransformationGUI_ScaleDlg::ActivateThisDialog()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_ScaleDlg::enterEvent(QEvent* e)
|
void TransformationGUI_ScaleDlg::enterEvent(QEvent* e)
|
||||||
{
|
{
|
||||||
if ( GroupConstructors->isEnabled() )
|
if(GroupConstructors->isEnabled())
|
||||||
return ;
|
return;
|
||||||
ActivateThisDialog() ;
|
this->ActivateThisDialog();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : closeEvent()
|
// function : ValueChangedInSpinBox()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_ScaleDlg::closeEvent( QCloseEvent* e )
|
void TransformationGUI_ScaleDlg::ValueChangedInSpinBox(double newValue)
|
||||||
{
|
{
|
||||||
this->ClickOnCancel() ; /* same than click on cancel button */
|
myFactor = newValue;
|
||||||
|
if(fabs(myFactor) > 0.00001 && myOkPoint1 && myOkBaseTopo)
|
||||||
|
MakeScaleSimulationAndDisplay();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -508,23 +289,24 @@ void TransformationGUI_ScaleDlg::closeEvent( QCloseEvent* e )
|
|||||||
// function : MakeScaleSimulationAndDisplay()
|
// function : MakeScaleSimulationAndDisplay()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_ScaleDlg::MakeScaleSimulationAndDisplay( const TopoDS_Shape& S )
|
void TransformationGUI_ScaleDlg::MakeScaleSimulationAndDisplay()
|
||||||
{
|
{
|
||||||
this->mySimulationTopoDs.Nullify() ;
|
myGeomGUI->EraseSimulationShape();
|
||||||
|
mySimulationTopoDs.Nullify();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
gp_Trsf theTransformation ;
|
gp_Trsf theTransformation;
|
||||||
theTransformation.SetScale( myPoint1, myFactor) ;
|
theTransformation.SetScale(myPoint1, myFactor);
|
||||||
BRepBuilderAPI_Transform myBRepTransformation( S, theTransformation, Standard_False) ;
|
BRepBuilderAPI_Transform myBRepTransformation(myBaseTopo, theTransformation, Standard_False);
|
||||||
mySimulationTopoDs = myBRepTransformation.Shape() ;
|
mySimulationTopoDs = myBRepTransformation.Shape();
|
||||||
if( mySimulationTopoDs.IsNull() )
|
if(mySimulationTopoDs.IsNull())
|
||||||
return ;
|
return;
|
||||||
else
|
else
|
||||||
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
|
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||||
}
|
}
|
||||||
catch(Standard_Failure) {
|
catch(Standard_Failure) {
|
||||||
MESSAGE( "Exception catched in MakeScaleSimulationAndDisplay" ) ;
|
MESSAGE("Exception catched in MakeScaleSimulationAndDisplay");
|
||||||
return ;
|
return;
|
||||||
}
|
}
|
||||||
return ;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -29,89 +29,51 @@
|
|||||||
#ifndef DIALOGBOX_SCALE_H
|
#ifndef DIALOGBOX_SCALE_H
|
||||||
#define DIALOGBOX_SCALE_H
|
#define DIALOGBOX_SCALE_H
|
||||||
|
|
||||||
|
#include "GEOMBase_Skeleton.h"
|
||||||
|
#include "DlgRef_2Sel1Spin.h"
|
||||||
|
|
||||||
#include "TransformationGUI.h"
|
#include "TransformationGUI.h"
|
||||||
|
|
||||||
#include <qvariant.h>
|
|
||||||
#include <qdialog.h>
|
|
||||||
|
|
||||||
class QVBoxLayout;
|
|
||||||
class QHBoxLayout;
|
|
||||||
class QGridLayout;
|
|
||||||
class QButtonGroup;
|
|
||||||
class QGroupBox;
|
|
||||||
class QLabel;
|
|
||||||
class QLineEdit;
|
|
||||||
class QPushButton;
|
|
||||||
class QRadioButton;
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : TransformationGUI_ScaleDlg
|
// class : TransformationGUI_ScaleDlg
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
class TransformationGUI_ScaleDlg : public QDialog
|
class TransformationGUI_ScaleDlg : public GEOMBase_Skeleton
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TransformationGUI_ScaleDlg( QWidget* parent = 0, const char* name = 0, TransformationGUI* theTransformationGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
|
TransformationGUI_ScaleDlg(QWidget* parent = 0, const char* name = 0, TransformationGUI* theTransformationGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
|
||||||
~TransformationGUI_ScaleDlg();
|
~TransformationGUI_ScaleDlg();
|
||||||
|
|
||||||
private :
|
private :
|
||||||
TransformationGUI* myTransformationGUI;
|
void Init();
|
||||||
void closeEvent( QCloseEvent* e ) ;
|
void enterEvent(QEvent* e);
|
||||||
void enterEvent( QEvent* e );
|
void MakeScaleSimulationAndDisplay();
|
||||||
void Init(SALOME_Selection* Sel) ;
|
|
||||||
void MakeScaleSimulationAndDisplay( const TopoDS_Shape& S ) ;
|
|
||||||
|
|
||||||
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */
|
TransformationGUI* myTransformationGUI;
|
||||||
GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */
|
|
||||||
TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */
|
|
||||||
SALOME_Selection* mySelection ; /* User shape selection */
|
|
||||||
gp_Pnt myPoint1 ; /* Points containing the vector */
|
|
||||||
TopoDS_Shape myBaseTopo ;
|
|
||||||
GEOM::GEOM_Shape_var myGeomShape ; /* is myBaseTopo */
|
|
||||||
Standard_Real myFactor ;
|
|
||||||
bool myOkPoint1 ; /* true when myPoint1 is defined */
|
|
||||||
bool myOkBaseTopo ; /* true when myBaseTopo is defined */
|
|
||||||
int myConstructorId ; /* Current constructor id = radio button id */
|
|
||||||
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
|
|
||||||
Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* filter for selection */
|
|
||||||
|
|
||||||
QButtonGroup* GroupConstructors;
|
double step;
|
||||||
QRadioButton* Constructor1;
|
Handle(GEOM_ShapeTypeFilter) myVertexFilter;
|
||||||
QGroupBox* GroupC1;
|
|
||||||
QLabel* TextLabelC1A1;
|
gp_Pnt myPoint1; /* Points containing the vector */
|
||||||
QLabel* TextLabelC1A2;
|
bool myOkPoint1; /* true when myPoint1 is defined */
|
||||||
QPushButton* SelectButtonC1A1;
|
TopoDS_Shape myBaseTopo;
|
||||||
QPushButton* SelectButtonC1A2;
|
bool myOkBaseTopo; /* true when myBaseTopo is defined */
|
||||||
QLineEdit* LineEditC1A1;
|
GEOM::GEOM_Shape_var myGeomShape; /* is myBaseTopo */
|
||||||
QLineEdit* LineEditC1A2;
|
Standard_Real myFactor;
|
||||||
QLineEdit* LineEditC1A3;
|
|
||||||
QLabel* TextLabelC1A3;
|
DlgRef_2Sel1Spin* GroupPoints;
|
||||||
QGroupBox* GroupButtons;
|
|
||||||
QPushButton* buttonApply;
|
|
||||||
QPushButton* buttonOk;
|
|
||||||
QPushButton* buttonCancel;
|
|
||||||
|
|
||||||
private slots :
|
private slots :
|
||||||
|
|
||||||
void ConstructorsClicked(int constructorId);
|
|
||||||
void ClickOnOk();
|
void ClickOnOk();
|
||||||
void ClickOnCancel();
|
|
||||||
void ClickOnApply();
|
void ClickOnApply();
|
||||||
void SetEditCurrentArgument() ;
|
void ActivateThisDialog();
|
||||||
void SelectionIntoArgument() ;
|
void LineEditReturnPressed();
|
||||||
void LineEditReturnPressed() ;
|
void SelectionIntoArgument();
|
||||||
void DeactivateActiveDialog() ;
|
void SetEditCurrentArgument();
|
||||||
void ActivateThisDialog() ;
|
void ValueChangedInSpinBox(double newValue);
|
||||||
void TextChangedInLineEdit(const QString& newText) ;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
QGridLayout* TransformationGUI_ScaleDlgLayout;
|
|
||||||
QGridLayout* GroupConstructorsLayout;
|
|
||||||
QGridLayout* GroupC1Layout;
|
|
||||||
QGridLayout* GroupButtonsLayout;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOGBOX_SCALE_H
|
#endif // DIALOGBOX_SCALE_H
|
||||||
|
@ -29,26 +29,7 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
#include "TransformationGUI_TranslationDlg.h"
|
#include "TransformationGUI_TranslationDlg.h"
|
||||||
|
|
||||||
|
#include <BRepBuilderAPI_Transform.hxx>
|
||||||
#include "QAD_Config.h"
|
|
||||||
|
|
||||||
|
|
||||||
#include <qbuttongroup.h>
|
|
||||||
#include <qgroupbox.h>
|
|
||||||
#include <qlabel.h>
|
|
||||||
#include <qlineedit.h>
|
|
||||||
#include <qpushbutton.h>
|
|
||||||
#include <qradiobutton.h>
|
|
||||||
#include <qlayout.h>
|
|
||||||
#include <qvariant.h>
|
|
||||||
#include <qtooltip.h>
|
|
||||||
#include <qwhatsthis.h>
|
|
||||||
#include <qimage.h>
|
|
||||||
#include <qvalidator.h>
|
|
||||||
#include <qpixmap.h>
|
|
||||||
#include <qevent.h>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : TransformationGUI_TranslationDlg()
|
// class : TransformationGUI_TranslationDlg()
|
||||||
@ -57,148 +38,44 @@ using namespace std;
|
|||||||
// The dialog will by default be modeless, unless you set 'modal' to
|
// The dialog will by default be modeless, unless you set 'modal' to
|
||||||
// TRUE to construct a modal dialog.
|
// TRUE to construct a modal dialog.
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
TransformationGUI_TranslationDlg::TransformationGUI_TranslationDlg( QWidget* parent, const char* name, TransformationGUI* theTransformationGUI, SALOME_Selection* Sel, bool modal, WFlags fl )
|
TransformationGUI_TranslationDlg::TransformationGUI_TranslationDlg(QWidget* parent, const char* name, TransformationGUI* theTransformationGUI, SALOME_Selection* Sel, bool modal, WFlags fl)
|
||||||
: QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu )
|
:GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
|
||||||
{
|
{
|
||||||
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_TRANSLATION")));
|
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_TRANSLATION")));
|
||||||
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
|
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
|
||||||
|
|
||||||
if ( !name )
|
setCaption(tr("GEOM_TRANSLATION_TITLE"));
|
||||||
setName( "TransformationGUI_TranslationDlg" );
|
|
||||||
resize( 303, 219 );
|
|
||||||
setCaption( tr( "GEOM_TRANSLATION_TITLE" ) );
|
|
||||||
setSizeGripEnabled( TRUE );
|
|
||||||
TransformationGUI_TranslationDlgLayout = new QGridLayout( this );
|
|
||||||
TransformationGUI_TranslationDlgLayout->setSpacing( 6 );
|
|
||||||
TransformationGUI_TranslationDlgLayout->setMargin( 11 );
|
|
||||||
|
|
||||||
/***************************************************************/
|
/***************************************************************/
|
||||||
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
|
GroupConstructors->setTitle(tr("GEOM_TRANSLATION"));
|
||||||
GroupConstructors->setTitle( tr( "GEOM_TRANSLATION" ) );
|
RadioButton1->setPixmap(image0);
|
||||||
GroupConstructors->setExclusive( TRUE );
|
RadioButton2->close(TRUE);
|
||||||
GroupConstructors->setColumnLayout(0, Qt::Vertical );
|
RadioButton3->close(TRUE);
|
||||||
GroupConstructors->layout()->setSpacing( 0 );
|
|
||||||
GroupConstructors->layout()->setMargin( 0 );
|
|
||||||
GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() );
|
|
||||||
GroupConstructorsLayout->setAlignment( Qt::AlignTop );
|
|
||||||
GroupConstructorsLayout->setSpacing( 6 );
|
|
||||||
GroupConstructorsLayout->setMargin( 11 );
|
|
||||||
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
|
|
||||||
Constructor1->setText( tr( "" ) );
|
|
||||||
Constructor1->setPixmap( image0 );
|
|
||||||
Constructor1->setChecked( TRUE );
|
|
||||||
Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) );
|
|
||||||
Constructor1->setMinimumSize( QSize( 50, 0 ) );
|
|
||||||
GroupConstructorsLayout->addWidget( Constructor1, 0, 0 );
|
|
||||||
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
|
|
||||||
GroupConstructorsLayout->addItem( spacer, 0, 1 );
|
|
||||||
TransformationGUI_TranslationDlgLayout->addWidget( GroupConstructors, 0, 0 );
|
|
||||||
|
|
||||||
GroupC1 = new QGroupBox( this, "GroupC1" );
|
GroupPoints = new DlgRef_1Sel3Spin(this, "GroupPoints");
|
||||||
GroupC1->setTitle( tr( "GEOM_TRANSLATION" ) ) ;
|
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
|
||||||
GroupC1->setMinimumSize( QSize( 0, 0 ) );
|
GroupPoints->TextLabel1->setText(tr("GEOM_OBJECT"));
|
||||||
GroupC1->setFrameShape( QGroupBox::Box );
|
GroupPoints->TextLabel2->setText(tr("GEOM_DX"));
|
||||||
GroupC1->setFrameShadow( QGroupBox::Sunken );
|
GroupPoints->TextLabel3->setText(tr("GEOM_DY"));
|
||||||
GroupC1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)5, GroupC1->sizePolicy().hasHeightForWidth() ) );
|
GroupPoints->TextLabel4->setText(tr("GEOM_DZ"));
|
||||||
GroupC1->setColumnLayout(0, Qt::Vertical );
|
GroupPoints->PushButton1->setPixmap(image1);
|
||||||
GroupC1->layout()->setSpacing( 0 );
|
|
||||||
GroupC1->layout()->setMargin( 0 );
|
|
||||||
GroupC1Layout = new QGridLayout( GroupC1->layout() );
|
|
||||||
GroupC1Layout->setAlignment( Qt::AlignTop );
|
|
||||||
GroupC1Layout->setSpacing( 6 );
|
|
||||||
GroupC1Layout->setMargin( 11 );
|
|
||||||
|
|
||||||
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
|
Layout1->addWidget(GroupPoints, 1, 0);
|
||||||
TextLabelC1A1->setText( tr( "GEOM_OBJECT" ) );
|
/***************************************************************/
|
||||||
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
|
|
||||||
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
|
|
||||||
TextLabelC1A1->setFrameShadow( QLabel::Plain );
|
|
||||||
GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
|
|
||||||
|
|
||||||
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
|
/* Initialisations */
|
||||||
SelectButtonC1A1->setText( tr( "" ) );
|
myTransformationGUI = theTransformationGUI;
|
||||||
SelectButtonC1A1->setPixmap( image1 );
|
Init();
|
||||||
SelectButtonC1A1->setToggleButton( FALSE );
|
|
||||||
SelectButtonC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, SelectButtonC1A1->sizePolicy().hasHeightForWidth() ) );
|
|
||||||
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
|
|
||||||
|
|
||||||
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
|
|
||||||
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
|
|
||||||
|
|
||||||
Layout1 = new QHBoxLayout;
|
|
||||||
Layout1->setSpacing( 6 );
|
|
||||||
Layout1->setMargin( 0 );
|
|
||||||
|
|
||||||
TextLabel_DX = new QLabel( GroupC1, "TextLabel_DX" );
|
|
||||||
TextLabel_DX->setText( tr( "GEOM_DX" ) );
|
|
||||||
Layout1->addWidget( TextLabel_DX );
|
|
||||||
|
|
||||||
SpinBox_DX = new DlgRef_SpinBox( GroupC1, "SpinBox_DX" );
|
|
||||||
SpinBox_DX->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, SpinBox_DX->sizePolicy().hasHeightForWidth() ) );
|
|
||||||
Layout1->addWidget( SpinBox_DX );
|
|
||||||
|
|
||||||
TextLabel_DY = new QLabel( GroupC1, "TextLabel_DY" );
|
|
||||||
TextLabel_DY->setText( tr( "GEOM_DY" ) );
|
|
||||||
Layout1->addWidget( TextLabel_DY );
|
|
||||||
|
|
||||||
SpinBox_DY = new DlgRef_SpinBox( GroupC1, "SpinBox_DY" );
|
|
||||||
SpinBox_DY->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, SpinBox_DY->sizePolicy().hasHeightForWidth() ) );
|
|
||||||
Layout1->addWidget( SpinBox_DY );
|
|
||||||
|
|
||||||
TextLabel_DZ = new QLabel( GroupC1, "TextLabel_DZ" );
|
|
||||||
TextLabel_DZ->setText( tr( "GEOM_DZ" ) );
|
|
||||||
Layout1->addWidget( TextLabel_DZ );
|
|
||||||
|
|
||||||
SpinBox_DZ = new DlgRef_SpinBox( GroupC1, "SpinBox_DZ" );
|
|
||||||
SpinBox_DZ->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, SpinBox_DZ->sizePolicy().hasHeightForWidth() ) );
|
|
||||||
Layout1->addWidget( SpinBox_DZ );
|
|
||||||
|
|
||||||
GroupC1Layout->addMultiCellLayout( Layout1, 1, 1, 0, 2 );
|
|
||||||
|
|
||||||
TransformationGUI_TranslationDlgLayout->addWidget( GroupC1, 1, 0 );
|
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************/
|
|
||||||
GroupButtons = new QGroupBox( this, "GroupButtons" );
|
|
||||||
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) );
|
|
||||||
GroupButtons->setTitle( tr( "" ) );
|
|
||||||
GroupButtons->setColumnLayout(0, Qt::Vertical );
|
|
||||||
GroupButtons->layout()->setSpacing( 0 );
|
|
||||||
GroupButtons->layout()->setMargin( 0 );
|
|
||||||
GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
|
|
||||||
GroupButtonsLayout->setAlignment( Qt::AlignTop );
|
|
||||||
GroupButtonsLayout->setSpacing( 6 );
|
|
||||||
GroupButtonsLayout->setMargin( 11 );
|
|
||||||
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
|
|
||||||
buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) );
|
|
||||||
buttonCancel->setAutoDefault( TRUE );
|
|
||||||
GroupButtonsLayout->addWidget( buttonCancel, 0, 3 );
|
|
||||||
buttonApply = new QPushButton( GroupButtons, "buttonApply" );
|
|
||||||
buttonApply->setText( tr( "GEOM_BUT_APPLY" ) );
|
|
||||||
buttonApply->setAutoDefault( TRUE );
|
|
||||||
GroupButtonsLayout->addWidget( buttonApply, 0, 1 );
|
|
||||||
QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
|
|
||||||
GroupButtonsLayout->addItem( spacer_9, 0, 2 );
|
|
||||||
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
|
|
||||||
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
|
|
||||||
buttonOk->setAutoDefault( TRUE );
|
|
||||||
buttonOk->setDefault( TRUE );
|
|
||||||
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
|
|
||||||
TransformationGUI_TranslationDlgLayout->addWidget( GroupButtons, 2, 0 );
|
|
||||||
/***************************************************************/
|
|
||||||
myTransformationGUI = theTransformationGUI;
|
|
||||||
Init(Sel) ; /* Initialisations */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ~TransformationGUI_TranslationDlg()
|
// function : ~TransformationGUI_TranslationDlg()
|
||||||
// purpose : Destroys the object and frees any allocated resources
|
// purpose : Destroys the object and frees any allocated resources
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
TransformationGUI_TranslationDlg::~TransformationGUI_TranslationDlg()
|
TransformationGUI_TranslationDlg::~TransformationGUI_TranslationDlg()
|
||||||
{
|
{
|
||||||
// no need to delete child widgets, Qt does it all for us
|
// no need to delete child widgets, Qt does it all for us
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -206,142 +83,79 @@ TransformationGUI_TranslationDlg::~TransformationGUI_TranslationDlg()
|
|||||||
// function : Init()
|
// function : Init()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_TranslationDlg::Init( SALOME_Selection* Sel )
|
void TransformationGUI_TranslationDlg::Init()
|
||||||
{
|
{
|
||||||
double step ;
|
/* init variables */
|
||||||
QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ;
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
step = St.toDouble() ;
|
|
||||||
|
|
||||||
/* min, max, step and decimals for spin boxes */
|
myVec.SetCoord(100.0, 100.0, 100.0);
|
||||||
SpinBox_DX->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ;
|
myOkBase = false;
|
||||||
SpinBox_DX->SetValue( 100.0 ) ;
|
|
||||||
SpinBox_DY->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ;
|
|
||||||
SpinBox_DY->SetValue( 100.0 ) ;
|
|
||||||
SpinBox_DZ->RangeStepAndValidator( -999.999, 999.999, step, 3 ) ;
|
|
||||||
SpinBox_DZ->SetValue( 100.0 ) ;
|
|
||||||
|
|
||||||
GroupC1->show();
|
/* Get setting of step value from file configuration */
|
||||||
myConstructorId = 0 ;
|
QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep");
|
||||||
Constructor1->setChecked( TRUE );
|
step = St.toDouble();
|
||||||
myEditCurrentArgument = LineEditC1A1 ;
|
|
||||||
mySelection = Sel;
|
|
||||||
myGeomGUI = GEOMBase_Context::GetGeomGUI() ;
|
|
||||||
myOkBase = false ;
|
|
||||||
|
|
||||||
this->myVec.SetCoord( 100.0, 100.0, 100.0 ) ;
|
/* min, max, step and decimals for spin boxes & initial values */
|
||||||
mySimulationTopoDs.Nullify() ;
|
GroupPoints->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3);
|
||||||
myBase.Nullify() ;
|
GroupPoints->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3);
|
||||||
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
|
GroupPoints->SpinBox_DZ->RangeStepAndValidator(-999.999, 999.999, step, 3);
|
||||||
|
|
||||||
// TODO : previous selection into argument ?
|
GroupPoints->SpinBox_DX->SetValue(100.0);
|
||||||
|
GroupPoints->SpinBox_DY->SetValue(100.0);
|
||||||
/* Filter definitions */
|
GroupPoints->SpinBox_DZ->SetValue(100.0);
|
||||||
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
|
|
||||||
myGeom = GEOM::GEOM_Gen::_narrow(comp);
|
|
||||||
// myEdgeFilter = new GEOM_ShapeTypeFilter( TopAbs_EDGE, myGeom );
|
|
||||||
|
|
||||||
/* signals and slots connections */
|
/* signals and slots connections */
|
||||||
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
|
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||||
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
|
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||||
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
|
|
||||||
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
|
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||||
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
|
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||||
|
|
||||||
|
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||||
|
connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||||
|
connect(GroupPoints->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
|
||||||
|
|
||||||
|
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double)));
|
||||||
|
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double)));
|
||||||
|
connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DZ, SLOT(SetStep(double)));
|
||||||
|
|
||||||
connect( SpinBox_DX, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
|
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
|
||||||
connect( SpinBox_DY, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
|
|
||||||
connect( SpinBox_DZ, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ;
|
|
||||||
|
|
||||||
connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
|
/* displays Dialog */
|
||||||
|
GroupPoints->show();
|
||||||
|
this->show();
|
||||||
|
|
||||||
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
|
return;
|
||||||
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
|
||||||
/* to close dialog if study change */
|
|
||||||
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ;
|
|
||||||
|
|
||||||
/* Move widget on the botton right corner of main widget */
|
|
||||||
int x, y ;
|
|
||||||
myGeomGUI->DefineDlgPosition( this, x, y ) ;
|
|
||||||
this->move( x, y ) ;
|
|
||||||
this->show() ; /* displays Dialog */
|
|
||||||
|
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : ConstructorsClicked()
|
|
||||||
// purpose : Radio button management
|
|
||||||
//=================================================================================
|
|
||||||
void TransformationGUI_TranslationDlg::ConstructorsClicked(int constructorId)
|
|
||||||
{
|
|
||||||
// myGeomGUI->EraseSimulationShape() ;
|
|
||||||
switch (constructorId)
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnOk()
|
// function : ClickOnOk()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_TranslationDlg::ClickOnOk()
|
void TransformationGUI_TranslationDlg::ClickOnOk()
|
||||||
{
|
{
|
||||||
this->ClickOnApply() ;
|
this->ClickOnApply();
|
||||||
this->ClickOnCancel() ;
|
ClickOnCancel();
|
||||||
|
return;
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : ClickOnApply()
|
// function : ClickOnApply()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_TranslationDlg::ClickOnApply()
|
void TransformationGUI_TranslationDlg::ClickOnApply()
|
||||||
{
|
{
|
||||||
myGeomGUI->EraseSimulationShape() ;
|
myGeomGUI->GetDesktop()->putInfo(tr(""));
|
||||||
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
|
if (mySimulationTopoDs.IsNull())
|
||||||
mySimulationTopoDs.Nullify() ;
|
return;
|
||||||
switch(myConstructorId)
|
myGeomGUI->EraseSimulationShape();
|
||||||
{
|
mySimulationTopoDs.Nullify();
|
||||||
case 0 :
|
|
||||||
{
|
|
||||||
if(myOkBase) {
|
|
||||||
myTransformationGUI->MakeTranslationAndDisplay( myGeomShape, myVec ) ;
|
|
||||||
}
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
case 1 :
|
|
||||||
{
|
|
||||||
break ;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// accept();
|
if(myOkBase)
|
||||||
return ;
|
myTransformationGUI->MakeTranslationAndDisplay(myGeomShape, myVec);
|
||||||
}
|
return;
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : ClickOnCancel()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void TransformationGUI_TranslationDlg::ClickOnCancel()
|
|
||||||
{
|
|
||||||
mySelection->ClearFilters() ;
|
|
||||||
myGeomGUI->EraseSimulationShape() ;
|
|
||||||
mySimulationTopoDs.Nullify() ;
|
|
||||||
disconnect( mySelection, 0, this, 0 );
|
|
||||||
myGeomGUI->ResetState() ;
|
|
||||||
reject() ;
|
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -351,43 +165,38 @@ void TransformationGUI_TranslationDlg::ClickOnCancel()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_TranslationDlg::SelectionIntoArgument()
|
void TransformationGUI_TranslationDlg::SelectionIntoArgument()
|
||||||
{
|
{
|
||||||
myEditCurrentArgument->setText("") ;
|
myGeomGUI->EraseSimulationShape();
|
||||||
myGeomGUI->EraseSimulationShape() ;
|
mySimulationTopoDs.Nullify();
|
||||||
mySimulationTopoDs.Nullify() ;
|
myEditCurrentArgument->setText("");
|
||||||
|
QString aString = ""; /* name of selection */
|
||||||
/* Future name of selection */
|
|
||||||
QString aString = "";
|
|
||||||
|
|
||||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
|
|
||||||
if ( nbSel != 1 ) {
|
|
||||||
if ( myEditCurrentArgument == LineEditC1A1 ) {
|
|
||||||
LineEditC1A1->setText("") ;
|
|
||||||
myOkBase = false ;
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* nbSel == 1 ! */
|
|
||||||
TopoDS_Shape S;
|
|
||||||
Standard_Boolean testResult ;
|
|
||||||
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
|
|
||||||
|
|
||||||
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
|
|
||||||
return ;
|
|
||||||
|
|
||||||
if ( myConstructorId == 0 && myEditCurrentArgument == LineEditC1A1 ) {
|
|
||||||
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
|
|
||||||
if( !testResult )
|
|
||||||
return ;
|
|
||||||
LineEditC1A1->setText(aString) ;
|
|
||||||
myBase = S ;
|
|
||||||
myOkBase = true ;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( myOkBase ) {
|
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
|
||||||
MakeTranslationSimulationAndDisplay() ;
|
if (nbSel != 1) {
|
||||||
|
if(myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||||
|
myOkBase = false;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
return ;
|
|
||||||
|
/* nbSel == 1 */
|
||||||
|
TopoDS_Shape S;
|
||||||
|
Standard_Boolean testResult;
|
||||||
|
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
|
||||||
|
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* gp_Pnt : not used */
|
||||||
|
if(myEditCurrentArgument == GroupPoints->LineEdit1) {
|
||||||
|
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
|
||||||
|
if(!testResult)
|
||||||
|
return ;
|
||||||
|
GroupPoints->LineEdit1->setText(aString);
|
||||||
|
myBase = S;
|
||||||
|
myOkBase = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(myOkBase)
|
||||||
|
this->MakeTranslationSimulationAndDisplay();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -395,105 +204,34 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument()
|
|||||||
// function : SetEditCurrentArgument()
|
// function : SetEditCurrentArgument()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_TranslationDlg::SetEditCurrentArgument()
|
void TransformationGUI_TranslationDlg::LineEditReturnPressed()
|
||||||
{
|
{
|
||||||
QPushButton* send = (QPushButton*)sender();
|
QLineEdit* send = (QLineEdit*)sender();
|
||||||
switch (myConstructorId)
|
if(send == GroupPoints->LineEdit1)
|
||||||
{
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
case 0: /* default constructor */
|
else
|
||||||
{
|
return;
|
||||||
if(send == SelectButtonC1A1) {
|
|
||||||
LineEditC1A1->setFocus() ;
|
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||||
myEditCurrentArgument = LineEditC1A1 ;
|
return;
|
||||||
SelectionIntoArgument() ;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 1:
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : LineEditReturnPressed()
|
// function : LineEditReturnPressed()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_TranslationDlg::LineEditReturnPressed()
|
void TransformationGUI_TranslationDlg::SetEditCurrentArgument()
|
||||||
{
|
{
|
||||||
QLineEdit* send = (QLineEdit*)sender();
|
QPushButton* send = (QPushButton*)sender();
|
||||||
if( send == LineEditC1A1 )
|
|
||||||
myEditCurrentArgument = LineEditC1A1 ;
|
|
||||||
else
|
|
||||||
return ;
|
|
||||||
|
|
||||||
/* User name of object input management */
|
|
||||||
/* If successfull the selection is changed and signal emitted... */
|
|
||||||
/* so SelectionIntoArgument() is automatically called. */
|
|
||||||
const QString objectUserName = myEditCurrentArgument->text() ;
|
|
||||||
QWidget* thisWidget = (QWidget*)this ;
|
|
||||||
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
|
|
||||||
myEditCurrentArgument->setText( objectUserName ) ;
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if(send == GroupPoints->PushButton1) {
|
||||||
|
GroupPoints->LineEdit1->setFocus();
|
||||||
//=================================================================================
|
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||||
// function : ValueChangedInSpinBox()
|
this->SelectionIntoArgument();
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void TransformationGUI_TranslationDlg::ValueChangedInSpinBox( double newValue )
|
|
||||||
{
|
|
||||||
|
|
||||||
QObject* send = (QObject*)sender() ;
|
|
||||||
Standard_Real Dx, Dy, Dz ;
|
|
||||||
|
|
||||||
if( send == SpinBox_DX ) {
|
|
||||||
Dx = newValue ;
|
|
||||||
Dy = SpinBox_DY->GetValue() ;
|
|
||||||
Dz = SpinBox_DZ->GetValue() ;
|
|
||||||
} else if( send == SpinBox_DY ) {
|
|
||||||
Dx = SpinBox_DX->GetValue() ;
|
|
||||||
Dy = newValue ;
|
|
||||||
Dz = SpinBox_DZ->GetValue() ;
|
|
||||||
} else if( send == SpinBox_DZ ) {
|
|
||||||
Dx = SpinBox_DX->GetValue() ;
|
|
||||||
Dy = SpinBox_DY->GetValue() ;
|
|
||||||
Dz = newValue ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this->myVec.SetCoord(Dx, Dy, Dz) ;
|
return;
|
||||||
if ( myOkBase ) {
|
|
||||||
MakeTranslationSimulationAndDisplay() ;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
myGeomGUI->EraseSimulationShape() ;
|
|
||||||
mySimulationTopoDs.Nullify() ;
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
|
||||||
// function : DeactivateActiveDialog()
|
|
||||||
// purpose :
|
|
||||||
//=================================================================================
|
|
||||||
void TransformationGUI_TranslationDlg::DeactivateActiveDialog()
|
|
||||||
{
|
|
||||||
if ( GroupConstructors->isEnabled() ) {
|
|
||||||
GroupConstructors->setEnabled(false) ;
|
|
||||||
GroupC1->setEnabled(false) ;
|
|
||||||
GroupButtons->setEnabled(false) ;
|
|
||||||
disconnect( mySelection, 0, this, 0 );
|
|
||||||
myGeomGUI->EraseSimulationShape() ;
|
|
||||||
mySelection->ClearFilters() ;
|
|
||||||
}
|
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -503,17 +241,11 @@ void TransformationGUI_TranslationDlg::DeactivateActiveDialog()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_TranslationDlg::ActivateThisDialog()
|
void TransformationGUI_TranslationDlg::ActivateThisDialog()
|
||||||
{
|
{
|
||||||
/* Emit a signal to deactivate the active dialog */
|
GEOMBase_Skeleton::ActivateThisDialog();
|
||||||
myGeomGUI->EmitSignalDeactivateDialog() ;
|
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||||
GroupConstructors->setEnabled(true) ;
|
if(!mySimulationTopoDs.IsNull())
|
||||||
GroupC1->setEnabled(true) ;
|
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||||
GroupButtons->setEnabled(true) ;
|
return;
|
||||||
|
|
||||||
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
|
||||||
if( !mySimulationTopoDs.IsNull() )
|
|
||||||
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
|
|
||||||
|
|
||||||
return ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -523,22 +255,42 @@ void TransformationGUI_TranslationDlg::ActivateThisDialog()
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_TranslationDlg::enterEvent(QEvent* e)
|
void TransformationGUI_TranslationDlg::enterEvent(QEvent* e)
|
||||||
{
|
{
|
||||||
if ( GroupConstructors->isEnabled() )
|
if(GroupConstructors->isEnabled())
|
||||||
return ;
|
return;
|
||||||
ActivateThisDialog() ;
|
this->ActivateThisDialog();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// function : closeEvent()
|
// function : ValueChangedInSpinBox()
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_TranslationDlg::closeEvent( QCloseEvent* e )
|
void TransformationGUI_TranslationDlg::ValueChangedInSpinBox(double newValue)
|
||||||
{
|
{
|
||||||
/* same than click on cancel button */
|
QObject* send = (QObject*)sender();
|
||||||
this->ClickOnCancel() ;
|
Standard_Real Dx, Dy, Dz;
|
||||||
return ;
|
|
||||||
|
if(send == GroupPoints->SpinBox_DX) {
|
||||||
|
Dx = newValue;
|
||||||
|
Dy = GroupPoints->SpinBox_DY->GetValue();
|
||||||
|
Dz = GroupPoints->SpinBox_DZ->GetValue();
|
||||||
|
}
|
||||||
|
else if(send == GroupPoints->SpinBox_DY) {
|
||||||
|
Dx = GroupPoints->SpinBox_DX->GetValue();
|
||||||
|
Dy = newValue;
|
||||||
|
Dz = GroupPoints->SpinBox_DZ->GetValue();
|
||||||
|
}
|
||||||
|
else if(send == GroupPoints->SpinBox_DZ) {
|
||||||
|
Dx = GroupPoints->SpinBox_DX->GetValue();
|
||||||
|
Dy = GroupPoints->SpinBox_DY->GetValue();
|
||||||
|
Dz = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
myVec.SetCoord(Dx, Dy, Dz);
|
||||||
|
if(myOkBase)
|
||||||
|
MakeTranslationSimulationAndDisplay();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -548,14 +300,22 @@ void TransformationGUI_TranslationDlg::closeEvent( QCloseEvent* e )
|
|||||||
//=================================================================================
|
//=================================================================================
|
||||||
void TransformationGUI_TranslationDlg::MakeTranslationSimulationAndDisplay()
|
void TransformationGUI_TranslationDlg::MakeTranslationSimulationAndDisplay()
|
||||||
{
|
{
|
||||||
myGeomGUI->EraseSimulationShape() ;
|
myGeomGUI->EraseSimulationShape();
|
||||||
mySimulationTopoDs.Nullify() ;
|
mySimulationTopoDs.Nullify();
|
||||||
|
|
||||||
gp_Trsf theTransformation ;
|
try {
|
||||||
theTransformation.SetTranslation(this->myVec) ;
|
gp_Trsf theTransformation;
|
||||||
|
theTransformation.SetTranslation(myVec);
|
||||||
BRepBuilderAPI_Transform myBRepTransformation(this->myBase, theTransformation, Standard_False) ;
|
BRepBuilderAPI_Transform myBRepTransformation(myBase, theTransformation, Standard_False);
|
||||||
mySimulationTopoDs = myBRepTransformation.Shape() ;
|
mySimulationTopoDs = myBRepTransformation.Shape();
|
||||||
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
|
if(mySimulationTopoDs.IsNull())
|
||||||
return ;
|
return;
|
||||||
|
else
|
||||||
|
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||||
|
}
|
||||||
|
catch(Standard_Failure) {
|
||||||
|
MESSAGE("Exception catched in MakeTranslationSimulationAndDisplay");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
@ -29,98 +29,49 @@
|
|||||||
#ifndef DIALOGBOX_TRANSLATION_H
|
#ifndef DIALOGBOX_TRANSLATION_H
|
||||||
#define DIALOGBOX_TRANSLATION_H
|
#define DIALOGBOX_TRANSLATION_H
|
||||||
|
|
||||||
|
#include "GEOMBase_Skeleton.h"
|
||||||
|
#include "DlgRef_1Sel3Spin.h"
|
||||||
|
|
||||||
#include "TransformationGUI.h"
|
#include "TransformationGUI.h"
|
||||||
|
|
||||||
#include "DlgRef_SpinBox.h"
|
|
||||||
|
|
||||||
#include <gp_Vec.hxx>
|
#include <gp_Vec.hxx>
|
||||||
#include <TopoDS_Shape.hxx>
|
|
||||||
#include <BRepBuilderAPI_Transform.hxx>
|
|
||||||
|
|
||||||
#include <qvariant.h>
|
|
||||||
#include <qdialog.h>
|
|
||||||
|
|
||||||
class QVBoxLayout;
|
|
||||||
class QHBoxLayout;
|
|
||||||
class QGridLayout;
|
|
||||||
class QButtonGroup;
|
|
||||||
class QGroupBox;
|
|
||||||
class QLabel;
|
|
||||||
class QLineEdit;
|
|
||||||
class QPushButton;
|
|
||||||
class QRadioButton;
|
|
||||||
|
|
||||||
|
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
// class : TransformationGUI_TranslationDlg
|
// class : TransformationGUI_TranslationDlg
|
||||||
// purpose :
|
// purpose :
|
||||||
//=================================================================================
|
//=================================================================================
|
||||||
class TransformationGUI_TranslationDlg : public QDialog
|
class TransformationGUI_TranslationDlg : public GEOMBase_Skeleton
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TransformationGUI_TranslationDlg( QWidget* parent = 0, const char* name = 0, TransformationGUI* theTransformationGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
|
TransformationGUI_TranslationDlg(QWidget* parent = 0, const char* name = 0, TransformationGUI* theTransformationGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
|
||||||
~TransformationGUI_TranslationDlg();
|
~TransformationGUI_TranslationDlg();
|
||||||
|
|
||||||
private :
|
private :
|
||||||
|
void Init();
|
||||||
|
void enterEvent(QEvent* e);
|
||||||
|
void MakeTranslationSimulationAndDisplay();
|
||||||
|
|
||||||
TransformationGUI* myTransformationGUI;
|
TransformationGUI* myTransformationGUI;
|
||||||
GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */
|
double step;
|
||||||
GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */
|
|
||||||
TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */
|
|
||||||
SALOME_Selection* mySelection ; /* User shape selection */
|
|
||||||
TopoDS_Shape myBase ;
|
|
||||||
GEOM::GEOM_Shape_var myGeomShape ; /* is myBase */
|
|
||||||
bool myOkBase ;
|
|
||||||
gp_Vec myVec ;
|
|
||||||
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
|
|
||||||
int myConstructorId ; /* Current constructor id = radio button id */
|
|
||||||
Handle(GEOM_ShapeTypeFilter) myEdgeFilter; /* Filter selection */
|
|
||||||
|
|
||||||
void closeEvent( QCloseEvent* e ) ;
|
TopoDS_Shape myBase; /* is myBase */
|
||||||
void enterEvent( QEvent* e);
|
GEOM::GEOM_Shape_var myGeomShape;
|
||||||
void Init( SALOME_Selection* Sel ) ;
|
bool myOkBase;
|
||||||
void MakeTranslationSimulationAndDisplay() ;
|
gp_Vec myVec;
|
||||||
|
|
||||||
QButtonGroup* GroupConstructors;
|
DlgRef_1Sel3Spin* GroupPoints;
|
||||||
QRadioButton* Constructor1;
|
|
||||||
QGroupBox* GroupC1;
|
|
||||||
QLabel* TextLabel_DX;
|
|
||||||
QLabel* TextLabel_DY;
|
|
||||||
QLabel* TextLabel_DZ;
|
|
||||||
|
|
||||||
DlgRef_SpinBox* SpinBox_DX ;
|
private slots :
|
||||||
DlgRef_SpinBox* SpinBox_DY ;
|
|
||||||
DlgRef_SpinBox* SpinBox_DZ ;
|
|
||||||
|
|
||||||
QLabel* TextLabelC1A1;
|
|
||||||
QPushButton* SelectButtonC1A1;
|
|
||||||
QLineEdit* LineEditC1A1;
|
|
||||||
QGroupBox* GroupButtons;
|
|
||||||
QPushButton* buttonOk;
|
|
||||||
QPushButton* buttonCancel;
|
|
||||||
QPushButton* buttonApply;
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
|
|
||||||
void ConstructorsClicked(int constructorId);
|
|
||||||
void ClickOnOk();
|
void ClickOnOk();
|
||||||
void ClickOnCancel();
|
|
||||||
void ClickOnApply();
|
void ClickOnApply();
|
||||||
void SetEditCurrentArgument() ;
|
void ActivateThisDialog();
|
||||||
void SelectionIntoArgument() ;
|
void LineEditReturnPressed();
|
||||||
void LineEditReturnPressed() ;
|
void SelectionIntoArgument();
|
||||||
void DeactivateActiveDialog() ;
|
void SetEditCurrentArgument();
|
||||||
void ActivateThisDialog() ;
|
void ValueChangedInSpinBox(double newValue);
|
||||||
void ValueChangedInSpinBox( double newValue ) ;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
QGridLayout* TransformationGUI_TranslationDlgLayout;
|
|
||||||
QGridLayout* GroupConstructorsLayout;
|
|
||||||
QGridLayout* GroupC1Layout;
|
|
||||||
QGridLayout* GroupButtonsLayout;
|
|
||||||
|
|
||||||
QHBoxLayout* Layout1 ;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOGBOX_TRANSLATION_H
|
#endif // DIALOGBOX_TRANSLATION_H
|
||||||
|
Loading…
Reference in New Issue
Block a user