mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-02-23 09:25:37 +05:00
DCQ : Architecture GEOM...
This commit is contained in:
parent
eb29abbc33
commit
d819746a78
@ -32,6 +32,10 @@ using namespace std;
|
||||
#include "QAD_RightFrame.h"
|
||||
#include "OCCViewer_Viewer3d.h"
|
||||
#include "OCCViewer_ViewPort3d.h"
|
||||
#include "SALOMEGUI_QtCatchCorbaException.hxx"
|
||||
|
||||
#include <Precision.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
|
||||
#include "BasicGUI_PointDlg.h" // Method POINT
|
||||
#include "BasicGUI_LineDlg.h" // Method LINE
|
||||
@ -42,8 +46,6 @@ using namespace std;
|
||||
#include "BasicGUI_PlaneDlg.h" // Method PLANE
|
||||
#include "BasicGUI_WorkingPlaneDlg.h" // Method WORKING PLANE
|
||||
|
||||
static BasicGUI* myBasicGUI = 0;
|
||||
|
||||
//=======================================================================
|
||||
// function : BasicGUI()
|
||||
// purpose : Constructor
|
||||
@ -51,9 +53,9 @@ static BasicGUI* myBasicGUI = 0;
|
||||
BasicGUI::BasicGUI() :
|
||||
QObject()
|
||||
{
|
||||
myGeomGUI = GEOMBase_Context::GetGeomGUI();
|
||||
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
|
||||
myGeom = GEOM::GEOM_Gen::_narrow(comp);
|
||||
myGeomBase = new GEOMBase();
|
||||
myGeomGUI = GEOMContext::GetGeomGUI();
|
||||
myGeom = myGeomGUI->myComponentGeom;
|
||||
}
|
||||
|
||||
|
||||
@ -66,25 +68,13 @@ 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()
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
bool BasicGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
||||
{
|
||||
BasicGUI::GetOrCreateGUI();
|
||||
BasicGUI* myBasicGUI = new BasicGUI();
|
||||
myBasicGUI->myGeomGUI->EmitSignalDeactivateDialog();
|
||||
SALOME_Selection* Sel = SALOME_Selection::Selection(myBasicGUI->myGeomGUI->GetActiveStudy()->getSelection());
|
||||
|
||||
@ -145,6 +135,51 @@ bool BasicGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : 0nMousePress()
|
||||
// purpose : [static] manage mouse events
|
||||
//=================================================================================
|
||||
bool BasicGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
|
||||
{
|
||||
BasicGUI* myBasicGUI = new BasicGUI();
|
||||
|
||||
if(myBasicGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
|
||||
return false;
|
||||
|
||||
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myBasicGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
||||
Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
|
||||
OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)studyFrame->getRightFrame()->getViewFrame())->getViewPort();
|
||||
|
||||
/* Get the clicked or selected point */
|
||||
gp_Pnt thePoint;
|
||||
|
||||
myBasicGUI->myGeomBase->EraseSimulationShape();
|
||||
BasicGUI_PointDlg *DialogPt = (BasicGUI_PointDlg*)(myBasicGUI->myGeomGUI->GetActiveDialogBox());
|
||||
|
||||
if(DialogPt->UseLocalContext()) {
|
||||
ic->InitSelected();
|
||||
if(pe->state() == Qt::ShiftButton)
|
||||
v3d->getAISSelector()->shiftSelect(); /* Append selection */
|
||||
else
|
||||
v3d->getAISSelector()->select(); /* New selection */
|
||||
|
||||
if(ic->MoreSelected())
|
||||
thePoint = BRep_Tool::Pnt(TopoDS::Vertex(ic->SelectedShape()));
|
||||
else
|
||||
thePoint = myBasicGUI->myGeomBase->ConvertClickToPoint(pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView());
|
||||
}
|
||||
else
|
||||
thePoint = myBasicGUI->myGeomBase->ConvertClickToPoint(pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView());
|
||||
|
||||
if(DialogPt != 0)
|
||||
DialogPt->PointIntoCoordinates(thePoint, true); /* display point */
|
||||
else
|
||||
myBasicGUI->myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT"));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : MakePointAndDisplay
|
||||
// purpose :
|
||||
@ -154,7 +189,7 @@ void BasicGUI::MakePointAndDisplay(const double x, const double y, const double
|
||||
try {
|
||||
GEOM::GEOM_Shape_var P = myGeom->MakeVertex(x, y, z);
|
||||
P->NameType(tr("GEOM_VERTEX"));
|
||||
if (myGeomGUI->Display(P))
|
||||
if (myGeomBase->Display(P))
|
||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
|
||||
}
|
||||
catch(const SALOME::SALOME_Exception& S_ex) {
|
||||
@ -172,7 +207,7 @@ void BasicGUI::MakeLineAndDisplay(const gp_Pnt InitPoint, const gp_Pnt LastPoint
|
||||
{
|
||||
gp_Pnt P1, P2;
|
||||
double dx, dy, dz;
|
||||
myGeomGUI->GetBipointDxDyDz(InitPoint, LastPoint, dx, dy, dz);
|
||||
myGeomBase->GetBipointDxDyDz(InitPoint, LastPoint, dx, dy, dz);
|
||||
Standard_Real length = InitPoint.Distance(LastPoint);
|
||||
if(length <= Precision::Confusion()) {
|
||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT"));
|
||||
@ -203,7 +238,7 @@ void BasicGUI::MakeLineAndDisplay(const gp_Pnt InitPoint, const gp_Pnt LastPoint
|
||||
}
|
||||
result->NameType(tr("GEOM_LINE"));
|
||||
|
||||
if(myGeomGUI->Display(result))
|
||||
if(myGeomBase->Display(result))
|
||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_READY"));
|
||||
}
|
||||
catch(const SALOME::SALOME_Exception& S_ex) {
|
||||
@ -230,7 +265,7 @@ void BasicGUI::MakeCircleAndDisplay(const gp_Pnt CenterPoint, const gp_Dir dir,
|
||||
return;
|
||||
}
|
||||
result->NameType(tr("GEOM_CIRCLE"));
|
||||
if(myGeomGUI->Display(result))
|
||||
if(myGeomBase->Display(result))
|
||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
|
||||
}
|
||||
catch(const SALOME::SALOME_Exception& S_ex) {
|
||||
@ -258,7 +293,7 @@ void BasicGUI::MakeEllipseAndDisplay(const gp_Pnt CenterPoint, const gp_Dir dir,
|
||||
return;
|
||||
}
|
||||
result->NameType(tr("GEOM_ELLIPSE"));
|
||||
if(myGeomGUI->Display(result))
|
||||
if(myGeomBase->Display(result))
|
||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
|
||||
}
|
||||
catch(const SALOME::SALOME_Exception& S_ex) {
|
||||
@ -289,7 +324,7 @@ void BasicGUI::MakeArcAndDisplay(gp_Pnt InitPoint, gp_Pnt CirclePoint, gp_Pnt En
|
||||
return;
|
||||
}
|
||||
result->NameType(tr("GEOM_ARC"));
|
||||
if (myGeomGUI->Display(result))
|
||||
if (myGeomBase->Display(result))
|
||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
|
||||
}
|
||||
catch(const SALOME::SALOME_Exception& S_ex) {
|
||||
@ -310,7 +345,7 @@ void BasicGUI::MakeVectorAndDisplay(const gp_Pnt P1, const gp_Pnt P2)
|
||||
GEOM::PointStruct pstruct2 = myGeom->MakePointStruct(P2.X(), P2.Y(), P2.Z());
|
||||
GEOM::GEOM_Shape_var Vector = myGeom->MakeVector(pstruct1, pstruct2);
|
||||
Vector->NameType(tr("GEOM_VECTOR"));
|
||||
if(myGeomGUI->Display(Vector))
|
||||
if(myGeomBase->Display(Vector))
|
||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
|
||||
}
|
||||
catch(const SALOME::SALOME_Exception& S_ex) {
|
||||
@ -337,7 +372,7 @@ void BasicGUI::MakePlaneAndDisplay(const gp_Pnt P1, const Standard_Real dx, cons
|
||||
GEOM::DirStruct dstruct = myGeom->MakeDirection(d);
|
||||
GEOM::GEOM_Shape_ptr plane = myGeom->MakePlane(pstruct, dstruct, TrimSize);
|
||||
plane->NameType(tr("GEOM_PLANE"));
|
||||
if(myGeomGUI->Display(plane))
|
||||
if(myGeomBase->Display(plane))
|
||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
|
||||
}
|
||||
catch(const SALOME::SALOME_Exception& S_ex) {
|
||||
@ -374,4 +409,7 @@ extern "C"
|
||||
{
|
||||
bool OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
||||
{return BasicGUI::OnGUIEvent(theCommandID, parent);}
|
||||
|
||||
bool OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
|
||||
{return BasicGUI::OnMousePress(pe, parent, studyFrame);}
|
||||
}
|
||||
|
@ -29,8 +29,7 @@
|
||||
#ifndef BASICGUI_H
|
||||
#define BASICGUI_H
|
||||
|
||||
#include "GEOMBase_Display.h"
|
||||
#include "QAD_Config.h"
|
||||
#include "GEOMBase.h"
|
||||
|
||||
//=================================================================================
|
||||
// class : BasicGUI
|
||||
@ -44,8 +43,8 @@ public :
|
||||
BasicGUI();
|
||||
~BasicGUI();
|
||||
|
||||
static BasicGUI* GetOrCreateGUI();
|
||||
static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
|
||||
static bool OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame);
|
||||
|
||||
void MakePointAndDisplay(const double x, const double y, const double z);
|
||||
void MakeLineAndDisplay(const gp_Pnt InitPoint, const gp_Pnt LastPoint);
|
||||
@ -58,7 +57,8 @@ public :
|
||||
const Standard_Real dz, const Standard_Real TrimSize);
|
||||
void MakeWorkingPlane(const gp_Pnt P, const gp_Dir D);
|
||||
|
||||
GEOMBase_Context* myGeomGUI;
|
||||
GEOMBase* myGeomBase;
|
||||
GEOMContext* myGeomGUI;
|
||||
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
|
||||
|
||||
};
|
||||
|
@ -32,6 +32,7 @@ using namespace std;
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <GC_MakeArcOfCircle.hxx>
|
||||
#include <Geom_TrimmedCurve.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
//=================================================================================
|
||||
// class : BasicGUI_ArcDlg()
|
||||
@ -139,7 +140,7 @@ void BasicGUI_ArcDlg::ClickOnApply()
|
||||
myGeomGUI->GetDesktop()->putInfo(tr(""));
|
||||
if (mySimulationTopoDs.IsNull())
|
||||
return;
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myGeomBase->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
|
||||
if(myOkPoint1 && myOkPoint2 && myOkPoint3)
|
||||
@ -154,12 +155,12 @@ void BasicGUI_ArcDlg::ClickOnApply()
|
||||
//=================================================================================
|
||||
void BasicGUI_ArcDlg::SelectionIntoArgument()
|
||||
{
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myGeomBase->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
myEditCurrentArgument->setText("");
|
||||
QString aString = ""; /* name of selection */
|
||||
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
if (nbSel != 1) {
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||
myOkPoint1 = false;
|
||||
@ -172,18 +173,18 @@ void BasicGUI_ArcDlg::SelectionIntoArgument()
|
||||
|
||||
// nbSel == 1
|
||||
TopoDS_Shape S;
|
||||
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
|
||||
if(!myGeomBase->GetTopoFromSelection(mySelection, S))
|
||||
return;
|
||||
|
||||
if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) {
|
||||
if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) {
|
||||
myEditCurrentArgument->setText(aString);
|
||||
myOkPoint1 = true;
|
||||
}
|
||||
else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomGUI->VertexToPoint(S, myPoint2)) {
|
||||
else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomBase->VertexToPoint(S, myPoint2)) {
|
||||
myEditCurrentArgument->setText(aString);
|
||||
myOkPoint2 = true;
|
||||
}
|
||||
else if(myEditCurrentArgument == GroupPoints->LineEdit3 && myGeomGUI->VertexToPoint(S, myPoint3)) {
|
||||
else if(myEditCurrentArgument == GroupPoints->LineEdit3 && myGeomBase->VertexToPoint(S, myPoint3)) {
|
||||
myEditCurrentArgument->setText(aString);
|
||||
myOkPoint3 = true;
|
||||
}
|
||||
@ -252,7 +253,7 @@ void BasicGUI_ArcDlg::ActivateThisDialog()
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
if(!mySimulationTopoDs.IsNull())
|
||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||
myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -276,7 +277,7 @@ void BasicGUI_ArcDlg::enterEvent(QEvent* e)
|
||||
//=================================================================================
|
||||
void BasicGUI_ArcDlg::MakeArcSimulationAndDisplay()
|
||||
{
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myGeomBase->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
|
||||
try {
|
||||
@ -297,7 +298,7 @@ void BasicGUI_ArcDlg::MakeArcSimulationAndDisplay()
|
||||
if(Arc.IsDone()) {
|
||||
Handle(Geom_TrimmedCurve) curve = Arc.Value();
|
||||
mySimulationTopoDs = BRepBuilderAPI_MakeEdge(curve).Shape();
|
||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||
myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
|
||||
}
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "DlgRef_3Sel_QTD.h"
|
||||
|
||||
#include "BasicGUI.h"
|
||||
#include "GEOM_ShapeTypeFilter.hxx"
|
||||
|
||||
//=================================================================================
|
||||
// class : BasicGUI_ArcDlg
|
||||
|
@ -31,6 +31,7 @@ using namespace std;
|
||||
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
#include "QAD_Config.h"
|
||||
|
||||
//=================================================================================
|
||||
// class : BasicGUI_CircleDlg()
|
||||
@ -147,7 +148,7 @@ void BasicGUI_CircleDlg::ClickOnApply()
|
||||
myGeomGUI->GetDesktop()->putInfo(tr(""));
|
||||
if (mySimulationTopoDs.IsNull())
|
||||
return;
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myGeomBase->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
|
||||
if(myOkPoint1 && myOkDir)
|
||||
@ -162,12 +163,12 @@ void BasicGUI_CircleDlg::ClickOnApply()
|
||||
//=================================================================================
|
||||
void BasicGUI_CircleDlg::SelectionIntoArgument()
|
||||
{
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myGeomBase->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
myEditCurrentArgument->setText("");
|
||||
QString aString = ""; /* name of selection */
|
||||
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
if (nbSel != 1) {
|
||||
if(myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||
myOkPoint1 = false;
|
||||
@ -178,11 +179,11 @@ void BasicGUI_CircleDlg::SelectionIntoArgument()
|
||||
|
||||
/* nbSel == 1 */
|
||||
TopoDS_Shape S;
|
||||
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
|
||||
if(!myGeomBase->GetTopoFromSelection(mySelection, S))
|
||||
return;
|
||||
|
||||
/* gp_Pnt : not used */
|
||||
if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) {
|
||||
if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) {
|
||||
GroupPoints->LineEdit1->setText(aString);
|
||||
myOkPoint1 = true;
|
||||
}
|
||||
@ -251,7 +252,7 @@ void BasicGUI_CircleDlg::ActivateThisDialog()
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
if(!mySimulationTopoDs.IsNull())
|
||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||
myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -288,7 +289,7 @@ void BasicGUI_CircleDlg::ValueChangedInSpinBox(double newValue)
|
||||
//=================================================================================
|
||||
void BasicGUI_CircleDlg::MakeCircleSimulationAndDisplay()
|
||||
{
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myGeomBase->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
|
||||
try {
|
||||
@ -296,7 +297,7 @@ void BasicGUI_CircleDlg::MakeCircleSimulationAndDisplay()
|
||||
gp_Circ circ(anAxis, myRadius);
|
||||
BRepBuilderAPI_MakeEdge MakeEdge(circ);
|
||||
mySimulationTopoDs = MakeEdge.Shape();
|
||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||
myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
MESSAGE("Exception catched in MakeCircleSimulationAndDisplay");
|
||||
|
@ -34,6 +34,7 @@
|
||||
|
||||
#include "BasicGUI.h"
|
||||
|
||||
#include "GEOM_ShapeTypeFilter.hxx"
|
||||
#include <gp_Dir.hxx>
|
||||
|
||||
//=================================================================================
|
||||
|
@ -29,6 +29,7 @@ using namespace std;
|
||||
#include "BasicGUI_EllipseDlg.h"
|
||||
|
||||
#include "gp_Elips.hxx"
|
||||
#include "QAD_Config.h"
|
||||
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <BRepAdaptor_Curve.hxx>
|
||||
@ -155,7 +156,7 @@ void BasicGUI_EllipseDlg::ClickOnApply()
|
||||
myGeomGUI->GetDesktop()->putInfo(tr(""));
|
||||
if (mySimulationTopoDs.IsNull())
|
||||
return;
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myGeomBase->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
|
||||
if(myOkPoint && myOkDir)
|
||||
@ -169,12 +170,12 @@ void BasicGUI_EllipseDlg::ClickOnApply()
|
||||
//=================================================================================
|
||||
void BasicGUI_EllipseDlg::SelectionIntoArgument()
|
||||
{
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myGeomBase->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
myEditCurrentArgument->setText("");
|
||||
QString aString = ""; /* name of selection */
|
||||
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
if (nbSel != 1) {
|
||||
if(myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||
myOkPoint = false;
|
||||
@ -185,11 +186,11 @@ void BasicGUI_EllipseDlg::SelectionIntoArgument()
|
||||
|
||||
/* nbSel == 1 */
|
||||
TopoDS_Shape S;
|
||||
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
|
||||
if(!myGeomBase->GetTopoFromSelection(mySelection, S))
|
||||
return;
|
||||
|
||||
/* gp_Pnt : not used */
|
||||
if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint)) {
|
||||
if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint)) {
|
||||
GroupPoints->LineEdit1->setText(aString);
|
||||
myOkPoint = true;
|
||||
}
|
||||
@ -258,7 +259,7 @@ void BasicGUI_EllipseDlg::ActivateThisDialog()
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
if(!mySimulationTopoDs.IsNull())
|
||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||
myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -301,7 +302,7 @@ void BasicGUI_EllipseDlg::ValueChangedInSpinBox(double newValue)
|
||||
//=================================================================================
|
||||
void BasicGUI_EllipseDlg::MakeEllipseSimulationAndDisplay()
|
||||
{
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myGeomBase->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
|
||||
if(myMajorRadius < myMinorRadius)
|
||||
@ -312,7 +313,7 @@ void BasicGUI_EllipseDlg::MakeEllipseSimulationAndDisplay()
|
||||
gp_Elips ellipse(anAxis, myMajorRadius, myMinorRadius);
|
||||
BRepBuilderAPI_MakeEdge MakeEdge(ellipse);
|
||||
mySimulationTopoDs = MakeEdge.Shape();
|
||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||
myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
MESSAGE("Exception catched in MakeEllipseSimulationAndDisplay");
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
#include "BasicGUI.h"
|
||||
|
||||
#include "GEOM_ShapeTypeFilter.hxx"
|
||||
#include <gp_Dir.hxx>
|
||||
|
||||
//=================================================================================
|
||||
|
@ -32,6 +32,7 @@ using namespace std;
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
//=================================================================================
|
||||
// class : BasicGUI_LineDlg()
|
||||
@ -137,7 +138,7 @@ void BasicGUI_LineDlg::ClickOnApply()
|
||||
myGeomGUI->GetDesktop()->putInfo(tr(""));
|
||||
if (mySimulationTopoDs.IsNull())
|
||||
return;
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myGeomBase->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
|
||||
if(myOkPoint1 && myOkPoint2)
|
||||
@ -152,12 +153,12 @@ void BasicGUI_LineDlg::ClickOnApply()
|
||||
//=================================================================================
|
||||
void BasicGUI_LineDlg::SelectionIntoArgument()
|
||||
{
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myGeomBase->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
myEditCurrentArgument->setText("");
|
||||
QString aString = ""; /* name of selection */
|
||||
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
if(nbSel != 1) {
|
||||
if(myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||
myOkPoint1 = false;
|
||||
@ -168,14 +169,14 @@ void BasicGUI_LineDlg::SelectionIntoArgument()
|
||||
|
||||
// nbSel == 1
|
||||
TopoDS_Shape S;
|
||||
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
|
||||
if(!myGeomBase->GetTopoFromSelection(mySelection, S))
|
||||
return;
|
||||
|
||||
if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) {
|
||||
if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) {
|
||||
myEditCurrentArgument->setText(aString);
|
||||
myOkPoint1 = true;
|
||||
}
|
||||
else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomGUI->VertexToPoint(S, myPoint2)) {
|
||||
else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomBase->VertexToPoint(S, myPoint2)) {
|
||||
myEditCurrentArgument->setText(aString);
|
||||
myOkPoint2 = true;
|
||||
}
|
||||
@ -238,7 +239,7 @@ void BasicGUI_LineDlg::ActivateThisDialog()
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
if(!mySimulationTopoDs.IsNull())
|
||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||
myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -264,13 +265,13 @@ void BasicGUI_LineDlg::enterEvent(QEvent* e)
|
||||
//=================================================================================
|
||||
void BasicGUI_LineDlg::MakeLineSimulationAndDisplay()
|
||||
{
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myGeomBase->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
|
||||
try {
|
||||
mySimulationTopoDs = BRepBuilderAPI_MakeEdge(myPoint1, myPoint2).Shape();
|
||||
TopoDS_Shape arrow;
|
||||
if(myGeomGUI->CreateArrowForLinearEdge(mySimulationTopoDs, arrow)) {
|
||||
if(myGeomBase->CreateArrowForLinearEdge(mySimulationTopoDs, arrow)) {
|
||||
TopoDS_Compound Comp;
|
||||
BRep_Builder B;
|
||||
B.MakeCompound (Comp);
|
||||
@ -278,7 +279,7 @@ void BasicGUI_LineDlg::MakeLineSimulationAndDisplay()
|
||||
B.Add(Comp, arrow);
|
||||
mySimulationTopoDs = Comp;
|
||||
}
|
||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||
myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
MESSAGE("Exception catched in MakeLineSimulationAndDisplay");
|
||||
|
@ -33,6 +33,7 @@
|
||||
#include "DlgRef_2Sel_QTD.h"
|
||||
|
||||
#include "BasicGUI.h"
|
||||
#include "GEOM_ShapeTypeFilter.hxx"
|
||||
|
||||
//=================================================================================
|
||||
// class : BasicGUI_LineDlg
|
||||
|
@ -34,6 +34,8 @@ using namespace std;
|
||||
#include <gp_Pln.hxx>
|
||||
#include <gp_Ax1.hxx>
|
||||
#include <gp_Dir.hxx>
|
||||
#include <Precision.hxx>
|
||||
#include "QAD_Config.h"
|
||||
|
||||
//=================================================================================
|
||||
// class : BasicGUI_PlaneDlg()
|
||||
@ -193,7 +195,7 @@ void BasicGUI_PlaneDlg::ConstructorsClicked(int constructorId)
|
||||
{
|
||||
myConstructorId = constructorId;
|
||||
mySelection->ClearFilters();
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myGeomBase->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
myOkPoint1 = myOkDirection = myOkCoordinates = myOkPlanarFace = false;
|
||||
@ -273,7 +275,7 @@ void BasicGUI_PlaneDlg::ClickOnApply()
|
||||
myGeomGUI->GetDesktop()->putInfo(tr(""));
|
||||
if (mySimulationTopoDs.IsNull())
|
||||
return;
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myGeomBase->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
|
||||
switch(myConstructorId)
|
||||
@ -307,11 +309,11 @@ void BasicGUI_PlaneDlg::ClickOnApply()
|
||||
//=================================================================================
|
||||
void BasicGUI_PlaneDlg::SelectionIntoArgument()
|
||||
{
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myGeomBase->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
QString aString = "";
|
||||
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
if(nbSel != 1) {
|
||||
switch (myConstructorId)
|
||||
{
|
||||
@ -352,19 +354,19 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument()
|
||||
|
||||
/* nbSel == 1 */
|
||||
TopoDS_Shape S;
|
||||
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
|
||||
if(!myGeomBase->GetTopoFromSelection(mySelection, S))
|
||||
return ;
|
||||
|
||||
/* FIRST CONSTRUCTOR */
|
||||
if(myEditCurrentArgument == GroupPointDirection->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) {
|
||||
if(myEditCurrentArgument == GroupPointDirection->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) {
|
||||
GroupPointDirection->LineEdit1->setText(aString);
|
||||
myOkPoint1 = true;
|
||||
}
|
||||
else if( myEditCurrentArgument == GroupPointDirection->LineEdit2) {
|
||||
/* We verify if the selection is a linear edge */
|
||||
gp_Pnt Pfirst, Plast;
|
||||
if( myGeomGUI->LinearEdgeExtremities(S, Pfirst, Plast)) {
|
||||
myGeomGUI->GetBipointDxDyDz(Pfirst, Plast, myDx, myDy, myDz);
|
||||
if( myGeomBase->LinearEdgeExtremities(S, Pfirst, Plast)) {
|
||||
myGeomBase->GetBipointDxDyDz(Pfirst, Plast, myDx, myDy, myDz);
|
||||
GroupPointDirection->LineEdit2->setText(aString);
|
||||
myOkDirection = true;
|
||||
myTrimSize = GroupPointDirection->SpinBox_DX->GetValue();
|
||||
@ -372,7 +374,7 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument()
|
||||
}
|
||||
|
||||
/* SECOND CONSTRUCTOR */
|
||||
else if(myEditCurrentArgument == GroupPointPlusCoordinates->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) {
|
||||
else if(myEditCurrentArgument == GroupPointPlusCoordinates->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) {
|
||||
GroupPointPlusCoordinates->LineEdit1->setText(aString);
|
||||
/* Get arguments */
|
||||
myDx = GroupPointPlusCoordinates->SpinBox_DX->GetValue();
|
||||
@ -492,7 +494,7 @@ void BasicGUI_PlaneDlg::ActivateThisDialog()
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
if(!mySimulationTopoDs.IsNull())
|
||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||
myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -543,7 +545,7 @@ void BasicGUI_PlaneDlg::ValueChangedInSpinBox(double newValue)
|
||||
//=================================================================================
|
||||
void BasicGUI_PlaneDlg::MakePlaneSimulationAndDisplay()
|
||||
{
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myGeomBase->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
|
||||
try {
|
||||
@ -551,7 +553,7 @@ void BasicGUI_PlaneDlg::MakePlaneSimulationAndDisplay()
|
||||
/* We make a trimmed plane */
|
||||
gp_Pln gplane(myPoint1, aDirection);
|
||||
mySimulationTopoDs = BRepBuilderAPI_MakeFace(gplane, -myTrimSize, +myTrimSize, -myTrimSize, +myTrimSize);
|
||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||
myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
MESSAGE( "Exception catched in MakePlaneSimulation" << endl );
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "BasicGUI.h"
|
||||
|
||||
#include "GEOM_FaceFilter.hxx"
|
||||
#include "GEOM_ShapeTypeFilter.hxx"
|
||||
|
||||
//=================================================================================
|
||||
// class : BasicGUI_PlaneDlg
|
||||
|
@ -34,6 +34,8 @@ using namespace std;
|
||||
#include <BRepAlgoAPI.hxx>
|
||||
#include <Geom_Curve.hxx>
|
||||
|
||||
#include "QAD_Config.h"
|
||||
|
||||
//=================================================================================
|
||||
// class : BasicGUI_PointDlg()
|
||||
// purpose : Constructs a BasicGUI_PointDlg which is a child of 'parent', with the
|
||||
@ -126,7 +128,7 @@ void BasicGUI_PointDlg::Init(const Handle(AIS_InteractiveContext)& ic)
|
||||
|
||||
if (myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
|
||||
myLocalContextId = myIC->OpenLocalContext();
|
||||
myGeomGUI->SetDisplayedObjectList();
|
||||
myGeomBase->SetDisplayedObjectList();
|
||||
/* sub shapes selection */
|
||||
myLocalContextMode = TopAbs_VERTEX;
|
||||
myIC->ActivateStandardMode(myLocalContextMode);
|
||||
@ -137,9 +139,9 @@ void BasicGUI_PointDlg::Init(const Handle(AIS_InteractiveContext)& ic)
|
||||
|
||||
TopoDS_Shape S;
|
||||
bool displayPoint = true;
|
||||
if(myGeomGUI->GetTopoFromSelection(mySelection, S)) {
|
||||
if(myGeomBase->GetTopoFromSelection(mySelection, S)) {
|
||||
/* Filter a possibly previous selection and try to put it into coordinates */
|
||||
if(myGeomGUI->VertexToPoint(S, myPoint))
|
||||
if(myGeomBase->VertexToPoint(S, myPoint))
|
||||
displayPoint = false;
|
||||
}
|
||||
|
||||
@ -180,7 +182,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
|
||||
{
|
||||
myConstructorId = constructorId;
|
||||
mySelection->ClearFilters();
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myGeomBase->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
disconnect(mySelection, 0, this, 0);
|
||||
|
||||
@ -210,7 +212,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
|
||||
{
|
||||
if(myUseLocalContext == false && myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
|
||||
myLocalContextId = myIC->OpenLocalContext();
|
||||
myGeomGUI->SetDisplayedObjectList();
|
||||
myGeomBase->SetDisplayedObjectList();
|
||||
/* sub shapes selection */
|
||||
myLocalContextMode = TopAbs_VERTEX;
|
||||
myIC->ActivateStandardMode(myLocalContextMode);
|
||||
@ -251,7 +253,7 @@ void BasicGUI_PointDlg::ClickOnApply()
|
||||
myGeomGUI->GetDesktop()->putInfo(tr(""));
|
||||
if(mySimulationTopoDs.IsNull())
|
||||
return;
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myGeomBase->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
|
||||
/* Close local context */
|
||||
@ -281,7 +283,7 @@ void BasicGUI_PointDlg::ClickOnApply()
|
||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
|
||||
/* no display if a local context is opened */
|
||||
myLocalContextId = myIC->OpenLocalContext();
|
||||
myGeomGUI->SetDisplayedObjectList();
|
||||
myGeomBase->SetDisplayedObjectList();
|
||||
/* sub shapes selection */
|
||||
myLocalContextMode = TopAbs_VERTEX;
|
||||
myIC->ActivateStandardMode(myLocalContextMode);
|
||||
@ -300,12 +302,12 @@ void BasicGUI_PointDlg::ClickOnApply()
|
||||
//=================================================================================
|
||||
void BasicGUI_PointDlg::SelectionIntoArgument()
|
||||
{
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myGeomBase->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
myEditCurrentArgument->setText("");
|
||||
QString aString = ""; /* name of selection */
|
||||
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
if(nbSel != 1) {
|
||||
myOkEdge = false;
|
||||
return;
|
||||
@ -313,15 +315,15 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
|
||||
|
||||
// nbSel == 1
|
||||
TopoDS_Shape S;
|
||||
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
|
||||
if(!myGeomBase->GetTopoFromSelection(mySelection, S))
|
||||
return;
|
||||
|
||||
if(S.ShapeType() == TopAbs_EDGE) {
|
||||
if(CalculateVertexOnCurve(TopoDS::Edge(S), myParameter, mySimulationTopoDs)) {
|
||||
if(myGeomGUI->VertexToPoint(mySimulationTopoDs, myPoint)) {
|
||||
if(myGeomBase->VertexToPoint(mySimulationTopoDs, myPoint)) {
|
||||
GroupPoints->LineEdit1->setText(aString);
|
||||
myOkEdge = true;
|
||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||
myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -391,7 +393,7 @@ void BasicGUI_PointDlg::ActivateThisDialog( )
|
||||
// OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
||||
// myIC = v3d->getAISContext();
|
||||
// myLocalContextId = myIC->OpenLocalContext();
|
||||
// myGeomGUI->SetDisplayedObjectList();
|
||||
// myGeomBase->SetDisplayedObjectList();
|
||||
// /* sub shapes selection */
|
||||
// myLocalContextMode = TopAbs_VERTEX ;
|
||||
// myIC->ActivateStandardMode(myLocalContextMode);
|
||||
@ -399,7 +401,7 @@ void BasicGUI_PointDlg::ActivateThisDialog( )
|
||||
// }
|
||||
|
||||
if(!mySimulationTopoDs.IsNull())
|
||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||
myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -441,7 +443,7 @@ void BasicGUI_PointDlg::ValueChangedInSpinBox(double newValue)
|
||||
{
|
||||
myPoint.SetCoord(vx, vy, vz);
|
||||
mySimulationTopoDs = BRepBuilderAPI_MakeVertex (myPoint).Shape();
|
||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||
myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -494,7 +496,7 @@ void BasicGUI_PointDlg::PointIntoCoordinates(gp_Pnt P, bool displayPoint)
|
||||
this->myPoint.SetCoord(P.X(), P.Y(), P.Z());
|
||||
if(displayPoint) {
|
||||
mySimulationTopoDs = BRepBuilderAPI_MakeVertex(P).Shape();
|
||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||
myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -35,6 +35,7 @@
|
||||
|
||||
#include "BasicGUI.h"
|
||||
|
||||
#include "GEOM_ShapeTypeFilter.hxx"
|
||||
#include <TopoDS_Edge.hxx>
|
||||
|
||||
//=================================================================================
|
||||
|
@ -29,10 +29,12 @@
|
||||
using namespace std;
|
||||
#include "BasicGUI_VectorDlg.h"
|
||||
|
||||
#include "QAD_Config.h"
|
||||
#include <TopoDS_Shape.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <BRep_Builder.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
//=================================================================================
|
||||
// class : BasicGUI_VectorDlg()
|
||||
@ -166,7 +168,7 @@ void BasicGUI_VectorDlg::ConstructorsClicked(int constructorId)
|
||||
{
|
||||
myConstructorId = constructorId;
|
||||
mySelection->ClearFilters();
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myGeomBase->EraseSimulationShape();
|
||||
disconnect(mySelection, 0, this, 0);
|
||||
myOkPoint1 = myOkPoint2 = false;
|
||||
|
||||
@ -209,7 +211,7 @@ void BasicGUI_VectorDlg::ConstructorsClicked(int constructorId)
|
||||
mySimulationTopoDs = BRepBuilderAPI_MakeEdge(myPoint1, myPoint2).Shape();
|
||||
/* Add arrow in simulation */
|
||||
bool noNeedToTest = AddArrowToSimulation(mySimulationTopoDs);
|
||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||
myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -238,7 +240,7 @@ void BasicGUI_VectorDlg::ClickOnApply()
|
||||
myGeomGUI->GetDesktop()->putInfo(tr(""));
|
||||
if (mySimulationTopoDs.IsNull())
|
||||
return;
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myGeomBase->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
|
||||
switch(myConstructorId)
|
||||
@ -271,11 +273,11 @@ void BasicGUI_VectorDlg::ClickOnApply()
|
||||
//=================================================================================
|
||||
void BasicGUI_VectorDlg::SelectionIntoArgument()
|
||||
{
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myGeomBase->EraseSimulationShape();
|
||||
myEditCurrentArgument->setText("");
|
||||
QString aString = ""; /* name of selection */
|
||||
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
if (nbSel != 1) {
|
||||
if (myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||
myOkPoint1 = false;
|
||||
@ -286,14 +288,14 @@ void BasicGUI_VectorDlg::SelectionIntoArgument()
|
||||
|
||||
// nbSel == 1
|
||||
TopoDS_Shape S;
|
||||
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
|
||||
if(!myGeomBase->GetTopoFromSelection(mySelection, S))
|
||||
return;
|
||||
|
||||
if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) {
|
||||
if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) {
|
||||
myEditCurrentArgument->setText(aString);
|
||||
myOkPoint1 = true;
|
||||
}
|
||||
else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomGUI->VertexToPoint(S, myPoint2)) {
|
||||
else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomBase->VertexToPoint(S, myPoint2)) {
|
||||
myEditCurrentArgument->setText(aString);
|
||||
myOkPoint2 = true;
|
||||
}
|
||||
@ -302,7 +304,7 @@ void BasicGUI_VectorDlg::SelectionIntoArgument()
|
||||
mySimulationTopoDs = BRepBuilderAPI_MakeEdge(myPoint1, myPoint2).Shape();
|
||||
/* Add arrow in simulation */
|
||||
bool noNeedToTest = this->AddArrowToSimulation(mySimulationTopoDs);
|
||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||
myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -362,7 +364,7 @@ void BasicGUI_VectorDlg::ActivateThisDialog()
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
if(!mySimulationTopoDs.IsNull())
|
||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||
myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -386,7 +388,7 @@ void BasicGUI_VectorDlg::enterEvent(QEvent* e)
|
||||
//=================================================================================
|
||||
void BasicGUI_VectorDlg::ValueChangedInSpinBox( double newValue )
|
||||
{
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myGeomBase->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
QObject* send = (QObject*)sender();
|
||||
|
||||
@ -411,7 +413,7 @@ void BasicGUI_VectorDlg::ValueChangedInSpinBox( double newValue )
|
||||
mySimulationTopoDs = BRepBuilderAPI_MakeEdge(myPoint1, myPoint2).Shape();
|
||||
/* Create simulation vector with an arrow */
|
||||
this->AddArrowToSimulation(mySimulationTopoDs);
|
||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||
myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -427,7 +429,7 @@ bool BasicGUI_VectorDlg::AddArrowToSimulation(TopoDS_Shape& modifiedShape)
|
||||
{
|
||||
TopoDS_Shape arrow;
|
||||
/* Try to add a cone simulation shape to show direction of a linear edge */
|
||||
if(myGeomGUI->CreateArrowForLinearEdge(modifiedShape, arrow)) {
|
||||
if(myGeomBase->CreateArrowForLinearEdge(modifiedShape, arrow)) {
|
||||
TopoDS_Compound Comp;
|
||||
BRep_Builder B;
|
||||
B.MakeCompound (Comp);
|
||||
@ -446,7 +448,7 @@ bool BasicGUI_VectorDlg::AddArrowToSimulation(TopoDS_Shape& modifiedShape)
|
||||
//=================================================================================
|
||||
void BasicGUI_VectorDlg::ReverseVector(int state)
|
||||
{
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myGeomBase->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
|
||||
myDx = -myDx;
|
||||
@ -465,7 +467,7 @@ void BasicGUI_VectorDlg::ReverseVector(int state)
|
||||
mySimulationTopoDs = BRepBuilderAPI_MakeEdge(myPoint1, myPoint2).Shape();
|
||||
/* Add arrow in simulation */
|
||||
bool noNeedToTest = this->AddArrowToSimulation(mySimulationTopoDs);
|
||||
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
|
||||
myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "DlgRef_3Spin1Check.h"
|
||||
|
||||
#include "BasicGUI.h"
|
||||
#include "GEOM_ShapeTypeFilter.hxx"
|
||||
|
||||
//=================================================================================
|
||||
// class : BasicGUI_VectorDlg
|
||||
|
@ -144,7 +144,7 @@ void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument()
|
||||
myEditCurrentArgument->setText("");
|
||||
QString aString = "";
|
||||
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
if(nbSel != 1) {
|
||||
myOkPlane = false;
|
||||
return;
|
||||
@ -152,7 +152,7 @@ void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument()
|
||||
|
||||
/* nbSel == 1 */
|
||||
TopoDS_Shape S;
|
||||
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
|
||||
if(!myGeomBase->GetTopoFromSelection(mySelection, S))
|
||||
return;
|
||||
|
||||
BRepAdaptor_Surface surf(TopoDS::Face(S));
|
||||
|
@ -35,8 +35,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl
|
||||
@COMMENCE@
|
||||
|
||||
# header files
|
||||
EXPORT_HEADERS= BasicGUI.h \
|
||||
BasicGUI_PointDlg.h
|
||||
EXPORT_HEADERS= BasicGUI_PointDlg.h
|
||||
|
||||
# Libraries targets
|
||||
LIB = libBasicGUI.la
|
||||
@ -77,6 +76,6 @@ LIB_SERVER_IDL =
|
||||
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
|
||||
|
||||
LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lDlgRef -lGEOMBase $(OCC_KERNEL_LIBS) $(OCC_MODELER_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome
|
||||
LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lDlgRef -lGEOMContext -lGEOMBase -L${KERNEL_ROOT_DIR}/lib/salome
|
||||
|
||||
@CONCLUDE@
|
||||
|
@ -29,13 +29,13 @@
|
||||
using namespace std;
|
||||
#include "BooleanGUI.h"
|
||||
|
||||
#include "SALOMEGUI_QtCatchCorbaException.hxx"
|
||||
|
||||
#include "BooleanGUI_FuseDlg.h" // Method FUSE
|
||||
#include "BooleanGUI_CommonDlg.h" // Method COMMON
|
||||
#include "BooleanGUI_CutDlg.h" // Method CUT
|
||||
#include "BooleanGUI_SectionDlg.h" // Method SECTION
|
||||
|
||||
static BooleanGUI* myBooleanGUI = 0;
|
||||
|
||||
//=======================================================================
|
||||
// function : BooleanGUI()
|
||||
// purpose : Constructor
|
||||
@ -43,9 +43,9 @@ static BooleanGUI* myBooleanGUI = 0;
|
||||
BooleanGUI::BooleanGUI() :
|
||||
QObject()
|
||||
{
|
||||
myGeomGUI = GEOMBase_Context::GetGeomGUI();
|
||||
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
|
||||
myGeom = GEOM::GEOM_Gen::_narrow(comp);
|
||||
myGeomBase = new GEOMBase();
|
||||
myGeomGUI = GEOMContext::GetGeomGUI();
|
||||
myGeom = myGeomGUI->myComponentGeom;
|
||||
}
|
||||
|
||||
|
||||
@ -58,25 +58,13 @@ 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()
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
bool BooleanGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
||||
{
|
||||
BooleanGUI::GetOrCreateGUI();
|
||||
BooleanGUI* myBooleanGUI = new BooleanGUI();
|
||||
myBooleanGUI->myGeomGUI->EmitSignalDeactivateDialog();
|
||||
SALOME_Selection* Sel = SALOME_Selection::Selection(myBooleanGUI->myGeomGUI->GetActiveStudy()->getSelection());
|
||||
|
||||
@ -127,10 +115,10 @@ void BooleanGUI::MakeBooleanAndDisplay(GEOM::GEOM_Shape_ptr Shape1, GEOM::GEOM_S
|
||||
|
||||
TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result);
|
||||
Standard_CString type;
|
||||
myGeomGUI->GetShapeTypeString(S,type);
|
||||
myGeomBase->GetShapeTypeString(S,type);
|
||||
result->NameType(type);
|
||||
|
||||
if (myGeomGUI->Display(result, ""))
|
||||
if (myGeomBase->Display(result))
|
||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
|
||||
}
|
||||
catch (const SALOME::SALOME_Exception& S_ex) {
|
||||
|
@ -29,7 +29,7 @@
|
||||
#ifndef BOOLEANGUI_H
|
||||
#define BOOLEANGUI_H
|
||||
|
||||
#include "GEOMBase_Display.h"
|
||||
#include "GEOMBase.h"
|
||||
|
||||
//=================================================================================
|
||||
// class : BooleanGUI
|
||||
@ -43,14 +43,14 @@ public :
|
||||
BooleanGUI();
|
||||
~BooleanGUI();
|
||||
|
||||
static BooleanGUI* GetOrCreateGUI();
|
||||
static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
|
||||
|
||||
void MakeBooleanAndDisplay(GEOM::GEOM_Shape_ptr Shape1,
|
||||
GEOM::GEOM_Shape_ptr Shape2,
|
||||
const short operation);
|
||||
|
||||
GEOMBase_Context* myGeomGUI;
|
||||
GEOMBase* myGeomBase;
|
||||
GEOMContext* myGeomGUI;
|
||||
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
|
||||
|
||||
};
|
||||
|
@ -146,7 +146,7 @@ void BooleanGUI_CommonDlg::SelectionIntoArgument()
|
||||
myEditCurrentArgument->setText("");
|
||||
QString aString = "";
|
||||
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
if(nbSel != 1) {
|
||||
if(myEditCurrentArgument == GroupCommon->LineEdit1)
|
||||
myOkShape1 = false;
|
||||
@ -160,11 +160,11 @@ void BooleanGUI_CommonDlg::SelectionIntoArgument()
|
||||
Standard_Boolean testResult;
|
||||
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
|
||||
|
||||
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
|
||||
if(!myGeomBase->GetTopoFromSelection(mySelection, S))
|
||||
return;
|
||||
|
||||
if(myEditCurrentArgument == GroupCommon->LineEdit1) {
|
||||
myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
|
||||
myGeomShape1 = myGeomBase->ConvertIOinGEOMShape(IO, testResult);
|
||||
if(!testResult)
|
||||
return;
|
||||
myShape1 = S;
|
||||
@ -172,7 +172,7 @@ void BooleanGUI_CommonDlg::SelectionIntoArgument()
|
||||
myOkShape1 = true;
|
||||
}
|
||||
else if(myEditCurrentArgument == GroupCommon->LineEdit2) {
|
||||
myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
|
||||
myGeomShape2 = myGeomBase->ConvertIOinGEOMShape(IO, testResult);
|
||||
if(!testResult)
|
||||
return;
|
||||
myShape2 = S;
|
||||
|
@ -145,7 +145,7 @@ void BooleanGUI_CutDlg::SelectionIntoArgument()
|
||||
myEditCurrentArgument->setText("");
|
||||
QString aString = "";
|
||||
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
if(nbSel != 1) {
|
||||
if(myEditCurrentArgument == GroupCut->LineEdit1)
|
||||
myOkShape1 = false;
|
||||
@ -159,11 +159,11 @@ void BooleanGUI_CutDlg::SelectionIntoArgument()
|
||||
Standard_Boolean testResult;
|
||||
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
|
||||
|
||||
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
|
||||
if(!myGeomBase->GetTopoFromSelection(mySelection, S))
|
||||
return;
|
||||
|
||||
if(myEditCurrentArgument == GroupCut->LineEdit1) {
|
||||
myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
|
||||
myGeomShape1 = myGeomBase->ConvertIOinGEOMShape(IO, testResult);
|
||||
if(!testResult)
|
||||
return;
|
||||
myShape1 = S;
|
||||
@ -171,7 +171,7 @@ void BooleanGUI_CutDlg::SelectionIntoArgument()
|
||||
myOkShape1 = true;
|
||||
}
|
||||
else if(myEditCurrentArgument == GroupCut->LineEdit2) {
|
||||
myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
|
||||
myGeomShape2 = myGeomBase->ConvertIOinGEOMShape(IO, testResult);
|
||||
if(!testResult)
|
||||
return;
|
||||
myShape2 = S;
|
||||
|
@ -145,7 +145,7 @@ void BooleanGUI_FuseDlg::SelectionIntoArgument()
|
||||
myEditCurrentArgument->setText("");
|
||||
QString aString = "";
|
||||
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
if(nbSel != 1) {
|
||||
if(myEditCurrentArgument == GroupFuse->LineEdit1)
|
||||
myOkShape1 = false;
|
||||
@ -159,11 +159,11 @@ void BooleanGUI_FuseDlg::SelectionIntoArgument()
|
||||
Standard_Boolean testResult;
|
||||
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
|
||||
|
||||
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
|
||||
if(!myGeomBase->GetTopoFromSelection(mySelection, S))
|
||||
return;
|
||||
|
||||
if(myEditCurrentArgument == GroupFuse->LineEdit1) {
|
||||
myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
|
||||
myGeomShape1 = myGeomBase->ConvertIOinGEOMShape(IO, testResult);
|
||||
if(!testResult)
|
||||
return;
|
||||
myShape1 = S;
|
||||
@ -171,7 +171,7 @@ void BooleanGUI_FuseDlg::SelectionIntoArgument()
|
||||
myOkShape1 = true;
|
||||
}
|
||||
else if(myEditCurrentArgument == GroupFuse->LineEdit2) {
|
||||
myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
|
||||
myGeomShape2 = myGeomBase->ConvertIOinGEOMShape(IO, testResult);
|
||||
if(!testResult)
|
||||
return;
|
||||
myShape2 = S;
|
||||
|
@ -146,7 +146,7 @@ void BooleanGUI_SectionDlg::SelectionIntoArgument()
|
||||
myEditCurrentArgument->setText("");
|
||||
QString aString = "";
|
||||
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
if(nbSel != 1) {
|
||||
if(myEditCurrentArgument == GroupSection->LineEdit1)
|
||||
myOkShape1 = false;
|
||||
@ -160,11 +160,11 @@ void BooleanGUI_SectionDlg::SelectionIntoArgument()
|
||||
Standard_Boolean testResult;
|
||||
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
|
||||
|
||||
if(!myGeomGUI->GetTopoFromSelection(mySelection, S))
|
||||
if(!myGeomBase->GetTopoFromSelection(mySelection, S))
|
||||
return;
|
||||
|
||||
if(myEditCurrentArgument == GroupSection->LineEdit1) {
|
||||
myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
|
||||
myGeomShape1 = myGeomBase->ConvertIOinGEOMShape(IO, testResult);
|
||||
if(!testResult)
|
||||
return;
|
||||
myShape1 = S;
|
||||
@ -172,7 +172,7 @@ void BooleanGUI_SectionDlg::SelectionIntoArgument()
|
||||
myOkShape1 = true;
|
||||
}
|
||||
else if(myEditCurrentArgument == GroupSection->LineEdit2) {
|
||||
myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
|
||||
myGeomShape2 = myGeomBase->ConvertIOinGEOMShape(IO, testResult);
|
||||
if(!testResult)
|
||||
return;
|
||||
myShape2 = S;
|
||||
|
@ -35,7 +35,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl
|
||||
@COMMENCE@
|
||||
|
||||
# header files
|
||||
EXPORT_HEADERS= BooleanGUI.h
|
||||
EXPORT_HEADERS=
|
||||
|
||||
# Libraries targets
|
||||
LIB = libBooleanGUI.la
|
||||
@ -68,6 +68,6 @@ LIB_SERVER_IDL =
|
||||
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
|
||||
|
||||
LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lDlgRef -lGEOMBase $(OCC_KERNEL_LIBS) $(OCC_MODELER_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome
|
||||
LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lDlgRef -lGEOMContext -lGEOMBase -L${KERNEL_ROOT_DIR}/lib/salome
|
||||
|
||||
@CONCLUDE@
|
||||
|
@ -29,11 +29,14 @@
|
||||
using namespace std;
|
||||
#include "BuildGUI.h"
|
||||
|
||||
#include "DisplayGUI.h"
|
||||
|
||||
#include "OCCViewer_Viewer3d.h"
|
||||
#include "VTKViewer_ViewFrame.h"
|
||||
#include "QAD_RightFrame.h"
|
||||
#include "GEOM_AssemblyBuilder.h"
|
||||
#include "SALOMEGUI_ImportOperation.h"
|
||||
#include "SALOMEGUI_QtCatchCorbaException.hxx"
|
||||
|
||||
#include <TopExp_Explorer.hxx>
|
||||
#include <TopoDS_Compound.hxx>
|
||||
@ -47,8 +50,6 @@ using namespace std;
|
||||
#include "BuildGUI_SolidDlg.h" // Method SOLID
|
||||
#include "BuildGUI_CompoundDlg.h" // Method COMPOUND
|
||||
|
||||
static BuildGUI* myBuildGUI = 0;
|
||||
|
||||
//=======================================================================
|
||||
// function : BuildGUI()
|
||||
// purpose : Constructor
|
||||
@ -56,9 +57,9 @@ static BuildGUI* myBuildGUI = 0;
|
||||
BuildGUI::BuildGUI() :
|
||||
QObject()
|
||||
{
|
||||
myGeomGUI = GEOMBase_Context::GetGeomGUI();
|
||||
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
|
||||
myGeom = GEOM::GEOM_Gen::_narrow(comp);
|
||||
myGeomBase = new GEOMBase();
|
||||
myGeomGUI = GEOMContext::GetGeomGUI();
|
||||
myGeom = myGeomGUI->myComponentGeom;
|
||||
}
|
||||
|
||||
|
||||
@ -71,25 +72,13 @@ 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()
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
bool BuildGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
||||
{
|
||||
BuildGUI::GetOrCreateGUI();
|
||||
BuildGUI* myBuildGUI = new BuildGUI();
|
||||
myBuildGUI->myGeomGUI->EmitSignalDeactivateDialog();
|
||||
SALOME_Selection* Sel = SALOME_Selection::Selection(myBuildGUI->myGeomGUI->GetActiveStudy()->getSelection());
|
||||
|
||||
@ -160,7 +149,7 @@ void BuildGUI::MakeLinearEdgeAndDisplay(const gp_Pnt P1, const gp_Pnt P2)
|
||||
return;
|
||||
}
|
||||
result->NameType(tr("GEOM_EDGE"));
|
||||
if(myGeomGUI->Display(result))
|
||||
if(myGeomBase->Display(result))
|
||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
|
||||
}
|
||||
catch(const SALOME::SALOME_Exception& S_ex) {
|
||||
@ -183,7 +172,7 @@ void BuildGUI::MakeWireAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR)
|
||||
return;
|
||||
}
|
||||
result->NameType(tr("GEOM_WIRE"));
|
||||
if(myGeomGUI->Display(result))
|
||||
if(myGeomBase->Display(result))
|
||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
|
||||
}
|
||||
catch(const SALOME::SALOME_Exception& S_ex) {
|
||||
@ -209,7 +198,7 @@ void BuildGUI::MakeFaceAndDisplay(GEOM::GEOM_Shape_ptr aWire, const Standard_Boo
|
||||
result->NameType(tr("GEOM_PLANE"));
|
||||
else
|
||||
result->NameType(tr("GEOM_FACE"));
|
||||
if(myGeomGUI->Display(result))
|
||||
if(myGeomBase->Display(result))
|
||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
|
||||
}
|
||||
catch(const SALOME::SALOME_Exception& S_ex) {
|
||||
@ -232,7 +221,7 @@ void BuildGUI::MakeShellAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR)
|
||||
return;
|
||||
}
|
||||
result->NameType(tr("GEOM_SHELL"));
|
||||
if(myGeomGUI->Display(result))
|
||||
if(myGeomBase->Display(result))
|
||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
|
||||
}
|
||||
catch(const SALOME::SALOME_Exception& S_ex) {
|
||||
@ -255,7 +244,7 @@ void BuildGUI::MakeSolidAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR)
|
||||
return;
|
||||
}
|
||||
result->NameType(tr("GEOM_SOLID"));
|
||||
if(myGeomGUI->Display(result))
|
||||
if(myGeomBase->Display(result))
|
||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
|
||||
}
|
||||
catch(const SALOME::SALOME_Exception& S_ex) {
|
||||
@ -278,7 +267,7 @@ void BuildGUI::MakeCompoundAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR)
|
||||
return;
|
||||
}
|
||||
result->NameType(tr("GEOM_COMPOUND"));
|
||||
if(myGeomGUI->Display(result))
|
||||
if(myGeomBase->Display(result))
|
||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
|
||||
}
|
||||
catch(const SALOME::SALOME_Exception& S_ex) {
|
||||
@ -356,9 +345,9 @@ bool BuildGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* Shape
|
||||
/* Set the nameType of sub shape */
|
||||
char* nameG = (char *)malloc(20);
|
||||
Standard_CString Type;
|
||||
if(myGeomGUI->GetShapeTypeString(S, Type)) {
|
||||
if(myGeomBase->GetShapeTypeString(S, Type)) {
|
||||
aResult->NameType(Type);
|
||||
sprintf(nameG, "%s_%d", Type, myGeomGUI->GetIndex(S, mainShape, SubShapeType));
|
||||
sprintf(nameG, "%s_%d", Type, myGeomBase->GetIndex(S, mainShape, SubShapeType));
|
||||
}
|
||||
else {
|
||||
aResult->NameType(tr("GEOM_SHAPE"));
|
||||
@ -416,7 +405,7 @@ bool BuildGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* Shape
|
||||
}
|
||||
else {
|
||||
allreadyexist = true;
|
||||
if(!myGeomGUI->SObjectExist(theObj, aResult->Name())) {
|
||||
if(!myGeomBase->SObjectExist(theObj, aResult->Name())) {
|
||||
SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj);
|
||||
aStudyBuilder->Addreference(newObj1, SO);
|
||||
IO->setEntry(SO->GetID());
|
||||
@ -473,7 +462,7 @@ bool BuildGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* Shape
|
||||
}
|
||||
else {
|
||||
allreadyexist = true;
|
||||
if(!myGeomGUI->SObjectExist(theObj, aResult->Name())) {
|
||||
if(!myGeomBase->SObjectExist(theObj, aResult->Name())) {
|
||||
SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj);
|
||||
aStudyBuilder->Addreference(newObj1, SO);
|
||||
IO->setEntry(SO->GetID());
|
||||
@ -559,7 +548,7 @@ bool BuildGUI::OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char*
|
||||
/* 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 */
|
||||
while(ic->MoreSelected()) {
|
||||
int index = myGeomGUI->GetIndex(ic->SelectedShape(), mainShape, SubShapeType);
|
||||
int index = myGeomBase->GetIndex(ic->SelectedShape(), mainShape, SubShapeType);
|
||||
ListOfID[i] = index;
|
||||
B.Add(compound, ic->SelectedShape());
|
||||
i++;
|
||||
@ -591,9 +580,9 @@ bool BuildGUI::OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char*
|
||||
if(nbSelected == 1) {
|
||||
TopExp_Explorer Exp (compound, TopAbs_ShapeEnum(SubShapeType));
|
||||
if(Exp.More()) {
|
||||
if(myGeomGUI->GetShapeTypeString(Exp.Current(),Type)) {
|
||||
if(myGeomBase->GetShapeTypeString(Exp.Current(),Type)) {
|
||||
aResult->NameType(Type);
|
||||
sprintf (nameG, "%s_%d", Type, myGeomGUI->GetIndex( Exp.Current(), mainTopo, SubShapeType));
|
||||
sprintf (nameG, "%s_%d", Type, myGeomBase->GetIndex( Exp.Current(), mainTopo, SubShapeType));
|
||||
}
|
||||
else {
|
||||
aResult->NameType(tr("GEOM_SHAPE"));
|
||||
@ -604,7 +593,7 @@ bool BuildGUI::OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char*
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ( myGeomGUI->GetShapeTypeString(compound,Type)) {
|
||||
if ( myGeomBase->GetShapeTypeString(compound,Type)) {
|
||||
aResult->NameType(Type);
|
||||
sprintf (nameG, "%s_%d", Type, myGeomGUI->GetNbGeom()++);
|
||||
} else {
|
||||
@ -666,7 +655,7 @@ bool BuildGUI::OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char*
|
||||
}
|
||||
else {
|
||||
allreadyexist = true;
|
||||
if(!myGeomGUI->SObjectExist(theObj, aResult->Name())) {
|
||||
if(!myGeomBase->SObjectExist(theObj, aResult->Name())) {
|
||||
SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj);
|
||||
aStudyBuilder->Addreference(newObj1, SO);
|
||||
|
||||
@ -684,7 +673,7 @@ bool BuildGUI::OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char*
|
||||
if(!allreadyexist)
|
||||
ic->Display(result);
|
||||
|
||||
GEOMBase_Display* myDisplayGUI = new GEOMBase_Display();
|
||||
DisplayGUI* myDisplayGUI = new DisplayGUI();
|
||||
myDisplayGUI->OnDisplayAll(true);
|
||||
|
||||
myGeomGUI->GetActiveStudy()->updateObjBrowser();
|
||||
|
@ -29,7 +29,7 @@
|
||||
#ifndef BUILDGUI_H
|
||||
#define BUILDGUI_H
|
||||
|
||||
#include "GEOMBase_Display.h"
|
||||
#include "GEOMBase.h"
|
||||
|
||||
//=================================================================================
|
||||
// class : BuildGUI
|
||||
@ -43,7 +43,6 @@ public :
|
||||
BuildGUI();
|
||||
~BuildGUI();
|
||||
|
||||
static BuildGUI* GetOrCreateGUI();
|
||||
static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
|
||||
|
||||
void MakeLinearEdgeAndDisplay(const gp_Pnt P1, const gp_Pnt P2);
|
||||
@ -54,11 +53,12 @@ public :
|
||||
void MakeCompoundAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR);
|
||||
|
||||
/* Methods for sub shapes explode */
|
||||
bool OnSubShapeGetAll(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);
|
||||
bool OnSubShapeGetAll(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);
|
||||
|
||||
GEOMBase_Context* myGeomGUI;
|
||||
GEOMBase* myGeomBase;
|
||||
GEOMContext* myGeomGUI;
|
||||
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
|
||||
|
||||
};
|
||||
|
@ -29,19 +29,6 @@
|
||||
using namespace std;
|
||||
#include "BuildGUI_CompoundDlg.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 <qpixmap.h>
|
||||
|
||||
//=================================================================================
|
||||
// class : BuildGUI_CompoundDlg()
|
||||
// purpose : Constructs a BuildGUI_CompoundDlg which is a child of 'parent', with the
|
||||
@ -50,99 +37,30 @@ using namespace std;
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
BuildGUI_CompoundDlg::BuildGUI_CompoundDlg(QWidget* parent, const char* name, BuildGUI* theBuildGUI, 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 image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_BUILD_COMPOUND")));
|
||||
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
|
||||
if ( !name )
|
||||
setName( "BuildGUI_CompoundDlg" );
|
||||
resize( 303, 175 );
|
||||
setCaption( tr( "GEOM_COMPOUND_TITLE" ) );
|
||||
setSizeGripEnabled( TRUE );
|
||||
BuildGUI_CompoundDlgLayout = new QGridLayout( this );
|
||||
BuildGUI_CompoundDlgLayout->setSpacing( 6 );
|
||||
BuildGUI_CompoundDlgLayout->setMargin( 11 );
|
||||
|
||||
/***************************************************************/
|
||||
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
|
||||
GroupConstructors->setTitle( tr( "GEOM_COMPOUND" ) );
|
||||
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 );
|
||||
Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" );
|
||||
Constructor1->setText( tr( "" ) );
|
||||
Constructor1->setPixmap( image1 );
|
||||
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 );
|
||||
BuildGUI_CompoundDlgLayout->addWidget( GroupConstructors, 0, 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 );
|
||||
BuildGUI_CompoundDlgLayout->addWidget( GroupButtons, 2, 0 );
|
||||
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_BUILD_COMPOUND")));
|
||||
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
|
||||
|
||||
/***************************************************************/
|
||||
GroupC1 = new QGroupBox( this, "GroupC1" );
|
||||
GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) );
|
||||
GroupC1->setMinimumSize( QSize( 0, 0 ) );
|
||||
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" );
|
||||
TextLabelC1A1->setText( tr( "GEOM_OBJECTS" ) );
|
||||
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( image0 );
|
||||
SelectButtonC1A1->setToggleButton( FALSE );
|
||||
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
|
||||
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
|
||||
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
|
||||
BuildGUI_CompoundDlgLayout->addWidget( GroupC1, 1, 0 );
|
||||
/***************************************************************/
|
||||
myBuildGUI = theBuildGUI;
|
||||
Init(Sel) ; /* Initialisations */
|
||||
setCaption(tr("GEOM_COMPOUND_TITLE"));
|
||||
|
||||
/***************************************************************/
|
||||
GroupConstructors->setTitle(tr("GEOM_COMPOUND"));
|
||||
RadioButton1->setPixmap(image0);
|
||||
RadioButton2->close(TRUE);
|
||||
RadioButton3->close(TRUE);
|
||||
|
||||
GroupPoints = new DlgRef_1Sel_QTD(this, "GroupPoints");
|
||||
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
|
||||
GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS"));
|
||||
GroupPoints->PushButton1->setPixmap(image1);
|
||||
|
||||
Layout1->addWidget(GroupPoints, 1, 0);
|
||||
/***************************************************************/
|
||||
|
||||
/* Initialisations */
|
||||
myBuildGUI = theBuildGUI;
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
@ -152,7 +70,7 @@ BuildGUI_CompoundDlg::BuildGUI_CompoundDlg(QWidget* parent, const char* name, Bu
|
||||
//=================================================================================
|
||||
BuildGUI_CompoundDlg::~BuildGUI_CompoundDlg()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
|
||||
@ -160,97 +78,48 @@ BuildGUI_CompoundDlg::~BuildGUI_CompoundDlg()
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_CompoundDlg::Init( SALOME_Selection* Sel )
|
||||
void BuildGUI_CompoundDlg::Init()
|
||||
{
|
||||
|
||||
GroupC1->show();
|
||||
myConstructorId = 0 ;
|
||||
Constructor1->setChecked( TRUE );
|
||||
myEditCurrentArgument = LineEditC1A1 ;
|
||||
mySelection = Sel;
|
||||
this->myOkListShapes = false ;
|
||||
myGeomGUI = GEOMBase_Context::GetGeomGUI() ;
|
||||
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);
|
||||
/* init variables */
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
myOkListShapes = false;
|
||||
|
||||
/* signals and slots connections */
|
||||
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
|
||||
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
|
||||
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
|
||||
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
|
||||
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
|
||||
|
||||
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
|
||||
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ;
|
||||
/* 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 */
|
||||
/* displays Dialog */
|
||||
GroupPoints->show();
|
||||
this->show();
|
||||
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ConstructorsClicked()
|
||||
// purpose : Radio button management
|
||||
//=================================================================================
|
||||
void BuildGUI_CompoundDlg::ConstructorsClicked(int constructorId)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_CompoundDlg::ClickOnOk()
|
||||
{
|
||||
this->ClickOnApply() ;
|
||||
this->ClickOnCancel() ;
|
||||
|
||||
return ;
|
||||
this->ClickOnApply();
|
||||
ClickOnCancel();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_CompoundDlg::ClickOnApply()
|
||||
{
|
||||
switch(myConstructorId)
|
||||
{
|
||||
case 0 :
|
||||
{
|
||||
if(myOkListShapes) {
|
||||
myBuildGUI->MakeCompoundAndDisplay( myListShapes ) ;
|
||||
}
|
||||
break ;
|
||||
}
|
||||
}
|
||||
// accept();
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnCancel()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_CompoundDlg::ClickOnCancel()
|
||||
{
|
||||
disconnect( mySelection, 0, this, 0 );
|
||||
myGeomGUI->ResetState() ;
|
||||
reject() ;
|
||||
return ;
|
||||
myGeomGUI->GetDesktop()->putInfo(tr(""));
|
||||
if(myOkListShapes)
|
||||
myBuildGUI->MakeCompoundAndDisplay(myListShapes);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -260,72 +129,38 @@ void BuildGUI_CompoundDlg::ClickOnCancel()
|
||||
//=================================================================================
|
||||
void BuildGUI_CompoundDlg::SelectionIntoArgument()
|
||||
{
|
||||
/* All this for first constructor */
|
||||
// if(myEditCurrentArgument == LineEditC1A1 )
|
||||
|
||||
myOkListShapes = false;
|
||||
myEditCurrentArgument->setText("") ;
|
||||
myEditCurrentArgument->setText("");
|
||||
QString aString = ""; /* name of selection */
|
||||
|
||||
int nbSel = mySelection->IObjectCount() ;
|
||||
if ( nbSel == 0 )
|
||||
myOkListShapes = false;
|
||||
int nbSel = mySelection->IObjectCount();
|
||||
if(nbSel == 0)
|
||||
return;
|
||||
aString = tr( "%1_objects" ).arg( nbSel );
|
||||
aString = tr("%1_objects").arg(nbSel);
|
||||
|
||||
// int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
// if(nbSel <= 1) {
|
||||
// myOkListShapes = false;
|
||||
// return;
|
||||
// }
|
||||
|
||||
myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes) ;
|
||||
myEditCurrentArgument->setText(aString) ;
|
||||
myOkListShapes = true ;
|
||||
myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes);
|
||||
myEditCurrentArgument->setText(aString);
|
||||
myOkListShapes = true;
|
||||
/* no simulation */
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : SetEditCurrentArgument()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_CompoundDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
switch (myConstructorId)
|
||||
{
|
||||
case 0: /* default constructor */
|
||||
{
|
||||
if(send == SelectButtonC1A1) {
|
||||
LineEditC1A1->setFocus() ;
|
||||
myEditCurrentArgument = LineEditC1A1;
|
||||
}
|
||||
SelectionIntoArgument() ;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : LineEditReturnPressed()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_CompoundDlg::LineEditReturnPressed()
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : DeactivateActiveDialog()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_CompoundDlg::DeactivateActiveDialog()
|
||||
{
|
||||
if ( GroupConstructors->isEnabled() ) {
|
||||
disconnect( mySelection, 0, this, 0 );
|
||||
GroupConstructors->setEnabled(false) ;
|
||||
GroupC1->setEnabled(false) ;
|
||||
GroupButtons->setEnabled(false) ;
|
||||
}
|
||||
return ;
|
||||
GroupPoints->LineEdit1->setFocus();
|
||||
this->SelectionIntoArgument();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -335,13 +170,9 @@ void BuildGUI_CompoundDlg::DeactivateActiveDialog()
|
||||
//=================================================================================
|
||||
void BuildGUI_CompoundDlg::ActivateThisDialog()
|
||||
{
|
||||
/* Emit a signal to deactivate the active dialog */
|
||||
myGeomGUI->EmitSignalDeactivateDialog() ;
|
||||
GroupConstructors->setEnabled(true) ;
|
||||
GroupC1->setEnabled(true) ;
|
||||
GroupButtons->setEnabled(true) ;
|
||||
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
return ;
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -351,20 +182,8 @@ void BuildGUI_CompoundDlg::ActivateThisDialog()
|
||||
//=================================================================================
|
||||
void BuildGUI_CompoundDlg::enterEvent(QEvent* e)
|
||||
{
|
||||
if ( GroupConstructors->isEnabled() )
|
||||
return ;
|
||||
ActivateThisDialog() ;
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : closeEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_CompoundDlg::closeEvent( QCloseEvent* e )
|
||||
{
|
||||
/* same than click on cancel button */
|
||||
this->ClickOnCancel() ;
|
||||
return ;
|
||||
if (GroupConstructors->isEnabled())
|
||||
return;
|
||||
this->ActivateThisDialog();
|
||||
return;
|
||||
}
|
||||
|
@ -29,27 +29,16 @@
|
||||
#ifndef DIALOGBOX_COMPOUND_H
|
||||
#define DIALOGBOX_COMPOUND_H
|
||||
|
||||
#include "GEOMBase_Skeleton.h"
|
||||
#include "DlgRef_1Sel_QTD.h"
|
||||
|
||||
#include "BuildGUI.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 : BuildGUI_CompoundDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class BuildGUI_CompoundDlg : public QDialog
|
||||
class BuildGUI_CompoundDlg : public GEOMBase_Skeleton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -58,47 +47,23 @@ public:
|
||||
~BuildGUI_CompoundDlg();
|
||||
|
||||
private:
|
||||
void Init();
|
||||
void enterEvent(QEvent* e);
|
||||
|
||||
BuildGUI* myBuildGUI;
|
||||
void Init( SALOME_Selection* Sel ) ;
|
||||
void closeEvent( QCloseEvent* e ) ;
|
||||
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
|
||||
|
||||
GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */
|
||||
GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */
|
||||
SALOME_Selection* mySelection ; /* User shape selection */
|
||||
GEOM::GEOM_Gen::ListOfIOR myListShapes ;
|
||||
bool myOkListShapes ; /* to check when arguments is defined */
|
||||
int myConstructorId ; /* Current constructor id = radio button id */
|
||||
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
|
||||
GEOM::GEOM_Gen::ListOfIOR myListShapes;
|
||||
bool myOkListShapes; /* to check when arguments is defined */
|
||||
|
||||
QButtonGroup* GroupConstructors;
|
||||
QRadioButton* Constructor1;
|
||||
QGroupBox* GroupButtons;
|
||||
QPushButton* buttonOk;
|
||||
QPushButton* buttonCancel;
|
||||
QPushButton* buttonApply;
|
||||
QGroupBox* GroupC1;
|
||||
QLabel* TextLabelC1A1;
|
||||
QPushButton* SelectButtonC1A1;
|
||||
QLineEdit* LineEditC1A1;
|
||||
DlgRef_1Sel_QTD* GroupPoints;
|
||||
|
||||
private slots:
|
||||
|
||||
void ConstructorsClicked(int constructorId);
|
||||
void ClickOnOk();
|
||||
void ClickOnCancel();
|
||||
void ClickOnApply();
|
||||
void SetEditCurrentArgument() ;
|
||||
void LineEditReturnPressed() ;
|
||||
void SelectionIntoArgument() ;
|
||||
void DeactivateActiveDialog() ;
|
||||
void ActivateThisDialog() ;
|
||||
void ActivateThisDialog();
|
||||
void SelectionIntoArgument();
|
||||
void SetEditCurrentArgument();
|
||||
|
||||
protected:
|
||||
QGridLayout* BuildGUI_CompoundDlgLayout;
|
||||
QGridLayout* GroupConstructorsLayout;
|
||||
QGridLayout* GroupButtonsLayout;
|
||||
QGridLayout* GroupC1Layout;
|
||||
};
|
||||
|
||||
#endif // DIALOGBOX_COMPOUND_H
|
||||
|
@ -29,20 +29,8 @@
|
||||
using namespace std;
|
||||
#include "BuildGUI_EdgeDlg.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 <qpixmap.h>
|
||||
|
||||
|
||||
#include <BRepBuilderAPI_MakeEdge.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
//=================================================================================
|
||||
// class : BuildGUI_EdgeDlg()
|
||||
@ -52,110 +40,32 @@ using namespace std;
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
BuildGUI_EdgeDlg::BuildGUI_EdgeDlg(QWidget* parent, const char* name, BuildGUI* theBuildGUI, 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_BUILD_EDGE")));
|
||||
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
|
||||
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_BUILD_EDGE")));
|
||||
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
|
||||
|
||||
if ( !name )
|
||||
setName( "BuildGUI_EdgeDlg" );
|
||||
resize( 303, 225 );
|
||||
setCaption( tr( "GEOM_EDGE_TITLE" ) );
|
||||
setSizeGripEnabled( TRUE );
|
||||
BuildGUI_EdgeDlgLayout = new QGridLayout( this );
|
||||
BuildGUI_EdgeDlgLayout->setSpacing( 6 );
|
||||
BuildGUI_EdgeDlgLayout->setMargin( 11 );
|
||||
|
||||
/***************************************************************/
|
||||
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
|
||||
GroupConstructors->setTitle( tr( "GEOM_EDGE" ) );
|
||||
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 );
|
||||
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 );
|
||||
BuildGUI_EdgeDlgLayout->addWidget( GroupConstructors, 0, 0 );
|
||||
setCaption(tr("GEOM_EDGE_TITLE"));
|
||||
|
||||
/***************************************************************/
|
||||
GroupC1 = new QGroupBox( this, "GroupC1" );
|
||||
GroupC1->setTitle( tr( "GEOM_POINTS" ) );
|
||||
GroupC1->setMinimumSize( QSize( 0, 0 ) );
|
||||
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 );
|
||||
GroupC1Layout->addWidget( SelectButtonC1A2, 1, 1 );
|
||||
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
|
||||
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
|
||||
LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" );
|
||||
GroupC1Layout->addWidget( LineEditC1A2, 1, 2 );
|
||||
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
|
||||
SelectButtonC1A1->setText( tr( "" ) );
|
||||
SelectButtonC1A1->setPixmap( image1 );
|
||||
SelectButtonC1A1->setToggleButton( FALSE );
|
||||
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
|
||||
TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" );
|
||||
TextLabelC1A1->setText( tr( "GEOM_POINT_I" ).arg("1") );
|
||||
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_POINT_I" ).arg("2") );
|
||||
TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) );
|
||||
GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 );
|
||||
BuildGUI_EdgeDlgLayout->addWidget( GroupC1, 1, 0 );
|
||||
/***************************************************************/
|
||||
GroupConstructors->setTitle(tr("GEOM_EDGE"));
|
||||
RadioButton1->setPixmap(image0);
|
||||
RadioButton2->close(TRUE);
|
||||
RadioButton3->close(TRUE);
|
||||
|
||||
/***************************************************************/
|
||||
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 );
|
||||
BuildGUI_EdgeDlgLayout->addWidget( GroupButtons, 2, 0 );
|
||||
/***************************************************************/
|
||||
myBuildGUI = theBuildGUI;
|
||||
Init(Sel) ; /* Initialisations */
|
||||
GroupPoints = new DlgRef_2Sel_QTD(this, "GroupPoints");
|
||||
GroupPoints->GroupBox1->setTitle(tr("GEOM_POINTS"));
|
||||
GroupPoints->TextLabel1->setText(tr("GEOM_POINT_I").arg("1"));
|
||||
GroupPoints->TextLabel2->setText(tr("GEOM_POINT_I").arg("2"));
|
||||
GroupPoints->PushButton1->setPixmap(image1);
|
||||
GroupPoints->PushButton2->setPixmap(image1);
|
||||
|
||||
Layout1->addWidget(GroupPoints, 1, 0);
|
||||
/***************************************************************/
|
||||
|
||||
/* Initialisations */
|
||||
myBuildGUI = theBuildGUI;
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
@ -173,121 +83,66 @@ BuildGUI_EdgeDlg::~BuildGUI_EdgeDlg()
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_EdgeDlg::Init( SALOME_Selection* Sel )
|
||||
void BuildGUI_EdgeDlg::Init()
|
||||
{
|
||||
/* init variables */
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
|
||||
GroupC1->show();
|
||||
// GroupC2->hide();
|
||||
// GroupC3->hide();
|
||||
myConstructorId = 0 ;
|
||||
Constructor1->setChecked( TRUE );
|
||||
myEditCurrentArgument = LineEditC1A1 ;
|
||||
mySelection = Sel;
|
||||
myGeomGUI = GEOMBase_Context::GetGeomGUI() ;
|
||||
myPoint1.SetCoord( 0.0, 0.0, 0.0 );
|
||||
myPoint2.SetCoord( 0.0, 0.0, 0.0 );
|
||||
myOkPoint1 = myOkPoint2 = false ;
|
||||
mySimulationTopoDs.Nullify() ;
|
||||
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
|
||||
myPoint1.SetCoord(0.0, 0.0, 0.0);
|
||||
myPoint2.SetCoord(0.0, 0.0, 0.0);
|
||||
myOkPoint1 = myOkPoint2 = false;
|
||||
|
||||
// TODO : previous selection into argument ?
|
||||
|
||||
/* Filters definition */
|
||||
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
|
||||
myGeom = GEOM::GEOM_Gen::_narrow(comp);
|
||||
myVertexFilter = new GEOM_ShapeTypeFilter( TopAbs_VERTEX, myGeom );
|
||||
mySelection->AddFilter(myVertexFilter) ; /* first filter used */
|
||||
/* first filter used */
|
||||
myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom);
|
||||
mySelection->AddFilter(myVertexFilter);
|
||||
|
||||
/* signals and slots connections */
|
||||
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
|
||||
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
|
||||
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(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
|
||||
connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
|
||||
connect( LineEditC1A2, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
|
||||
|
||||
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() ) ) ;
|
||||
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
|
||||
/* 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 */
|
||||
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
|
||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
|
||||
|
||||
return ;
|
||||
/* displays Dialog */
|
||||
GroupPoints->show();
|
||||
this->show();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ConstructorsClicked()
|
||||
// purpose : Radio button management
|
||||
//=================================================================================
|
||||
void BuildGUI_EdgeDlg::ConstructorsClicked(int constructorId)
|
||||
{
|
||||
switch (constructorId)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_EdgeDlg::ClickOnOk()
|
||||
{
|
||||
this->ClickOnApply() ;
|
||||
this->ClickOnCancel() ;
|
||||
|
||||
return ;
|
||||
this->ClickOnApply();
|
||||
ClickOnCancel();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_EdgeDlg::ClickOnApply()
|
||||
{
|
||||
myGeomGUI->EraseSimulationShape() ;
|
||||
mySimulationTopoDs.Nullify() ;
|
||||
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
|
||||
switch(myConstructorId)
|
||||
{
|
||||
case 0 :
|
||||
{
|
||||
if(myOkPoint1 && myOkPoint2)
|
||||
myBuildGUI->MakeLinearEdgeAndDisplay( myPoint1, myPoint2 ) ;
|
||||
break ;
|
||||
}
|
||||
}
|
||||
// accept();
|
||||
return ;
|
||||
}
|
||||
myGeomGUI->GetDesktop()->putInfo(tr(""));
|
||||
if (mySimulationTopoDs.IsNull())
|
||||
return;
|
||||
myGeomBase->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnCancel()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_EdgeDlg::ClickOnCancel()
|
||||
{
|
||||
mySelection->ClearFilters() ;
|
||||
myGeomGUI->EraseSimulationShape() ;
|
||||
mySimulationTopoDs.Nullify() ;
|
||||
disconnect( mySelection, 0, this, 0 );
|
||||
myGeomGUI->ResetState() ;
|
||||
reject() ;
|
||||
return ;
|
||||
if(myOkPoint1 && myOkPoint2)
|
||||
myBuildGUI->MakeLinearEdgeAndDisplay(myPoint1, myPoint2);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -297,69 +152,57 @@ void BuildGUI_EdgeDlg::ClickOnCancel()
|
||||
//=================================================================================
|
||||
void BuildGUI_EdgeDlg::SelectionIntoArgument()
|
||||
{
|
||||
myEditCurrentArgument->setText("") ;
|
||||
myGeomGUI->EraseSimulationShape() ;
|
||||
mySimulationTopoDs.Nullify() ;
|
||||
myGeomBase->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
myEditCurrentArgument->setText("");
|
||||
QString aString = ""; /* name of selection */
|
||||
|
||||
QString aString = ""; /* name of future selection */
|
||||
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
|
||||
if ( nbSel != 1 ) {
|
||||
if ( myEditCurrentArgument == LineEditC1A1 ) {
|
||||
myOkPoint1 = false ;
|
||||
}
|
||||
else if ( myEditCurrentArgument == LineEditC1A2 ) {
|
||||
myOkPoint2 = false ;
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
||||
// nbSel == 1 !
|
||||
TopoDS_Shape S;
|
||||
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
|
||||
return ;
|
||||
|
||||
if ( myConstructorId == 0 && myEditCurrentArgument == LineEditC1A1 && myGeomGUI->VertexToPoint(S, myPoint1) ) {
|
||||
myEditCurrentArgument->setText(aString) ;
|
||||
myOkPoint1 = true ;
|
||||
}
|
||||
else if ( myConstructorId == 0 && myEditCurrentArgument == LineEditC1A2 && myGeomGUI->VertexToPoint(S, myPoint2) ) {
|
||||
myEditCurrentArgument->setText(aString) ;
|
||||
myOkPoint2 = true ;
|
||||
int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
if(nbSel != 1) {
|
||||
if(myEditCurrentArgument == GroupPoints->LineEdit1)
|
||||
myOkPoint1 = false;
|
||||
else if(myEditCurrentArgument == GroupPoints->LineEdit2)
|
||||
myOkPoint2 = false;
|
||||
return;
|
||||
}
|
||||
|
||||
if( myOkPoint1 && myOkPoint2 && myPoint1.Distance(myPoint2) > Precision::Confusion() ) {
|
||||
mySimulationTopoDs = BRepBuilderAPI_MakeEdge( myPoint1, myPoint2 ).Shape();
|
||||
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
|
||||
}
|
||||
return ;
|
||||
// nbSel == 1
|
||||
TopoDS_Shape S;
|
||||
if(!myGeomBase->GetTopoFromSelection(mySelection, S))
|
||||
return;
|
||||
|
||||
if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) {
|
||||
myEditCurrentArgument->setText(aString);
|
||||
myOkPoint1 = true;
|
||||
}
|
||||
else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomBase->VertexToPoint(S, myPoint2)) {
|
||||
myEditCurrentArgument->setText(aString);
|
||||
myOkPoint2 = true;
|
||||
}
|
||||
|
||||
if(myOkPoint1 && myOkPoint2 && myPoint1.Distance(myPoint2) > Precision::Confusion())
|
||||
this->MakeEdgeSimulationAndDisplay();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : LineEditReturnPressed()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_EdgeDlg::LineEditReturnPressed()
|
||||
{
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if( send == LineEditC1A1 )
|
||||
myEditCurrentArgument = LineEditC1A1 ;
|
||||
else if ( send == LineEditC1A2 )
|
||||
myEditCurrentArgument = LineEditC1A2 ;
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if(send == GroupPoints->LineEdit1)
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
else if (send == GroupPoints->LineEdit2)
|
||||
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||
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 ;
|
||||
}
|
||||
return;
|
||||
|
||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
@ -369,46 +212,20 @@ void BuildGUI_EdgeDlg::LineEditReturnPressed()
|
||||
void BuildGUI_EdgeDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
mySelection->ClearFilters() ;
|
||||
switch (myConstructorId)
|
||||
{
|
||||
case 0: /* default constructor */
|
||||
{
|
||||
if(send == SelectButtonC1A1) {
|
||||
LineEditC1A1->setFocus() ;
|
||||
myEditCurrentArgument = LineEditC1A1;
|
||||
}
|
||||
else if(send == SelectButtonC1A2) {
|
||||
LineEditC1A2->setFocus() ;
|
||||
myEditCurrentArgument = LineEditC1A2;
|
||||
}
|
||||
mySelection->AddFilter(myVertexFilter) ;
|
||||
SelectionIntoArgument() ;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ;
|
||||
}
|
||||
mySelection->ClearFilters();
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : DeactivateActiveDialog()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_EdgeDlg::DeactivateActiveDialog()
|
||||
{
|
||||
if ( GroupConstructors->isEnabled() ) {
|
||||
|
||||
GroupConstructors->setEnabled(false) ;
|
||||
GroupC1->setEnabled(false) ;
|
||||
// TODO other constructors
|
||||
//
|
||||
GroupButtons->setEnabled(false) ;
|
||||
disconnect( mySelection, 0, this, 0 );
|
||||
myGeomGUI->EraseSimulationShape() ;
|
||||
mySelection->ClearFilters() ;
|
||||
if(send == GroupPoints->PushButton1) {
|
||||
GroupPoints->LineEdit1->setFocus();
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
}
|
||||
return ;
|
||||
else if(send == GroupPoints->PushButton2) {
|
||||
GroupPoints->LineEdit2->setFocus();
|
||||
myEditCurrentArgument = GroupPoints->LineEdit2;
|
||||
}
|
||||
mySelection->AddFilter(myVertexFilter);
|
||||
this->SelectionIntoArgument();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -418,17 +235,11 @@ void BuildGUI_EdgeDlg::DeactivateActiveDialog()
|
||||
//=================================================================================
|
||||
void BuildGUI_EdgeDlg::ActivateThisDialog()
|
||||
{
|
||||
/* Emit a signal to deactivate the active dialog */
|
||||
myGeomGUI->EmitSignalDeactivateDialog() ;
|
||||
GroupConstructors->setEnabled(true) ;
|
||||
GroupC1->setEnabled(true) ;
|
||||
GroupButtons->setEnabled(true) ;
|
||||
|
||||
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
if( !mySimulationTopoDs.IsNull() )
|
||||
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
|
||||
|
||||
return ;
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
if(!mySimulationTopoDs.IsNull())
|
||||
myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -438,20 +249,29 @@ void BuildGUI_EdgeDlg::ActivateThisDialog()
|
||||
//=================================================================================
|
||||
void BuildGUI_EdgeDlg::enterEvent(QEvent* e)
|
||||
{
|
||||
if ( GroupConstructors->isEnabled() )
|
||||
return ;
|
||||
ActivateThisDialog() ;
|
||||
return ;
|
||||
if (GroupConstructors->isEnabled())
|
||||
return;
|
||||
this->ActivateThisDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : closeEvent()
|
||||
// purpose :
|
||||
// function : MakeMirrorSimulationAndDisplay()
|
||||
// purpose : S1 is a shape and S2 a mirror.
|
||||
//=================================================================================
|
||||
void BuildGUI_EdgeDlg::closeEvent( QCloseEvent* e )
|
||||
void BuildGUI_EdgeDlg::MakeEdgeSimulationAndDisplay()
|
||||
{
|
||||
/* same than click on cancel button */
|
||||
this->ClickOnCancel() ;
|
||||
return ;
|
||||
myGeomBase->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
|
||||
try {
|
||||
mySimulationTopoDs = BRepBuilderAPI_MakeEdge(myPoint1, myPoint2).Shape();
|
||||
myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
|
||||
}
|
||||
catch(Standard_Failure) {
|
||||
MESSAGE("Exception catched in MakeEdgeSimulationAndDisplay");
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -29,29 +29,18 @@
|
||||
#ifndef DIALOGBOX_EDGE_H
|
||||
#define DIALOGBOX_EDGE_H
|
||||
|
||||
#include "GEOMBase_Skeleton.h"
|
||||
#include "DlgRef_2Sel_QTD.h"
|
||||
|
||||
#include "BuildGUI.h"
|
||||
|
||||
#include <BRepBuilderAPI_MakeEdge.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;
|
||||
|
||||
#include "GEOM_ShapeTypeFilter.hxx"
|
||||
|
||||
//=================================================================================
|
||||
// class : BuildGUI_EdgeDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class BuildGUI_EdgeDlg : public QDialog
|
||||
class BuildGUI_EdgeDlg : public GEOMBase_Skeleton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -60,55 +49,28 @@ public:
|
||||
~BuildGUI_EdgeDlg();
|
||||
|
||||
private :
|
||||
void Init();
|
||||
void enterEvent(QEvent* e);
|
||||
void MakeEdgeSimulationAndDisplay();
|
||||
|
||||
BuildGUI* myBuildGUI;
|
||||
GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */
|
||||
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 */
|
||||
gp_Pnt myPoint2 ;
|
||||
Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* Filter selection */
|
||||
|
||||
bool myOkPoint1 ; /* true when myPoint is defined */
|
||||
bool myOkPoint2 ;
|
||||
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
|
||||
int myConstructorId ; /* Current constructor id = radio button id */
|
||||
Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* Filter selection */
|
||||
gp_Pnt myPoint1; /* Points containing the vector */
|
||||
gp_Pnt myPoint2;
|
||||
bool myOkPoint1; /* true when myPoint is defined */
|
||||
bool myOkPoint2;
|
||||
|
||||
void closeEvent( QCloseEvent* e ) ;
|
||||
void enterEvent( QEvent* e);
|
||||
void Init( SALOME_Selection* Sel ) ;
|
||||
|
||||
QButtonGroup* GroupConstructors;
|
||||
QRadioButton* Constructor1;
|
||||
QGroupBox* GroupC1;
|
||||
QPushButton* SelectButtonC1A2;
|
||||
QLineEdit* LineEditC1A1;
|
||||
QLineEdit* LineEditC1A2;
|
||||
QPushButton* SelectButtonC1A1;
|
||||
QLabel* TextLabelC1A1;
|
||||
QLabel* TextLabelC1A2;
|
||||
QGroupBox* GroupButtons;
|
||||
QPushButton* buttonOk;
|
||||
QPushButton* buttonCancel;
|
||||
QPushButton* buttonApply;
|
||||
DlgRef_2Sel_QTD* GroupPoints;
|
||||
|
||||
private slots:
|
||||
|
||||
void ConstructorsClicked(int constructorId);
|
||||
void ClickOnOk();
|
||||
void ClickOnCancel();
|
||||
void ClickOnApply();
|
||||
void SetEditCurrentArgument() ;
|
||||
void LineEditReturnPressed() ;
|
||||
void SelectionIntoArgument() ;
|
||||
void DeactivateActiveDialog() ;
|
||||
void ActivateThisDialog() ;
|
||||
void ActivateThisDialog();
|
||||
void LineEditReturnPressed();
|
||||
void SelectionIntoArgument();
|
||||
void SetEditCurrentArgument();
|
||||
|
||||
protected:
|
||||
QGridLayout* BuildGUI_EdgeDlgLayout;
|
||||
QGridLayout* GroupConstructorsLayout;
|
||||
QGridLayout* GroupC1Layout;
|
||||
QGridLayout* GroupButtonsLayout;
|
||||
};
|
||||
|
||||
#endif // DIALOGBOX_EDGE_H
|
||||
|
@ -29,22 +29,6 @@
|
||||
using namespace std;
|
||||
#include "BuildGUI_FaceDlg.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 <qpixmap.h>
|
||||
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// class : BuildGUI_FaceDlg()
|
||||
// purpose : Constructs a BuildGUI_FaceDlg which is a child of 'parent', with the
|
||||
@ -53,103 +37,31 @@ using namespace std;
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
BuildGUI_FaceDlg::BuildGUI_FaceDlg(QWidget* parent, const char* name, BuildGUI* theBuildGUI, 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_BUILD_FACE")));
|
||||
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
|
||||
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_BUILD_FACE")));
|
||||
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
|
||||
|
||||
if ( !name )
|
||||
setName( "BuildGUI_FaceDlg" );
|
||||
resize( 303, 208 );
|
||||
setCaption( tr( "GEOM_FACE_TITLE" ) );
|
||||
setSizeGripEnabled( TRUE );
|
||||
BuildGUI_FaceDlgLayout = new QGridLayout( this );
|
||||
BuildGUI_FaceDlgLayout->setSpacing( 6 );
|
||||
BuildGUI_FaceDlgLayout->setMargin( 11 );
|
||||
setCaption(tr("GEOM_FACE_TITLE"));
|
||||
|
||||
/***************************************************************/
|
||||
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
|
||||
GroupConstructors->setTitle( tr( "GEOM_FACE" ) );
|
||||
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 );
|
||||
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 );
|
||||
BuildGUI_FaceDlgLayout->addWidget( GroupConstructors, 0, 0 );
|
||||
/***************************************************************/
|
||||
GroupConstructors->setTitle(tr("GEOM_FACE"));
|
||||
RadioButton1->setPixmap(image0);
|
||||
RadioButton2->close(TRUE);
|
||||
RadioButton3->close(TRUE);
|
||||
|
||||
/***************************************************************/
|
||||
GroupC1 = new QGroupBox( this, "GroupC1" );
|
||||
GroupC1->setTitle( tr( "GEOM_FACE_FFW" ) );
|
||||
GroupC1->setMinimumSize( QSize( 0, 0 ) );
|
||||
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" );
|
||||
TextLabelC1A1->setText( tr( "GEOM_WIRE" ) );
|
||||
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 );
|
||||
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
|
||||
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
|
||||
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
|
||||
CheckBox1 = new QCheckBox( GroupC1, "CheckBox1" );
|
||||
CheckBox1->setText( tr( "GEOM_FACE_OPT" ) );
|
||||
CheckBox1->setChecked( TRUE );
|
||||
GroupC1Layout->addWidget( CheckBox1, 1, 2);
|
||||
BuildGUI_FaceDlgLayout->addWidget( GroupC1, 1, 0 );
|
||||
GroupPoints = new DlgRef_1Sel1Check_QTD(this, "GroupPoints");
|
||||
GroupPoints->GroupBox1->setTitle(tr("GEOM_FACE_FFW"));
|
||||
GroupPoints->TextLabel1->setText(tr("GEOM_WIRE"));
|
||||
GroupPoints->CheckButton1->setText(tr("GEOM_FACE_OPT"));
|
||||
GroupPoints->PushButton1->setPixmap(image1);
|
||||
|
||||
/***************************************************************/
|
||||
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 );
|
||||
BuildGUI_FaceDlgLayout->addWidget( GroupButtons, 2, 0 );
|
||||
myBuildGUI = theBuildGUI;
|
||||
Init(Sel) ; /* Initialisations */
|
||||
Layout1->addWidget(GroupPoints, 1, 0);
|
||||
/***************************************************************/
|
||||
|
||||
/* Initialisations */
|
||||
myBuildGUI = theBuildGUI;
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
@ -159,115 +71,62 @@ BuildGUI_FaceDlg::BuildGUI_FaceDlg(QWidget* parent, const char* name, BuildGUI*
|
||||
//=================================================================================
|
||||
BuildGUI_FaceDlg::~BuildGUI_FaceDlg()
|
||||
{
|
||||
// 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()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_FaceDlg::Init( SALOME_Selection* Sel )
|
||||
void BuildGUI_FaceDlg::Init()
|
||||
{
|
||||
/* init variables */
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
GroupPoints->CheckButton1->setChecked(TRUE);
|
||||
|
||||
GroupC1->show();
|
||||
myConstructorId = 0 ;
|
||||
Constructor1->setChecked( TRUE );
|
||||
CheckBox1->setChecked( TRUE );
|
||||
myOkShape = false;
|
||||
|
||||
myEditCurrentArgument = LineEditC1A1 ;
|
||||
mySelection = Sel;
|
||||
this->myOkShape = false ;
|
||||
myGeomGUI = GEOMBase_Context::GetGeomGUI() ;
|
||||
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);
|
||||
myWireFilter = new GEOM_ShapeTypeFilter( TopAbs_WIRE, myGeom );
|
||||
mySelection->AddFilter(myWireFilter) ; /* first filter used */
|
||||
myWireFilter = new GEOM_ShapeTypeFilter(TopAbs_WIRE, myGeom);
|
||||
mySelection->AddFilter(myWireFilter); /* first filter used */
|
||||
|
||||
/* signals and slots connections */
|
||||
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
|
||||
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
|
||||
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
|
||||
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
|
||||
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
|
||||
|
||||
connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
|
||||
/* displays Dialog */
|
||||
GroupPoints->show();
|
||||
this->show();
|
||||
|
||||
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
|
||||
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 ;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ConstructorsClicked()
|
||||
// purpose : Radio button management
|
||||
//=================================================================================
|
||||
void BuildGUI_FaceDlg::ConstructorsClicked(int constructorId)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_FaceDlg::ClickOnOk()
|
||||
{
|
||||
this->ClickOnApply() ;
|
||||
this->ClickOnCancel() ;
|
||||
|
||||
return ;
|
||||
this->ClickOnApply();
|
||||
ClickOnCancel();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnApply()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_FaceDlg::ClickOnApply()
|
||||
{
|
||||
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
|
||||
switch(myConstructorId)
|
||||
{
|
||||
case 0 :
|
||||
{
|
||||
if(myOkShape) {
|
||||
myBuildGUI->MakeFaceAndDisplay(this->myGeomShape, this->CheckBox1->isChecked() ) ;
|
||||
}
|
||||
break ;
|
||||
}
|
||||
}
|
||||
// accept();
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnCancel()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_FaceDlg::ClickOnCancel()
|
||||
{
|
||||
mySelection->ClearFilters() ;
|
||||
myGeomGUI->ResetState() ;
|
||||
disconnect( mySelection, 0, this, 0 );
|
||||
reject() ;
|
||||
return ;
|
||||
myGeomGUI->GetDesktop()->putInfo(tr(""));
|
||||
if(myOkShape)
|
||||
myBuildGUI->MakeFaceAndDisplay(myGeomShape, GroupPoints->CheckButton1->isChecked());
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -277,32 +136,29 @@ void BuildGUI_FaceDlg::ClickOnCancel()
|
||||
//=================================================================================
|
||||
void BuildGUI_FaceDlg::SelectionIntoArgument()
|
||||
{
|
||||
/* All this for first constructor */
|
||||
// if(myEditCurrentArgument == LineEditC1A1 )
|
||||
|
||||
myEditCurrentArgument->setText("");
|
||||
QString aString = ""; /* name of selection */
|
||||
|
||||
myOkShape = false;
|
||||
myEditCurrentArgument->setText("") ;
|
||||
QString aString = ""; /* future the name of selection */
|
||||
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
|
||||
if ( nbSel != 1 )
|
||||
return ;
|
||||
|
||||
// nbSel == 1 !
|
||||
Standard_Boolean testResult ;
|
||||
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
|
||||
if( !myGeomGUI->GetTopoFromSelection(this->mySelection, this->myShape) )
|
||||
return ;
|
||||
int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
if(nbSel != 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
|
||||
if( !testResult )
|
||||
return ;
|
||||
// nbSel == 1!
|
||||
Standard_Boolean testResult;
|
||||
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
|
||||
if(!myGeomBase->GetTopoFromSelection(mySelection, myShape))
|
||||
return;
|
||||
|
||||
myEditCurrentArgument->setText(aString) ;
|
||||
this->myOkShape = true ;
|
||||
myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult);
|
||||
if(!testResult)
|
||||
return;
|
||||
|
||||
myEditCurrentArgument->setText(aString);
|
||||
myOkShape = true;
|
||||
/* no simulation */
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -312,65 +168,28 @@ void BuildGUI_FaceDlg::SelectionIntoArgument()
|
||||
//=================================================================================
|
||||
void BuildGUI_FaceDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
mySelection->ClearFilters() ;
|
||||
|
||||
switch (myConstructorId)
|
||||
{
|
||||
case 0: /* default constructor */
|
||||
{
|
||||
if(send == SelectButtonC1A1) {
|
||||
LineEditC1A1->setFocus() ;
|
||||
myEditCurrentArgument = LineEditC1A1;
|
||||
mySelection->AddFilter(myWireFilter) ;
|
||||
}
|
||||
SelectionIntoArgument() ;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ;
|
||||
GroupPoints->LineEdit1->setFocus();
|
||||
mySelection->ClearFilters();
|
||||
mySelection->AddFilter(myWireFilter);
|
||||
this->SelectionIntoArgument();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : LineEditReturnPressed()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_FaceDlg::LineEditReturnPressed()
|
||||
{
|
||||
QLineEdit* send = (QLineEdit*)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 ;
|
||||
}
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if(send == GroupPoints->LineEdit1)
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
else
|
||||
return;
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : DeactivateActiveDialog()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_FaceDlg::DeactivateActiveDialog()
|
||||
{
|
||||
if ( GroupConstructors->isEnabled() ) {
|
||||
disconnect( mySelection, 0, this, 0 );
|
||||
mySelection->ClearFilters() ;
|
||||
GroupConstructors->setEnabled(false) ;
|
||||
GroupC1->setEnabled(false) ;
|
||||
GroupButtons->setEnabled(false) ;
|
||||
}
|
||||
return ;
|
||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -380,13 +199,9 @@ void BuildGUI_FaceDlg::DeactivateActiveDialog()
|
||||
//=================================================================================
|
||||
void BuildGUI_FaceDlg::ActivateThisDialog()
|
||||
{
|
||||
/* Emit a signal to deactivate the active dialog */
|
||||
myGeomGUI->EmitSignalDeactivateDialog() ;
|
||||
GroupConstructors->setEnabled(true) ;
|
||||
GroupC1->setEnabled(true) ;
|
||||
GroupButtons->setEnabled(true) ;
|
||||
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
return ;
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -396,20 +211,8 @@ void BuildGUI_FaceDlg::ActivateThisDialog()
|
||||
//=================================================================================
|
||||
void BuildGUI_FaceDlg::enterEvent(QEvent* e)
|
||||
{
|
||||
if ( GroupConstructors->isEnabled() )
|
||||
return ;
|
||||
ActivateThisDialog() ;
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : closeEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_FaceDlg::closeEvent( QCloseEvent* e )
|
||||
{
|
||||
/* same than click on cancel button */
|
||||
this->ClickOnCancel() ;
|
||||
return ;
|
||||
if (GroupConstructors->isEnabled())
|
||||
return;
|
||||
this->ActivateThisDialog();
|
||||
return;
|
||||
}
|
||||
|
@ -29,82 +29,48 @@
|
||||
#ifndef DIALOGBOX_FACE_H
|
||||
#define DIALOGBOX_FACE_H
|
||||
|
||||
#include "GEOMBase_Skeleton.h"
|
||||
#include "DlgRef_1Sel1Check_QTD.h"
|
||||
|
||||
#include "BuildGUI.h"
|
||||
|
||||
#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;
|
||||
|
||||
#include "GEOM_ShapeTypeFilter.hxx"
|
||||
|
||||
//=================================================================================
|
||||
// class : BuildGUI_FaceDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class BuildGUI_FaceDlg : public QDialog
|
||||
class BuildGUI_FaceDlg : public GEOMBase_Skeleton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
BuildGUI_FaceDlg( QWidget* parent = 0, const char* name = 0, BuildGUI* theBuildGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
|
||||
BuildGUI_FaceDlg(QWidget* parent = 0, const char* name = 0, BuildGUI* theBuildGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
|
||||
~BuildGUI_FaceDlg();
|
||||
|
||||
private:
|
||||
void Init();
|
||||
void enterEvent(QEvent* e);
|
||||
|
||||
BuildGUI* myBuildGUI;
|
||||
void Init( SALOME_Selection* Sel ) ;
|
||||
void closeEvent( QCloseEvent* e ) ;
|
||||
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
|
||||
|
||||
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */
|
||||
GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */
|
||||
SALOME_Selection* mySelection ; /* User shape selection */
|
||||
/* Filter selection */
|
||||
Handle(GEOM_ShapeTypeFilter) myWireFilter;
|
||||
|
||||
TopoDS_Shape myShape ; /* topology used to fuse */
|
||||
GEOM::GEOM_Shape_var myGeomShape ; /* is myShape */
|
||||
bool myOkShape ; /* to check when arguments is defined */
|
||||
TopoDS_Shape myShape; /* topology used to fuse */
|
||||
GEOM::GEOM_Shape_var myGeomShape; /* is myShape */
|
||||
bool myOkShape; /* to check when arguments is defined */
|
||||
|
||||
int myConstructorId ; /* Current constructor id = radio button id */
|
||||
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
|
||||
Handle(GEOM_ShapeTypeFilter) myWireFilter; /* Filter selection */
|
||||
|
||||
QButtonGroup* GroupConstructors;
|
||||
QRadioButton* Constructor1;
|
||||
QGroupBox* GroupC1;
|
||||
QLabel* TextLabelC1A1;
|
||||
QPushButton* SelectButtonC1A1;
|
||||
QLineEdit* LineEditC1A1;
|
||||
QCheckBox* CheckBox1;
|
||||
QGroupBox* GroupButtons;
|
||||
QPushButton* buttonOk;
|
||||
QPushButton* buttonCancel;
|
||||
QPushButton* buttonApply;
|
||||
DlgRef_1Sel1Check_QTD* GroupPoints;
|
||||
|
||||
private slots:
|
||||
|
||||
void ConstructorsClicked(int constructorId);
|
||||
void ClickOnOk();
|
||||
void ClickOnCancel();
|
||||
void ClickOnApply();
|
||||
void SetEditCurrentArgument() ;
|
||||
void SelectionIntoArgument() ;
|
||||
void LineEditReturnPressed() ;
|
||||
void DeactivateActiveDialog() ;
|
||||
void ActivateThisDialog() ;
|
||||
void ActivateThisDialog();
|
||||
void LineEditReturnPressed();
|
||||
void SelectionIntoArgument();
|
||||
void SetEditCurrentArgument();
|
||||
|
||||
protected:
|
||||
QGridLayout* BuildGUI_FaceDlgLayout;
|
||||
QGridLayout* GroupConstructorsLayout;
|
||||
QGridLayout* GroupC1Layout;
|
||||
QGridLayout* GroupButtonsLayout;
|
||||
};
|
||||
|
||||
#endif // DIALOGBOX_FACE_H
|
||||
|
@ -149,7 +149,7 @@ void BuildGUI_ShellDlg::SelectionIntoArgument()
|
||||
|
||||
aString = tr("%1_objects").arg(nbSel);
|
||||
|
||||
myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes);
|
||||
myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes);
|
||||
myEditCurrentArgument->setText(aString);
|
||||
myOkListShapes = true;
|
||||
|
||||
|
@ -149,7 +149,7 @@ void BuildGUI_SolidDlg::SelectionIntoArgument()
|
||||
|
||||
aString = tr("%1_objects").arg(nbSel);
|
||||
|
||||
myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes);
|
||||
myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes);
|
||||
myEditCurrentArgument->setText(aString);
|
||||
myOkListShapes = true;
|
||||
|
||||
|
@ -34,6 +34,8 @@
|
||||
|
||||
#include "BuildGUI.h"
|
||||
|
||||
#include "GEOM_ShapeTypeFilter.hxx"
|
||||
|
||||
//=================================================================================
|
||||
// class : BuildGUI_SolidDlg
|
||||
// purpose :
|
||||
|
@ -29,28 +29,13 @@
|
||||
using namespace std;
|
||||
#include "BuildGUI_SubShapeDlg.h"
|
||||
|
||||
#include "DisplayGUI.h"
|
||||
#include "QAD_RightFrame.h"
|
||||
#include "OCCViewer_Viewer3d.h"
|
||||
|
||||
#include <TopExp_Explorer.hxx>
|
||||
|
||||
#include <qbuttongroup.h>
|
||||
#include <qcheckbox.h>
|
||||
#include <qcombobox.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>
|
||||
|
||||
|
||||
#include <qmessagebox.h>
|
||||
#include <qmessagebox.h>
|
||||
|
||||
//=================================================================================
|
||||
// class : BuildGUI_SubShapeDlg()
|
||||
@ -60,112 +45,32 @@ using namespace std;
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
BuildGUI_SubShapeDlg::BuildGUI_SubShapeDlg(QWidget* parent, const char* name, BuildGUI* theBuildGUI, SALOME_Selection* Sel, Handle(AIS_InteractiveContext) ic, 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_SUBSHAPE")));
|
||||
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
|
||||
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SUBSHAPE")));
|
||||
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
|
||||
|
||||
if ( !name )
|
||||
setName( "BuildGUI_SUBSHAPE" );
|
||||
resize( 303, 239 );
|
||||
setCaption( tr( "GEOM_SUBSHAPE_TITLE" ) );
|
||||
setSizeGripEnabled( TRUE );
|
||||
BuildGUI_SubShapeDlgLayout = new QGridLayout( this );
|
||||
BuildGUI_SubShapeDlgLayout->setSpacing( 6 );
|
||||
BuildGUI_SubShapeDlgLayout->setMargin( 11 );
|
||||
setCaption(tr("GEOM_SUBSHAPE_TITLE"));
|
||||
|
||||
/***************************************************************/
|
||||
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
|
||||
GroupConstructors->setTitle( tr( "GEOM_SUB_SHAPE" ) );
|
||||
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 );
|
||||
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 );
|
||||
BuildGUI_SubShapeDlgLayout->addWidget( GroupConstructors, 0, 0 );
|
||||
/***************************************************************/
|
||||
GroupConstructors->setTitle(tr("GEOM_SUB_SHAPE"));
|
||||
RadioButton1->setPixmap(image0);
|
||||
RadioButton2->close(TRUE);
|
||||
RadioButton3->close(TRUE);
|
||||
|
||||
/***************************************************************/
|
||||
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 );
|
||||
BuildGUI_SubShapeDlgLayout->addWidget( GroupButtons, 2, 0 );
|
||||
GroupPoints = new DlgRef_1Sel1Check1List_QTD(this, "GroupPoints");
|
||||
GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
|
||||
GroupPoints->TextLabel1->setText(tr("GEOM_MAIN_OBJECT"));
|
||||
//GroupPoints->ComboBox1->setText(tr("GEOM_SUBSHAPE_TYPE"));
|
||||
GroupPoints->CheckButton1->setText(tr("GEOM_SUBSHAPE_SELECT"));
|
||||
GroupPoints->PushButton1->setPixmap(image1);
|
||||
|
||||
/***************************************************************/
|
||||
GroupC1 = new QGroupBox( this, "GroupC1" );
|
||||
GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) );
|
||||
GroupC1->setMinimumSize( QSize( 0, 0 ) );
|
||||
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" );
|
||||
TextLabelC1A1->setText( tr( "GEOM_MAIN_OBJECT" ) );
|
||||
TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) );
|
||||
TextLabelC1A1->setFrameShape( QLabel::NoFrame );
|
||||
TextLabelC1A1->setFrameShadow( QLabel::Plain );
|
||||
GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 );
|
||||
TextLabelComboBox1 = new QLabel( GroupC1, "TextLabelComboBox1" );
|
||||
TextLabelComboBox1->setText( tr( "GEOM_SUBSHAPE_TYPE" ) );
|
||||
GroupC1Layout->addMultiCellWidget( TextLabelComboBox1, 1, 1, 0, 1 );
|
||||
ComboBox1 = new QComboBox( FALSE, GroupC1, "ComboBox1" );
|
||||
ComboBox1->setMaxCount( 100 );
|
||||
GroupC1Layout->addMultiCellWidget( ComboBox1, 1, 1, 2, 3 );
|
||||
CheckBox1 = new QCheckBox( GroupC1, "CheckBox1" );
|
||||
CheckBox1->setText( tr( "GEOM_SUBSHAPE_SELECT" ) );
|
||||
CheckBox1->setChecked( FALSE );
|
||||
GroupC1Layout->addMultiCellWidget( CheckBox1, 2, 2, 0, 1 );
|
||||
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
|
||||
GroupC1Layout->addMultiCellWidget( LineEditC1A1, 0, 0, 2, 3 );
|
||||
SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" );
|
||||
SelectButtonC1A1->setText( tr( "" ) );
|
||||
SelectButtonC1A1->setPixmap( image1 );
|
||||
SelectButtonC1A1->setToggleButton( FALSE );
|
||||
SelectButtonC1A1->setMaximumSize( QSize( 28, 32767 ) );
|
||||
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
|
||||
BuildGUI_SubShapeDlgLayout->addWidget( GroupC1, 1, 0 );
|
||||
/***************************************************************/
|
||||
myBuildGUI = theBuildGUI;
|
||||
/* Initialisations */
|
||||
Init(Sel, ic) ;
|
||||
Layout1->addWidget(GroupPoints, 1, 0);
|
||||
/***************************************************************/
|
||||
|
||||
/* Initialisations */
|
||||
myBuildGUI = theBuildGUI;
|
||||
Init(ic);
|
||||
}
|
||||
|
||||
|
||||
@ -175,7 +80,7 @@ BuildGUI_SubShapeDlg::BuildGUI_SubShapeDlg(QWidget* parent, const char* name, Bu
|
||||
//=================================================================================
|
||||
BuildGUI_SubShapeDlg::~BuildGUI_SubShapeDlg()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
|
||||
@ -183,97 +88,65 @@ BuildGUI_SubShapeDlg::~BuildGUI_SubShapeDlg()
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_SubShapeDlg::Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic )
|
||||
void BuildGUI_SubShapeDlg::Init(Handle(AIS_InteractiveContext) ic)
|
||||
{
|
||||
|
||||
GroupC1->show();
|
||||
myConstructorId = 0 ;
|
||||
Constructor1->setChecked( TRUE );
|
||||
myEditCurrentArgument = LineEditC1A1 ;
|
||||
mySelection = Sel;
|
||||
myShape.Nullify() ;
|
||||
|
||||
myIC = ic ;
|
||||
myUseLocalContext = false ;
|
||||
myLocalContextId = -1;
|
||||
myAbort = false ;
|
||||
myOkShape = false ;
|
||||
myGeomGUI = GEOMBase_Context::GetGeomGUI() ;
|
||||
|
||||
/* type for sub shape selection */
|
||||
ComboBox1->insertItem("Compound");
|
||||
ComboBox1->insertItem("Compsolid");
|
||||
ComboBox1->insertItem("Solid");
|
||||
ComboBox1->insertItem("Shell");
|
||||
ComboBox1->insertItem("Face");
|
||||
ComboBox1->insertItem("Wire");
|
||||
ComboBox1->insertItem("Edge");
|
||||
ComboBox1->insertItem("Vertex");
|
||||
ComboBox1->insertItem("Shape");
|
||||
/* init variables */
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
|
||||
myWithShape = true;
|
||||
myShapeType = ComboBox1->currentItem();
|
||||
myAbort = myOkShape = myUseLocalContext = false;
|
||||
myIC = ic;
|
||||
myLocalContextId = -1;
|
||||
|
||||
/* Select sub shapes mode not checked */
|
||||
CheckBox1->setChecked( FALSE );
|
||||
myOkSelectSubMode = CheckBox1->isChecked();
|
||||
/* type for sub shape selection */
|
||||
GroupPoints->ComboBox1->insertItem("Compound");
|
||||
GroupPoints->ComboBox1->insertItem("Compsolid");
|
||||
GroupPoints->ComboBox1->insertItem("Solid");
|
||||
GroupPoints->ComboBox1->insertItem("Shell");
|
||||
GroupPoints->ComboBox1->insertItem("Face");
|
||||
GroupPoints->ComboBox1->insertItem("Wire");
|
||||
GroupPoints->ComboBox1->insertItem("Edge");
|
||||
GroupPoints->ComboBox1->insertItem("Vertex");
|
||||
GroupPoints->ComboBox1->insertItem("Shape");
|
||||
|
||||
// TODO : previous selection into argument ?
|
||||
|
||||
/* Filter definitions */
|
||||
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
|
||||
myGeom = GEOM::GEOM_Gen::_narrow(comp);
|
||||
myShapeType = GroupPoints->ComboBox1->currentItem();
|
||||
myOkSelectSubMode = GroupPoints->CheckButton1->isChecked();
|
||||
|
||||
/* signals and slots connections */
|
||||
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
|
||||
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
|
||||
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
|
||||
connect( GroupConstructors, SIGNAL(clicked(int) ), this, SLOT( ConstructorsClicked(int) ) );
|
||||
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
|
||||
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
|
||||
connect( CheckBox1, SIGNAL (stateChanged(int) ), this, SLOT( AllOrNotAll() ) ) ;
|
||||
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
|
||||
|
||||
connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ;
|
||||
connect(GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged()));
|
||||
connect(GroupPoints->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(AllOrNotAll()));
|
||||
|
||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
|
||||
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
|
||||
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) );
|
||||
/* displays Dialog */
|
||||
GroupPoints->show();
|
||||
this->show();
|
||||
|
||||
connect( ComboBox1, SIGNAL( activated(int) ), this, SLOT( ComboTextChanged() ) );
|
||||
|
||||
/* Move widget on the botton right corner of main widget */
|
||||
int x, y ;
|
||||
myGeomGUI->DefineDlgPosition( this, x, y ) ;
|
||||
this->move( x, y ) ;
|
||||
this->show() ; /* display Dialog */
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ConstructorsClicked()
|
||||
// purpose : Radio button management
|
||||
//=================================================================================
|
||||
void BuildGUI_SubShapeDlg::ConstructorsClicked(int constructorId)
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_SubShapeDlg::ClickOnOk()
|
||||
{
|
||||
this->ClickOnApply() ;
|
||||
this->ClickOnApply();
|
||||
|
||||
/* User has aborted or not operation of explode all with many sub shapes */
|
||||
if( this->myAbort == false )
|
||||
this->ClickOnCancel() ;
|
||||
if(myAbort == false)
|
||||
this->ClickOnCancel();
|
||||
else
|
||||
this->myAbort = false ;
|
||||
|
||||
return ;
|
||||
myAbort = false;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -283,52 +156,42 @@ void BuildGUI_SubShapeDlg::ClickOnOk()
|
||||
//=================================================================================
|
||||
void BuildGUI_SubShapeDlg::ClickOnApply()
|
||||
{
|
||||
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
|
||||
bool testResult = false ;
|
||||
|
||||
this->myAbort = false ; /* Not aborted by default */
|
||||
myGeomGUI->GetDesktop()->putInfo(tr(""));
|
||||
bool testResult = false;
|
||||
myAbort = false; /* Not aborted by default */
|
||||
|
||||
switch(myConstructorId)
|
||||
{
|
||||
case 0 :
|
||||
{
|
||||
/* Explode all sub shapes */
|
||||
if( myOkShape && !myOkSelectSubMode ) {
|
||||
|
||||
/* More than 30 subshapes : ask confirmation */
|
||||
unsigned int nb = NumberOfSubShapes( myShape, myShapeType ) ;
|
||||
if( nb > 30 ) {
|
||||
const QString caption = tr("GEOM_CONFIRM") ;
|
||||
const QString text = tr("GEOM_CONFIRM_INFO").arg(nb) ;
|
||||
const QString button0 = tr("GEOM_BUT_EXPLODE") ;
|
||||
const QString button1 = tr("GEOM_BUT_CANCEL") ;
|
||||
/* Explode all sub shapes */
|
||||
if(myOkShape && !myOkSelectSubMode) {
|
||||
/* More than 30 subshapes : ask confirmation */
|
||||
unsigned int nb = NumberOfSubShapes(myShape, myShapeType);
|
||||
if(nb > 30) {
|
||||
const QString caption = tr("GEOM_CONFIRM");
|
||||
const QString text = tr("GEOM_CONFIRM_INFO").arg(nb);
|
||||
const QString button0 = tr("GEOM_BUT_EXPLODE");
|
||||
const QString button1 = tr("GEOM_BUT_CANCEL");
|
||||
|
||||
if( QMessageBox::warning( this, caption, text, button0, button1 ) == 0 )
|
||||
testResult = myBuildGUI->OnSubShapeGetAll( myShape, myShapeIOR, myShapeType ) ;
|
||||
else
|
||||
this->myAbort = true ; /* aborted */
|
||||
}
|
||||
else {
|
||||
testResult = myBuildGUI->OnSubShapeGetAll( myShape, myShapeIOR, myShapeType ) ;
|
||||
}
|
||||
}
|
||||
/* explode only selected sub shapes */
|
||||
else if( myOkShape && myOkSelectSubMode ) {
|
||||
testResult = myBuildGUI->OnSubShapeGetSelected( myShape, myShapeIOR, myShapeType, myLocalContextId, myUseLocalContext ) ;
|
||||
}
|
||||
if( !testResult ) {
|
||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ;
|
||||
this->myAbort = true;
|
||||
}
|
||||
else {
|
||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ;
|
||||
}
|
||||
/* Reset all arguments and local context to allow user a new selection ...*/
|
||||
this->ResetStateOfDialog() ;
|
||||
break ;
|
||||
}
|
||||
if(QMessageBox::warning(this, caption, text, button0, button1) == 0)
|
||||
testResult = myBuildGUI->OnSubShapeGetAll(myShape, myShapeIOR, myShapeType);
|
||||
else
|
||||
myAbort = true; /* aborted */
|
||||
}
|
||||
return ;
|
||||
else
|
||||
testResult = myBuildGUI->OnSubShapeGetAll(myShape, myShapeIOR, myShapeType);
|
||||
}
|
||||
/* explode only selected sub shapes */
|
||||
else if(myOkShape && myOkSelectSubMode)
|
||||
testResult = myBuildGUI->OnSubShapeGetSelected(myShape, myShapeIOR, myShapeType, myLocalContextId, myUseLocalContext);
|
||||
|
||||
if(!testResult) {
|
||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT"));
|
||||
myAbort = true;
|
||||
}
|
||||
else
|
||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
|
||||
|
||||
/* Reset all arguments and local context to allow user a new selection ...*/
|
||||
this->ResetStateOfDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -338,22 +201,19 @@ void BuildGUI_SubShapeDlg::ClickOnApply()
|
||||
//=================================================================================
|
||||
void BuildGUI_SubShapeDlg::ClickOnCancel()
|
||||
{
|
||||
disconnect( mySelection, 0, this, 0 );
|
||||
myGeomGUI->ResetState() ;
|
||||
|
||||
if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
|
||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
|
||||
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
||||
myIC = v3d->getAISContext();
|
||||
myIC = v3d->getAISContext();
|
||||
|
||||
if(myUseLocalContext) {
|
||||
myIC->CloseLocalContext(myLocalContextId) ;
|
||||
|
||||
GEOMBase_Display* myDisplayGUI = new GEOMBase_Display();
|
||||
myDisplayGUI->OnDisplayAll(true) ;
|
||||
this->myUseLocalContext = false ;
|
||||
myIC->CloseLocalContext(myLocalContextId);
|
||||
myUseLocalContext = false;
|
||||
DisplayGUI* myDisplayGUI = new DisplayGUI();
|
||||
myDisplayGUI->OnDisplayAll(true);
|
||||
}
|
||||
}
|
||||
reject() ;
|
||||
return ;
|
||||
GEOMBase_Skeleton::ClickOnCancel();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -364,104 +224,98 @@ void BuildGUI_SubShapeDlg::ClickOnCancel()
|
||||
//=================================================================================
|
||||
void BuildGUI_SubShapeDlg::SelectionIntoArgument()
|
||||
{
|
||||
|
||||
/* Reset all arguments and local context when selection as changed */
|
||||
this->ResetStateOfDialog() ;
|
||||
|
||||
QString aString = ""; /* future name of selection */
|
||||
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
|
||||
myEditCurrentArgument->setText("");
|
||||
this->ResetStateOfDialog();
|
||||
QString aString = ""; /* name of selection */
|
||||
|
||||
if ( nbSel != 1 ) {
|
||||
LineEditC1A1->setText("") ;
|
||||
int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
if(nbSel != 1) {
|
||||
myOkShape = false;
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
/* nbSel == 1 */
|
||||
TopoDS_Shape S ;
|
||||
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
|
||||
|
||||
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
|
||||
return ;
|
||||
TopoDS_Shape S;
|
||||
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
|
||||
if(!myGeomBase->GetTopoFromSelection(mySelection, S))
|
||||
return;
|
||||
|
||||
if( !IO->hasEntry() ) {
|
||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")) ;
|
||||
return ;
|
||||
if(!IO->hasEntry()) {
|
||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY"));
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !S.IsNull() && S.ShapeType() != TopAbs_VERTEX )
|
||||
{
|
||||
if ( IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) )
|
||||
{
|
||||
Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast( IO );
|
||||
myShapeIOR = GIObject->getIOR(); /* the Geom IOR string of selection */
|
||||
LineEditC1A1->setText(aString) ;
|
||||
myShape = S ;
|
||||
myOkShape = true ;
|
||||
}
|
||||
else
|
||||
{
|
||||
SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument();
|
||||
SALOMEDS::SObject_var obj = aStudy->FindObjectID( IO->getEntry() );
|
||||
SALOMEDS::GenericAttribute_var anAttr;
|
||||
SALOMEDS::AttributeIOR_var anIOR;
|
||||
if ( !obj->_is_nil() )
|
||||
{
|
||||
if (obj->FindAttribute(anAttr, "AttributeIOR"))
|
||||
{
|
||||
anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
|
||||
myShapeIOR = anIOR->Value();
|
||||
myOkShape = true ;
|
||||
myShape = S ;
|
||||
LineEditC1A1->setText(aString) ;
|
||||
}
|
||||
}
|
||||
if(!S.IsNull() && S.ShapeType() != TopAbs_VERTEX) {
|
||||
if(IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject))) {
|
||||
Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast( IO );
|
||||
myShapeIOR = GIObject->getIOR(); /* the Geom IOR string of selection */
|
||||
myEditCurrentArgument->setText(aString);
|
||||
myShape = S;
|
||||
myOkShape = true;
|
||||
}
|
||||
else {
|
||||
SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument();
|
||||
SALOMEDS::SObject_var obj = aStudy->FindObjectID(IO->getEntry());
|
||||
SALOMEDS::GenericAttribute_var anAttr;
|
||||
SALOMEDS::AttributeIOR_var anIOR;
|
||||
if(!obj->_is_nil()) {
|
||||
if(obj->FindAttribute(anAttr, "AttributeIOR")) {
|
||||
anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
|
||||
myShapeIOR = anIOR->Value();
|
||||
myOkShape = true;
|
||||
myShape = S;
|
||||
GroupPoints->LineEdit1->setText(aString);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int SelectedShapeType = ComboBox1->currentItem();
|
||||
int count = ComboBox1->count();
|
||||
if ( myWithShape ) count = count - 1;
|
||||
int SelectedShapeType = GroupPoints->ComboBox1->currentItem();
|
||||
int count = GroupPoints->ComboBox1->count();
|
||||
|
||||
if(myWithShape)
|
||||
count = count - 1;
|
||||
|
||||
int i = 0;
|
||||
while ( i <= myShape.ShapeType() ) {
|
||||
ComboBox1->removeItem(0);
|
||||
while(i <= myShape.ShapeType()) {
|
||||
GroupPoints->ComboBox1->removeItem(0);
|
||||
i++;
|
||||
}
|
||||
|
||||
if (myShape.ShapeType()==TopAbs_COMPOUND)
|
||||
{
|
||||
if (myWithShape == false) {
|
||||
ComboBox1->insertItem("Shape");
|
||||
myWithShape = true;
|
||||
}
|
||||
if(myShape.ShapeType()==TopAbs_COMPOUND) {
|
||||
if(myWithShape == false) {
|
||||
GroupPoints->ComboBox1->insertItem("Shape");
|
||||
myWithShape = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (myWithShape == true) {
|
||||
ComboBox1->removeItem( ComboBox1->count() -1 );
|
||||
myWithShape = false;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(myWithShape == true) {
|
||||
GroupPoints->ComboBox1->removeItem(GroupPoints->ComboBox1->count() - 1);
|
||||
myWithShape = false;
|
||||
}
|
||||
}
|
||||
|
||||
int count1 = ComboBox1->count();
|
||||
if ( myWithShape ) count1 = count1 - 1;
|
||||
int count1 = GroupPoints->ComboBox1->count();
|
||||
if(myWithShape)
|
||||
count1 = count1 - 1;
|
||||
|
||||
if ( SelectedShapeType > myShape.ShapeType() ) {
|
||||
if ( SelectedShapeType == 8 ) {
|
||||
if ( myShape.ShapeType() != TopAbs_COMPOUND ) {
|
||||
ComboBox1->setCurrentItem(0);
|
||||
if(SelectedShapeType > myShape.ShapeType()) {
|
||||
if(SelectedShapeType == 8) {
|
||||
if(myShape.ShapeType() != TopAbs_COMPOUND) {
|
||||
GroupPoints->ComboBox1->setCurrentItem(0);
|
||||
myShapeType = 8 - count1;
|
||||
}
|
||||
} else {
|
||||
ComboBox1->setCurrentItem( count1 - count + SelectedShapeType );
|
||||
myShapeType = 8 - count1 + ComboBox1->currentItem();
|
||||
}
|
||||
} else {
|
||||
ComboBox1->setCurrentItem(0);
|
||||
else {
|
||||
GroupPoints->ComboBox1->setCurrentItem(count1 - count + SelectedShapeType);
|
||||
myShapeType = 8 - count1 + GroupPoints->ComboBox1->currentItem();
|
||||
}
|
||||
}
|
||||
else {
|
||||
GroupPoints->ComboBox1->setCurrentItem(0);
|
||||
myShapeType = 8 - count1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -472,21 +326,15 @@ void BuildGUI_SubShapeDlg::SelectionIntoArgument()
|
||||
void BuildGUI_SubShapeDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
switch (myConstructorId)
|
||||
{
|
||||
case 0: /* default constructor */
|
||||
{
|
||||
if(send == SelectButtonC1A1) {
|
||||
LineEditC1A1->setFocus() ;
|
||||
myEditCurrentArgument = LineEditC1A1;
|
||||
SelectionIntoArgument() ;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
||||
if(send == GroupPoints->PushButton1) {
|
||||
GroupPoints->LineEdit1->setFocus();
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
}
|
||||
this->SelectionIntoArgument();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
@ -495,21 +343,14 @@ void BuildGUI_SubShapeDlg::SetEditCurrentArgument()
|
||||
//=================================================================================
|
||||
void BuildGUI_SubShapeDlg::LineEditReturnPressed()
|
||||
{
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if( send == LineEditC1A1 )
|
||||
myEditCurrentArgument = LineEditC1A1 ;
|
||||
QLineEdit* send = (QLineEdit*)sender();
|
||||
if(send == GroupPoints->LineEdit1)
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
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 ;
|
||||
return;
|
||||
|
||||
GEOMBase_Skeleton::LineEditReturnPressed();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -519,21 +360,13 @@ void BuildGUI_SubShapeDlg::LineEditReturnPressed()
|
||||
//=================================================================================
|
||||
void BuildGUI_SubShapeDlg::DeactivateActiveDialog()
|
||||
{
|
||||
/* Check if active */
|
||||
if ( GroupConstructors->isEnabled() ) {
|
||||
|
||||
this->ResetStateOfDialog() ;
|
||||
|
||||
disconnect( mySelection, 0, this, 0 );
|
||||
GroupConstructors->setEnabled(false) ;
|
||||
GroupC1->setEnabled(false) ;
|
||||
GroupButtons->setEnabled(false) ;
|
||||
myGeomGUI->ResetState() ;
|
||||
myGeomGUI->SetActiveDialogBox(0) ;
|
||||
GEOMBase_Display* myDisplayGUI = new GEOMBase_Display();
|
||||
myDisplayGUI->OnDisplayAll(true) ;
|
||||
if(GroupConstructors->isEnabled()) {
|
||||
GEOMBase_Skeleton::DeactivateActiveDialog();
|
||||
this->ResetStateOfDialog();
|
||||
DisplayGUI* myDisplayGUI = new DisplayGUI();
|
||||
myDisplayGUI->OnDisplayAll(true);
|
||||
}
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -543,14 +376,9 @@ void BuildGUI_SubShapeDlg::DeactivateActiveDialog()
|
||||
//=================================================================================
|
||||
void BuildGUI_SubShapeDlg::ActivateThisDialog()
|
||||
{
|
||||
/* Emit a signal to deactivate other active dialog */
|
||||
myGeomGUI->EmitSignalDeactivateDialog() ;
|
||||
GroupConstructors->setEnabled(true) ;
|
||||
GroupC1->setEnabled(true) ;
|
||||
GroupButtons->setEnabled(true) ;
|
||||
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
|
||||
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
|
||||
return ;
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -560,10 +388,10 @@ void BuildGUI_SubShapeDlg::ActivateThisDialog()
|
||||
//=================================================================================
|
||||
void BuildGUI_SubShapeDlg::enterEvent(QEvent* e)
|
||||
{
|
||||
if ( GroupConstructors->isEnabled() )
|
||||
return ;
|
||||
ActivateThisDialog() ;
|
||||
return ;
|
||||
if(GroupConstructors->isEnabled())
|
||||
return;
|
||||
this->ActivateThisDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -571,63 +399,11 @@ void BuildGUI_SubShapeDlg::enterEvent(QEvent* e)
|
||||
// function : closeEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_SubShapeDlg::closeEvent( QCloseEvent* e )
|
||||
void BuildGUI_SubShapeDlg::closeEvent(QCloseEvent* e)
|
||||
{
|
||||
/* same than click on cancel button */
|
||||
this->ClickOnCancel() ;
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : AllOrNotAll()
|
||||
// purpose : Allow user selection of all or only selected sub shapes
|
||||
// : Called when 'CheckBox1' state change
|
||||
//=================================================================================
|
||||
void BuildGUI_SubShapeDlg::AllOrNotAll()
|
||||
{
|
||||
|
||||
/* No sub shape selection if main shape not selected */
|
||||
if( !this->myOkShape ) {
|
||||
ResetStateOfDialog() ;
|
||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_FIRST")) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
if (myShapeType ==TopAbs_SHAPE && myShape.ShapeType()==TopAbs_COMPOUND)
|
||||
{
|
||||
/* Select sub shapes mode not checked */
|
||||
myOkSelectSubMode = false ;
|
||||
CheckBox1->setChecked( FALSE );
|
||||
//no meaning to allow user selection for type = shape
|
||||
//TODO - add another message
|
||||
//myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_FIRST")) ;
|
||||
return ;
|
||||
}
|
||||
|
||||
myOkSelectSubMode = CheckBox1->isChecked() ;
|
||||
|
||||
if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
|
||||
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
||||
myIC = v3d->getAISContext();
|
||||
if( this->myUseLocalContext ) {
|
||||
myIC->CloseLocalContext(myLocalContextId) ;
|
||||
this->myUseLocalContext = false ;
|
||||
GEOMBase_Display* myDisplayGUI = new GEOMBase_Display();
|
||||
myDisplayGUI->OnDisplayAll(true) ;
|
||||
}
|
||||
} else {
|
||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NOT_FOR_VTK_VIEWER") ) ;
|
||||
return;
|
||||
}
|
||||
|
||||
if( myOkShape && myOkSelectSubMode ) {
|
||||
/* local context is defined into the method */
|
||||
myGeomGUI->PrepareSubShapeSelection( this->myShapeType, this->myLocalContextId ) ;
|
||||
myUseLocalContext = true ;
|
||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_FACE")) ;
|
||||
}
|
||||
return ;
|
||||
this->ClickOnCancel();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -637,56 +413,104 @@ void BuildGUI_SubShapeDlg::AllOrNotAll()
|
||||
//=================================================================================
|
||||
void BuildGUI_SubShapeDlg::ResetStateOfDialog()
|
||||
{
|
||||
/* To leave current selection if explode all as been aborted by user */
|
||||
if( this->myAbort == true ) {
|
||||
this->myOkShape = false ;
|
||||
this->myEditCurrentArgument->setText("") ;
|
||||
}
|
||||
else {
|
||||
; /* nothing to do : keep selection argument */
|
||||
if(myAbort == true) {
|
||||
myOkShape = false;
|
||||
myEditCurrentArgument->setText("");
|
||||
}
|
||||
|
||||
int SelectedShapeType = ComboBox1->currentItem();
|
||||
int count = ComboBox1->count();
|
||||
if ( myWithShape ) count = count - 1;
|
||||
int SelectedShapeType = GroupPoints->ComboBox1->currentItem();
|
||||
int count = GroupPoints->ComboBox1->count();
|
||||
if(myWithShape)
|
||||
count = count - 1;
|
||||
|
||||
/* type for sub shape selection */
|
||||
ComboBox1->clear();
|
||||
ComboBox1->insertItem("Compound");
|
||||
ComboBox1->insertItem("Compsolid");
|
||||
ComboBox1->insertItem("Solid");
|
||||
ComboBox1->insertItem("Shell");
|
||||
ComboBox1->insertItem("Face");
|
||||
ComboBox1->insertItem("Wire");
|
||||
ComboBox1->insertItem("Edge");
|
||||
ComboBox1->insertItem("Vertex");
|
||||
ComboBox1->insertItem("Shape");
|
||||
this->myWithShape=true;
|
||||
ComboBox1->setCurrentItem( 8 - count + SelectedShapeType );
|
||||
GroupPoints->ComboBox1->clear();
|
||||
GroupPoints->ComboBox1->insertItem("Compound");
|
||||
GroupPoints->ComboBox1->insertItem("Compsolid");
|
||||
GroupPoints->ComboBox1->insertItem("Solid");
|
||||
GroupPoints->ComboBox1->insertItem("Shell");
|
||||
GroupPoints->ComboBox1->insertItem("Face");
|
||||
GroupPoints->ComboBox1->insertItem("Wire");
|
||||
GroupPoints->ComboBox1->insertItem("Edge");
|
||||
GroupPoints->ComboBox1->insertItem("Vertex");
|
||||
GroupPoints->ComboBox1->insertItem("Shape");
|
||||
myWithShape=true;
|
||||
GroupPoints->ComboBox1->setCurrentItem(8 - count + SelectedShapeType);
|
||||
myOkSelectSubMode = false;
|
||||
|
||||
|
||||
/* unpress buttons : due to abort box*/
|
||||
this->buttonApply->setDown(FALSE) ;
|
||||
this->buttonOk->setDown(FALSE) ;
|
||||
|
||||
/* Select sub shapes mode not checked */
|
||||
this->myOkSelectSubMode = false ;
|
||||
this->CheckBox1->setChecked( FALSE );
|
||||
buttonApply->setDown(FALSE);
|
||||
buttonOk->setDown(FALSE);
|
||||
GroupPoints->CheckButton1->setChecked(FALSE);
|
||||
|
||||
/* Close its local contact if opened */
|
||||
if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
|
||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
|
||||
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
||||
myIC = v3d->getAISContext();
|
||||
if( this->myUseLocalContext ) {
|
||||
myIC->CloseLocalContext(this->myLocalContextId) ;
|
||||
this->myUseLocalContext = false ;
|
||||
GEOMBase_Display* myDisplayGUI = new GEOMBase_Display();
|
||||
myDisplayGUI->OnDisplayAll(true) ;
|
||||
myIC = v3d->getAISContext();
|
||||
|
||||
if(myUseLocalContext) {
|
||||
myIC->CloseLocalContext(myLocalContextId);
|
||||
myUseLocalContext = false;
|
||||
DisplayGUI* myDisplayGUI = new DisplayGUI();
|
||||
myDisplayGUI->OnDisplayAll(true);
|
||||
}
|
||||
}
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : AllOrNotAll()
|
||||
// purpose : Allow user selection of all or only selected sub shapes
|
||||
// : Called when 'CheckButton1' state change
|
||||
//=================================================================================
|
||||
void BuildGUI_SubShapeDlg::AllOrNotAll()
|
||||
{
|
||||
/* No sub shape selection if main shape not selected */
|
||||
if(!myOkShape) {
|
||||
this->ResetStateOfDialog();
|
||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_FIRST"));
|
||||
return;
|
||||
}
|
||||
|
||||
if(myShapeType ==TopAbs_SHAPE && myShape.ShapeType()==TopAbs_COMPOUND) {
|
||||
/* Select sub shapes mode not checked */
|
||||
myOkSelectSubMode = false;
|
||||
GroupPoints->CheckButton1->setChecked( FALSE );
|
||||
//no meaning to allow user selection for type = shape
|
||||
//TODO - add another message
|
||||
//myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_FIRST")) ;
|
||||
return;
|
||||
}
|
||||
|
||||
myOkSelectSubMode = GroupPoints->CheckButton1->isChecked();
|
||||
|
||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
|
||||
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
||||
myIC = v3d->getAISContext();
|
||||
|
||||
if(myUseLocalContext) {
|
||||
myIC->CloseLocalContext(myLocalContextId);
|
||||
myUseLocalContext = false;
|
||||
DisplayGUI* myDisplayGUI = new DisplayGUI();
|
||||
myDisplayGUI->OnDisplayAll(true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NOT_FOR_VTK_VIEWER"));
|
||||
return;
|
||||
}
|
||||
|
||||
if(myOkShape && myOkSelectSubMode) {
|
||||
/* local context is defined into the method */
|
||||
DisplayGUI* myDisplayGUI = new DisplayGUI();
|
||||
myDisplayGUI->PrepareSubShapeSelection(myShapeType, myLocalContextId);
|
||||
myUseLocalContext = true;
|
||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_FACE"));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ComboTextChanged()
|
||||
@ -694,26 +518,27 @@ void BuildGUI_SubShapeDlg::ResetStateOfDialog()
|
||||
//=================================================================================
|
||||
void BuildGUI_SubShapeDlg::ComboTextChanged()
|
||||
{
|
||||
if ( myOkShape )
|
||||
this->myShapeType = ComboBox1->currentItem() + myShape.ShapeType() + 1;
|
||||
if(myOkShape)
|
||||
myShapeType = GroupPoints->ComboBox1->currentItem() + myShape.ShapeType() + 1;
|
||||
else
|
||||
this->myShapeType = ComboBox1->currentItem();
|
||||
myShapeType = GroupPoints->ComboBox1->currentItem();
|
||||
|
||||
/* Select sub shapes mode not checked */
|
||||
CheckBox1->setChecked( FALSE );
|
||||
myOkSelectSubMode = FALSE ;
|
||||
GroupPoints->CheckButton1->setChecked(FALSE);
|
||||
myOkSelectSubMode = FALSE;
|
||||
|
||||
if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) {
|
||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
|
||||
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
||||
myIC = v3d->getAISContext();
|
||||
if( this->myUseLocalContext ) {
|
||||
myIC->CloseLocalContext(myLocalContextId) ;
|
||||
this->myUseLocalContext = false ;
|
||||
GEOMBase_Display* myDisplayGUI = new GEOMBase_Display();
|
||||
myDisplayGUI->OnDisplayAll(true) ;
|
||||
|
||||
if(myUseLocalContext) {
|
||||
myIC->CloseLocalContext(myLocalContextId);
|
||||
myUseLocalContext = false;
|
||||
DisplayGUI* myDisplayGUI = new DisplayGUI();
|
||||
myDisplayGUI->OnDisplayAll(true);
|
||||
}
|
||||
}
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -721,21 +546,19 @@ void BuildGUI_SubShapeDlg::ComboTextChanged()
|
||||
// function : NumberOfSubShapes()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
unsigned int BuildGUI_SubShapeDlg::NumberOfSubShapes( const TopoDS_Shape& S, const int shapeType )
|
||||
unsigned int BuildGUI_SubShapeDlg::NumberOfSubShapes(const TopoDS_Shape& S, const int shapeType)
|
||||
{
|
||||
if( S.IsNull() )
|
||||
return 0 ;
|
||||
if(S.IsNull())
|
||||
return 0;
|
||||
|
||||
unsigned int index = 0 ;
|
||||
TopExp_Explorer Exp( S, TopAbs_ShapeEnum(shapeType) );
|
||||
unsigned int index = 0;
|
||||
TopExp_Explorer Exp(S, TopAbs_ShapeEnum(shapeType));
|
||||
TopTools_MapOfShape M;
|
||||
while ( Exp.More() ) {
|
||||
if ( M.Add(Exp.Current()) )
|
||||
while(Exp.More()) {
|
||||
if(M.Add(Exp.Current()))
|
||||
index++;
|
||||
Exp.Next();
|
||||
}
|
||||
M.Clear() ;
|
||||
return index ;
|
||||
M.Clear();
|
||||
return index;
|
||||
}
|
||||
|
||||
|
||||
|
@ -29,31 +29,16 @@
|
||||
#ifndef DIALOGBOX_SUBSHAPE_H
|
||||
#define DIALOGBOX_SUBSHAPE_H
|
||||
|
||||
#include "GEOMBase_Skeleton.h"
|
||||
#include "DlgRef_1Sel1Check1List_QTD.h"
|
||||
|
||||
#include "BuildGUI.h"
|
||||
|
||||
#include <AIS_InteractiveContext.hxx>
|
||||
|
||||
#include <qvariant.h>
|
||||
#include <qdialog.h>
|
||||
|
||||
class QVBoxLayout;
|
||||
class QHBoxLayout;
|
||||
class QGridLayout;
|
||||
class QButtonGroup;
|
||||
class QCheckBox;
|
||||
class QComboBox;
|
||||
class QGroupBox;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QPushButton;
|
||||
class QRadioButton;
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// class : BuildGUI_SubShapeDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class BuildGUI_SubShapeDlg : public QDialog
|
||||
class BuildGUI_SubShapeDlg : public GEOMBase_Skeleton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -62,70 +47,43 @@ public:
|
||||
~BuildGUI_SubShapeDlg();
|
||||
|
||||
private :
|
||||
void Init(Handle(AIS_InteractiveContext) ic);
|
||||
void enterEvent(QEvent* e);
|
||||
void closeEvent(QCloseEvent* e);
|
||||
|
||||
void ResetStateOfDialog();
|
||||
unsigned int NumberOfSubShapes(const TopoDS_Shape& S, const int shapeType);
|
||||
|
||||
BuildGUI* myBuildGUI;
|
||||
void Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) ;
|
||||
void closeEvent( QCloseEvent* e ) ;
|
||||
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
|
||||
void ResetStateOfDialog() ;
|
||||
|
||||
unsigned int NumberOfSubShapes( const TopoDS_Shape& S, const int shapeType ) ;
|
||||
|
||||
|
||||
/* Interactive and local context management see also : bool myUseLocalContext() */
|
||||
Handle (AIS_InteractiveContext) myIC ; /* Interactive context */
|
||||
Standard_Integer myLocalContextId ; /* identify a local context used by this method */
|
||||
bool myUseLocalContext ; /* true when this method as opened a local context */
|
||||
Handle(AIS_InteractiveContext) myIC; /* Interactive context */
|
||||
Standard_Integer myLocalContextId; /* identify a local context used by this method */
|
||||
bool myUseLocalContext; /* true when this method as opened a local context */
|
||||
|
||||
GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */
|
||||
GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */
|
||||
SALOME_Selection* mySelection ; /* User shape selection */
|
||||
TopoDS_Shape myShape;
|
||||
bool myOkShape;
|
||||
char* myShapeIOR;
|
||||
int myShapeType;
|
||||
|
||||
TopoDS_Shape myShape ;
|
||||
char* myShapeIOR ;
|
||||
bool myOkShape ;
|
||||
int myShapeType ; /* define a type of topology mode of sub selection */
|
||||
|
||||
bool myWithShape ; /* check if Shape item exists */
|
||||
|
||||
bool myOkSelectSubMode ; /* true = sub mode selection activated */
|
||||
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
|
||||
int myConstructorId ; /* Current constructor id = radio button id */
|
||||
bool myAbort ; /* Indicate if sub Shape All has been aborted by user */
|
||||
bool myWithShape; /* check if Shape item exists */
|
||||
bool myOkSelectSubMode; /* true = sub mode selection activated */
|
||||
bool myAbort; /* Indicate if sub Shape All has been aborted by user */
|
||||
|
||||
QButtonGroup* GroupConstructors;
|
||||
QRadioButton* Constructor1;
|
||||
QGroupBox* GroupButtons;
|
||||
QPushButton* buttonOk;
|
||||
QPushButton* buttonCancel;
|
||||
QPushButton* buttonApply;
|
||||
QGroupBox* GroupC1;
|
||||
QPushButton* SelectButtonC1A1;
|
||||
QLineEdit* LineEditC1A1;
|
||||
QLabel* TextLabelC1A1;
|
||||
QLabel* TextLabelComboBox1;
|
||||
QComboBox* ComboBox1;
|
||||
|
||||
QCheckBox* CheckBox1;
|
||||
DlgRef_1Sel1Check1List_QTD* GroupPoints;
|
||||
|
||||
private slots:
|
||||
|
||||
void ConstructorsClicked(int constructorId);
|
||||
void ClickOnOk();
|
||||
void ClickOnCancel();
|
||||
void ClickOnApply();
|
||||
void LineEditReturnPressed() ;
|
||||
void SetEditCurrentArgument() ;
|
||||
void SelectionIntoArgument() ;
|
||||
void DeactivateActiveDialog() ;
|
||||
void ActivateThisDialog() ;
|
||||
void ClickOnCancel();
|
||||
void ActivateThisDialog();
|
||||
void DeactivateActiveDialog();
|
||||
void LineEditReturnPressed();
|
||||
void SelectionIntoArgument();
|
||||
void SetEditCurrentArgument();
|
||||
void AllOrNotAll() ;
|
||||
void ComboTextChanged() ;
|
||||
|
||||
protected:
|
||||
QGridLayout* BuildGUI_SubShapeDlgLayout;
|
||||
QGridLayout* GroupConstructorsLayout;
|
||||
QGridLayout* GroupButtonsLayout;
|
||||
QGridLayout* GroupC1Layout;
|
||||
};
|
||||
|
||||
#endif // DIALOGBOX_SUBSHAPE_H
|
||||
|
@ -29,20 +29,6 @@
|
||||
using namespace std;
|
||||
#include "BuildGUI_WireDlg.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 <qpixmap.h>
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// class : BuildGUI_WireDlg()
|
||||
// purpose : Constructs a BuildGUI_WireDlg which is a child of 'parent', with the
|
||||
@ -51,108 +37,40 @@ using namespace std;
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
BuildGUI_WireDlg::BuildGUI_WireDlg(QWidget* parent, const char* name, BuildGUI* theBuildGUI, 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_BUILD_WIRE")));
|
||||
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT")));
|
||||
QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_BUILD_WIRE")));
|
||||
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
|
||||
|
||||
if ( !name )
|
||||
setName( "BuildGUI_WireDlg" );
|
||||
resize( 303, 185 );
|
||||
setCaption( tr( "GEOM_WIRE_TITLE" ) );
|
||||
setSizeGripEnabled( TRUE );
|
||||
BuildGUI_WireDlgLayout = new QGridLayout( this );
|
||||
BuildGUI_WireDlgLayout->setSpacing( 6 );
|
||||
BuildGUI_WireDlgLayout->setMargin( 11 );
|
||||
setCaption(tr("GEOM_WIRE_TITLE"));
|
||||
|
||||
/***************************************************************/
|
||||
GroupConstructors = new QButtonGroup( this, "GroupConstructors" );
|
||||
GroupConstructors->setTitle( tr( "GEOM_WIRE" ) );
|
||||
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 );
|
||||
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 );
|
||||
BuildGUI_WireDlgLayout->addWidget( GroupConstructors, 0, 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 );
|
||||
BuildGUI_WireDlgLayout->addWidget( GroupButtons, 2, 0 );
|
||||
/***************************************************************/
|
||||
GroupConstructors->setTitle(tr("GEOM_WIRE"));
|
||||
RadioButton1->setPixmap(image0);
|
||||
RadioButton2->close(TRUE);
|
||||
RadioButton3->close(TRUE);
|
||||
|
||||
/***************************************************************/
|
||||
GroupC1 = new QGroupBox( this, "GroupC1" );
|
||||
GroupC1->setTitle( tr( "GEOM_WIRE_CONNECT" ) );
|
||||
GroupC1->setMinimumSize( QSize( 0, 0 ) );
|
||||
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" );
|
||||
TextLabelC1A1->setText( tr( "GEOM_OBJECTS" ) );
|
||||
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 );
|
||||
GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 );
|
||||
LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" );
|
||||
GroupC1Layout->addWidget( LineEditC1A1, 0, 2 );
|
||||
BuildGUI_WireDlgLayout->addWidget( GroupC1, 1, 0 );
|
||||
myBuildGUI = theBuildGUI;
|
||||
Init(Sel) ; /* Initialisations */
|
||||
GroupPoints = new DlgRef_1Sel_QTD(this, "GroupPoints");
|
||||
GroupPoints->GroupBox1->setTitle(tr("GEOM_WIRE_CONNECT"));
|
||||
GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS"));
|
||||
GroupPoints->PushButton1->setPixmap(image1);
|
||||
|
||||
Layout1->addWidget(GroupPoints, 1, 0);
|
||||
/***************************************************************/
|
||||
|
||||
/* Initialisations */
|
||||
myBuildGUI = theBuildGUI;
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ~BuildGUI_WireDlg()
|
||||
// purpose : Destroys the object and frees any allocated resources
|
||||
//=================================================================================
|
||||
BuildGUI_WireDlg::~BuildGUI_WireDlg()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
|
||||
@ -160,53 +78,35 @@ BuildGUI_WireDlg::~BuildGUI_WireDlg()
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_WireDlg::Init( SALOME_Selection* Sel )
|
||||
void BuildGUI_WireDlg::Init()
|
||||
{
|
||||
|
||||
GroupC1->show();
|
||||
myConstructorId = 0 ;
|
||||
Constructor1->setChecked( TRUE );
|
||||
myEditCurrentArgument = LineEditC1A1 ;
|
||||
mySelection = Sel;
|
||||
this->myOkListShapes = false ;
|
||||
myGeomGUI = GEOMBase_Context::GetGeomGUI() ;
|
||||
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);
|
||||
/* init variables */
|
||||
myEditCurrentArgument = GroupPoints->LineEdit1;
|
||||
myOkListShapes = false;
|
||||
|
||||
/* signals and slots connections */
|
||||
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) );
|
||||
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ;
|
||||
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
|
||||
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
|
||||
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
|
||||
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
|
||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
|
||||
|
||||
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ;
|
||||
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() ) ) ;
|
||||
/* displays Dialog */
|
||||
GroupPoints->show();
|
||||
this->show();
|
||||
|
||||
/* 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 ;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ConstructorsClicked()
|
||||
// purpose : Radio button management
|
||||
// function : ClickOnOk()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_WireDlg::ConstructorsClicked(int constructorId)
|
||||
void BuildGUI_WireDlg::ClickOnOk()
|
||||
{
|
||||
return ;
|
||||
this->ClickOnApply();
|
||||
ClickOnCancel();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -216,41 +116,10 @@ void BuildGUI_WireDlg::ConstructorsClicked(int constructorId)
|
||||
//=================================================================================
|
||||
void BuildGUI_WireDlg::ClickOnApply()
|
||||
{
|
||||
switch(myConstructorId)
|
||||
{
|
||||
case 0 :
|
||||
{
|
||||
if(myOkListShapes) {
|
||||
myBuildGUI->MakeWireAndDisplay( myListShapes ) ;
|
||||
}
|
||||
break ;
|
||||
}
|
||||
}
|
||||
// accept();
|
||||
return ;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_WireDlg::ClickOnOk()
|
||||
{
|
||||
this->ClickOnApply() ;
|
||||
this->ClickOnCancel() ;
|
||||
|
||||
return ;
|
||||
}
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnCancel()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_WireDlg::ClickOnCancel()
|
||||
{
|
||||
myGeomGUI->ResetState() ;
|
||||
reject() ;
|
||||
return ;
|
||||
myGeomGUI->GetDesktop()->putInfo(tr(""));
|
||||
if(myOkListShapes)
|
||||
myBuildGUI->MakeWireAndDisplay(myListShapes);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -260,22 +129,20 @@ void BuildGUI_WireDlg::ClickOnCancel()
|
||||
//=================================================================================
|
||||
void BuildGUI_WireDlg::SelectionIntoArgument()
|
||||
{
|
||||
/* All this for first constructor */
|
||||
// if(myEditCurrentArgument == LineEditC1A1 )
|
||||
myEditCurrentArgument->setText("");
|
||||
QString aString = ""; /* name of selection */
|
||||
|
||||
myEditCurrentArgument->setText("") ;
|
||||
myOkListShapes = false;
|
||||
QString aString = ""; /* Future name of selection */
|
||||
|
||||
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
|
||||
if(nbSel < 1)
|
||||
return ;
|
||||
int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
|
||||
if(nbSel < 1) {
|
||||
myOkListShapes = false;
|
||||
return;
|
||||
}
|
||||
|
||||
myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes) ;
|
||||
myEditCurrentArgument->setText(aString) ;
|
||||
myOkListShapes = true ;
|
||||
myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes);
|
||||
myEditCurrentArgument->setText(aString);
|
||||
myOkListShapes = true;
|
||||
/* no simulation */
|
||||
return ;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -285,46 +152,9 @@ void BuildGUI_WireDlg::SelectionIntoArgument()
|
||||
//=================================================================================
|
||||
void BuildGUI_WireDlg::SetEditCurrentArgument()
|
||||
{
|
||||
QPushButton* send = (QPushButton*)sender();
|
||||
switch (myConstructorId)
|
||||
{
|
||||
case 0: /* default constructor */
|
||||
{
|
||||
if(send == SelectButtonC1A1) {
|
||||
LineEditC1A1->setFocus() ;
|
||||
myEditCurrentArgument = LineEditC1A1;
|
||||
}
|
||||
SelectionIntoArgument() ;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : LineEditReturnPressed()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_WireDlg::LineEditReturnPressed()
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : DeactivateActiveDialog()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_WireDlg::DeactivateActiveDialog()
|
||||
{
|
||||
if ( GroupConstructors->isEnabled() ) {
|
||||
GroupConstructors->setEnabled(false) ;
|
||||
GroupC1->setEnabled(false) ;
|
||||
GroupButtons->setEnabled(false) ;
|
||||
}
|
||||
return ;
|
||||
GroupPoints->LineEdit1->setFocus();
|
||||
this->SelectionIntoArgument();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -334,12 +164,9 @@ void BuildGUI_WireDlg::DeactivateActiveDialog()
|
||||
//=================================================================================
|
||||
void BuildGUI_WireDlg::ActivateThisDialog()
|
||||
{
|
||||
/* Emit a signal to deactivate the active dialog */
|
||||
myGeomGUI->EmitSignalDeactivateDialog() ;
|
||||
GroupConstructors->setEnabled(true) ;
|
||||
GroupC1->setEnabled(true) ;
|
||||
GroupButtons->setEnabled(true) ;
|
||||
return ;
|
||||
GEOMBase_Skeleton::ActivateThisDialog();
|
||||
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -349,22 +176,8 @@ void BuildGUI_WireDlg::ActivateThisDialog()
|
||||
//=================================================================================
|
||||
void BuildGUI_WireDlg::enterEvent(QEvent* e)
|
||||
{
|
||||
if ( GroupConstructors->isEnabled() )
|
||||
return ;
|
||||
ActivateThisDialog() ;
|
||||
return ;
|
||||
if (GroupConstructors->isEnabled())
|
||||
return;
|
||||
this->ActivateThisDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : closeEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void BuildGUI_WireDlg::closeEvent( QCloseEvent* e )
|
||||
{
|
||||
/* same than click on cancel button */
|
||||
this->ClickOnCancel() ;
|
||||
return ;
|
||||
}
|
||||
|
||||
|
||||
|
@ -29,76 +29,41 @@
|
||||
#ifndef DIALOGBOX_WIRE_H
|
||||
#define DIALOGBOX_WIRE_H
|
||||
|
||||
#include "GEOMBase_Skeleton.h"
|
||||
#include "DlgRef_1Sel_QTD.h"
|
||||
|
||||
#include "BuildGUI.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 : BuildGUI_WireDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class BuildGUI_WireDlg : public QDialog
|
||||
class BuildGUI_WireDlg : public GEOMBase_Skeleton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
BuildGUI_WireDlg( QWidget* parent = 0, const char* name = 0, BuildGUI* theBuildGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 );
|
||||
BuildGUI_WireDlg(QWidget* parent = 0, const char* name = 0, BuildGUI* theBuildGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
|
||||
~BuildGUI_WireDlg();
|
||||
|
||||
private:
|
||||
void Init();
|
||||
void enterEvent(QEvent* e);
|
||||
|
||||
BuildGUI* myBuildGUI;
|
||||
void Init( SALOME_Selection* Sel ) ;
|
||||
void closeEvent( QCloseEvent* e ) ;
|
||||
void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */
|
||||
|
||||
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */
|
||||
GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */
|
||||
SALOME_Selection* mySelection ; /* User shape selection */
|
||||
GEOM::GEOM_Gen::ListOfIOR myListShapes ;
|
||||
bool myOkListShapes ; /* to check when arguments is defined */
|
||||
int myConstructorId ; /* Current constructor id = radio button id */
|
||||
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
|
||||
GEOM::GEOM_Gen::ListOfIOR myListShapes;
|
||||
bool myOkListShapes; /* to check when arguments is defined */
|
||||
|
||||
QButtonGroup* GroupConstructors;
|
||||
QRadioButton* Constructor1;
|
||||
QGroupBox* GroupButtons;
|
||||
QPushButton* buttonOk;
|
||||
QPushButton* buttonCancel;
|
||||
QPushButton* buttonApply;
|
||||
QGroupBox* GroupC1;
|
||||
QLabel* TextLabelC1A1;
|
||||
QPushButton* SelectButtonC1A1;
|
||||
QLineEdit* LineEditC1A1;
|
||||
DlgRef_1Sel_QTD* GroupPoints;
|
||||
|
||||
private slots:
|
||||
|
||||
void ConstructorsClicked(int constructorId);
|
||||
void ClickOnOk();
|
||||
void ClickOnCancel();
|
||||
void ClickOnApply();
|
||||
void SetEditCurrentArgument() ;
|
||||
void LineEditReturnPressed() ;
|
||||
void SelectionIntoArgument() ;
|
||||
void DeactivateActiveDialog() ;
|
||||
void ActivateThisDialog() ;
|
||||
void ActivateThisDialog();
|
||||
void SelectionIntoArgument();
|
||||
void SetEditCurrentArgument();
|
||||
|
||||
protected:
|
||||
QGridLayout* BuildGUI_WireDlgLayout;
|
||||
QGridLayout* GroupConstructorsLayout;
|
||||
QGridLayout* GroupButtonsLayout;
|
||||
QGridLayout* GroupC1Layout;
|
||||
};
|
||||
|
||||
#endif // DIALOGBOX_WIRE_H
|
||||
|
@ -35,7 +35,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl
|
||||
@COMMENCE@
|
||||
|
||||
# header files
|
||||
EXPORT_HEADERS= BuildGUI.h
|
||||
EXPORT_HEADERS=
|
||||
|
||||
# Libraries targets
|
||||
LIB = libBuildGUI.la
|
||||
@ -74,6 +74,6 @@ LIB_SERVER_IDL =
|
||||
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
|
||||
|
||||
LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lDlgRef -lGEOMBase $(OCC_KERNEL_LIBS) $(OCC_MODELER_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome
|
||||
LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lDlgRef -lGEOMContext -lGEOMBase -lDisplayGUI -L${KERNEL_ROOT_DIR}/lib/salome
|
||||
|
||||
@CONCLUDE@
|
||||
|
85
src/DlgRef/DlgRef_1Sel1Check1List_QTD.cxx
Normal file
85
src/DlgRef/DlgRef_1Sel1Check1List_QTD.cxx
Normal file
@ -0,0 +1,85 @@
|
||||
/****************************************************************************
|
||||
** Form implementation generated from reading ui file 'DlgRef_1Sel1Check1List_QTD.ui'
|
||||
**
|
||||
** Created: jeu oct 16 10:43:10 2003
|
||||
** by: The User Interface Compiler (uic)
|
||||
**
|
||||
** WARNING! All changes made in this file will be lost!
|
||||
****************************************************************************/
|
||||
#include "DlgRef_1Sel1Check1List_QTD.h"
|
||||
|
||||
#include <qvariant.h>
|
||||
#include <qcombobox.h>
|
||||
#include <qgroupbox.h>
|
||||
#include <qlabel.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qradiobutton.h>
|
||||
#include <qlayout.h>
|
||||
#include <qtooltip.h>
|
||||
#include <qwhatsthis.h>
|
||||
|
||||
/*
|
||||
* Constructs a DlgRef_1Sel1Check1List_QTD which is a child of 'parent', with the
|
||||
* name 'name' and widget flags set to 'f'.
|
||||
*/
|
||||
DlgRef_1Sel1Check1List_QTD::DlgRef_1Sel1Check1List_QTD( QWidget* parent, const char* name, WFlags fl )
|
||||
: QWidget( parent, name, fl )
|
||||
{
|
||||
if ( !name )
|
||||
setName( "DlgRef_1Sel1Check1List_QTD" );
|
||||
resize( 129, 104 );
|
||||
setCaption( trUtf8( "DlgRef_1Sel1Check1List_QTD" ) );
|
||||
DlgRef_1Sel1Check1List_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_1Sel1Check1List_QTDLayout");
|
||||
|
||||
GroupBox1 = new QGroupBox( this, "GroupBox1" );
|
||||
GroupBox1->setTitle( trUtf8( "" ) );
|
||||
GroupBox1->setColumnLayout(0, Qt::Vertical );
|
||||
GroupBox1->layout()->setSpacing( 6 );
|
||||
GroupBox1->layout()->setMargin( 11 );
|
||||
GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
|
||||
GroupBox1Layout->setAlignment( Qt::AlignTop );
|
||||
|
||||
Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1");
|
||||
|
||||
CheckButton1 = new QRadioButton( GroupBox1, "CheckButton1" );
|
||||
CheckButton1->setText( trUtf8( "" ) );
|
||||
|
||||
Layout1->addMultiCellWidget( CheckButton1, 2, 2, 0, 2 );
|
||||
|
||||
LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" );
|
||||
|
||||
Layout1->addWidget( LineEdit1, 0, 2 );
|
||||
|
||||
TextLabel1 = new QLabel( GroupBox1, "TextLabel1" );
|
||||
TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) );
|
||||
TextLabel1->setText( trUtf8( "TL1" ) );
|
||||
|
||||
Layout1->addWidget( TextLabel1, 0, 0 );
|
||||
|
||||
PushButton1 = new QPushButton( GroupBox1, "PushButton1" );
|
||||
PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) );
|
||||
PushButton1->setText( trUtf8( "" ) );
|
||||
|
||||
Layout1->addWidget( PushButton1, 0, 1 );
|
||||
|
||||
ComboBox1 = new QComboBox( FALSE, GroupBox1, "ComboBox1" );
|
||||
ComboBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, ComboBox1->sizePolicy().hasHeightForWidth() ) );
|
||||
|
||||
Layout1->addWidget( ComboBox1, 1, 2 );
|
||||
QSpacerItem* spacer = new QSpacerItem( 0, 60, QSizePolicy::Minimum, QSizePolicy::Expanding );
|
||||
Layout1->addItem( spacer, 3, 2 );
|
||||
|
||||
GroupBox1Layout->addLayout( Layout1, 0, 0 );
|
||||
|
||||
DlgRef_1Sel1Check1List_QTDLayout->addWidget( GroupBox1, 0, 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
* Destroys the object and frees any allocated resources
|
||||
*/
|
||||
DlgRef_1Sel1Check1List_QTD::~DlgRef_1Sel1Check1List_QTD()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
46
src/DlgRef/DlgRef_1Sel1Check1List_QTD.h
Normal file
46
src/DlgRef/DlgRef_1Sel1Check1List_QTD.h
Normal file
@ -0,0 +1,46 @@
|
||||
/****************************************************************************
|
||||
** Form interface generated from reading ui file 'DlgRef_1Sel1Check1List_QTD.ui'
|
||||
**
|
||||
** Created: jeu oct 16 10:43:10 2003
|
||||
** by: The User Interface Compiler (uic)
|
||||
**
|
||||
** WARNING! All changes made in this file will be lost!
|
||||
****************************************************************************/
|
||||
#ifndef DLGREF_1SEL1CHECK1LIST_QTD_H
|
||||
#define DLGREF_1SEL1CHECK1LIST_QTD_H
|
||||
|
||||
#include <qvariant.h>
|
||||
#include <qwidget.h>
|
||||
class QVBoxLayout;
|
||||
class QHBoxLayout;
|
||||
class QGridLayout;
|
||||
class QComboBox;
|
||||
class QGroupBox;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QPushButton;
|
||||
class QRadioButton;
|
||||
|
||||
class DlgRef_1Sel1Check1List_QTD : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DlgRef_1Sel1Check1List_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
|
||||
~DlgRef_1Sel1Check1List_QTD();
|
||||
|
||||
QGroupBox* GroupBox1;
|
||||
QRadioButton* CheckButton1;
|
||||
QLineEdit* LineEdit1;
|
||||
QLabel* TextLabel1;
|
||||
QPushButton* PushButton1;
|
||||
QComboBox* ComboBox1;
|
||||
|
||||
|
||||
protected:
|
||||
QGridLayout* DlgRef_1Sel1Check1List_QTDLayout;
|
||||
QGridLayout* GroupBox1Layout;
|
||||
QGridLayout* Layout1;
|
||||
};
|
||||
|
||||
#endif // DLGREF_1SEL1CHECK1LIST_QTD_H
|
79
src/DlgRef/DlgRef_1Sel1Check_QTD.cxx
Normal file
79
src/DlgRef/DlgRef_1Sel1Check_QTD.cxx
Normal file
@ -0,0 +1,79 @@
|
||||
/****************************************************************************
|
||||
** Form implementation generated from reading ui file 'DlgRef_1Sel1Check_QTD.ui'
|
||||
**
|
||||
** Created: ven oct 10 11:28:38 2003
|
||||
** by: The User Interface Compiler (uic)
|
||||
**
|
||||
** WARNING! All changes made in this file will be lost!
|
||||
****************************************************************************/
|
||||
#include "DlgRef_1Sel1Check_QTD.h"
|
||||
|
||||
#include <qvariant.h>
|
||||
#include <qgroupbox.h>
|
||||
#include <qlabel.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qradiobutton.h>
|
||||
#include <qlayout.h>
|
||||
#include <qtooltip.h>
|
||||
#include <qwhatsthis.h>
|
||||
|
||||
/*
|
||||
* Constructs a DlgRef_1Sel1Check_QTD which is a child of 'parent', with the
|
||||
* name 'name' and widget flags set to 'f'.
|
||||
*/
|
||||
DlgRef_1Sel1Check_QTD::DlgRef_1Sel1Check_QTD( QWidget* parent, const char* name, WFlags fl )
|
||||
: QWidget( parent, name, fl )
|
||||
{
|
||||
if ( !name )
|
||||
setName( "DlgRef_1Sel1Check_QTD" );
|
||||
resize( 129, 76 );
|
||||
setCaption( trUtf8( "DlgRef_1Sel1Check_QTD" ) );
|
||||
DlgRef_1Sel1Check_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "DlgRef_1Sel1Check_QTDLayout");
|
||||
|
||||
GroupBox1 = new QGroupBox( this, "GroupBox1" );
|
||||
GroupBox1->setTitle( trUtf8( "" ) );
|
||||
GroupBox1->setColumnLayout(0, Qt::Vertical );
|
||||
GroupBox1->layout()->setSpacing( 6 );
|
||||
GroupBox1->layout()->setMargin( 11 );
|
||||
GroupBox1Layout = new QGridLayout( GroupBox1->layout() );
|
||||
GroupBox1Layout->setAlignment( Qt::AlignTop );
|
||||
|
||||
Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1");
|
||||
|
||||
TextLabel1 = new QLabel( GroupBox1, "TextLabel1" );
|
||||
TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) );
|
||||
TextLabel1->setText( trUtf8( "TL1" ) );
|
||||
|
||||
Layout1->addWidget( TextLabel1, 0, 0 );
|
||||
QSpacerItem* spacer = new QSpacerItem( 0, 113, QSizePolicy::Minimum, QSizePolicy::Expanding );
|
||||
Layout1->addItem( spacer, 2, 2 );
|
||||
|
||||
PushButton1 = new QPushButton( GroupBox1, "PushButton1" );
|
||||
PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) );
|
||||
PushButton1->setText( trUtf8( "" ) );
|
||||
|
||||
Layout1->addWidget( PushButton1, 0, 1 );
|
||||
|
||||
LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" );
|
||||
|
||||
Layout1->addWidget( LineEdit1, 0, 2 );
|
||||
|
||||
CheckButton1 = new QRadioButton( GroupBox1, "CheckButton1" );
|
||||
CheckButton1->setText( trUtf8( "" ) );
|
||||
|
||||
Layout1->addMultiCellWidget( CheckButton1, 1, 1, 0, 2 );
|
||||
|
||||
GroupBox1Layout->addLayout( Layout1, 0, 0 );
|
||||
|
||||
DlgRef_1Sel1Check_QTDLayout->addWidget( GroupBox1, 0, 0 );
|
||||
}
|
||||
|
||||
/*
|
||||
* Destroys the object and frees any allocated resources
|
||||
*/
|
||||
DlgRef_1Sel1Check_QTD::~DlgRef_1Sel1Check_QTD()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
44
src/DlgRef/DlgRef_1Sel1Check_QTD.h
Normal file
44
src/DlgRef/DlgRef_1Sel1Check_QTD.h
Normal file
@ -0,0 +1,44 @@
|
||||
/****************************************************************************
|
||||
** Form interface generated from reading ui file 'DlgRef_1Sel1Check_QTD.ui'
|
||||
**
|
||||
** Created: ven oct 10 11:28:37 2003
|
||||
** by: The User Interface Compiler (uic)
|
||||
**
|
||||
** WARNING! All changes made in this file will be lost!
|
||||
****************************************************************************/
|
||||
#ifndef DLGREF_1SEL1CHECK_QTD_H
|
||||
#define DLGREF_1SEL1CHECK_QTD_H
|
||||
|
||||
#include <qvariant.h>
|
||||
#include <qwidget.h>
|
||||
class QVBoxLayout;
|
||||
class QHBoxLayout;
|
||||
class QGridLayout;
|
||||
class QGroupBox;
|
||||
class QLabel;
|
||||
class QLineEdit;
|
||||
class QPushButton;
|
||||
class QRadioButton;
|
||||
|
||||
class DlgRef_1Sel1Check_QTD : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DlgRef_1Sel1Check_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
|
||||
~DlgRef_1Sel1Check_QTD();
|
||||
|
||||
QGroupBox* GroupBox1;
|
||||
QLabel* TextLabel1;
|
||||
QPushButton* PushButton1;
|
||||
QLineEdit* LineEdit1;
|
||||
QRadioButton* CheckButton1;
|
||||
|
||||
|
||||
protected:
|
||||
QGridLayout* DlgRef_1Sel1Check_QTDLayout;
|
||||
QGridLayout* GroupBox1Layout;
|
||||
QGridLayout* Layout1;
|
||||
};
|
||||
|
||||
#endif // DLGREF_1SEL1CHECK_QTD_H
|
@ -28,6 +28,7 @@
|
||||
|
||||
using namespace std;
|
||||
#include "DlgRef_SpinBox.h"
|
||||
|
||||
#include <qvalidator.h>
|
||||
|
||||
//=================================================================================
|
||||
@ -93,7 +94,8 @@ QString DlgRef_SpinBox::GetString()
|
||||
// function : RangeStepAndValidator()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void DlgRef_SpinBox::RangeStepAndValidator(double min, double max, double step, unsigned short decimals)
|
||||
void DlgRef_SpinBox::RangeStepAndValidator(double min, double max,double step,
|
||||
unsigned short decimals)
|
||||
{
|
||||
setRange(min, max);
|
||||
setLineStep(step);
|
||||
|
@ -31,8 +31,6 @@
|
||||
|
||||
#include "QAD_SpinBoxDbl.h"
|
||||
|
||||
class DlgRef ;
|
||||
|
||||
//=================================================================================
|
||||
// class : DlgRef_SpinBox
|
||||
// purpose : Derivated from QSpinBox class and modified to accept floats
|
||||
@ -42,19 +40,18 @@ class DlgRef_SpinBox : public QAD_SpinBoxDbl
|
||||
Q_OBJECT
|
||||
|
||||
public :
|
||||
DlgRef_SpinBox( QWidget* parent, const char* name = 0 );
|
||||
DlgRef_SpinBox(QWidget* parent, const char* name = 0);
|
||||
~DlgRef_SpinBox();
|
||||
|
||||
void RangeStepAndValidator( double min = -1000000.0,
|
||||
double max = +1000000.0,
|
||||
double step = 100.0,
|
||||
unsigned short decimals = 3 );
|
||||
void SetValue( double v );
|
||||
double GetValue();
|
||||
void RangeStepAndValidator(double min = -1000000.0, double max = +1000000.0,
|
||||
double step = 100.0, unsigned short decimals = 3);
|
||||
void SetValue(double v);
|
||||
double GetValue();
|
||||
QString GetString();
|
||||
|
||||
public slots:
|
||||
void SetStep( double newStep );
|
||||
void SetStep(double newStep);
|
||||
|
||||
};
|
||||
|
||||
#endif // GEOMSPINBOX_H
|
||||
|
@ -41,6 +41,8 @@ LIB_SRC = DlgRef_Skeleton_QTD.cxx \
|
||||
DlgRef_1Sel_QTD.cxx \
|
||||
DlgRef_2Sel_QTD.cxx \
|
||||
DlgRef_3Sel_QTD.cxx \
|
||||
DlgRef_1Sel1Check_QTD.cxx \
|
||||
DlgRef_1Sel1Check1List_QTD.cxx \
|
||||
DlgRef_1Sel1Spin_QTD.cxx \
|
||||
DlgRef_1Sel2Spin_QTD.cxx \
|
||||
DlgRef_1Sel3Spin_QTD.cxx \
|
||||
@ -74,6 +76,8 @@ LIB_MOC = \
|
||||
DlgRef_1Sel_QTD.h \
|
||||
DlgRef_2Sel_QTD.h \
|
||||
DlgRef_3Sel_QTD.h \
|
||||
DlgRef_1Sel1Check_QTD.h \
|
||||
DlgRef_1Sel1Check1List_QTD.h \
|
||||
DlgRef_1Sel1Spin_QTD.h \
|
||||
DlgRef_1Sel2Spin_QTD.h \
|
||||
DlgRef_1Sel3Spin_QTD.h \
|
||||
@ -105,13 +109,19 @@ LIB_MOC = \
|
||||
# header files
|
||||
EXPORT_HEADERS= $(LIB_MOC)
|
||||
|
||||
LIB_CLIENT_IDL =
|
||||
LIB_CLIENT_IDL = SALOME_Exception.idl \
|
||||
GEOM_Gen.idl \
|
||||
GEOM_Shape.idl \
|
||||
SALOMEDS.idl \
|
||||
SALOMEDS_Attributes.idl \
|
||||
SALOME_ModuleCatalog.idl \
|
||||
SALOME_Component.idl \
|
||||
|
||||
LIB_SERVER_IDL =
|
||||
|
||||
# additionnal information to compil and link file
|
||||
CPPFLAGS += $(QT_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
|
||||
CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome
|
||||
LDFLAGS += -L${KERNEL_ROOT_DIR}/lib/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
|
||||
LDFLAGS += -lSalomeGUI -L${KERNEL_ROOT_DIR}/lib/salome
|
||||
|
||||
@CONCLUDE@
|
||||
|
141
src/DlgRef/UIFiles/DlgRef_1Sel1Check1List_QTD.ui
Normal file
141
src/DlgRef/UIFiles/DlgRef_1Sel1Check1List_QTD.ui
Normal file
@ -0,0 +1,141 @@
|
||||
<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
|
||||
<class>DlgRef_1Sel1Check1List_QTD</class>
|
||||
<widget class="QWidget">
|
||||
<property name="name">
|
||||
<cstring>DlgRef_1Sel1Check1List_QTD</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>129</width>
|
||||
<height>104</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="caption">
|
||||
<string>DlgRef_1Sel1Check1List_QTD</string>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QGroupBox" row="0" column="0">
|
||||
<property name="name">
|
||||
<cstring>GroupBox1</cstring>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string></string>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QLayoutWidget" row="0" column="0">
|
||||
<property name="name">
|
||||
<cstring>Layout1</cstring>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QRadioButton" row="2" column="0" rowspan="1" colspan="3">
|
||||
<property name="name">
|
||||
<cstring>CheckButton1</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" row="0" column="2">
|
||||
<property name="name">
|
||||
<cstring>LineEdit1</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" row="0" column="0">
|
||||
<property name="name">
|
||||
<cstring>TextLabel1</cstring>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>0</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TL1</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" row="0" column="1">
|
||||
<property name="name">
|
||||
<cstring>PushButton1</cstring>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>0</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QComboBox" row="1" column="2">
|
||||
<property name="name">
|
||||
<cstring>ComboBox1</cstring>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>7</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer row="3" column="2">
|
||||
<property name="name">
|
||||
<cstring>Spacer5</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</grid>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
<layoutdefaults spacing="6" margin="11"/>
|
||||
</UI>
|
128
src/DlgRef/UIFiles/DlgRef_1Sel1Check_QTD.ui
Normal file
128
src/DlgRef/UIFiles/DlgRef_1Sel1Check_QTD.ui
Normal file
@ -0,0 +1,128 @@
|
||||
<!DOCTYPE UI><UI version="3.0" stdsetdef="1">
|
||||
<class>DlgRef_1Sel1Check_QTD</class>
|
||||
<widget class="QWidget">
|
||||
<property name="name">
|
||||
<cstring>DlgRef_1Sel1Check_QTD</cstring>
|
||||
</property>
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>129</width>
|
||||
<height>76</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="caption">
|
||||
<string>DlgRef_1Sel1Check_QTD</string>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QGroupBox" row="0" column="0">
|
||||
<property name="name">
|
||||
<cstring>GroupBox1</cstring>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string></string>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>11</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QLayoutWidget" row="0" column="0">
|
||||
<property name="name">
|
||||
<cstring>Layout1</cstring>
|
||||
</property>
|
||||
<grid>
|
||||
<property name="name">
|
||||
<cstring>unnamed</cstring>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="spacing">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<widget class="QLabel" row="0" column="0">
|
||||
<property name="name">
|
||||
<cstring>TextLabel1</cstring>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>0</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>TL1</string>
|
||||
</property>
|
||||
</widget>
|
||||
<spacer row="2" column="2">
|
||||
<property name="name">
|
||||
<cstring>Spacer5</cstring>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>113</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
<widget class="QPushButton" row="0" column="1">
|
||||
<property name="name">
|
||||
<cstring>PushButton1</cstring>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy>
|
||||
<hsizetype>0</hsizetype>
|
||||
<vsizetype>0</vsizetype>
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLineEdit" row="0" column="2">
|
||||
<property name="name">
|
||||
<cstring>LineEdit1</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QRadioButton" row="1" column="0" rowspan="1" colspan="3">
|
||||
<property name="name">
|
||||
<cstring>CheckButton1</cstring>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string></string>
|
||||
</property>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
</grid>
|
||||
</widget>
|
||||
<layoutdefaults spacing="6" margin="11"/>
|
||||
</UI>
|
@ -3,23 +3,20 @@
|
||||
#uic -o DlgRef_Skeleton_QTD.h DlgRef_Skeleton_QTD.ui
|
||||
#uic -o DlgRef_Skeleton_QTD.cxx -impl DlgRef_Skeleton_QTD.h DlgRef_Skeleton_QTD.ui
|
||||
|
||||
#uic -o DlgRef_TopRef1_QTD.h DlgRef_TopRef1_QTD.ui
|
||||
#uic -o DlgRef_TopRef1_QTD.cxx -impl DlgRef_TopRef1_QTD.h DlgRef_TopRef1_QTD.ui
|
||||
|
||||
#uic -o DlgRef_TopRef2_QTD.h DlgRef_TopRef2_QTD.ui
|
||||
#uic -o DlgRef_TopRef2_QTD.cxx -impl DlgRef_TopRef2_QTD.h DlgRef_TopRef2_QTD.ui
|
||||
|
||||
#uic -o DlgRef_TopRef3_QTD.h DlgRef_TopRef3_QTD.ui
|
||||
#uic -o DlgRef_TopRef3_QTD.cxx -impl DlgRef_TopRef3_QTD.h DlgRef_TopRef3_QTD.ui
|
||||
|
||||
#uic -o DlgRef_1Sel_QTD.h DlgRef_1Sel_QTD.ui
|
||||
#uic -o DlgRef_1Sel_QTD.cxx -impl DlgRef_1Sel_QTD.h DlgRef_1Sel_QTD.ui
|
||||
|
||||
#uic -o DlgRef_1Sel1Check_QTD.h DlgRef_1Sel1Check_QTD.ui
|
||||
#uic -o DlgRef_1Sel1Check_QTD.cxx -impl DlgRef_1Sel1Check_QTD.h DlgRef_1Sel1Check_QTD.ui
|
||||
|
||||
uic -o DlgRef_1Sel1Check1List_QTD.h DlgRef_1Sel1Check1List_QTD.ui
|
||||
uic -o DlgRef_1Sel1Check1List_QTD.cxx -impl DlgRef_1Sel1Check1List_QTD.h DlgRef_1Sel1Check1List_QTD.ui
|
||||
|
||||
#uic -o DlgRef_1Sel1Spin_QTD.h DlgRef_1Sel1Spin_QTD.ui
|
||||
#uic -o DlgRef_1Sel1Spin_QTD.cxx -impl DlgRef_1Sel1Spin_QTD.h DlgRef_1Sel1Spin_QTD.ui
|
||||
|
||||
uic -o DlgRef_1Sel2Spin_QTD.h DlgRef_1Sel2Spin_QTD.ui
|
||||
uic -o DlgRef_1Sel2Spin_QTD.cxx -impl DlgRef_1Sel2Spin_QTD.h DlgRef_1Sel2Spin_QTD.ui
|
||||
#uic -o DlgRef_1Sel2Spin_QTD.h DlgRef_1Sel2Spin_QTD.ui
|
||||
#uic -o DlgRef_1Sel2Spin_QTD.cxx -impl DlgRef_1Sel2Spin_QTD.h DlgRef_1Sel2Spin_QTD.ui
|
||||
|
||||
#uic -o DlgRef_1Sel3Spin_QTD.h DlgRef_1Sel3Spin_QTD.ui
|
||||
#uic -o DlgRef_1Sel3Spin_QTD.cxx -impl DlgRef_1Sel3Spin_QTD.h DlgRef_1Sel3Spin_QTD.ui
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,195 +0,0 @@
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : GEOMBase_Context.h
|
||||
// Author : Damien COQUERET
|
||||
// Module : GEOM
|
||||
// $Header:
|
||||
|
||||
#ifndef GEOMBASE_CONTEXT_H
|
||||
#define GEOMBASE_CONTEXT_H
|
||||
|
||||
// SALOME Includes
|
||||
#include "QAD_Desktop.h"
|
||||
#include "QAD_Application.h"
|
||||
|
||||
#include "SALOME_Selection.h"
|
||||
#include "SALOMEGUI_QtCatchCorbaException.hxx"
|
||||
|
||||
#include "GEOM_InteractiveObject.hxx"
|
||||
#include "GEOM_AISShape.hxx"
|
||||
#include "GEOM_Actor.h"
|
||||
#include "GEOM_Sketcher.h"
|
||||
#include "GEOM_Client.hxx"
|
||||
#include "GEOM_ShapeTypeFilter.hxx"
|
||||
|
||||
// Open CASCADE Includes
|
||||
#include <AIS_ListOfInteractive.hxx>
|
||||
#include <gp_Pnt.hxx>
|
||||
#include <V3d_View.hxx>
|
||||
#include <Quantity_Color.hxx>
|
||||
#include <Precision.hxx>
|
||||
|
||||
// QT Includes
|
||||
#include <qapplication.h>
|
||||
|
||||
// IDL Headers
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(GEOM_Gen)
|
||||
#include CORBA_SERVER_HEADER(SALOMEDS)
|
||||
#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
|
||||
|
||||
|
||||
//=================================================================================
|
||||
//
|
||||
//=================================================================================
|
||||
enum {POINT_METHOD, CURRENT_SKETCH};
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// class : GEOMBase_Context
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class GEOMBase_Context : public QObject
|
||||
{
|
||||
Q_OBJECT /* for QT compatibility */
|
||||
|
||||
public :
|
||||
GEOMBase_Context();
|
||||
~GEOMBase_Context();
|
||||
|
||||
private :
|
||||
int myNbGeom; /* Unique name for a geom entity */
|
||||
int myState; /* Identify a method */
|
||||
|
||||
QAD_Desktop* myDesktop;
|
||||
QAD_Study* myActiveStudy;
|
||||
QDialog* myActiveDialogBox; /* Unique active dialog box */
|
||||
|
||||
GEOM::GEOM_Gen_var myComponentGeom;
|
||||
GEOM_Client myShapeReader;
|
||||
Standard_CString myFatherior;
|
||||
AIS_ListOfInteractive myListDisplayedObject;
|
||||
Quantity_Color myShadingColor;
|
||||
|
||||
Sketch mySketcher;
|
||||
|
||||
Handle(AIS_Shape) mySimulationShape; /* AIS shape used only during topo/geom simulations */
|
||||
vtkActorCollection* mySimulationActor; /* GEOM Actor used only during topo/geom simulations */
|
||||
|
||||
bool mySettings_AddInStudy;
|
||||
bool mySettings_Copy;
|
||||
|
||||
public :
|
||||
static GEOMBase_Context* GetOrCreateGeomGUI(QAD_Desktop* desktop);
|
||||
static GEOMBase_Context* GetGeomGUI();
|
||||
|
||||
static int GetIndex(const TopoDS_Shape& subshape, const TopoDS_Shape& shape, int ShapeType);
|
||||
static bool VertexToPoint(const TopoDS_Shape& S, gp_Pnt& P);
|
||||
static bool GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString& aTypeString);
|
||||
static bool LinearEdgeExtremities(const TopoDS_Shape& S, gp_Pnt& P1, gp_Pnt& P2);
|
||||
static gp_Pnt ConvertClickToPoint(Standard_Real x, Standard_Real y, Handle(V3d_View) aView);
|
||||
/* User dialog 1 parameter returned */
|
||||
static double Parameter(Standard_Boolean& res,
|
||||
const char* aValue1 = 0, const char* aTitle1 = 0,
|
||||
const char* aTitle = 0, const double bottom = -1E6,
|
||||
const double top = +1E6, const int decimals = 6);
|
||||
void GetBipointDxDyDz(gp_Pnt P1, gp_Pnt P2, double& dx, double& dy, double& dz);
|
||||
|
||||
int& GetNbGeom(){return myNbGeom;};
|
||||
int& GetState(){return myState;};
|
||||
QAD_Desktop* GetDesktop(){return myDesktop;};
|
||||
QAD_Study* GetActiveStudy(){return myActiveStudy;};
|
||||
QDialog* GetActiveDialogBox(){return myActiveDialogBox ;}; /* Returns the active DialogBox */
|
||||
|
||||
GEOM_Client& GetShapeReader(){return myShapeReader;};
|
||||
Standard_CString& GetFatherior(){return myFatherior;};
|
||||
AIS_ListOfInteractive& GetListDisplayedObject(){return myListDisplayedObject;};
|
||||
Quantity_Color& GetShadingColor(){return myShadingColor;};
|
||||
|
||||
Handle(AIS_Shape)& GetSimulationShape(){return mySimulationShape;};
|
||||
bool& GetSettings_AddInStudy(){return mySettings_AddInStudy;};
|
||||
bool& GetSettings_Copy(){return mySettings_Copy;};
|
||||
|
||||
Sketch& GetSketcher(){return mySketcher;};
|
||||
|
||||
void SetState(int aState);
|
||||
void ResetState(); /* Sets myState = -1 a private field to indicate wich method is active */
|
||||
bool AddInStudy(bool selection = false, const Handle(SALOME_InteractiveObject)& anIO = 0);
|
||||
void SetActiveDialogBox(QDialog* aDlg); /* Sets 'myActiveDialogBox' a pointer to the active Dialog Box */
|
||||
|
||||
bool DefineDlgPosition(QWidget* aDlg, int& x, int& y);
|
||||
bool SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* IOR);
|
||||
|
||||
/* Selection and objects management */
|
||||
TopoDS_Shape GetShapeFromIOR(QString IOR);
|
||||
bool GetTopoFromSelection(SALOME_Selection *Sel, TopoDS_Shape& tds);
|
||||
int GetNameOfSelectedIObjects(SALOME_Selection* Sel, QString& aName);
|
||||
GEOM::GEOM_Shape_ptr ConvertIOinGEOMShape(const Handle(SALOME_InteractiveObject)& IO,
|
||||
Standard_Boolean& testResult);
|
||||
Handle(GEOM_AISShape) ConvertIOinGEOMAISShape(const Handle(SALOME_InteractiveObject)& IO,
|
||||
Standard_Boolean& testResult,
|
||||
bool onlyInActiveView = false);
|
||||
Handle(GEOM_AISShape) ConvertIORinGEOMAISShape(const char * IOR,
|
||||
Standard_Boolean& testResult,
|
||||
bool onlyInActiveView = false);
|
||||
GEOM_Actor* ConvertIORinGEOMActor(const char * IOR, Standard_Boolean& testResult,
|
||||
bool onlyInActiveView = false);
|
||||
void ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList,
|
||||
GEOM::GEOM_Gen::ListOfIOR& listIOR);
|
||||
|
||||
/* Method used by dialog boxes called when used has entered a name of object in a LineEdit */
|
||||
bool SelectionByNameInDialogs(QWidget* aWidget, const QString& userObjectName, SALOME_Selection *Sel);
|
||||
|
||||
/* Method opening context for any sub shape selection */
|
||||
bool PrepareSubShapeSelection(const int SubShapeType, Standard_Integer& returnLocalContextId);
|
||||
/* Method opening context for sub shape selection on an argument shape */
|
||||
bool PrepareSubShapeSelectionArgumentShape(const TopoDS_Shape& aShape, const int SubShapeType,
|
||||
Standard_Integer& returnLocalContextId);
|
||||
/* Define a list of indices of sub shapes selected in a local context */
|
||||
bool GetIndexSubShapeSelected(const TopoDS_Shape& ShapeTopo, const int SubShapeType,
|
||||
GEOM::GEOM_Shape::ListOfSubShapeID& ListOfID,
|
||||
Standard_Integer& aLocalContextId, bool& myUseLocalContext);
|
||||
|
||||
void SetDisplayedObjectList();
|
||||
bool Display(GEOM::GEOM_Shape_ptr aShape, Standard_CString name = "");
|
||||
|
||||
/* Simulation management */
|
||||
bool CreateArrowForLinearEdge(const TopoDS_Shape& tds, TopoDS_Shape& ArrowCone);
|
||||
void DisplaySimulationShape(const TopoDS_Shape& S);
|
||||
void EraseSimulationShape();
|
||||
|
||||
/* Non modal dialog boxes magement */
|
||||
void EmitSignalDeactivateDialog();
|
||||
void EmitSignalCloseAllDialogs();
|
||||
void EmitSignalDefaultStepValueChanged(double newVal);
|
||||
|
||||
signals :
|
||||
void SignalDeactivateActiveDialog();
|
||||
void SignalCloseAllDialogs();
|
||||
void SignalDefaultStepValueChanged(double newVal);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,624 +0,0 @@
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : GEOMBase_Display.cxx
|
||||
// Author : Damien COQUERET
|
||||
// Module : GEOM
|
||||
// $Header:
|
||||
|
||||
using namespace std;
|
||||
#include "GEOMBase_Display.h"
|
||||
|
||||
#include "QAD_RightFrame.h"
|
||||
#include "GEOM_AssemblyBuilder.h"
|
||||
#include "VTKViewer_ViewFrame.h"
|
||||
#include "OCCViewer_ViewFrame.h"
|
||||
#include "OCCViewer_Viewer3d.h"
|
||||
|
||||
#include "SALOMEGUI_ImportOperation.h"
|
||||
#include "SALOME_ListIteratorOfListIO.hxx"
|
||||
#include <AIS_ListIteratorOfListOfInteractive.hxx>
|
||||
|
||||
//=======================================================================
|
||||
// function : DisplayGUI()
|
||||
// purpose : Constructor
|
||||
//=======================================================================
|
||||
GEOMBase_Display::GEOMBase_Display() :
|
||||
QObject()
|
||||
{
|
||||
myGeomGUI = GEOMBase_Context::GetGeomGUI();
|
||||
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
|
||||
myGeom = GEOM::GEOM_Gen::_narrow(comp);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : ~GEOMBase_Display()
|
||||
// purpose : Destructor
|
||||
//=======================================================================
|
||||
GEOMBase_Display::~GEOMBase_Display()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : OnGUIEvent()
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
bool GEOMBase_Display::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
||||
{
|
||||
switch (theCommandID)
|
||||
{
|
||||
case 211: // MENU VIEW - WIREFRAME/SHADING
|
||||
{
|
||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
|
||||
QApplication::setOverrideCursor(waitCursor);
|
||||
|
||||
VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
|
||||
|
||||
int themode = myRenderInter->GetDisplayMode();
|
||||
if(themode==0) {
|
||||
myRenderInter->SetDisplayMode(1);
|
||||
myGeomGUI->GetDesktop()->menuBar()->changeItem(211, tr("GEOM_MEN_WIREFRAME"));
|
||||
}
|
||||
else {
|
||||
myRenderInter->SetDisplayMode(0);
|
||||
myGeomGUI->GetDesktop()->menuBar()->changeItem(211, tr("GEOM_MEN_SHADING"));
|
||||
}
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
else if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
|
||||
QApplication::setOverrideCursor(Qt::waitCursor);
|
||||
|
||||
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
||||
Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
|
||||
AIS_DisplayMode mode = (AIS_DisplayMode)ic->DisplayMode();
|
||||
AIS_DisplayMode newmode = (mode == AIS_WireFrame ? AIS_Shaded : AIS_WireFrame);
|
||||
|
||||
AIS_ListOfInteractive List;
|
||||
ic->DisplayedObjects(List);
|
||||
AIS_ListOfInteractive List1;
|
||||
ic->ObjectsInCollector(List1);
|
||||
List.Append(List1);
|
||||
|
||||
AIS_ListIteratorOfListOfInteractive ite(List);
|
||||
while(ite.More()) {
|
||||
if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
|
||||
Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
|
||||
ic->SetDisplayMode(aSh,Standard_Integer(newmode),true);
|
||||
}
|
||||
ite.Next();
|
||||
}
|
||||
|
||||
ic->SetDisplayMode(newmode, Standard_False);
|
||||
if(newmode == 1)
|
||||
myGeomGUI->GetDesktop()->menuBar()->changeItem(211, tr("GEOM_MEN_WIREFRAME"));
|
||||
else
|
||||
myGeomGUI->GetDesktop()->menuBar()->changeItem(211, tr("GEOM_MEN_SHADING"));
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 212: // MENU VIEW - DISPLAY ALL
|
||||
{
|
||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK)
|
||||
((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->DisplayAll();
|
||||
else if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC)
|
||||
this->OnDisplayAll();
|
||||
break;
|
||||
}
|
||||
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)
|
||||
((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->EraseAll();
|
||||
else if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
|
||||
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
||||
Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
|
||||
|
||||
ic->EraseAll(Standard_True, Standard_False);
|
||||
ic->Display(v3d->getTrihedron());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 215: // MENU VIEW - ERASE ONLY
|
||||
{
|
||||
this->OnErase();
|
||||
break;
|
||||
}
|
||||
case 8031: // POPUP VIEWER - WIREFRAME/SHADING
|
||||
{
|
||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
|
||||
// VTK
|
||||
VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
|
||||
|
||||
SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection());
|
||||
SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
|
||||
|
||||
QApplication::setOverrideCursor(Qt::waitCursor);
|
||||
for(;It.More();It.Next()) {
|
||||
Handle(SALOME_InteractiveObject) IOS = It.Value();
|
||||
myRenderInter->SwitchRepresentation(IOS, false);
|
||||
}
|
||||
myRenderInter->Render();
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
else if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
|
||||
QApplication::setOverrideCursor(Qt::waitCursor);
|
||||
SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection());
|
||||
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
||||
Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
|
||||
SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
|
||||
for(;It.More();It.Next()) {
|
||||
Handle(SALOME_InteractiveObject) IObject = It.Value();
|
||||
Standard_Boolean found;
|
||||
Handle(GEOM_AISShape) Shape = myGeomGUI->ConvertIOinGEOMAISShape(IObject, found, true);
|
||||
if(!Shape.IsNull()) {
|
||||
AIS_DisplayMode mode = (AIS_DisplayMode)Shape->DisplayMode();
|
||||
if(mode == -1)
|
||||
mode = (AIS_DisplayMode)ic->DisplayMode();
|
||||
|
||||
QApplication::setOverrideCursor(Qt::waitCursor);
|
||||
ic->SetDisplayMode(Shape, mode == AIS_WireFrame ? AIS_Shaded : AIS_WireFrame, false);
|
||||
}
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
ic->UpdateCurrentViewer();
|
||||
}
|
||||
QApplication::restoreOverrideCursor();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//=====================================================================================
|
||||
// function : OnDisplayAll()
|
||||
// purpose :
|
||||
//=====================================================================================
|
||||
void GEOMBase_Display::OnDisplayAll(bool onlyPreviousDisplayedObject)
|
||||
{
|
||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
|
||||
return;
|
||||
|
||||
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
||||
Handle (AIS_InteractiveContext) myContext = v3d->getAISContext();
|
||||
|
||||
myContext->Display(v3d->getTrihedron());
|
||||
|
||||
if(!onlyPreviousDisplayedObject) {
|
||||
AIS_ListOfInteractive List1;
|
||||
myContext->ObjectsInCollector(List1);
|
||||
AIS_ListIteratorOfListOfInteractive ite1(List1);
|
||||
while(ite1.More()) {
|
||||
if(ite1.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
|
||||
Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite1.Value());
|
||||
if(aSh->hasIO()) {
|
||||
Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO());
|
||||
if(v3d->isInViewer(GIO, true)) {
|
||||
myContext->Display(aSh);
|
||||
}
|
||||
}
|
||||
}
|
||||
ite1.Next();
|
||||
}
|
||||
}
|
||||
else {
|
||||
AIS_ListIteratorOfListOfInteractive ite(myGeomGUI->GetListDisplayedObject());
|
||||
while(ite.More()) {
|
||||
if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
|
||||
Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
|
||||
if (aSh->hasIO()) {
|
||||
Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO());
|
||||
if (v3d->isInViewer(GIO,true)) {
|
||||
myContext->Display(aSh);
|
||||
}
|
||||
}
|
||||
}
|
||||
ite.Next();
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=====================================================================================
|
||||
// function : OnVTKDisplayOnly()
|
||||
// purpose :
|
||||
//=====================================================================================
|
||||
void GEOMBase_Display::OnVTKDisplayOnly()
|
||||
{
|
||||
QApplication::setOverrideCursor(Qt::waitCursor);
|
||||
|
||||
// Erase all not selected actors
|
||||
vtkRenderer* aren = ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
|
||||
vtkActorCollection* theActors = aren->GetActors();
|
||||
theActors->InitTraversal();
|
||||
vtkActor *ac = theActors->GetNextActor();
|
||||
while(!(ac==NULL)) {
|
||||
if(ac->IsA("SALOME_Actor")) {
|
||||
SALOME_Actor* anActor = SALOME_Actor::SafeDownCast(ac);
|
||||
if(!anActor->isHighlighted())
|
||||
anActor->VisibilityOff();
|
||||
}
|
||||
ac = theActors->GetNextActor();
|
||||
}
|
||||
|
||||
// Display selection
|
||||
SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument();
|
||||
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
|
||||
SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->entry());
|
||||
SALOMEDS::GenericAttribute_var anAttr;
|
||||
SALOMEDS::AttributeName_var aName;
|
||||
SALOMEDS::AttributeIOR_var anIOR;
|
||||
|
||||
SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection());
|
||||
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();
|
||||
|
||||
if(myRenderInter->isInViewer(IObject)) {
|
||||
myRenderInter->Display(IObject);
|
||||
}
|
||||
else {
|
||||
// Create new actor
|
||||
if(!obj->_is_nil()) {
|
||||
if(!obj->FindAttribute(anAttr, "AttributeIOR"))
|
||||
break;
|
||||
// If selected object contains displayable subobjects, then do nothing
|
||||
SALOMEDS::ChildIterator_var anIter = myGeomGUI->GetActiveStudy()->getStudyDocument()->NewChildIterator(obj);
|
||||
SALOMEDS::GenericAttribute_var aTmpAttr;
|
||||
|
||||
anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
|
||||
GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(anIOR->Value());
|
||||
if(CORBA::is_nil(aShape)) continue;
|
||||
TopoDS_Shape Shape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape);
|
||||
|
||||
if(obj->FindAttribute(anAttr, "AttributeName")) {
|
||||
aName = SALOMEDS::AttributeName::_narrow(anAttr);
|
||||
// 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();
|
||||
|
||||
vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
|
||||
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);
|
||||
GActor->setIO(IObject);
|
||||
GActor->setName(IObject->getName());
|
||||
|
||||
theRenderer->AddActor(GActor);
|
||||
vtkRenderWindow *renWin
|
||||
= ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer()->GetRenderWindow();
|
||||
renWin->Render();
|
||||
anActor = (vtkActor*)theActors->GetNextActor();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
myGeomGUI->GetActiveStudy()->updateObjBrowser(true);
|
||||
|
||||
QApplication::restoreOverrideCursor();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=====================================================================================
|
||||
// function : OnDisplayOnly()
|
||||
// purpose :
|
||||
//=====================================================================================
|
||||
void GEOMBase_Display::OnDisplayOnly()
|
||||
{
|
||||
if (myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
|
||||
return;
|
||||
|
||||
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
||||
SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument();
|
||||
Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
|
||||
|
||||
AIS_ListOfInteractive List;
|
||||
ic->DisplayedObjects(List);
|
||||
AIS_ListIteratorOfListOfInteractive ite(List);
|
||||
while(ite.More()) {
|
||||
if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
|
||||
Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
|
||||
if (!ic->IsSelected( aSh )) {
|
||||
ic->Erase(aSh, Standard_True, Standard_True);
|
||||
}
|
||||
}
|
||||
ite.Next();
|
||||
}
|
||||
|
||||
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
|
||||
SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection());
|
||||
|
||||
SALOME_ListIteratorOfListIO It1(Sel->StoredIObjects());
|
||||
for(;It1.More();It1.Next()) {
|
||||
Handle(SALOME_InteractiveObject) IObject = It1.Value();
|
||||
|
||||
SALOMEDS::SObject_var fatherSF =
|
||||
aStudy->FindObjectID(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->entry());
|
||||
if(v3d->isInViewer(IObject, true)) {
|
||||
AIS_ListOfInteractive List1;
|
||||
ic->ObjectsInCollector(List1);
|
||||
AIS_ListIteratorOfListOfInteractive ite1(List1);
|
||||
while(ite1.More()) {
|
||||
if(ite1.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
|
||||
Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite1.Value());
|
||||
if (aSh->hasIO()) {
|
||||
Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO());
|
||||
if (IObject->isSame(GIO)) {
|
||||
ic->Display(aSh);
|
||||
ic->AddOrRemoveCurrentObject(aSh, true);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
ite1.Next();
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (IObject->hasEntry()) {
|
||||
SALOMEDS::SObject_var obj = aStudy->FindObjectID(IObject->getEntry());
|
||||
SALOMEDS::GenericAttribute_var anAttr;
|
||||
SALOMEDS::AttributeName_var aName;
|
||||
SALOMEDS::AttributeIOR_var anIOR;
|
||||
if (!obj->_is_nil()) {
|
||||
if (obj->FindAttribute(anAttr, "AttributeIOR")) {
|
||||
// this SObject may be GEOM module root SObject
|
||||
|
||||
anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
|
||||
GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(anIOR->Value());
|
||||
if(CORBA::is_nil(aShape)) continue;
|
||||
TopoDS_Shape Shape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape);
|
||||
|
||||
if(obj->FindAttribute(anAttr, "AttributeName")) {
|
||||
aName = SALOMEDS::AttributeName::_narrow(anAttr);
|
||||
// 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());
|
||||
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);
|
||||
ic->AddOrRemoveCurrentObject(aSh, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//=====================================================================================
|
||||
// function : OnErase()
|
||||
// purpose :
|
||||
//=====================================================================================
|
||||
void GEOMBase_Display::OnErase()
|
||||
{
|
||||
SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument();
|
||||
SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection());
|
||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
|
||||
// VTK
|
||||
SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
|
||||
Handle(SALOME_InteractiveObject) anIObject;
|
||||
for(;It.More();It.Next()) {
|
||||
anIObject = It.Value();
|
||||
VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
|
||||
|
||||
if(myRenderInter->isInViewer(anIObject)) {
|
||||
myRenderInter->Erase(anIObject);
|
||||
}
|
||||
else {
|
||||
SALOMEDS::SObject_var obj = aStudy->FindObjectID(anIObject->getEntry());
|
||||
SALOMEDS::GenericAttribute_var anAttr;
|
||||
SALOMEDS::AttributeIOR_var anIOR;
|
||||
if(!obj->_is_nil()) {
|
||||
if(obj->FindAttribute(anAttr, "AttributeIOR")) {
|
||||
// this SObject may be GEOM module root SObject
|
||||
SALOMEDS::ChildIterator_var anIter = myGeomGUI->GetActiveStudy()->getStudyDocument()->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")) {
|
||||
// searchin for already displayed objects with the same shape
|
||||
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->Erase(anIObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
actor=(vtkActor*)(theAllActors->GetNextActor());
|
||||
}
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
|
||||
// OCC
|
||||
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
||||
Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
|
||||
SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
|
||||
Handle(SALOME_InteractiveObject) anIObject;
|
||||
for(;It.More();It.Next()) {
|
||||
anIObject = It.Value();
|
||||
if(v3d->isInViewer(anIObject, true)) {
|
||||
Standard_Boolean found;
|
||||
Handle(GEOM_AISShape) aSh = myGeomGUI->ConvertIOinGEOMAISShape(anIObject, found, true);
|
||||
if(found) {
|
||||
ic->Erase(aSh);
|
||||
ic->AddOrRemoveCurrentObject(aSh, true);
|
||||
}
|
||||
}
|
||||
else {
|
||||
SALOMEDS::SObject_var obj = aStudy->FindObjectID(anIObject->getEntry());
|
||||
SALOMEDS::GenericAttribute_var anAttr;
|
||||
SALOMEDS::AttributeIOR_var anIOR;
|
||||
if(!obj->_is_nil()) {
|
||||
if(obj->FindAttribute(anAttr, "AttributeIOR")) {
|
||||
// this SObject may be GEOM module root SObject
|
||||
SALOMEDS::ChildIterator_var anIter = myGeomGUI->GetActiveStudy()->getStudyDocument()->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")) {
|
||||
// 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->Erase(anAISShape);
|
||||
}
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Sel->ClearIObjects();
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : GEOMBase_Display.h
|
||||
// Author : Damien COQUERET
|
||||
// Module : GEOM
|
||||
// $Header:
|
||||
|
||||
#ifndef GEOMBASE_DISPLAY_H
|
||||
#define GEOMBASE_DISPLAY_H
|
||||
|
||||
#include "GEOMBase_Context.h"
|
||||
|
||||
//=================================================================================
|
||||
// class : GEOMBase_Display
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class GEOMBase_Display : public QObject
|
||||
{
|
||||
Q_OBJECT /* for QT compatibility */
|
||||
|
||||
public :
|
||||
GEOMBase_Display();
|
||||
~GEOMBase_Display();
|
||||
|
||||
bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
|
||||
|
||||
void OnDisplayAll(bool onlyPreviousDisplayedObject = false);
|
||||
void OnVTKDisplayOnly();
|
||||
void OnDisplayOnly();
|
||||
void OnErase();
|
||||
|
||||
private:
|
||||
GEOMBase_Context* myGeomGUI;
|
||||
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -1,134 +0,0 @@
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : GEOMBase_NbIsosDlg.cxx
|
||||
// Author :
|
||||
// Module : GEOM
|
||||
// $Header:
|
||||
|
||||
using namespace std;
|
||||
#include "GEOMBase_NbIsosDlg.h"
|
||||
#include "GEOMBase_Context.h"
|
||||
#include "QAD_Tools.h"
|
||||
|
||||
#include <qlabel.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qgroupbox.h>
|
||||
#include <qlayout.h>
|
||||
#include <qspinbox.h>
|
||||
|
||||
//=================================================================================
|
||||
// class : GEOMBase_NbIsosDlg()
|
||||
// purpose : Constructs a GEOMBase_NbIsosDlg which is a child of 'parent', with the
|
||||
// name 'name' and widget flags set to 'f'.
|
||||
// The dialog will by default be modeless, unless you set 'modal' to
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
GEOMBase_NbIsosDlg::GEOMBase_NbIsosDlg(QWidget* parent, const char* name, bool modal, WFlags fl)
|
||||
:QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
|
||||
{
|
||||
if( !name )
|
||||
setName("GEOMBase_NbIsosDlg");
|
||||
setCaption(name);
|
||||
setSizeGripEnabled(TRUE);
|
||||
QGridLayout* MyDialogLayout = new QGridLayout(this);
|
||||
MyDialogLayout->setSpacing(6);
|
||||
MyDialogLayout->setMargin(11);
|
||||
|
||||
/***************************************************************/
|
||||
QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" );
|
||||
GroupC1->setColumnLayout(0, Qt::Vertical );
|
||||
GroupC1->layout()->setSpacing( 0 );
|
||||
GroupC1->layout()->setMargin( 0 );
|
||||
QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
|
||||
GroupC1Layout->setAlignment( Qt::AlignTop );
|
||||
GroupC1Layout->setSpacing( 6 );
|
||||
GroupC1Layout->setMargin( 11 );
|
||||
|
||||
TextLabel1 = new QLabel( GroupC1, "TextLabel1" );
|
||||
TextLabel1->setText( tr( "GEOM_MEN_ISOU") );
|
||||
GroupC1Layout->addWidget( TextLabel1, 0, 0 );
|
||||
|
||||
SpinBoxU = new QSpinBox( GroupC1, "SpinBoxU" );
|
||||
SpinBoxU->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
|
||||
SpinBoxU->setMinValue( 1 );
|
||||
SpinBoxU->setValue( 1 );
|
||||
GroupC1Layout->addWidget( SpinBoxU, 0, 1 );
|
||||
|
||||
TextLabel2 = new QLabel( GroupC1, "TextLabel2" );
|
||||
TextLabel2->setText( tr( "GEOM_MEN_ISOV") ) ;
|
||||
GroupC1Layout->addWidget( TextLabel2, 0, 2 );
|
||||
|
||||
SpinBoxV = new QSpinBox( GroupC1, "SpinBoxV");
|
||||
SpinBoxV->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
|
||||
SpinBoxV->setValue( 1 );
|
||||
SpinBoxV->setMinValue( 1 );
|
||||
GroupC1Layout->addWidget( SpinBoxV, 0, 3 );
|
||||
|
||||
/***************************************************************/
|
||||
QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
|
||||
GroupButtons->setColumnLayout(0, Qt::Vertical );
|
||||
GroupButtons->layout()->setSpacing( 0 );
|
||||
GroupButtons->layout()->setMargin( 0 );
|
||||
QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
|
||||
GroupButtonsLayout->setAlignment( Qt::AlignTop );
|
||||
GroupButtonsLayout->setSpacing( 6 );
|
||||
GroupButtonsLayout->setMargin( 11 );
|
||||
|
||||
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
|
||||
buttonOk->setText( tr( "GEOM_BUT_OK" ) ) ;
|
||||
buttonOk->setAutoDefault( TRUE );
|
||||
buttonOk->setDefault( TRUE );
|
||||
GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
|
||||
|
||||
GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
|
||||
|
||||
buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
|
||||
buttonCancel->setText( tr( "GEOM_BUT_CANCEL" ) ) ;
|
||||
buttonCancel->setAutoDefault( TRUE );
|
||||
GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
|
||||
/***************************************************************/
|
||||
|
||||
MyDialogLayout->addWidget(GroupC1, 0, 0);
|
||||
MyDialogLayout->addWidget(GroupButtons, 1, 0);
|
||||
|
||||
/* Retrieve GeomGUI */
|
||||
myGeomGUI = GEOMBase_Context::GetGeomGUI();
|
||||
|
||||
// signals and slots connections
|
||||
connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept()));
|
||||
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
|
||||
|
||||
/* Move widget on the botton right corner of main widget */
|
||||
QAD_Tools::centerWidget(this, parent);
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ~GEOMBase_NbIsosDlg()
|
||||
// purpose : Destroys the object and frees any allocated resources
|
||||
//=================================================================================
|
||||
GEOMBase_NbIsosDlg::~GEOMBase_NbIsosDlg()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : GEOMBase_NbIsosDlg.h
|
||||
// Author :
|
||||
// Module : GEOM
|
||||
// $Header:
|
||||
|
||||
#ifndef GEOMBASE_NBISOSDLG_H
|
||||
#define GEOMBASE_NBISOSDLG_H
|
||||
|
||||
#include <qdialog.h>
|
||||
|
||||
class QLabel;
|
||||
class QSpinBox;
|
||||
class QPushButton;
|
||||
class GEOMBase_Context;
|
||||
|
||||
//=================================================================================
|
||||
// class : GEOMBase_NbIsosDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class GEOMBase_NbIsosDlg : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GEOMBase_NbIsosDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0);
|
||||
~GEOMBase_NbIsosDlg();
|
||||
|
||||
GEOMBase_Context* myGeomGUI; /* Current GeomGUI object */
|
||||
|
||||
QPushButton* buttonOk;
|
||||
QPushButton* buttonCancel;
|
||||
QLabel* TextLabel1;
|
||||
QLabel* TextLabel2;
|
||||
QSpinBox* SpinBoxU;
|
||||
QSpinBox* SpinBoxV;
|
||||
|
||||
};
|
||||
|
||||
#endif // GEOMETRYGUI_NBISOSDLG_H
|
@ -1,172 +0,0 @@
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : GEOMBase_Skeleton.cxx
|
||||
// Author : Damien COQUERET
|
||||
// Module : GEOM
|
||||
// $Header:
|
||||
|
||||
#include "GEOMBase_Skeleton.h"
|
||||
|
||||
//=================================================================================
|
||||
// class : GEOMBase_Skeleton()
|
||||
// purpose : Constructs a GEOMBase_Skeleton which is a child of 'parent', with the
|
||||
// name 'name' and widget flags set to 'f'.
|
||||
// The dialog will by default be modeless, unless you set 'modal' to
|
||||
// TRUE to construct a modal dialog.
|
||||
//=================================================================================
|
||||
GEOMBase_Skeleton::GEOMBase_Skeleton(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl)
|
||||
:DlgRef_Skeleton_QTD(parent, name, modal, fl)
|
||||
{
|
||||
if (!name)
|
||||
setName("GEOMBase_Skeleton");
|
||||
|
||||
buttonCancel->setText(tr("GEOM_BUT_CLOSE"));
|
||||
buttonOk->setText(tr("GEOM_BUT_OK"));
|
||||
buttonApply->setText(tr("GEOM_BUT_APPLY"));
|
||||
|
||||
GroupMedium->close(TRUE);
|
||||
resize(0, 0);
|
||||
|
||||
Init(Sel);
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ~GEOMBase_Skeleton()
|
||||
// purpose : Destroys the object and frees any allocated resources
|
||||
//=================================================================================
|
||||
GEOMBase_Skeleton::~GEOMBase_Skeleton()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
this->destroy(TRUE, TRUE);
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : Init()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GEOMBase_Skeleton::Init(SALOME_Selection* Sel)
|
||||
{
|
||||
/* init variables */
|
||||
mySelection = Sel;
|
||||
mySimulationTopoDs.Nullify();
|
||||
|
||||
myGeomGUI = GEOMBase_Context::GetGeomGUI();
|
||||
myGeomGUI->SetActiveDialogBox((QDialog*)this);
|
||||
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
|
||||
myGeom = GEOM::GEOM_Gen::_narrow(comp);
|
||||
|
||||
/* signals and slots connections */
|
||||
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
|
||||
connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog()));
|
||||
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 );
|
||||
|
||||
/* displays Dialog */
|
||||
RadioButton1->setChecked(TRUE);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ClickOnCancel()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GEOMBase_Skeleton::ClickOnCancel()
|
||||
{
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
mySimulationTopoDs.Nullify();
|
||||
|
||||
mySelection->ClearFilters();
|
||||
disconnect(mySelection, 0, this, 0);
|
||||
|
||||
myGeomGUI->ResetState();
|
||||
reject();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : LineEditReturnPressed()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GEOMBase_Skeleton::LineEditReturnPressed()
|
||||
{
|
||||
/* 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 : DeactivateActiveDialog()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GEOMBase_Skeleton::DeactivateActiveDialog()
|
||||
{
|
||||
this->setEnabled(false);
|
||||
mySelection->ClearFilters();
|
||||
disconnect(mySelection, 0, this, 0);
|
||||
myGeomGUI->EraseSimulationShape();
|
||||
myGeomGUI->SetActiveDialogBox(0);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ActivateThisDialog()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GEOMBase_Skeleton::ActivateThisDialog()
|
||||
{
|
||||
/* Emit a signal to deactivate the active dialog */
|
||||
myGeomGUI->EmitSignalDeactivateDialog();
|
||||
this->setEnabled(true);
|
||||
myGeomGUI->SetActiveDialogBox((QDialog*)this);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : closeEvent()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
void GEOMBase_Skeleton::closeEvent(QCloseEvent* e)
|
||||
{
|
||||
/* same than click on cancel button */
|
||||
this->ClickOnCancel();
|
||||
return;
|
||||
}
|
@ -1,71 +0,0 @@
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : GEOMBase_Skeleton.h
|
||||
// Author : Damine COQUERET
|
||||
// Module : GEOM
|
||||
// $Header:
|
||||
|
||||
#ifndef GEOMBASE_SKELETON_H
|
||||
#define GEOMBASE_SKELETON_H
|
||||
|
||||
#include "DlgRef_Skeleton_QTD.h"
|
||||
|
||||
#include "GEOMBase_Context.h"
|
||||
|
||||
#include <qwidget.h>
|
||||
#include <qgroupbox.h>
|
||||
#include <qlineedit.h>
|
||||
#include <qlayout.h>
|
||||
#include <qradiobutton.h>
|
||||
#include <qbuttongroup.h>
|
||||
|
||||
class GEOMBase_Skeleton : public DlgRef_Skeleton_QTD
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GEOMBase_Skeleton(QWidget* parent = 0, const char* name = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0);
|
||||
~GEOMBase_Skeleton();
|
||||
|
||||
private :
|
||||
void Init(SALOME_Selection* Sel);
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent* e);
|
||||
|
||||
TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */
|
||||
QLineEdit* myEditCurrentArgument; /* Current LineEdit */
|
||||
SALOME_Selection* mySelection; /* User shape selection */
|
||||
GEOM::GEOM_Gen_var myGeom; /* Current GeomI object */
|
||||
GEOMBase_Context* myGeomGUI; /* Current GeomGUI object */
|
||||
|
||||
protected slots:
|
||||
void ClickOnCancel();
|
||||
void LineEditReturnPressed();
|
||||
void DeactivateActiveDialog();
|
||||
void ActivateThisDialog();
|
||||
|
||||
};
|
||||
|
||||
#endif // GEOMBASE_SKELETON_H
|
@ -1,487 +0,0 @@
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : GEOMBase_Sketcher.cxx
|
||||
// Author : Damien COQUERET
|
||||
// Module : GEOM
|
||||
// $Header:
|
||||
|
||||
using namespace std;
|
||||
#include "GEOMBase_Sketcher.h"
|
||||
|
||||
#include "QAD_RightFrame.h"
|
||||
#include "OCCViewer_Viewer3d.h"
|
||||
|
||||
#include <BRepTools_WireExplorer.hxx>
|
||||
#include <TopoDS_Wire.hxx>
|
||||
#include <BRep_Tool.hxx>
|
||||
#include <TopExp.hxx>
|
||||
#include <Geom_Circle.hxx>
|
||||
|
||||
//=======================================================================
|
||||
// function : GEOMBase_Sketcher()
|
||||
// purpose : Constructor
|
||||
//=======================================================================
|
||||
GEOMBase_Sketcher::GEOMBase_Sketcher() :
|
||||
QObject()
|
||||
{
|
||||
myGeomGUI = GEOMBase_Context::GetGeomGUI();
|
||||
Engines::Component_var comp = myGeomGUI->GetDesktop()->getEngine("FactoryServer", "GEOM");
|
||||
myGeom = GEOM::GEOM_Gen::_narrow(comp);
|
||||
mySketcher = myGeomGUI->GetSketcher();
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : ~GEOMBase_Sketcher()
|
||||
// purpose : Destructor
|
||||
//=======================================================================
|
||||
GEOMBase_Sketcher::~GEOMBase_Sketcher()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : OnGUIEvent()
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
bool GEOMBase_Sketcher::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
||||
{
|
||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
|
||||
return false;
|
||||
|
||||
myGeomGUI->EmitSignalDeactivateDialog();
|
||||
SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection());
|
||||
|
||||
QMenuBar* Mb = myGeomGUI->GetDesktop()->getMainMenuBar();
|
||||
QMenuData* pp;
|
||||
|
||||
switch (theCommandID)
|
||||
{
|
||||
case 404: // SKETCHER
|
||||
{
|
||||
((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->onViewTop(); // DCQ : 28/02/2002
|
||||
|
||||
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
||||
|
||||
mySketcher = Sketch(v3d->getViewer3d());
|
||||
myGeomGUI->SetState(CURRENT_SKETCH);
|
||||
|
||||
QMenuItem* item = Mb->findItem(4061, &pp);
|
||||
mySketcher.SetParameterVisibility(LENGTH_PARAMETER, pp->isItemChecked(4061));
|
||||
item = Mb->findItem(4062, &pp);
|
||||
mySketcher.SetParameterVisibility(ANGLE_PARAMETER, pp->isItemChecked(4062));
|
||||
item = Mb->findItem(4063, &pp);
|
||||
mySketcher.SetParameterVisibility(RADIUS_PARAMETER, pp->isItemChecked(4063));
|
||||
item = Mb->findItem(4064, &pp);
|
||||
mySketcher.SetParameterVisibility(XVALUE_PARAMETER, pp->isItemChecked(4064));
|
||||
item = Mb->findItem(4065, &pp);
|
||||
mySketcher.SetParameterVisibility(YVALUE_PARAMETER, pp->isItemChecked(4065));
|
||||
|
||||
mySketcher.SetTransitionStatus(NOCONSTRAINT);
|
||||
item = Mb->findItem(4052, &pp);
|
||||
pp->setItemChecked(4052, false);
|
||||
item = Mb->findItem(4053, &pp);
|
||||
pp->setItemChecked(4053, false);
|
||||
break;
|
||||
}
|
||||
case 4041: // SKETCH Segment
|
||||
{
|
||||
mySketcher.ChangeMode(SEGMENT);
|
||||
break;
|
||||
}
|
||||
case 4042: // SKETCH Arc
|
||||
{
|
||||
mySketcher.ChangeMode(ARC_CHORD);
|
||||
break;
|
||||
}
|
||||
case 4043: // SKETCH Set Angle
|
||||
{
|
||||
OnSketchSetAngle();
|
||||
break;
|
||||
}
|
||||
case 4044: // SKETCH Set X
|
||||
{
|
||||
OnSketchSetx();
|
||||
break;
|
||||
}
|
||||
case 4045: // SKETCH Set Y
|
||||
{
|
||||
OnSketchSety();
|
||||
break;
|
||||
}
|
||||
case 4046: // SKETCH Delete
|
||||
{
|
||||
OnSketchDelete();
|
||||
break;
|
||||
}
|
||||
case 4047: // SKETCH End
|
||||
{
|
||||
OnSketchEnd();
|
||||
break;
|
||||
}
|
||||
case 4048: // SKETCH Close
|
||||
{
|
||||
OnSketchClose();
|
||||
break;
|
||||
}
|
||||
case 4051: // sketcher Set Plane
|
||||
{
|
||||
//TO DO
|
||||
break;
|
||||
}
|
||||
case 4052: // sketcher TANGENT
|
||||
{
|
||||
QMenuItem* item = Mb->findItem(theCommandID, &pp);
|
||||
pp->setItemChecked(theCommandID, !pp->isItemChecked(theCommandID));
|
||||
if(pp->isItemChecked(theCommandID) == true)
|
||||
mySketcher.SetTransitionStatus(TANGENT);
|
||||
else
|
||||
mySketcher.SetTransitionStatus(NOCONSTRAINT);
|
||||
|
||||
pp->setItemChecked(4053, false);
|
||||
break;
|
||||
}
|
||||
case 4053: // sketcher PERPENDICULAR
|
||||
{
|
||||
QMenuItem* item = Mb->findItem(theCommandID, &pp);
|
||||
pp->setItemChecked(theCommandID,!pp->isItemChecked(theCommandID));
|
||||
if(pp->isItemChecked(theCommandID) == true)
|
||||
mySketcher.SetTransitionStatus(PERPENDICULAR);
|
||||
else
|
||||
mySketcher.SetTransitionStatus(NOCONSTRAINT);
|
||||
|
||||
pp->setItemChecked(4052, false);
|
||||
break;
|
||||
}
|
||||
case 4061: // SKETCH OptionsOnofflengthdimension
|
||||
{
|
||||
QMenuItem* item = Mb->findItem(theCommandID, &pp);
|
||||
pp->setItemChecked(theCommandID, !pp->isItemChecked(theCommandID));
|
||||
mySketcher.SetParameterVisibility(LENGTH_PARAMETER, pp->isItemChecked(theCommandID));
|
||||
break;
|
||||
}
|
||||
case 4062: // SKETCH OptionsOnoffangledimension
|
||||
{
|
||||
QMenuItem* item = Mb->findItem(theCommandID, &pp);
|
||||
pp->setItemChecked(theCommandID, !pp->isItemChecked(theCommandID));
|
||||
mySketcher.SetParameterVisibility(ANGLE_PARAMETER, pp->isItemChecked(theCommandID));
|
||||
break;
|
||||
}
|
||||
case 4063: // SKETCH OptionsOnoffradiusdimension
|
||||
{
|
||||
QMenuItem* item = Mb->findItem(theCommandID, &pp);
|
||||
pp->setItemChecked(theCommandID, !pp->isItemChecked(theCommandID));
|
||||
mySketcher.SetParameterVisibility(RADIUS_PARAMETER, pp->isItemChecked(theCommandID));
|
||||
break;
|
||||
}
|
||||
case 4064: // SKETCH OptionsOnoffxdimension
|
||||
{
|
||||
QMenuItem* item = Mb->findItem(theCommandID, &pp);
|
||||
pp->setItemChecked(theCommandID, !pp->isItemChecked(theCommandID));
|
||||
mySketcher.SetParameterVisibility(XVALUE_PARAMETER, pp->isItemChecked(theCommandID));
|
||||
break;
|
||||
}
|
||||
case 4065: // SKETCH OptionsOnoffydimension
|
||||
{
|
||||
QMenuItem* item = Mb->findItem(theCommandID, &pp);
|
||||
pp->setItemChecked(theCommandID, !pp->isItemChecked(theCommandID));
|
||||
mySketcher.SetParameterVisibility(YVALUE_PARAMETER, pp->isItemChecked(theCommandID));
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : OnSketchSetAngle()
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void GEOMBase_Sketcher::OnSketchSetAngle()
|
||||
{
|
||||
Standard_Real anAngle = mySketcher.GetSegmentAngle()/PI180;
|
||||
Sketch::fitInResol(anAngle);
|
||||
Standard_Boolean res = false;
|
||||
QString Value = QString("%1").arg(anAngle);
|
||||
anAngle = myGeomGUI->Parameter(res, Value, tr("GEOM_MEN_ANGLE"), tr("GEOM_MEN_ENTER_ANGLE"),
|
||||
-180.0, +180.0, 6) * PI180;
|
||||
|
||||
if(res) {
|
||||
mySketcher.SetSegmentAngle(anAngle);
|
||||
QMenuBar* Mb = myGeomGUI->GetDesktop()->getMainMenuBar();
|
||||
QMenuData* pp;
|
||||
QMenuItem* item = Mb->findItem(4052, &pp);
|
||||
pp->setItemChecked(4052, false);
|
||||
item = Mb->findItem(4053, &pp);
|
||||
pp->setItemChecked(4053, false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : OnSketchSetx()
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void GEOMBase_Sketcher::OnSketchSetx()
|
||||
{
|
||||
Standard_Boolean res = false;
|
||||
double X = myGeomGUI->Parameter(res, "0.", tr("GEOM_MEN_X"), tr("GEOM_MEN_SKETCHER_X"),
|
||||
2.0 * Precision::Confusion(), 1E6, 6);
|
||||
if(res)
|
||||
mySketcher.SetXDimension(X);
|
||||
QMenuBar* Mb = myGeomGUI->GetDesktop()->getMainMenuBar();
|
||||
QMenuData* pp;
|
||||
QMenuItem* item = Mb->findItem(4052, &pp);
|
||||
pp->setItemChecked(4052, false);
|
||||
item = Mb->findItem(4053, &pp);
|
||||
pp->setItemChecked(4053, false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : OnSketchSety()
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void GEOMBase_Sketcher::OnSketchSety()
|
||||
{
|
||||
Standard_Boolean res = false;
|
||||
double Y = myGeomGUI->Parameter(res, "0.", tr("GEOM_MEN_Y"), tr("GEOM_MEN_SKETCHER_Y"),
|
||||
2.0 * Precision::Confusion(), 1E6, 6);
|
||||
if(res)
|
||||
mySketcher.SetYDimension(Y);
|
||||
QMenuBar* Mb = myGeomGUI->GetDesktop()->getMainMenuBar();
|
||||
QMenuData* pp;
|
||||
QMenuItem* item = Mb->findItem(4052, &pp);
|
||||
pp->setItemChecked(4052, false);
|
||||
item = Mb->findItem(4053, &pp);
|
||||
pp->setItemChecked(4053, false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : OnSketchDelete()
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void GEOMBase_Sketcher::OnSketchDelete()
|
||||
{
|
||||
if(mySketcher.GetmyEdgesNumber() == 1) {
|
||||
QMenuBar* Mb = myGeomGUI->GetDesktop()->getMainMenuBar();
|
||||
QMenuData* pp;
|
||||
QMenuItem* item = Mb->findItem(406, &pp);
|
||||
pp->setItemEnabled(406, false); // SKETCH CONTRAINTS
|
||||
mySketcher.SetTransitionStatus(NOCONSTRAINT);
|
||||
}
|
||||
|
||||
if(mySketcher.Delete())
|
||||
myGeomGUI->ResetState();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : OnSketchClose()
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void GEOMBase_Sketcher::OnSketchClose()
|
||||
{
|
||||
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
||||
Handle(AIS_InteractiveContext) myContext = v3d->getAISContext();
|
||||
|
||||
TopoDS_Wire W = mySketcher.Close();
|
||||
if(!W.IsNull()) {
|
||||
GEOM::GEOM_Gen::ListOfIOR_var listShapes = new GEOM::GEOM_Gen::ListOfIOR;
|
||||
listShapes->length(0);
|
||||
unsigned int i = 0;
|
||||
|
||||
BRepTools_WireExplorer Ex(W);
|
||||
while(Ex.More()) {
|
||||
TopoDS_Edge E = Ex.Current();
|
||||
gp_Pnt pt1, pt2;
|
||||
|
||||
pt1 = BRep_Tool::Pnt(TopExp::FirstVertex(E));
|
||||
pt2 = BRep_Tool::Pnt(TopExp::LastVertex(E));
|
||||
|
||||
gp_Pnt CenterPoint;
|
||||
Handle(Geom_Curve) Curve;
|
||||
Handle(Geom_Circle) Circle;
|
||||
gp_Circ Circ;
|
||||
Standard_Real First,Last;
|
||||
|
||||
Curve = BRep_Tool::Curve(E,First,Last);
|
||||
if(Curve->IsKind(STANDARD_TYPE(Geom_Circle))) {
|
||||
Circle = Handle(Geom_Circle)::DownCast(Curve); // pointer on geom_circ
|
||||
Circ = Circle->Circ(); // gp_Circ
|
||||
|
||||
Curve->D0((First + Last) / 2., CenterPoint);
|
||||
|
||||
GEOM::PointStruct pI = myGeom->MakePointStruct(pt1.X(), pt1.Y(), pt1.Z());
|
||||
GEOM::PointStruct pC = myGeom->MakePointStruct(CenterPoint.X(), CenterPoint.Y(), CenterPoint.Z());
|
||||
GEOM::PointStruct pE = myGeom->MakePointStruct(pt2.X(), pt2.Y(), pt2.Z());
|
||||
|
||||
GEOM::GEOM_Shape_var arc;
|
||||
|
||||
try {
|
||||
arc = myGeom->MakeArc(pI, pC, pE);
|
||||
}
|
||||
catch (const SALOME::SALOME_Exception& S_ex) {
|
||||
QtCatchCorbaException(S_ex);
|
||||
}
|
||||
|
||||
listShapes->length(i+1);
|
||||
listShapes[i] = strdup(arc->Name());
|
||||
i++;
|
||||
}
|
||||
else {
|
||||
GEOM::PointStruct pI = myGeom->MakePointStruct(pt1.X(), pt1.Y(), pt1.Z());
|
||||
GEOM::PointStruct pE = myGeom->MakePointStruct(pt2.X(), pt2.Y(), pt2.Z());
|
||||
GEOM::GEOM_Shape_var segment;
|
||||
|
||||
try {
|
||||
segment = myGeom->MakeEdge(pI,pE);
|
||||
}
|
||||
catch (const SALOME::SALOME_Exception& S_ex) {
|
||||
QtCatchCorbaException(S_ex);
|
||||
}
|
||||
|
||||
listShapes->length(i+1);
|
||||
listShapes[i] = strdup(segment->Name());
|
||||
i++;
|
||||
}
|
||||
Ex.Next();
|
||||
}
|
||||
GEOM::GEOM_Shape_var Wire = myGeom->MakeWire(listShapes);
|
||||
TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, Wire);
|
||||
Standard_CString type;
|
||||
myGeomGUI->GetShapeTypeString(S,type);
|
||||
Wire->NameType(type);
|
||||
|
||||
if(myGeomGUI->Display(Wire))
|
||||
QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
|
||||
}
|
||||
myGeomGUI->ResetState();
|
||||
QMenuBar* Mb = myGeomGUI->GetDesktop()->getMainMenuBar();
|
||||
QMenuData* pp;
|
||||
QMenuItem* item = Mb->findItem(406, &pp);
|
||||
pp->setItemEnabled(406, false); // SKETCH CONTRAINTS
|
||||
mySketcher.SetTransitionStatus(NOCONSTRAINT);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : OnSketchEnd()
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void GEOMBase_Sketcher::OnSketchEnd()
|
||||
{
|
||||
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
||||
Handle (AIS_InteractiveContext) myContext = v3d->getAISContext();
|
||||
|
||||
TopoDS_Wire W = mySketcher.End();
|
||||
if(!W.IsNull()) {
|
||||
GEOM::GEOM_Gen::ListOfIOR_var listShapes = new GEOM::GEOM_Gen::ListOfIOR;
|
||||
listShapes->length(0);
|
||||
unsigned int i = 0;
|
||||
|
||||
BRepTools_WireExplorer Ex(W);
|
||||
while(Ex.More()) {
|
||||
TopoDS_Edge E = TopoDS::Edge(Ex.Current());
|
||||
|
||||
gp_Pnt pt1, pt2;
|
||||
pt1 = BRep_Tool::Pnt(TopExp::FirstVertex(E));
|
||||
pt2 = BRep_Tool::Pnt(TopExp::LastVertex(E));
|
||||
|
||||
gp_Pnt CenterPoint;
|
||||
Handle(Geom_Curve) Curve;
|
||||
Handle(Geom_Circle) Circle;
|
||||
gp_Circ Circ;
|
||||
Standard_Real First,Last;
|
||||
|
||||
Curve = BRep_Tool::Curve(E,First,Last);
|
||||
if(Curve->IsKind(STANDARD_TYPE(Geom_Circle))) {
|
||||
Circle = Handle(Geom_Circle)::DownCast(Curve); // pointer on geom_circ
|
||||
Circ = Circle->Circ(); // gp_Circ
|
||||
|
||||
Curve->D0((First + Last) / 2., CenterPoint);
|
||||
|
||||
GEOM::PointStruct pI = myGeom->MakePointStruct(pt1.X(), pt1.Y(), pt1.Z());
|
||||
GEOM::PointStruct pC = myGeom->MakePointStruct(CenterPoint.X(), CenterPoint.Y(), CenterPoint.Z());
|
||||
GEOM::PointStruct pE = myGeom->MakePointStruct(pt2.X(), pt2.Y(), pt2.Z());
|
||||
|
||||
GEOM::GEOM_Shape_var arc;
|
||||
|
||||
try {
|
||||
arc = myGeom->MakeArc(pI, pC, pE);
|
||||
}
|
||||
catch (const SALOME::SALOME_Exception& S_ex) {
|
||||
QtCatchCorbaException(S_ex);
|
||||
}
|
||||
|
||||
listShapes->length(i+1);
|
||||
listShapes[i] = strdup(arc->Name());
|
||||
i++;
|
||||
} else {
|
||||
GEOM::PointStruct pI = myGeom->MakePointStruct(pt1.X(), pt1.Y(), pt1.Z());
|
||||
GEOM::PointStruct pE = myGeom->MakePointStruct(pt2.X(), pt2.Y(), pt2.Z());
|
||||
GEOM::GEOM_Shape_var segment;
|
||||
|
||||
try {
|
||||
segment = myGeom->MakeEdge(pI,pE);
|
||||
}
|
||||
catch (const SALOME::SALOME_Exception& S_ex) {
|
||||
QtCatchCorbaException(S_ex);
|
||||
}
|
||||
|
||||
listShapes->length(i+1);
|
||||
listShapes[i] = strdup(segment->Name());
|
||||
i++;
|
||||
}
|
||||
Ex.Next();
|
||||
}
|
||||
|
||||
GEOM::GEOM_Shape_var Wire = myGeom->MakeWire(listShapes);
|
||||
TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, Wire);
|
||||
Standard_CString type;
|
||||
myGeomGUI->GetShapeTypeString(S,type);
|
||||
Wire->NameType(type);
|
||||
|
||||
if(myGeomGUI->Display(Wire))
|
||||
QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
|
||||
}
|
||||
myGeomGUI->ResetState();
|
||||
QMenuBar* Mb = myGeomGUI->GetDesktop()->getMainMenuBar();
|
||||
QMenuData* pp;
|
||||
QMenuItem* item = Mb->findItem(406, &pp);
|
||||
pp->setItemEnabled(406, false); // SKETCH CONTRAINTS
|
||||
mySketcher.SetTransitionStatus(NOCONSTRAINT);
|
||||
return;
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : GEOMBase_Sketcher.h
|
||||
// Author : Damien COQUERET
|
||||
// Module : GEOM
|
||||
// $Header:
|
||||
|
||||
#ifndef GEOMBASE_SKETCHER_H
|
||||
#define GEOMBASE_SKETCHER_H
|
||||
|
||||
#include "GEOMBase_Context.h"
|
||||
|
||||
//=================================================================================
|
||||
// class : GEOMBase_Sketcher
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class GEOMBase_Sketcher : public QObject
|
||||
{
|
||||
Q_OBJECT /* for QT compatibility */
|
||||
|
||||
public :
|
||||
GEOMBase_Sketcher();
|
||||
~GEOMBase_Sketcher();
|
||||
|
||||
bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
|
||||
|
||||
/* Sketcher management */
|
||||
void OnSketchSetAngle();
|
||||
void OnSketchSetx();
|
||||
void OnSketchSety();
|
||||
|
||||
void OnSketchDelete();
|
||||
void OnSketchClose();
|
||||
void OnSketchEnd();
|
||||
|
||||
private:
|
||||
GEOMBase_Context* myGeomGUI;
|
||||
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
|
||||
Sketch mySketcher;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -1,894 +0,0 @@
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : GEOMBase_Tools.cxx
|
||||
// Author : Damien COQUERET
|
||||
// Module : GEOM
|
||||
// $Header:
|
||||
|
||||
using namespace std;
|
||||
#include "GEOMBase_Tools.h"
|
||||
|
||||
#include "QAD_Config.h"
|
||||
#include "QAD_FileDlg.h"
|
||||
#include "QAD_Tools.h"
|
||||
#include "QAD_MessageBox.h"
|
||||
#include "QAD_RightFrame.h"
|
||||
|
||||
#include "OCCViewer_Viewer3d.h"
|
||||
#include "VTKViewer_ViewFrame.h"
|
||||
|
||||
#include "SALOME_ListIteratorOfListIO.hxx"
|
||||
#include "SALOMEGUI_NameDlg.h"
|
||||
#include "SALOMEGUI_ImportOperation.h"
|
||||
|
||||
#include <AIS_Drawer.hxx>
|
||||
#include <AIS_ListIteratorOfListOfInteractive.hxx>
|
||||
#include <Prs3d_IsoAspect.hxx>
|
||||
|
||||
#include <qcolordialog.h>
|
||||
#include <qspinbox.h>
|
||||
|
||||
#include "GEOMBase_NbIsosDlg.h" // Method ISOS adjustement
|
||||
#include "GEOMBase_TransparencyDlg.h" // Method TRANSPARENCY adjustement
|
||||
|
||||
//=======================================================================
|
||||
// function : GEOMBase_Tools()
|
||||
// purpose : Constructor
|
||||
//=======================================================================
|
||||
GEOMBase_Tools::GEOMBase_Tools() :
|
||||
QObject()
|
||||
{
|
||||
myGeomGUI = GEOMBase_Context::GetGeomGUI();
|
||||
Engines::Component_var comp = myGeomGUI->GetDesktop()->getEngine("FactoryServer", "GEOM");
|
||||
myGeom = GEOM::GEOM_Gen::_narrow(comp);
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : ~GEOMBase_Tools()
|
||||
// purpose : Destructor
|
||||
//=======================================================================
|
||||
GEOMBase_Tools::~GEOMBase_Tools()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : OnGUIEvent()
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
bool GEOMBase_Tools::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
|
||||
{
|
||||
myGeomGUI->EmitSignalDeactivateDialog();
|
||||
SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection());
|
||||
|
||||
SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument();
|
||||
|
||||
switch (theCommandID)
|
||||
{
|
||||
case 31: // COPY
|
||||
{
|
||||
this->OnEditCopy();
|
||||
break;
|
||||
}
|
||||
case 33: // DELETE
|
||||
{
|
||||
this->OnEditDelete();
|
||||
break;
|
||||
}
|
||||
case 111: // IMPORT BREP
|
||||
{
|
||||
myGeomGUI->SetState(111);
|
||||
this->Import();
|
||||
myGeomGUI->ResetState();
|
||||
break;
|
||||
}
|
||||
case 112: // IMPORT IGES
|
||||
{
|
||||
myGeomGUI->SetState(112);
|
||||
this->Import();
|
||||
myGeomGUI->ResetState();
|
||||
break;
|
||||
}
|
||||
case 113: // IMPORT STEP
|
||||
{
|
||||
myGeomGUI->SetState(113);
|
||||
this->Import();
|
||||
myGeomGUI->ResetState();
|
||||
break;
|
||||
}
|
||||
case 121: // EXPORT BREP
|
||||
{
|
||||
myGeomGUI->SetState(121);
|
||||
this->Export();
|
||||
myGeomGUI->ResetState();
|
||||
break;
|
||||
}
|
||||
case 122: // EXPORT IGES
|
||||
{
|
||||
myGeomGUI->SetState(122);
|
||||
this->Export();
|
||||
myGeomGUI->ResetState();
|
||||
break;
|
||||
}
|
||||
case 123: // EXPORT STEP
|
||||
{
|
||||
myGeomGUI->SetState(123);
|
||||
this->Export();
|
||||
myGeomGUI->ResetState();
|
||||
break;
|
||||
}
|
||||
case 411: // SETTINGS - COPY
|
||||
{
|
||||
QMenuBar* Mb = myGeomGUI->GetDesktop()->getMainMenuBar();
|
||||
QMenuData* pp;
|
||||
QMenuItem* item = parent->menuBar()->findItem(411, &pp);
|
||||
bool check = !pp->isItemChecked(411);
|
||||
pp->setItemChecked(411, check);
|
||||
myGeomGUI->GetSettings_Copy() = check;
|
||||
QAD_CONFIG->addSetting("Geometry:SettingsCopy", myGeomGUI->GetSettings_Copy());
|
||||
break;
|
||||
}
|
||||
case 412: // SETTINGS - ADD IN STUDY
|
||||
{
|
||||
QMenuBar* Mb = myGeomGUI->GetDesktop()->getMainMenuBar();
|
||||
QMenuData* pp;
|
||||
QMenuItem* item = parent->menuBar()->findItem(412, &pp);
|
||||
bool check = !pp->isItemChecked(412);
|
||||
pp->setItemChecked(412,check);
|
||||
myGeomGUI->GetSettings_AddInStudy() = check;
|
||||
QAD_CONFIG->addSetting("Geometry:SettingsAddInStudy", myGeomGUI->GetSettings_AddInStudy());
|
||||
break;
|
||||
}
|
||||
case 413: // SETTINGS - SHADING COLOR
|
||||
{
|
||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
|
||||
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 SCg = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorGreen");
|
||||
QString SCb = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorBlue");
|
||||
QColor color;
|
||||
if(!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty()) {
|
||||
color = QColor (SCr.toInt(), SCg.toInt(), SCb.toInt());
|
||||
}
|
||||
else {
|
||||
Quantity_Color Default = Quantity_Color();
|
||||
color = QColor ((int)Default.Red() * 255.0, (int)Default.Green()* 255.0, (int)Default.Blue() * 255.0);
|
||||
}
|
||||
|
||||
QColor c = QColorDialog::getColor(color, myGeomGUI->GetDesktop());
|
||||
if(c.isValid()) {
|
||||
myGeomGUI->GetShadingColor() = Quantity_Color(c.red() / 255.0, c.green() / 255.0, c.blue() / 255.0, Quantity_TOC_RGB);
|
||||
|
||||
AIS_ListOfInteractive List;
|
||||
ic->DisplayedObjects(List);
|
||||
AIS_ListOfInteractive List1;
|
||||
ic->ObjectsInCollector(List1);
|
||||
List.Append(List1);
|
||||
|
||||
AIS_ListIteratorOfListOfInteractive ite(List);
|
||||
while(ite.More()) {
|
||||
if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
|
||||
Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
|
||||
aSh->SetShadingColor(myGeomGUI->GetShadingColor());
|
||||
ic->Redisplay(aSh, Standard_True, Standard_True);
|
||||
}
|
||||
ite.Next();
|
||||
}
|
||||
|
||||
ic->UpdateCurrentViewer();
|
||||
|
||||
QAD_CONFIG->addSetting("Geometry:SettingsShadingColorRed", c.red());
|
||||
QAD_CONFIG->addSetting("Geometry:SettingsShadingColorGreen", c.green());
|
||||
QAD_CONFIG->addSetting("Geometry:SettingsShadingColorBlue", c.blue());
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 414: // SETTINGS - ISOS
|
||||
{
|
||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
|
||||
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 IsoV = QAD_CONFIG->getSetting("Geometry:SettingsIsoV");
|
||||
if(!IsoU.isEmpty())
|
||||
ic->DefaultDrawer()->UIsoAspect()->SetNumber(IsoU.toInt());
|
||||
else
|
||||
IsoU = "1";
|
||||
if (!IsoV.isEmpty())
|
||||
ic->DefaultDrawer()->VIsoAspect()->SetNumber(IsoV.toInt());
|
||||
else
|
||||
IsoV = "1";
|
||||
|
||||
GEOMBase_NbIsosDlg* NbIsosDlg = new GEOMBase_NbIsosDlg(myGeomGUI->GetDesktop(), tr("GEOM_MEN_ISOS"), TRUE);
|
||||
int UIso = IsoU.toInt();
|
||||
int VIso = IsoV.toInt();
|
||||
|
||||
NbIsosDlg->SpinBoxU->setValue(UIso);
|
||||
NbIsosDlg->SpinBoxV->setValue(VIso);
|
||||
|
||||
if(NbIsosDlg->exec()) {
|
||||
UIso = NbIsosDlg->SpinBoxU->text().toInt();
|
||||
VIso = NbIsosDlg->SpinBoxV->text().toInt();
|
||||
|
||||
ic->DefaultDrawer()->UIsoAspect()->SetNumber(UIso);
|
||||
ic->DefaultDrawer()->VIsoAspect()->SetNumber(VIso);
|
||||
QAD_CONFIG->addSetting("Geometry:SettingsIsoU", NbIsosDlg->SpinBoxU->text()); /* text format */
|
||||
QAD_CONFIG->addSetting("Geometry:SettingsIsoV", NbIsosDlg->SpinBoxV->text()); /* text format */
|
||||
}
|
||||
|
||||
AIS_ListOfInteractive List;
|
||||
ic->DisplayedObjects(List);
|
||||
AIS_ListOfInteractive List1;
|
||||
ic->ObjectsInCollector(List1);
|
||||
List.Append(List1);
|
||||
|
||||
AIS_ListIteratorOfListOfInteractive ite(List);
|
||||
ic->InitCurrent();
|
||||
if(ic->NbCurrents())
|
||||
while(ite.More()) {
|
||||
if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) {
|
||||
Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value());
|
||||
Handle (AIS_Drawer) CurDrawer;
|
||||
CurDrawer = aSh->Attributes();
|
||||
CurDrawer->UIsoAspect()->SetNumber(UIso);
|
||||
CurDrawer->VIsoAspect()->SetNumber(VIso);
|
||||
ic->SetLocalAttributes(aSh, CurDrawer);
|
||||
ic->Redisplay(aSh);
|
||||
}
|
||||
ite.Next();
|
||||
}
|
||||
ic->UpdateCurrentViewer();
|
||||
break;
|
||||
}
|
||||
case 415: // SETTINGS : STEP VALUE FOR SPIN BOXES
|
||||
{
|
||||
QString step = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep");
|
||||
if(step.isEmpty())
|
||||
step = "100.0";
|
||||
|
||||
Standard_Boolean res = false;
|
||||
double dd = myGeomGUI->Parameter(res, QString("%1").arg(step), tr("GEOM_MEN_STEP_LABEL"), tr("GEOM_STEP_TITLE"), 0.001, 10000.0, 3);
|
||||
if(res) {
|
||||
QAD_CONFIG->addSetting("Geometry:SettingsGeomStep", QString("%1").arg(dd));
|
||||
|
||||
/* Emit signal to GeometryGUI_SpinBoxes */
|
||||
myGeomGUI->EmitSignalDefaultStepValueChanged(dd);
|
||||
}
|
||||
else
|
||||
parent->putInfo(tr("GEOM_PRP_ABORT"));
|
||||
break;
|
||||
}
|
||||
case 804: // ADD IN STUDY - POPUP VIEWER
|
||||
{
|
||||
const SALOME_ListIO& ListSelected = Sel->StoredIObjects();
|
||||
SALOME_ListIteratorOfListIO It(ListSelected);
|
||||
for(; It.More(); It.Next()) {
|
||||
Handle(SALOME_InteractiveObject) IObject = It.Value();
|
||||
myGeomGUI->AddInStudy(true, IObject);
|
||||
}
|
||||
/* Is set on the dialog box */
|
||||
QApplication::restoreOverrideCursor();
|
||||
break;
|
||||
}
|
||||
case 901: // RENAME
|
||||
{
|
||||
SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
|
||||
for(; It.More(); It.Next()) {
|
||||
Handle(SALOME_InteractiveObject) IObject = It.Value();
|
||||
|
||||
SALOMEDS::SObject_var obj = aStudy->FindObjectID(IObject->getEntry());
|
||||
SALOMEDS::GenericAttribute_var anAttr;
|
||||
SALOMEDS::AttributeName_var aName;
|
||||
if(!obj->_is_nil()) {
|
||||
if(obj->FindAttribute(anAttr, "AttributeName")) {
|
||||
aName = SALOMEDS::AttributeName::_narrow(anAttr);
|
||||
|
||||
QString nm = QString(aName->Value());
|
||||
nm = SALOMEGUI_NameDlg::getName(myGeomGUI->GetDesktop(), nm);
|
||||
if(!nm.isEmpty()) {
|
||||
QApplication::setOverrideCursor(Qt::waitCursor);
|
||||
myGeomGUI->GetActiveStudy()->renameIObject(IObject, nm);
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 5103: // CHECK GEOMETRY
|
||||
{
|
||||
QAD_PyEditor* PyEditor = myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getPyEditor();
|
||||
PyEditor->setText("from GEOM_usinggeom import *\n");
|
||||
PyEditor->setText(">>> ");
|
||||
PyEditor->handleReturn();
|
||||
break;
|
||||
}
|
||||
case 8032: // COLOR - POPUP VIEWER
|
||||
{
|
||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
|
||||
// VTK
|
||||
VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
|
||||
|
||||
SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
|
||||
Handle(SALOME_InteractiveObject) FirstIOS = Sel->firstIObject();
|
||||
if(!FirstIOS.IsNull()) {
|
||||
QColor initcolor = myRenderInter->GetColor(FirstIOS);
|
||||
QColor c = QColorDialog::getColor( initcolor, myGeomGUI->GetDesktop());
|
||||
|
||||
if(c.isValid()) {
|
||||
QApplication::setOverrideCursor(Qt::waitCursor);
|
||||
for(;It.More();It.Next()) {
|
||||
Handle(SALOME_InteractiveObject) IOS = It.Value();
|
||||
myRenderInter->SetColor(IOS,c);
|
||||
}
|
||||
}
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
}
|
||||
else if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
|
||||
Handle(SALOME_InteractiveObject) IO = Sel->firstIObject();
|
||||
Standard_Boolean found;
|
||||
Handle(GEOM_AISShape) Shape = myGeomGUI->ConvertIOinGEOMAISShape(IO, found, true);
|
||||
if(found) {
|
||||
Quantity_Color CSFColor;
|
||||
Shape->Color(CSFColor);
|
||||
|
||||
QColor c = QColorDialog::getColor(QColor(CSFColor.Red() * 255.0, CSFColor.Green()* 255.0, CSFColor.Blue() * 255.0), myGeomGUI->GetDesktop());
|
||||
|
||||
if(c.isValid()) {
|
||||
CSFColor = Quantity_Color (c.red()/255., c.green()/255., c.blue()/255., Quantity_TOC_RGB);
|
||||
QApplication::setOverrideCursor( Qt::waitCursor );
|
||||
|
||||
SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
|
||||
for(;It.More();It.Next()) {
|
||||
Handle(SALOME_InteractiveObject) IObject = It.Value();
|
||||
Standard_Boolean found;
|
||||
Handle(GEOM_AISShape) Shape = myGeomGUI->ConvertIOinGEOMAISShape(IObject, found, true);
|
||||
if(found) {
|
||||
Shape->SetColor(CSFColor);
|
||||
Shape->SetShadingColor(CSFColor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
QApplication::restoreOverrideCursor();
|
||||
break;
|
||||
}
|
||||
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);
|
||||
break;
|
||||
}
|
||||
case 8034: // ISOS - POPUP VIEWER
|
||||
{
|
||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
|
||||
break;
|
||||
|
||||
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
|
||||
Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
|
||||
|
||||
ic->InitCurrent();
|
||||
if(ic->MoreCurrent()) {
|
||||
Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current());
|
||||
QString IsoU = QAD_CONFIG->getSetting("Geometry:SettingsIsoU");
|
||||
QString IsoV = QAD_CONFIG->getSetting("Geometry:SettingsIsoV");
|
||||
|
||||
if(!IsoU.isEmpty())
|
||||
ic->DefaultDrawer()->UIsoAspect()->SetNumber(IsoU.toInt());
|
||||
else
|
||||
IsoU = "1";
|
||||
if (!IsoV.isEmpty())
|
||||
ic->DefaultDrawer()->VIsoAspect()->SetNumber(IsoV.toInt());
|
||||
else
|
||||
IsoV = "1";
|
||||
|
||||
GEOMBase_NbIsosDlg * NbIsosDlg =
|
||||
new GEOMBase_NbIsosDlg(myGeomGUI->GetDesktop(), tr("GEOM_MEN_ISOS"), TRUE);
|
||||
|
||||
NbIsosDlg->SpinBoxU->setValue(IsoU.toInt());
|
||||
NbIsosDlg->SpinBoxV->setValue(IsoV.toInt());
|
||||
|
||||
if(NbIsosDlg->exec()) {
|
||||
QApplication::setOverrideCursor(Qt::waitCursor);
|
||||
for(; ic->MoreCurrent(); ic->NextCurrent()) {
|
||||
Handle(AIS_Drawer) CurDrawer;
|
||||
|
||||
CurDrawer = ic->Current()->Attributes();
|
||||
CurDrawer->UIsoAspect()->SetNumber(NbIsosDlg->SpinBoxU->text().toInt());
|
||||
CurDrawer->VIsoAspect()->SetNumber(NbIsosDlg->SpinBoxV->text().toInt());
|
||||
|
||||
ic->SetLocalAttributes(CurObject, CurDrawer);
|
||||
ic->Redisplay(CurObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
QApplication::restoreOverrideCursor();
|
||||
break;
|
||||
}
|
||||
case 9024 : // OPEN - OBJBROSER POPUP
|
||||
{
|
||||
SALOME_ListIteratorOfListIO It(Sel->StoredIObjects());
|
||||
Handle(SALOME_InteractiveObject) anIObject;
|
||||
for(;It.More();It.Next()) {
|
||||
anIObject = It.Value();
|
||||
SALOMEDS::SObject_var obj = aStudy->FindObjectID(anIObject->getEntry());
|
||||
SALOMEDS::AttributePersistentRef_var aPersist;
|
||||
SALOMEDS::AttributeIOR_var anIOR;
|
||||
if(!obj->_is_nil()) {
|
||||
// this SObject may be GEOM module root SObject
|
||||
SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(obj);
|
||||
SALOMEDS::GenericAttribute_var anAttr;
|
||||
bool useSubItems = false;
|
||||
while (anIter->More() && !useSubItems) {
|
||||
SALOMEDS::SObject_var subobj = anIter->Value();
|
||||
if (subobj->FindAttribute(anAttr, "AttributePersistentRef")) {
|
||||
useSubItems = true;
|
||||
obj = subobj;
|
||||
}
|
||||
else
|
||||
anIter->Next();
|
||||
}
|
||||
obj->FindAttribute(anAttr, "AttributePersistentRef");
|
||||
|
||||
while(useSubItems?anIter->More():!anAttr->_is_nil()) {
|
||||
if(!obj->FindAttribute(anAttr, "AttributeIOR") &&
|
||||
obj->FindAttribute(anAttr, "AttributePersistentRef")) {
|
||||
// load
|
||||
Engines::Component_var comp = myGeomGUI->GetDesktop()->getEngine("FactoryServer","GEOM");
|
||||
if (!CORBA::is_nil(comp)) {
|
||||
SALOMEDS::Driver_var driver = SALOMEDS::Driver::_narrow(comp);
|
||||
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
|
||||
aStudyBuilder->LoadWith(aStudy->FindComponent("GEOM"),driver);
|
||||
}
|
||||
else {
|
||||
MESSAGE("Component is null");
|
||||
}
|
||||
}
|
||||
if(useSubItems) {
|
||||
anIter->Next();
|
||||
obj = anIter->Value();
|
||||
}
|
||||
else
|
||||
anAttr = SALOMEDS::GenericAttribute::_nil();
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
|
||||
break;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//===============================================================================
|
||||
// function : OnEditDelete()
|
||||
// purpose :
|
||||
//===============================================================================
|
||||
void GEOMBase_Tools::OnEditDelete()
|
||||
{
|
||||
if ( QAD_MessageBox::warn2
|
||||
( myGeomGUI->GetDesktop(),
|
||||
tr ("GEOM_WRN_WARNING"),
|
||||
tr ("GEOM_REALLY_DELETE"),
|
||||
tr ("GEOM_BUT_YES"), tr ("GEOM_BUT_NO"), 1, 0, 0) != 1 )
|
||||
return;
|
||||
|
||||
int nbSf = myGeomGUI->GetActiveStudy()->getStudyFramesCount();
|
||||
|
||||
Standard_Boolean found;
|
||||
SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument();
|
||||
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
|
||||
SALOMEDS::GenericAttribute_var anAttr;
|
||||
SALOMEDS::AttributeIOR_var anIOR;
|
||||
|
||||
SALOME_Selection* Sel = SALOME_Selection::Selection( myGeomGUI->GetActiveStudy()->getSelection() );
|
||||
SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
|
||||
for(;It.More();It.Next()) {
|
||||
Handle(SALOME_InteractiveObject) IObject = It.Value();
|
||||
if ( IObject->hasEntry() ) {
|
||||
SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument();
|
||||
SALOMEDS::SObject_var SO = aStudy->FindObjectID( IObject->getEntry() );
|
||||
|
||||
/* Erase child graphical objects */
|
||||
SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SO);
|
||||
for (; it->More();it->Next()) {
|
||||
SALOMEDS::SObject_var CSO= it->Value();
|
||||
if (CSO->FindAttribute(anAttr, "AttributeIOR") ) {
|
||||
anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
|
||||
/* Delete child(s) shape in Client : */
|
||||
const TCollection_AsciiString ASCior(anIOR->Value()) ;
|
||||
myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( ASCior ) ;
|
||||
|
||||
for ( int i = 0; i < nbSf; i++ ) {
|
||||
QAD_StudyFrame* sf = myGeomGUI->GetActiveStudy()->getStudyFrame(i);
|
||||
if ( sf->getTypeView() == VIEW_OCC ) {
|
||||
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getViewer();
|
||||
Handle (AIS_InteractiveContext) myContext = v3d->getAISContext();
|
||||
Handle(GEOM_AISShape) Result = myGeomGUI->ConvertIORinGEOMAISShape( anIOR->Value(), found );
|
||||
if ( found )
|
||||
myContext->Erase( Result, true, false );
|
||||
} else if ( sf->getTypeView() == VIEW_VTK ) {
|
||||
//vtkRenderer* Renderer = ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRenderer();
|
||||
VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRWInteractor();
|
||||
GEOM_Actor* ac = myGeomGUI->ConvertIORinGEOMActor( anIOR->Value(), found );
|
||||
if ( found ) {
|
||||
//Renderer->RemoveActor(ac);
|
||||
if ( ac->hasIO() )
|
||||
myRenderInter->Remove( ac->getIO() );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Erase main graphical object */
|
||||
for ( int i = 0; i < nbSf; i++ ) {
|
||||
QAD_StudyFrame* sf = myGeomGUI->GetActiveStudy()->getStudyFrame(i);
|
||||
if ( sf->getTypeView() == VIEW_OCC ) {
|
||||
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getViewer();
|
||||
Handle (AIS_InteractiveContext) myContext = v3d->getAISContext();
|
||||
Handle(GEOM_AISShape) Result = myGeomGUI->ConvertIOinGEOMAISShape( IObject, found );
|
||||
if ( found )
|
||||
myContext->Erase( Result, true, false );
|
||||
} else if ( sf->getTypeView() == VIEW_VTK ) {
|
||||
VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRWInteractor();
|
||||
myRenderInter->Remove( IObject );
|
||||
}
|
||||
}
|
||||
|
||||
/* Delete main shape in Client : */
|
||||
if (SO->FindAttribute(anAttr, "AttributeIOR") ) {
|
||||
anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
|
||||
const TCollection_AsciiString ASCIor(anIOR->Value()) ;
|
||||
myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( ASCIor ) ;
|
||||
}
|
||||
|
||||
/* Erase objects in Study */
|
||||
SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() );
|
||||
if ( !obj->_is_nil() ) {
|
||||
QAD_Operation* op = new SALOMEGUI_ImportOperation( myGeomGUI->GetActiveStudy() );
|
||||
op->start();
|
||||
aStudyBuilder->RemoveObject(obj);
|
||||
op->finish();
|
||||
}
|
||||
|
||||
} /* IObject->hasEntry() */
|
||||
} /* more/next */
|
||||
|
||||
/* Clear any previous selection */
|
||||
Sel->ClearIObjects() ;
|
||||
myGeomGUI->GetActiveStudy()->updateObjBrowser();
|
||||
}
|
||||
|
||||
|
||||
//==============================================================================
|
||||
// function : OnEditCopy()
|
||||
// purpose :
|
||||
//==============================================================================
|
||||
void GEOMBase_Tools::OnEditCopy()
|
||||
{
|
||||
SALOME_Selection* Sel = SALOME_Selection::Selection( myGeomGUI->GetActiveStudy()->getSelection() );
|
||||
GEOM::GEOM_Gen::ListOfIOR_var listIOR = new GEOM::GEOM_Gen::ListOfIOR;
|
||||
|
||||
const SALOME_ListIO& List = Sel->StoredIObjects();
|
||||
|
||||
myGeomGUI->ConvertListOfIOInListOfIOR( List, listIOR);
|
||||
|
||||
Sel->ClearIObjects();
|
||||
|
||||
for (unsigned int ind = 0; ind < listIOR->length();ind++) {
|
||||
GEOM::GEOM_Shape_var aShapeInit = myGeom->GetIORFromString(listIOR[ind]);
|
||||
try {
|
||||
GEOM::GEOM_Shape_var result = myGeom->MakeCopy(aShapeInit) ;
|
||||
result->NameType( aShapeInit->NameType() );
|
||||
myGeomGUI->Display(result);
|
||||
}
|
||||
catch (const SALOME::SALOME_Exception& S_ex) {
|
||||
QtCatchCorbaException(S_ex);
|
||||
}
|
||||
}
|
||||
|
||||
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_READY"));
|
||||
}
|
||||
|
||||
|
||||
//=====================================================================================
|
||||
// function : Import
|
||||
// purpose : BRep, Iges, Step
|
||||
//=====================================================================================
|
||||
bool GEOMBase_Tools::Import()
|
||||
{
|
||||
SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument();
|
||||
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
|
||||
|
||||
GEOM::GEOM_Shape_var aShape;
|
||||
QString file;
|
||||
QStringList filtersList ;
|
||||
|
||||
switch (myGeomGUI->GetState())
|
||||
{
|
||||
case 111 : // Import BREP
|
||||
{
|
||||
filtersList.append( tr("GEOM_MEN_IMPORT_BREP") );
|
||||
filtersList.append( tr("GEOM_MEN_ALL_FILES") ) ;
|
||||
|
||||
file = QAD_FileDlg::getFileName(myGeomGUI->GetDesktop(),
|
||||
"",
|
||||
filtersList,
|
||||
tr("GEOM_MEN_IMPORT"),
|
||||
true);
|
||||
if ( !file.isEmpty() ) {
|
||||
QApplication::setOverrideCursor( Qt::waitCursor );
|
||||
try {
|
||||
aShape = myGeom->ImportBREP( file.latin1() );
|
||||
}
|
||||
catch (const SALOME::SALOME_Exception& S_ex) {
|
||||
QtCatchCorbaException(S_ex);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 112 : // Import IGES
|
||||
{
|
||||
filtersList.append( tr("GEOM_MEN_IMPORT_IGES") ) ;
|
||||
filtersList.append( tr("GEOM_MEN_ALL_FILES") ) ;
|
||||
|
||||
file = QAD_FileDlg::getFileName(myGeomGUI->GetDesktop(),
|
||||
"",
|
||||
filtersList,
|
||||
tr("GEOM_MEN_IMPORT"),
|
||||
true);
|
||||
if ( !file.isEmpty() ) {
|
||||
QApplication::setOverrideCursor( Qt::waitCursor );
|
||||
try {
|
||||
aShape = myGeom->ImportIGES( file.latin1() );
|
||||
}
|
||||
catch (const SALOME::SALOME_Exception& S_ex) {
|
||||
QtCatchCorbaException(S_ex);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 113 : // Import STEP
|
||||
{
|
||||
filtersList.append( tr("GEOM_MEN_IMPORT_STEP") ) ;
|
||||
filtersList.append( tr("GEOM_MEN_ALL_FILES") ) ;
|
||||
|
||||
file = QAD_FileDlg::getFileName(myGeomGUI->GetDesktop(),
|
||||
"",
|
||||
filtersList,
|
||||
tr("GEOM_MEN_IMPORT"),
|
||||
true);
|
||||
if ( !file.isEmpty() ) {
|
||||
QApplication::setOverrideCursor( Qt::waitCursor );
|
||||
try {
|
||||
aShape = myGeom->ImportSTEP( file.latin1() );
|
||||
}
|
||||
catch (const SALOME::SALOME_Exception& S_ex) {
|
||||
QtCatchCorbaException(S_ex);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !file.isEmpty() ) {
|
||||
myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_LOADING").arg(QAD_Tools::getFileNameFromPath( file )) );
|
||||
|
||||
SALOMEDS::SComponent_var father = aStudy->FindComponent("GEOM");
|
||||
SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->entry());
|
||||
SALOMEDS::GenericAttribute_var anAttr;
|
||||
SALOMEDS::AttributeName_var aName;
|
||||
SALOMEDS::AttributePixMap_var aPixmap;
|
||||
int aLocked = false;
|
||||
if (father->_is_nil()) {
|
||||
QAD_Operation* op = new SALOMEGUI_ImportOperation( myGeomGUI->GetActiveStudy() );
|
||||
op->start();
|
||||
aLocked = aStudy->GetProperties()->IsLocked();
|
||||
if (aLocked) aStudy->GetProperties()->SetLocked(false);
|
||||
father = aStudyBuilder->NewComponent("GEOM");
|
||||
anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributeName");
|
||||
aName = SALOMEDS::AttributeName::_narrow(anAttr);
|
||||
// aName->SetValue( tr("GEOM_MEN_COMPONENT") );
|
||||
aName->SetValue( myGeomGUI->GetDesktop()->getComponentUserName( "GEOM" ) );
|
||||
anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap");
|
||||
aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
|
||||
aPixmap->SetPixMap( "ICON_OBJBROWSER_Geometry" );
|
||||
if (aLocked) aStudy->GetProperties()->SetLocked(true);
|
||||
op->finish();
|
||||
}
|
||||
// if (aLocked) return false;
|
||||
aStudyBuilder->DefineComponentInstance( father, myGeom );
|
||||
father->ComponentIOR(myGeomGUI->GetFatherior());
|
||||
|
||||
QString nameShape = QAD_Tools::getFileNameFromPath(file,false) + QString("_%1").arg(myGeomGUI->GetNbGeom()++);
|
||||
|
||||
if(myGeomGUI->Display(aShape, strdup(nameShape.latin1()))) {
|
||||
myGeomGUI->GetActiveStudy()->setMessage( tr("GEOM_INF_LOADED").arg(QAD_Tools::getFileNameFromPath( file )) );
|
||||
myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_READY"));
|
||||
}
|
||||
}
|
||||
QApplication::restoreOverrideCursor();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//=====================================================================================
|
||||
// function : Export
|
||||
// purpose : BRep, Iges, Step
|
||||
//=====================================================================================
|
||||
bool GEOMBase_Tools::Export()
|
||||
{
|
||||
SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument();
|
||||
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
|
||||
|
||||
GEOM::GEOM_Shape_var aShape;
|
||||
|
||||
static QString filters[] = { tr("GEOM_MEN_IMPORT_BREP"),
|
||||
tr("GEOM_MEN_IMPORT_IGES"),
|
||||
tr("GEOM_MEN_IMPORT_STEP") };
|
||||
|
||||
SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection());
|
||||
SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
|
||||
|
||||
switch (myGeomGUI->GetState())
|
||||
{
|
||||
case 121 :
|
||||
{
|
||||
for(;It.More();It.Next()) {
|
||||
QApplication::restoreOverrideCursor();
|
||||
Handle(SALOME_InteractiveObject) IObject = It.Value();
|
||||
Standard_Boolean found;
|
||||
GEOM::GEOM_Shape_var aShape = myGeomGUI->ConvertIOinGEOMShape(IObject, found);
|
||||
// Handle(GEOM_AISShape) Shape = myGeomGUI->ConvertIOinGEOMAISShape(IObject, found, true);
|
||||
if ( found ) {
|
||||
QString file = QAD_FileDlg::getFileName(myGeomGUI->GetDesktop(),
|
||||
QString( IObject->getName() ) + ".brep",
|
||||
tr("GEOM_MEN_IMPORT_BREP"),
|
||||
tr("GEOM_MEN_EXPORT"),
|
||||
false);
|
||||
if ( !file.isEmpty() && !aShape->_is_nil() ) {
|
||||
QApplication::setOverrideCursor( Qt::waitCursor );
|
||||
// Standard_Boolean result = BRepTools::Write(Shape->Shape(), strdup(file.latin1()) );
|
||||
try {
|
||||
myGeom->ExportBREP(strdup( file.latin1()), aShape);
|
||||
}
|
||||
catch (const SALOME::SALOME_Exception& S_ex) {
|
||||
QtCatchCorbaException(S_ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 122 :
|
||||
{
|
||||
for(;It.More();It.Next()) {
|
||||
QApplication::restoreOverrideCursor();
|
||||
Handle(SALOME_InteractiveObject) IObject = It.Value();
|
||||
Standard_Boolean found;
|
||||
GEOM::GEOM_Shape_var aShape = myGeomGUI->ConvertIOinGEOMShape(IObject, found);
|
||||
// Handle(GEOM_AISShape) Shape = myGeomGUI->ConvertIOinGEOMAISShape(IObject, found, true);
|
||||
if ( found ) {
|
||||
QString file = QAD_FileDlg::getFileName(myGeomGUI->GetDesktop(),
|
||||
QString( IObject->getName() ) + ".igs",
|
||||
tr("GEOM_MEN_IMPORT_IGES"),
|
||||
tr("GEOM_MEN_EXPORT"),
|
||||
false);
|
||||
if ( !file.isEmpty() && !aShape->_is_nil() ) {
|
||||
QApplication::setOverrideCursor( Qt::waitCursor );
|
||||
try {
|
||||
myGeom->ExportIGES(strdup( file.latin1()), aShape);
|
||||
}
|
||||
catch (const SALOME::SALOME_Exception& S_ex) {
|
||||
QtCatchCorbaException(S_ex);
|
||||
}
|
||||
// //VRV: OCC 4.0 migration
|
||||
// IGESControl_Controller::Init();
|
||||
// IGESControl_Writer ICW (Interface_Static::CVal("XSTEP.iges.unit"),
|
||||
// Interface_Static::IVal("XSTEP.iges.writebrep.mode"));
|
||||
// //VRV: OCC 4.0 migration
|
||||
|
||||
// ICW.AddShape (Shape->Shape());
|
||||
// ICW.ComputeModel();
|
||||
// Standard_Boolean result = ICW.Write( strdup(file.latin1()) );
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case 123 :
|
||||
{
|
||||
// bool test = false ;
|
||||
// IFSelect_ReturnStatus status ;
|
||||
// //VRV: OCC 4.0 migration
|
||||
// STEPControl_Writer aWriter;
|
||||
// //VRV: OCC 4.0 migration
|
||||
QString file;
|
||||
|
||||
for( ; It.More(); It.Next() ) {
|
||||
// GEOM::GEOM_Shape_var aShape = myGeomGUI->ConvertIOinGEOMShape(IObject, found);
|
||||
QApplication::restoreOverrideCursor();
|
||||
Handle(SALOME_InteractiveObject) IObject = It.Value();
|
||||
Standard_Boolean found;
|
||||
GEOM::GEOM_Shape_var aShape = myGeomGUI->ConvertIOinGEOMShape(IObject, found);
|
||||
// Handle(GEOM_AISShape) Shape = myGeomGUI->ConvertIOinGEOMAISShape(IObject, found, true);
|
||||
if ( found ) {
|
||||
file = QAD_FileDlg::getFileName(myGeomGUI->GetDesktop(),
|
||||
QString( IObject->getName() ) + ".stp",
|
||||
tr("GEOM_MEN_IMPORT_STEP"),
|
||||
tr("GEOM_MEN_EXPORT"),
|
||||
false);
|
||||
if ( !file.isEmpty() && !aShape->_is_nil() ) {
|
||||
|
||||
QApplication::setOverrideCursor( Qt::waitCursor ) ;
|
||||
try {
|
||||
myGeom->ExportSTEP(strdup( file.latin1()), aShape);
|
||||
}
|
||||
catch (const SALOME::SALOME_Exception& S_ex) {
|
||||
QtCatchCorbaException(S_ex);
|
||||
}
|
||||
// //VRV: OCC 4.0 migration
|
||||
// status = aWriter.Transfer( Shape->Shape(), STEPControl_ManifoldSolidBrep ) ;
|
||||
// //VRV: OCC 4.0 migration
|
||||
// test = true ;
|
||||
// if ( status != IFSelect_RetDone ) {
|
||||
// QApplication::restoreOverrideCursor() ;
|
||||
// return false ;
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
// if(test) {
|
||||
// status = aWriter.Write( strdup(file.latin1()) ) ;
|
||||
// QApplication::restoreOverrideCursor() ;
|
||||
// return status ;
|
||||
// }
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
QApplication::restoreOverrideCursor() ;
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : GEOMBase_Tools.h
|
||||
// Author : Damien COQUERET
|
||||
// Module : GEOM
|
||||
// $Header:
|
||||
|
||||
#ifndef GEOMBASE_TOOLS_H
|
||||
#define GEOMBASE_TOOLS_H
|
||||
|
||||
#include "GEOMBase_Context.h"
|
||||
|
||||
//=================================================================================
|
||||
// class : GEOMBase_Tools
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class GEOMBase_Tools : public QObject
|
||||
{
|
||||
Q_OBJECT /* for QT compatibility */
|
||||
|
||||
public :
|
||||
GEOMBase_Tools();
|
||||
~GEOMBase_Tools();
|
||||
|
||||
bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
|
||||
|
||||
/* Import and export topology methods */
|
||||
bool Import();
|
||||
bool Export();
|
||||
|
||||
void OnEditCopy();
|
||||
void OnEditDelete();
|
||||
|
||||
private:
|
||||
GEOMBase_Context* myGeomGUI;
|
||||
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
|
||||
|
||||
};
|
||||
|
||||
#endif
|
@ -1,238 +0,0 @@
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : GEOMBase_TransparencyDlg.cxx
|
||||
// Author : Lucien PIGNOLONI
|
||||
// Module : GEOM
|
||||
|
||||
using namespace std;
|
||||
#include "GEOMBase_TransparencyDlg.h"
|
||||
#include "GEOMBase_Context.h"
|
||||
|
||||
#include "QAD_RightFrame.h"
|
||||
#include "SALOME_ListIteratorOfListIO.hxx"
|
||||
|
||||
#include <qframe.h>
|
||||
#include <qlabel.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qslider.h>
|
||||
#include <qlayout.h>
|
||||
#include <qvariant.h>
|
||||
#include <qtooltip.h>
|
||||
#include <qwhatsthis.h>
|
||||
#include <qapplication.h>
|
||||
#include <qgroupbox.h>
|
||||
|
||||
#include "VTKViewer_ViewFrame.h"
|
||||
#include "VTKViewer_RenderWindowInteractor.h"
|
||||
|
||||
//=================================================================================
|
||||
// class : GEOMBase_TransparencyDlg()
|
||||
// purpose : Constructs a GEOMBase_SUBSHAPE which is a child of 'parent', with the
|
||||
// name 'name' and widget flags set to 'f'.
|
||||
//
|
||||
// : WARNING : this dialog is modal !
|
||||
//
|
||||
//=================================================================================
|
||||
GEOMBase_TransparencyDlg::GEOMBase_TransparencyDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, const Handle(AIS_InteractiveContext)& ic, bool modal, WFlags fl)
|
||||
:QDialog(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
|
||||
{
|
||||
if(!name)
|
||||
setName("GEOMBase_TransparencyDlg");
|
||||
resize(152, 107);
|
||||
setCaption(tr("GEOM_TRANSPARENCY_TITLE"));
|
||||
setSizeGripEnabled(TRUE);
|
||||
GEOMBase_TransparencyDlgLayout = new QGridLayout(this);
|
||||
GEOMBase_TransparencyDlgLayout->setSpacing(6);
|
||||
GEOMBase_TransparencyDlgLayout->setMargin(11);
|
||||
|
||||
/*************************************************************************/
|
||||
QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
|
||||
GroupButtons->setColumnLayout(0, Qt::Vertical );
|
||||
GroupButtons->layout()->setSpacing( 0 );
|
||||
GroupButtons->layout()->setMargin( 0 );
|
||||
QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
|
||||
GroupButtonsLayout->setAlignment( Qt::AlignTop );
|
||||
GroupButtonsLayout->setSpacing( 6 );
|
||||
GroupButtonsLayout->setMargin( 11 );
|
||||
|
||||
buttonOk = new QPushButton( GroupButtons, "buttonOk" );
|
||||
buttonOk->setText( tr( "GEOM_BUT_OK" ) );
|
||||
buttonOk->setAutoDefault( TRUE );
|
||||
buttonOk->setDefault( TRUE );
|
||||
GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 0 );
|
||||
GroupButtonsLayout->addWidget( buttonOk, 0, 1 );
|
||||
GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 2 );
|
||||
|
||||
/*************************************************************************/
|
||||
QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" );
|
||||
GroupC1->setColumnLayout(0, Qt::Vertical );
|
||||
GroupC1->layout()->setSpacing( 0 );
|
||||
GroupC1->layout()->setMargin( 0 );
|
||||
QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
|
||||
GroupC1Layout->setAlignment( Qt::AlignTop );
|
||||
GroupC1Layout->setSpacing( 6 );
|
||||
GroupC1Layout->setMargin( 11 );
|
||||
|
||||
TextLabelOpaque = new QLabel( GroupC1, "TextLabelOpaque" );
|
||||
TextLabelOpaque->setText( tr( "GEOM_TRANSPARENCY_OPAQUE" ) );
|
||||
TextLabelOpaque->setAlignment( int( QLabel::AlignLeft ) );
|
||||
GroupC1Layout->addWidget( TextLabelOpaque, 0, 0 );
|
||||
GroupC1Layout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
|
||||
|
||||
TextLabelTransparent = new QLabel( GroupC1, "TextLabelTransparent" );
|
||||
TextLabelTransparent->setText( tr( "GEOM_TRANSPARENCY_TRANSPARENT" ) );
|
||||
TextLabelTransparent->setAlignment( int( QLabel::AlignRight ) );
|
||||
GroupC1Layout->addWidget( TextLabelTransparent, 0, 2 );
|
||||
|
||||
Slider1 = new QSlider( 0, 10, 1, 5, Horizontal, GroupC1, "Slider1" );
|
||||
Slider1->setMinimumSize( 300, 0 );
|
||||
Slider1->setTickmarks( QSlider::Left );
|
||||
GroupC1Layout->addMultiCellWidget( Slider1, 1, 1, 0, 2 );
|
||||
/*************************************************************************/
|
||||
|
||||
GEOMBase_TransparencyDlgLayout->addWidget(GroupC1, 0, 0);
|
||||
GEOMBase_TransparencyDlgLayout->addWidget(GroupButtons, 1, 0);
|
||||
|
||||
/* Initialisations */
|
||||
this->myGeomGUI = GEOMBase_Context::GetGeomGUI();
|
||||
this->myIc = ic;
|
||||
this->mySel = Sel;
|
||||
|
||||
/* First call valueChanged() method for initialisation */
|
||||
/* The default value of transparency will change with the selection */
|
||||
this->myFirstInit = true;
|
||||
// Slider1->setMaxValue( 10 );
|
||||
// Slider1->setValue( 5 ) ;
|
||||
this->ValueHasChanged(Slider1->value());
|
||||
|
||||
// signals and slots connections : after ValueHasChanged()
|
||||
connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
|
||||
connect(Slider1, SIGNAL(valueChanged(int)), this, SLOT(ValueHasChanged(int)));
|
||||
|
||||
/* 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 this Dialog */
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ~GEOMBase_TransparencyDlg()
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
GEOMBase_TransparencyDlg::~GEOMBase_TransparencyDlg()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : ClickOnOk()
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void GEOMBase_TransparencyDlg::ClickOnOk()
|
||||
{
|
||||
accept();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : ClickOnClose()
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void GEOMBase_TransparencyDlg::ClickOnClose()
|
||||
{
|
||||
accept();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// function : ValueHasChanged()
|
||||
// purpose : Called when value of slider change
|
||||
// : or the first time as initilisation
|
||||
//=================================================================================
|
||||
void GEOMBase_TransparencyDlg::ValueHasChanged(int newValue)
|
||||
{
|
||||
if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
|
||||
// VTK
|
||||
VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
|
||||
SALOME_ListIteratorOfListIO It(this->mySel->StoredIObjects());
|
||||
|
||||
Handle(SALOME_InteractiveObject) FirstIOS = mySel->firstIObject();
|
||||
if(!FirstIOS.IsNull()) {
|
||||
/* The first time as initialisation */
|
||||
if(this->myFirstInit) {
|
||||
this->myFirstInit = false;
|
||||
float transp = (myRenderInter->GetTransparency(FirstIOS))*10.0;
|
||||
this->Slider1->setValue(int(transp));
|
||||
}
|
||||
}
|
||||
|
||||
QApplication::setOverrideCursor(Qt::waitCursor);
|
||||
for(;It.More(); It.Next()) {
|
||||
Handle(SALOME_InteractiveObject) IOS = It.Value();
|
||||
myRenderInter->SetTransparency(IOS, newValue/10.0);
|
||||
}
|
||||
QApplication::restoreOverrideCursor();
|
||||
}
|
||||
|
||||
else if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
|
||||
// OCC
|
||||
SALOME_ListIteratorOfListIO It(this->mySel->StoredIObjects());
|
||||
Handle(SALOME_InteractiveObject) FirstIOS = mySel->firstIObject();
|
||||
if(!FirstIOS.IsNull()) {
|
||||
|
||||
/* The first time as initialisation */
|
||||
if(this->myFirstInit) {
|
||||
this->myFirstInit = false;
|
||||
Standard_Boolean found;
|
||||
Handle(GEOM_AISShape) Shape = myGeomGUI->ConvertIOinGEOMAISShape(FirstIOS, found);
|
||||
if(!found)
|
||||
return;
|
||||
float transp = (int(Shape->Transparency() * 10.0 + 0.001));
|
||||
this->Slider1->setValue(int(transp));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
QApplication::setOverrideCursor(Qt::waitCursor);
|
||||
for(;It.More(); It.Next()) {
|
||||
Handle(SALOME_InteractiveObject) IObject = It.Value();
|
||||
Standard_Boolean found;
|
||||
Handle(GEOM_AISShape) Shape = myGeomGUI->ConvertIOinGEOMAISShape(IObject, found);
|
||||
if(!found) {
|
||||
QApplication::restoreOverrideCursor();
|
||||
return;
|
||||
}
|
||||
this->myIc->SetTransparency(Shape, newValue / 10.0, false);
|
||||
myIc->Redisplay(Shape, Standard_False, Standard_True);
|
||||
}
|
||||
myIc->UpdateCurrentViewer();
|
||||
}
|
||||
QApplication::restoreOverrideCursor();
|
||||
return;
|
||||
}
|
@ -1,96 +0,0 @@
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : GEOMBase_TransparencyDlg.h
|
||||
// Author : Lucien PIGNOLONI
|
||||
// Module : GEOM
|
||||
// $Header$
|
||||
|
||||
#ifndef DIALOGBOX_TRANSPARENCYDLG_H
|
||||
#define DIALOGBOX_TRANSPARENCYDLG_H
|
||||
|
||||
#include <qvariant.h>
|
||||
#include <qdialog.h>
|
||||
|
||||
#include "SALOME_Selection.h"
|
||||
#include "SALOME_InteractiveObject.hxx"
|
||||
#include "GEOM_InteractiveObject.hxx"
|
||||
#include "GEOM_AISShape.hxx"
|
||||
|
||||
|
||||
class QVBoxLayout;
|
||||
class QHBoxLayout;
|
||||
class QGridLayout;
|
||||
class QFrame;
|
||||
class QLabel;
|
||||
class QPushButton;
|
||||
class QSlider;
|
||||
class GEOMBase_Context;
|
||||
|
||||
|
||||
|
||||
//=================================================================================
|
||||
// class : GEOMBase_TransparencyDlg
|
||||
// purpose :
|
||||
// : WARNING : that is a MODAL dialog.
|
||||
//=================================================================================
|
||||
class GEOMBase_TransparencyDlg : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GEOMBase_TransparencyDlg( QWidget* parent = 0,
|
||||
const char* name = 0,
|
||||
SALOME_Selection* Sel = 0,
|
||||
const Handle(AIS_InteractiveContext)& ic = 0,
|
||||
bool modal = TRUE,
|
||||
WFlags fl = 0 );
|
||||
|
||||
~GEOMBase_TransparencyDlg();
|
||||
|
||||
private :
|
||||
|
||||
GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */
|
||||
bool myFirstInit ; /* Inform for the first init */
|
||||
SALOME_Selection* mySel; /* User selection */
|
||||
Handle(AIS_InteractiveContext) myIc ; /* Interactive context */
|
||||
|
||||
QPushButton* buttonOk;
|
||||
QLabel* TextLabelOpaque;
|
||||
QLabel* TextLabelTransparent;
|
||||
QSlider* Slider1;
|
||||
|
||||
public slots:
|
||||
|
||||
void ClickOnOk();
|
||||
void ClickOnClose();
|
||||
void ValueHasChanged( int newValue ) ;
|
||||
|
||||
protected:
|
||||
QGridLayout* GEOMBase_TransparencyDlgLayout;
|
||||
QHBoxLayout* Layout1;
|
||||
QHBoxLayout* Layout2;
|
||||
};
|
||||
|
||||
#endif // DIALOGBOX_TRANSPARENCYDLG_H
|
||||
|
@ -1,160 +0,0 @@
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : GEOMBase_aParameterDlg.cxx
|
||||
// Author : Lucien PIGNOLONI
|
||||
// Module : GEOM
|
||||
// $Header$
|
||||
|
||||
using namespace std;
|
||||
#include "GEOMBase_aParameterDlg.h"
|
||||
#include "GEOMBase_Context.h"
|
||||
#include "QAD_SpinBoxDbl.h"
|
||||
#include "QAD_Tools.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
#include <qgroupbox.h>
|
||||
#include <qlabel.h>
|
||||
#include <qpushbutton.h>
|
||||
#include <qlayout.h>
|
||||
#include <qvariant.h>
|
||||
#include <qvalidator.h>
|
||||
|
||||
//======================================================================================
|
||||
// function : GEOMBase_aParameterDlg()
|
||||
// purpose : Constructs a GEOMBase_aParametertDlg which is a child of 'parent', with the
|
||||
// name 'name' and widget flags set to 'f'
|
||||
//
|
||||
// avalue1 : is a float or integer used as default value in edit line
|
||||
// aTitle1 : is the prompt for aValue1
|
||||
// aTitle : is the title for the user in dialog box
|
||||
//
|
||||
// bottom : the minimal value to be entered
|
||||
// top : the maximum value to be entered
|
||||
// decimals : number of decimals to be entered
|
||||
//
|
||||
// The dialog will by default be modeless, unless you set 'modal' to
|
||||
// TRUE to construct a modal dialog.
|
||||
//
|
||||
//======================================================================================
|
||||
GEOMBase_aParameterDlg::GEOMBase_aParameterDlg(const char *aValue1, const char *aTitle1, QWidget* parent, const char* name, bool modal, WFlags fl, const double bottom, const double top, const int decimals)
|
||||
:QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
|
||||
{
|
||||
if(!name)
|
||||
setName( "MyParameterDialog" );
|
||||
resize(288, 81);
|
||||
setCaption(name); /* appears on the title bar */
|
||||
setSizeGripEnabled(TRUE);
|
||||
|
||||
QGridLayout* topLayout = new QGridLayout(this);
|
||||
topLayout->setSpacing(6);
|
||||
topLayout->setMargin(11);
|
||||
|
||||
QGroupBox* mainGrp = new QGroupBox(this, "mainGrp");
|
||||
mainGrp->setColumnLayout(0, Qt::Vertical);
|
||||
mainGrp->layout()->setSpacing(0);
|
||||
mainGrp->layout()->setMargin(0);
|
||||
QGridLayout* mainGrpLayout = new QGridLayout(mainGrp->layout());
|
||||
mainGrpLayout->setAlignment(Qt::AlignTop);
|
||||
mainGrpLayout ->setSpacing(6);
|
||||
mainGrpLayout->setMargin(11);
|
||||
topLayout->addWidget(mainGrp, 0, 0);
|
||||
|
||||
/* aTitle1 : text prompt on left of edit line */
|
||||
QLabel* TextLabel1 = new QLabel(mainGrp, "TextLabel1");
|
||||
TextLabel1->setText(tr(aTitle1));
|
||||
mainGrpLayout->addWidget(TextLabel1, 0, 0);
|
||||
|
||||
mySpinBox = new QAD_SpinBoxDbl(mainGrp, "mySpinBox");
|
||||
mySpinBox->setPrecision(12);
|
||||
mySpinBox->setRange(bottom, top);
|
||||
((QDoubleValidator*)(mySpinBox->validator()))->setRange(bottom, top, decimals);
|
||||
mySpinBox->setValue(QString(aValue1).toDouble());
|
||||
mainGrpLayout->addWidget(mySpinBox, 0, 1);
|
||||
|
||||
QGroupBox* btnGrp = new QGroupBox(this, "btnGrp");
|
||||
btnGrp->setColumnLayout(0, Qt::Vertical);
|
||||
btnGrp->layout()->setSpacing(0);
|
||||
btnGrp->layout()->setMargin(0);
|
||||
QGridLayout* btnGrpLayout = new QGridLayout(btnGrp->layout());
|
||||
btnGrpLayout->setAlignment(Qt::AlignTop);
|
||||
btnGrpLayout->setSpacing(6);
|
||||
btnGrpLayout->setMargin(11);
|
||||
topLayout->addWidget(btnGrp, 1, 0);
|
||||
|
||||
/* Ok button */
|
||||
myButtonOk = new QPushButton(btnGrp, "buttonOk");
|
||||
myButtonOk->setText(tr("GEOM_BUT_OK"));
|
||||
myButtonOk->setAutoDefault(TRUE);
|
||||
myButtonOk->setDefault(TRUE);
|
||||
btnGrpLayout->addWidget(myButtonOk, 0, 0);
|
||||
|
||||
btnGrpLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1);
|
||||
|
||||
/* Cancel button */
|
||||
myButtonCancel = new QPushButton(btnGrp, "buttonCancel");
|
||||
myButtonCancel->setText(tr("GEOM_BUT_CANCEL"));
|
||||
myButtonCancel->setAutoDefault(TRUE);
|
||||
btnGrpLayout->addWidget(myButtonCancel, 0, 2);
|
||||
|
||||
/* signals and slots connections */
|
||||
connect(myButtonOk, SIGNAL(clicked()), this, SLOT(accept()));
|
||||
connect(myButtonCancel, SIGNAL(clicked()), this, SLOT(reject()));
|
||||
|
||||
/* Retrieve GeomGUI */
|
||||
myGeomGUI = GEOMBase_Context::GetGeomGUI();
|
||||
|
||||
/* Move widget on the botton right corner of main widget */
|
||||
QAD_Tools::centerWidget(this, parent);
|
||||
}
|
||||
|
||||
|
||||
//======================================================================================
|
||||
// function : ~GEOMBase_aParameterDlg() destructor
|
||||
// purpose : Destroys the object and frees any allocated resources
|
||||
//======================================================================================
|
||||
GEOMBase_aParameterDlg::~GEOMBase_aParameterDlg()
|
||||
{
|
||||
// no need to delete child widgets, Qt does it all for us
|
||||
}
|
||||
|
||||
|
||||
//======================================================================================
|
||||
// function : GEOMBase_aParameterDlg::setValue
|
||||
// purpose : sets value
|
||||
//======================================================================================
|
||||
void GEOMBase_aParameterDlg::setValue(double val)
|
||||
{
|
||||
mySpinBox->setValue(val);
|
||||
}
|
||||
|
||||
|
||||
//======================================================================================
|
||||
// function : GEOMBase_aParameterDlg::getValue
|
||||
// purpose : gets value
|
||||
//======================================================================================
|
||||
double GEOMBase_aParameterDlg::getValue()
|
||||
{
|
||||
return mySpinBox->value();
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
// GEOM GEOMGUI : GUI for Geometry component
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : GEOMBase_aParameterDlg.h
|
||||
// Author : Lucien PIGNOLONI
|
||||
// Module : GEOM
|
||||
// $Header$
|
||||
|
||||
#ifndef GEOMBase_aParameterDLG_H
|
||||
#define GEOMBase_aParameterDLG_H
|
||||
|
||||
#include <qdialog.h>
|
||||
|
||||
class QPushButton;
|
||||
class QAD_SpinBoxDbl;
|
||||
|
||||
class GEOMBase_Context;
|
||||
|
||||
//=================================================================================
|
||||
// class : GEOMBase_aParameterDlg
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class GEOMBase_aParameterDlg : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GEOMBase_aParameterDlg(const char* aValue1 = "25", const char* aTitle1 = "Value :", QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0, const double bottom = -1E6, const double top = +1E6, const int decimals = 6);
|
||||
~GEOMBase_aParameterDlg();
|
||||
|
||||
void setValue(double val);
|
||||
double getValue();
|
||||
|
||||
private:
|
||||
GEOMBase_Context* myGeomGUI; /* Current GeomGUI object */
|
||||
|
||||
QPushButton* myButtonOk;
|
||||
QPushButton* myButtonCancel;
|
||||
QAD_SpinBoxDbl* mySpinBox;
|
||||
|
||||
};
|
||||
|
||||
#endif // GEOMBase_aParameterDlg.h
|
196
src/GEOMBase/GEOMContext.cxx
Normal file
196
src/GEOMBase/GEOMContext.cxx
Normal file
@ -0,0 +1,196 @@
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : GEOMContext.cxx
|
||||
// Author : Damien COQUERET
|
||||
// Module : GEOM
|
||||
// $Header:
|
||||
|
||||
using namespace std;
|
||||
#include "GEOMContext.h"
|
||||
|
||||
#include "QAD_Tools.h"
|
||||
|
||||
/* The object itself created in the static method 'GetOrCreateGEOMBase()' */
|
||||
static GEOMContext* GeomGUI = 0;
|
||||
|
||||
//=======================================================================
|
||||
// function : GEOMContext()
|
||||
// purpose : Constructor
|
||||
//=======================================================================
|
||||
GEOMContext::GEOMContext() :
|
||||
QObject()
|
||||
{
|
||||
mySettings_AddInStudy = false;
|
||||
mySettings_Copy = false;
|
||||
myFatherior = "";
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : ~GEOMContext()
|
||||
// purpose : Destructor
|
||||
//=======================================================================
|
||||
GEOMContext::~GEOMContext()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : GetGEOMContext() static
|
||||
// purpose : Returns current 'GeomGUI' a static pointer
|
||||
//=======================================================================
|
||||
GEOMContext* GEOMContext::GetGeomGUI()
|
||||
{
|
||||
return GeomGUI;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : GetOrCreateGEOMBase()
|
||||
// purpose : Gets or create an object 'GEOMBase' with initialisations
|
||||
// : Returns 'GeomGUI' as a pointer
|
||||
//=======================================================================
|
||||
GEOMContext* GEOMContext::GetOrCreateGeomGUI(QAD_Desktop* desktop)
|
||||
{
|
||||
if(GeomGUI == 0) {
|
||||
GeomGUI = new GEOMContext();
|
||||
GeomGUI->myDesktop = desktop;
|
||||
GeomGUI->myActiveStudy = desktop->getActiveStudy();
|
||||
Engines::Component_var comp = desktop->getEngine("FactoryServer", "GEOM");
|
||||
GeomGUI->myComponentGeom = GEOM::GEOM_Gen::_narrow(comp);
|
||||
|
||||
GeomGUI->myState = -1;
|
||||
GeomGUI->myActiveDialogBox = 0;
|
||||
GeomGUI->myGUILibrary = OSD_SharedLibrary();
|
||||
GeomGUI->mySimulationShape = new AIS_Shape(TopoDS_Shape());
|
||||
GeomGUI->myShadingColor = Quantity_Color(Quantity_NOC_GOLDENROD);
|
||||
|
||||
/* GetCurrentStudy */
|
||||
int studyId = GeomGUI->myActiveStudy->getStudyId();
|
||||
GeomGUI->myComponentGeom->GetCurrentStudy(studyId);
|
||||
GeomGUI->myNbGeom = GeomGUI->myComponentGeom->NbLabels();
|
||||
}
|
||||
else {
|
||||
/* study may have changed */
|
||||
GeomGUI->myActiveStudy = desktop->getActiveStudy();
|
||||
}
|
||||
|
||||
return GeomGUI;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : LoadLibrary()
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
bool GEOMContext::LoadLibrary(QString GUILibrary)
|
||||
{
|
||||
QCString libs;
|
||||
QFileInfo fileInfo;
|
||||
QString GUILib, fileString, dir;
|
||||
|
||||
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 res = myGUILibrary.DlOpen(OSD_RTLD_LAZY);
|
||||
if(!res)
|
||||
cout<<"Can't open library : "<<myGUILibrary.DlError()<<endl;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : SetState()
|
||||
// purpose : Sets myState = aState a private field indicating which methode is active
|
||||
//=======================================================================
|
||||
void GEOMContext::SetState(int aState)
|
||||
{
|
||||
myState = aState;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : ResetState()
|
||||
// purpose : Sets myState = -1 a private field indicating which methode is active
|
||||
//=======================================================================
|
||||
void GEOMContext::ResetState()
|
||||
{
|
||||
myState = -1;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : SetActiveDialogBox()
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void GEOMContext::SetActiveDialogBox(QDialog* aDlg)
|
||||
{
|
||||
myActiveDialogBox = (QDialog*)aDlg;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : EmitSignalDeactivateDialog()
|
||||
// purpose : Emit a signal to deactivate the active dialog Box
|
||||
//=======================================================================
|
||||
void GEOMContext::EmitSignalDeactivateDialog()
|
||||
{
|
||||
emit SignalDeactivateActiveDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : EmitSignalCloseAllDialogs()
|
||||
// purpose : Emit a signal to deactivate all non modal dialogs box
|
||||
//=======================================================================
|
||||
void GEOMContext::EmitSignalCloseAllDialogs()
|
||||
{
|
||||
emit SignalCloseAllDialogs();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//=======================================================================
|
||||
// function : EmitSignalDefaultStepValueChanged()
|
||||
// purpose :
|
||||
//=======================================================================
|
||||
void GEOMContext::EmitSignalDefaultStepValueChanged(double newVal)
|
||||
{
|
||||
emit SignalDefaultStepValueChanged(newVal);
|
||||
return;
|
||||
}
|
131
src/GEOMBase/GEOMContext.h
Normal file
131
src/GEOMBase/GEOMContext.h
Normal file
@ -0,0 +1,131 @@
|
||||
// GEOMCONTEXT
|
||||
//
|
||||
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU Lesser General Public
|
||||
// License as published by the Free Software Foundation; either
|
||||
// version 2.1 of the License.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
//
|
||||
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
|
||||
//
|
||||
//
|
||||
//
|
||||
// File : GEOMContext.h
|
||||
// Author : Damien COQUERET
|
||||
// Module : GEOM
|
||||
// $Header:
|
||||
|
||||
#ifndef GEOMCONTEXT_H
|
||||
#define GEOMCONTEXT_H
|
||||
|
||||
// SALOME Includes
|
||||
#include "QAD_Desktop.h"
|
||||
|
||||
#include "GEOM_Client.hxx"
|
||||
#include "GEOM_AISShape.hxx"
|
||||
#include "GEOM_InteractiveObject.hxx"
|
||||
#include "GEOM_Actor.h"
|
||||
#include "GEOM_Sketcher.h"
|
||||
|
||||
// Open CASCADE Includes
|
||||
#include <Quantity_Color.hxx>
|
||||
#include <AIS_ListOfInteractive.hxx>
|
||||
#include <OSD_SharedLibrary.hxx>
|
||||
|
||||
// QT Includes
|
||||
#include <qapplication.h>
|
||||
|
||||
// IDL Headers
|
||||
#include <SALOMEconfig.h>
|
||||
#include CORBA_SERVER_HEADER(GEOM_Gen)
|
||||
#include CORBA_SERVER_HEADER(SALOMEDS)
|
||||
#include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
|
||||
|
||||
enum {POINT_METHOD, CURRENT_SKETCH};
|
||||
|
||||
//=================================================================================
|
||||
// class : GEOMContext
|
||||
// purpose :
|
||||
//=================================================================================
|
||||
class GEOMContext : public QObject
|
||||
{
|
||||
Q_OBJECT /* for QT compatibility */
|
||||
|
||||
public :
|
||||
GEOMContext();
|
||||
~GEOMContext();
|
||||
|
||||
private :
|
||||
QAD_Desktop* myDesktop;
|
||||
QAD_Study* myActiveStudy;
|
||||
QDialog* myActiveDialogBox; /* Unique active dialog box */
|
||||
|
||||
int myNbGeom; /* Unique name for a geom entity */
|
||||
int myState; /* Identify a method */
|
||||
|
||||
GEOM_Client myShapeReader;
|
||||
Standard_CString myFatherior;
|
||||
AIS_ListOfInteractive myListDisplayedObject;
|
||||
Quantity_Color myShadingColor;
|
||||
Handle(AIS_Shape) mySimulationShape; /* AIS shape used only during topo/geom simulations */
|
||||
Sketch mySketcher;
|
||||
|
||||
bool mySettings_AddInStudy;
|
||||
bool mySettings_Copy;
|
||||
|
||||
public :
|
||||
static GEOMContext* GetOrCreateGeomGUI(QAD_Desktop* desktop);
|
||||
static GEOMContext* GetGeomGUI();
|
||||
|
||||
OSD_SharedLibrary myGUILibrary;
|
||||
GEOM::GEOM_Gen_var myComponentGeom;
|
||||
//GEOM::GEOM_Gen_var* GetComponentGeom(){return myComponentGeom;};
|
||||
|
||||
QAD_Desktop* GetDesktop(){return myDesktop;};
|
||||
QAD_Study* GetActiveStudy(){return myActiveStudy;};
|
||||
QDialog* GetActiveDialogBox(){return myActiveDialogBox ;}; /* Returns the active DialogBox */
|
||||
|
||||
int& GetNbGeom(){return myNbGeom;};
|
||||
int& GetState(){return myState;};
|
||||
|
||||
GEOM_Client& GetShapeReader(){return myShapeReader;};
|
||||
Standard_CString& GetFatherior(){return myFatherior;};
|
||||
AIS_ListOfInteractive& GetListDisplayedObject(){return myListDisplayedObject;};
|
||||
Quantity_Color& GetShadingColor(){return myShadingColor;};
|
||||
Handle(AIS_Shape) GetSimulationShape(){return mySimulationShape;};
|
||||
Sketch& GetSketcher(){return mySketcher;};
|
||||
|
||||
bool& GetSettings_AddInStudy(){return mySettings_AddInStudy;};
|
||||
bool& GetSettings_Copy(){return mySettings_Copy;};
|
||||
|
||||
bool LoadLibrary(QString GUILibrary);
|
||||
|
||||
void SetState(int aState);
|
||||
void ResetState(); /* Sets myState = -1 a private field to indicate wich method is active */
|
||||
void SetActiveDialogBox(QDialog* aDlg); /* Sets 'myActiveDialogBox' a pointer to the active Dialog Box */
|
||||
|
||||
/* Non modal dialog boxes magement */
|
||||
void EmitSignalDeactivateDialog();
|
||||
void EmitSignalCloseAllDialogs();
|
||||
void EmitSignalDefaultStepValueChanged(double newVal);
|
||||
|
||||
signals :
|
||||
void SignalDeactivateActiveDialog();
|
||||
void SignalCloseAllDialogs();
|
||||
void SignalDefaultStepValueChanged(double newVal);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
# GEOM GEOMBASE :
|
||||
# GEOM GEOMCONTEXT :
|
||||
#
|
||||
# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
|
||||
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
|
||||
@ -35,7 +35,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl
|
||||
@COMMENCE@
|
||||
|
||||
# Libraries targets
|
||||
LIB = libGEOMBase.la
|
||||
LIB = libGEOMContext.la
|
||||
|
||||
# ressources files
|
||||
PO_FILES = \
|
||||
@ -44,30 +44,12 @@ PO_FILES = \
|
||||
GEOM_msg_fr.po
|
||||
|
||||
# header files
|
||||
EXPORT_HEADERS= GEOMBase_Context.h \
|
||||
GEOMBase_Skeleton.h \
|
||||
GEOMBase_Tools.h \
|
||||
GEOMBase_Display.h \
|
||||
GEOMBase_Sketcher.h
|
||||
EXPORT_HEADERS= GEOMContext.h
|
||||
|
||||
LIB_SRC = GEOMBase_Context.cxx \
|
||||
GEOMBase_Skeleton.cxx \
|
||||
GEOMBase_Tools.cxx \
|
||||
GEOMBase_Display.cxx \
|
||||
GEOMBase_aParameterDlg.cxx \
|
||||
GEOMBase_NbIsosDlg.cxx \
|
||||
GEOMBase_TransparencyDlg.cxx \
|
||||
GEOMBase_Sketcher.cxx
|
||||
LIB_SRC = GEOMContext.cxx
|
||||
|
||||
LIB_MOC = \
|
||||
GEOMBase_Context.h \
|
||||
GEOMBase_Skeleton.h \
|
||||
GEOMBase_Tools.h \
|
||||
GEOMBase_Display.h \
|
||||
GEOMBase_aParameterDlg.h \
|
||||
GEOMBase_NbIsosDlg.h \
|
||||
GEOMBase_TransparencyDlg.h \
|
||||
GEOMBase_Sketcher.h
|
||||
GEOMContext.h
|
||||
|
||||
LIB_CLIENT_IDL = SALOME_Exception.idl \
|
||||
GEOM_Gen.idl \
|
||||
@ -84,6 +66,6 @@ LIB_SERVER_IDL =
|
||||
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
|
||||
|
||||
LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lGEOMSketcher -lDlgRef $(OCC_KERNEL_LIBS) $(OCC_MODELER_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome
|
||||
LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMSketcher -L${KERNEL_ROOT_DIR}/lib/salome
|
||||
|
||||
@CONCLUDE@
|
||||
|
@ -32,6 +32,6 @@ VPATH=.:@srcdir@
|
||||
|
||||
@COMMENCE@
|
||||
|
||||
SUBDIRS = OBJECT SKETCHER ARCHIMEDE PARTITION GEOMDS GEOM GEOMClient GEOMFiltersSelection DlgRef GEOMBase BasicGUI PrimitiveGUI GenerationGUI BuildGUI BooleanGUI TransformationGUI OperationGUI RepairGUI MeasureGUI GEOMGUI GEOM_SWIG
|
||||
SUBDIRS = OBJECT SKETCHER ARCHIMEDE PARTITION GEOMDS GEOM GEOMClient GEOMFiltersSelection DlgRef GEOMContext GEOMBase DisplayGUI GEOMToolsGUI BasicGUI PrimitiveGUI GenerationGUI BuildGUI BooleanGUI TransformationGUI OperationGUI RepairGUI MeasureGUI GEOMGUI GEOM_SWIG
|
||||
|
||||
@MODULE@
|
||||
|
Loading…
Reference in New Issue
Block a user