diff --git a/src/DlgRef/UIFiles/DlgRef_Skeleton_QTD.ui b/src/DlgRef/UIFiles/DlgRef_Skeleton_QTD.ui index 0c6e57718..eed5c27f4 100644 --- a/src/DlgRef/UIFiles/DlgRef_Skeleton_QTD.ui +++ b/src/DlgRef/UIFiles/DlgRef_Skeleton_QTD.ui @@ -8,8 +8,8 @@ 0 0 - 307 - 147 + 321 + 295 @@ -51,6 +51,22 @@ 6 + + GroupMedium + + + + 7 + 7 + 0 + 0 + + + + + + + GroupButtons @@ -203,19 +219,51 @@ - GroupMedium - - - - 7 - 7 - 0 - 0 - + GroupBoxName - + Result name + + + unnamed + + + 11 + + + 6 + + + + Layout66 + + + + unnamed + + + 0 + + + 6 + + + + ResultName + + + + + NameLabel + + + Name + + + + + diff --git a/src/EntityGUI/EntityGUI.cxx b/src/EntityGUI/EntityGUI.cxx index f83cec33c..049b4fe00 100644 --- a/src/EntityGUI/EntityGUI.cxx +++ b/src/EntityGUI/EntityGUI.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header: -using namespace std; #include "EntityGUI.h" #include "QAD_RightFrame.h" @@ -36,18 +35,18 @@ using namespace std; #include "SALOMEGUI_ImportOperation.h" #include "SALOMEGUI_QtCatchCorbaException.hxx" -#include -#include #include -#include #include -#include #include -#include -#include #include "DisplayGUI.h" -#include "EntityGUI_SubShapeDlg.h" // Method SUBSHAPE + +#include "EntityGUI_SketcherDlg.h" // Sketcher +#include "EntityGUI_SubShapeDlg.h" // Method SUBSHAPE + +#include "utilities.h" + +using namespace std; //======================================================================= // function : EntityGUI() @@ -59,6 +58,9 @@ EntityGUI::EntityGUI() : myGeomBase = new GEOMBase(); myGeomGUI = GEOMContext::GetGeomGUI(); myGeom = myGeomGUI->myComponentGeom; + + mySimulationShape1 = new AIS_Shape(TopoDS_Shape()); + mySimulationShape2 = new AIS_Shape(TopoDS_Shape()); } @@ -81,126 +83,12 @@ bool EntityGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) myEntityGUI->myGeomGUI->EmitSignalDeactivateDialog(); SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); - QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); - switch (theCommandID) { case 404: // SKETCHER { ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->onViewTop(); // DCQ : 28/02/2002 - - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - - myEntityGUI->myGeomGUI->GetSketcher() = Sketch(v3d->getViewer3d()); - myEntityGUI->myGeomGUI->myState = 2; - - Mb->setItemChecked(4052, false); - Mb->setItemChecked(4053, false); - - myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(LENGTH_PARAMETER, Mb->isItemChecked(4061)); - myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(ANGLE_PARAMETER, Mb->isItemChecked(4062)); - myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(RADIUS_PARAMETER, Mb->isItemChecked(4063)); - myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(XVALUE_PARAMETER, Mb->isItemChecked(4064)); - myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(YVALUE_PARAMETER, Mb->isItemChecked(4065)); - - myEntityGUI->myGeomGUI->GetSketcher().SetTransitionStatus(NOCONSTRAINT); - break; - } - case 4041: // SKETCH Segment - { - myEntityGUI->myGeomGUI->GetSketcher().ChangeMode(SEGMENT); - break; - } - case 4042: // SKETCH Arc - { - myEntityGUI->myGeomGUI->GetSketcher().ChangeMode(ARC_CHORD); - break; - } - case 4043: // SKETCH Set Angle - { - myEntityGUI->OnSketchSetAngle(); - break; - } - case 4044: // SKETCH Set X - { - myEntityGUI->OnSketchSetx(); - break; - } - case 4045: // SKETCH Set Y - { - myEntityGUI->OnSketchSety(); - break; - } - case 4046: // SKETCH Delete - { - myEntityGUI->OnSketchDelete(); - break; - } - case 4047: // SKETCH End - { - myEntityGUI->OnSketchEnd(); - break; - } - case 4048: // SKETCH Close - { - myEntityGUI->OnSketchClose(); - break; - } - case 4051: // sketcher Set Plane - { - //TO DO - break; - } - case 4052: // sketcher TANGENT - { - Mb->setItemChecked(theCommandID, !Mb->isItemChecked(theCommandID)); - if(Mb->isItemChecked(theCommandID) == true) - myEntityGUI->myGeomGUI->GetSketcher().SetTransitionStatus(TANGENT); - else - myEntityGUI->myGeomGUI->GetSketcher().SetTransitionStatus(NOCONSTRAINT); - - Mb->setItemChecked(4053, false); - break; - } - case 4053: // sketcher PERPENDICULAR - { - Mb->setItemChecked(theCommandID, !Mb->isItemChecked(theCommandID)); - if(Mb->isItemChecked(theCommandID) == true) - myEntityGUI->myGeomGUI->GetSketcher().SetTransitionStatus(PERPENDICULAR); - else - myEntityGUI->myGeomGUI->GetSketcher().SetTransitionStatus(NOCONSTRAINT); - - Mb->setItemChecked(4052, false); - break; - } - case 4061: // SKETCH OptionsOnofflengthdimension - { - Mb->setItemChecked(theCommandID, !Mb->isItemChecked(theCommandID)); - myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(LENGTH_PARAMETER, Mb->isItemChecked(theCommandID)); - break; - } - case 4062: // SKETCH OptionsOnoffangledimension - { - Mb->setItemChecked(theCommandID, !Mb->isItemChecked(theCommandID)); - myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(ANGLE_PARAMETER, Mb->isItemChecked(theCommandID)); - break; - } - case 4063: // SKETCH OptionsOnoffradiusdimension - { - Mb->setItemChecked(theCommandID, !Mb->isItemChecked(theCommandID)); - myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(RADIUS_PARAMETER, Mb->isItemChecked(theCommandID)); - break; - } - case 4064: // SKETCH OptionsOnoffxdimension - { - Mb->setItemChecked(theCommandID, !Mb->isItemChecked(theCommandID)); - myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(XVALUE_PARAMETER, Mb->isItemChecked(theCommandID)); - break; - } - case 4065: // SKETCH OptionsOnoffydimension - { - Mb->setItemChecked(theCommandID, !Mb->isItemChecked(theCommandID)); - myEntityGUI->myGeomGUI->GetSketcher().SetParameterVisibility(YVALUE_PARAMETER, Mb->isItemChecked(theCommandID)); + EntityGUI_SketcherDlg* aDlg = new EntityGUI_SketcherDlg(parent, "", myEntityGUI, Sel); break; } case 407: // EXPLODE : use ic @@ -223,258 +111,101 @@ bool EntityGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) } -//======================================================================= -// function : OnSketchSetAngle() -// purpose : -//======================================================================= -void EntityGUI::OnSketchSetAngle() -{ - Standard_Real anAngle = myGeomGUI->GetSketcher().GetSegmentAngle()/PI180; - Sketch::fitInResol(anAngle); - Standard_Boolean res = false; - QString Value = QString("%1").arg(anAngle); - anAngle = myGeomBase->Parameter(res, Value, tr("GEOM_MEN_ANGLE"), tr("GEOM_MEN_ENTER_ANGLE"), - -180.0, +180.0, 6) * PI180; - - if(res) { - myGeomGUI->GetSketcher().SetSegmentAngle(anAngle); - QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); - Mb->setItemChecked(4052, false); - Mb->setItemChecked(4053, false); - } - return; -} - - -//======================================================================= -// function : OnSketchSetx() -// purpose : -//======================================================================= -void EntityGUI::OnSketchSetx() -{ - Standard_Boolean res = false; - double X = myGeomBase->Parameter(res, "0.", tr("GEOM_MEN_X"), tr("GEOM_MEN_SKETCHER_X"), - 2.0 * Precision::Confusion(), 1E6, 6); - if(res) - myGeomGUI->GetSketcher().SetXDimension(X); - QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); - Mb->setItemChecked(4052, false); - Mb->setItemChecked(4053, false); - return; -} - - -//======================================================================= -// function : OnSketchSety() -// purpose : -//======================================================================= -void EntityGUI::OnSketchSety() -{ - Standard_Boolean res = false; - double Y = myGeomBase->Parameter(res, "0.", tr("GEOM_MEN_Y"), tr("GEOM_MEN_SKETCHER_Y"), 2.0 * Precision::Confusion(), 1E6, 6); - if(res) - myGeomGUI->GetSketcher().SetYDimension(Y); - QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); - Mb->setItemChecked(4052, false); - Mb->setItemChecked(4053, false); - return; -} - - -//======================================================================= -// function : OnSketchDelete() -// purpose : -//======================================================================= -void EntityGUI::OnSketchDelete() -{ - if(myGeomGUI->GetSketcher().GetmyEdgesNumber() == 1) { - QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); - Mb->setItemEnabled(405, false); // SKETCH CONTRAINTS - myGeomGUI->GetSketcher().SetTransitionStatus(NOCONSTRAINT); - } - - if(myGeomGUI->GetSketcher().Delete()) - myGeomGUI->myState = -1; - return; -} - - -//======================================================================= -// function : OnSketchClose() -// purpose : -//======================================================================= -void EntityGUI::OnSketchClose() -{ - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle(AIS_InteractiveContext) myContext = v3d->getAISContext(); - - TopoDS_Wire W = myGeomGUI->GetSketcher().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; - myGeomBase->GetShapeTypeString(S,type); - Wire->NameType(type); - - if(myGeomBase->Display(Wire)) - QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); - } - myGeomGUI->myState = -1; - QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); - Mb->setItemEnabled(405, false); // SKETCH CONTRAINTS - myGeomGUI->GetSketcher().SetTransitionStatus(NOCONSTRAINT); - return; -} - - //======================================================================= // function : OnSketchEnd() // purpose : //======================================================================= -void EntityGUI::OnSketchEnd() +void EntityGUI::OnSketchEnd(const char *Cmd) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) myContext = v3d->getAISContext(); - - TopoDS_Wire W = myGeomGUI->GetSketcher().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(); + try { + GEOM::GEOM_Shape_var result = myGeom->MakeSketcher(Cmd); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + return; } - - GEOM::GEOM_Shape_var Wire = myGeom->MakeWire(listShapes); - TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, Wire); - Standard_CString type; - myGeomBase->GetShapeTypeString(S,type); - Wire->NameType(type); - - if(myGeomBase->Display(Wire)) + result->NameType(tr("GEOM_WIRE")); + if(myGeomBase->Display(result)) QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); } - myGeomGUI->myState = -1; - QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); - Mb->setItemEnabled(405, false); // SKETCH CONTRAINTS - myGeomGUI->GetSketcher().SetTransitionStatus(NOCONSTRAINT); + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } return; } +//===================================================================================== +// function : DisplaySimulationShape() +// purpose : Displays 'this->mySimulationShape' a pure graphical shape from a TopoDS_Shape +//===================================================================================== +void EntityGUI::DisplaySimulationShape(const TopoDS_Shape& S1, const TopoDS_Shape& S2) +{ + //NRI DEBUG : 14/02/2002 + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + return; + + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); + try { + if(!S1.IsNull()) { + /* erase any previous */ + ic->Erase(mySimulationShape1, Standard_True, Standard_False); + ic->ClearPrs(mySimulationShape1); + + mySimulationShape1 = new AIS_Shape(TopoDS_Shape()); + mySimulationShape1->Set(S1); + mySimulationShape1->SetColor(Quantity_NOC_RED); + + ic->Deactivate(mySimulationShape1); + ic->Display(mySimulationShape1, Standard_False); + mySimulationShape1->UnsetColor(); + } + if(!S2.IsNull()) { + ic->Erase(mySimulationShape2, Standard_True, Standard_False); + ic->ClearPrs(mySimulationShape2); + + mySimulationShape2 = new AIS_Shape(TopoDS_Shape()); + mySimulationShape2->Set(S2); + mySimulationShape2->SetColor(Quantity_NOC_VIOLET); + + ic->Deactivate(mySimulationShape2); + ic->Display(mySimulationShape2, Standard_False); + mySimulationShape2->UnsetColor(); + } + ic->UpdateCurrentViewer(); + } + catch(Standard_Failure) { + MESSAGE("Exception catched in EntityGUI::DisplaySimulationShape "); + } + return; +} + + +//================================================================================== +// function : EraseSimulationShape() +// purpose : Clears the display of 'mySimulationShape' a pure graphical shape +//================================================================================== +void EntityGUI::EraseSimulationShape(int Sh) +{ + int count = QAD_Application::getDesktop()->getActiveStudy()->getStudyFramesCount(); + for(int i = 0; i < count; i++) { + if(QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i)->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i)->getRightFrame()->getViewFrame())->getViewer(); + Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); + if(Sh < 1) { + ic->Erase(mySimulationShape1, Standard_True, Standard_False); + ic->ClearPrs(mySimulationShape1); + } + if(Sh <= 1) { + ic->Erase(mySimulationShape2, Standard_True, Standard_False); + ic->ClearPrs(mySimulationShape2); + } + ic->UpdateCurrentViewer(); + } + } +} + + //===================================================================================== // function : SObjectExist() // purpose : diff --git a/src/EntityGUI/EntityGUI.h b/src/EntityGUI/EntityGUI.h index 863e310ed..9ecb56744 100644 --- a/src/EntityGUI/EntityGUI.h +++ b/src/EntityGUI/EntityGUI.h @@ -45,14 +45,10 @@ public : static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); - /* Sketcher management */ - void OnSketchSetAngle(); - void OnSketchSetx(); - void OnSketchSety(); - - void OnSketchDelete(); - void OnSketchClose(); - void OnSketchEnd(); + void OnSketchEnd(const char *Cmd); + + void DisplaySimulationShape(const TopoDS_Shape& S1, const TopoDS_Shape& S2); + void EraseSimulationShape(int Sh = 0); /* Methods for sub shapes explode */ bool SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* IOR); @@ -60,6 +56,10 @@ public : bool OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType, Standard_Integer& aLocalContextId, bool& myUseLocalContext); + /* AIS shape used only during topo/geom simulations */ + Handle(AIS_Shape) mySimulationShape1; + Handle(AIS_Shape) mySimulationShape2; + GEOMBase* myGeomBase; GEOMContext* myGeomGUI; GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ diff --git a/src/EntityGUI/EntityGUI_1Sel_QTD.cxx b/src/EntityGUI/EntityGUI_1Sel_QTD.cxx new file mode 100644 index 000000000..01584de8f --- /dev/null +++ b/src/EntityGUI/EntityGUI_1Sel_QTD.cxx @@ -0,0 +1,94 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'EntityGUI_1Sel_QTD.ui' +** +** Created: Fri Apr 30 11:23:36 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "EntityGUI_1Sel_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a EntityGUI_1Sel_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +EntityGUI_1Sel_QTD::EntityGUI_1Sel_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "EntityGUI_1Sel_QTD" ); + resize( 245, 110 ); + setCaption( trUtf8( "EntityGUI_1Sel_QTD" ) ); + EntityGUI_1Sel_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "EntityGUI_1Sel_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "Values" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout3 = new QGridLayout( 0, 1, 1, 0, 6, "Layout3"); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + buttonUndo = new QPushButton( GroupBox1, "buttonUndo" ); + buttonUndo->setText( trUtf8( "Undo" ) ); + + Layout2->addWidget( buttonUndo, 1, 0 ); + + buttonApply = new QPushButton( GroupBox1, "buttonApply" ); + buttonApply->setText( trUtf8( "Create" ) ); + + Layout2->addWidget( buttonApply, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 0, 51, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout2->addItem( spacer, 2, 0 ); + + Layout3->addLayout( Layout2, 0, 1 ); + + 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_2 = new QSpacerItem( 0, 180, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer_2, 1, 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" ); + LineEdit1->setFocusPolicy( QLineEdit::NoFocus ); + + Layout1->addWidget( LineEdit1, 0, 2 ); + + Layout3->addLayout( Layout1, 0, 0 ); + + GroupBox1Layout->addLayout( Layout3, 0, 0 ); + + EntityGUI_1Sel_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_1Sel_QTD::~EntityGUI_1Sel_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/EntityGUI/EntityGUI_1Sel_QTD.h b/src/EntityGUI/EntityGUI_1Sel_QTD.h new file mode 100644 index 000000000..915cda9c4 --- /dev/null +++ b/src/EntityGUI/EntityGUI_1Sel_QTD.h @@ -0,0 +1,46 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'EntityGUI_1Sel_QTD.ui' +** +** Created: Fri Apr 30 11:23:32 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef ENTITYGUI_1SEL_QTD_H +#define ENTITYGUI_1SEL_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QPushButton; + +class EntityGUI_1Sel_QTD : public QWidget +{ + Q_OBJECT + +public: + EntityGUI_1Sel_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_1Sel_QTD(); + + QGroupBox* GroupBox1; + QPushButton* buttonUndo; + QPushButton* buttonApply; + QLabel* TextLabel1; + QPushButton* PushButton1; + QLineEdit* LineEdit1; + + +protected: + QGridLayout* EntityGUI_1Sel_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout3; + QGridLayout* Layout2; + QGridLayout* Layout1; +}; + +#endif // ENTITYGUI_1SEL_QTD_H diff --git a/src/KinematicGUI/KinematicGUI_3Sel1Spin.cxx b/src/EntityGUI/EntityGUI_1Spin.cxx similarity index 78% rename from src/KinematicGUI/KinematicGUI_3Sel1Spin.cxx rename to src/EntityGUI/EntityGUI_1Spin.cxx index b4e46acd9..131a45500 100644 --- a/src/KinematicGUI/KinematicGUI_3Sel1Spin.cxx +++ b/src/EntityGUI/EntityGUI_1Spin.cxx @@ -21,34 +21,36 @@ // // // -// File : KinematicGUI_3Sel1Spin.cxx +// File : EntityGUI_1Spin.cxx // Author : Damien COQUERET // Module : GEOM // $Header: -#include "KinematicGUI_3Sel1Spin.h" +#include "EntityGUI_1Spin.h" #include #include #include /* - * Constructs a KinematicGUI_3Sel1Spin which is a child of 'parent', with the + * Constructs a EntityGUI_1Spin which is a child of 'parent', with the * name 'name' and widget flags set to 'f' */ -KinematicGUI_3Sel1Spin::KinematicGUI_3Sel1Spin(QWidget* parent, const char* name, WFlags fl) - :KinematicGUI_3Sel1Spin_QTD(parent, name, fl) +EntityGUI_1Spin::EntityGUI_1Spin(QWidget* parent, const char* name, WFlags fl) + :EntityGUI_1Spin_QTD(parent, name, fl) { SpinBox1->close(TRUE); + SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX"); - Layout2->addWidget(SpinBox_DX, 0, 1); + Layout1->addWidget(SpinBox_DX, 0, 1); + } /* * Destroys the object and frees any allocated resources */ -KinematicGUI_3Sel1Spin::~KinematicGUI_3Sel1Spin() +EntityGUI_1Spin::~EntityGUI_1Spin() { // no need to delete child widgets, Qt does it all for us } diff --git a/src/KinematicGUI/KinematicGUI_3Sel1Spin.h b/src/EntityGUI/EntityGUI_1Spin.h similarity index 75% rename from src/KinematicGUI/KinematicGUI_3Sel1Spin.h rename to src/EntityGUI/EntityGUI_1Spin.h index 143274ed2..fb5814ca2 100644 --- a/src/KinematicGUI/KinematicGUI_3Sel1Spin.h +++ b/src/EntityGUI/EntityGUI_1Spin.h @@ -21,27 +21,27 @@ // // // -// File : KinematicGUI_3Sel1Spin.h +// File : EntityGUI_1Spin.h // Author : Damien COQUERET // Module : GEOM // $Header: -#ifndef KINEMATICGUI_3SEL1SPIN_H -#define KINEMATICGUI_3SEL1SPIN_H +#ifndef ENTITYGUI_1SPIN_H +#define ENTITYGUI_1SPIN_H -#include "KinematicGUI_3Sel1Spin_QTD.h" +#include "EntityGUI_1Spin_QTD.h" #include "DlgRef_SpinBox.h" -class KinematicGUI_3Sel1Spin : public KinematicGUI_3Sel1Spin_QTD +class EntityGUI_1Spin : public EntityGUI_1Spin_QTD { Q_OBJECT public: - KinematicGUI_3Sel1Spin( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); - ~KinematicGUI_3Sel1Spin(); + EntityGUI_1Spin(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); + ~EntityGUI_1Spin(); DlgRef_SpinBox* SpinBox_DX; }; -#endif // KINEMATICGUI_3SEL1SPIN_H +#endif // ENTITYGUI_1SPIN_H diff --git a/src/EntityGUI/EntityGUI_1Spin_QTD.cxx b/src/EntityGUI/EntityGUI_1Spin_QTD.cxx new file mode 100644 index 000000000..20f21d295 --- /dev/null +++ b/src/EntityGUI/EntityGUI_1Spin_QTD.cxx @@ -0,0 +1,88 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'EntityGUI_1Spin_QTD.ui' +** +** Created: ven déc 12 11:17:10 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "EntityGUI_1Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a EntityGUI_1Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +EntityGUI_1Spin_QTD::EntityGUI_1Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "EntityGUI_1Spin_QTD" ); + resize( 154, 96 ); + setCaption( trUtf8( "EntityGUI_1Spin_QTD" ) ); + EntityGUI_1Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "EntityGUI_1Spin_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "Values" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout3 = new QGridLayout( 0, 1, 1, 0, 6, "Layout3"); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + buttonUndo = new QPushButton( GroupBox1, "buttonUndo" ); + buttonUndo->setText( trUtf8( "Undo" ) ); + + Layout2->addWidget( buttonUndo, 1, 0 ); + + buttonApply = new QPushButton( GroupBox1, "buttonApply" ); + buttonApply->setText( trUtf8( "Create" ) ); + + Layout2->addWidget( buttonApply, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 0, 51, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout2->addItem( spacer, 2, 0 ); + + Layout3->addLayout( Layout2, 0, 1 ); + + 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 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox1, 0, 1 ); + QSpacerItem* spacer_2 = new QSpacerItem( 0, 82, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer_2, 3, 1 ); + + Layout3->addLayout( Layout1, 0, 0 ); + + GroupBox1Layout->addLayout( Layout3, 0, 0 ); + + EntityGUI_1Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_1Spin_QTD::~EntityGUI_1Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/EntityGUI/EntityGUI_1Spin_QTD.h b/src/EntityGUI/EntityGUI_1Spin_QTD.h new file mode 100644 index 000000000..b44238263 --- /dev/null +++ b/src/EntityGUI/EntityGUI_1Spin_QTD.h @@ -0,0 +1,45 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'EntityGUI_1Spin_QTD.ui' +** +** Created: ven déc 12 11:17:10 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef ENTITYGUI_1SPIN_QTD_H +#define ENTITYGUI_1SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QPushButton; +class QSpinBox; + +class EntityGUI_1Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + EntityGUI_1Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_1Spin_QTD(); + + QGroupBox* GroupBox1; + QPushButton* buttonUndo; + QPushButton* buttonApply; + QLabel* TextLabel1; + QSpinBox* SpinBox1; + + +protected: + QGridLayout* EntityGUI_1Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout3; + QGridLayout* Layout2; + QGridLayout* Layout1; +}; + +#endif // ENTITYGUI_1SPIN_QTD_H diff --git a/src/EntityGUI/EntityGUI_2Spin.cxx b/src/EntityGUI/EntityGUI_2Spin.cxx new file mode 100644 index 000000000..b71d731ae --- /dev/null +++ b/src/EntityGUI/EntityGUI_2Spin.cxx @@ -0,0 +1,60 @@ +// 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 : EntityGUI_2Spin.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "EntityGUI_2Spin.h" + +#include +#include +#include + +/* + * Constructs a EntityGUI_2Spin which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +EntityGUI_2Spin::EntityGUI_2Spin(QWidget* parent, const char* name, WFlags fl) + :EntityGUI_2Spin_QTD(parent, name, fl) +{ + SpinBox1->close(TRUE); + SpinBox2->close(TRUE); + + SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX"); + Layout1->addWidget(SpinBox_DX, 0, 1); + + SpinBox_DY = new DlgRef_SpinBox(GroupBox1, "SpinBox_DY"); + Layout1->addWidget(SpinBox_DY, 1, 1); + +} + + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_2Spin::~EntityGUI_2Spin() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/EntityGUI/EntityGUI_2Spin.h b/src/EntityGUI/EntityGUI_2Spin.h new file mode 100644 index 000000000..4d0dd21a3 --- /dev/null +++ b/src/EntityGUI/EntityGUI_2Spin.h @@ -0,0 +1,48 @@ +// 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 : EntityGUI_2Spin.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef ENTITYGUI_2SPIN_H +#define ENTITYGUI_2SPIN_H + +#include "EntityGUI_2Spin_QTD.h" +#include "DlgRef_SpinBox.h" + +class EntityGUI_2Spin : public EntityGUI_2Spin_QTD +{ + Q_OBJECT + +public: + EntityGUI_2Spin(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); + ~EntityGUI_2Spin(); + + DlgRef_SpinBox* SpinBox_DX; + DlgRef_SpinBox* SpinBox_DY; + +}; + +#endif // ENTITYGUI_2SPIN_H diff --git a/src/EntityGUI/EntityGUI_2Spin_QTD.cxx b/src/EntityGUI/EntityGUI_2Spin_QTD.cxx new file mode 100644 index 000000000..a01f2a783 --- /dev/null +++ b/src/EntityGUI/EntityGUI_2Spin_QTD.cxx @@ -0,0 +1,99 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'EntityGUI_2Spin_QTD.ui' +** +** Created: ven déc 12 11:17:11 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "EntityGUI_2Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a EntityGUI_2Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +EntityGUI_2Spin_QTD::EntityGUI_2Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "EntityGUI_2Spin_QTD" ); + resize( 154, 96 ); + setCaption( trUtf8( "EntityGUI_2Spin_QTD" ) ); + EntityGUI_2Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "EntityGUI_2Spin_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "Values" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout3 = new QGridLayout( 0, 1, 1, 0, 6, "Layout3"); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + buttonUndo = new QPushButton( GroupBox1, "buttonUndo" ); + buttonUndo->setText( trUtf8( "Undo" ) ); + + Layout2->addWidget( buttonUndo, 1, 0 ); + + buttonApply = new QPushButton( GroupBox1, "buttonApply" ); + buttonApply->setText( trUtf8( "Create" ) ); + + Layout2->addWidget( buttonApply, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 0, 51, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout2->addItem( spacer, 2, 0 ); + + Layout3->addLayout( Layout2, 0, 1 ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + 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 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox1, 0, 1 ); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox2, 1, 1 ); + QSpacerItem* spacer_2 = new QSpacerItem( 0, 82, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer_2, 3, 1 ); + + Layout3->addLayout( Layout1, 0, 0 ); + + GroupBox1Layout->addLayout( Layout3, 0, 0 ); + + EntityGUI_2Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_2Spin_QTD::~EntityGUI_2Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/EntityGUI/EntityGUI_2Spin_QTD.h b/src/EntityGUI/EntityGUI_2Spin_QTD.h new file mode 100644 index 000000000..4827aa86c --- /dev/null +++ b/src/EntityGUI/EntityGUI_2Spin_QTD.h @@ -0,0 +1,47 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'EntityGUI_2Spin_QTD.ui' +** +** Created: ven déc 12 11:17:10 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef ENTITYGUI_2SPIN_QTD_H +#define ENTITYGUI_2SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QPushButton; +class QSpinBox; + +class EntityGUI_2Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + EntityGUI_2Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_2Spin_QTD(); + + QGroupBox* GroupBox1; + QPushButton* buttonUndo; + QPushButton* buttonApply; + QLabel* TextLabel2; + QLabel* TextLabel1; + QSpinBox* SpinBox1; + QSpinBox* SpinBox2; + + +protected: + QGridLayout* EntityGUI_2Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout3; + QGridLayout* Layout2; + QGridLayout* Layout1; +}; + +#endif // ENTITYGUI_2SPIN_QTD_H diff --git a/src/KinematicGUI/KinematicGUI_3List3Spin.cxx b/src/EntityGUI/EntityGUI_3Spin.cxx similarity index 76% rename from src/KinematicGUI/KinematicGUI_3List3Spin.cxx rename to src/EntityGUI/EntityGUI_3Spin.cxx index 7cbc46c3f..fe73aeba5 100644 --- a/src/KinematicGUI/KinematicGUI_3List3Spin.cxx +++ b/src/EntityGUI/EntityGUI_3Spin.cxx @@ -21,40 +21,43 @@ // // // -// File : KinematicGUI_3List3Spin.cxx +// File : EntityGUI_3Spin.cxx // Author : Damien COQUERET // Module : GEOM // $Header: -#include "KinematicGUI_3List3Spin.h" +#include "EntityGUI_3Spin.h" #include #include #include /* - * Constructs a KinematicGUI_3List3Spin which is a child of 'parent', with the + * Constructs a EntityGUI_3Spin which is a child of 'parent', with the * name 'name' and widget flags set to 'f' */ -KinematicGUI_3List3Spin::KinematicGUI_3List3Spin(QWidget* parent, const char* name, WFlags fl) - :KinematicGUI_3List3Spin_QTD(parent, name, fl) +EntityGUI_3Spin::EntityGUI_3Spin(QWidget* parent, const char* name, WFlags fl) + :EntityGUI_3Spin_QTD(parent, name, fl) { SpinBox1->close(TRUE); SpinBox2->close(TRUE); SpinBox3->close(TRUE); + SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX"); + Layout1->addWidget(SpinBox_DX, 0, 1); + SpinBox_DY = new DlgRef_SpinBox(GroupBox1, "SpinBox_DY"); + Layout1->addWidget(SpinBox_DY, 1, 1); + SpinBox_DZ = new DlgRef_SpinBox(GroupBox1, "SpinBox_DZ"); - Layout1->addWidget(SpinBox_DX, 0, 3); - Layout1->addWidget(SpinBox_DY, 1, 3); - Layout1->addWidget(SpinBox_DZ, 2, 3); + Layout1->addWidget(SpinBox_DZ, 2, 1); } /* * Destroys the object and frees any allocated resources */ -KinematicGUI_3List3Spin::~KinematicGUI_3List3Spin() +EntityGUI_3Spin::~EntityGUI_3Spin() { // no need to delete child widgets, Qt does it all for us } diff --git a/src/KinematicGUI/KinematicGUI_3List3Spin.h b/src/EntityGUI/EntityGUI_3Spin.h similarity index 76% rename from src/KinematicGUI/KinematicGUI_3List3Spin.h rename to src/EntityGUI/EntityGUI_3Spin.h index c1363fafb..58b732d31 100644 --- a/src/KinematicGUI/KinematicGUI_3List3Spin.h +++ b/src/EntityGUI/EntityGUI_3Spin.h @@ -21,24 +21,24 @@ // // // -// File : KinematicGUI_3List3Spin.h +// File : EntityGUI_3Spin.h // Author : Damien COQUERET // Module : GEOM // $Header: -#ifndef KINEMATICGUI_3LIST3SPIN_H -#define KINEMATICGUI_3LIST3SPIN_H +#ifndef ENTITYGUI_3SPIN_H +#define ENTITYGUI_3SPIN_H -#include "KinematicGUI_3List3Spin_QTD.h" +#include "EntityGUI_3Spin_QTD.h" #include "DlgRef_SpinBox.h" -class KinematicGUI_3List3Spin : public KinematicGUI_3List3Spin_QTD +class EntityGUI_3Spin : public EntityGUI_3Spin_QTD { Q_OBJECT public: - KinematicGUI_3List3Spin( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); - ~KinematicGUI_3List3Spin(); + EntityGUI_3Spin( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_3Spin(); DlgRef_SpinBox* SpinBox_DX; DlgRef_SpinBox* SpinBox_DY; @@ -46,4 +46,4 @@ public: }; -#endif // KINEMATICGUI_3LIST3SPIN_H +#endif // ENTITYGUI_3SPIN_H diff --git a/src/EntityGUI/EntityGUI_3Spin_QTD.cxx b/src/EntityGUI/EntityGUI_3Spin_QTD.cxx new file mode 100644 index 000000000..8fa505304 --- /dev/null +++ b/src/EntityGUI/EntityGUI_3Spin_QTD.cxx @@ -0,0 +1,110 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'EntityGUI_3Spin_QTD.ui' +** +** Created: ven déc 12 11:17:11 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "EntityGUI_3Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a EntityGUI_3Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +EntityGUI_3Spin_QTD::EntityGUI_3Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "EntityGUI_3Spin_QTD" ); + resize( 154, 120 ); + setCaption( trUtf8( "EntityGUI_3Spin_QTD" ) ); + EntityGUI_3Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "EntityGUI_3Spin_QTDLayout"); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setTitle( trUtf8( "Values" ) ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + Layout3 = new QGridLayout( 0, 1, 1, 0, 6, "Layout3"); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + buttonUndo = new QPushButton( GroupBox1, "buttonUndo" ); + buttonUndo->setText( trUtf8( "Undo" ) ); + + Layout2->addWidget( buttonUndo, 1, 0 ); + + buttonApply = new QPushButton( GroupBox1, "buttonApply" ); + buttonApply->setText( trUtf8( "Create" ) ); + + Layout2->addWidget( buttonApply, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 0, 51, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout2->addItem( spacer, 2, 0 ); + + Layout3->addLayout( Layout2, 0, 1 ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + Layout1->addWidget( TextLabel2, 1, 0 ); + + 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 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox1, 0, 1 ); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox2, 1, 1 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + Layout1->addWidget( TextLabel3, 2, 0 ); + QSpacerItem* spacer_2 = new QSpacerItem( 0, 82, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer_2, 3, 1 ); + + SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" ); + SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox3, 2, 1 ); + + Layout3->addLayout( Layout1, 0, 0 ); + + GroupBox1Layout->addLayout( Layout3, 0, 0 ); + + EntityGUI_3Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_3Spin_QTD::~EntityGUI_3Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/KinematicGUI/KinematicGUI_3Sel1Spin_QTD.h b/src/EntityGUI/EntityGUI_3Spin_QTD.h similarity index 50% rename from src/KinematicGUI/KinematicGUI_3Sel1Spin_QTD.h rename to src/EntityGUI/EntityGUI_3Spin_QTD.h index dac9815e2..1efc3a5c1 100644 --- a/src/KinematicGUI/KinematicGUI_3Sel1Spin_QTD.h +++ b/src/EntityGUI/EntityGUI_3Spin_QTD.h @@ -1,13 +1,13 @@ /**************************************************************************** -** Form interface generated from reading ui file 'KinematicGUI_3Sel1Spin_QTD.ui' +** Form interface generated from reading ui file 'EntityGUI_3Spin_QTD.ui' ** -** Created: mer fév 4 13:09:40 2004 +** Created: ven déc 12 11:17:11 2003 ** by: The User Interface Compiler (uic) ** ** WARNING! All changes made in this file will be lost! ****************************************************************************/ -#ifndef KINEMATICGUI_3SEL1SPIN_QTD_H -#define KINEMATICGUI_3SEL1SPIN_QTD_H +#ifndef ENTITYGUI_3SPIN_QTD_H +#define ENTITYGUI_3SPIN_QTD_H #include #include @@ -16,37 +16,34 @@ class QHBoxLayout; class QGridLayout; class QGroupBox; class QLabel; -class QLineEdit; class QPushButton; class QSpinBox; -class KinematicGUI_3Sel1Spin_QTD : public QWidget +class EntityGUI_3Spin_QTD : public QWidget { Q_OBJECT public: - KinematicGUI_3Sel1Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); - ~KinematicGUI_3Sel1Spin_QTD(); + EntityGUI_3Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_3Spin_QTD(); QGroupBox* GroupBox1; - QLineEdit* LineEdit1; - QPushButton* PushButton3; - QLabel* TextLabel4; - QSpinBox* SpinBox1; - QLabel* TextLabel3; - QLineEdit* LineEdit3; - QLineEdit* LineEdit2; - QPushButton* PushButton2; + QPushButton* buttonUndo; + QPushButton* buttonApply; QLabel* TextLabel2; QLabel* TextLabel1; - QPushButton* PushButton1; + QSpinBox* SpinBox1; + QSpinBox* SpinBox2; + QLabel* TextLabel3; + QSpinBox* SpinBox3; protected: - QGridLayout* KinematicGUI_3Sel1Spin_QTDLayout; + QGridLayout* EntityGUI_3Spin_QTDLayout; QGridLayout* GroupBox1Layout; - QGridLayout* Layout1; + QGridLayout* Layout3; QGridLayout* Layout2; + QGridLayout* Layout1; }; -#endif // KINEMATICGUI_3SEL1SPIN_QTD_H +#endif // ENTITYGUI_3SPIN_QTD_H diff --git a/src/EntityGUI/EntityGUI_4Spin.cxx b/src/EntityGUI/EntityGUI_4Spin.cxx new file mode 100644 index 000000000..29aa398a1 --- /dev/null +++ b/src/EntityGUI/EntityGUI_4Spin.cxx @@ -0,0 +1,67 @@ +// 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 : EntityGUI_4Spin.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "EntityGUI_4Spin.h" + +#include +#include +#include + +/* + * Constructs a EntityGUI_4Spin which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +EntityGUI_4Spin::EntityGUI_4Spin(QWidget* parent, const char* name, WFlags fl) + :EntityGUI_4Spin_QTD(parent, name, fl) +{ + SpinBox1->close(TRUE); + SpinBox2->close(TRUE); + SpinBox3->close(TRUE); + SpinBox4->close(TRUE); + + SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX"); + Layout1->addWidget(SpinBox_DX, 0, 1); + + SpinBox_DY = new DlgRef_SpinBox(GroupBox1, "SpinBox_DY"); + Layout1->addWidget(SpinBox_DY, 1, 1); + + SpinBox_DZ = new DlgRef_SpinBox(GroupBox1, "SpinBox_DZ"); + Layout1->addWidget(SpinBox_DZ, 2, 1); + + SpinBox_DS = new DlgRef_SpinBox(GroupBox1, "SpinBox_DS"); + Layout1->addWidget(SpinBox_DS, 3, 1); +} + + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_4Spin::~EntityGUI_4Spin() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/EntityGUI/EntityGUI_4Spin.h b/src/EntityGUI/EntityGUI_4Spin.h new file mode 100644 index 000000000..9a97fff1e --- /dev/null +++ b/src/EntityGUI/EntityGUI_4Spin.h @@ -0,0 +1,50 @@ +// 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 : EntityGUI_4Spin.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef ENTITYGUI_4SPIN_H +#define ENTITYGUI_4SPIN_H + +#include "EntityGUI_4Spin_QTD.h" +#include "DlgRef_SpinBox.h" + +class EntityGUI_4Spin : public EntityGUI_4Spin_QTD +{ + Q_OBJECT + +public: + EntityGUI_4Spin( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_4Spin(); + + DlgRef_SpinBox* SpinBox_DX; + DlgRef_SpinBox* SpinBox_DY; + DlgRef_SpinBox* SpinBox_DZ; + DlgRef_SpinBox* SpinBox_DS; + +}; + +#endif // ENTITYGUI_4SPIN_H diff --git a/src/KinematicGUI/KinematicGUI_3List3Spin_QTD.cxx b/src/EntityGUI/EntityGUI_4Spin_QTD.cxx similarity index 50% rename from src/KinematicGUI/KinematicGUI_3List3Spin_QTD.cxx rename to src/EntityGUI/EntityGUI_4Spin_QTD.cxx index 70b92345e..428da7dfb 100644 --- a/src/KinematicGUI/KinematicGUI_3List3Spin_QTD.cxx +++ b/src/EntityGUI/EntityGUI_4Spin_QTD.cxx @@ -1,15 +1,14 @@ /**************************************************************************** -** Form implementation generated from reading ui file 'KinematicGUI_3List3Spin_QTD.ui' +** Form implementation generated from reading ui file 'EntityGUI_4Spin_QTD.ui' ** -** Created: mer fév 4 16:57:37 2004 +** Created: Fri Apr 30 10:56:21 2004 ** by: The User Interface Compiler (uic) ** ** WARNING! All changes made in this file will be lost! ****************************************************************************/ -#include "KinematicGUI_3List3Spin_QTD.h" +#include "EntityGUI_4Spin_QTD.h" #include -#include #include #include #include @@ -19,53 +18,79 @@ #include /* - * Constructs a KinematicGUI_3List3Spin_QTD which is a child of 'parent', with the + * Constructs a EntityGUI_4Spin_QTD which is a child of 'parent', with the * name 'name' and widget flags set to 'f'. */ -KinematicGUI_3List3Spin_QTD::KinematicGUI_3List3Spin_QTD( QWidget* parent, const char* name, WFlags fl ) +EntityGUI_4Spin_QTD::EntityGUI_4Spin_QTD( QWidget* parent, const char* name, WFlags fl ) : QWidget( parent, name, fl ) { if ( !name ) - setName( "KinematicGUI_3List3Spin_QTD" ); - resize( 279, 111 ); - setMinimumSize( QSize( 100, 0 ) ); - setCaption( trUtf8( "KinematicGUI_3List3Spin_QTD" ) ); - KinematicGUI_3List3Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "KinematicGUI_3List3Spin_QTDLayout"); + setName( "EntityGUI_4Spin_QTD" ); + resize( 176, 154 ); + setCaption( trUtf8( "EntityGUI_4Spin_QTD" ) ); + EntityGUI_4Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "EntityGUI_4Spin_QTDLayout"); GroupBox1 = new QGroupBox( this, "GroupBox1" ); - GroupBox1->setTitle( trUtf8( "" ) ); + GroupBox1->setTitle( trUtf8( "Values" ) ); GroupBox1->setColumnLayout(0, Qt::Vertical ); GroupBox1->layout()->setSpacing( 6 ); GroupBox1->layout()->setMargin( 11 ); GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); GroupBox1Layout->setAlignment( Qt::AlignTop ); + Layout3 = new QGridLayout( 0, 1, 1, 0, 6, "Layout3"); + + Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); + + buttonUndo = new QPushButton( GroupBox1, "buttonUndo" ); + buttonUndo->setText( trUtf8( "Undo" ) ); + + Layout2->addWidget( buttonUndo, 1, 0 ); + + buttonApply = new QPushButton( GroupBox1, "buttonApply" ); + buttonApply->setText( trUtf8( "Create" ) ); + + Layout2->addWidget( buttonApply, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 0, 51, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout2->addItem( spacer, 2, 0 ); + + Layout3->addLayout( Layout2, 0, 1 ); + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" ); + SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox3, 2, 1 ); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox2, 1, 1 ); + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); TextLabel2->setText( trUtf8( "TL2" ) ); - Layout1->addWidget( TextLabel2, 0, 2 ); - QSpacerItem* spacer = new QSpacerItem( 0, 100, QSizePolicy::Minimum, QSizePolicy::Expanding ); - Layout1->addItem( spacer, 3, 3 ); + Layout1->addWidget( TextLabel2, 1, 0 ); + QSpacerItem* spacer_2 = new QSpacerItem( 0, 70, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer_2, 4, 1 ); - SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); - SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + SpinBox4 = new QSpinBox( GroupBox1, "SpinBox4" ); + SpinBox4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox4->sizePolicy().hasHeightForWidth() ) ); - Layout1->addWidget( SpinBox1, 0, 3 ); - - TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); - TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); - TextLabel4->setText( trUtf8( "TL4" ) ); - - Layout1->addWidget( TextLabel4, 1, 2 ); + Layout1->addWidget( SpinBox4, 3, 1 ); TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); TextLabel3->setText( trUtf8( "TL3" ) ); - Layout1->addWidget( TextLabel3, 1, 0 ); + Layout1->addWidget( TextLabel3, 2, 0 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + Layout1->addWidget( SpinBox1, 0, 1 ); TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); @@ -73,52 +98,30 @@ KinematicGUI_3List3Spin_QTD::KinematicGUI_3List3Spin_QTD( QWidget* parent, cons Layout1->addWidget( TextLabel1, 0, 0 ); - ComboBox3 = new QComboBox( FALSE, GroupBox1, "ComboBox3" ); - ComboBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, ComboBox3->sizePolicy().hasHeightForWidth() ) ); + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); - Layout1->addWidget( ComboBox3, 2, 1 ); + Layout1->addWidget( TextLabel4, 3, 0 ); - SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); - SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + Layout3->addLayout( Layout1, 0, 0 ); - Layout1->addWidget( SpinBox2, 1, 3 ); + GroupBox1Layout->addLayout( Layout3, 0, 0 ); - SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" ); - SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) ); + EntityGUI_4Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); - Layout1->addWidget( SpinBox3, 2, 3 ); - - TextLabel6 = new QLabel( GroupBox1, "TextLabel6" ); - TextLabel6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel6->sizePolicy().hasHeightForWidth() ) ); - TextLabel6->setText( trUtf8( "TL6" ) ); - - Layout1->addWidget( TextLabel6, 2, 2 ); - - ComboBox1 = new QComboBox( FALSE, GroupBox1, "ComboBox1" ); - ComboBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, ComboBox1->sizePolicy().hasHeightForWidth() ) ); - - Layout1->addWidget( ComboBox1, 0, 1 ); - - ComboBox2 = new QComboBox( FALSE, GroupBox1, "ComboBox2" ); - ComboBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, ComboBox2->sizePolicy().hasHeightForWidth() ) ); - - Layout1->addWidget( ComboBox2, 1, 1 ); - - TextLabel5 = new QLabel( GroupBox1, "TextLabel5" ); - TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) ); - TextLabel5->setText( trUtf8( "TL5" ) ); - - Layout1->addWidget( TextLabel5, 2, 0 ); - - GroupBox1Layout->addLayout( Layout1, 0, 0 ); - - KinematicGUI_3List3Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); + // tab order + setTabOrder( buttonUndo, buttonApply ); + setTabOrder( buttonApply, SpinBox1 ); + setTabOrder( SpinBox1, SpinBox2 ); + setTabOrder( SpinBox2, SpinBox3 ); + setTabOrder( SpinBox3, SpinBox4 ); } /* * Destroys the object and frees any allocated resources */ -KinematicGUI_3List3Spin_QTD::~KinematicGUI_3List3Spin_QTD() +EntityGUI_4Spin_QTD::~EntityGUI_4Spin_QTD() { // no need to delete child widgets, Qt does it all for us } diff --git a/src/KinematicGUI/KinematicGUI_3List3Spin_QTD.h b/src/EntityGUI/EntityGUI_4Spin_QTD.h similarity index 53% rename from src/KinematicGUI/KinematicGUI_3List3Spin_QTD.h rename to src/EntityGUI/EntityGUI_4Spin_QTD.h index 9d8c70251..4aa37176d 100644 --- a/src/KinematicGUI/KinematicGUI_3List3Spin_QTD.h +++ b/src/EntityGUI/EntityGUI_4Spin_QTD.h @@ -1,51 +1,51 @@ /**************************************************************************** -** Form interface generated from reading ui file 'KinematicGUI_3List3Spin_QTD.ui' +** Form interface generated from reading ui file 'EntityGUI_4Spin_QTD.ui' ** -** Created: mer fév 4 16:57:37 2004 +** Created: Fri Apr 30 10:56:17 2004 ** by: The User Interface Compiler (uic) ** ** WARNING! All changes made in this file will be lost! ****************************************************************************/ -#ifndef KINEMATICGUI_3LIST3SPIN_QTD_H -#define KINEMATICGUI_3LIST3SPIN_QTD_H +#ifndef ENTITYGUI_4SPIN_QTD_H +#define ENTITYGUI_4SPIN_QTD_H #include #include class QVBoxLayout; class QHBoxLayout; class QGridLayout; -class QComboBox; class QGroupBox; class QLabel; +class QPushButton; class QSpinBox; -class KinematicGUI_3List3Spin_QTD : public QWidget +class EntityGUI_4Spin_QTD : public QWidget { Q_OBJECT public: - KinematicGUI_3List3Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); - ~KinematicGUI_3List3Spin_QTD(); + EntityGUI_4Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_4Spin_QTD(); QGroupBox* GroupBox1; - QLabel* TextLabel2; - QSpinBox* SpinBox1; - QLabel* TextLabel4; - QLabel* TextLabel3; - QLabel* TextLabel1; - QComboBox* ComboBox3; - QSpinBox* SpinBox2; + QPushButton* buttonUndo; + QPushButton* buttonApply; QSpinBox* SpinBox3; - QLabel* TextLabel6; - QComboBox* ComboBox1; - QComboBox* ComboBox2; - QLabel* TextLabel5; + QSpinBox* SpinBox2; + QLabel* TextLabel2; + QSpinBox* SpinBox4; + QLabel* TextLabel3; + QSpinBox* SpinBox1; + QLabel* TextLabel1; + QLabel* TextLabel4; protected: - QGridLayout* KinematicGUI_3List3Spin_QTDLayout; + QGridLayout* EntityGUI_4Spin_QTDLayout; QGridLayout* GroupBox1Layout; + QGridLayout* Layout3; + QGridLayout* Layout2; QGridLayout* Layout1; }; -#endif // KINEMATICGUI_3LIST3SPIN_QTD_H +#endif // ENTITYGUI_4SPIN_QTD_H diff --git a/src/EntityGUI/EntityGUI_Dir1_QTD.cxx b/src/EntityGUI/EntityGUI_Dir1_QTD.cxx new file mode 100644 index 000000000..40b070b47 --- /dev/null +++ b/src/EntityGUI/EntityGUI_Dir1_QTD.cxx @@ -0,0 +1,80 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'EntityGUI_Dir1_QTD.ui' +** +** Created: ven déc 12 11:17:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "EntityGUI_Dir1_QTD.h" + +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a EntityGUI_Dir1_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +EntityGUI_Dir1_QTD::EntityGUI_Dir1_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "EntityGUI_Dir1_QTD" ); + resize( 131, 123 ); + setCaption( trUtf8( "EntityGUI_Dir1_QTD" ) ); + EntityGUI_Dir1_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "EntityGUI_Dir1_QTDLayout"); + + GroupDir1 = new QButtonGroup( this, "GroupDir1" ); + GroupDir1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupDir1->sizePolicy().hasHeightForWidth() ) ); + GroupDir1->setTitle( trUtf8( "Direction" ) ); + GroupDir1->setColumnLayout(0, Qt::Vertical ); + GroupDir1->layout()->setSpacing( 6 ); + GroupDir1->layout()->setMargin( 11 ); + GroupDir1Layout = new QGridLayout( GroupDir1->layout() ); + GroupDir1Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + RB_Dir12 = new QRadioButton( GroupDir1, "RB_Dir12" ); + RB_Dir12->setText( trUtf8( "Perpendicular" ) ); + + Layout1->addWidget( RB_Dir12, 1, 0 ); + + RB_Dir13 = new QRadioButton( GroupDir1, "RB_Dir13" ); + RB_Dir13->setText( trUtf8( "Tangent" ) ); + + Layout1->addWidget( RB_Dir13, 2, 0 ); + + RB_Dir11 = new QRadioButton( GroupDir1, "RB_Dir11" ); + RB_Dir11->setText( trUtf8( "Angle" ) ); + + Layout1->addWidget( RB_Dir11, 0, 0 ); + + RB_Dir14 = new QRadioButton( GroupDir1, "RB_Dir14" ); + RB_Dir14->setText( trUtf8( "VX-VY" ) ); + + Layout1->addWidget( RB_Dir14, 3, 0 ); + + GroupDir1Layout->addLayout( Layout1, 0, 0 ); + + EntityGUI_Dir1_QTDLayout->addWidget( GroupDir1, 0, 0 ); + + // tab order + setTabOrder( RB_Dir11, RB_Dir12 ); + setTabOrder( RB_Dir12, RB_Dir13 ); + setTabOrder( RB_Dir13, RB_Dir14 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_Dir1_QTD::~EntityGUI_Dir1_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/EntityGUI/EntityGUI_Dir1_QTD.h b/src/EntityGUI/EntityGUI_Dir1_QTD.h new file mode 100644 index 000000000..31a85e8bb --- /dev/null +++ b/src/EntityGUI/EntityGUI_Dir1_QTD.h @@ -0,0 +1,41 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'EntityGUI_Dir1_QTD.ui' +** +** Created: ven déc 12 11:17:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef ENTITYGUI_DIR1_QTD_H +#define ENTITYGUI_DIR1_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QRadioButton; + +class EntityGUI_Dir1_QTD : public QWidget +{ + Q_OBJECT + +public: + EntityGUI_Dir1_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_Dir1_QTD(); + + QButtonGroup* GroupDir1; + QRadioButton* RB_Dir12; + QRadioButton* RB_Dir13; + QRadioButton* RB_Dir11; + QRadioButton* RB_Dir14; + + +protected: + QGridLayout* EntityGUI_Dir1_QTDLayout; + QGridLayout* GroupDir1Layout; + QGridLayout* Layout1; +}; + +#endif // ENTITYGUI_DIR1_QTD_H diff --git a/src/EntityGUI/EntityGUI_Dir2_QTD.cxx b/src/EntityGUI/EntityGUI_Dir2_QTD.cxx new file mode 100644 index 000000000..6fee0814c --- /dev/null +++ b/src/EntityGUI/EntityGUI_Dir2_QTD.cxx @@ -0,0 +1,76 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'EntityGUI_Dir2_QTD.ui' +** +** Created: ven déc 12 11:17:10 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "EntityGUI_Dir2_QTD.h" + +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a EntityGUI_Dir2_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +EntityGUI_Dir2_QTD::EntityGUI_Dir2_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "EntityGUI_Dir2_QTD" ); + resize( 124, 106 ); + setCaption( trUtf8( "EntityGUI_Dir2_QTD" ) ); + EntityGUI_Dir2_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "EntityGUI_Dir2_QTDLayout"); + + GroupDir2 = new QButtonGroup( this, "GroupDir2" ); + GroupDir2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupDir2->sizePolicy().hasHeightForWidth() ) ); + GroupDir2->setTitle( trUtf8( "Direction" ) ); + GroupDir2->setColumnLayout(0, Qt::Vertical ); + GroupDir2->layout()->setSpacing( 6 ); + GroupDir2->layout()->setMargin( 11 ); + GroupDir2Layout = new QGridLayout( GroupDir2->layout() ); + GroupDir2Layout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + RB_Dir22 = new QRadioButton( GroupDir2, "RB_Dir22" ); + RB_Dir22->setText( trUtf8( "X" ) ); + + Layout1->addWidget( RB_Dir22, 1, 0 ); + + RB_Dir23 = new QRadioButton( GroupDir2, "RB_Dir23" ); + RB_Dir23->setText( trUtf8( "Y" ) ); + + Layout1->addWidget( RB_Dir23, 2, 0 ); + QSpacerItem* spacer = new QSpacerItem( 0, 20, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer, 3, 0 ); + + RB_Dir21 = new QRadioButton( GroupDir2, "RB_Dir21" ); + RB_Dir21->setText( trUtf8( "Length" ) ); + + Layout1->addWidget( RB_Dir21, 0, 0 ); + + GroupDir2Layout->addLayout( Layout1, 0, 0 ); + + EntityGUI_Dir2_QTDLayout->addWidget( GroupDir2, 0, 0 ); + + // tab order + setTabOrder( RB_Dir21, RB_Dir22 ); + setTabOrder( RB_Dir22, RB_Dir23 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_Dir2_QTD::~EntityGUI_Dir2_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/EntityGUI/EntityGUI_Dir2_QTD.h b/src/EntityGUI/EntityGUI_Dir2_QTD.h new file mode 100644 index 000000000..04ae7382f --- /dev/null +++ b/src/EntityGUI/EntityGUI_Dir2_QTD.h @@ -0,0 +1,40 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'EntityGUI_Dir2_QTD.ui' +** +** Created: ven déc 12 11:17:09 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef ENTITYGUI_DIR2_QTD_H +#define ENTITYGUI_DIR2_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QRadioButton; + +class EntityGUI_Dir2_QTD : public QWidget +{ + Q_OBJECT + +public: + EntityGUI_Dir2_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_Dir2_QTD(); + + QButtonGroup* GroupDir2; + QRadioButton* RB_Dir22; + QRadioButton* RB_Dir23; + QRadioButton* RB_Dir21; + + +protected: + QGridLayout* EntityGUI_Dir2_QTDLayout; + QGridLayout* GroupDir2Layout; + QGridLayout* Layout1; +}; + +#endif // ENTITYGUI_DIR2_QTD_H diff --git a/src/EntityGUI/EntityGUI_Point_QTD.cxx b/src/EntityGUI/EntityGUI_Point_QTD.cxx new file mode 100644 index 000000000..901a14fe2 --- /dev/null +++ b/src/EntityGUI/EntityGUI_Point_QTD.cxx @@ -0,0 +1,74 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'EntityGUI_Point_QTD.ui' +** +** Created: ven déc 12 11:17:08 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "EntityGUI_Point_QTD.h" + +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a EntityGUI_Point_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +EntityGUI_Point_QTD::EntityGUI_Point_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "EntityGUI_Point_QTD" ); + resize( 124, 106 ); + setCaption( trUtf8( "EntityGUI_Point_QTD" ) ); + EntityGUI_Point_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "EntityGUI_Point_QTDLayout"); + + GroupPoint = new QButtonGroup( this, "GroupPoint" ); + GroupPoint->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupPoint->sizePolicy().hasHeightForWidth() ) ); + GroupPoint->setTitle( trUtf8( "Point" ) ); + GroupPoint->setColumnLayout(0, Qt::Vertical ); + GroupPoint->layout()->setSpacing( 6 ); + GroupPoint->layout()->setMargin( 11 ); + GroupPointLayout = new QGridLayout( GroupPoint->layout() ); + GroupPointLayout->setAlignment( Qt::AlignTop ); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + RB_Point2 = new QRadioButton( GroupPoint, "RB_Point2" ); + RB_Point2->setText( trUtf8( "Relative" ) ); + + Layout1->addWidget( RB_Point2, 1, 0 ); + + RB_Point1 = new QRadioButton( GroupPoint, "RB_Point1" ); + RB_Point1->setText( trUtf8( "Absolute" ) ); + + Layout1->addWidget( RB_Point1, 0, 0 ); + + RB_Point3 = new QRadioButton( GroupPoint, "RB_Point3" ); + RB_Point3->setText( trUtf8( "Selection" ) ); + + Layout1->addWidget( RB_Point3, 2, 0 ); + + GroupPointLayout->addLayout( Layout1, 0, 0 ); + + EntityGUI_Point_QTDLayout->addWidget( GroupPoint, 0, 0 ); + + // tab order + setTabOrder( RB_Point1, RB_Point2 ); + setTabOrder( RB_Point2, RB_Point3 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_Point_QTD::~EntityGUI_Point_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/EntityGUI/EntityGUI_Point_QTD.h b/src/EntityGUI/EntityGUI_Point_QTD.h new file mode 100644 index 000000000..8b58ee2d0 --- /dev/null +++ b/src/EntityGUI/EntityGUI_Point_QTD.h @@ -0,0 +1,40 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'EntityGUI_Point_QTD.ui' +** +** Created: ven déc 12 11:17:08 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef ENTITYGUI_POINT_QTD_H +#define ENTITYGUI_POINT_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QRadioButton; + +class EntityGUI_Point_QTD : public QWidget +{ + Q_OBJECT + +public: + EntityGUI_Point_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_Point_QTD(); + + QButtonGroup* GroupPoint; + QRadioButton* RB_Point2; + QRadioButton* RB_Point1; + QRadioButton* RB_Point3; + + +protected: + QGridLayout* EntityGUI_Point_QTDLayout; + QGridLayout* GroupPointLayout; + QGridLayout* Layout1; +}; + +#endif // ENTITYGUI_POINT_QTD_H diff --git a/src/EntityGUI/EntityGUI_Skeleton_QTD.cxx b/src/EntityGUI/EntityGUI_Skeleton_QTD.cxx new file mode 100644 index 000000000..8298731f4 --- /dev/null +++ b/src/EntityGUI/EntityGUI_Skeleton_QTD.cxx @@ -0,0 +1,176 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'EntityGUI_Skeleton_QTD.ui' +** +** Created: ven déc 12 11:17:08 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "EntityGUI_Skeleton_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a EntityGUI_Skeleton_QTD 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. + */ +EntityGUI_Skeleton_QTD::EntityGUI_Skeleton_QTD( QWidget* parent, const char* name, bool modal, WFlags fl ) + : QDialog( parent, name, modal, fl ) +{ + if ( !name ) + setName( "EntityGUI_Skeleton_QTD" ); + resize( 317, 276 ); + setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 0, sizePolicy().hasHeightForWidth() ) ); + setCaption( trUtf8( "EntityGUI_Skeleton_QTD" ) ); + EntityGUI_Skeleton_QTDLayout = new QGridLayout( this, 1, 1, 11, 6, "EntityGUI_Skeleton_QTDLayout"); + + Layout1 = new QGridLayout( 0, 1, 1, 0, 6, "Layout1"); + + GroupVal = new QGroupBox( this, "GroupVal" ); + GroupVal->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupVal->sizePolicy().hasHeightForWidth() ) ); + GroupVal->setTitle( trUtf8( "" ) ); + + Layout1->addWidget( GroupVal, 2, 0 ); + + GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); + GroupConstructors->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)0, 0, 0, GroupConstructors->sizePolicy().hasHeightForWidth() ) ); + GroupConstructors->setTitle( trUtf8( "Element Type" ) ); + GroupConstructors->setColumnLayout(0, Qt::Vertical ); + GroupConstructors->layout()->setSpacing( 6 ); + GroupConstructors->layout()->setMargin( 11 ); + GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); + GroupConstructorsLayout->setAlignment( Qt::AlignTop ); + + Layout2 = new QHBoxLayout( 0, 0, 6, "Layout2"); + + RadioButton1 = new QRadioButton( GroupConstructors, "RadioButton1" ); + RadioButton1->setText( trUtf8( "Segment" ) ); + Layout2->addWidget( RadioButton1 ); + + RadioButton2 = new QRadioButton( GroupConstructors, "RadioButton2" ); + RadioButton2->setText( trUtf8( "Arc" ) ); + Layout2->addWidget( RadioButton2 ); + + GroupConstructorsLayout->addLayout( Layout2, 0, 0 ); + + Layout1->addWidget( GroupConstructors, 0, 0 ); + + GroupDest = new QGroupBox( this, "GroupDest" ); + GroupDest->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupDest->sizePolicy().hasHeightForWidth() ) ); + GroupDest->setTitle( trUtf8( "Destination" ) ); + GroupDest->setColumnLayout(0, Qt::Vertical ); + GroupDest->layout()->setSpacing( 6 ); + GroupDest->layout()->setMargin( 11 ); + GroupDestLayout = new QGridLayout( GroupDest->layout() ); + GroupDestLayout->setAlignment( Qt::AlignTop ); + + Layout5 = new QGridLayout( 0, 1, 1, 0, 6, "Layout5"); + + GroupDest1 = new QButtonGroup( GroupDest, "GroupDest1" ); + GroupDest1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupDest1->sizePolicy().hasHeightForWidth() ) ); + GroupDest1->setTitle( trUtf8( "Type" ) ); + GroupDest1->setColumnLayout(0, Qt::Vertical ); + GroupDest1->layout()->setSpacing( 6 ); + GroupDest1->layout()->setMargin( 11 ); + GroupDest1Layout = new QGridLayout( GroupDest1->layout() ); + GroupDest1Layout->setAlignment( Qt::AlignTop ); + + Layout4 = new QGridLayout( 0, 1, 1, 0, 6, "Layout4"); + + RB_Dest2 = new QRadioButton( GroupDest1, "RB_Dest2" ); + RB_Dest2->setText( trUtf8( "Direction" ) ); + + Layout4->addWidget( RB_Dest2, 0, 1 ); + + RB_Dest1 = new QRadioButton( GroupDest1, "RB_Dest1" ); + RB_Dest1->setText( trUtf8( "Point" ) ); + + Layout4->addWidget( RB_Dest1, 0, 0 ); + + GroupDest1Layout->addLayout( Layout4, 0, 0 ); + + Layout5->addMultiCellWidget( GroupDest1, 0, 0, 0, 1 ); + + GroupDest2 = new QButtonGroup( GroupDest, "GroupDest2" ); + GroupDest2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupDest2->sizePolicy().hasHeightForWidth() ) ); + GroupDest2->setTitle( trUtf8( "" ) ); + GroupDest2->setColumnLayout(0, Qt::Vertical ); + GroupDest2->layout()->setSpacing( 6 ); + GroupDest2->layout()->setMargin( 11 ); + GroupDest2Layout = new QGridLayout( GroupDest2->layout() ); + GroupDest2Layout->setAlignment( Qt::AlignTop ); + + Layout5->addWidget( GroupDest2, 1, 0 ); + + GroupDest3 = new QButtonGroup( GroupDest, "GroupDest3" ); + GroupDest3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, GroupDest3->sizePolicy().hasHeightForWidth() ) ); + GroupDest3->setTitle( trUtf8( "" ) ); + GroupDest3->setColumnLayout(0, Qt::Vertical ); + GroupDest3->layout()->setSpacing( 6 ); + GroupDest3->layout()->setMargin( 11 ); + GroupDest3Layout = new QGridLayout( GroupDest3->layout() ); + GroupDest3Layout->setAlignment( Qt::AlignTop ); + + Layout5->addWidget( GroupDest3, 1, 1 ); + + GroupDestLayout->addLayout( Layout5, 0, 0 ); + + Layout1->addWidget( GroupDest, 1, 0 ); + + GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, GroupButtons->sizePolicy().hasHeightForWidth() ) ); + GroupButtons->setTitle( trUtf8( "" ) ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 6 ); + GroupButtons->layout()->setMargin( 11 ); + GroupButtonsLayout = new QHBoxLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + + Layout3 = new QHBoxLayout( 0, 0, 6, "Layout3"); + + buttonEnd = new QPushButton( GroupButtons, "buttonEnd" ); + buttonEnd->setText( trUtf8( "End Sketch" ) ); + Layout3->addWidget( buttonEnd ); + + buttonClose = new QPushButton( GroupButtons, "buttonClose" ); + buttonClose->setText( trUtf8( "Close Sketch" ) ); + Layout3->addWidget( buttonClose ); + QSpacerItem* spacer = new QSpacerItem( 91, 0, QSizePolicy::Expanding, QSizePolicy::Minimum ); + Layout3->addItem( spacer ); + + buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + buttonCancel->setText( trUtf8( "&Cancel" ) ); + Layout3->addWidget( buttonCancel ); + GroupButtonsLayout->addLayout( Layout3 ); + + Layout1->addWidget( GroupButtons, 3, 0 ); + + EntityGUI_Skeleton_QTDLayout->addLayout( Layout1, 0, 0 ); + + // tab order + setTabOrder( RadioButton1, RadioButton2 ); + setTabOrder( RadioButton2, RB_Dest1 ); + setTabOrder( RB_Dest1, RB_Dest2 ); + setTabOrder( RB_Dest2, buttonEnd ); + setTabOrder( buttonEnd, buttonClose ); + setTabOrder( buttonClose, buttonCancel ); +} + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_Skeleton_QTD::~EntityGUI_Skeleton_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/EntityGUI/EntityGUI_Skeleton_QTD.h b/src/EntityGUI/EntityGUI_Skeleton_QTD.h new file mode 100644 index 000000000..534f52ca3 --- /dev/null +++ b/src/EntityGUI/EntityGUI_Skeleton_QTD.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'EntityGUI_Skeleton_QTD.ui' +** +** Created: ven déc 12 11:17:07 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef ENTITYGUI_SKELETON_QTD_H +#define ENTITYGUI_SKELETON_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QButtonGroup; +class QGroupBox; +class QPushButton; +class QRadioButton; + +class EntityGUI_Skeleton_QTD : public QDialog +{ + Q_OBJECT + +public: + EntityGUI_Skeleton_QTD( QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0 ); + ~EntityGUI_Skeleton_QTD(); + + QGroupBox* GroupVal; + QButtonGroup* GroupConstructors; + QRadioButton* RadioButton1; + QRadioButton* RadioButton2; + QGroupBox* GroupDest; + QButtonGroup* GroupDest1; + QRadioButton* RB_Dest2; + QRadioButton* RB_Dest1; + QButtonGroup* GroupDest2; + QButtonGroup* GroupDest3; + QGroupBox* GroupButtons; + QPushButton* buttonEnd; + QPushButton* buttonClose; + QPushButton* buttonCancel; + + +protected: + QGridLayout* EntityGUI_Skeleton_QTDLayout; + QGridLayout* Layout1; + QGridLayout* GroupConstructorsLayout; + QHBoxLayout* Layout2; + QGridLayout* GroupDestLayout; + QGridLayout* Layout5; + QGridLayout* GroupDest1Layout; + QGridLayout* Layout4; + QGridLayout* GroupDest2Layout; + QGridLayout* GroupDest3Layout; + QHBoxLayout* GroupButtonsLayout; + QHBoxLayout* Layout3; +}; + +#endif // ENTITYGUI_SKELETON_QTD_H diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.cxx b/src/EntityGUI/EntityGUI_SketcherDlg.cxx new file mode 100644 index 000000000..d91c24544 --- /dev/null +++ b/src/EntityGUI/EntityGUI_SketcherDlg.cxx @@ -0,0 +1,1168 @@ +// 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 : EntityGUI_SketcherDlg.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +using namespace std; +#include "EntityGUI_SketcherDlg.h" +#include "Sketcher_Profile.hxx" +#include "utilities.h" + +#include +#include +#include + +#include + +//================================================================================= +// class : EntityGUI_SketcherDlg() +// purpose : Constructs a EntityGUI_SketcherDlg 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. +//================================================================================= +EntityGUI_SketcherDlg::EntityGUI_SketcherDlg(QWidget* parent, const char* name, EntityGUI* theEntityGUI, SALOME_Selection* Sel, bool modal, WFlags fl) + :EntityGUI_Skeleton_QTD(parent, name, modal, fl) +{ + if (!name) + setName("EntityGUI_SketcherDlg"); + + buttonCancel->setText(tr("GEOM_BUT_CANCEL")); + buttonEnd->setText(tr("GEOM_BUT_END_SKETCH")); + buttonClose->setText(tr("GEOM_BUT_CLOSE_SKETCH")); + GroupVal->close(TRUE); + GroupDest2->close(TRUE); + GroupDest3->close(TRUE); + resize(0, 0); + + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_SKETCHER_TITLE")); + + GroupConstructors->setTitle(tr("GEOM_SKETCHER_EL")); + RadioButton1->setText(tr("GEOM_SKETCHER_SEGMENT")); + RadioButton2->setText(tr("GEOM_SKETCHER_ARC")); + GroupDest->setTitle(tr("GEOM_SKETCHER_DEST")); + GroupDest1->setTitle(tr("GEOM_SKETCHER_TYPE")); + RB_Dest1->setText(tr("GEOM_SKETCHER_POINT")); + RB_Dest2->setText(tr("GEOM_SKETCHER_DIR")); + + /***************************************************************/ + GroupPt = new EntityGUI_Point_QTD(GroupDest, "GroupPt"); + GroupPt->GroupPoint->setTitle(tr("GEOM_SKETCHER_POINT")); + GroupPt->RB_Point1->setText(tr("GEOM_SKETCHER_ABS")); + GroupPt->RB_Point2->setText(tr("GEOM_SKETCHER_REL")); + GroupPt->RB_Point3->setText(tr("GEOM_SKETCHER_SEL")); + + GroupD1 = new EntityGUI_Dir1_QTD(GroupDest, "GroupD1"); + GroupD1->GroupDir1->setTitle(tr("GEOM_SKETCHER_DIR")); + GroupD1->RB_Dir11->setText(tr("GEOM_SKETCHER_ANGLE")); + GroupD1->RB_Dir12->setText(tr("GEOM_SKETCHER_PER")); + GroupD1->RB_Dir13->setText(tr("GEOM_SKETCHER_TAN")); + GroupD1->RB_Dir14->setText(tr("GEOM_SKETCHER_VXVY")); + + GroupD2 = new EntityGUI_Dir2_QTD(GroupDest, "GroupD2"); + GroupD2->GroupDir2->setTitle(tr("GEOM_SKETCHER_DIR")); + GroupD2->RB_Dir21->setText(tr("GEOM_SKETCHER_LENGTH")); + GroupD2->RB_Dir22->setText(tr("GEOM_SKETCHER_X")); + GroupD2->RB_Dir23->setText(tr("GEOM_SKETCHER_Y")); + + Group1Sel = new EntityGUI_1Sel_QTD(this, "Group1Sel"); + Group1Sel->TextLabel1->setText(tr("GEOM_SKETCHER_POINT2")); + Group1Sel->GroupBox1->setTitle(tr("GEOM_SKETCHER_VALUES")); + Group1Sel->buttonUndo->setText(tr("GEOM_SKETCHER_UNDO")); + Group1Sel->buttonApply->setText(tr("GEOM_SKETCHER_APPLY")); + Group1Sel->PushButton1->setPixmap(image0); + + Group1Spin = new EntityGUI_1Spin(this, "Group1Spin"); + Group1Spin->GroupBox1->setTitle(tr("GEOM_SKETCHER_VALUES")); + Group1Spin->buttonUndo->setText(tr("GEOM_SKETCHER_UNDO")); + Group1Spin->buttonApply->setText(tr("GEOM_SKETCHER_APPLY")); + + Group2Spin = new EntityGUI_2Spin(this, "Group2Spin"); + Group2Spin->GroupBox1->setTitle(tr("GEOM_SKETCHER_VALUES")); + Group2Spin->buttonUndo->setText(tr("GEOM_SKETCHER_UNDO")); + Group2Spin->buttonApply->setText(tr("GEOM_SKETCHER_APPLY")); + + Group3Spin = new EntityGUI_3Spin(this, "Group3Spin"); + Group3Spin->GroupBox1->setTitle(tr("GEOM_SKETCHER_VALUES")); + Group3Spin->buttonUndo->setText(tr("GEOM_SKETCHER_UNDO")); + Group3Spin->buttonApply->setText(tr("GEOM_SKETCHER_APPLY")); + + Group4Spin = new EntityGUI_4Spin(this, "Group4Spin"); + Group4Spin->GroupBox1->setTitle(tr("GEOM_SKETCHER_VALUES")); + Group4Spin->buttonUndo->setText(tr("GEOM_SKETCHER_UNDO")); + Group4Spin->buttonApply->setText(tr("GEOM_SKETCHER_APPLY")); + + Layout5->addMultiCellWidget(GroupPt, 1, 1, 0, 1); + Layout5->addWidget(GroupD1, 1, 0); + Layout5->addWidget(GroupD2, 1, 1); + + Layout1->addWidget(Group1Sel, 2, 0); + Layout1->addWidget(Group1Spin, 2, 0); + Layout1->addWidget(Group2Spin, 2, 0); + Layout1->addWidget(Group3Spin, 2, 0); + Layout1->addWidget(Group4Spin, 2, 0); + /***************************************************************/ + + mySelection = Sel; + mySimulationTopoDs1.Nullify(); + mySimulationTopoDs2.Nullify(); + myEntityGUI = theEntityGUI; + + /* Get setting of step value from file configuration */ + QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); + step = St.toDouble(); + + myGeomBase = new GEOMBase(); + myGeomGUI = GEOMContext::GetGeomGUI(); + myGeomGUI->SetActiveDialogBox((QDialog*)this); + myGeom = myGeomGUI->myComponentGeom; + + myVertexFilter = new GEOM_ShapeTypeFilter(TopAbs_VERTEX, myGeom); + mySelection->AddFilter(myVertexFilter); + + /* signals and slots connections */ + connect(buttonEnd, SIGNAL(clicked()), this, SLOT(ClickOnEnd())); + connect(buttonClose, SIGNAL(clicked()), this, SLOT(ClickOnClose())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + + connect(Group1Sel->buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(Group1Sel->buttonUndo, SIGNAL(clicked()), this, SLOT(ClickOnUndo())); + connect(Group1Spin->buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(Group1Spin->buttonUndo, SIGNAL(clicked()), this, SLOT(ClickOnUndo())); + connect(Group2Spin->buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(Group2Spin->buttonUndo, SIGNAL(clicked()), this, SLOT(ClickOnUndo())); + connect(Group3Spin->buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(Group3Spin->buttonUndo, SIGNAL(clicked()), this, SLOT(ClickOnUndo())); + connect(Group4Spin->buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(Group4Spin->buttonUndo, SIGNAL(clicked()), this, SLOT(ClickOnUndo())); + + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(TypeClicked(int))); + connect(GroupDest1, SIGNAL(clicked(int)), this, SLOT(DestClicked(int))); + connect(GroupPt->GroupPoint, SIGNAL(clicked(int)), this, SLOT(PointClicked(int))); + connect(GroupD1->GroupDir1, SIGNAL(clicked(int)), this, SLOT(Dir1Clicked(int))); + connect(GroupD2->GroupDir2, SIGNAL(clicked(int)), this, SLOT(Dir2Clicked(int))); + + connect(Group1Sel->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group1Sel->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(Group1Spin->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group2Spin->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group2Spin->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group3Spin->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group3Spin->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group3Spin->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group4Spin->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group4Spin->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group4Spin->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group4Spin->SpinBox_DS, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group1Spin->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group2Spin->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group2Spin->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3Spin->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3Spin->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3Spin->SpinBox_DZ, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group4Spin->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group4Spin->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group4Spin->SpinBox_DZ, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group4Spin->SpinBox_DS, SLOT(SetStep(double))); + + 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; +// myGeomBase->DefineDlgPosition( this, x, y ); + + myEntityGUI = theEntityGUI; + this->Init(); + this->show(); +} + + +//================================================================================= +// function : ~EntityGUI_SketcherDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +EntityGUI_SketcherDlg::~EntityGUI_SketcherDlg() +{ + // no need to delete child widgets, Qt does it all for us + this->destroy(TRUE, TRUE); +} + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = Group1Sel->LineEdit1; + + /* min, max, step and decimals for spin boxes */ + Group1Spin->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); + Group2Spin->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); + Group2Spin->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3); + Group3Spin->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); + Group3Spin->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3); + Group3Spin->SpinBox_DZ->RangeStepAndValidator(-999.999, 999.999, step, 3); + Group4Spin->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, 0.1, 3); + Group4Spin->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, 0.1, 3); + Group4Spin->SpinBox_DZ->RangeStepAndValidator(-999.999, 999.999, step, 3); + Group4Spin->SpinBox_DS->RangeStepAndValidator(-999.999, 999.999, 5., 3); + + Group1Spin->SpinBox_DX->SetValue(0.0); + Group2Spin->SpinBox_DX->SetValue(0.0); + Group2Spin->SpinBox_DY->SetValue(0.0); + Group3Spin->SpinBox_DX->SetValue(0.0); + Group3Spin->SpinBox_DY->SetValue(0.0); + Group3Spin->SpinBox_DZ->SetValue(0.0); + Group4Spin->SpinBox_DX->SetValue(0.0); + Group4Spin->SpinBox_DY->SetValue(0.0); + Group4Spin->SpinBox_DZ->SetValue(0.0); + Group4Spin->SpinBox_DS->SetValue(0.0); + + /* displays Dialog */ + Group1Sel->buttonUndo->setEnabled(false); + Group1Spin->buttonUndo->setEnabled(false); + Group2Spin->buttonUndo->setEnabled(false); + Group3Spin->buttonUndo->setEnabled(false); + Group4Spin->buttonUndo->setEnabled(false); + + RadioButton1->setChecked(true); + + myLastOp = 0; + myLastX1 = 0.0; + myLastY1 = 0.0; + myLastX2 = 0.0; + myLastY2 = 0.0; + + mySketchState = FIRST_POINT; + this->TypeClicked(0); + + return; +} + + +//================================================================================= +// function : InitClick() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::InitClick() +{ + disconnect(mySelection, 0, this, 0); + + Group2Spin->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); + Group2Spin->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3); + Group3Spin->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, step, 3); + Group3Spin->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, step, 3); + Group3Spin->SpinBox_DZ->RangeStepAndValidator(-999.999, 999.999, step, 3); + + Group1Sel->hide(); + Group1Spin->hide(); + Group2Spin->hide(); + Group3Spin->hide(); + Group4Spin->hide(); + + resize(0, 0); + + return; +} + + +//================================================================================= +// function : TypeClicked() +// purpose : Radio button management +//================================================================================= +void EntityGUI_SketcherDlg::TypeClicked(int constructorId) +{ + myConstructorId = constructorId; + if(myConstructorId == 0) { // SEGMENT + GroupD2->setEnabled(true); + RB_Dest1->setEnabled(true); + RB_Dest1->setChecked(true); + this->DestClicked(1); + } + else if(myConstructorId == 1) { // ARC + GroupD2->setEnabled(false); + RB_Dest1->setEnabled(false); + RB_Dest2->setChecked(true); + this->DestClicked(0); + } + return; +} + + +//================================================================================= +// function : DestClicked() +// purpose : Radio button management +//================================================================================= +void EntityGUI_SketcherDlg::DestClicked(int constructorId) +{ + GroupPt->hide(); + GroupD1->hide(); + GroupD2->hide(); + + if(constructorId == 1) { // Point + GroupPt->RB_Point1->setChecked(true); + GroupPt->show(); + this->PointClicked(1); // XY + } + else if(constructorId == 0) { // Direction + GroupD1->RB_Dir11->setChecked(true); + GroupD1->show(); + GroupD2->show(); + this->Dir1Clicked(2); // Angle + } + return; +} + + +//================================================================================= +// function : PointClicked() +// purpose : Radio button management +//================================================================================= +void EntityGUI_SketcherDlg::PointClicked(int constructorId) +{ + this->InitClick(); + + if(myConstructorId == 0) { // SEGMENT + if(constructorId == 1) { // XY + mySketchType = PT_ABS; + Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_X2")); + Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_Y2")); + myX = 0.0; + Group2Spin->SpinBox_DX->SetValue(myX); + myY = 0.0; + Group2Spin->SpinBox_DY->SetValue(myY); + Group2Spin->show(); + Group2Spin->buttonApply->setFocus(); + this->MakeSimulationAndDisplay(); + } + else if(constructorId == 0) { // DXDY + mySketchType = PT_RELATIVE; + Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_DX2")); + Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_DY2")); + myDX = 0.0; + Group2Spin->SpinBox_DX->SetValue(myDX); + myDY = 0.0; + Group2Spin->SpinBox_DY->SetValue(myDY); + Group2Spin->show(); + Group2Spin->buttonApply->setFocus(); + this->MakeSimulationAndDisplay(); + } + else if(constructorId == 2) { // Selection + mySketchType = PT_SEL; + myEditCurrentArgument = Group1Sel->LineEdit1; + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + Group1Sel->show(); + Group1Sel->buttonApply->setFocus(); + this->SelectionIntoArgument(); + } + } + + return; +} + + +//================================================================================= +// function : Dir1Clicked() +// purpose : Radio button management +//================================================================================= +void EntityGUI_SketcherDlg::Dir1Clicked(int constructorId) +{ + myConstructorDirId = constructorId; + GroupD2->RB_Dir21->setChecked(true); + this->Dir2Clicked(2); + return; +} + + +//================================================================================= +// function : Dir2Clicked() +// purpose : Radio button management +//================================================================================= +void EntityGUI_SketcherDlg::Dir2Clicked(int constructorId) +{ + this->InitClick(); + myAngle = 0.0; + + if(myConstructorId == 0) { // SEGMENT + myX = 0.0; + myY = 0.0; + myLength = 100.0; + if(myConstructorDirId == 2) { // Angle + Group2Spin->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, 5., 3); + Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_ANGLE2")); + Group2Spin->SpinBox_DX->SetValue(myAngle); + Group2Spin->buttonApply->setFocus(); + Group2Spin->show(); + + if(constructorId == 2) { // Length + mySketchType = DIR_ANGLE_LENGTH; + Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_LENGTH2")); + Group2Spin->SpinBox_DY->SetValue(myLength); + } + else if(constructorId == 0) { // X + mySketchType = DIR_ANGLE_X; + Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_X3")); + Group2Spin->SpinBox_DY->SetValue(myX); + } + else if(constructorId == 1) { // Y + mySketchType = DIR_ANGLE_Y; + Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_Y3")); + Group2Spin->SpinBox_DY->SetValue(myY); + } + } + else if(myConstructorDirId == 0) { // Perpendicular + Group1Spin->show(); + Group1Spin->buttonApply->setFocus(); + + if(constructorId == 2) { // Length + mySketchType = DIR_PER_LENGTH; + Group1Spin->TextLabel1->setText(tr("GEOM_SKETCHER_LENGTH2")); + Group1Spin->SpinBox_DX->SetValue(myLength); + } + else if(constructorId == 0) { // X + mySketchType = DIR_PER_X; + Group1Spin->TextLabel1->setText(tr("GEOM_SKETCHER_X3")); + Group1Spin->SpinBox_DX->SetValue(myX); + } + else if(constructorId == 1) { // Y + mySketchType = DIR_PER_Y; + Group1Spin->TextLabel1->setText(tr("GEOM_SKETCHER_Y3")); + Group1Spin->SpinBox_DX->SetValue(myY); + } + } + else if(myConstructorDirId == 1) { // Tangent + Group1Spin->show(); + Group1Spin->buttonApply->setFocus(); + + if(constructorId == 2) { // Length + mySketchType = DIR_TAN_LENGTH; + Group1Spin->TextLabel1->setText(tr("GEOM_SKETCHER_LENGTH2")); + Group1Spin->SpinBox_DX->SetValue(myLength); + } + else if(constructorId == 0) { // X + mySketchType = DIR_TAN_X; + Group1Spin->TextLabel1->setText(tr("GEOM_SKETCHER_X3")); + Group1Spin->SpinBox_DX->SetValue(myX); + } + else if(constructorId == 1) { // Y + mySketchType = DIR_TAN_Y; + Group1Spin->TextLabel1->setText(tr("GEOM_SKETCHER_Y3")); + Group1Spin->SpinBox_DX->SetValue(myY); + } + } + else if(myConstructorDirId == 3) { // DXDY + Group3Spin->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, 0.1, 3); + Group3Spin->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, 0.1, 3); + Group3Spin->TextLabel1->setText(tr("GEOM_SKETCHER_VX2")); + Group3Spin->TextLabel2->setText(tr("GEOM_SKETCHER_VY2")); + myDX = 0.0; + Group3Spin->SpinBox_DX->SetValue(myDX); + myDY = 0.0; + Group3Spin->SpinBox_DY->SetValue(myDY); + Group3Spin->show(); + Group3Spin->buttonApply->setFocus(); + + if(constructorId == 2) { // Length + mySketchType = DIR_DXDY_LENGTH; + Group3Spin->TextLabel3->setText(tr("GEOM_SKETCHER_LENGTH2")); + Group3Spin->SpinBox_DZ->SetValue(myLength); + } + else if(constructorId == 0) { // X + mySketchType = DIR_DXDY_X; + Group3Spin->TextLabel3->setText(tr("GEOM_SKETCHER_X3")); + Group3Spin->SpinBox_DZ->SetValue(myX); + } + else if(constructorId == 1) { // Y + mySketchType = DIR_DXDY_Y; + Group3Spin->TextLabel3->setText(tr("GEOM_SKETCHER_Y3")); + Group3Spin->SpinBox_DZ->SetValue(myY); + } + } + } + else if(myConstructorId == 1) { // ARC + if(myConstructorDirId == 2) { // Angle + if(constructorId == 2) { // Length + mySketchType = DIR_ANGLE_LENGTH; + Group3Spin->SpinBox_DX->RangeStepAndValidator(-999.999, 999.999, 5., 3); + Group3Spin->SpinBox_DZ->RangeStepAndValidator(-999.999, 999.999, 5., 3); + Group3Spin->TextLabel1->setText(tr("GEOM_SKETCHER_ANGLE2")); + Group3Spin->TextLabel2->setText(tr("GEOM_SKETCHER_RADIUS2")); + Group3Spin->TextLabel3->setText(tr("GEOM_SKETCHER_ANGLE2")); + Group3Spin->SpinBox_DX->SetValue(myAngle); + myRadius = 100.0; + Group3Spin->SpinBox_DY->SetValue(myRadius); + myLength = 30.0; + Group3Spin->SpinBox_DZ->SetValue(myLength); + Group3Spin->show(); + Group3Spin->buttonApply->setFocus(); + } + } + else if(myConstructorDirId == 0) { // Perpendicular + if(constructorId == 2) { // Length + mySketchType = DIR_PER_LENGTH; + Group2Spin->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, 5., 3); + Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_RADIUS2")); + Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_ANGLE2")); + myRadius = 100.0; + Group2Spin->SpinBox_DX->SetValue(myRadius); + myLength = 30.0; + Group2Spin->SpinBox_DY->SetValue(myLength); + Group2Spin->show(); + Group2Spin->buttonApply->setFocus(); + } + } + else if(myConstructorDirId == 1) { // Tangent + if(constructorId == 2) { // Length + mySketchType = DIR_TAN_LENGTH; + Group2Spin->SpinBox_DY->RangeStepAndValidator(-999.999, 999.999, 5., 3); + Group2Spin->TextLabel1->setText(tr("GEOM_SKETCHER_RADIUS2")); + Group2Spin->TextLabel2->setText(tr("GEOM_SKETCHER_ANGLE2")); + myRadius = 100.0; + Group2Spin->SpinBox_DX->SetValue(myRadius); + myLength = 30.0; + Group2Spin->SpinBox_DY->SetValue(myLength); + Group2Spin->show(); + Group2Spin->buttonApply->setFocus(); + } + } + else if(myConstructorDirId == 3) { // DXDY + if(constructorId == 2) { // Length + mySketchType = DIR_DXDY_LENGTH; + Group4Spin->TextLabel1->setText(tr("GEOM_SKETCHER_VX2")); + Group4Spin->TextLabel2->setText(tr("GEOM_SKETCHER_VY2")); + Group4Spin->TextLabel3->setText(tr("GEOM_SKETCHER_RADIUS2")); + Group4Spin->TextLabel4->setText(tr("GEOM_SKETCHER_ANGLE2")); + myDX = 0.0; + Group4Spin->SpinBox_DX->SetValue(myDX); + myDY = 0.0; + Group4Spin->SpinBox_DY->SetValue(myDY); + myRadius = 100.0; + Group4Spin->SpinBox_DZ->SetValue(myRadius); + myLength = 30.0; + Group4Spin->SpinBox_DS->SetValue(myLength); + Group4Spin->show(); + Group4Spin->buttonApply->setFocus(); + } + } + } + + this->MakeSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : ClickOnCancel() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::ClickOnCancel() +{ + QAD_Application::getDesktop()->putInfo(tr("")); + myEntityGUI->EraseSimulationShape(); + mySimulationTopoDs1.Nullify(); + mySimulationTopoDs2.Nullify(); + + mySelection->ClearFilters(); + disconnect(mySelection, 0, this, 0); + + reject(); + return; +} + + +//================================================================================= +// function : ClickOnEnd() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::ClickOnEnd() +{ + if(mySketchState != FIRST_POINT && mySketchState != SECOND_POINT) + myEntityGUI->OnSketchEnd(myCommand.ascii()); + + this->ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnClose() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::ClickOnClose() +{ + if(mySketchState != FIRST_POINT && mySketchState != SECOND_POINT) { + myCommand = myCommand + ":WW"; + myEntityGUI->OnSketchEnd(myCommand.ascii()); + } + + this->ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::ClickOnApply() +{ + if(mySketchState == FIRST_POINT) { + mySketchState = SECOND_POINT; + myLastX2 = myLastX1; + myLastY2 = myLastY1; + } + else { + if(mySketchState != SECOND_POINT) { + Group1Sel->buttonUndo->setEnabled(true); + Group1Spin->buttonUndo->setEnabled(true); + Group2Spin->buttonUndo->setEnabled(true); + Group3Spin->buttonUndo->setEnabled(true); + Group4Spin->buttonUndo->setEnabled(true); + } + + QString myNewCommand = this->GetNewCommand(); + QString myCommandTemp = myCommand + myNewCommand; + + Sketcher_Profile aProfile (myCommandTemp.ascii()); + + if(aProfile.IsDone()) { + myLastCommand = myCommand; + myCommand = myCommandTemp; + myLastX2 = myLastX1; + myLastY2 = myLastY1; + mySketchState = NEXT_POINT; + } + } + + myLastOp = myConstructorId; + this->MakeSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : ClickOnUndo() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::ClickOnUndo() +{ + Group1Sel->buttonUndo->setEnabled(false); + Group1Spin->buttonUndo->setEnabled(false); + Group2Spin->buttonUndo->setEnabled(false); + Group3Spin->buttonUndo->setEnabled(false); + Group4Spin->buttonUndo->setEnabled(false); + + myCommand = myLastCommand; + this->MakeSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection as changed +//================================================================================= +void EntityGUI_SketcherDlg::SelectionIntoArgument() +{ + myEntityGUI->EraseSimulationShape(1); //Juste Shape2!! + + Group1Sel->buttonApply->setEnabled(false); + Group1Sel->buttonApply->setFocus(); + + myEditCurrentArgument->setText(""); + QString aString = ""; + + myX = 0.0; + myY = 0.0; + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) + return; + + /* nbSel == 1 */ + TopoDS_Shape S; + gp_Pnt myPoint1; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + + if(myEditCurrentArgument == Group1Sel->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) { + myX = myPoint1.X(); + myY = myPoint1.Y(); + Group1Sel->LineEdit1->setText(aString); + + Group1Sel->buttonApply->setEnabled(true); + Group1Sel->buttonApply->setFocus(); + this->MakeSimulationAndDisplay(); + } + + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + mySelection->ClearFilters(); + if(send == Group1Sel->PushButton1) { + //Group1Sel->LineEdit1->setFocus(); + myEditCurrentArgument = Group1Sel->LineEdit1; + } + mySelection->AddFilter(myVertexFilter); + this->SelectionIntoArgument(); + return; +} + + +//================================================================================= +// function : LineEditReturnPressed() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::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(myGeomBase->SelectionByNameInDialogs(thisWidget, objectUserName, mySelection)) + myEditCurrentArgument->setText(objectUserName); + + return; +} + + +//================================================================================= +// function : DeactivateActiveDialog() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::DeactivateActiveDialog() +{ + this->setEnabled(false); + mySelection->ClearFilters(); + disconnect(mySelection, 0, this, 0); + myEntityGUI->EraseSimulationShape(); + myGeomGUI->SetActiveDialogBox(0); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::ActivateThisDialog() +{ + /* Emit a signal to deactivate the active dialog */ + myGeomGUI->EmitSignalDeactivateDialog(); + this->setEnabled(true); + myGeomGUI->SetActiveDialogBox((QDialog*)this); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + mySelection->AddFilter(myVertexFilter); + myEntityGUI->DisplaySimulationShape(mySimulationTopoDs1, mySimulationTopoDs2); + + return; +} + + +//================================================================================= +// function : enterEvent [REDEFINED] +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : closeEvent() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::closeEvent(QCloseEvent* e) +{ + /* same than click on cancel button */ + this->ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::ValueChangedInSpinBox(double newValue) +{ + QObject* send = (QObject*)sender(); + Standard_Real vx, vy, vz, vs; + vx = vy = vz = vs = 0.0; + + if(send == Group1Spin->SpinBox_DX) { + vx = newValue; + Group1Spin->buttonApply->setFocus(); + } + else if(send == Group2Spin->SpinBox_DX) { + vx = newValue; + vy = Group2Spin->SpinBox_DY->GetValue(); + Group2Spin->buttonApply->setFocus(); + } + else if(send == Group2Spin->SpinBox_DY) { + vx = Group2Spin->SpinBox_DX->GetValue(); + vy = newValue; + Group2Spin->buttonApply->setFocus(); + } + else if(send == Group3Spin->SpinBox_DX) { + vx = newValue; + vy = Group3Spin->SpinBox_DY->GetValue(); + vz = Group3Spin->SpinBox_DZ->GetValue(); + Group3Spin->buttonApply->setFocus(); + } + else if(send == Group3Spin->SpinBox_DY) { + vx = Group3Spin->SpinBox_DX->GetValue(); + vy = newValue; + vz = Group3Spin->SpinBox_DZ->GetValue(); + Group3Spin->buttonApply->setFocus(); + } + else if(send == Group3Spin->SpinBox_DZ) { + vx = Group3Spin->SpinBox_DX->GetValue(); + vy = Group3Spin->SpinBox_DY->GetValue(); + vz = newValue; + Group3Spin->buttonApply->setFocus(); + } + else if(send == Group4Spin->SpinBox_DX) { + vx = newValue; + vy = Group4Spin->SpinBox_DY->GetValue(); + vz = Group4Spin->SpinBox_DZ->GetValue(); + vs = Group4Spin->SpinBox_DS->GetValue(); + Group4Spin->buttonApply->setFocus(); + } + else if(send == Group4Spin->SpinBox_DY) { + vx = Group4Spin->SpinBox_DX->GetValue(); + vy = newValue; + vz = Group4Spin->SpinBox_DZ->GetValue(); + vs = Group4Spin->SpinBox_DS->GetValue(); + Group4Spin->buttonApply->setFocus(); + } + else if(send == Group4Spin->SpinBox_DZ) { + vx = Group4Spin->SpinBox_DX->GetValue(); + vy = Group4Spin->SpinBox_DY->GetValue(); + vz = newValue; + vs = Group4Spin->SpinBox_DS->GetValue(); + Group4Spin->buttonApply->setFocus(); + } + else if(send == Group4Spin->SpinBox_DS) { + vx = Group4Spin->SpinBox_DX->GetValue(); + vy = Group4Spin->SpinBox_DY->GetValue(); + vz = Group4Spin->SpinBox_DZ->GetValue(); + vs = newValue; + Group4Spin->buttonApply->setFocus(); + } + + if(myConstructorId == 0) { // SEGMENT + if(mySketchType == PT_ABS) { + myX = vx; + myY = vy; + } + else if(mySketchType == PT_RELATIVE) { + myDX = vx; + myDY = vy; + } + else if(mySketchType == DIR_ANGLE_LENGTH) { + myAngle = vx; + myLength = vy; + } + else if(mySketchType == DIR_ANGLE_X) { + myAngle = vx; + myX = vy; + } + else if(mySketchType == DIR_ANGLE_Y) { + myAngle = vx; + myY = vy; + } + else if(mySketchType == DIR_PER_LENGTH) { + myLength = vx; + } + else if(mySketchType == DIR_PER_X) { + myX = vx; + } + else if(mySketchType == DIR_PER_Y) { + myY = vx; + } + else if(mySketchType == DIR_TAN_LENGTH) { + myLength = vx; + } + else if(mySketchType == DIR_TAN_X) { + myX = vx; + } + else if(mySketchType == DIR_TAN_Y) { + myY = vx; + } + else if(mySketchType == DIR_DXDY_LENGTH) { + myDX = vx; + myDY = vy; + myLength = vz; + } + else if(mySketchType == DIR_DXDY_X) { + myDX = vx; + myDY = vy; + myX = vz; + } + else if(mySketchType == DIR_DXDY_Y) { + myDX = vx; + myDY = vy; + myY = vz; + } + } + else if(myConstructorId == 1) { // ARC + if(mySketchType == DIR_ANGLE_LENGTH) { + myAngle = vx; + myRadius = vy; + myLength = vz; + } + else if(mySketchType == DIR_PER_LENGTH) { + myRadius = vx; + myLength = vy; + } + else if(mySketchType == DIR_TAN_LENGTH) { + myRadius = vx; + myLength = vy; + } + else if(mySketchType == DIR_DXDY_LENGTH) { + myDX = vx; + myDY = vy; + myRadius = vz; + myLength = vs; + } + } + + this->MakeSimulationAndDisplay(); + return; +} + + +//================================================================================= +// function : GetNewCommand() +// purpose : +//================================================================================= +QString EntityGUI_SketcherDlg::GetNewCommand() +{ + QString myNewCommand = ""; + if(mySketchState == FIRST_POINT) + return myNewCommand; + + myNewCommand = ":"; + if(myConstructorId == 0) { // SEGMENT + if(mySketchType == PT_ABS || mySketchType == PT_SEL) + myNewCommand = myNewCommand + "TT " + QString::number(myX) + " " + QString::number(myY); + if(mySketchType == PT_RELATIVE) + myNewCommand = myNewCommand + "T " + QString::number(myDX) + " " + QString::number(myDY); + if(mySketchType == DIR_ANGLE_LENGTH) { + myNewCommand = myNewCommand + "R " + QString::number(myAngle); + myNewCommand = myNewCommand + ":" + "L " + QString::number(myLength); + } + if(mySketchType == DIR_ANGLE_X) { + myNewCommand = myNewCommand + "R " + QString::number(myAngle); + myNewCommand = myNewCommand + ":" + "IX " + QString::number(myX); + } + if(mySketchType == DIR_ANGLE_Y) { + myNewCommand = myNewCommand + "R " + QString::number(myAngle); + myNewCommand = myNewCommand + ":" + "IY " + QString::number(myY); + } + if(mySketchType == DIR_PER_LENGTH) { + myNewCommand = myNewCommand + "R " + QString::number(90.0); + myNewCommand = myNewCommand + ":" + "L " + QString::number(myLength); + } + if(mySketchType == DIR_PER_X) { + myNewCommand = myNewCommand + "R " + QString::number(90.0); + myNewCommand = myNewCommand + ":" + "IX " + QString::number(myX); + } + if(mySketchType == DIR_PER_Y) { + myNewCommand = myNewCommand + "R " + QString::number(90.0); + myNewCommand = myNewCommand + ":" + "IY " + QString::number(myY); + } + if(mySketchType == DIR_TAN_LENGTH) + myNewCommand = myNewCommand + "L " + QString::number(myLength); + if(mySketchType == DIR_TAN_X) + myNewCommand = myNewCommand + "IX " + QString::number(myX); + if(mySketchType == DIR_TAN_Y) + myNewCommand = myNewCommand + "IY " + QString::number(myY); + if(mySketchType == DIR_DXDY_LENGTH) { + myNewCommand = myNewCommand + "D " + QString::number(myDX) + " " + QString::number(myDY); + myNewCommand = myNewCommand + ":" + "L " + QString::number(myLength); + } + if(mySketchType == DIR_DXDY_X) { + myNewCommand = myNewCommand + "D " + QString::number(myDX) + " " + QString::number(myDY); + myNewCommand = myNewCommand + ":" + "IX " + QString::number(myX); + } + if(mySketchType == DIR_DXDY_Y) { + myNewCommand = myNewCommand + "D " + QString::number(myDX) + " " + QString::number(myDY); + myNewCommand = myNewCommand + ":" + "IY " + QString::number(myY); + } + } + else if(myConstructorId == 1) { // ARC + if(mySketchType == DIR_ANGLE_LENGTH) { + myNewCommand = myNewCommand + "R " + QString::number(myAngle); + myNewCommand = myNewCommand + ":" + "C " + QString::number(myRadius) + " " + QString::number(myLength); + } + if(mySketchType == DIR_PER_LENGTH) { + myNewCommand = myNewCommand + "R " + QString::number(90.0); + myNewCommand = myNewCommand + ":" + "C " + QString::number(myRadius) + " " + QString::number(myLength); + } + if(mySketchType == DIR_TAN_LENGTH) { + myNewCommand = myNewCommand + "C " + QString::number(myRadius) + " " + QString::number(myLength); + } + if(mySketchType == DIR_DXDY_LENGTH) { + myNewCommand = myNewCommand + "D " + QString::number(myDX) + " " + QString::number(myDY); + myNewCommand = myNewCommand + ":" + "C " + QString::number(myRadius) + " " + QString::number(myLength); + } + } + return myNewCommand; +} + + +//================================================================================= +// function : MakeSimulationAndDisplay() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::MakeSimulationAndDisplay() +{ + myEntityGUI->EraseSimulationShape(); + mySimulationTopoDs1.Nullify(); + mySimulationTopoDs2.Nullify(); + + try { + if(mySketchState == FIRST_POINT) { + myCommand = "Sketch "; + myCommand = myCommand + ":" + "F " + QString::number(myX) + " " + QString::number(myY); + + myLastX1 = myX; + myLastY1 = myY; + + } + + Sketcher_Profile aProfile1 (myCommand.ascii()); + + if(aProfile1.IsDone()) { + myShape = aProfile1.GetShape(); + mySimulationTopoDs1 = myShape; + } + + if(mySketchState != FIRST_POINT) { + if(mySketchState == SECOND_POINT) { + gp_Pnt pt = BRep_Tool::Pnt(TopoDS::Vertex(myShape)); + myLastX1 = pt.X(); + myLastY1 = pt.Y(); + } + else { + TopoDS_Vertex V1, V2; + TopExp::Vertices(TopoDS::Wire(myShape), V1, V2); + gp_Pnt pt = BRep_Tool::Pnt(V2); + myLastX1 = pt.X(); + myLastY1 = pt.Y(); + if(myLastOp == 1) { // ARC + myLastDir = aProfile1.GetLastDir(); + myLastX2 = myLastX1 - myLastDir.X(); + myLastY2 = myLastY1 - myLastDir.Y(); + } + } + QString myNewCommand = "Sketch "; + myNewCommand = myNewCommand + ":" + "F " + QString::number(myLastX1) + " " + QString::number(myLastY1); + if(mySketchState != SECOND_POINT && !((myLastX1 - myLastX2) == 0 && (myLastY1 - myLastY2) == 0)) + myNewCommand = myNewCommand + ":" + "D " + QString::number(myLastX1 - myLastX2) + " " + QString::number(myLastY1 - myLastY2); + myNewCommand = myNewCommand + this->GetNewCommand(); + Sketcher_Profile aProfile2 (myNewCommand.ascii()); + if(aProfile2.IsDone()) + mySimulationTopoDs2 = aProfile2.GetShape(); + + if ( mySimulationTopoDs2.IsNull() ) { + if ( Group1Sel->isVisible() ) { + Group1Sel->buttonApply->setEnabled(false); + Group1Sel->buttonApply->setFocus(); + } + if ( Group1Spin->isVisible() ) { + Group1Spin->buttonApply->setEnabled(false); + Group1Spin->buttonApply->setFocus(); + } + if ( Group2Spin->isVisible() ) { + Group2Spin->buttonApply->setEnabled(false); + Group2Spin->buttonApply->setFocus(); + } + if ( Group3Spin->isVisible() ) { + Group3Spin->buttonApply->setEnabled(false); + Group3Spin->buttonApply->setFocus(); + } + if ( Group4Spin->isVisible() ) { + Group4Spin->buttonApply->setEnabled(false); + Group4Spin->buttonApply->setFocus(); + } + } else { + if ( Group1Sel->isVisible() ) { + Group1Sel->buttonApply->setEnabled(true); + Group1Sel->buttonApply->setFocus(); + } + if ( Group1Spin->isVisible() ) { + Group1Spin->buttonApply->setEnabled(true); + Group1Spin->buttonApply->setFocus(); + } + if ( Group2Spin->isVisible() ) { + Group2Spin->buttonApply->setEnabled(true); + Group2Spin->buttonApply->setFocus(); + } + if ( Group3Spin->isVisible() ) { + Group3Spin->buttonApply->setEnabled(true); + Group3Spin->buttonApply->setFocus(); + } + if ( Group4Spin->isVisible() ) { + Group4Spin->buttonApply->setEnabled(true); + Group4Spin->buttonApply->setFocus(); + } + } + } + + myEntityGUI->DisplaySimulationShape(mySimulationTopoDs1, mySimulationTopoDs2); + } + catch(Standard_Failure) { + MESSAGE("Exception catched in MakeSimulationAndDisplay"); + return; + } + return; +} diff --git a/src/EntityGUI/EntityGUI_SketcherDlg.h b/src/EntityGUI/EntityGUI_SketcherDlg.h new file mode 100644 index 000000000..2da62fe81 --- /dev/null +++ b/src/EntityGUI/EntityGUI_SketcherDlg.h @@ -0,0 +1,149 @@ +// 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 : EntityGUI_SketcherDlg.h +// Author : Damine COQUERET +// Module : GEOM +// $Header: + +#ifndef ENTITYGUI_SKETCHERDLG_H +#define ENTITYGUI_SKETCHERDLG_H + +#include "EntityGUI_Skeleton_QTD.h" +#include "EntityGUI_Point_QTD.h" +#include "EntityGUI_Dir1_QTD.h" +#include "EntityGUI_Dir2_QTD.h" + +#include "EntityGUI_1Sel_QTD.h" +#include "EntityGUI_1Spin.h" +#include "EntityGUI_2Spin.h" +#include "EntityGUI_3Spin.h" +#include "EntityGUI_4Spin.h" + +#include "EntityGUI.h" + +#include "GEOM_ShapeTypeFilter.hxx" + +#include + +#include +#include +#include +#include +#include +#include + +//================================================================================= +// class : EntityGUI_Dlg +// purpose : +//================================================================================= +class EntityGUI_SketcherDlg : public EntityGUI_Skeleton_QTD +{ + Q_OBJECT + +public: + EntityGUI_SketcherDlg(QWidget* parent = 0, const char* name = 0, EntityGUI* theEntityGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~EntityGUI_SketcherDlg(); + +private : + void Init(); + void enterEvent(QEvent* e); + void closeEvent(QCloseEvent* e); + void InitClick(); + void MakeSimulationAndDisplay(); + QString GetNewCommand(); + + EntityGUI* myEntityGUI; + + double step; + int myConstructorId; + int myConstructorDirId; + int mySketchType; + int mySketchState; + Handle(GEOM_ShapeTypeFilter) myVertexFilter; + + TopoDS_Shape mySimulationTopoDs1; /* Shape used for simulation display */ + TopoDS_Shape mySimulationTopoDs2; /* Shape used for simulation display */ + QLineEdit* myEditCurrentArgument; /* Current LineEdit */ + SALOME_Selection* mySelection; /* User shape selection */ + GEOM::GEOM_Gen_var myGeom; /* Current GeomI object */ + GEOMBase* myGeomBase; + GEOMContext* myGeomGUI; /* Current GeomGUI object */ + + int myLastOp; + QString myCommand; + QString myLastCommand; + TopoDS_Shape myShape; + gp_Dir myLastDir; + + Standard_Real myX; + Standard_Real myY; + Standard_Real myDX; + Standard_Real myDY; + Standard_Real myLastX1; + Standard_Real myLastY1; + Standard_Real myLastX2; + Standard_Real myLastY2; + Standard_Real myLength; + Standard_Real myAngle; + Standard_Real myRadius; + + EntityGUI_Point_QTD* GroupPt; + EntityGUI_Dir1_QTD* GroupD1; + EntityGUI_Dir2_QTD* GroupD2; + + EntityGUI_1Sel_QTD* Group1Sel; + EntityGUI_1Spin* Group1Spin; + EntityGUI_2Spin* Group2Spin; + EntityGUI_3Spin* Group3Spin; + EntityGUI_4Spin* Group4Spin; + + enum SketchState {FIRST_POINT, SECOND_POINT, NEXT_POINT}; + + enum SketchType {PT_ABS, PT_RELATIVE, PT_SEL, + DIR_ANGLE_LENGTH, DIR_ANGLE_X, DIR_ANGLE_Y, + DIR_PER_LENGTH, DIR_PER_X, DIR_PER_Y, + DIR_TAN_LENGTH, DIR_TAN_X, DIR_TAN_Y, + DIR_DXDY_LENGTH, DIR_DXDY_X, DIR_DXDY_Y}; + +private slots: + void ClickOnEnd(); + void ClickOnClose(); + void ClickOnCancel(); + void ClickOnApply(); + void ClickOnUndo(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void DeactivateActiveDialog(); + void ActivateThisDialog(); + void TypeClicked(int constructorId); + void DestClicked(int constructorId); + void PointClicked(int constructorId); + void Dir1Clicked(int constructorId); + void Dir2Clicked(int constructorId); + void ValueChangedInSpinBox(double newValue); + +}; + +#endif // ENTITYGUI_SKETCHERDLG_H diff --git a/src/EntityGUI/Makefile.in b/src/EntityGUI/Makefile.in index 7a82dddd1..78574444c 100644 --- a/src/EntityGUI/Makefile.in +++ b/src/EntityGUI/Makefile.in @@ -41,10 +41,38 @@ LIB = libEntityGUI.la EXPORT_HEADERS= LIB_SRC = EntityGUI.cxx \ + EntityGUI_Skeleton_QTD.cxx \ + EntityGUI_Point_QTD.cxx \ + EntityGUI_Dir1_QTD.cxx \ + EntityGUI_Dir2_QTD.cxx \ + EntityGUI_1Sel_QTD.cxx \ + EntityGUI_1Spin_QTD.cxx \ + EntityGUI_2Spin_QTD.cxx \ + EntityGUI_3Spin_QTD.cxx \ + EntityGUI_4Spin_QTD.cxx \ + EntityGUI_1Spin.cxx \ + EntityGUI_2Spin.cxx \ + EntityGUI_3Spin.cxx \ + EntityGUI_4Spin.cxx \ + EntityGUI_SketcherDlg.cxx \ EntityGUI_SubShapeDlg.cxx LIB_MOC = \ EntityGUI.h \ + EntityGUI_Skeleton_QTD.h \ + EntityGUI_Point_QTD.h \ + EntityGUI_Dir1_QTD.h \ + EntityGUI_Dir2_QTD.h \ + EntityGUI_1Sel_QTD.h \ + EntityGUI_1Spin_QTD.h \ + EntityGUI_2Spin_QTD.h \ + EntityGUI_3Spin_QTD.h \ + EntityGUI_4Spin_QTD.h \ + EntityGUI_1Spin.h \ + EntityGUI_2Spin.h \ + EntityGUI_3Spin.h \ + EntityGUI_4Spin.h \ + EntityGUI_SketcherDlg.h \ EntityGUI_SubShapeDlg.h LIB_CLIENT_IDL = GEOM_Kinematic.idl @@ -56,6 +84,6 @@ LIB_SERVER_IDL = CPPFLAGS += $(QT_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lGEOMFiltersSelection -lDisplayGUI +LDFLAGS += -lGEOMFiltersSelection -lDisplayGUI -lGEOMSketcher @CONCLUDE@ diff --git a/src/GEOM/GEOM_Animation_i.cc b/src/GEOM/GEOM_Animation_i.cc index 1007a50d1..19ba20b60 100644 --- a/src/GEOM/GEOM_Animation_i.cc +++ b/src/GEOM/GEOM_Animation_i.cc @@ -26,16 +26,16 @@ // Module : GEOM // $Header$ -using namespace std; + #include "GEOM_Animation_i.hh" +using namespace std; + //================================================================================= // function : GEOM_Animation_i() constructor (no arguments) // purpose : for what now ? //================================================================================= -GEOM_Animation_i::GEOM_Animation_i() -{ -} +GEOM_Animation_i::GEOM_Animation_i() {} //================================================================================= @@ -64,46 +64,6 @@ GEOM_Animation_i::GEOM_Animation_i(Kinematic_Animation* Animation, GEOM_Animation_i::~GEOM_Animation_i() { delete &_Animation; } -//================================================================================= -// function : GetAssembly() -// purpose : -//================================================================================= -GEOM::GEOM_Assembly_ptr GEOM_Animation_i::GetAssembly() throw(SALOME::SALOME_Exception) -{ - return GEOM::GEOM_Assembly::_duplicate(_Ass); -} - - -//================================================================================= -// function : GetFrame() -// purpose : -//================================================================================= -GEOM::GEOM_Shape_ptr GEOM_Animation_i::GetFrame() throw(SALOME::SALOME_Exception) -{ - return GEOM::GEOM_Shape::_duplicate(_Frame); -} - - -//================================================================================= -// function : GetDuration() -// purpose : -//================================================================================= -CORBA::Double GEOM_Animation_i::GetDuration() throw(SALOME::SALOME_Exception) -{ - return _Animation->Duration(); -} - - -//================================================================================= -// function : GetNbSeq() -// purpose : -//================================================================================= -CORBA::Long GEOM_Animation_i::GetNbSeq() throw(SALOME::SALOME_Exception) -{ - return _Animation->NbSeq(); -} - - //================================================================================= // function : Name (set method) // purpose : to set the attribute 'name'. @@ -116,32 +76,12 @@ void GEOM_Animation_i::Name(const char* name) } -//================================================================================= -// function : Name (get method) -// purpose : to get the attribute 'name' of this shape -//================================================================================= -char* GEOM_Animation_i::Name() { return strdup(_name); } - - -//================================================================================= -// function : ShapeId -// purpose : to get the id of this shape from GEOM (OCAF entry) -//================================================================================= -char* GEOM_Animation_i::ShapeId() { return strdup(_shapeid); } - - //================================================================================= // function : ShapeId (set method) // purpose : to set the id of this shape in GEOM/OCAF doc //================================================================================= -void GEOM_Animation_i::ShapeId(const char * shapeid) { _shapeid = strdup(shapeid); } - - -//================================================================================= -// function : StudyShapeId (get method) -// purpose : to get the id of this shape from the study document (OCAF entry) -//================================================================================= -char* GEOM_Animation_i::StudyShapeId() { return strdup(_studyshapeid) ; } +void GEOM_Animation_i::ShapeId(const char * shapeid) +{ _shapeid = strdup(shapeid); } //================================================================================= @@ -150,3 +90,61 @@ char* GEOM_Animation_i::StudyShapeId() { return strdup(_studyshapeid) ; } //================================================================================= void GEOM_Animation_i::StudyShapeId(const char * studyshapeid) { _studyshapeid = strdup(studyshapeid); } + + +//================================================================================= +// function : GetDisplacement() +// purpose : +//================================================================================= +GEOM::ListOfDouble* GEOM_Animation_i::GetDisplacement(GEOM::GEOM_Contact_ptr aContact) + throw(SALOME::SALOME_Exception) +{ + cout<<"GEOM_Animation_i::GetDisplacement"<length(12); + + GEOM::ListOfContact_var aContactList = _Ass->GetContactList(); + int aKContact = 0; + for(int i = 0; i < _Ass->NbContacts(); i++) { + if(aContact == aContactList[i]) + aKContact = i; + } + + cout<<"GEOM_Animation_i::GetDisplacement : Contact = "< aList = _Animation->GetDisplacement(aKContact); + list ::const_iterator it = aList.begin(); + int k = 0; + while(it != aList.end()) { + cout<<"GEOM_Animation_i::GetDisplacement : k = "<GetContactList(); + int aKContact = 0; + for(int i = 0; i < _Ass->NbContacts(); i++) { + if(aContact == aContactList[i]) + aKContact = i; + } + + list aKList; + for(int j = 0; j < 12; j++) + aKList.push_back(aList[j]); + + _Animation->SetDisplacement(aKContact, aKList); + + return; +} diff --git a/src/GEOM/GEOM_Animation_i.hh b/src/GEOM/GEOM_Animation_i.hh index 4cc925f65..f425771cf 100644 --- a/src/GEOM/GEOM_Animation_i.hh +++ b/src/GEOM/GEOM_Animation_i.hh @@ -62,25 +62,32 @@ private: char* _studyshapeid; // exists only if added in the study document public: - GEOM::GEOM_Assembly_ptr GetAssembly() + GEOM::GEOM_Assembly_ptr GetAssembly() throw (SALOME::SALOME_Exception) + {return GEOM::GEOM_Assembly::_duplicate(_Ass);}; + + GEOM::GEOM_Shape_ptr GetFrame() throw (SALOME::SALOME_Exception) + {return GEOM::GEOM_Shape::_duplicate(_Frame);}; + + CORBA::Double GetDuration() throw (SALOME::SALOME_Exception) + {return _Animation->GetDuration();}; + + CORBA::Long GetNbSeq() throw (SALOME::SALOME_Exception) + {return _Animation->GetNbSeq();}; + + GEOM::ListOfDouble* GetDisplacement(GEOM::GEOM_Contact_ptr aContact) throw (SALOME::SALOME_Exception); - GEOM::GEOM_Shape_ptr GetFrame() + void SetDisplacement(GEOM::GEOM_Contact_ptr aContact, + const GEOM::ListOfDouble& aList) throw (SALOME::SALOME_Exception); - CORBA::Double GetDuration() - throw (SALOME::SALOME_Exception); - - CORBA::Long GetNbSeq() - throw (SALOME::SALOME_Exception); - - char* Name(); + char* Name() {return strdup(_name);}; void Name(const char* name); - char* ShapeId(); + char* ShapeId() {return strdup(_shapeid);}; void ShapeId(const char* shapeid); - char* StudyShapeId(); + char* StudyShapeId() {return strdup(_studyshapeid);}; void StudyShapeId(const char* studyshapeid); }; diff --git a/src/GEOM/GEOM_Assembly_i.cc b/src/GEOM/GEOM_Assembly_i.cc index bd151fd88..ee7af41bc 100644 --- a/src/GEOM/GEOM_Assembly_i.cc +++ b/src/GEOM/GEOM_Assembly_i.cc @@ -26,16 +26,15 @@ // Module : GEOM // $Header$ -using namespace std; #include "GEOM_Assembly_i.hh" +using namespace std; + //================================================================================= // function : GEOM_Assembly_i() constructor (no arguments) // purpose : for what now ? //================================================================================= -GEOM_Assembly_i::GEOM_Assembly_i() -{ -} +GEOM_Assembly_i::GEOM_Assembly_i() {} //================================================================================= @@ -63,6 +62,34 @@ GEOM_Assembly_i::GEOM_Assembly_i(Kinematic_Assembly* Ass) GEOM_Assembly_i::~GEOM_Assembly_i() { delete &_Ass; } +//================================================================================= +// function : Name (set method) +// purpose : to set the attribute 'name'. +// : WARNING : Register to naming service actually removed ! +//================================================================================= +void GEOM_Assembly_i::Name(const char* name) +{ + _name = strdup(name); + GEOM::GEOM_Assembly_ptr g = GEOM::GEOM_Assembly::_narrow(_this()); +} + + +//================================================================================= +// function : ShapeId (set method) +// purpose : to set the id of this shape in GEOM/OCAF doc +//================================================================================= +void GEOM_Assembly_i::ShapeId(const char * shapeid) +{ _shapeid = strdup(shapeid); } + + +//================================================================================= +// function : StudyShapeId (set method) +// purpose : to set the id of this shape in the Study document (OCAF entry) +//================================================================================= +void GEOM_Assembly_i::StudyShapeId(const char * studyshapeid) +{ _studyshapeid = strdup(studyshapeid); } + + //================================================================================= // function : AddContact() // purpose : @@ -84,66 +111,8 @@ GEOM::ListOfContact* GEOM_Assembly_i::GetContactList() throw(SALOME::SALOME_Exce { GEOM::ListOfContact_var aContactList = new GEOM::ListOfContact; aContactList->length(_aContactList.length()); - for(int i = 0; i < _NbContact; i++) { + for(int i = 0; i < _NbContact; i++) aContactList[i] = GEOM::GEOM_Contact::_duplicate(_aContactList[i]); - } + return aContactList._retn(); } - - -//================================================================================= -// function : NbContacts() -// purpose : -//================================================================================= -CORBA::Long GEOM_Assembly_i::NbContacts() throw(SALOME::SALOME_Exception) -{ - return _NbContact; -} - - -//================================================================================= -// function : Name (set method) -// purpose : to set the attribute 'name'. -// : WARNING : Register to naming service actually removed ! -//================================================================================= -void GEOM_Assembly_i::Name(const char* name) -{ - _name = strdup(name); - GEOM::GEOM_Assembly_ptr g = GEOM::GEOM_Assembly::_narrow(_this()); -} - - -//================================================================================= -// function : Name (get method) -// purpose : to get the attribute 'name' of this shape -//================================================================================= -char* GEOM_Assembly_i::Name() { return strdup(_name); } - - -//================================================================================= -// function : ShapeId -// purpose : to get the id of this shape from GEOM (OCAF entry) -//================================================================================= -char* GEOM_Assembly_i::ShapeId() { return strdup(_shapeid); } - - -//================================================================================= -// function : ShapeId (set method) -// purpose : to set the id of this shape in GEOM/OCAF doc -//================================================================================= -void GEOM_Assembly_i::ShapeId(const char * shapeid) { _shapeid = strdup(shapeid); } - - -//================================================================================= -// function : StudyShapeId (get method) -// purpose : to get the id of this shape from the study document (OCAF entry) -//================================================================================= -char* GEOM_Assembly_i::StudyShapeId() { return strdup(_studyshapeid) ; } - - -//================================================================================= -// function : StudyShapeId (set method) -// purpose : to set the id of this shape in the Study document (OCAF entry) -//================================================================================= -void GEOM_Assembly_i::StudyShapeId(const char * studyshapeid) -{ _studyshapeid = strdup(studyshapeid); } diff --git a/src/GEOM/GEOM_Assembly_i.hh b/src/GEOM/GEOM_Assembly_i.hh index 288b33fe6..00dc49c78 100644 --- a/src/GEOM/GEOM_Assembly_i.hh +++ b/src/GEOM/GEOM_Assembly_i.hh @@ -66,16 +66,16 @@ public: GEOM::ListOfContact* GetContactList() throw (SALOME::SALOME_Exception); - CORBA::Long NbContacts() - throw (SALOME::SALOME_Exception); + CORBA::Long NbContacts() throw (SALOME::SALOME_Exception) + {return _NbContact;}; - char* Name(); + char* Name() {return strdup(_name);}; void Name(const char* name); - char* ShapeId(); + char* ShapeId() {return strdup(_shapeid);}; void ShapeId(const char* shapeid); - char* StudyShapeId(); + char* StudyShapeId() {return strdup(_studyshapeid);}; void StudyShapeId(const char* studyshapeid); }; diff --git a/src/GEOM/GEOM_Contact_i.cc b/src/GEOM/GEOM_Contact_i.cc index 051118a14..c92caeae9 100644 --- a/src/GEOM/GEOM_Contact_i.cc +++ b/src/GEOM/GEOM_Contact_i.cc @@ -26,19 +26,17 @@ // Module : GEOM // $Header$ -using namespace std; #include "GEOM_Contact_i.hh" -#include "GEOM_Position_i.hh" -#include "GEOM_Rotation_i.hh" -#include "GEOM_Translation_i.hh" + +#include "utilities.h" + +using namespace std; //================================================================================= // function : GEOM_Contact_i() constructor (no arguments) // purpose : for what now ? //================================================================================= -GEOM_Contact_i::GEOM_Contact_i() -{ -} +GEOM_Contact_i::GEOM_Contact_i() {} //================================================================================= @@ -47,45 +45,17 @@ GEOM_Contact_i::GEOM_Contact_i() //================================================================================= GEOM_Contact_i::GEOM_Contact_i(Kinematic_Contact* Contact, GEOM::GEOM_Shape_ptr Shape1, - GEOM::GEOM_Shape_ptr Shape2, - GEOM::GEOM_Gen_ptr engine) + GEOM::GEOM_Shape_ptr Shape2) { _Contact = Contact; _Shape1 = GEOM::GEOM_Shape::_duplicate(Shape1); _Shape2 = GEOM::GEOM_Shape::_duplicate(Shape2); - GEOM::PointStruct p0 = engine->MakePointStruct(Contact->Position().Origin().X(), - Contact->Position().Origin().Y(), - Contact->Position().Origin().Z()); - GEOM::PointStruct pX = engine->MakePointStruct(Contact->Position().DirX().X(), - Contact->Position().DirX().Y(), - Contact->Position().DirX().Z()); - GEOM::PointStruct pY = engine->MakePointStruct(Contact->Position().DirY().X(), - Contact->Position().DirY().Y(), - Contact->Position().DirY().Z()); - GEOM::PointStruct pZ = engine->MakePointStruct(Contact->Position().DirZ().X(), - Contact->Position().DirZ().Y(), - Contact->Position().DirZ().Z()); - GEOM::DirStruct VX = engine->MakeDirection(pX); - GEOM::DirStruct VY = engine->MakeDirection(pY); - GEOM::DirStruct VZ = engine->MakeDirection(pZ); - GEOM_Position_i * Position_servant = new GEOM_Position_i(p0, VX, VY, VZ); - _Position = GEOM::GEOM_Position::_narrow(Position_servant->_this()); - - GEOM_Rotation_i * Rotation_servant = new GEOM_Rotation_i(Contact->Rotation().Rot1(), - Contact->Rotation().Rot2(), - Contact->Rotation().Rot3(), - Contact->Rotation().ValX(), - Contact->Rotation().ValY(), - Contact->Rotation().ValZ()); - _Rotation = GEOM::GEOM_Rotation::_narrow(Rotation_servant->_this()); - GEOM_Translation_i * Translation_servant = new GEOM_Translation_i(0, 0, 0); - _Translation = GEOM::GEOM_Translation::_narrow(Translation_servant->_this()); - _shapeid = ""; _studyshapeid = ""; - _name = ""; + + return; } @@ -96,76 +66,6 @@ GEOM_Contact_i::GEOM_Contact_i(Kinematic_Contact* Contact, GEOM_Contact_i::~GEOM_Contact_i() { delete &_Contact; } -//================================================================================= -// function : GetType() -// purpose : -//================================================================================= -CORBA::Long GEOM_Contact_i::GetType() throw(SALOME::SALOME_Exception) -{ - return _Contact->Type(); -} - - -//================================================================================= -// function : GetShape1() -// purpose : -//================================================================================= -GEOM::GEOM_Shape_ptr GEOM_Contact_i::GetShape1() throw(SALOME::SALOME_Exception) -{ - return GEOM::GEOM_Shape::_duplicate(_Shape1); -} - - -//================================================================================= -// function : GetShape2() -// purpose : -//================================================================================= -GEOM::GEOM_Shape_ptr GEOM_Contact_i::GetShape2() throw(SALOME::SALOME_Exception) -{ - return GEOM::GEOM_Shape::_duplicate(_Shape2); -} - - -//================================================================================= -// function : GetPosition() -// purpose : -//================================================================================= -GEOM::GEOM_Position_ptr GEOM_Contact_i::GetPosition() throw(SALOME::SALOME_Exception) -{ - return GEOM::GEOM_Position::_duplicate(_Position); -} - - -//================================================================================= -// function : GetRotation() -// purpose : -//================================================================================= -GEOM::GEOM_Rotation_ptr GEOM_Contact_i::GetRotation() throw(SALOME::SALOME_Exception) -{ - return GEOM::GEOM_Rotation::_duplicate(_Rotation); -} - - -//================================================================================= -// function : GetTranslation() -// purpose : -//================================================================================= -GEOM::GEOM_Translation_ptr GEOM_Contact_i::GetTranslation() throw(SALOME::SALOME_Exception) -{ - return GEOM::GEOM_Translation::_duplicate(_Translation); -} - - -//================================================================================= -// function : GetStep() -// purpose : -//================================================================================= -CORBA::Double GEOM_Contact_i::GetStep() throw(SALOME::SALOME_Exception) -{ - return _Contact->Step(); -} - - //================================================================================= // function : Name (set method) // purpose : to set the attribute 'name'. @@ -178,32 +78,12 @@ void GEOM_Contact_i::Name(const char* name) } -//================================================================================= -// function : Name (get method) -// purpose : to get the attribute 'name' of this shape -//================================================================================= -char* GEOM_Contact_i::Name() { return strdup(_name); } - - -//================================================================================= -// function : ShapeId -// purpose : to get the id of this shape from GEOM (OCAF entry) -//================================================================================= -char* GEOM_Contact_i::ShapeId() { return strdup(_shapeid); } - - //================================================================================= // function : ShapeId (set method) // purpose : to set the id of this shape in GEOM/OCAF doc //================================================================================= -void GEOM_Contact_i::ShapeId(const char * shapeid) { _shapeid = strdup(shapeid); } - - -//================================================================================= -// function : StudyShapeId (get method) -// purpose : to get the id of this shape from the study document (OCAF entry) -//================================================================================= -char* GEOM_Contact_i::StudyShapeId() { return strdup(_studyshapeid) ; } +void GEOM_Contact_i::ShapeId(const char * shapeid) +{ _shapeid = strdup(shapeid); } //================================================================================= @@ -212,3 +92,162 @@ char* GEOM_Contact_i::StudyShapeId() { return strdup(_studyshapeid) ; } //================================================================================= void GEOM_Contact_i::StudyShapeId(const char * studyshapeid) { _studyshapeid = strdup(studyshapeid); } + + +//================================================================================= +// function : GetPosition() +// purpose : +//================================================================================= +GEOM::ListOfDouble* GEOM_Contact_i::GetPosition() throw(SALOME::SALOME_Exception) +{ + GEOM::ListOfDouble_var aPositionList = new GEOM::ListOfDouble; + aPositionList->length(12); + + aPositionList[0] = _Contact->GetPosition().GetOrigin().X(); + aPositionList[1] = _Contact->GetPosition().GetOrigin().Y(); + aPositionList[2] = _Contact->GetPosition().GetOrigin().Z(); + + aPositionList[3] = _Contact->GetPosition().GetDirX().X(); + aPositionList[4] = _Contact->GetPosition().GetDirX().Y(); + aPositionList[5] = _Contact->GetPosition().GetDirX().Z(); + + aPositionList[6] = _Contact->GetPosition().GetDirY().X(); + aPositionList[7] = _Contact->GetPosition().GetDirY().Y(); + aPositionList[8] = _Contact->GetPosition().GetDirY().Z(); + + aPositionList[9] = _Contact->GetPosition().GetDirZ().X(); + aPositionList[10] = _Contact->GetPosition().GetDirZ().Y(); + aPositionList[11] = _Contact->GetPosition().GetDirZ().Z(); + + return aPositionList._retn(); +} + + +//================================================================================= +// function : GetAngularRange() +// purpose : +//================================================================================= +GEOM::ListOfDouble* GEOM_Contact_i::GetAngularRange() throw(SALOME::SALOME_Exception) +{ + GEOM::ListOfDouble_var anAngularRangeList = new GEOM::ListOfDouble; + anAngularRangeList->length(6); + + anAngularRangeList[0] = _Contact->GetAngularRange().GetMinValX(); + anAngularRangeList[1] = _Contact->GetAngularRange().GetMaxValX(); + + anAngularRangeList[2] = _Contact->GetAngularRange().GetMinValY(); + anAngularRangeList[3] = _Contact->GetAngularRange().GetMaxValY(); + + anAngularRangeList[4] = _Contact->GetAngularRange().GetMinValZ(); + anAngularRangeList[5] = _Contact->GetAngularRange().GetMaxValZ(); + + return anAngularRangeList._retn(); +} + + +//================================================================================= +// function : GetLinearRange() +// purpose : +//================================================================================= +GEOM::ListOfDouble* GEOM_Contact_i::GetLinearRange() throw(SALOME::SALOME_Exception) +{ + GEOM::ListOfDouble_var aLinearRangeList = new GEOM::ListOfDouble; + aLinearRangeList->length(6); + + aLinearRangeList[0] = _Contact->GetLinearRange().GetMinValX(); + aLinearRangeList[1] = _Contact->GetLinearRange().GetMaxValX(); + + aLinearRangeList[2] = _Contact->GetLinearRange().GetMinValY(); + aLinearRangeList[3] = _Contact->GetLinearRange().GetMaxValY(); + + aLinearRangeList[4] = _Contact->GetLinearRange().GetMinValZ(); + aLinearRangeList[5] = _Contact->GetLinearRange().GetMaxValZ(); + + return aLinearRangeList._retn(); +} + + +//================================================================================= +// function : SetPosition() +// purpose : +//================================================================================= +void GEOM_Contact_i::SetPosition(double P0x, double P0y, double P0z, + double VXx, double VXy, double VXz, + double VYx, double VYy, double VYz, + double VZx, double VZy, double VZz) + throw(SALOME::SALOME_Exception) +{ + gp_Pnt Center(P0x, P0y, P0z); + _Contact->GetPosition().SetOrigin(Center); + + if(VXx == 0 && VXy == 0 && VXz == 0) { + MESSAGE("Null Vector in Contact Position (SetVX)."<GetPosition().SetDirX(aDirX); + } + + if(VYx == 0 && VYy == 0 && VYz == 0) { + MESSAGE("Null Vector in Contact Position (SetVY)."<GetPosition().SetDirY(aDirY); + } + + if(VZx == 0 && VZy == 0 && VZz == 0) { + MESSAGE("Null Vector in Contact Position (SetVZ)."<GetPosition().SetDirZ(aDirZ); + } + + return; +} + + +//================================================================================= +// function : SetAngularRange() +// purpose : +//================================================================================= +void GEOM_Contact_i::SetAngularRange(double MinValX, double MaxValX, + double MinValY, double MaxValY, + double MinValZ, double MaxValZ) + throw(SALOME::SALOME_Exception) +{ + _Contact->GetAngularRange().SetRangeX(MinValX, MaxValX); + _Contact->GetAngularRange().SetRangeY(MinValY, MaxValY); + _Contact->GetAngularRange().SetRangeZ(MinValZ, MaxValZ); + + if(_Contact->GetType() == 9) { //HELICOIDAL + double p = _Contact->GetStep() / 360; + _Contact->GetLinearRange().SetRangeX(p * MinValX, p * MaxValX); + _Contact->GetLinearRange().SetRangeY(p * MinValY, p * MaxValY); + _Contact->GetLinearRange().SetRangeZ(p * MinValZ, p * MaxValZ); + } + + return; +} + + +//================================================================================= +// function : SetLinearRange() +// purpose : +//================================================================================= +void GEOM_Contact_i::SetLinearRange(double MinValX, double MaxValX, + double MinValY, double MaxValY, + double MinValZ, double MaxValZ) + throw(SALOME::SALOME_Exception) +{ + _Contact->GetLinearRange().SetRangeX(MinValX, MaxValX); + _Contact->GetLinearRange().SetRangeY(MinValY, MaxValY); + _Contact->GetLinearRange().SetRangeZ(MinValZ, MaxValZ); + + if(_Contact->GetType() == 9) { //HELICOIDAL + double p = 360 / _Contact->GetStep(); + _Contact->GetAngularRange().SetRangeX(p * MinValX, p * MaxValX); + _Contact->GetAngularRange().SetRangeY(p * MinValY, p * MaxValY); + _Contact->GetAngularRange().SetRangeZ(p * MinValZ, p * MaxValZ); + } + + return; +} diff --git a/src/GEOM/GEOM_Contact_i.hh b/src/GEOM/GEOM_Contact_i.hh index 6cd7ff94c..9e2ee826c 100644 --- a/src/GEOM/GEOM_Contact_i.hh +++ b/src/GEOM/GEOM_Contact_i.hh @@ -48,8 +48,7 @@ public: GEOM_Contact_i(); GEOM_Contact_i(Kinematic_Contact* Contact, GEOM::GEOM_Shape_ptr Shape1, - GEOM::GEOM_Shape_ptr Shape2, - GEOM::GEOM_Gen_ptr engine); + GEOM::GEOM_Shape_ptr Shape2); ~GEOM_Contact_i(); @@ -57,43 +56,51 @@ private: Kinematic_Contact* _Contact; GEOM::GEOM_Shape_ptr _Shape1; GEOM::GEOM_Shape_ptr _Shape2; - GEOM::GEOM_Position_ptr _Position; - GEOM::GEOM_Rotation_ptr _Rotation; - GEOM::GEOM_Translation_ptr _Translation; char* _name; char* _shapeid; char* _studyshapeid; // exists only if added in the study document public: - CORBA::Long GetType() + CORBA::Long GetType() throw (SALOME::SALOME_Exception) + {return _Contact->GetType();}; + CORBA::Double GetStep() throw (SALOME::SALOME_Exception) + {return _Contact->GetStep();}; + GEOM::GEOM_Shape_ptr GetShape1() throw (SALOME::SALOME_Exception) + {return GEOM::GEOM_Shape::_duplicate(_Shape1);}; + GEOM::GEOM_Shape_ptr GetShape2() throw (SALOME::SALOME_Exception) + {return GEOM::GEOM_Shape::_duplicate(_Shape2);}; + + GEOM::ListOfDouble* GetPosition() + throw (SALOME::SALOME_Exception); + GEOM::ListOfDouble* GetAngularRange() + throw (SALOME::SALOME_Exception); + GEOM::ListOfDouble* GetLinearRange() throw (SALOME::SALOME_Exception); - GEOM::GEOM_Shape_ptr GetShape1() + void SetPosition(double P0x, double P0y, double P0z, + double VXx, double VXy, double VXz, + double VYx, double VYy, double VYz, + double VZx, double VZy, double VZz) throw (SALOME::SALOME_Exception); - GEOM::GEOM_Shape_ptr GetShape2() + void SetAngularRange(double MinValX, double MaxValX, + double MinValY, double MaxValY, + double MinValZ, double MaxValZ) throw (SALOME::SALOME_Exception); - GEOM::GEOM_Position_ptr GetPosition() + void SetLinearRange(double MinValX, double MaxValX, + double MinValY, double MaxValY, + double MinValZ, double MaxValZ) throw (SALOME::SALOME_Exception); - GEOM::GEOM_Rotation_ptr GetRotation() - throw (SALOME::SALOME_Exception); - - GEOM::GEOM_Translation_ptr GetTranslation() - throw (SALOME::SALOME_Exception); - - CORBA::Double GetStep() - throw (SALOME::SALOME_Exception); - - char* Name(); + char* Name() {return strdup(_name);}; void Name(const char* name); - char* ShapeId(); + char* ShapeId() {return strdup(_shapeid);}; void ShapeId(const char* shapeid); - char* StudyShapeId(); + char* StudyShapeId() {return strdup(_studyshapeid) ;}; void StudyShapeId(const char* studyshapeid); }; diff --git a/src/GEOM/GEOM_Gen_i.cc b/src/GEOM/GEOM_Gen_i.cc index 48d910168..88301b077 100644 --- a/src/GEOM/GEOM_Gen_i.cc +++ b/src/GEOM/GEOM_Gen_i.cc @@ -31,6 +31,7 @@ using namespace std; #include "Partition_Spliter.hxx" #include "Archimede_VolumeSection.hxx" +#include "Sketcher_Profile.hxx" #include "Utils_CorbaException.hxx" #include "utilities.h" @@ -215,7 +216,7 @@ char* GEOM_Gen_i::IORToLocalPersistentID(SALOMEDS::SObject_ptr theSObject, { GEOM::GEOM_Shape_var aShape = GEOM::GEOM_Shape::_narrow(_orb->string_to_object(IORString)); if (!CORBA::is_nil(aShape)) { - return strdup(aShape->ShapeId()); + return CORBA::string_dup(aShape->ShapeId()); } GEOM::GEOM_Assembly_var aAssembly = GEOM::GEOM_Assembly::_narrow(_orb->string_to_object(IORString)); if (!CORBA::is_nil(aAssembly)) { @@ -407,8 +408,7 @@ char* GEOM_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, } /* Create the CORBA servant holding the TopoDS_Shape */ - GEOM::GEOM_Gen_ptr engine = POA_GEOM::GEOM_Gen::_this(); - GEOM_Contact_i * Contact_servant = new GEOM_Contact_i(Contact, aShape1, aShape2, engine); + GEOM_Contact_i * Contact_servant = new GEOM_Contact_i(Contact, aShape1, aShape2); GEOM::GEOM_Contact_var result = GEOM::GEOM_Contact::_narrow(Contact_servant->_this()); /* Create and set the name (IOR of shape converted into a string) */ @@ -476,6 +476,7 @@ char* GEOM_Gen_i::LocalPersistentIDToIOR(SALOMEDS::SObject_ptr theSObject, result->ShapeId(aPersRefString); return result->Name(); } + return 0 ; } //============================================================================ @@ -562,7 +563,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PublishInStudy(SALOMEDS::Study_ptr theStudy, aShapeName = "Vertex_"; } if (strlen(theName) == 0) aShapeName += TCollection_AsciiString(aResultSO->Tag()); - else aShapeName = TCollection_AsciiString(strdup(theName)); + else aShapeName = TCollection_AsciiString((char*)theName); //Set a name of the added shape anAttr = aStudyBuilder->FindOrCreateAttribute(aResultSO, "AttributeName"); @@ -645,7 +646,7 @@ CORBA::Boolean GEOM_Gen_i::Load(SALOMEDS::SComponent_ptr theComponent, if (!isMultiFile) SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.ToCString(), aSeq.in(), true); SALOMEDS::Study_var Study = theComponent->GetStudy(); - TCollection_AsciiString name( strdup(Study->Name()) ); + TCollection_AsciiString name( Study->Name() ); int StudyID = Study->StudyId(); myStudyIDToDoc.Bind( StudyID, myCurrentOCAFDoc ); @@ -673,7 +674,7 @@ CORBA::Boolean GEOM_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent, // void GEOM_Gen_i::Save(const char *IORSComponent, const char *aUrlOfFile) // { -// TCollection_ExtendedString path(strdup(aUrlOfFile)); +// TCollection_ExtendedString path((char*)aUrlOfFile); // TCollection_ExtendedString pathWithExt = path + TCollection_ExtendedString(".sgd"); // myOCAFApp->SaveAs(myCurrentOCAFDoc,pathWithExt); // } @@ -686,14 +687,14 @@ CORBA::Boolean GEOM_Gen_i::LoadASCII(SALOMEDS::SComponent_ptr theComponent, // void GEOM_Gen_i::Load(const char *IORSComponent, const char *aUrlOfFile) // { -// TCollection_ExtendedString path(strdup(aUrlOfFile)); +// TCollection_ExtendedString path((char*)aUrlOfFile); // TCollection_ExtendedString pathWithExt = path + TCollection_ExtendedString(".sgd"); // myOCAFApp->Open(pathWithExt,myCurrentOCAFDoc); // SALOMEDS::SComponent_var SC = SALOMEDS::SComponent::_narrow(_orb->string_to_object(IORSComponent)); // SALOMEDS::Study_var Study = SC->GetStudy(); -// TCollection_AsciiString name( strdup(Study->Name()) ); +// TCollection_AsciiString name( Study->Name() ); // int StudyID = Study->StudyId(); // myStudyIDToDoc.Bind( StudyID, myCurrentOCAFDoc ); @@ -840,7 +841,7 @@ SALOMEDS::SObject_ptr GEOM_Gen_i::PasteInto(const SALOMEDS::TMPFile& theStream, //============================================================================ char* GEOM_Gen_i::ComponentDataType() { - return strdup("GEOM"); + return CORBA::string_dup("GEOM"); } //============================================================================ @@ -850,7 +851,7 @@ char* GEOM_Gen_i::ComponentDataType() void GEOM_Gen_i::register_name(char * name) { GEOM::GEOM_Gen_ptr g = GEOM::GEOM_Gen::_narrow(POA_GEOM::GEOM_Gen::_this()); - name_service->Register(g, strdup(name)); + name_service->Register(g, name); } @@ -889,7 +890,7 @@ TopoDS_Shape GEOM_Gen_i::GetTopoShape(GEOM::GEOM_Shape_ptr shape_ptr) TDF_Label lab ; Handle(TDF_Data) D = myCurrentOCAFDoc->GetData() ; - TDF_Tool::Label( D, strdup(shape_ptr->ShapeId()), lab, true ) ; + TDF_Tool::Label( D, shape_ptr->ShapeId(), lab, true ) ; Handle(TNaming_NamedShape) NamedShape ; bool res = lab.FindAttribute(TNaming_NamedShape::GetID(), NamedShape) ; @@ -939,7 +940,7 @@ const char * GEOM_Gen_i::InsertInLabel(TopoDS_Shape S, const char *mystr, Handle { GEOMDS_Commands GC(OCAFDoc->Main()); /* add attributs S and mystr in a new label */ - TDF_Label Lab = GC.AddShape (S, strdup(mystr)); + TDF_Label Lab = GC.AddShape (S, (char*)mystr); TCollection_AsciiString entry; TDF_Tool::Entry(Lab,entry); @@ -967,7 +968,7 @@ const char * GEOM_Gen_i::InsertInLabelDependentShape( TopoDS_Shape S, TDF_Tool::Label(OCAFDoc->GetData(), mainshape_ptr->ShapeId(), mainRefLab); /* add attributs : S, nameIor and ref to main */ - TDF_Label Lab = GC.AddDependentShape(S, strdup(nameIor), mainRefLab); + TDF_Label Lab = GC.AddDependentShape(S, (char*)nameIor, mainRefLab); TCollection_AsciiString entry; TDF_Tool::Entry(Lab, entry); @@ -3003,7 +3004,6 @@ throw (SALOME::SALOME_Exception) GEOM::GEOM_Shape_var aShape = GetIORFromString( ListTools[ind] ); TopoDS_Shape Shape = GetTopoShape(aShape); if(Shape.IsNull() ) { - //MESSAGE ( "In Partition a tool shape is null" ); THROW_SALOME_CORBA_EXCEPTION("In Partition a shape is null", SALOME::BAD_PARAM); } if ( !ShapesMap.Contains( Shape ) && ToolsMap.Add( Shape )) @@ -3038,7 +3038,9 @@ throw (SALOME::SALOME_Exception) PS.AddShape(Shape); } + //MESSAGE ( "Partition::Compute() " ); PS.Compute ((TopAbs_ShapeEnum) Limit); + //MESSAGE ( "Partition::Compute() - END" ); // suppress result outside of shapes in KInsideMap for (ind = 0; ind < ListKeepInside.length(); ind++) { @@ -3164,6 +3166,7 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeFilling(GEOM::GEOM_Shape_ptr myShape, THROW_SALOME_CORBA_EXCEPTION("Initial shape doesn't contain only edges !", SALOME::BAD_PARAM); } C = BRep_Tool::Curve(TopoDS::Edge(Scurrent), First, Last); + if (C.IsNull()) continue; C = new Geom_TrimmedCurve(C, First, Last); Section.AddCurve(C) ; i++ ; @@ -3637,7 +3640,7 @@ GEOM::GEOM_Gen::ListOfIOR* GEOM_Gen_i::GetReferencedObjects(GEOM::GEOM_Shape_ptr Handle(TDataStd_Name) Att; L.FindAttribute(TDataStd_Name::GetID(),Att); TCollection_AsciiString nameIOR (Att->Get()) ; - aList[i] = strdup( nameIOR.ToCString() ); + aList[i] = CORBA::string_dup( nameIOR.ToCString() ); i++; } @@ -3687,7 +3690,7 @@ GEOM::GEOM_Gen::ListOfIOR* GEOM_Gen_i::GetObjects(GEOM::GEOM_Shape_ptr shape) if (!Att->Get().IsEqual(TCollection_ExtendedString("Arguments")) ) { TCollection_AsciiString nameIOR (Att->Get()); - aList[i] = strdup( nameIOR.ToCString() ); + aList[i] = CORBA::string_dup( nameIOR.ToCString() ); i++; } ChildIterator1.Next(); @@ -3708,8 +3711,10 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::ImportBREP(const char* filename) GEOM::GEOM_Shape_var result ; try { - BRep_Builder aBuilder; - BRepTools::Read(tds, strdup(filename), aBuilder) ; + BRep_Builder aBuilder; + char* aCopyfilename = strdup(filename); + BRepTools::Read(tds, aCopyfilename, aBuilder) ; + free(aCopyfilename); if (tds.IsNull()) { THROW_SALOME_CORBA_EXCEPTION("Import BRep aborted", SALOME::BAD_PARAM); } @@ -3863,10 +3868,21 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeFaces(const GEOM::GEOM_Gen::ListOfIOR& List FR.Perform(); if(FR.IsDone()) { - for(; FR.More(); FR.Next()) - aBuilder.Add(C, FR.Current().Oriented(OriF)); - result = CreateObject(C); - InsertInLabelMoreArguments(C, result, ListShapes, myCurrentOCAFDoc); + int k = 0; + TopoDS_Shape aFace; + for(; FR.More(); FR.Next()) { + aFace = FR.Current().Oriented(OriF); + aBuilder.Add(C, aFace); + k++; + } + if(k == 1) { + result = CreateObject(aFace); + InsertInLabelMoreArguments(aFace, result, ListShapes, myCurrentOCAFDoc); + } + else { + result = CreateObject(C); + InsertInLabelMoreArguments(C, result, ListShapes, myCurrentOCAFDoc); + } } } } @@ -4144,7 +4160,34 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeArc(const GEOM::PointStruct& pInit, return result ; } - +//================================================================================= + // function : MakeSketcher() + // purpose : Make a wire from a list containing many points + //================================================================================= + GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeSketcher( const char *Cmd ) + throw (SALOME::SALOME_Exception) + { + GEOM::GEOM_Shape_var result ; + TopoDS_Shape tds ; + try { + Sketcher_Profile aProfile (Cmd); + if(aProfile.IsDone()) + tds = aProfile.GetShape(); + } + catch(Standard_Failure) { + THROW_SALOME_CORBA_EXCEPTION("Exception catched in GEOM_Gen_i::MakeSketcher", SALOME::BAD_PARAM); + } + + if (tds.IsNull()) { + THROW_SALOME_CORBA_EXCEPTION("MakeSketcher aborted : null shape", SALOME::BAD_PARAM); + } + else { + result = CreateObject(tds); + const char *entry = InsertInLabel(tds, result->Name(), myCurrentOCAFDoc) ; + result->ShapeId(entry) ; + } + return result; + } //================================================================================= // function : MakeTranslation() @@ -5303,10 +5346,10 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakePanel(GEOM::GEOM_Shape_ptr shape, GEOM::GEOM_Gen::ListOfIOR_var aList = new GEOM::GEOM_Gen::ListOfIOR; aList->length(4); - aList[0]=strdup(Edge1->Name()); - aList[1]=strdup(Edge2->Name()); - aList[2]=strdup(Edge3->Name()); - aList[3]=strdup(Edge4->Name()); + aList[0]=CORBA::string_dup(Edge1->Name()); + aList[1]=CORBA::string_dup(Edge2->Name()); + aList[2]=CORBA::string_dup(Edge3->Name()); + aList[3]=CORBA::string_dup(Edge4->Name()); GEOM::GEOM_Shape_ptr aWire = MakeWire( aList ); GEOM::GEOM_Shape_ptr aFace = MakeFace( aWire, true ) ; @@ -5467,6 +5510,7 @@ GEOM::GEOM_Contact_ptr GEOM_Gen_i::AddContact(GEOM::GEOM_Assembly_ptr Ass, CORBA::Double step) throw (SALOME::SALOME_Exception) { + cout<<"GEOM_Gen_i::AddContact"<GetData(), Ass->ShapeId(), mainRefLab); @@ -5480,8 +5524,7 @@ GEOM::GEOM_Contact_ptr GEOM_Gen_i::AddContact(GEOM::GEOM_Assembly_ptr Ass, THROW_SALOME_CORBA_EXCEPTION("Exception catched in GEOM_Gen_i::AddContact", SALOME::BAD_PARAM); /* Create the CORBA servant holding the TopoDS_Shape */ - GEOM::GEOM_Gen_ptr engine = POA_GEOM::GEOM_Gen::_this(); - GEOM_Contact_i * Contact_servant = new GEOM_Contact_i(tds, Shape1, Shape2, engine); + GEOM_Contact_i * Contact_servant = new GEOM_Contact_i(tds, Shape1, Shape2); GEOM::GEOM_Contact_var Contact = GEOM::GEOM_Contact::_narrow(Contact_servant->_this()); /* Create and set the name (IOR of shape converted into a string) */ @@ -5511,6 +5554,7 @@ GEOM::GEOM_Animation_ptr GEOM_Gen_i::AddAnimation(GEOM::GEOM_Assembly_ptr Ass, const short NbSeq) throw (SALOME::SALOME_Exception) { + cout<<"GEOM_Gen_i::AddAnimation"<GetData(), Ass->ShapeId(), mainRefLab); @@ -5538,9 +5582,8 @@ GEOM::GEOM_Animation_ptr GEOM_Gen_i::AddAnimation(GEOM::GEOM_Assembly_ptr Ass, TCollection_AsciiString entry; TDF_Tool::Entry(Lab, entry); - const char *ent = entry.ToCString(); + Animation->ShapeId(entry.ToCString()); - Animation->ShapeId(ent); return Animation; } @@ -5557,16 +5600,12 @@ void GEOM_Gen_i::SetPosition(GEOM::GEOM_Contact_ptr Contact) TDF_Tool::Label(myCurrentOCAFDoc->GetData(), Contact->ShapeId(), mainRefLab); GEOMDS_Commands GC(myCurrentOCAFDoc->Main()); - GEOM::GEOM_Position_var myGeomPosition = GEOM::GEOM_Position::_narrow(Contact->GetPosition()); - GEOM::PointStruct P0 = myGeomPosition->GetOrigin(); - GEOM::DirStruct VX = myGeomPosition->GetVX(); - GEOM::DirStruct VY = myGeomPosition->GetVY(); - GEOM::DirStruct VZ = myGeomPosition->GetVZ(); + GEOM::ListOfDouble_var aList = Contact->GetPosition(); - GC.SetPosition(mainRefLab, P0.x, P0.y, P0.z, - VX.PS.x, VX.PS.y, VX.PS.z, - VY.PS.x, VY.PS.y, VY.PS.z, - VZ.PS.x, VZ.PS.y, VZ.PS.z); + GC.SetPosition(mainRefLab, aList[0], aList[1], aList[2], + aList[3], aList[4], aList[5], + aList[6], aList[7], aList[8], + aList[9], aList[10], aList[11]); } catch(Standard_Failure) THROW_SALOME_CORBA_EXCEPTION("Exception catched in GEOM_Gen_i::SetPosition", SALOME::BAD_PARAM); @@ -5576,10 +5615,10 @@ void GEOM_Gen_i::SetPosition(GEOM::GEOM_Contact_ptr Contact) //================================================================================= -// function : SetRotation() +// function : SetAngularRange() // purpose : //================================================================================= -void GEOM_Gen_i::SetRotation(GEOM::GEOM_Contact_ptr Contact) +void GEOM_Gen_i::SetAngularRange(GEOM::GEOM_Contact_ptr Contact) throw (SALOME::SALOME_Exception) { try { @@ -5587,28 +5626,23 @@ void GEOM_Gen_i::SetRotation(GEOM::GEOM_Contact_ptr Contact) TDF_Tool::Label(myCurrentOCAFDoc->GetData(), Contact->ShapeId(), mainRefLab); GEOMDS_Commands GC(myCurrentOCAFDoc->Main()); - GEOM::GEOM_Rotation_var myGeomRotation = GEOM::GEOM_Rotation::_narrow(Contact->GetRotation()); - int aRot1 = myGeomRotation->GetRot1(); - int aRot2 = myGeomRotation->GetRot2(); - int aRot3 = myGeomRotation->GetRot3(); - double aVal1 = myGeomRotation->GetVal1(); - double aVal2 = myGeomRotation->GetVal2(); - double aVal3 = myGeomRotation->GetVal3(); + GEOM::ListOfDouble_var aList = Contact->GetAngularRange(); - GC.SetRotation(mainRefLab, aRot1, aRot2, aRot3, aVal1, aVal2, aVal3); + GC.SetAngularRange(mainRefLab, aList[0], aList[1], aList[2], + aList[3], aList[4], aList[5]); } catch(Standard_Failure) - THROW_SALOME_CORBA_EXCEPTION("Exception catched in GEOM_Gen_i::SetRotation", SALOME::BAD_PARAM); + THROW_SALOME_CORBA_EXCEPTION("Exception catched in GEOM_Gen_i::SetAngularRange", SALOME::BAD_PARAM); return; } //================================================================================= -// function : SetTranslation() +// function : SetLinearRange() // purpose : //================================================================================= -void GEOM_Gen_i::SetTranslation(GEOM::GEOM_Contact_ptr Contact) +void GEOM_Gen_i::SetLinearRange(GEOM::GEOM_Contact_ptr Contact) throw (SALOME::SALOME_Exception) { try { @@ -5616,15 +5650,46 @@ void GEOM_Gen_i::SetTranslation(GEOM::GEOM_Contact_ptr Contact) TDF_Tool::Label(myCurrentOCAFDoc->GetData(), Contact->ShapeId(), mainRefLab); GEOMDS_Commands GC(myCurrentOCAFDoc->Main()); - GEOM::GEOM_Translation_var myGeomTranslation = GEOM::GEOM_Translation::_narrow(Contact->GetTranslation()); - double aValX = myGeomTranslation->GetValX(); - double aValY = myGeomTranslation->GetValY(); - double aValZ = myGeomTranslation->GetValZ(); + GEOM::ListOfDouble_var aList = Contact->GetLinearRange(); - GC.SetTranslation(mainRefLab, aValX, aValY, aValZ); + GC.SetLinearRange(mainRefLab, aList[0], aList[1], aList[2], + aList[3], aList[4], aList[5]); } catch(Standard_Failure) - THROW_SALOME_CORBA_EXCEPTION("Exception catched in GEOM_Gen_i::SetTranslation", SALOME::BAD_PARAM); + THROW_SALOME_CORBA_EXCEPTION("Exception catched in GEOM_Gen_i::SetLinearRange", SALOME::BAD_PARAM); + + return; +} + + +//================================================================================= +// function : SetDisplacement() +// purpose : +//================================================================================= +void GEOM_Gen_i::SetDisplacement(GEOM::GEOM_Animation_ptr Animation, GEOM::GEOM_Contact_ptr Contact) + throw (SALOME::SALOME_Exception) +{ + cout<<"GEOM_Gen_i::SetDisplacement"<GetData(), Animation->ShapeId(), mainRefLab); + GEOMDS_Commands GC(myCurrentOCAFDoc->Main()); + + GEOM::GEOM_Assembly_var anAss = Animation->GetAssembly(); + GEOM::ListOfContact_var aContactList = anAss->GetContactList(); + int aKContact; + for(int i = 0; i < anAss->NbContacts(); i++) { + if(Contact == aContactList[i]) + aKContact = i; + } + + GEOM::ListOfDouble_var aList = Animation->GetDisplacement(Contact); + GC.SetDisplacement(mainRefLab, aKContact, + aList[0], aList[1], aList[2], aList[3], aList[4], aList[5], + aList[6], aList[7], aList[8], aList[9], aList[10], aList[11]); + } + catch(Standard_Failure) + THROW_SALOME_CORBA_EXCEPTION("Exception catched in GEOM_Gen_i::SetDisplacement", SALOME::BAD_PARAM); return; } diff --git a/src/GEOM/GEOM_Gen_i.hh b/src/GEOM/GEOM_Gen_i.hh index 83a9a72c2..ed533c610 100644 --- a/src/GEOM/GEOM_Gen_i.hh +++ b/src/GEOM/GEOM_Gen_i.hh @@ -392,6 +392,7 @@ class GEOM_Gen_i: public POA_GEOM::GEOM_Gen, GEOM::GEOM_Shape_ptr MakePlacedBox(CORBA::Double x1, CORBA::Double y1, CORBA::Double z1, CORBA::Double delta1, CORBA::Double delta2, CORBA::Double delta3) throw (SALOME::SALOME_Exception) ; + GEOM::GEOM_Shape_ptr MakePanel(GEOM::GEOM_Shape_ptr shape, CORBA::Short directiontype, CORBA::Double delta) @@ -400,18 +401,18 @@ class GEOM_Gen_i: public POA_GEOM::GEOM_Gen, //---------------------------------------------------------------------// // Transformations Operations // //---------------------------------------------------------------------// - // Copy - GEOM::GEOM_Shape_ptr MakeCopy(GEOM::GEOM_Shape_ptr shape) + // Copy + GEOM::GEOM_Shape_ptr MakeCopy( GEOM::GEOM_Shape_ptr shape) throw (SALOME::SALOME_Exception) ; // Translation - GEOM::GEOM_Shape_ptr MakeTranslation(GEOM::GEOM_Shape_ptr shape, + GEOM::GEOM_Shape_ptr MakeTranslation( GEOM::GEOM_Shape_ptr shape, CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception) ; // Rotation - GEOM::GEOM_Shape_ptr MakeRotation(GEOM::GEOM_Shape_ptr shape, + GEOM::GEOM_Shape_ptr MakeRotation( GEOM::GEOM_Shape_ptr shape, const GEOM::AxisStruct& axis, CORBA::Double angle) throw (SALOME::SALOME_Exception) ; @@ -587,6 +588,14 @@ class GEOM_Gen_i: public POA_GEOM::GEOM_Gen, const GEOM::PointStruct& pEnd) throw (SALOME::SALOME_Exception) ; + //-------------------------------------------------------------------// + // Specific method Sketcher // + //-------------------------------------------------------------------// + GEOM::GEOM_Shape_ptr MakeSketcher (const char* Cmd) + throw (SALOME::SALOME_Exception) ; + + //-------------------------------------------------------------------// + GEOM::GEOM_Shape_ptr MakeCompound (const GEOM::GEOM_Gen::ListOfIOR& ListShapes) throw (SALOME::SALOME_Exception) ; GEOM::GEOM_Shape_ptr MakeWire (const GEOM::GEOM_Gen::ListOfIOR& ListShapes) @@ -632,9 +641,12 @@ class GEOM_Gen_i: public POA_GEOM::GEOM_Gen, throw (SALOME::SALOME_Exception) ; void SetPosition(GEOM::GEOM_Contact_ptr Contact) throw (SALOME::SALOME_Exception) ; - void SetRotation(GEOM::GEOM_Contact_ptr Contact) + void SetAngularRange(GEOM::GEOM_Contact_ptr Contact) throw (SALOME::SALOME_Exception) ; - void SetTranslation(GEOM::GEOM_Contact_ptr Contact) + void SetLinearRange(GEOM::GEOM_Contact_ptr Contact) + throw (SALOME::SALOME_Exception) ; + void SetDisplacement(GEOM::GEOM_Animation_ptr Animation, + GEOM::GEOM_Contact_ptr Contact) throw (SALOME::SALOME_Exception) ; }; diff --git a/src/GEOM/GEOM_Position_i.cc b/src/GEOM/GEOM_Position_i.cc deleted file mode 100644 index 3db2cf744..000000000 --- a/src/GEOM/GEOM_Position_i.cc +++ /dev/null @@ -1,147 +0,0 @@ -// GEOM GEOM : -// -// 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 : GEOM_Position_i.cc -// Author : Damien COQUERET -// Module : GEOM -// $Header$ - -using namespace std; -#include "GEOM_Position_i.hh" - -//================================================================================= -// function : GEOM_Position_i() constructor (no arguments) -// purpose : for what now ? -//================================================================================= -GEOM_Position_i::GEOM_Position_i() -{ -} - - -//================================================================================= -// function : constructor -// purpose : constructor for servant creation -//================================================================================= -GEOM_Position_i::GEOM_Position_i(const GEOM::PointStruct& P0, const GEOM::DirStruct& VX, - const GEOM::DirStruct& VY, const GEOM::DirStruct& VZ) -{ - - SetOrigin(P0); - SetVX(VX); - SetVY(VY); - SetVZ(VZ); - return; - -} - - -//================================================================================= -// function : destructor -// purpose : -//================================================================================= -GEOM_Position_i::~GEOM_Position_i() {} - - -//================================================================================= -// function : SetOrigin() -// purpose : -//================================================================================= -void GEOM_Position_i::SetOrigin(const GEOM::PointStruct& P0) - throw(SALOME::SALOME_Exception) -{ - _P0 = P0; - return; -} - -//================================================================================= -// function : SetVX() -// purpose : -//================================================================================= -void GEOM_Position_i::SetVX(const GEOM::DirStruct& Vect) - throw(SALOME::SALOME_Exception) -{ - _VX = Vect; - return; -} - -//================================================================================= -// function : SetVY() -// purpose : -//================================================================================= -void GEOM_Position_i::SetVY(const GEOM::DirStruct& Vect) - throw(SALOME::SALOME_Exception) -{ - _VY = Vect; - return; -} - -//================================================================================= -// function : SetVZ() -// purpose : -//================================================================================= -void GEOM_Position_i::SetVZ(const GEOM::DirStruct& Vect) - throw(SALOME::SALOME_Exception) -{ - _VZ = Vect; - return; -} - -//================================================================================= -// function : GetOrigin() -// purpose : -//================================================================================= -GEOM::PointStruct GEOM_Position_i::GetOrigin() - throw(SALOME::SALOME_Exception) -{ - return _P0; -} - -//================================================================================= -// function : GetVX() -// purpose : -//================================================================================= -GEOM::DirStruct GEOM_Position_i::GetVX() - throw(SALOME::SALOME_Exception) -{ - return _VX; -} - -//================================================================================= -// function : GetVY() -// purpose : -//================================================================================= -GEOM::DirStruct GEOM_Position_i::GetVY() - throw(SALOME::SALOME_Exception) -{ - return _VY; -} - -//================================================================================= -// function : GetVZ() -// purpose : -//================================================================================= -GEOM::DirStruct GEOM_Position_i::GetVZ() - throw(SALOME::SALOME_Exception) -{ - return _VZ; -} diff --git a/src/GEOM/GEOM_Position_i.hh b/src/GEOM/GEOM_Position_i.hh deleted file mode 100644 index 57b66a0f0..000000000 --- a/src/GEOM/GEOM_Position_i.hh +++ /dev/null @@ -1,84 +0,0 @@ -// GEOM GEOM : -// -// 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 : GEOM_Position_i.hh -// Author : Damien COQUERET -// Module : GEOM -// $Header$ - -#ifndef __GEOM_POSITION_I_H__ -#define __GEOM_POSITION_I_H__ - -// IDL headers -#include -#include CORBA_SERVER_HEADER(GEOM_Gen) -#include CORBA_SERVER_HEADER(GEOM_Shape) -#include CORBA_SERVER_HEADER(GEOM_Kinematic) - -//===================================================================== -// GEOM_Position_i : class definition -//===================================================================== -class GEOM_Position_i: - public POA_GEOM::GEOM_Position -{ -public: - GEOM_Position_i(); - GEOM_Position_i(const GEOM::PointStruct& P0, const GEOM::DirStruct& VX, - const GEOM::DirStruct& VY, const GEOM::DirStruct& VZ); - - ~GEOM_Position_i(); - -private: - GEOM::PointStruct _P0; - GEOM::DirStruct _VX; - GEOM::DirStruct _VY; - GEOM::DirStruct _VZ; - -public: - void SetOrigin(const GEOM::PointStruct& P0) - throw (SALOME::SALOME_Exception); - - void SetVX(const GEOM::DirStruct& Vect) - throw (SALOME::SALOME_Exception); - - void SetVY(const GEOM::DirStruct& Vect) - throw (SALOME::SALOME_Exception); - - void SetVZ(const GEOM::DirStruct& Vect) - throw (SALOME::SALOME_Exception); - - GEOM::PointStruct GetOrigin() - throw (SALOME::SALOME_Exception); - - GEOM::DirStruct GetVX() - throw (SALOME::SALOME_Exception); - - GEOM::DirStruct GetVY() - throw (SALOME::SALOME_Exception); - - GEOM::DirStruct GetVZ() - throw (SALOME::SALOME_Exception); - -}; - -#endif diff --git a/src/GEOM/GEOM_Rotation_i.cc b/src/GEOM/GEOM_Rotation_i.cc deleted file mode 100644 index c0fa00432..000000000 --- a/src/GEOM/GEOM_Rotation_i.cc +++ /dev/null @@ -1,135 +0,0 @@ -// GEOM GEOM : -// -// 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 : GEOM_Rotation_i.cc -// Author : Damien COQUERET -// Module : GEOM -// $Header$ - -using namespace std; -#include "GEOM_Rotation_i.hh" - -//================================================================================= -// function : GEOM_Rotation_i() constructor (no arguments) -// purpose : for what now ? -//================================================================================= -GEOM_Rotation_i::GEOM_Rotation_i() -{ -} - - -//================================================================================= -// function : constructor -// purpose : constructor for servant creation -//================================================================================= -GEOM_Rotation_i::GEOM_Rotation_i(CORBA::Long Rot1, CORBA::Long Rot2, CORBA::Long Rot3, - CORBA::Double Val1, CORBA::Double Val2, CORBA::Double Val3) -{ - - SetRotation(Rot1, Rot2, Rot3, Val1, Val2, Val3); - return; - -} - - -//================================================================================= -// function : destructor -// purpose : -//================================================================================= -GEOM_Rotation_i::~GEOM_Rotation_i() {} - - -//================================================================================= -// function : SetRotation() -// purpose : -//================================================================================= -void GEOM_Rotation_i::SetRotation(CORBA::Long Rot1, CORBA::Long Rot2, CORBA::Long Rot3, - CORBA::Double Val1, CORBA::Double Val2, CORBA::Double Val3) - throw(SALOME::SALOME_Exception) -{ - - _Rot1 = Rot1; - _Rot2 = Rot2; - _Rot3 = Rot3; - - _Val1 = Val1; - _Val2 = Val2; - _Val3 = Val3; - - return; - -} - -//================================================================================= -// function : GetRot1() -// purpose : -//================================================================================= -CORBA::Long GEOM_Rotation_i::GetRot1() throw(SALOME::SALOME_Exception) -{ - return _Rot1; -} - -//================================================================================= -// function : GetRot2() -// purpose : -//================================================================================= -CORBA::Long GEOM_Rotation_i::GetRot2() throw(SALOME::SALOME_Exception) -{ - return _Rot2; -} - -//================================================================================= -// function : GetRot3() -// purpose : -//================================================================================= -CORBA::Long GEOM_Rotation_i::GetRot3() throw(SALOME::SALOME_Exception) -{ - return _Rot3; -} - -//================================================================================= -// function : GetVal1() -// purpose : -//================================================================================= -CORBA::Double GEOM_Rotation_i::GetVal1() throw(SALOME::SALOME_Exception) -{ - return _Val1; -} - -//================================================================================= -// function : GetVal2() -// purpose : -//================================================================================= -CORBA::Double GEOM_Rotation_i::GetVal2() throw(SALOME::SALOME_Exception) -{ - return _Val2; -} - -//================================================================================= -// function : GetVal3() -// purpose : -//================================================================================= -CORBA::Double GEOM_Rotation_i::GetVal3() throw(SALOME::SALOME_Exception) -{ - return _Val3; -} diff --git a/src/GEOM/GEOM_Rotation_i.hh b/src/GEOM/GEOM_Rotation_i.hh deleted file mode 100644 index 598073005..000000000 --- a/src/GEOM/GEOM_Rotation_i.hh +++ /dev/null @@ -1,85 +0,0 @@ -// GEOM GEOM : -// -// 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 : GEOM_Rotation_i.hh -// Author : Damien COQUERET -// Module : GEOM -// $Header$ - -#ifndef __GEOM_ROTATION_I_H__ -#define __GEOM_ROTATION_I_H__ - -// IDL headers -#include -#include CORBA_SERVER_HEADER(GEOM_Gen) -#include CORBA_SERVER_HEADER(GEOM_Shape) -#include CORBA_SERVER_HEADER(GEOM_Kinematic) - -//===================================================================== -// GEOM_Rotation_i : class definition -//===================================================================== -class GEOM_Rotation_i: - public POA_GEOM::GEOM_Rotation -{ -public: - GEOM_Rotation_i(); - GEOM_Rotation_i(CORBA::Long Rot1, CORBA::Long Rot2, CORBA::Long Rot3, - CORBA::Double Val1, CORBA::Double Val2, CORBA::Double Val3); - - ~GEOM_Rotation_i(); - -private: - CORBA::Long _Rot1; - CORBA::Long _Rot2; - CORBA::Long _Rot3; - - CORBA::Double _Val1; - CORBA::Double _Val2; - CORBA::Double _Val3; - -public: - void SetRotation(CORBA::Long Rot1, CORBA::Long Rot2, CORBA::Long Rot3, - CORBA::Double Val1, CORBA::Double Val2, CORBA::Double Val3) - throw (SALOME::SALOME_Exception); - - CORBA::Long GetRot1() - throw (SALOME::SALOME_Exception); - - CORBA::Long GetRot2() - throw (SALOME::SALOME_Exception); - - CORBA::Long GetRot3() - throw (SALOME::SALOME_Exception); - - CORBA::Double GetVal1() - throw (SALOME::SALOME_Exception); - - CORBA::Double GetVal2() - throw (SALOME::SALOME_Exception); - - CORBA::Double GetVal3() - throw (SALOME::SALOME_Exception); - -}; - -#endif diff --git a/src/GEOM/GEOM_Shape_i.cc b/src/GEOM/GEOM_Shape_i.cc index 60db998b4..bd2110d50 100644 --- a/src/GEOM/GEOM_Shape_i.cc +++ b/src/GEOM/GEOM_Shape_i.cc @@ -26,13 +26,16 @@ // Module : GEOM // $Header$ -using namespace std; -#include -#include "GEOM_Shape_i.hh" -#include "SALOME_NamingService.hxx" #include +#include + +#include #include +#include "GEOM_Shape_i.hh" +#include "SALOME_NamingService.hxx" + +using namespace std; //================================================================================= @@ -84,7 +87,7 @@ GEOM_Shape_i::~GEOM_Shape_i() { delete &_geom; } // : WARNING : Register to naming service actually removed ! //================================================================================= void GEOM_Shape_i::Name(const char* name) { - _name = strdup(name); + _name = CORBA::string_dup(name); GEOM::GEOM_Shape_ptr g = GEOM::GEOM_Shape::_narrow(_this()); // Removed declaration of shapes to naming service @@ -97,14 +100,14 @@ void GEOM_Shape_i::Name(const char* name) { // function : Name (get method) // purpose : to get the attribute 'name' of this shape //================================================================================= -char* GEOM_Shape_i::Name() { return strdup(_name); } +char* GEOM_Shape_i::Name() { return CORBA::string_dup(_name); } //================================================================================= // function : MainName (set method) // purpose : to set the attribute 'name' of this mainshape. //================================================================================= void GEOM_Shape_i::MainName(const char* name) { - _mainname = strdup(name); + _mainname = CORBA::string_dup(name); } @@ -112,7 +115,7 @@ void GEOM_Shape_i::MainName(const char* name) { // function : MainName (get method) // purpose : to get the attribute 'name' of this shape //================================================================================= -char* GEOM_Shape_i::MainName() { return strdup(_mainname); } +char* GEOM_Shape_i::MainName() { return CORBA::string_dup(_mainname); } //================================================================================= // function : IsMainShape (get method) @@ -132,14 +135,14 @@ void GEOM_Shape_i::IsMainShape(const bool abool) { _ismain = abool ; } // function : ShapeId // purpose : to get the id of this shape from GEOM (OCAF entry) //================================================================================= -char* GEOM_Shape_i::ShapeId() { return strdup(_shapeid) ; } +char* GEOM_Shape_i::ShapeId() { return CORBA::string_dup(_shapeid) ; } //================================================================================= // function : ShapeId (set method) // purpose : to set the id of this shape in GEOM/OCAF doc //================================================================================= -void GEOM_Shape_i::ShapeId(const char * shapeid) { _shapeid = strdup(shapeid) ; } +void GEOM_Shape_i::ShapeId(const char * shapeid) { _shapeid = CORBA::string_dup(shapeid) ; } @@ -147,7 +150,7 @@ void GEOM_Shape_i::ShapeId(const char * shapeid) { _shapeid = strdup(shapeid) ; // function : StudyShapeId (get method) // purpose : to get the id of this shape from the study document (OCAF entry) //================================================================================= -char* GEOM_Shape_i::StudyShapeId() { return strdup(_studyshapeid) ; } +char* GEOM_Shape_i::StudyShapeId() { return CORBA::string_dup(_studyshapeid) ; } //================================================================================= @@ -155,7 +158,7 @@ char* GEOM_Shape_i::StudyShapeId() { return strdup(_studyshapeid) ; } // purpose : to set the id of this shape in the Study document (OCAF entry) //================================================================================= void GEOM_Shape_i::StudyShapeId(const char * studyshapeid) -{ _studyshapeid = strdup(studyshapeid) ; } +{ _studyshapeid = CORBA::string_dup(studyshapeid) ; } @@ -209,7 +212,7 @@ void GEOM_Shape_i::NameType(const char* name) { // function : NameType (get method) // purpose : to get the attribute 'nametype' of this shape //================================================================================= -char* GEOM_Shape_i::NameType() { return strdup(_nametype); } +char* GEOM_Shape_i::NameType() { return CORBA::string_dup(_nametype); } //================================================================================= // function : GetShapeStream diff --git a/src/GEOM/GEOM_Translation_i.hh b/src/GEOM/GEOM_Translation_i.hh deleted file mode 100644 index 923207767..000000000 --- a/src/GEOM/GEOM_Translation_i.hh +++ /dev/null @@ -1,70 +0,0 @@ -// GEOM GEOM : -// -// 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 : GEOM_Translation_i.hh -// Author : Damien COQUERET -// Module : GEOM -// $Header$ - -#ifndef __GEOM_TRANSLATION_I_H__ -#define __GEOM_TRANSLATION_I_H__ - -// IDL headers -#include -#include CORBA_SERVER_HEADER(GEOM_Gen) -#include CORBA_SERVER_HEADER(GEOM_Shape) -#include CORBA_SERVER_HEADER(GEOM_Kinematic) - -//===================================================================== -// GEOM_Translation_i : class definition -//===================================================================== -class GEOM_Translation_i: - public POA_GEOM::GEOM_Translation -{ -public: - GEOM_Translation_i(); - GEOM_Translation_i(CORBA::Double ValX, CORBA::Double ValY, CORBA::Double ValZ); - - ~GEOM_Translation_i(); - -private: - CORBA::Double _ValX; - CORBA::Double _ValY; - CORBA::Double _ValZ; - -public: - void SetTranslation(CORBA::Double ValX, CORBA::Double ValY, CORBA::Double ValZ) - throw (SALOME::SALOME_Exception); - - CORBA::Double GetValX() - throw (SALOME::SALOME_Exception); - - CORBA::Double GetValY() - throw (SALOME::SALOME_Exception); - - CORBA::Double GetValZ() - throw (SALOME::SALOME_Exception); - -}; - -#endif diff --git a/src/GEOM/Makefile.in b/src/GEOM/Makefile.in index 03e5d9640..99fa12b9b 100644 --- a/src/GEOM/Makefile.in +++ b/src/GEOM/Makefile.in @@ -37,7 +37,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl # Libraries targets LIB = libGEOMEngine.la -LIB_SRC = GEOM_Shape_i.cc GEOM_Position_i.cc GEOM_Rotation_i.cc GEOM_Translation_i.cc GEOM_Contact_i.cc GEOM_Assembly_i.cc GEOM_Animation_i.cc GEOM_Gen_i.cc +LIB_SRC = GEOM_Shape_i.cc GEOM_Contact_i.cc GEOM_Assembly_i.cc GEOM_Animation_i.cc GEOM_Gen_i.cc LIB_SERVER_IDL = SALOME_Component.idl SALOMEDS.idl SALOME_Exception.idl GEOM_Gen.idl GEOM_Shape.idl GEOM_Kinematic.idl # Executables targets @@ -46,12 +46,12 @@ BIN_SRC = BIN_CLIENT_IDL = BIN_SERVER_IDL = -EXPORT_HEADERS = +EXPORT_HEADERS = GEOM_Assembly_i.hh # additionnal information to compil and link file CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lGEOMDS -lTOOLSDS -lSalomeNS -lSalomeContainer -lGEOMPartition -lGEOMArchimede -lGEOMKinematic $(CAS_LDPATH) -lTKIGES -lTKSTEP -lTKFillet -lTKOffset -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS += -lGEOMDS -lTOOLSDS -lSalomeNS -lSalomeContainer -lGEOMPartition -lGEOMArchimede -lGEOMSketcher -lGEOMKinematic $(CAS_LDPATH) -lTKIGES -lTKSTEP -lTKFillet -lTKOffset -L${KERNEL_ROOT_DIR}/lib/salome # additional file to be cleaned MOSTLYCLEAN = diff --git a/src/GEOMBase/GEOMBase.cxx b/src/GEOMBase/GEOMBase.cxx index f3c845c66..d1ede3674 100644 --- a/src/GEOMBase/GEOMBase.cxx +++ b/src/GEOMBase/GEOMBase.cxx @@ -219,9 +219,9 @@ bool GEOMBase::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString GEOM::GEOM_Contact_ptr myGeomContact = myGeomBase->ConvertIOinContact(IO, testResult); int type = myGeomContact->GetType(); if(type == 0 || type == 2) //EMBEDDING || SLIDE - popup->removeItem(6132); //ROTATION + popup->removeItem(6123); //ANGULAR if(type == 0 || type == 1 || type == 4) //EMBEDDING || PIVOT || SPHERICAL - popup->removeItem(6133); //TRANSLATION + popup->removeItem(6124); //LINEAR popup->removeItem(QAD_DisplayOnly_Popup_ID); popup->removeItem(QAD_Display_Popup_ID); popup->removeItem(QAD_Erase_Popup_ID); @@ -382,9 +382,9 @@ bool GEOMBase::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString GEOM::GEOM_Contact_ptr myGeomContact = myGeomBase->ConvertIOinContact(IO, testResult); int type = myGeomContact->GetType(); if(type == 0 || type == 2) //EMBEDDING || SLIDE - popup->removeItem(6132); //ROTATION + popup->removeItem(6123); //ANGULAR if(type == 0 || type == 1 || type == 4) //EMBEDDING || PIVOT || SPHERICAL - popup->removeItem(6133); //TRANSLATION + popup->removeItem(6124); //LINEAR popup->removeItem(QAD_DisplayOnly_Popup_ID); popup->removeItem(QAD_Display_Popup_ID); popup->removeItem(QAD_Erase_Popup_ID); @@ -717,11 +717,17 @@ bool GEOMBase::AddInStudy(bool selection, const Handle(SALOME_InteractiveObject) QString Name = SALOMEGUI_NameDlg::getName(QAD_Application::getDesktop(), anIO->getName()); if(!Name.isEmpty()) { // VTK - if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) - GActor->setName(strdup(Name.latin1())); + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + char* aCopy = CORBA::string_dup(Name.latin1()); + GActor->setName(aCopy); + delete(aCopy); + } // OCC - else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) - GAISShape->setName(strdup(Name.latin1())); + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + char* aCopy = CORBA::string_dup(Name.latin1()); + GAISShape->setName(aCopy); + delete(aCopy); + } } else return false; @@ -958,55 +964,55 @@ bool GEOMBase::GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString& { case TopAbs_COMPOUND: { - aTypeString = strdup(tr("GEOM_COMPOUND")); + aTypeString = CORBA::string_dup(tr("GEOM_COMPOUND")); return true; } case TopAbs_COMPSOLID: { - aTypeString = strdup(tr("GEOM_COMPOUNDSOLID")) ; + aTypeString = CORBA::string_dup(tr("GEOM_COMPOUNDSOLID")) ; return true ; } case TopAbs_SOLID: { - aTypeString = strdup(tr("GEOM_SOLID")) ; + aTypeString = CORBA::string_dup(tr("GEOM_SOLID")) ; return true ; } case TopAbs_SHELL: { - aTypeString = strdup(tr("GEOM_SHELL")) ; + aTypeString = CORBA::string_dup(tr("GEOM_SHELL")) ; return true ; } case TopAbs_FACE: { BRepAdaptor_Surface surf(TopoDS::Face(aShape)); if(surf.GetType() == GeomAbs_Plane) { - aTypeString = strdup(tr("GEOM_PLANE")); + aTypeString = CORBA::string_dup(tr("GEOM_PLANE")); return true; } else if(surf.GetType() == GeomAbs_Cylinder) { - aTypeString = strdup(tr("GEOM_SURFCYLINDER")); + aTypeString = CORBA::string_dup(tr("GEOM_SURFCYLINDER")); return true; } else if(surf.GetType() == GeomAbs_Sphere) { - aTypeString = strdup(tr("GEOM_SURFSPHERE")); + aTypeString = CORBA::string_dup(tr("GEOM_SURFSPHERE")); return true ; } else if(surf.GetType() == GeomAbs_Torus) { - aTypeString = strdup(tr("GEOM_SURFTORUS")); + aTypeString = CORBA::string_dup(tr("GEOM_SURFTORUS")); return true ; } else if(surf.GetType() == GeomAbs_Cone) { - aTypeString = strdup(tr("GEOM_SURFCONE")); + aTypeString = CORBA::string_dup(tr("GEOM_SURFCONE")); return true ; } else { - aTypeString = strdup(tr("GEOM_FACE")); + aTypeString = CORBA::string_dup(tr("GEOM_FACE")); return true; } } case TopAbs_WIRE: { - aTypeString = strdup(tr("GEOM_WIRE")); + aTypeString = CORBA::string_dup(tr("GEOM_WIRE")); return true; } case TopAbs_EDGE: @@ -1014,31 +1020,31 @@ bool GEOMBase::GetShapeTypeString(const TopoDS_Shape& aShape, Standard_CString& BRepAdaptor_Curve curv(TopoDS::Edge(aShape)); if(curv.GetType() == GeomAbs_Line) { if((Abs(curv.FirstParameter()) >= 1E6) || (Abs(curv.LastParameter()) >= 1E6)) - aTypeString = strdup(tr("GEOM_LINE")); + aTypeString = CORBA::string_dup(tr("GEOM_LINE")); else - aTypeString = strdup(tr("GEOM_EDGE")); + aTypeString = CORBA::string_dup(tr("GEOM_EDGE")); return true; } else if(curv.GetType() == GeomAbs_Circle) { if(curv.IsClosed()) - aTypeString = strdup(tr("GEOM_CIRCLE")); + aTypeString = CORBA::string_dup(tr("GEOM_CIRCLE")); else - aTypeString = strdup(tr("GEOM_ARC")); + aTypeString = CORBA::string_dup(tr("GEOM_ARC")); return true; } else { - aTypeString = strdup(tr("GEOM_EDGE")); + aTypeString = CORBA::string_dup(tr("GEOM_EDGE")); return true; } } case TopAbs_VERTEX: { - aTypeString = strdup(tr("GEOM_VERTEX")); + aTypeString = CORBA::string_dup(tr("GEOM_VERTEX")); return true; } case TopAbs_SHAPE: { - aTypeString = strdup(tr("GEOM_SHAPE")); + aTypeString = CORBA::string_dup(tr("GEOM_SHAPE")); return true; } } @@ -1349,7 +1355,7 @@ void GEOMBase::ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, GEOM::GEOM CORBA::String_var theValue = anIOR->Value(); CORBA::Object_var theObj = _orb->string_to_object(theValue); if(theObj->_is_a("IDL:GEOM/GEOM_Shape:1.0")) { - listIOR[j] = strdup(theValue); + listIOR[j] = CORBA::string_dup(theValue); j++; } } @@ -1357,7 +1363,7 @@ void GEOMBase::ConvertListOfIOInListOfIOR(const SALOME_ListIO& aList, GEOM::GEOM else if(IObject->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject))) { Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast(IObject); Standard_CString ior = GIObject->getIOR(); - listIOR[j] = strdup(ior); + listIOR[j] = CORBA::string_dup(ior); j++; } } @@ -1593,7 +1599,9 @@ bool GEOMBase::SelectionByNameInDialogs(QWidget* aWidget, const QString& objectU SALOMEDS::SObject_var theObj = listSO[0]; /* Create a SALOME_InteractiveObject with a SALOME::SObject */ Standard_CString anEntry = theObj->GetID(); - Handle(SALOME_InteractiveObject) SI = new SALOME_InteractiveObject(anEntry, "GEOM", strdup(objectUserName)); + char* aCopyobjectUserName = CORBA::string_dup(objectUserName); + Handle(SALOME_InteractiveObject) SI = new SALOME_InteractiveObject(anEntry, "GEOM", aCopyobjectUserName); + delete(aCopyobjectUserName); /* Add as a selected object */ /* Clear any previous selection : */ @@ -1617,6 +1625,23 @@ bool GEOMBase::DefineDlgPosition(QWidget* aDlg, int& x, int& y) return true; } +QString GEOMBase::GetDefaultName(const QString& theOperation) +{ + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + int aNumber = 0; + QString aName; + SALOMEDS::SObject_var obj; + + do + { + aName = theOperation+"_"+QString::number(++aNumber); + obj = aStudy->FindObject(aName); + } + while (!obj->_is_nil()); + + return aName; +} + //===================================================================================== // EXPORTED METHODS diff --git a/src/GEOMBase/GEOMBase.h b/src/GEOMBase/GEOMBase.h index 12cbd728f..56ce5ff9c 100644 --- a/src/GEOMBase/GEOMBase.h +++ b/src/GEOMBase/GEOMBase.h @@ -116,6 +116,9 @@ public : bool SelectionByNameInDialogs(QWidget* aWidget, const QString& userObjectName, SALOME_Selection *Sel); bool DefineDlgPosition(QWidget* aDlg, int& x, int& y); + /* This method generates default names for results of geometrical operations */ + static QString GetDefaultName(const QString& theOperation); + GEOMContext* myGeomGUI; GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ diff --git a/src/GEOMBase/GEOMBase_Skeleton.h b/src/GEOMBase/GEOMBase_Skeleton.h index 0ec58c125..cfeb6ea45 100644 --- a/src/GEOMBase/GEOMBase_Skeleton.h +++ b/src/GEOMBase/GEOMBase_Skeleton.h @@ -39,6 +39,7 @@ #include #include #include +#include class GEOMBase_Skeleton : public DlgRef_Skeleton_QTD { diff --git a/src/GEOMContext/GEOMContext.cxx b/src/GEOMContext/GEOMContext.cxx index aed81c294..fcd33c80f 100644 --- a/src/GEOMContext/GEOMContext.cxx +++ b/src/GEOMContext/GEOMContext.cxx @@ -81,6 +81,7 @@ GEOMContext* GEOMContext::GetOrCreateGeomGUI(QAD_Desktop* desktop) /* GetCurrentStudy */ int studyId = desktop->getActiveStudy()->getStudyId(); GeomGUI->myComponentGeom->GetCurrentStudy(studyId); + GeomGUI->myNbGeom = GeomGUI->myComponentGeom->NbLabels(); } @@ -88,7 +89,7 @@ GEOMContext* GEOMContext::GetOrCreateGeomGUI(QAD_Desktop* desktop) int studyId = desktop->getActiveStudy()->getStudyId(); GeomGUI->myComponentGeom->GetCurrentStudy(studyId); - //GeomGUI->myNbGeom = GeomGUI->myComponentGeom->NbLabels(); + GeomGUI->myNbGeom = GeomGUI->myComponentGeom->NbLabels(); return GeomGUI; } diff --git a/src/GEOMContext/GEOMContext.h b/src/GEOMContext/GEOMContext.h index f5746fc2f..e83a93288 100644 --- a/src/GEOMContext/GEOMContext.h +++ b/src/GEOMContext/GEOMContext.h @@ -31,7 +31,6 @@ #include "QAD_Desktop.h" #include "GEOM_Client.hxx" -#include "GEOM_Sketcher.h" #include #include @@ -51,7 +50,6 @@ private : QDialog* myActiveDialogBox; /* Unique active dialog box */ GEOM_Client myShapeReader; Standard_CString myFatherior; - Sketch mySketcher; public : int myNbGeom; /* Unique name for a geom entity */ @@ -68,7 +66,6 @@ public : int& GetNbGeom(){return myNbGeom;}; GEOM_Client& GetShapeReader(){return myShapeReader;}; Standard_CString& GetFatherior(){return myFatherior;}; - Sketch& GetSketcher(){return mySketcher;}; bool LoadLibrary(QString GUILibrary); diff --git a/src/GEOMContext/GEOM_icons.po b/src/GEOMContext/GEOM_icons.po index 08e173903..943bd4296 100644 --- a/src/GEOMContext/GEOM_icons.po +++ b/src/GEOMContext/GEOM_icons.po @@ -410,10 +410,6 @@ msgstr "anim_prev.png" msgid "ICON_ANIM_PLAY" msgstr "anim_play.png" -#: -msgid "ICON_ANIM_STOP" -msgstr "anim_stop.png" - #: msgid "ICON_ANIM_NEXT" msgstr "anim_next.png" diff --git a/src/GEOMContext/GEOM_msg_en.po b/src/GEOMContext/GEOM_msg_en.po index bee59ab47..35f35bf7f 100644 --- a/src/GEOMContext/GEOM_msg_en.po +++ b/src/GEOMContext/GEOM_msg_en.po @@ -1314,6 +1314,24 @@ msgstr "Fillet can't be computed with radius %1" msgid "GEOM_CHAMFER_ABORT" msgstr "Chamfer can't be computed with %1 and %2" +msgid "GEOM_RANGE_X" +msgstr "X" + +msgid "GEOM_RANGE_Y" +msgstr "Y" + +msgid "GEOM_RANGE_Z" +msgstr "Z" + +msgid "GEOM_RANGE_TITLE" +msgstr "Define Contact Range" + +msgid "GEOM_LIN_RANGE" +msgstr "Linear Range" + +msgid "GEOM_ANG_RANGE" +msgstr "Angular Range" + msgid "GEOM_CONTACT_TITLE" msgstr "Add Contact" @@ -1398,6 +1416,36 @@ msgstr "Animation" msgid "GEOM_ANIM_INLOOP" msgstr "In Loop" +msgid "GEOM_ANIMVALUES_TITLE" +msgstr "Set Values of Animation" + +msgid "GEOM_ANIMVALUES" +msgstr "Animation Values" + +msgid "GEOM_BEGIN" +msgstr "Begin" + +msgid "GEOM_END" +msgstr "End" + +msgid "GEOM_RX" +msgstr "RX" + +msgid "GEOM_RY" +msgstr "RY" + +msgid "GEOM_RZ" +msgstr "RZ" + +msgid "GEOM_TX" +msgstr "TX" + +msgid "GEOM_TY" +msgstr "TY" + +msgid "GEOM_TZ" +msgstr "TZ" + msgid "GEOM_POSITION" msgstr "Position" diff --git a/src/GEOMContext/GEOM_msg_fr.po b/src/GEOMContext/GEOM_msg_fr.po index bdf18ab6f..494ee85c0 100644 --- a/src/GEOMContext/GEOM_msg_fr.po +++ b/src/GEOMContext/GEOM_msg_fr.po @@ -1315,6 +1315,24 @@ msgstr "Le congé ne peut-être realisé avec un rayon de %1 " msgid "GEOM_CHAMFER_ABORT" msgstr "Le chanfrein ne peut-être realisé avec %1 et %2 " +msgid "GEOM_RANGE_X" +msgstr "X" + +msgid "GEOM_RANGE_Y" +msgstr "Y" + +msgid "GEOM_RANGE_Z" +msgstr "Z" + +msgid "GEOM_RANGE_TITLE" +msgstr "Débattement de Contact" + +msgid "GEOM_LIN_RANGE" +msgstr "Débattement Linéaire" + +msgid "GEOM_ANG_RANGE" +msgstr "Débattement Angulaire" + msgid "GEOM_CONTACT_TITLE" msgstr "Nouveau Contact" @@ -1399,6 +1417,36 @@ msgstr "Animation" msgid "GEOM_ANIM_INLOOP" msgstr "En boucle" +msgid "GEOM_ANIMVALUES_TITLE" +msgstr "Définir les Valeurs d'Animation" + +msgid "GEOM_ANIMVALUES" +msgstr "Valeurs d'Animation" + +msgid "GEOM_BEGIN" +msgstr "Début" + +msgid "GEOM_END" +msgstr "Fin" + +msgid "GEOM_RX" +msgstr "RX" + +msgid "GEOM_RY" +msgstr "RY" + +msgid "GEOM_RZ" +msgstr "RZ" + +msgid "GEOM_TX" +msgstr "TX" + +msgid "GEOM_TY" +msgstr "TY" + +msgid "GEOM_TZ" +msgstr "TZ" + msgid "GEOM_POSITION" msgstr "Position" diff --git a/src/GEOMContext/Makefile.in b/src/GEOMContext/Makefile.in index 9215429ea..7f564228c 100644 --- a/src/GEOMContext/Makefile.in +++ b/src/GEOMContext/Makefile.in @@ -60,6 +60,6 @@ LIB_SERVER_IDL = CPPFLAGS += $(QT_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMSketcher -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -L${KERNEL_ROOT_DIR}/lib/salome @CONCLUDE@ diff --git a/src/GEOMDS/GEOMDS_Commands.cxx b/src/GEOMDS/GEOMDS_Commands.cxx index aad004200..5af23a8c4 100644 --- a/src/GEOMDS/GEOMDS_Commands.cxx +++ b/src/GEOMDS/GEOMDS_Commands.cxx @@ -342,56 +342,56 @@ TDF_Label GEOMDS_Commands::AddContact(Kinematic_Contact& KContact, TDataStd_Integer::Set(LabContactType, 2); TDF_Label LabType = LabContact.NewChild(); - TDataStd_Integer::Set(LabType, KContact.Type()); + TDataStd_Integer::Set(LabType, KContact.GetType()); int ret; TDF_Label NewLab1 = LabContact.NewChild(); TNaming_Builder B1(NewLab1); - B1.Select(KContact.Shape1(), KContact.Shape1()); - TDF_Label RefLab1 = TNaming_Tool::Label(myLab, KContact.Shape1(), ret); + B1.Select(KContact.GetShape1(), KContact.GetShape1()); + TDF_Label RefLab1 = TNaming_Tool::Label(myLab, KContact.GetShape1(), ret); TDF_Reference::Set(NewLab1, RefLab1); TDF_Label NewLab2 = LabContact.NewChild(); TNaming_Builder B2(NewLab2); - B2.Select(KContact.Shape2(), KContact.Shape2()); - TDF_Label RefLab2 = TNaming_Tool::Label(myLab, KContact.Shape2(), ret); + B2.Select(KContact.GetShape2(), KContact.GetShape2()); + TDF_Label RefLab2 = TNaming_Tool::Label(myLab, KContact.GetShape2(), ret); TDF_Reference::Set(NewLab2, RefLab2); TDF_Label LabPosition = LabContact.NewChild(); Handle(TDataStd_RealArray) RealArrayP = TDataStd_RealArray::Set(LabPosition, 1, 12); - RealArrayP->SetValue(1, KContact.Position().Origin().X()); - RealArrayP->SetValue(2, KContact.Position().Origin().Y()); - RealArrayP->SetValue(3, KContact.Position().Origin().Z()); - RealArrayP->SetValue(4, KContact.Position().DirX().X()); - RealArrayP->SetValue(5, KContact.Position().DirX().Y()); - RealArrayP->SetValue(6, KContact.Position().DirX().Z()); - RealArrayP->SetValue(7, KContact.Position().DirY().X()); - RealArrayP->SetValue(8, KContact.Position().DirY().Y()); - RealArrayP->SetValue(9, KContact.Position().DirY().Z()); - RealArrayP->SetValue(10, KContact.Position().DirZ().X()); - RealArrayP->SetValue(11, KContact.Position().DirZ().Y()); - RealArrayP->SetValue(12, KContact.Position().DirZ().Z()); + RealArrayP->SetValue(1, KContact.GetPosition().GetOrigin().X()); + RealArrayP->SetValue(2, KContact.GetPosition().GetOrigin().Y()); + RealArrayP->SetValue(3, KContact.GetPosition().GetOrigin().Z()); + RealArrayP->SetValue(4, KContact.GetPosition().GetDirX().X()); + RealArrayP->SetValue(5, KContact.GetPosition().GetDirX().Y()); + RealArrayP->SetValue(6, KContact.GetPosition().GetDirX().Z()); + RealArrayP->SetValue(7, KContact.GetPosition().GetDirY().X()); + RealArrayP->SetValue(8, KContact.GetPosition().GetDirY().Y()); + RealArrayP->SetValue(9, KContact.GetPosition().GetDirY().Z()); + RealArrayP->SetValue(10, KContact.GetPosition().GetDirZ().X()); + RealArrayP->SetValue(11, KContact.GetPosition().GetDirZ().Y()); + RealArrayP->SetValue(12, KContact.GetPosition().GetDirZ().Z()); - TDF_Label LabRotation1 = LabContact.NewChild(); - Handle(TDataStd_IntegerArray) IntegerArrayR = TDataStd_IntegerArray::Set(LabRotation1, 1, 3); - IntegerArrayR->SetValue(1, KContact.Rotation().Rot1()); - IntegerArrayR->SetValue(2, KContact.Rotation().Rot2()); - IntegerArrayR->SetValue(3, KContact.Rotation().Rot3()); + TDF_Label LabAngularRange = LabContact.NewChild(); + Handle(TDataStd_RealArray) RealArrayR = TDataStd_RealArray::Set(LabAngularRange, 1, 6); + RealArrayR->SetValue(1, KContact.GetAngularRange().GetMinValX()); + RealArrayR->SetValue(2, KContact.GetAngularRange().GetMaxValX()); + RealArrayR->SetValue(3, KContact.GetAngularRange().GetMinValY()); + RealArrayR->SetValue(4, KContact.GetAngularRange().GetMaxValY()); + RealArrayR->SetValue(5, KContact.GetAngularRange().GetMinValZ()); + RealArrayR->SetValue(6, KContact.GetAngularRange().GetMaxValZ()); - TDF_Label LabRotation2 = LabContact.NewChild(); - Handle(TDataStd_RealArray) RealArrayR = TDataStd_RealArray::Set(LabRotation2, 1, 3); - RealArrayR->SetValue(1, KContact.Rotation().ValX()); - RealArrayR->SetValue(2, KContact.Rotation().ValY()); - RealArrayR->SetValue(3, KContact.Rotation().ValZ()); - - TDF_Label LabTranslation = LabContact.NewChild(); - Handle(TDataStd_RealArray) RealArrayT = TDataStd_RealArray::Set(LabTranslation, 1, 3); - RealArrayT->SetValue(1, KContact.Translation().ValX()); - RealArrayT->SetValue(2, KContact.Translation().ValY()); - RealArrayT->SetValue(3, KContact.Translation().ValZ()); + TDF_Label LabLinearRange = LabContact.NewChild(); + Handle(TDataStd_RealArray) RealArrayT = TDataStd_RealArray::Set(LabLinearRange, 1, 6); + RealArrayT->SetValue(1, KContact.GetLinearRange().GetMinValX()); + RealArrayT->SetValue(2, KContact.GetLinearRange().GetMaxValX()); + RealArrayT->SetValue(3, KContact.GetLinearRange().GetMinValY()); + RealArrayT->SetValue(4, KContact.GetLinearRange().GetMaxValY()); + RealArrayT->SetValue(5, KContact.GetLinearRange().GetMinValZ()); + RealArrayT->SetValue(6, KContact.GetLinearRange().GetMaxValZ()); TDF_Label LabStep = LabContact.NewChild(); - TDataStd_Real::Set(LabStep, KContact.Step()); + TDataStd_Real::Set(LabStep, KContact.GetStep()); return LabContact; } @@ -405,6 +405,7 @@ TDF_Label GEOMDS_Commands::AddAnimation(Kinematic_Animation& KAnimation, const TDF_Label& AssLab, const TCollection_ExtendedString& Name) { + cout<<"GEOMDS_Commands::AddAnimation"< aContactList = returnAss->GetContactList(); + list ::const_iterator it = aContactList.begin(); + int i = 0; + while(it != aContactList.end()) { + TDF_Label LabDisplacement = LabAnimation.NewChild(); + Handle(TDataStd_RealArray) RealArrayT = TDataStd_RealArray::Set(LabDisplacement, 1, 12); + + list aList = KAnimation.GetDisplacement(i); + list ::const_iterator it1 = aList.begin(); + int k = 1; + while(it1 != aList.end()) { + RealArrayT->SetValue(k, *it1); + k++; + it1++; + } + i++; + it++; + } + } return LabAnimation; } @@ -480,7 +503,6 @@ Standard_Boolean GEOMDS_Commands::GetContact(const TDF_Label& aLabel, Handle(TDataStd_Integer) anAttInteger1; Handle(TDataStd_Integer) anAttInteger2; Handle(TDataStd_Real) anAttReal; - Handle(TDataStd_IntegerArray) anAttIntegerArrayR; Handle(TDataStd_RealArray) anAttRealArrayP; Handle(TDataStd_RealArray) anAttRealArrayR; Handle(TDataStd_RealArray) anAttRealArrayT; @@ -492,41 +514,36 @@ Standard_Boolean GEOMDS_Commands::GetContact(const TDF_Label& aLabel, } } if(i == 2 && L.FindAttribute(TDataStd_Integer::GetID(), anAttInteger2)) { - Contact->Type(anAttInteger2->Get()); + Contact->SetType(anAttInteger2->Get()); } if(i == 3 && L.FindAttribute(TNaming_NamedShape::GetID(), anAttTopo1)) { - Contact->Shape1(TNaming_Tool::GetShape(anAttTopo1)); + Contact->SetShape1(TNaming_Tool::GetShape(anAttTopo1)); } if(i == 4 && L.FindAttribute(TNaming_NamedShape::GetID(), anAttTopo2)) { - Contact->Shape2(TNaming_Tool::GetShape(anAttTopo2)); + Contact->SetShape2(TNaming_Tool::GetShape(anAttTopo2)); } if(i == 5 && L.FindAttribute(TDataStd_RealArray::GetID(), anAttRealArrayP)) { gp_Pnt Center(anAttRealArrayP->Value(1), anAttRealArrayP->Value(2), anAttRealArrayP->Value(3)); gp_Dir aDirX(anAttRealArrayP->Value(4), anAttRealArrayP->Value(5), anAttRealArrayP->Value(6)); gp_Dir aDirY(anAttRealArrayP->Value(7), anAttRealArrayP->Value(8), anAttRealArrayP->Value(9)); gp_Dir aDirZ(anAttRealArrayP->Value(10), anAttRealArrayP->Value(11), anAttRealArrayP->Value(12)); - Contact->Position().Origin(Center); - Contact->Position().DirX(aDirX); - Contact->Position().DirY(aDirY); - Contact->Position().DirZ(aDirZ); + Contact->GetPosition().SetOrigin(Center); + Contact->GetPosition().SetDirX(aDirX); + Contact->GetPosition().SetDirY(aDirY); + Contact->GetPosition().SetDirZ(aDirZ); } - if(i == 6 && L.FindAttribute(TDataStd_IntegerArray::GetID(), anAttIntegerArrayR)) { - Contact->Rotation().Rot1(anAttIntegerArrayR->Value(1)); - Contact->Rotation().Rot2(anAttIntegerArrayR->Value(2)); - Contact->Rotation().Rot3(anAttIntegerArrayR->Value(3)); + if(i == 6 && L.FindAttribute(TDataStd_RealArray::GetID(), anAttRealArrayR)) { + Contact->GetAngularRange().SetRangeX(anAttRealArrayR->Value(1), anAttRealArrayR->Value(2)); + Contact->GetAngularRange().SetRangeY(anAttRealArrayR->Value(3), anAttRealArrayR->Value(4)); + Contact->GetAngularRange().SetRangeZ(anAttRealArrayR->Value(5), anAttRealArrayR->Value(6)); } - if(i == 7 && L.FindAttribute(TDataStd_RealArray::GetID(), anAttRealArrayR)) { - Contact->Rotation().ValX(anAttRealArrayR->Value(1)); - Contact->Rotation().ValY(anAttRealArrayR->Value(2)); - Contact->Rotation().ValZ(anAttRealArrayR->Value(3)); + if(i == 7 && L.FindAttribute(TDataStd_RealArray::GetID(), anAttRealArrayT)) { + Contact->GetLinearRange().SetRangeX(anAttRealArrayT->Value(1), anAttRealArrayT->Value(2)); + Contact->GetLinearRange().SetRangeY(anAttRealArrayT->Value(3), anAttRealArrayT->Value(4)); + Contact->GetLinearRange().SetRangeZ(anAttRealArrayT->Value(5), anAttRealArrayT->Value(6)); } - if(i == 8 && L.FindAttribute(TDataStd_RealArray::GetID(), anAttRealArrayT)) { - Contact->Translation().ValX(anAttRealArrayT->Value(1)); - Contact->Translation().ValY(anAttRealArrayT->Value(2)); - Contact->Translation().ValZ(anAttRealArrayT->Value(3)); - } - if(i == 9 && L.FindAttribute(TDataStd_Real::GetID(), anAttReal)) { - Contact->Step(anAttReal->Get()); + if(i == 8 && L.FindAttribute(TDataStd_Real::GetID(), anAttReal)) { + Contact->SetStep(anAttReal->Get()); } i++; } @@ -542,16 +559,19 @@ Standard_Boolean GEOMDS_Commands::GetContact(const TDF_Label& aLabel, Standard_Boolean GEOMDS_Commands::GetAnimation(const TDF_Label& aLabel, Kinematic_Animation& returnAnim) { + cout<<"GEOMDS_Commands::GetAnimation"<Get() != 3) { @@ -562,16 +582,23 @@ Standard_Boolean GEOMDS_Commands::GetAnimation(const TDF_Label& aLabel, if(i == 2) { Kinematic_Assembly* aAss = new Kinematic_Assembly(); Standard_Boolean test = GetAssembly(L, *aAss); - Anim->Assembly(aAss); + Anim->SetAssembly(aAss); } if(i == 3 && L.FindAttribute(TNaming_NamedShape::GetID(), anAttTopo)) { - Anim->Frame(TNaming_Tool::GetShape(anAttTopo)); + Anim->SetFrame(TNaming_Tool::GetShape(anAttTopo)); } if(i == 4 && L.FindAttribute(TDataStd_Real::GetID(), anAttReal)) { - Anim->Duration(anAttReal->Get()); + Anim->SetDuration(anAttReal->Get()); } if(i == 5 && L.FindAttribute(TDataStd_Integer::GetID(), anAttInteger1)) { - Anim->NbSeq(anAttInteger1->Get()); + Anim->SetNbSeq(anAttInteger1->Get()); + } + if(i > 5 && L.FindAttribute(TDataStd_RealArray::GetID(), anAttRealArrayP)) { + list aList; + for(int j = 1; j <= 12; j++) + aList.push_back(anAttRealArrayP->Value(j)); + Anim->SetDisplacement(k, aList); + k++; } i++; } @@ -619,29 +646,27 @@ void GEOMDS_Commands::SetPosition(const TDF_Label& aLabel, //======================================================================= -// function : SetRotation() +// function : SetAngularRange() // purpose : //======================================================================= -void GEOMDS_Commands::SetRotation(const TDF_Label& aLabel, - int Rot1, int Rot2, int Rot3, - double Val1, double Val2, double Val3) +void GEOMDS_Commands::SetAngularRange(const TDF_Label& aLabel, + double MinValX, double MaxValX, + double MinValY, double MaxValY, + double MinValZ, double MaxValZ) { TDF_ChildIterator it; int i = 1; for(it.Initialize(aLabel, Standard_False); it.More(); it.Next()) { TDF_Label L = it.Value(); - Handle(TDataStd_IntegerArray) anAttIntegerArrayR; Handle(TDataStd_RealArray) anAttRealArrayR; - if(i == 6 && L.FindAttribute(TDataStd_IntegerArray::GetID(), anAttIntegerArrayR)) { - anAttIntegerArrayR->SetValue(1, Rot1); - anAttIntegerArrayR->SetValue(2, Rot2); - anAttIntegerArrayR->SetValue(3, Rot3); - } - if(i == 7 && L.FindAttribute(TDataStd_RealArray::GetID(), anAttRealArrayR)) { - anAttRealArrayR->SetValue(1, Val1); - anAttRealArrayR->SetValue(2, Val2); - anAttRealArrayR->SetValue(3, Val3); + if(i == 6 && L.FindAttribute(TDataStd_RealArray::GetID(), anAttRealArrayR)) { + anAttRealArrayR->SetValue(1, MinValX); + anAttRealArrayR->SetValue(2, MaxValX); + anAttRealArrayR->SetValue(3, MinValY); + anAttRealArrayR->SetValue(4, MaxValY); + anAttRealArrayR->SetValue(5, MinValZ); + anAttRealArrayR->SetValue(6, MaxValZ); return; } i++; @@ -651,11 +676,13 @@ void GEOMDS_Commands::SetRotation(const TDF_Label& aLabel, //======================================================================= -// function : SetTranslation() +// function : SetLinearRange() // purpose : //======================================================================= -void GEOMDS_Commands::SetTranslation(const TDF_Label& aLabel, - double Val1, double Val2, double Val3) +void GEOMDS_Commands::SetLinearRange(const TDF_Label& aLabel, + double MinValX, double MaxValX, + double MinValY, double MaxValY, + double MinValZ, double MaxValZ) { TDF_ChildIterator it; int i = 1; @@ -663,13 +690,56 @@ void GEOMDS_Commands::SetTranslation(const TDF_Label& aLabel, TDF_Label L = it.Value(); Handle(TDataStd_RealArray) anAttRealArrayT; - if(i == 8 && L.FindAttribute(TDataStd_RealArray::GetID(), anAttRealArrayT)) { - anAttRealArrayT->SetValue(1, Val1); - anAttRealArrayT->SetValue(2, Val2); - anAttRealArrayT->SetValue(3, Val3); + if(i == 7 && L.FindAttribute(TDataStd_RealArray::GetID(), anAttRealArrayT)) { + anAttRealArrayT->SetValue(1, MinValX); + anAttRealArrayT->SetValue(2, MaxValX); + anAttRealArrayT->SetValue(3, MinValY); + anAttRealArrayT->SetValue(4, MaxValY); + anAttRealArrayT->SetValue(5, MinValZ); + anAttRealArrayT->SetValue(6, MaxValZ); return; } i++; } return; } + + +//======================================================================= +// function : SetDisplacement() +// purpose : +//======================================================================= +void GEOMDS_Commands::SetDisplacement(const TDF_Label& aLabel, int aContact, + double MinValRX, double MaxValRX, + double MinValRY, double MaxValRY, + double MinValRZ, double MaxValRZ, + double MinValTX, double MaxValTX, + double MinValTY, double MaxValTY, + double MinValTZ, double MaxValTZ) +{ + cout<<"GEOMDS_Commands::SetDisplacement"<SetValue(1, MinValRX); + anAttRealArrayT->SetValue(2, MaxValRX); + anAttRealArrayT->SetValue(3, MinValRY); + anAttRealArrayT->SetValue(4, MaxValRY); + anAttRealArrayT->SetValue(5, MinValRZ); + anAttRealArrayT->SetValue(6, MaxValRZ); + anAttRealArrayT->SetValue(7, MinValTX); + anAttRealArrayT->SetValue(8, MaxValTX); + anAttRealArrayT->SetValue(9, MinValTY); + anAttRealArrayT->SetValue(10, MaxValTY); + anAttRealArrayT->SetValue(11, MinValTZ); + anAttRealArrayT->SetValue(12, MaxValTZ); + } + i++; + } + return; +} diff --git a/src/GEOMDS/GEOMDS_Commands.hxx b/src/GEOMDS/GEOMDS_Commands.hxx index f45516a7a..cf5471d5b 100644 --- a/src/GEOMDS/GEOMDS_Commands.hxx +++ b/src/GEOMDS/GEOMDS_Commands.hxx @@ -146,10 +146,21 @@ public: double VXx, double VXy, double VXz, double VYx, double VYy, double VYz, double VZx, double VZy, double VZz) ; - Standard_EXPORT void SetRotation(const TDF_Label& aLabel, int Rot1, int Rot2, int Rot3, - double Val1, double Val2, double Val3) ; - Standard_EXPORT void SetTranslation(const TDF_Label& aLabel, - double Val1, double Val2, double Val3) ; + Standard_EXPORT void SetAngularRange(const TDF_Label& aLabel, + double MinValX, double MaxValX, + double MinValY, double MaxValY, + double MinValZ, double MaxValZ) ; + Standard_EXPORT void SetLinearRange(const TDF_Label& aLabel, + double MinValX, double MaxValX, + double MinValY, double MaxValY, + double MinValZ, double MaxValZ) ; + Standard_EXPORT void SetDisplacement(const TDF_Label& aLabel, int aContact, + double MinValRX, double MaxValRX, + double MinValRY, double MaxValRY, + double MinValRZ, double MaxValRZ, + double MinValTX, double MaxValTX, + double MinValTY, double MaxValTY, + double MinValTZ, double MaxValTZ) ; protected: diff --git a/src/GEOMDS/GEOMDS_Commands.jxx b/src/GEOMDS/GEOMDS_Commands.jxx index 017dcd329..8d4cccf10 100644 --- a/src/GEOMDS/GEOMDS_Commands.jxx +++ b/src/GEOMDS/GEOMDS_Commands.jxx @@ -35,4 +35,4 @@ #endif #ifndef _GEOMDS_Commands_HeaderFile #include "GEOMDS_Commands.hxx" -#endif \ No newline at end of file +#endif diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index 139007359..332bd7869 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -63,10 +63,9 @@ typedef bool CP(QAD_Desktop*, QPopupMenu*, const QString&, // function : GeometryGUI() // purpose : Constructor //======================================================================= -GeometryGUI::GeometryGUI() : - QObject() -{ -} +GeometryGUI::GeometryGUI( const QString& theName, QObject* theParent ) : + SALOMEGUI( theName, theParent ) +{} //======================================================================= @@ -109,7 +108,6 @@ bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) return false; Mb->setItemEnabled(404, ViewOCC);//SKETCHER - Mb->setItemEnabled(406, ViewOCC);//SKETCHER Mb->setItemEnabled(603, ViewOCC);//SuppressFace Mb->setItemEnabled(604, ViewOCC);//SuppressHole @@ -117,169 +115,134 @@ bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) Mb->setItemEnabled(413, ViewOCC);// ShadingColor Settings Mb->setItemEnabled(414, ViewOCC);// Isos Settings - if(theCommandID == 4041 || // SKETCHER - POPUP VIEWER - SEGMENT - theCommandID == 4042 || // SKETCHER - POPUP VIEWER - ARC - theCommandID == 4043 || // SKETCHER - POPUP VIEWER - SET ANGLE - theCommandID == 4044 || // SKETCHER - POPUP VIEWER - SET X - theCommandID == 4045 || // SKETCHER - POPUP VIEWER - SET Y - theCommandID == 4046 || // SKETCHER - POPUP VIEWER - DELETE - theCommandID == 4047 || // SKETCHER - POPUP VIEWER - END - theCommandID == 4048 || // SKETCHER - POPUP VIEWER - CLOSE - theCommandID == 4051 || // SKETCHER - MENU - SET PLANE - theCommandID == 4052 || // SKETCHER - MENU - TANGENT - theCommandID == 4053 || // SKETCHER - MENU - PERPENDICULAR - theCommandID == 4061 || // SKETCHER - MENU - LENGTH - theCommandID == 4062 || // SKETCHER - MENU - ANGLE - theCommandID == 4063 || // SKETCHER - MENU - RADIUS - theCommandID == 4064 || // SKETCHER - MENU - X - theCommandID == 4065) { // SKETCHER - MENU - Y + if(theCommandID == 111 || // MENU FILE - IMPORT BREP + theCommandID == 112 || // MENU FILE - IMPORT IGES + theCommandID == 113 || // MENU FILE - IMPORT STEP + theCommandID == 121 || // MENU FILE - EXPORT BREP + theCommandID == 122 || // MENU FILE - EXPORT IGES + theCommandID == 123 || // MENU FILE - EXPORT STEP + theCommandID == 31 || // MENU EDIT - COPY + theCommandID == 33 || // MENU EDIT - DELETE + theCommandID == 411 || // MENU SETTINGS - ADD IN STUDY + theCommandID == 412 || // MENU SETTINGS - SHADING COLOR + theCommandID == 413 || // MENU SETTINGS - ISOS + theCommandID == 414 || // MENU SETTINGS - STEP VALUE FOR SPIN BOXES + theCommandID == 5103 || // MENU TOOLS - CHECK GEOMETRY + theCommandID == 5104 || // MENU TOOLS - LOAD SCRIPT + theCommandID == 8032 || // POPUP VIEWER - COLOR + theCommandID == 8033 || // POPUP VIEWER - TRANSPARENCY + theCommandID == 8034 || // POPUP VIEWER - ISOS + theCommandID == 804 || // POPUP VIEWER - ADD IN STUDY + theCommandID == 901 || // OBJECT BROWSER - RENAME + theCommandID == 9024) { // OBJECT BROWSER - OPEN + if(!GeomGUI->LoadLibrary("libGEOMToolsGUI.so")) + return false; + } + else if(theCommandID == 211 || // MENU VIEW - WIREFRAME/SHADING + theCommandID == 212 || // MENU VIEW - DISPLAY ALL + theCommandID == 213 || // MENU VIEW - DISPLAY ONLY + theCommandID == 214 || // MENU VIEW - ERASE ALL + theCommandID == 215 || // MENU VIEW - ERASE ONLY + theCommandID == 8031) { // POPUP VIEWER - WIREFRAME/SHADING + if(!GeomGUI->LoadLibrary("libDisplayGUI.so")) + return false; + } + else if(theCommandID == 4011 || // MENU BASIC - POINT + theCommandID == 4012 || // MENU BASIC - LINE + theCommandID == 4013 || // MENU BASIC - CIRCLE + theCommandID == 4014 || // MENU BASIC - ELLIPSE + theCommandID == 4015 || // MENU BASIC - ARC + theCommandID == 4016 || // MENU BASIC - VECTOR + theCommandID == 4017 || // MENU BASIC - PLANE + theCommandID == 4018) { // MENU BASIC - WPLANE + if(!GeomGUI->LoadLibrary("libBasicGUI.so")) + return false; + } + else if(theCommandID == 4021 || // MENU PRIMITIVE - BOX + theCommandID == 4022 || // MENU PRIMITIVE - CYLINDER + theCommandID == 4023 || // MENU PRIMITIVE - SPHERE + theCommandID == 4024 || // MENU PRIMITIVE - TORUS + theCommandID == 4025) { // MENU PRIMITIVE - CONE + if(!GeomGUI->LoadLibrary("libPrimitiveGUI.so")) + return false; + } + else if(theCommandID == 4031 || // MENU GENERATION - PRISM + theCommandID == 4032 || // MENU GENERATION - REVOLUTION + theCommandID == 4033 || // MENU GENERATION - FILLING + theCommandID == 4034) { // MENU GENERATION - PIPE + if(!GeomGUI->LoadLibrary("libGenerationGUI.so")) + return false; + } + else if(theCommandID == 404 || // MENU ENTITY - SKETCHER + theCommandID == 407) { // MENU ENTITY - EXPLODE if(!GeomGUI->LoadLibrary("libEntityGUI.so")) return false; } - else { - if(GeomGUI->myState == 2) { - Mb->setItemEnabled(405, false);//SKETCHER - GeomGUI->GetSketcher().Clear(); - GeomGUI->myState = -1; - } - - if(theCommandID == 111 || // MENU FILE - IMPORT BREP - theCommandID == 112 || // MENU FILE - IMPORT IGES - theCommandID == 113 || // MENU FILE - IMPORT STEP - theCommandID == 121 || // MENU FILE - EXPORT BREP - theCommandID == 122 || // MENU FILE - EXPORT IGES - theCommandID == 123 || // MENU FILE - EXPORT STEP - theCommandID == 31 || // MENU EDIT - COPY - theCommandID == 33 || // MENU EDIT - DELETE - theCommandID == 411 || // MENU SETTINGS - ADD IN STUDY - theCommandID == 412 || // MENU SETTINGS - SHADING COLOR - theCommandID == 413 || // MENU SETTINGS - ISOS - theCommandID == 414 || // MENU SETTINGS - STEP VALUE FOR SPIN BOXES - theCommandID == 5103 || // MENU TOOLS - CHECK GEOMETRY - theCommandID == 5104 || // MENU TOOLS - LOAD SCRIPT - theCommandID == 8032 || // POPUP VIEWER - COLOR - theCommandID == 8033 || // POPUP VIEWER - TRANSPARENCY - theCommandID == 8034 || // POPUP VIEWER - ISOS - theCommandID == 804 || // POPUP VIEWER - ADD IN STUDY - theCommandID == 901 || // OBJECT BROWSER - RENAME - theCommandID == 9024) { // OBJECT BROWSER - OPEN - if(!GeomGUI->LoadLibrary("libGEOMToolsGUI.so")) - return false; - } - else if(theCommandID == 211 || // MENU VIEW - WIREFRAME/SHADING - theCommandID == 212 || // MENU VIEW - DISPLAY ALL - theCommandID == 213 || // MENU VIEW - DISPLAY ONLY - theCommandID == 214 || // MENU VIEW - ERASE ALL - theCommandID == 215 || // MENU VIEW - ERASE ONLY - theCommandID == 8031) { // POPUP VIEWER - WIREFRAME/SHADING - if(!GeomGUI->LoadLibrary("libDisplayGUI.so")) - return false; - } - else if(theCommandID == 4011 || // MENU BASIC - POINT - theCommandID == 4012 || // MENU BASIC - LINE - theCommandID == 4013 || // MENU BASIC - CIRCLE - theCommandID == 4014 || // MENU BASIC - ELLIPSE - theCommandID == 4015 || // MENU BASIC - ARC - theCommandID == 4016 || // MENU BASIC - VECTOR - theCommandID == 4017 || // MENU BASIC - PLANE - theCommandID == 4018) { // MENU BASIC - WPLANE - if(!GeomGUI->LoadLibrary("libBasicGUI.so")) - return false; - } - else if(theCommandID == 4021 || // MENU PRIMITIVE - BOX - theCommandID == 4022 || // MENU PRIMITIVE - CYLINDER - theCommandID == 4023 || // MENU PRIMITIVE - SPHERE - theCommandID == 4024 || // MENU PRIMITIVE - TORUS - theCommandID == 4025) { // MENU PRIMITIVE - CONE - if(!GeomGUI->LoadLibrary("libPrimitiveGUI.so")) - return false; - } - else if(theCommandID == 4031 || // MENU GENERATION - PRISM - theCommandID == 4032 || // MENU GENERATION - REVOLUTION - theCommandID == 4033 || // MENU GENERATION - FILLING - theCommandID == 4034) { // MENU GENERATION - PIPE - if(!GeomGUI->LoadLibrary("libGenerationGUI.so")) - return false; - } - else if(theCommandID == 404 || // SKETCHER - theCommandID == 407) { // MENU ENTITY - EXPLODE - if(!GeomGUI->LoadLibrary("libEntityGUI.so")) - return false; - } - else if(theCommandID == 4081 || // MENU BUILD - EDGE - theCommandID == 4082 || // MENU BUILD - WIRE - theCommandID == 4083 || // MENU BUILD - FACE - theCommandID == 4084 || // MENU BUILD - SHELL - theCommandID == 4085 || // MENU BUILD - SOLID - theCommandID == 4086) { // MENU BUILD - COMPUND - if(!GeomGUI->LoadLibrary("libBuildGUI.so")) - return false; - } - else if(theCommandID == 5011 || // MENU BOOLEAN - FUSE - theCommandID == 5012 || // MENU BOOLEAN - COMMON - theCommandID == 5013 || // MENU BOOLEAN - CUT - theCommandID == 5014) { // MENU BOOLEAN - SECTION - if(!GeomGUI->LoadLibrary("libBooleanGUI.so")) - return false; - } - else if(theCommandID == 5021 || // MENU TRANSFORMATION - TRANSLATION - theCommandID == 5022 || // MENU TRANSFORMATION - ROTATION - theCommandID == 5023 || // MENU TRANSFORMATION - POSITION - theCommandID == 5024 || // MENU TRANSFORMATION - MIRROR - theCommandID == 5025 || // MENU TRANSFORMATION - SCALE - theCommandID == 5026 || // MENU TRANSFORMATION - MULTI-TRANSLATION - theCommandID == 5027) { // MENU TRANSFORMATION - MULTI-ROTATION - if(!GeomGUI->LoadLibrary("libTransformationGUI.so")) - return false; - } - else if(theCommandID == 503 || // MENU OPERATION - PARTITION - theCommandID == 504 || // MENU OPERATION - ARCHIMEDE - theCommandID == 505 || // MENU OPERATION - FILLET - theCommandID == 506) { // MENU OPERATION - CHAMFER - if(!GeomGUI->LoadLibrary("libOperationGUI.so")) - return false; - } - else if(theCommandID == 601 || // MENU REPAIR - SEWING - theCommandID == 602 || // MENU REPAIR - ORIENTATION - theCommandID == 603 || // MENU REPAIR - SUPPRESS FACES - theCommandID == 604) { // MENU REPAIR - SUPPRESS HOLE - if(!GeomGUI->LoadLibrary("libRepairGUI.so")) - return false; - } - else if(theCommandID == 611 || // MENU KINEMATIC - ASSEMBLY - theCommandID == 61201 || // MENU KINEMATIC - EMBEDDING - theCommandID == 61202 || // MENU KINEMATIC - PIVOT - theCommandID == 61203 || // MENU KINEMATIC - SLIDE - theCommandID == 61204 || // MENU KINEMATIC - SLIDING PIVOT - theCommandID == 61205 || // MENU KINEMATIC - SPHERICAL - theCommandID == 61206 || // MENU KINEMATIC - PLANE - theCommandID == 61207 || // MENU KINEMATIC - ANNULAR - theCommandID == 61208 || // MENU KINEMATIC - RECTILINEAR - theCommandID == 61209 || // MENU KINEMATIC - PONCTUAL - theCommandID == 61210 || // MENU KINEMATIC - HELICOIDAL - theCommandID == 6131 || // MENU KINEMATIC - POSITION - theCommandID == 6132 || // MENU KINEMATIC - ROTATION - theCommandID == 6133 || // MENU KINEMATIC - TRANSLATION - theCommandID == 614 || // MENU KINEMATIC - ANIMATION - theCommandID == 6141) { // MENU KINEMATIC - RUN ANIMATION - if(!GeomGUI->LoadLibrary("libKinematicGUI.so")) - return false; - } - else if(theCommandID == 701 || // MENU MEASURE - PROPERTIES - theCommandID == 702 || // MENU MEASURE - CDG - theCommandID == 703 || // MENU MEASURE - INERTIA - theCommandID == 7041 || // MENU MEASURE - BOUNDING BOX - theCommandID == 7042 || // MENU MEASURE - MIN DISTANCE - theCommandID == 705 || // MENU MEASURE - TOLERANCE - theCommandID == 706 || // MENU MEASURE - WHATIS - theCommandID == 707) { // MENU MEASURE - CHECK - if(!GeomGUI->LoadLibrary("libMeasureGUI.so")) - return false; - } - else + else if(theCommandID == 4081 || // MENU BUILD - EDGE + theCommandID == 4082 || // MENU BUILD - WIRE + theCommandID == 4083 || // MENU BUILD - FACE + theCommandID == 4084 || // MENU BUILD - SHELL + theCommandID == 4085 || // MENU BUILD - SOLID + theCommandID == 4086) { // MENU BUILD - COMPUND + if(!GeomGUI->LoadLibrary("libBuildGUI.so")) return false; } - + else if(theCommandID == 5011 || // MENU BOOLEAN - FUSE + theCommandID == 5012 || // MENU BOOLEAN - COMMON + theCommandID == 5013 || // MENU BOOLEAN - CUT + theCommandID == 5014) { // MENU BOOLEAN - SECTION + if(!GeomGUI->LoadLibrary("libBooleanGUI.so")) + return false; + } + else if(theCommandID == 5021 || // MENU TRANSFORMATION - TRANSLATION + theCommandID == 5022 || // MENU TRANSFORMATION - ROTATION + theCommandID == 5023 || // MENU TRANSFORMATION - POSITION + theCommandID == 5024 || // MENU TRANSFORMATION - MIRROR + theCommandID == 5025 || // MENU TRANSFORMATION - SCALE + theCommandID == 5026 || // MENU TRANSFORMATION - MULTI-TRANSLATION + theCommandID == 5027) { // MENU TRANSFORMATION - MULTI-ROTATION + if(!GeomGUI->LoadLibrary("libTransformationGUI.so")) + return false; + } + else if(theCommandID == 503 || // MENU OPERATION - PARTITION + theCommandID == 504 || // MENU OPERATION - ARCHIMEDE + theCommandID == 505 || // MENU OPERATION - FILLET + theCommandID == 506) { // MENU OPERATION - CHAMFER + if(!GeomGUI->LoadLibrary("libOperationGUI.so")) + return false; + } + else if(theCommandID == 601 || // MENU REPAIR - SEWING + theCommandID == 602 || // MENU REPAIR - ORIENTATION + theCommandID == 603 || // MENU REPAIR - SUPPRESS FACES + theCommandID == 604) { // MENU REPAIR - SUPPRESS HOLE + if(!GeomGUI->LoadLibrary("libRepairGUI.so")) + return false; + } + else if(theCommandID == 611 || // MENU KINEMATIC - ASSEMBLY + theCommandID == 6121 || // MENU KINEMATIC - CONTACT + theCommandID == 6122 || // MENU KINEMATIC - POSITION + theCommandID == 6123 || // MENU KINEMATIC - ROTATION + theCommandID == 6124 || // MENU KINEMATIC - TRANSLATION + theCommandID == 613 || // MENU KINEMATIC - ANIMATION + theCommandID == 6131 || // MENU KINEMATIC - SET VALUES + theCommandID == 6132) { // MENU KINEMATIC - RUN ANIMATION + if(!GeomGUI->LoadLibrary("libKinematicGUI.so")) + return false; + } + else if(theCommandID == 701 || // MENU MEASURE - PROPERTIES + theCommandID == 702 || // MENU MEASURE - CDG + theCommandID == 703 || // MENU MEASURE - INERTIA + theCommandID == 7041 || // MENU MEASURE - BOUNDING BOX + theCommandID == 7042 || // MENU MEASURE - MIN DISTANCE + theCommandID == 705 || // MENU MEASURE - TOLERANCE + theCommandID == 706 || // MENU MEASURE - WHATIS + theCommandID == 707) { // MENU MEASURE - CHECK + if(!GeomGUI->LoadLibrary("libMeasureGUI.so")) + return false; + } + else + return false; + //Load Function OnGUIEvent OSD_Function osdF = GeomGUI->myGUILibrary.DlSymb("OnGUIEvent"); OGE (*f1) = NULL; @@ -319,12 +282,7 @@ bool GeometryGUI::OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFra if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) return false; - - if(GeomGUI->myState == 2) { - OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)studyFrame->getRightFrame()->getViewFrame())->getViewPort(); - GeomGUI->GetSketcher().MakeCurrentEdge(pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView()); - } - + else return true; } @@ -340,14 +298,7 @@ bool GeometryGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFr if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) return false; - if(GeomGUI->myState == 2) { - GeomGUI->GetSketcher().ValidateEdge(); - if(GeomGUI->GetSketcher().GetmyEdgesNumber() == 1) { - QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); - Mb->setItemEnabled(405, true); // SKETCH CONTRAINTS - } - } - else if(GeomGUI->myState == 0) { + if(GeomGUI->myState == 0) { if(!GeomGUI->LoadLibrary("libBasicGUI.so")) return false; @@ -451,8 +402,6 @@ bool GeometryGUI::SetSettings(QAD_Desktop* parent) } Mb->setItemEnabled(404, ViewOCC);//SKETCHER - Mb->setItemEnabled(405, false);//SKETCHER - Mb->setItemEnabled(406, ViewOCC);//SKETCHER Mb->setItemEnabled(603, ViewOCC);//SuppressFace Mb->setItemEnabled(604, ViewOCC);//SuppressHole @@ -480,11 +429,8 @@ void GeometryGUI::DefinePopup(QString & theContext, QString & theParent, QString theObject = ""; theContext = ""; - if((theParent.compare("Viewer") == 0)) { - if(GeomGUI->myState == 2) - theContext = "Sketch"; - else if(Sel->IObjectCount() == 0) + if(Sel->IObjectCount() == 0) theContext = "NothingSelected"; } @@ -531,24 +477,6 @@ bool GeometryGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QStr { GeometryGUI::GetOrCreateGeometryGUI(parent); - if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - if(theParent.compare("Viewer") == 0) { - if(theContext.compare("Sketch") == 0) { - SketchStatus myCS = GeomGUI->GetSketcher().GetCurrentStatus(); - popup->setCheckable(TRUE); - if(myCS == SEGMENT) { - popup->setItemChecked(4041, true); //Sketch Segment Menu - popup->setItemChecked(4042, false); //Sketch Arc Menu - } - else if(myCS == ARC_CHORD) { - popup->setItemChecked(4041, false); //Sketch Segment Menu - popup->setItemChecked(4042, true); //Sketch Arc Menu - } - return true; - } - } - } - if(!GeomGUI->LoadLibrary("libGEOMBase.so")) return false; @@ -571,25 +499,17 @@ bool GeometryGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QStr // function : activeStudyChanged() // purpose : static //================================================================================= -void GeometryGUI::activeStudyChanged(QAD_Desktop* parent) +bool GeometryGUI::ActiveStudyChanged(QAD_Desktop* parent) { GeometryGUI::GetOrCreateGeometryGUI(parent); if(GeomGUI != 0) { QMenuBar* Mb = QAD_Application::getDesktop()->getMainMenuBar(); - GeomGUI->myNbGeom = GeomGUI->myComponentGeom->NbLabels(); - if(GeomGUI->myState == 2) { - Mb->setItemEnabled(405, false);//SKETCHER - GeomGUI->GetSketcher().Clear(); - GeomGUI->myState = -1; - } - bool ViewOCC = false; if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) ViewOCC = true; Mb->setItemEnabled(404, ViewOCC);//SKETCHER - Mb->setItemEnabled(406, ViewOCC);//SKETCHER Mb->setItemEnabled(603, ViewOCC);//SuppressFace Mb->setItemEnabled(604, ViewOCC);//SuppressHole @@ -604,7 +524,7 @@ void GeometryGUI::activeStudyChanged(QAD_Desktop* parent) // PAL5356: update VTK selection ::UpdateVtkSelection(parent); - return; + return true; } @@ -630,49 +550,23 @@ void GeometryGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theI } -//================================================================================= -// EXPORTED METHODS -//================================================================================= +void GeometryGUI::SupportedViewType(int* buffer, int bufferSize) +{ + if(!buffer || !bufferSize) return; + buffer[0] = (int)VIEW_OCC; + if (--bufferSize) buffer[1] = (int)VIEW_VTK; +} + +void GeometryGUI::Deactivate() +{ + if ( GeomGUI ) + GeomGUI->EmitSignalCloseAllDialogs(); +} + +static GeometryGUI aGUI(""); extern "C" { - bool OnGUIEvent(int theCommandID, QAD_Desktop* parent) - {return GeometryGUI::OnGUIEvent(theCommandID, parent);} - - bool OnKeyPress(QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) - {return GeometryGUI::OnKeyPress(pe, parent, studyFrame);} - - bool OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) - {return GeometryGUI::OnMousePress(pe, parent, studyFrame);} - - bool OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) - {return GeometryGUI::OnMouseMove(pe, parent, studyFrame);} - - bool SetSettings(QAD_Desktop* parent) - {return GeometryGUI::SetSettings(parent);} - - bool customPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString & theContext, - const QString & theParent, const QString & theObject) - {return GeometryGUI::CustomPopup(parent, popup, theContext, theParent, theObject);} - - void definePopup(QString & theContext, QString & parent, QString & theObject) - {GeometryGUI::DefinePopup(theContext, parent, theObject);} - - bool activeStudyChanged(QAD_Desktop* parent) - {GeometryGUI::activeStudyChanged(parent);} - - void buildPresentation(const Handle(SALOME_InteractiveObject)& theIO) - {GeometryGUI::BuildPresentation(theIO);} - - void supportedViewType(int* buffer, int bufferSize) - { - if(!buffer || !bufferSize) return; - buffer[0] = (int)VIEW_OCC; - if (--bufferSize) buffer[1] = (int)VIEW_VTK; - } - - void deactivate() - { - if ( GeomGUI ) - GeomGUI->EmitSignalCloseAllDialogs(); + Standard_EXPORT SALOMEGUI* GetComponentGUI() { + return &aGUI; } } diff --git a/src/GEOMGUI/GeometryGUI.h b/src/GEOMGUI/GeometryGUI.h index dd133add0..06649f622 100644 --- a/src/GEOMGUI/GeometryGUI.h +++ b/src/GEOMGUI/GeometryGUI.h @@ -29,34 +29,36 @@ #ifndef GEOMETRYGUI_H #define GEOMETRYGUI_H +#include "SALOMEGUI.h" #include "GEOMContext.h" //================================================================================= // class : GeometryGUI // purpose : //================================================================================= -class GeometryGUI : public QObject +class GeometryGUI : public SALOMEGUI { Q_OBJECT /* for QT compatibility */ public : - GeometryGUI(); - ~GeometryGUI(); - - static GEOMContext* GetOrCreateGeometryGUI(QAD_Desktop* desktop); - - /* Managed by IAPP */ - Standard_EXPORT static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); - Standard_EXPORT static bool OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame); - Standard_EXPORT static bool OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame); - Standard_EXPORT static bool OnKeyPress(QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame); - Standard_EXPORT static bool SetSettings(QAD_Desktop* parent); - Standard_EXPORT static void activeStudyChanged(QAD_Desktop* parent); - Standard_EXPORT static void BuildPresentation(const Handle(SALOME_InteractiveObject)&); - Standard_EXPORT static void DefinePopup(QString & theContext, QString & theParent, QString & theObject); - Standard_EXPORT static bool CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext, - const QString& theParent, const QString& theObject); - + GeometryGUI( const QString& name = "", QObject* parent = 0 ); + ~GeometryGUI(); + + static GEOMContext* GetOrCreateGeometryGUI(QAD_Desktop* desktop); + + /* Managed by IAPP */ + virtual bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + virtual bool OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame); + virtual bool OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame); + virtual bool OnKeyPress(QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame); + virtual bool SetSettings(QAD_Desktop* parent); + virtual bool ActiveStudyChanged(QAD_Desktop* parent); + virtual void BuildPresentation(const Handle(SALOME_InteractiveObject)&); + virtual void DefinePopup(QString & theContext, QString & theParent, QString & theObject); + virtual bool CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext, + const QString& theParent, const QString& theObject); + virtual void SupportedViewType (int* buffer, int bufferSize); + virtual void Deactivate (); }; #endif diff --git a/src/GEOMGUI/GeometryGUI_Swig.cxx b/src/GEOMGUI/GeometryGUI_Swig.cxx index 81e1f1b45..bb7159bbb 100644 --- a/src/GEOMGUI/GeometryGUI_Swig.cxx +++ b/src/GEOMGUI/GeometryGUI_Swig.cxx @@ -264,6 +264,7 @@ const char* GEOM_Swig::getShapeTypeString(const char* IOR) case TopAbs_SHAPE: { return "Shape" ;} } + return 0; } diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.cxx b/src/GEOMToolsGUI/GEOMToolsGUI.cxx index 591c97c3c..e4aab6706 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header: -using namespace std; #include "GEOMToolsGUI.h" #include "QAD_Config.h" @@ -34,6 +33,7 @@ using namespace std; #include "QAD_Tools.h" #include "QAD_MessageBox.h" #include "QAD_RightFrame.h" +#include "QAD_PyEditor.h" #include "OCCViewer_Viewer3d.h" #include "VTKViewer_ViewFrame.h" @@ -60,6 +60,10 @@ using namespace std; #include "GEOMToolsGUI_NbIsosDlg.h" // Method ISOS adjustement #include "GEOMToolsGUI_TransparencyDlg.h" // Method TRANSPARENCY adjustement +#include "utilities.h" + +using namespace std; + //======================================================================= // function : GEOMToolsGUI() // purpose : Constructor @@ -150,7 +154,7 @@ bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) { if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) break; - + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); @@ -791,7 +795,7 @@ bool GEOMToolsGUI::Import(int aState) QString nameShape = QAD_Tools::getFileNameFromPath(file,false) + QString("_%1").arg(myGeomGUI->myNbGeom++); - if(myGeomBase->Display(aShape, strdup(nameShape.latin1()))) { + if(myGeomBase->Display(aShape, (char*)nameShape.latin1())) { QAD_Application::getDesktop()->getActiveStudy()->setMessage( tr("GEOM_INF_LOADED").arg(QAD_Tools::getFileNameFromPath( file )) ); QAD_Application::getDesktop()->putInfo( tr("GEOM_PRP_READY")); } @@ -839,7 +843,7 @@ bool GEOMToolsGUI::Export(int aState) QApplication::setOverrideCursor( Qt::waitCursor ); // Standard_Boolean result = BRepTools::Write(Shape->Shape(), strdup(file.latin1()) ); try { - myGeom->ExportBREP(strdup( file.latin1()), aShape); + myGeom->ExportBREP((char*)file.latin1(), aShape); } catch (const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -866,7 +870,7 @@ bool GEOMToolsGUI::Export(int aState) if ( !file.isEmpty() && !aShape->_is_nil() ) { QApplication::setOverrideCursor( Qt::waitCursor ); try { - myGeom->ExportIGES(strdup( file.latin1()), aShape); + myGeom->ExportIGES((char*)file.latin1(), aShape); } catch (const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -912,7 +916,7 @@ bool GEOMToolsGUI::Export(int aState) QApplication::setOverrideCursor( Qt::waitCursor ) ; try { - myGeom->ExportSTEP(strdup( file.latin1()), aShape); + myGeom->ExportSTEP((char*)file.latin1(), aShape); } catch (const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -938,6 +942,7 @@ bool GEOMToolsGUI::Export(int aState) } QApplication::restoreOverrideCursor() ; + return true; } diff --git a/src/GEOM_SWIG/GEOM_Kinematic.py b/src/GEOM_SWIG/GEOM_Kinematic.py new file mode 100644 index 000000000..f44742742 --- /dev/null +++ b/src/GEOM_SWIG/GEOM_Kinematic.py @@ -0,0 +1,105 @@ +# GEOM GEOM_SWIG : binding of C++ omplementaion with Python +# +# 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 : GEOM_Kinematic.py +# Author : Damien COQUERET, Open CASCADE +# Module : GEOM +# $Header: + +import salome +import geompy +import math + +geom = salome.lcc.FindOrLoadComponent("FactoryServer", "GEOM") +myBuilder = salome.myStudy.NewBuilder() + +#Varaibles +TypeShape = 8 #Explode In Shape +Pivot = 1 +Step = 0. +Duration = 5. +NbSeq = 50 + +#Import Shapes : Robot +Robot = geompy.ImportBREP("/home/dcq/robot.brep") +Id_Robot = geompy.addToStudy(Robot, "Robot") + +#Decompose objects +SubShape = [] +SubShape = geompy.SubShapeAll(Robot, TypeShape) + +for Shape in SubShape : + name = geompy.SubShapeName(Shape._get_Name(), Robot._get_Name()) +# Id_SubShape = geompy.addToStudy(Shape, "Shape") + Id_SubShape = geompy.addToStudyInFather(Robot, Shape, name) + +#Kinematic +anAss = geompy.InitAssembly() +Id_Ass = geompy.addAssemblyToStudy(anAss, "Robot_Assembly") + +aContact1 = geompy.AddContact(anAss, SubShape[0], SubShape[1], Pivot, Step) +aContact1.SetPosition(0., 0., 0., 0., 0., 1., 1., 0., 0., 0., 1., 0.) +geompy.SetPosition(aContact1) +aContact1.SetAngularRange(0., 45., 0., 0., 0., 0.) +geompy.SetAngularRange(aContact1) +Id_Contact1 = geompy.addContactToStudy(anAss, aContact1, "Robot_Contact1") + +aContact2 = geompy.AddContact(anAss, SubShape[1], SubShape[2], Pivot, Step) +aContact2.SetPosition(0., 0., 900., 0., 1., 0., 0., 0., 1., 1., 0., 0.) +geompy.SetPosition(aContact2) +aContact2.SetAngularRange(0., 30., 0., 0., 0., 0.) +geompy.SetAngularRange(aContact2) +Id_Contact2 = geompy.addContactToStudy(anAss, aContact2, "Robot_Contact2") + +aContact3 = geompy.AddContact(anAss, SubShape[2], SubShape[3], Pivot, Step) +aContact3.SetPosition(565.7, 0., 1465.7, 0., 1., 0., 0., 0., 1., 1., 0., 0.) +geompy.SetPosition(aContact3) +aContact3.SetAngularRange(-180., 0., 0., 0., 0., 0.) +geompy.SetAngularRange(aContact3) +Id_Contact3 = geompy.addContactToStudy(anAss, aContact3, "Robot_Contact3") + +aContact4 = geompy.AddContact(anAss, SubShape[3], SubShape[4], Pivot, Step) +aContact4.SetPosition(1132.5, 0., 901.1, 0., 1., 0., 0., 0., 1., 1., 0., 0.) +geompy.SetPosition(aContact4) +aContact4.SetAngularRange(0., 180., 0., 0., 0., 0.) +geompy.SetAngularRange(aContact4) +Id_Contact4 = geompy.addContactToStudy(anAss, aContact4, "Robot_Contact4") + +aContact5 = geompy.AddContact(anAss, SubShape[4], SubShape[5], Pivot, Step) +aContact5.SetPosition(0., 0., 900., 1., 0., 0., 0., 1., 0., 0., 0., 1.) +geompy.SetPosition(aContact5) +aContact5.SetAngularRange(0., 180., 0., 0., 0., 0.) +geompy.SetAngularRange(aContact5) +Id_Contact5 = geompy.addContactToStudy(anAss, aContact5, "Robot_Contact5") + +anAnim = geompy.AddAnimation(anAss, SubShape[0], Duration, NbSeq) +aList = [] +aList.append(0.) +aList.append(-180.) +i = 0 +while i <= 9 : + aList.append(0.) + i = i + 1 +anAnim.SetDisplacement(aContact3, aList) +geompy.SetDisplacement(anAnim, aContact3) +Id_Anim = geompy.addAnimationToStudy(anAnim, "Robot_Animation") diff --git a/src/GEOM_SWIG/GEOM_Sketcher.py b/src/GEOM_SWIG/GEOM_Sketcher.py new file mode 100644 index 000000000..fbdb7fbf5 --- /dev/null +++ b/src/GEOM_SWIG/GEOM_Sketcher.py @@ -0,0 +1,58 @@ +# GEOM GEOM_SWIG : binding of C++ omplementaion with Python +# +# 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 : GEOM_Sketcher.py +# Author : Damien COQUERET, Open CASCADE +# Module : GEOM +# $Header$ + +import geompy + +#SKETCHER INFOS +#Init Sketcher +#Create a string beginning by :"Sketcher:" +#Each command must be separated by ":" +#"F x y" : Create first point at X & Y + +#To Make Segment +#"R angle" : Set the direction by angle +#"D dx dy" : Set the direction by DX & DY + +#"TT x y" : Create by point at X & Y +#"T dx dy" : Create by point with DX & DY +#"L length" : Create by direction & Length +#"IX x" : Create by direction & Intersect. X +#"IY y" : Create by direction & Intersect. Y + +#To Make Arc +#"C radius length" : Create by direction, radius and length(in degree) + +#To finish +#"WW" : Close Wire + +#Create Sketcher +Cmd = "Sketch:F 0 0:TT 0 100:C 100 180:WW" +Sketcher = geompy.MakeSketcher(Cmd) #(string)->GEOM_Shape_ptr + +#Add In Study +id_Sketcher = geompy.addToStudy(Sketcher, "Sketcher") diff --git a/src/GEOM_SWIG/Makefile.in b/src/GEOM_SWIG/Makefile.in index 5984c7dce..338ff43e9 100644 --- a/src/GEOM_SWIG/Makefile.in +++ b/src/GEOM_SWIG/Makefile.in @@ -45,13 +45,15 @@ EXPORT_PYSCRIPTS = libGEOM_Swig.py geompy.py batchmode_geompy.py \ GEOM_example2.py \ GEOM_example3.py \ GEOM_example4.py \ + GEOM_Kinematic.py \ GEOM_moteur.py \ GEOM_usinggeom.py \ GEOM_Partition1.py \ GEOM_Partition2.py \ GEOM_Partition3.py \ GEOM_Partition4.py \ - GEOM_Partition5.py + GEOM_Partition5.py \ + GEOM_Sketcher.py LIB_CLIENT_IDL = SALOMEDS.idl \ SALOMEDS_Attributes.idl \ diff --git a/src/GEOM_SWIG/batchmode_geompy.py b/src/GEOM_SWIG/batchmode_geompy.py index 7d1ae1db8..ec0421c2d 100644 --- a/src/GEOM_SWIG/batchmode_geompy.py +++ b/src/GEOM_SWIG/batchmode_geompy.py @@ -164,6 +164,12 @@ def MakePlane(p1,d1,trimsize): anObj._set_Name(ior) return anObj +def MakeSketcher(Cmd): + anObj = geom.MakeSketcher(Cmd) + ior = orb.object_to_string(anObj) + anObj._set_Name(ior) + return anObj + # ----------------------------------------------------------------------------- # Create Geometry 3D # ----------------------------------------------------------------------------- @@ -487,11 +493,14 @@ def AddAnimation(Ass,Frame,Duration,NbSeq): def SetPosition(aContact): geom.SetPosition(aContact) -def SetRotation(aContact): - geom.SetRotation(aContact) +def SetAngularRange(aContact): + geom.SetAngularRange(aContact) -def SetTranslation(aContact): - geom.SetTranslation(aContact) +def SetLinearRange(aContact): + geom.SetLinearRange(aContact) + +def SetDisplacement(anAnim,aContact): + geom.SetDisplacement(anAnim,aContact) def addAssemblyToStudy(anAss, aName): myBuilder.NewCommand() diff --git a/src/GEOM_SWIG/geompy.py b/src/GEOM_SWIG/geompy.py index 2a128aebe..f2c7c7ec1 100644 --- a/src/GEOM_SWIG/geompy.py +++ b/src/GEOM_SWIG/geompy.py @@ -190,6 +190,12 @@ def MakePlane(p1,d1,trimsize): anObj._set_Name(ior) return anObj +def MakeSketcher(Cmd): + anObj = geom.MakeSketcher(Cmd) + ior = salome.orb.object_to_string(anObj) + anObj._set_Name(ior) + return anObj + # ----------------------------------------------------------------------------- # Create Geometry 3D # ----------------------------------------------------------------------------- @@ -513,11 +519,14 @@ def AddAnimation(Ass,Frame,Duration,NbSeq): def SetPosition(aContact): geom.SetPosition(aContact) -def SetRotation(aContact): - geom.SetRotation(aContact) +def SetAngularRange(aContact): + geom.SetAngularRange(aContact) -def SetTranslation(aContact): - geom.SetTranslation(aContact) +def SetLinearRange(aContact): + geom.SetLinearRange(aContact) + +def SetDisplacement(anAnim,aContact): + geom.SetDisplacement(anAnim,aContact) def addAssemblyToStudy(anAss, aName): myBuilder.NewCommand() diff --git a/src/GenerationGUI/GenerationGUI_FillingDlg.cxx b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx index fc32ef980..85d0203b8 100644 --- a/src/GenerationGUI/GenerationGUI_FillingDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx @@ -26,9 +26,9 @@ // Module : GEOM // $Header$ -using namespace std; #include "GenerationGUI_FillingDlg.h" +#include "QAD_WaitCursor.h" #include "QAD_Config.h" #include @@ -38,8 +38,14 @@ using namespace std; #include #include #include +#include #include #include +#include + +#include "utilities.h" + +using namespace std; //================================================================================= // class : GenerationGUI_FillingDlg() @@ -210,10 +216,14 @@ void GenerationGUI_FillingDlg::SelectionIntoArgument() return; if(myEditCurrentArgument == GroupPoints->LineEdit1 && mySectionShape.ShapeType() == TopAbs_COMPOUND) { - myEditCurrentArgument->setText(aString); myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult); if(!testResult) return; + // mySectionShape should be a compound of edges + for ( TopoDS_Iterator it( mySectionShape ); it.More(); it.Next() ) + if ( it.Value().ShapeType() != TopAbs_EDGE ) + return; + myEditCurrentArgument->setText(aString); myOkSectionShape = true; } @@ -319,6 +329,8 @@ void GenerationGUI_FillingDlg::ValueChangedInSpinBox(double newValue) //================================================================================= void GenerationGUI_FillingDlg::MakeFillingSimulationAndDisplay() { + QAD_WaitCursor wc; + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); @@ -336,6 +348,7 @@ void GenerationGUI_FillingDlg::MakeFillingSimulationAndDisplay() if( Scurrent.IsNull() || Scurrent.ShapeType() != TopAbs_EDGE) return; C = BRep_Tool::Curve(TopoDS::Edge(Scurrent), First, Last); + if (C.IsNull()) continue; C = new Geom_TrimmedCurve(C, First, Last); Section.AddCurve(C) ; i++ ; diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx index d1bc9969e..adb21593b 100644 --- a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "GenerationGUI_PipeDlg.h" #include @@ -38,6 +37,10 @@ using namespace std; #include #endif +#include "utilities.h" + +using namespace std; + //================================================================================= // class : GenerationGUI_PipeDlg() // purpose : Constructs a GenerationGUI_PipeDlg which is a child of 'parent', with the diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx index b9c8057ec..90fc67b70 100644 --- a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx @@ -26,12 +26,15 @@ // Module : GEOM // $Header$ -using namespace std; #include "GenerationGUI_PrismDlg.h" #include #include "QAD_Config.h" +#include "utilities.h" + +using namespace std; + //================================================================================= // class : GenerationGUI_PrismDlg() // purpose : Constructs a GenerationGUI_PrismDlg which is a child of 'parent', with the diff --git a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx index 69d69205c..0aa52712c 100644 --- a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx @@ -26,13 +26,18 @@ // Module : GEOM // $Header$ -using namespace std; #include "GenerationGUI_RevolDlg.h" #include #include #include #include "QAD_Config.h" +#include +#include + +#include "utilities.h" + +using namespace std; //================================================================================= // class : GenerationGUI_RevolDlg() @@ -157,6 +162,32 @@ void GenerationGUI_RevolDlg::ClickOnApply() return; } +//======================================================================= +//function : isAcceptableBase +//purpose : return true if theBase can be used as algo argument +//======================================================================= + +static bool isAcceptableBase(const TopoDS_Shape& theBase) +{ + switch ( theBase.ShapeType() ) { + case TopAbs_VERTEX: + case TopAbs_EDGE: + case TopAbs_WIRE: + case TopAbs_FACE: + case TopAbs_SHELL: + return true; + case TopAbs_SOLID: + case TopAbs_COMPSOLID: + return false; + case TopAbs_COMPOUND: { + TopExp_Explorer exp( theBase, TopAbs_SOLID); + return !exp.More(); + } + default: + return false; + } + return false; +} //================================================================================= // function : SelectionIntoArgument() @@ -189,8 +220,7 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument() myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult); if(!testResult) return; - TopAbs_ShapeEnum aType = S.ShapeType(); - if(aType != TopAbs_VERTEX && aType != TopAbs_EDGE && aType != TopAbs_WIRE && aType != TopAbs_FACE && aType != TopAbs_SHELL && aType != TopAbs_COMPOUND) + if( !isAcceptableBase( S )) return; myEditCurrentArgument->setText(aString); myOkBase = true; @@ -318,8 +348,7 @@ void GenerationGUI_RevolDlg::MakeRevolutionSimulationAndDisplay() myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); - TopAbs_ShapeEnum aType = myBase.ShapeType(); - if(aType != TopAbs_VERTEX && aType != TopAbs_EDGE && aType != TopAbs_WIRE && aType != TopAbs_FACE && aType != TopAbs_SHELL && aType !=TopAbs_COMPOUND) + if (!isAcceptableBase( myBase )) return; try { diff --git a/src/KINEMATIC/Kinematic_Animation.cxx b/src/KINEMATIC/Kinematic_Animation.cxx index 935443e91..97d5eda6b 100644 --- a/src/KINEMATIC/Kinematic_Animation.cxx +++ b/src/KINEMATIC/Kinematic_Animation.cxx @@ -26,13 +26,14 @@ // Module : GEOM // $Header: -using namespace std; #include "Kinematic_Animation.hxx" #include #include #include +using namespace std; + //======================================================================= // profile // command to build a profile @@ -53,14 +54,16 @@ Kinematic_Animation::Kinematic_Animation() Kinematic_Animation::Kinematic_Animation(Kinematic_Assembly* Ass, TopoDS_Shape frame, double duration, int nbseq) { - myAss = Ass; - myFrame = frame; - myDuration = duration; - myNbSeq = nbseq; myIsShading = false; IsCreated = false; myNbAIS = 0; + + SetAssembly(Ass); + SetFrame(frame); + SetDuration(duration); + SetNbSeq(nbseq); this->SetMap(); + this->InitValues(); return; } @@ -74,42 +77,141 @@ Kinematic_Animation::~Kinematic_Animation() {} //================================================================================= // function : SetMap() -// purpose : +// purpose : Create Kinematic Graph //================================================================================= void Kinematic_Animation::SetMap() { - list ContactList = myAss->GetContactList(); + list aContactList = myAss->GetContactList(); Kinematic_Contact* aContact; - list ::const_iterator it = ContactList.begin(); - while(it != ContactList.end()) { + list ::const_iterator it = aContactList.begin(); + while(it != aContactList.end()) { aContact = *it; - if(!myIndexToShape.Contains(aContact->Shape1())) - myIndexToShape.Add(aContact->Shape1()); + if(!myIndexToShape.Contains(aContact->GetShape1())) + myIndexToShape.Add(aContact->GetShape1()); - if(!myIndexToShape.Contains(aContact->Shape2())) - myIndexToShape.Add(aContact->Shape2()); + if(!myIndexToShape.Contains(aContact->GetShape2())) + myIndexToShape.Add(aContact->GetShape2()); it++; } for(int i = 1; i <= myIndexToShape.Extent(); i++) { - it = ContactList.begin(); - list ContactListOfShape; - TopoDS_Shape myShape = myIndexToShape.FindKey(i); - while(it != ContactList.end()) { + it = aContactList.begin(); + list aContactListOfShape; + TopoDS_Shape aShape = myIndexToShape.FindKey(i); + while(it != aContactList.end()) { aContact = *it; - if(myShape == aContact->Shape1() || myShape == aContact->Shape2()) - ContactListOfShape.push_back(aContact); + if(aShape == aContact->GetShape1() || aShape == aContact->GetShape2()) + aContactListOfShape.push_back(aContact); it++; } - myStlMapofShapeListOfContact[i] = ContactListOfShape; + myStlMapofShapeListOfContact[i] = aContactListOfShape; } return; } +//================================================================================= +// function : InitValues() +// purpose : +//================================================================================= +void Kinematic_Animation::InitValues() +{ + list aContactList = myAss->GetContactList(); + list ::const_iterator it = aContactList.begin(); + while(it != aContactList.end()) { + InitValuesOnContact(*it); + it++; + } + + return; +} + + +//================================================================================= +// function : InitValuesOnContact() +// purpose : +//================================================================================= +void Kinematic_Animation::InitValuesOnContact(Kinematic_Contact* aContact) +{ + cout<<"Kinematic_Animation::InitValuesOnContact"< aContactListOfValue; + + cout<<"Kinematic_Animation::InitValuesOnContact : Val = "<GetAngularRange().GetMaxValX()<GetAngularRange().GetMinValX()); + aContactListOfValue.push_back(aContact->GetAngularRange().GetMaxValX()); + aContactListOfValue.push_back(aContact->GetAngularRange().GetMinValY()); + aContactListOfValue.push_back(aContact->GetAngularRange().GetMaxValY()); + aContactListOfValue.push_back(aContact->GetAngularRange().GetMinValZ()); + aContactListOfValue.push_back(aContact->GetAngularRange().GetMaxValZ()); + + aContactListOfValue.push_back(aContact->GetLinearRange().GetMinValX()); + aContactListOfValue.push_back(aContact->GetLinearRange().GetMaxValX()); + aContactListOfValue.push_back(aContact->GetLinearRange().GetMinValY()); + aContactListOfValue.push_back(aContact->GetLinearRange().GetMaxValY()); + aContactListOfValue.push_back(aContact->GetLinearRange().GetMinValZ()); + aContactListOfValue.push_back(aContact->GetLinearRange().GetMaxValZ()); + + myStlMapofContactListOfValue[aContact] = aContactListOfValue; + return; +} + + +//================================================================================= +// function : GetDisplacement() +// purpose : +//================================================================================= +list Kinematic_Animation::GetDisplacement(int aContact) +{ + cout<<"Kinematic_Animation::GetDisplacement"< aContactList = myAss->GetContactList(); + + list ::const_iterator it = aContactList.begin(); + int i = 0; + while(it != aContactList.end()) { + if(i == aContact) + aKContact = *it; + i++; + it++; + } + + if(myStlMapofContactListOfValue.find(aKContact) == myStlMapofContactListOfValue.end()) { + cout<<"Kinematic_Animation::GetDisplacement : ADD"< aContactListOfValue = myStlMapofContactListOfValue[aKContact]; + return aContactListOfValue; +} + + +//================================================================================= +// function : SetDisplacement() +// purpose : +//================================================================================= +void Kinematic_Animation::SetDisplacement(int aContact, list aList) +{ + cout<<"Kinematic_Animation::SetDisplacement"< aContactList = myAss->GetContactList(); + + list ::const_iterator it = aContactList.begin(); + int i = 0; + while(it != aContactList.end()) { + if(i == aContact) + aKContact = *it; + i++; + it++; + } + + myStlMapofContactListOfValue[aKContact] = aList; + return; +} + + //================================================================================= // function : GetNextShape() // purpose : @@ -118,36 +220,36 @@ void Kinematic_Animation::GetNextShape(const Handle(AIS_InteractiveContext)& ic, gp_Trsf& aLoc, TopoDS_Shape Shape1, double Step) { int j = 0; - list ContactListOfShape; + list aContactListOfShape; Kinematic_Contact* aContact; - TopoDS_Shape myShape, myShape2, aNewShape; + TopoDS_Shape aShape, aShape2, aNewShape; for(int i = 1; i <= myIndexToShape.Extent(); i++) { - myShape = myIndexToShape.FindKey(i); - if(myShape == Shape1) { + aShape = myIndexToShape.FindKey(i); + if(aShape == Shape1) { gp_Trsf aNewLoc = aLoc; - ContactListOfShape = myStlMapofShapeListOfContact[i]; - list ::const_iterator it = ContactListOfShape.begin(); - while(it != ContactListOfShape.end()) { + aContactListOfShape = myStlMapofShapeListOfContact[i]; + list ::const_iterator it = aContactListOfShape.begin(); + while(it != aContactListOfShape.end()) { aContact = *it; - if(aContact->Shape1() == Shape1) - myShape2 = aContact->Shape2(); - else if(aContact->Shape2() == Shape1) - myShape2 = aContact->Shape1(); + if(aContact->GetShape1() == Shape1) + aShape2 = aContact->GetShape2(); + else if(aContact->GetShape2() == Shape1) + aShape2 = aContact->GetShape1(); - if(!myMovedShape.Contains(myShape2)) { - myMovedShape.Add(myShape2); + if(!myMovedShape.Contains(aShape2)) { + myMovedShape.Add(aShape2); if(!IsCreated) { Handle(AIS_Shape) mySimulationShape; mySimulationShape = new AIS_Shape(TopoDS_Shape()); - mySimulationShape->Set(myShape2); - ListOfAIS.Append(mySimulationShape); + mySimulationShape->Set(aShape2); + myListOfAIS.Append(mySimulationShape); } else MoveShape(ic, aLoc, aContact, Step); - GetNextShape(ic, aLoc, myShape2, Step); + GetNextShape(ic, aLoc, aShape2, Step); } aLoc = aNewLoc; it++; @@ -160,18 +262,18 @@ void Kinematic_Animation::GetNextShape(const Handle(AIS_InteractiveContext)& ic, //================================================================================= -// function : CreateShape() +// function : MoveShape() // purpose : //================================================================================= void Kinematic_Animation::MoveShape(const Handle(AIS_InteractiveContext)& ic, gp_Trsf& aLoc, Kinematic_Contact* aContact, double Step) { - gp_Trsf aTrans = aContact->GetTransformation(Step); + gp_Trsf aTrans = GetTransformation(aContact, Step); aLoc = aLoc * aTrans; myNbAIS++; - Handle(AIS_Shape) mySimulationShape = Handle(AIS_Shape)::DownCast(ListOfAIS.Value(myNbAIS)); + Handle(AIS_Shape) mySimulationShape = Handle(AIS_Shape)::DownCast(myListOfAIS.Value(myNbAIS)); Handle(Geom_Transformation) aGTrans = new Geom_Transformation(); aGTrans->SetTrsf(aLoc); mySimulationShape->SetTransformation(aGTrans, false, false); @@ -187,3 +289,39 @@ void Kinematic_Animation::MoveShape(const Handle(AIS_InteractiveContext)& ic, ic->Display(mySimulationShape, Standard_False); return; } + + +//================================================================================= +// function : GetTransformation() +// purpose : +//================================================================================= +gp_Trsf Kinematic_Animation::GetTransformation(Kinematic_Contact* aContact, double Step) +{ + gp_Vec aVect; + gp_Trsf aTransformation, aRot, aRot1, aRot2, aRot3; + + list aValuesList = myStlMapofContactListOfValue[aContact]; + list ::const_iterator it = aValuesList.begin(); + double aL[12]; + + int i = 0; + while(it != aValuesList.end()) { + aL[i] = *it; + i++; + it++; + } + + aRot1.SetRotation(aContact->GetPosition().GetAxeX(), (Step * (aL[1] - aL[0]) + aL[0]) * PI / 180); + aRot2.SetRotation(aContact->GetPosition().GetAxeY(), (Step * (aL[3] - aL[2]) + aL[2]) * PI / 180); + aRot3.SetRotation(aContact->GetPosition().GetAxeZ(), (Step * (aL[5] - aL[4]) + aL[4]) * PI / 180); + aRot = aRot1 * aRot2 * aRot3; + + aVect.SetCoord(Step * (aL[7] - aL[6]) + aL[6], + Step * (aL[9] - aL[8]) + aL[8], + Step * (aL[11] - aL[10]) + aL[10]); + + aTransformation.SetTranslation(aVect); + aTransformation = aTransformation * aRot; + + return aTransformation; +} diff --git a/src/KINEMATIC/Kinematic_Animation.hxx b/src/KINEMATIC/Kinematic_Animation.hxx index 258665a54..ae00f2496 100644 --- a/src/KINEMATIC/Kinematic_Animation.hxx +++ b/src/KINEMATIC/Kinematic_Animation.hxx @@ -36,6 +36,7 @@ #include #include #include +#include #include #include @@ -50,13 +51,14 @@ public: private: map > myStlMapofShapeListOfContact; + map > myStlMapofContactListOfValue; Kinematic_Assembly* myAss; TopoDS_Shape myFrame; double myDuration; int myNbSeq; public: - AIS_SequenceOfInteractive ListOfAIS; + AIS_SequenceOfInteractive myListOfAIS; TopTools_IndexedMapOfShape myIndexToShape; TopTools_IndexedMapOfShape myMovedShape; bool IsCreated; @@ -64,21 +66,26 @@ public: bool myIsShading; void SetMap(); + void InitValues(); + void InitValuesOnContact(Kinematic_Contact* aContact); void GetNextShape(const Handle (AIS_InteractiveContext)& ic, gp_Trsf& aLoc, TopoDS_Shape Shape1, double Step); void MoveShape(const Handle(AIS_InteractiveContext)& ic, gp_Trsf& aLoc, Kinematic_Contact* aContact, double Step); - void Assembly(Kinematic_Assembly* Assembly){myAss = Assembly;}; - void Frame(TopoDS_Shape Frame){myFrame = Frame;}; - void Duration(double Duration){myDuration = Duration;}; - void NbSeq(int NbSeq){myNbSeq = NbSeq;}; + void SetAssembly(Kinematic_Assembly* Assembly){myAss = Assembly;}; + void SetFrame(TopoDS_Shape Frame){myFrame = Frame;}; + void SetDuration(double Duration){myDuration = Duration;}; + void SetNbSeq(int NbSeq){myNbSeq = NbSeq;}; + void SetDisplacement(int aContact, list aList); - Kinematic_Assembly* Assembly(){return myAss;}; - TopoDS_Shape& Frame(){return myFrame;}; - double& Duration(){return myDuration;}; - int& NbSeq(){return myNbSeq;}; + Kinematic_Assembly* GetAssembly(){return myAss;}; + TopoDS_Shape& GetFrame(){return myFrame;}; + double& GetDuration(){return myDuration;}; + int& GetNbSeq(){return myNbSeq;}; + list GetDisplacement(int aContact); + gp_Trsf GetTransformation(Kinematic_Contact* aContact, double Step = 1); }; diff --git a/src/KINEMATIC/Kinematic_Assembly.cxx b/src/KINEMATIC/Kinematic_Assembly.cxx index 461630481..79ad4e8fc 100644 --- a/src/KINEMATIC/Kinematic_Assembly.cxx +++ b/src/KINEMATIC/Kinematic_Assembly.cxx @@ -26,27 +26,22 @@ // Module : GEOM // $Header: -using namespace std; #include "Kinematic_Assembly.hxx" +using namespace std; //======================================================================= // profile // command to build a profile //======================================================================= -Kinematic_Assembly::Kinematic_Assembly() -{ - -} +Kinematic_Assembly::Kinematic_Assembly() {} //================================================================================= // function : ~Kinematic_Assembly() // purpose : Destroys the object and frees any allocated resources //================================================================================= -Kinematic_Assembly::~Kinematic_Assembly() -{ -} +Kinematic_Assembly::~Kinematic_Assembly() {} //================================================================================= diff --git a/src/KINEMATIC/Kinematic_Contact.cxx b/src/KINEMATIC/Kinematic_Contact.cxx index e4c8cebe4..df1d9a7e3 100644 --- a/src/KINEMATIC/Kinematic_Contact.cxx +++ b/src/KINEMATIC/Kinematic_Contact.cxx @@ -26,14 +26,15 @@ // Module : GEOM // $Header: -using namespace std; #include "Kinematic_Contact.hxx" +using namespace std; + //======================================================================= // profile // command to build a profile //======================================================================= -Kinematic_Contact::Kinematic_Contact(){} +Kinematic_Contact::Kinematic_Contact() {} //======================================================================= @@ -43,23 +44,25 @@ Kinematic_Contact::Kinematic_Contact(){} Kinematic_Contact::Kinematic_Contact(TopoDS_Shape Shape1, TopoDS_Shape Shape2, int type, double step) { - myType = type; - myShape1 = Shape1; - myShape2 = Shape2; - myStep = step; + SetType(type); + SetStep(step); + SetShape1(Shape1); + SetShape2(Shape2); gp_Pnt Origin(0, 0, 0); - gp_Dir DirX(1, 0, 0); - gp_Dir DirY(0, 1, 0); - gp_Dir DirZ(0, 0, 1); + gp_Vec DirX(1, 0, 0); + gp_Vec DirY(0, 1, 0); + gp_Vec DirZ(0, 0, 1); Kinematic_Position Pos(Origin, DirX, DirY, DirZ); - Kinematic_Rotation Rot(1, 2, 3, 0, 0, 0); - Kinematic_Translation Trans(0, 0, 0); + Kinematic_Range AngularRange(0, 0, 0, 0, 0, 0); + Kinematic_Range LinearRange(0, 0, 0, 0, 0, 0); - myPosition = Pos; - myRotation = Rot; - myTranslation = Trans; + SetPosition(Pos); + SetAngularRange(AngularRange); + SetLinearRange(LinearRange); + + return; } @@ -70,6 +73,21 @@ Kinematic_Contact::Kinematic_Contact(TopoDS_Shape Shape1, TopoDS_Shape Shape2, Kinematic_Contact::~Kinematic_Contact() {} +//================================================================================= +// function : GetLocation() +// purpose : +//================================================================================= +TopLoc_Location Kinematic_Contact::GetLocation() +{ + gp_Trsf aTrans; + + aTrans.SetTransformation(myPosition.GetAxe3()); + TopLoc_Location aLoc(aTrans); + + return aLoc; +} + + //================================================================================= // function : GetTransformation() // purpose : @@ -79,55 +97,25 @@ gp_Trsf Kinematic_Contact::GetTransformation(double Step) gp_Vec aVect; gp_Trsf aTransformation, aRot, aRot1, aRot2, aRot3; - aVect.SetCoord(Step * myTranslation.ValX(), Step * myTranslation.ValY(), Step * myTranslation.ValZ()); + double aMinVal = myAngularRange.GetMinValX(); + double aMaxVal = myAngularRange.GetMaxValX(); + aRot1.SetRotation(myPosition.GetAxeX(), (Step * (aMaxVal - aMinVal) + aMinVal) * PI / 180); + + aMinVal = myAngularRange.GetMinValY(); + aMaxVal = myAngularRange.GetMaxValY(); + aRot2.SetRotation(myPosition.GetAxeY(), (Step * (aMaxVal - aMinVal) + aMinVal) * PI / 180); + + aMinVal = myAngularRange.GetMinValZ(); + aMaxVal = myAngularRange.GetMaxValZ(); + aRot3.SetRotation(myPosition.GetAxeZ(), (Step * (aMaxVal - aMinVal) + aMinVal) * PI / 180); + + aVect.SetCoord(Step * (myLinearRange.GetMaxValX() - myLinearRange.GetMinValX()) + myLinearRange.GetMinValX(), + Step * (myLinearRange.GetMaxValY() - myLinearRange.GetMinValY()) + myLinearRange.GetMinValY(), + Step * (myLinearRange.GetMaxValZ() - myLinearRange.GetMinValZ()) + myLinearRange.GetMinValZ()); + aTransformation.SetTranslation(aVect); - - if(myRotation.Rot1() == 1) { //Axe X - aRot1.SetRotation(myPosition.AxeX(), Step * myRotation.ValX() * PI / 180); - if(myRotation.Rot2() == 2) { - aRot2.SetRotation(myPosition.AxeY(), Step * myRotation.ValY() * PI / 180); - aRot3.SetRotation(myPosition.AxeZ(), Step * myRotation.ValZ() * PI / 180); - } else { - aRot2.SetRotation(myPosition.AxeZ(), Step * myRotation.ValZ() * PI / 180); - aRot3.SetRotation(myPosition.AxeY(), Step * myRotation.ValY() * PI / 180); - } - } else if(myRotation.Rot1() == 2) { //Axe Y - aRot1.SetRotation(myPosition.AxeY(), Step * myRotation.ValY() * PI / 180); - if(myRotation.Rot2() == 1) { - aRot2.SetRotation(myPosition.AxeX(), Step * myRotation.ValX() * PI / 180); - aRot3.SetRotation(myPosition.AxeZ(), Step * myRotation.ValZ() * PI / 180); - } else { - aRot2.SetRotation(myPosition.AxeZ(), Step * myRotation.ValZ() * PI / 180); - aRot3.SetRotation(myPosition.AxeX(), Step * myRotation.ValX() * PI / 180); - } - } else if(myRotation.Rot1() == 3) { //Axe Z - aRot1.SetRotation(myPosition.AxeZ(), Step * myRotation.ValZ() * PI / 180); - if(myRotation.Rot2() == 1) { - aRot2.SetRotation(myPosition.AxeX(), Step * myRotation.ValX() * PI / 180); - aRot3.SetRotation(myPosition.AxeY(), Step * myRotation.ValY() * PI / 180); - } else { - aRot2.SetRotation(myPosition.AxeY(), Step * myRotation.ValY() * PI / 180); - aRot3.SetRotation(myPosition.AxeX(), Step * myRotation.ValX() * PI / 180); - } - } - aRot = aRot1 * aRot2 * aRot3; aTransformation = aTransformation * aRot; return aTransformation; } - - -//================================================================================= -// function : GetLocation() -// purpose : -//================================================================================= -TopLoc_Location Kinematic_Contact::GetLocation() -{ - gp_Trsf aTrans; - - aTrans.SetTransformation(myPosition.Axe3()); - TopLoc_Location aLoc(aTrans); - - return aLoc; -} diff --git a/src/KINEMATIC/Kinematic_Contact.hxx b/src/KINEMATIC/Kinematic_Contact.hxx index ac5678e52..a55191e62 100644 --- a/src/KINEMATIC/Kinematic_Contact.hxx +++ b/src/KINEMATIC/Kinematic_Contact.hxx @@ -31,12 +31,11 @@ #include #include -#include #include +#include #include "Kinematic_Position.hxx" -#include "Kinematic_Rotation.hxx" -#include "Kinematic_Translation.hxx" +#include "Kinematic_Range.hxx" class Kinematic_Contact { @@ -47,33 +46,33 @@ public: ~Kinematic_Contact(); private: - int myType; TopoDS_Shape myShape1; TopoDS_Shape myShape2; + int myType; double myStep; Kinematic_Position myPosition; - Kinematic_Rotation myRotation; - Kinematic_Translation myTranslation; + Kinematic_Range myAngularRange; + Kinematic_Range myLinearRange; public: - gp_Trsf GetTransformation(double Step = 1); TopLoc_Location GetLocation(); + gp_Trsf GetTransformation(double Step); - void Type(int Type){myType = Type;}; - void Shape1(TopoDS_Shape Shape1){myShape1 = Shape1;}; - void Shape2(TopoDS_Shape Shape2){myShape2 = Shape2;}; - void Step(double Step){myStep = Step;}; - void Position(Kinematic_Position& Position){myPosition = Position;}; - void Rotation(Kinematic_Rotation& Rotation){myRotation = Rotation;}; - void Translation(Kinematic_Translation& Translation){myTranslation = Translation;}; + void SetType(int aValue){myType = aValue;}; + void SetShape1(TopoDS_Shape aShape){myShape1 = aShape;}; + void SetShape2(TopoDS_Shape aShape){myShape2 = aShape;}; + void SetStep(double aValue){myStep = aValue;}; + void SetPosition(Kinematic_Position& aPosition){myPosition = aPosition;}; + void SetAngularRange(Kinematic_Range& anAngularRange){myAngularRange = anAngularRange;}; + void SetLinearRange(Kinematic_Range& aLinearRange){myLinearRange = aLinearRange;}; - int& Type(){return myType;}; - TopoDS_Shape& Shape1(){return myShape1;}; - TopoDS_Shape& Shape2(){return myShape2;}; - double& Step(){return myStep;}; - Kinematic_Position& Position(){return myPosition;}; - Kinematic_Rotation& Rotation(){return myRotation;}; - Kinematic_Translation& Translation(){return myTranslation;}; + int& GetType(){return myType;}; + TopoDS_Shape& GetShape1(){return myShape1;}; + TopoDS_Shape& GetShape2(){return myShape2;}; + double& GetStep(){return myStep;}; + Kinematic_Position& GetPosition(){return myPosition;}; + Kinematic_Range& GetAngularRange(){return myAngularRange;}; + Kinematic_Range& GetLinearRange(){return myLinearRange;}; }; diff --git a/src/KINEMATIC/Kinematic_Position.cxx b/src/KINEMATIC/Kinematic_Position.cxx index 926fd2e67..95bb7f5ee 100644 --- a/src/KINEMATIC/Kinematic_Position.cxx +++ b/src/KINEMATIC/Kinematic_Position.cxx @@ -26,27 +26,29 @@ // Module : GEOM // $Header: -using namespace std; #include "Kinematic_Position.hxx" +using namespace std; //======================================================================= // profile // command to build a profile //======================================================================= -Kinematic_Position::Kinematic_Position(){} +Kinematic_Position::Kinematic_Position() {} //======================================================================= // profile // command to build a profile //======================================================================= -Kinematic_Position::Kinematic_Position(gp_Pnt Origin, gp_Dir DirX, gp_Dir DirY, gp_Dir DirZ) +Kinematic_Position::Kinematic_Position(gp_Pnt Origin, gp_Vec DirX, gp_Vec DirY, gp_Vec DirZ) { - myOrigin = Origin; - myDirX = DirX; - myDirY = DirY; - myDirZ = DirZ; + SetOrigin(Origin); + SetDirX(DirX); + SetDirY(DirY); + SetDirZ(DirZ); + + return; } @@ -58,10 +60,54 @@ Kinematic_Position::~Kinematic_Position() {} //================================================================================= -// function : AxeX() +// function : SetOrigin() // purpose : //================================================================================= -gp_Ax1 Kinematic_Position::AxeX() +void Kinematic_Position::SetOrigin(const gp_Pnt& aPnt) +{ + myOrigin = aPnt; + return; +} + + +//================================================================================= +// function : SetDirX() +// purpose : +//================================================================================= +void Kinematic_Position::SetDirX(const gp_Vec& aDir) +{ + myDirX = aDir; + return; +} + + +//================================================================================= +// function : SetDirY() +// purpose : +//================================================================================= +void Kinematic_Position::SetDirY(const gp_Vec& aDir) +{ + myDirY = aDir; + return; +} + + +//================================================================================= +// function : SetDirZ() +// purpose : +//================================================================================= +void Kinematic_Position::SetDirZ(const gp_Vec& aDir) +{ + myDirZ = aDir; + return; +} + + +//================================================================================= +// function : GetAxeX() +// purpose : +//================================================================================= +gp_Ax1 Kinematic_Position::GetAxeX() { gp_Ax1 anAxe; anAxe.SetLocation(myOrigin); @@ -71,10 +117,10 @@ gp_Ax1 Kinematic_Position::AxeX() //================================================================================= -// function : AxeY() +// function : GetAxeY() // purpose : //================================================================================= -gp_Ax1 Kinematic_Position::AxeY() +gp_Ax1 Kinematic_Position::GetAxeY() { gp_Ax1 anAxe; anAxe.SetLocation(myOrigin); @@ -84,10 +130,10 @@ gp_Ax1 Kinematic_Position::AxeY() //================================================================================= -// function : AxeZ() +// function : GetAxeZ() // purpose : //================================================================================= -gp_Ax1 Kinematic_Position::AxeZ() +gp_Ax1 Kinematic_Position::GetAxeZ() { gp_Ax1 anAxe; anAxe.SetLocation(myOrigin); @@ -97,10 +143,10 @@ gp_Ax1 Kinematic_Position::AxeZ() //================================================================================= -// function : Axe3() +// function : GetAxe3() // purpose : //================================================================================= -gp_Ax3 Kinematic_Position::Axe3() +gp_Ax3 Kinematic_Position::GetAxe3() { gp_Ax3 anAxe3(myOrigin, myDirZ, myDirX); return anAxe3; diff --git a/src/KINEMATIC/Kinematic_Position.hxx b/src/KINEMATIC/Kinematic_Position.hxx index b03fd9a1e..db9259920 100644 --- a/src/KINEMATIC/Kinematic_Position.hxx +++ b/src/KINEMATIC/Kinematic_Position.hxx @@ -30,7 +30,7 @@ #define _KINEMATIC_POSITION_HXX #include -#include +#include #include #include #include @@ -39,31 +39,31 @@ class Kinematic_Position { public: Kinematic_Position(); - Kinematic_Position(gp_Pnt Origin, gp_Dir DirX, gp_Dir DirY, gp_Dir DirZ); + Kinematic_Position(gp_Pnt Origin, gp_Vec DirX, gp_Vec DirY, gp_Vec DirZ); ~Kinematic_Position(); private: gp_Pnt myOrigin; - gp_Dir myDirX; - gp_Dir myDirY; - gp_Dir myDirZ; + gp_Vec myDirX; + gp_Vec myDirY; + gp_Vec myDirZ; public: - void Origin(const gp_Pnt& Origin){myOrigin = Origin;}; - void DirX(const gp_Dir& DirX){myDirX = DirX;}; - void DirY(const gp_Dir& DirY){myDirY = DirY;}; - void DirZ(const gp_Dir& DirZ){myDirZ = DirZ;}; + void SetOrigin(const gp_Pnt& aPnt); + void SetDirX(const gp_Vec& aDir); + void SetDirY(const gp_Vec& aDir); + void SetDirZ(const gp_Vec& aDir); - gp_Pnt& Origin(){return myOrigin;}; - gp_Dir& DirX(){return myDirX;}; - gp_Dir& DirY(){return myDirY;}; - gp_Dir& DirZ(){return myDirZ;}; + gp_Pnt& GetOrigin(){return myOrigin;}; + gp_Vec& GetDirX(){return myDirX;}; + gp_Vec& GetDirY(){return myDirY;}; + gp_Vec& GetDirZ(){return myDirZ;}; - gp_Ax1 AxeX(); - gp_Ax1 AxeY(); - gp_Ax1 AxeZ(); + gp_Ax1 GetAxeX(); + gp_Ax1 GetAxeY(); + gp_Ax1 GetAxeZ(); - gp_Ax3 Axe3(); + gp_Ax3 GetAxe3(); }; diff --git a/src/GEOM/GEOM_Translation_i.cc b/src/KINEMATIC/Kinematic_Range.cxx similarity index 60% rename from src/GEOM/GEOM_Translation_i.cc rename to src/KINEMATIC/Kinematic_Range.cxx index a92d47ae1..dc953646f 100644 --- a/src/GEOM/GEOM_Translation_i.cc +++ b/src/KINEMATIC/Kinematic_Range.cxx @@ -1,4 +1,4 @@ -// GEOM GEOM : +// GEOM KINEMATIC // // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -21,81 +21,75 @@ // // // -// File : GEOM_Translation_i.cc +// File : Kinematic_Range.cxx // Author : Damien COQUERET // Module : GEOM -// $Header$ +// $Header: + +#include "Kinematic_Range.hxx" using namespace std; -#include "GEOM_Translation_i.hh" -//================================================================================= -// function : GEOM_Translation_i() constructor (no arguments) -// purpose : for what now ? -//================================================================================= -GEOM_Translation_i::GEOM_Translation_i() +//======================================================================= +// profile +// command to build a profile +//======================================================================= +Kinematic_Range::Kinematic_Range() {} + + +//======================================================================= +// profile +// command to build a profile +//======================================================================= +Kinematic_Range::Kinematic_Range(double MinValX, double MaxValX, + double MinValY, double MaxValY, + double MinValZ, double MaxValZ) { -} - - -//================================================================================= -// function : constructor -// purpose : constructor for servant creation -//================================================================================= -GEOM_Translation_i::GEOM_Translation_i(CORBA::Double ValX, CORBA::Double ValY, CORBA::Double ValZ) -{ - - SetTranslation(ValX, ValY, ValZ); + SetRangeX(MinValX, MaxValX); + SetRangeY(MinValY, MaxValY); + SetRangeZ(MinValZ, MaxValZ); return; - } //================================================================================= -// function : destructor -// purpose : +// function : ~Kinematic_Range() +// purpose : Destroys the object and frees any allocated resources //================================================================================= -GEOM_Translation_i::~GEOM_Translation_i() {} +Kinematic_Range::~Kinematic_Range() {} //================================================================================= -// function : SetTranslation() +// function : SetRangeX() // purpose : //================================================================================= -void GEOM_Translation_i::SetTranslation(CORBA::Double ValX, CORBA::Double ValY, CORBA::Double ValZ) - throw(SALOME::SALOME_Exception) +void Kinematic_Range::SetRangeX(double MinVal, double MaxVal) { - - _ValX = ValX; - _ValY = ValY; - _ValZ = ValZ; + myMinValX = MinVal; + myMaxValX = MaxVal; return; - } + //================================================================================= -// function : GetValX() +// function : SetRangeY() // purpose : //================================================================================= -CORBA::Double GEOM_Translation_i::GetValX() throw(SALOME::SALOME_Exception) +void Kinematic_Range::SetRangeY(double MinVal, double MaxVal) { - return _ValX; + myMinValY = MinVal; + myMaxValY = MaxVal; + return; } -//================================================================================= -// function : GetValY() -// purpose : -//================================================================================= -CORBA::Double GEOM_Translation_i::GetValY() throw(SALOME::SALOME_Exception) -{ - return _ValY; -} //================================================================================= -// function : GetValZ() +// function : SetRangeZ() // purpose : //================================================================================= -CORBA::Double GEOM_Translation_i::GetValZ() throw(SALOME::SALOME_Exception) +void Kinematic_Range::SetRangeZ(double MinVal, double MaxVal) { - return _ValZ; + myMinValZ = MinVal; + myMaxValZ = MaxVal; + return; } diff --git a/src/KINEMATIC/Kinematic_Rotation.hxx b/src/KINEMATIC/Kinematic_Range.hxx similarity index 57% rename from src/KINEMATIC/Kinematic_Rotation.hxx rename to src/KINEMATIC/Kinematic_Range.hxx index c6018e625..f0694a3bd 100644 --- a/src/KINEMATIC/Kinematic_Rotation.hxx +++ b/src/KINEMATIC/Kinematic_Range.hxx @@ -21,44 +21,39 @@ // // // -// File : Kinematic_Rotation.hxx +// File : Kinematic_Range.hxx // Author : Damien COQUERET // Module : GEOM // $Header: -#ifndef _KINEMATIC_ROTATION_HXX -#define _KINEMATIC_ROTATION_HXX +#ifndef _KINEMATIC_RANGE_HXX +#define _KINEMATIC_RANGE_HXX -class Kinematic_Rotation +class Kinematic_Range { public: - Kinematic_Rotation(); - Kinematic_Rotation(int Rot1, int Rot2, int Rot3, double ValX, double ValY, double ValZ); - ~Kinematic_Rotation(); + Kinematic_Range(); + Kinematic_Range(double MinValX, double MaxValX, double MinValY, + double MaxValY, double MinValZ, double MaxValZ); + ~Kinematic_Range(); private: - int myRot1; - int myRot2; - int myRot3; - - double myValX; - double myValY; - double myValZ; + double myMinValX, myMaxValX; + double myMinValY, myMaxValY; + double myMinValZ, myMaxValZ; public: - void Rot1(int Rot1){myRot1 = Rot1;}; - void Rot2(int Rot2){myRot2 = Rot2;}; - void Rot3(int Rot3){myRot3 = Rot3;}; - void ValX(double ValX){myValX = ValX;}; - void ValY(double ValY){myValY = ValY;}; - void ValZ(double ValZ){myValZ = ValZ;}; - int& Rot1(){return myRot1;}; - int& Rot2(){return myRot2;}; - int& Rot3(){return myRot3;}; - double& ValX(){return myValX;}; - double& ValY(){return myValY;}; - double& ValZ(){return myValZ;}; + void SetRangeX(double MinVal, double MaxVal); + void SetRangeY(double MinVal, double MaxVal); + void SetRangeZ(double MinVal, double MaxVal); + + double& GetMinValX(){return myMinValX;}; + double& GetMaxValX(){return myMaxValX;}; + double& GetMinValY(){return myMinValY;}; + double& GetMaxValY(){return myMaxValY;}; + double& GetMinValZ(){return myMinValZ;}; + double& GetMaxValZ(){return myMaxValZ;}; }; diff --git a/src/KINEMATIC/Kinematic_Rotation.cxx b/src/KINEMATIC/Kinematic_Rotation.cxx deleted file mode 100644 index 6a789555a..000000000 --- a/src/KINEMATIC/Kinematic_Rotation.cxx +++ /dev/null @@ -1,60 +0,0 @@ -// GEOM KINEMATIC -// -// 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 : Kinematic_Rotation.cxx -// Author : Damien COQUERET -// Module : GEOM -// $Header: - -using namespace std; -#include "Kinematic_Rotation.hxx" - - -//======================================================================= -// profile -// command to build a profile -//======================================================================= -Kinematic_Rotation::Kinematic_Rotation(){} - - -//======================================================================= -// profile -// command to build a profile -//======================================================================= -Kinematic_Rotation::Kinematic_Rotation(int Rot1, int Rot2, int Rot3, double ValX, double ValY, double ValZ) -{ - myRot1 = Rot1; - myRot2 = Rot2; - myRot3 = Rot3; - - myValX = ValX; - myValY = ValY; - myValZ = ValZ; -} - - -//================================================================================= -// function : ~Kinematic_Rotation() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -Kinematic_Rotation::~Kinematic_Rotation() {} diff --git a/src/KINEMATIC/Kinematic_Translation.cxx b/src/KINEMATIC/Kinematic_Translation.cxx deleted file mode 100644 index 7b8914a11..000000000 --- a/src/KINEMATIC/Kinematic_Translation.cxx +++ /dev/null @@ -1,56 +0,0 @@ -// GEOM KINEMATIC -// -// 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 : Kinematic_Translation.cxx -// Author : Damien COQUERET -// Module : GEOM -// $Header: - -using namespace std; -#include "Kinematic_Translation.hxx" - - -//======================================================================= -// profile -// command to build a profile -//======================================================================= -Kinematic_Translation::Kinematic_Translation(){} - - -//======================================================================= -// profile -// command to build a profile -//======================================================================= -Kinematic_Translation::Kinematic_Translation(double ValX, double ValY, double ValZ) -{ - myValX = ValX; - myValY = ValY; - myValZ = ValZ; -} - - -//================================================================================= -// function : ~Kinematic_Translation() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -Kinematic_Translation::~Kinematic_Translation() {} diff --git a/src/KINEMATIC/Makefile.in b/src/KINEMATIC/Makefile.in index 70843201e..dfc65b9a2 100644 --- a/src/KINEMATIC/Makefile.in +++ b/src/KINEMATIC/Makefile.in @@ -37,8 +37,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl # Libraries targets LIB = libGEOMKinematic.la LIB_SRC = Kinematic_Position.cxx \ - Kinematic_Rotation.cxx \ - Kinematic_Translation.cxx \ + Kinematic_Range.cxx \ Kinematic_Contact.cxx \ Kinematic_Assembly.cxx \ Kinematic_Animation.cxx @@ -46,12 +45,11 @@ LIB_SRC = Kinematic_Position.cxx \ LIB_CLIENT_IDL = # header files -EXPORT_HEADERS = Kinematic_Position.hxx \ - Kinematic_Rotation.hxx \ - Kinematic_Translation.hxx \ - Kinematic_Contact.hxx \ - Kinematic_Assembly.hxx \ - Kinematic_Animation.hxx +EXPORT_HEADERS = Kinematic_Position.hxx \ + Kinematic_Range.hxx \ + Kinematic_Contact.hxx \ + Kinematic_Assembly.hxx \ + Kinematic_Animation.hxx # additionnal information to compil and link file CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome diff --git a/src/KinematicGUI/KinematicGUI.cxx b/src/KinematicGUI/KinematicGUI.cxx index 51ac47644..6c42dbb0c 100644 --- a/src/KinematicGUI/KinematicGUI.cxx +++ b/src/KinematicGUI/KinematicGUI.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header: -using namespace std; #include "KinematicGUI.h" #include "QAD_RightFrame.h" @@ -38,13 +37,14 @@ using namespace std; #include #include "KinematicGUI_ContactDlg.h" // Method CONTACT -#include "KinematicGUI_ContactHDlg.h" // Method CONTACT HELICOIDAL #include "KinematicGUI_PositionDlg.h" // Method POSITION -#include "KinematicGUI_RotationDlg.h" // Method ROTATION -#include "KinematicGUI_TranslationDlg.h" // Method TRANSLATION -#include "KinematicGUI_AnimationDlg.h" // Method Create ANIMATION +#include "KinematicGUI_RangeDlg.h" // Method RANGE +#include "KinematicGUI_AnimationDlg.h" // Method ANIMATION +#include "KinematicGUI_AnimValuesDlg.h" // Method SET VALUES #include "KinematicGUI_AnimDlg.h" // Method Play ANIMATION +using namespace std; + //======================================================================= // function : KinematicGUI() // purpose : Constructor @@ -84,83 +84,43 @@ bool KinematicGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) myKinematicGUI->AddNewAssembly(); break; } - case 61201: // EMBEDDING + case 6121: // CONTACT { - KinematicGUI_ContactDlg *aDlg = new KinematicGUI_ContactDlg(parent, "", myKinematicGUI, Sel, 0); + KinematicGUI_ContactDlg *aDlg = new KinematicGUI_ContactDlg(parent, "", myKinematicGUI, Sel); break; } - case 61202: // PIVOT - { - KinematicGUI_ContactDlg *aDlg = new KinematicGUI_ContactDlg(parent, "", myKinematicGUI, Sel, 1); - break; - } - case 61203: // SLIDE - { - KinematicGUI_ContactDlg *aDlg = new KinematicGUI_ContactDlg(parent, "", myKinematicGUI, Sel, 2); - break; - } - case 61204: // SLIDING PIVOT - { - KinematicGUI_ContactDlg *aDlg = new KinematicGUI_ContactDlg(parent, "", myKinematicGUI, Sel, 3); - break; - } - case 61205: // SPHERICAL - { - KinematicGUI_ContactDlg *aDlg = new KinematicGUI_ContactDlg(parent, "", myKinematicGUI, Sel, 4); - break; - } - case 61206: // PLANE - { - KinematicGUI_ContactDlg *aDlg = new KinematicGUI_ContactDlg(parent, "", myKinematicGUI, Sel, 5); - break; - } - case 61207: // ANNULAR - { - KinematicGUI_ContactDlg *aDlg = new KinematicGUI_ContactDlg(parent, "", myKinematicGUI, Sel, 6); - break; - } - case 61208: // RECTILINEAR - { - KinematicGUI_ContactDlg *aDlg = new KinematicGUI_ContactDlg(parent, "", myKinematicGUI, Sel, 7); - break; - } - case 61209: // PONCTUAL - { - KinematicGUI_ContactDlg *aDlg = new KinematicGUI_ContactDlg(parent, "", myKinematicGUI, Sel, 8); - break; - } - case 61210: // HELICOIDAL - { - KinematicGUI_ContactHDlg *aDlg = new KinematicGUI_ContactHDlg(parent, "", myKinematicGUI, Sel); - break; - } - case 6131: // ROTATION + case 6122: // POSITION { KinematicGUI_PositionDlg *aDlg = new KinematicGUI_PositionDlg(parent, "", myKinematicGUI, Sel, true); break; } - case 6132: // ROTATION + case 6123: // ANGULAR RANGE { - KinematicGUI_RotationDlg *aDlg = new KinematicGUI_RotationDlg(parent, "", myKinematicGUI, Sel, true); + KinematicGUI_RangeDlg *aDlg = new KinematicGUI_RangeDlg(parent, "", myKinematicGUI, Sel, 0); break; } - case 6133: // TRANSLATION + case 6124: // LINEAR RANGE { - KinematicGUI_TranslationDlg *aDlg = new KinematicGUI_TranslationDlg(parent, "", myKinematicGUI, Sel, true); + KinematicGUI_RangeDlg *aDlg = new KinematicGUI_RangeDlg(parent, "", myKinematicGUI, Sel, 1); break; } - case 614: // ANIMATION + case 613: // ANIMATION { KinematicGUI_AnimationDlg *aDlg = new KinematicGUI_AnimationDlg(parent, "", myKinematicGUI, Sel); break; } - case 6141: // RUN ANIMATION + case 6131: // SET VALUES + { + KinematicGUI_AnimValuesDlg *aDlg = new KinematicGUI_AnimValuesDlg(parent, "", myKinematicGUI, Sel); + break; + } + case 6132: // RUN ANIMATION { if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { Handle(AIS_InteractiveContext) ic; OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); ic = v3d->getAISContext(); - KinematicGUI_AnimDlg *aDlg = new KinematicGUI_AnimDlg(parent, "", myKinematicGUI, Sel, ic, true); + KinematicGUI_AnimDlg *aDlg = new KinematicGUI_AnimDlg(parent, "", myKinematicGUI, Sel, ic); } break; } @@ -285,7 +245,7 @@ bool KinematicGUI::AddAssemblyInStudy(GEOM::GEOM_Assembly_ptr aAssembly) SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry()); TCollection_AsciiString nameG("Assembly_"); - nameG += TCollection_AsciiString(myGeomGUI->GetNbGeom()++) + TCollection_AsciiString("\0"); + nameG += TCollection_AsciiString(myGeomGUI->myNbGeom++) + TCollection_AsciiString("\0"); // open transaction QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy()); @@ -341,7 +301,7 @@ bool KinematicGUI::AddContactInStudy(GEOM::GEOM_Assembly_ptr Ass, GEOM::GEOM_Con SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry()); TCollection_AsciiString nameG("Contact_"); - nameG += TCollection_AsciiString(myGeomGUI->GetNbGeom()++) + TCollection_AsciiString("\0"); + nameG += TCollection_AsciiString(myGeomGUI->myNbGeom++) + TCollection_AsciiString("\0"); // open transaction QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy()); @@ -423,7 +383,7 @@ bool KinematicGUI::AddAnimationInStudy(GEOM::GEOM_Animation_ptr aAnimation) SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry()); TCollection_AsciiString nameG("Animation_"); - nameG += TCollection_AsciiString(myGeomGUI->GetNbGeom()++) + TCollection_AsciiString("\0"); + nameG += TCollection_AsciiString(myGeomGUI->myNbGeom++) + TCollection_AsciiString("\0"); // open transaction QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy()); @@ -482,12 +442,8 @@ void KinematicGUI::SetPosition(GEOM::GEOM_Contact_ptr aContact, GEOM::PointStruc GEOM::DirStruct VX, GEOM::DirStruct VY, GEOM::DirStruct VZ) { try { - GEOM::GEOM_Position_var myGeomPosition = GEOM::GEOM_Position::_narrow(aContact->GetPosition()); - myGeomPosition->SetOrigin(P0); - myGeomPosition->SetVX(VX); - myGeomPosition->SetVY(VY); - myGeomPosition->SetVZ(VZ); - + aContact->SetPosition(P0.x, P0.y, P0.z, VX.PS.x, VX.PS.y, VX.PS.z, + VY.PS.x, VY.PS.y, VY.PS.z, VZ.PS.x, VZ.PS.y, VZ.PS.z); myGeom->SetPosition(aContact); } catch(const SALOME::SALOME_Exception& S_ex) { @@ -498,26 +454,16 @@ void KinematicGUI::SetPosition(GEOM::GEOM_Contact_ptr aContact, GEOM::PointStruc //======================================================================= -// function : SetRotation() +// function : SetAngularRange() // purpose : //======================================================================= -void KinematicGUI::SetRotation(GEOM::GEOM_Contact_ptr aContact, - int Rot1, int Rot2, int Rot3, - double Val1, double Val2, double Val3) +void KinematicGUI::SetAngularRange(GEOM::GEOM_Contact_ptr aContact, + double MinValX, double MaxValX, double MinValY, + double MaxValY, double MinValZ, double MaxValZ) { try { - GEOM::GEOM_Rotation_var myGeomRotation = GEOM::GEOM_Rotation::_narrow(aContact->GetRotation()); - myGeomRotation->SetRotation(Rot1, Rot2, Rot3, Val1, Val2, Val3); - int type = aContact->GetType(); - if(type == 9) { //HELICOIDAL - GEOM::GEOM_Translation_var myGeomTranslation = GEOM::GEOM_Translation::_narrow(aContact->GetTranslation()); - double aValY = myGeomTranslation->GetValY(); - double aValZ = myGeomTranslation->GetValZ(); - double aStep = aContact->GetStep(); - double aValX = aStep * Val1 / 360; - myGeomTranslation->SetTranslation(aValX, aValY, aValZ); - } - myGeom->SetRotation(aContact); + aContact->SetAngularRange(MinValX, MaxValX, MinValY, MaxValY, MinValZ, MaxValZ); + myGeom->SetAngularRange(aContact); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -527,28 +473,35 @@ void KinematicGUI::SetRotation(GEOM::GEOM_Contact_ptr aContact, //======================================================================= -// function : SetTranslation() +// function : SetLinearRange() // purpose : //======================================================================= -void KinematicGUI::SetTranslation(GEOM::GEOM_Contact_ptr aContact, - double ValX, double ValY, double ValZ) +void KinematicGUI::SetLinearRange(GEOM::GEOM_Contact_ptr aContact, + double MinValX, double MaxValX, double MinValY, + double MaxValY, double MinValZ, double MaxValZ) { try { - GEOM::GEOM_Translation_var myGeomTranslation = GEOM::GEOM_Translation::_narrow(aContact->GetTranslation()); - myGeomTranslation->SetTranslation(ValX, ValY, ValZ); - int type = aContact->GetType(); - if(type == 9) { //HELICOIDAL - GEOM::GEOM_Rotation_var myGeomRotation = GEOM::GEOM_Rotation::_narrow(aContact->GetRotation()); - int aRot1 = myGeomRotation->GetRot1(); - int aRot2 = myGeomRotation->GetRot2(); - int aRot3 = myGeomRotation->GetRot3(); - double aVal2 = myGeomRotation->GetVal2(); - double aVal3 = myGeomRotation->GetVal3(); - double aStep = aContact->GetStep(); - double aVal1 = 360 * ValX / aStep; - myGeomRotation->SetRotation(aRot1, aRot2, aRot3, aVal1, aVal2, aVal3); - } - myGeom->SetTranslation(aContact); + aContact->SetLinearRange(MinValX, MaxValX, MinValY, MaxValY, MinValZ, MaxValZ); + myGeom->SetLinearRange(aContact); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//======================================================================= +// function : SetDisplacement() +// purpose : +//======================================================================= +void KinematicGUI::SetDisplacement(GEOM::GEOM_Animation_ptr anAnimation, + GEOM::GEOM_Contact_ptr aContact, + const GEOM::ListOfDouble& aList) +{ + try { + anAnimation->SetDisplacement(aContact, aList); + myGeom->SetDisplacement(anAnimation, aContact); } catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); @@ -558,7 +511,7 @@ void KinematicGUI::SetTranslation(GEOM::GEOM_Contact_ptr aContact, //===================================================================================== -// function : AddContactInStudy() +// function : GetNameFromType() // purpose : //===================================================================================== TCollection_AsciiString KinematicGUI::GetNameFromType(int type) @@ -601,38 +554,33 @@ Kinematic_Contact* KinematicGUI::CreateContact(GEOM::GEOM_Contact_ptr aContact) { GEOM::GEOM_Shape_var myShape1 = aContact->GetShape1(); GEOM::GEOM_Shape_var myShape2 = aContact->GetShape2(); - GEOM::GEOM_Position_var myPosition = aContact->GetPosition(); - GEOM::GEOM_Rotation_var myRotation = aContact->GetRotation(); - GEOM::GEOM_Translation_var myTranslation = aContact->GetTranslation(); int Type = aContact->GetType(); double Step = aContact->GetStep(); + GEOM::ListOfDouble_var aPosList = aContact->GetPosition(); + GEOM::ListOfDouble_var aARList = aContact->GetAngularRange(); + GEOM::ListOfDouble_var aLRList = aContact->GetLinearRange(); TopoDS_Shape aShape1 = myGeomGUI->GetShapeReader().GetShape(myGeom, myShape1); TopoDS_Shape aShape2 = myGeomGUI->GetShapeReader().GetShape(myGeom, myShape2); Kinematic_Contact* KContact = new Kinematic_Contact(aShape1, aShape2, Type, Step); - gp_Pnt Origin(myPosition->GetOrigin().x, myPosition->GetOrigin().y, myPosition->GetOrigin().z); - gp_Dir aDirX(myPosition->GetVX().PS.x, myPosition->GetVX().PS.y, myPosition->GetVX().PS.z); - gp_Dir aDirY(myPosition->GetVY().PS.x, myPosition->GetVY().PS.y, myPosition->GetVY().PS.z); - gp_Dir aDirZ(myPosition->GetVZ().PS.x, myPosition->GetVZ().PS.y, myPosition->GetVZ().PS.z); + gp_Pnt Center(aPosList[0], aPosList[1], aPosList[2]); + gp_Dir aDirX(aPosList[3], aPosList[4], aPosList[5]); + gp_Dir aDirY(aPosList[6], aPosList[7], aPosList[8]); + gp_Dir aDirZ(aPosList[9], aPosList[10], aPosList[11]); + KContact->GetPosition().SetOrigin(Center); + KContact->GetPosition().SetDirX(aDirX); + KContact->GetPosition().SetDirY(aDirY); + KContact->GetPosition().SetDirZ(aDirZ); - KContact->Position().Origin(Origin); - KContact->Position().DirX(aDirX); - KContact->Position().DirY(aDirY); - KContact->Position().DirZ(aDirZ); + KContact->GetAngularRange().SetRangeX(aARList[0], aARList[1]); + KContact->GetAngularRange().SetRangeY(aARList[2], aARList[3]); + KContact->GetAngularRange().SetRangeZ(aARList[4], aARList[5]); - KContact->Rotation().Rot1(myRotation->GetRot1()); - KContact->Rotation().Rot2(myRotation->GetRot2()); - KContact->Rotation().Rot3(myRotation->GetRot3()); - - KContact->Rotation().ValX(myRotation->GetVal1()); - KContact->Rotation().ValY(myRotation->GetVal2()); - KContact->Rotation().ValZ(myRotation->GetVal3()); - - KContact->Translation().ValX(myTranslation->GetValX()); - KContact->Translation().ValY(myTranslation->GetValY()); - KContact->Translation().ValZ(myTranslation->GetValZ()); + KContact->GetLinearRange().SetRangeX(aLRList[0], aLRList[1]); + KContact->GetLinearRange().SetRangeY(aLRList[2], aLRList[3]); + KContact->GetLinearRange().SetRangeZ(aLRList[4], aLRList[5]); return KContact; } @@ -658,7 +606,7 @@ Kinematic_Assembly* KinematicGUI::CreateAssembly(GEOM::GEOM_Assembly_ptr aAssemb //======================================================================= -// function : () +// function : CreateAnimation() // purpose : //======================================================================= Kinematic_Animation* KinematicGUI::CreateAnimation(GEOM::GEOM_Animation_ptr aAnimation) @@ -672,6 +620,17 @@ Kinematic_Animation* KinematicGUI::CreateAnimation(GEOM::GEOM_Animation_ptr aAni TopoDS_Shape myFrame = myGeomGUI->GetShapeReader().GetShape(myGeom, aFrame); Kinematic_Animation* KAnimation = new Kinematic_Animation(KAssembly, myFrame, Duration, NbSeq); + + GEOM::ListOfContact_var aContactList = myAssembly->GetContactList(); + for(int i = 0; i < myAssembly->NbContacts(); i++) { + GEOM::GEOM_Contact_var aContact = aContactList[i]; + GEOM::ListOfDouble_var aList = aAnimation->GetDisplacement(aContact); + list aKList; + for(int k = 0; k < 12; k++) + aKList.push_back(aList[k]); + KAnimation->SetDisplacement(i, aKList); + } + return KAnimation; } diff --git a/src/KinematicGUI/KinematicGUI.h b/src/KinematicGUI/KinematicGUI.h index 41d7d57ac..134ed87c8 100644 --- a/src/KinematicGUI/KinematicGUI.h +++ b/src/KinematicGUI/KinematicGUI.h @@ -67,12 +67,16 @@ public : TCollection_AsciiString GetNameFromType(int type); void SetPosition(GEOM::GEOM_Contact_ptr aContact, GEOM::PointStruct P0, - GEOM::DirStruct VX, GEOM::DirStruct VY, GEOM::DirStruct VZ); - void SetRotation(GEOM::GEOM_Contact_ptr aContact, - int Rot1, int Rot2, int Rot3, - double Val1, double Val2, double Val3); - void SetTranslation(GEOM::GEOM_Contact_ptr aContact, - double ValX, double ValY, double ValZ); + GEOM::DirStruct VX, GEOM::DirStruct VY, GEOM::DirStruct VZ); + void SetAngularRange(GEOM::GEOM_Contact_ptr aContact, + double MinValX, double MaxValX, double MinValY, + double MaxValY, double MinValZ, double MaxValZ); + void SetLinearRange(GEOM::GEOM_Contact_ptr aContact, + double MinValX, double MaxValX, double MinValY, + double MaxValY, double MinValZ, double MaxValZ); + void SetDisplacement(GEOM::GEOM_Animation_ptr anAnimation, + GEOM::GEOM_Contact_ptr aContact, + const GEOM::ListOfDouble& aList); Kinematic_Contact* CreateContact(GEOM::GEOM_Contact_ptr aContact); Kinematic_Assembly* CreateAssembly(GEOM::GEOM_Assembly_ptr aAssembly); diff --git a/src/KinematicGUI/KinematicGUI_3Sel1List_QTD.cxx b/src/KinematicGUI/KinematicGUI_3Sel1List_QTD.cxx deleted file mode 100644 index 67ac66dd4..000000000 --- a/src/KinematicGUI/KinematicGUI_3Sel1List_QTD.cxx +++ /dev/null @@ -1,117 +0,0 @@ -/**************************************************************************** -** Form implementation generated from reading ui file 'KinematicGUI_3Sel1List_QTD.ui' -** -** Created: mer fév 4 13:09:40 2004 -** by: The User Interface Compiler (uic) -** -** WARNING! All changes made in this file will be lost! -****************************************************************************/ -#include "KinematicGUI_3Sel1List_QTD.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * Constructs a KinematicGUI_3Sel1List_QTD which is a child of 'parent', with the - * name 'name' and widget flags set to 'f'. - */ -KinematicGUI_3Sel1List_QTD::KinematicGUI_3Sel1List_QTD( QWidget* parent, const char* name, WFlags fl ) - : QWidget( parent, name, fl ) -{ - if ( !name ) - setName( "KinematicGUI_3Sel1List_QTD" ); - resize( 129, 145 ); - setCaption( trUtf8( "KinematicGUI_3Sel1List_QTD" ) ); - KinematicGUI_3Sel1List_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "KinematicGUI_3Sel1List_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"); - QSpacerItem* spacer = new QSpacerItem( 0, 90, QSizePolicy::Minimum, QSizePolicy::Expanding ); - Layout1->addItem( spacer, 4, 2 ); - - PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); - PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); - PushButton2->setText( trUtf8( "" ) ); - - Layout1->addWidget( PushButton2, 2, 1 ); - - 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 ); - - TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); - TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); - TextLabel4->setText( trUtf8( "TL4" ) ); - - Layout1->addWidget( TextLabel4, 3, 0 ); - - LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); - - Layout1->addWidget( LineEdit1, 0, 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 ); - - TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); - TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); - TextLabel3->setText( trUtf8( "TL3" ) ); - - Layout1->addWidget( TextLabel3, 2, 0 ); - - PushButton3 = new QPushButton( GroupBox1, "PushButton3" ); - PushButton3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton3->sizePolicy().hasHeightForWidth() ) ); - PushButton3->setText( trUtf8( "" ) ); - - Layout1->addWidget( PushButton3, 3, 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 ); - - LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); - - Layout1->addWidget( LineEdit2, 2, 2 ); - - LineEdit3 = new QLineEdit( GroupBox1, "LineEdit3" ); - - Layout1->addWidget( LineEdit3, 3, 2 ); - - TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); - TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); - TextLabel2->setText( trUtf8( "TL2" ) ); - - Layout1->addWidget( TextLabel2, 1, 0 ); - - GroupBox1Layout->addLayout( Layout1, 0, 0 ); - - KinematicGUI_3Sel1List_QTDLayout->addWidget( GroupBox1, 0, 0 ); -} - -/* - * Destroys the object and frees any allocated resources - */ -KinematicGUI_3Sel1List_QTD::~KinematicGUI_3Sel1List_QTD() -{ - // no need to delete child widgets, Qt does it all for us -} - diff --git a/src/KinematicGUI/KinematicGUI_3Sel1List_QTD.h b/src/KinematicGUI/KinematicGUI_3Sel1List_QTD.h deleted file mode 100644 index e9cbbe2b4..000000000 --- a/src/KinematicGUI/KinematicGUI_3Sel1List_QTD.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** Form interface generated from reading ui file 'KinematicGUI_3Sel1List_QTD.ui' -** -** Created: mer fév 4 13:09:40 2004 -** by: The User Interface Compiler (uic) -** -** WARNING! All changes made in this file will be lost! -****************************************************************************/ -#ifndef KINEMATICGUI_3SEL1LIST_QTD_H -#define KINEMATICGUI_3SEL1LIST_QTD_H - -#include -#include -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QComboBox; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; - -class KinematicGUI_3Sel1List_QTD : public QWidget -{ - Q_OBJECT - -public: - KinematicGUI_3Sel1List_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); - ~KinematicGUI_3Sel1List_QTD(); - - QGroupBox* GroupBox1; - QPushButton* PushButton2; - QLabel* TextLabel1; - QLabel* TextLabel4; - QLineEdit* LineEdit1; - QPushButton* PushButton1; - QLabel* TextLabel3; - QPushButton* PushButton3; - QComboBox* ComboBox1; - QLineEdit* LineEdit2; - QLineEdit* LineEdit3; - QLabel* TextLabel2; - - -protected: - QGridLayout* KinematicGUI_3Sel1List_QTDLayout; - QGridLayout* GroupBox1Layout; - QGridLayout* Layout1; -}; - -#endif // KINEMATICGUI_3SEL1LIST_QTD_H diff --git a/src/KinematicGUI/KinematicGUI_3Sel1Spin_QTD.cxx b/src/KinematicGUI/KinematicGUI_3Sel1Spin_QTD.cxx deleted file mode 100644 index bb5c78728..000000000 --- a/src/KinematicGUI/KinematicGUI_3Sel1Spin_QTD.cxx +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************** -** Form implementation generated from reading ui file 'KinematicGUI_3Sel1Spin_QTD.ui' -** -** Created: mer fév 4 13:09:41 2004 -** by: The User Interface Compiler (uic) -** -** WARNING! All changes made in this file will be lost! -****************************************************************************/ -#include "KinematicGUI_3Sel1Spin_QTD.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * Constructs a KinematicGUI_3Sel1Spin_QTD which is a child of 'parent', with the - * name 'name' and widget flags set to 'f'. - */ -KinematicGUI_3Sel1Spin_QTD::KinematicGUI_3Sel1Spin_QTD( QWidget* parent, const char* name, WFlags fl ) - : QWidget( parent, name, fl ) -{ - if ( !name ) - setName( "KinematicGUI_3Sel1Spin_QTD" ); - resize( 129, 147 ); - setCaption( trUtf8( "KinematicGUI_3Sel1Spin_QTD" ) ); - KinematicGUI_3Sel1Spin_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "KinematicGUI_3Sel1Spin_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"); - - LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); - - Layout1->addWidget( LineEdit1, 0, 2 ); - - PushButton3 = new QPushButton( GroupBox1, "PushButton3" ); - PushButton3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton3->sizePolicy().hasHeightForWidth() ) ); - PushButton3->setText( trUtf8( "" ) ); - - Layout1->addWidget( PushButton3, 2, 1 ); - - Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); - - TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); - TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); - TextLabel4->setText( trUtf8( "TL4" ) ); - - Layout2->addWidget( TextLabel4, 0, 0 ); - - SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); - SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); - - Layout2->addWidget( SpinBox1, 0, 1 ); - - Layout1->addMultiCellLayout( Layout2, 3, 3, 0, 2 ); - - TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); - TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); - TextLabel3->setText( trUtf8( "TL3" ) ); - - Layout1->addWidget( TextLabel3, 2, 0 ); - - LineEdit3 = new QLineEdit( GroupBox1, "LineEdit3" ); - - Layout1->addWidget( LineEdit3, 2, 2 ); - - LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); - - Layout1->addWidget( LineEdit2, 1, 2 ); - - PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); - PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); - PushButton2->setText( trUtf8( "" ) ); - - Layout1->addWidget( PushButton2, 1, 1 ); - - TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); - TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); - TextLabel2->setText( trUtf8( "TL2" ) ); - - Layout1->addWidget( TextLabel2, 1, 0 ); - QSpacerItem* spacer = new QSpacerItem( 0, 100, QSizePolicy::Minimum, QSizePolicy::Expanding ); - Layout1->addItem( spacer, 4, 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 ); - - GroupBox1Layout->addLayout( Layout1, 0, 0 ); - - KinematicGUI_3Sel1Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); -} - -/* - * Destroys the object and frees any allocated resources - */ -KinematicGUI_3Sel1Spin_QTD::~KinematicGUI_3Sel1Spin_QTD() -{ - // no need to delete child widgets, Qt does it all for us -} - diff --git a/src/KinematicGUI/KinematicGUI_AnimDlg.cxx b/src/KinematicGUI/KinematicGUI_AnimDlg.cxx index 15fe8e6a3..a46dbd8c9 100644 --- a/src/KinematicGUI/KinematicGUI_AnimDlg.cxx +++ b/src/KinematicGUI/KinematicGUI_AnimDlg.cxx @@ -26,189 +26,16 @@ // Module : GEOM // $Header: -using namespace std; #include "KinematicGUI_AnimDlg.h" +#include + #include "QAD_RightFrame.h" #include "OCCViewer_ViewFrame.h" #include "QAD_FileDlg.h" #include "QAD_Tools.h" -//================================================================================= -// class : MyThread() -// purpose : -//================================================================================= -MyThread::MyThread(Kinematic_Animation* KAnimation, Handle(AIS_InteractiveContext) ic) -{ - myIC = ic; - myKAnimation = KAnimation; - myIsActive = false; -} - -//================================================================================= -// function : ~MyThread() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -MyThread::~MyThread() {} - -//================================================================================= -// class : run() -// purpose : -//================================================================================= -void MyThread::run() -{ - qApp->lock(); - while(myIsActive) { - emit frameChanged(); - - qApp->syncX(); - - double Step, Val; - Step = 1.0 / myKAnimation->NbSeq(); - Val = myValue * Step; - - myKAnimation->myMovedShape.Clear(); - myKAnimation->myMovedShape.Add(myKAnimation->Frame()); - - myKAnimation->myNbAIS = 0; - myKAnimation->GetNextShape(myIC, myLoc, myKAnimation->Frame(), Val); - - myIC->UpdateCurrentViewer(); - - qApp->unlock(); - usleep((int)(myKAnimation->Duration() / myKAnimation->NbSeq() * 1e6)); - qApp->lock(); - - if (!myIsActive) break; - } - - qApp->unlock(); - emit stopped(); - QThread::exit(); - return; -} - -//================================================================================= -// class : InitAnim() -// purpose : -//================================================================================= -void MyThread::InitAnim() -{ - myKAnimation->myMovedShape.Clear(); - myKAnimation->myMovedShape.Add(myKAnimation->Frame()); - - gp_Trsf aLoc; - myLoc = aLoc; - if(!myKAnimation->IsCreated) - myKAnimation->GetNextShape(myIC, myLoc, myKAnimation->Frame(), 1); - myKAnimation->IsCreated = true; - - myAISFrame = new AIS_Shape(TopoDS_Shape()); - myAISFrame->Set(myKAnimation->Frame()); - if(myKAnimation->myIsShading) { - myAISFrame->SetColor(Quantity_NOC_GOLDENROD); - myIC->Display(myAISFrame, 1, 1, Standard_False); - } - else { - myAISFrame->SetColor(Quantity_NOC_RED); - myIC->Display(myAISFrame, 0, 1, Standard_False); - } - return; -} - -//================================================================================= -// class : ClearAnim() -// purpose : -//================================================================================= -void MyThread::ClearAnim(int ClearPrs) -{ - myIC->Erase(myAISFrame, Standard_False, Standard_False); - myIC->ClearPrs(myAISFrame); - - if(!myKAnimation->ListOfAIS.IsEmpty()) { - for(int i = 1; i <= myKAnimation->myNbAIS; i++) { - Handle(AIS_Shape) myShape = Handle(AIS_Shape)::DownCast(myKAnimation->ListOfAIS.Value(i)); - myIC->Erase(myShape, Standard_False, Standard_False); - if(ClearPrs) - myIC->ClearPrs(myShape); - } - } - myIC->UpdateCurrentViewer(); - return; -} - -//================================================================================= -// class : NextFrame() -// purpose : -//================================================================================= -void MyThread::NextFrame() { - double Step, Val; - Step = 1.0 / myKAnimation->NbSeq(); - Val = myValue * Step; - - myKAnimation->myMovedShape.Clear(); - myKAnimation->myMovedShape.Add(myKAnimation->Frame()); - - myKAnimation->myNbAIS = 0; - myKAnimation->GetNextShape(myIC, myLoc, myKAnimation->Frame(), Val); - - myIC->UpdateCurrentViewer(); - return; -} - -//================================================================================= -// class : startAnimation() -// purpose : -//================================================================================= -void MyThread::startAnimation() { - //DCQ : QThread doesn't work... -// if(!myIsActive) { -// myIsActive = true; -// QThread::start(); -// } - - QApplication::setOverrideCursor(Qt::waitCursor); - myIsActive = true; - qApp->lock(); - while(myIsActive) { - emit frameChanged(); - - qApp->syncX(); - - double Step, Val; - Step = 1.0 / myKAnimation->NbSeq(); - Val = myValue * Step; - - myKAnimation->myMovedShape.Clear(); - myKAnimation->myMovedShape.Add(myKAnimation->Frame()); - - myKAnimation->myNbAIS = 0; - myKAnimation->GetNextShape(myIC, myLoc, myKAnimation->Frame(), Val); - - myIC->UpdateCurrentViewer(); - - qApp->unlock(); - usleep((int)(myKAnimation->Duration() / myKAnimation->NbSeq() * 1e6)); - qApp->lock(); - - if (!myIsActive) break; - } - - QApplication::restoreOverrideCursor(); - qApp->unlock(); - emit stopped(); - return; -} - -//================================================================================= -// class : stopAnimation() -// purpose : -//================================================================================= -void MyThread::stopAnimation() { - myIsActive = false; - return; -} - +using namespace std; //================================================================================= // class : KinematicGUI_AnimDlg() @@ -227,38 +54,127 @@ KinematicGUI_AnimDlg::KinematicGUI_AnimDlg(QWidget* parent, const char* name, Ki GroupMedium->close(TRUE); resize(0, 0); + 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 ); + + LayoutA = new QGridLayout( 0, 1, 1, 0, 6, "LayoutA"); + + LayoutD = new QGridLayout( 0, 1, 1, 0, 6, "LayoutD"); + + PushButton7 = new QPushButton( GroupBox1, "PushButton7" ); + PushButton7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton7->sizePolicy().hasHeightForWidth() ) ); + PushButton7->setText( trUtf8( "" ) ); + + LayoutD->addWidget( PushButton7, 0, 1 ); + + CheckButton1 = new QRadioButton( GroupBox1, "CheckButton1" ); + CheckButton1->setText( trUtf8( "" ) ); + + LayoutD->addWidget( CheckButton1, 0, 0 ); + + LayoutA->addLayout( LayoutD, 3, 0 ); + + Slider1 = new QSlider( GroupBox1, "Slider1" ); + Slider1->setOrientation( QSlider::Horizontal ); + + LayoutA->addWidget( Slider1, 1, 0 ); + + LayoutB = new QGridLayout( 0, 1, 1, 0, 6, "LayoutB"); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + LayoutB->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( "" ) ); + + LayoutB->addWidget( PushButton1, 0, 1 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + LayoutB->addWidget( LineEdit1, 0, 2 ); + + LayoutA->addLayout( LayoutB, 0, 0 ); + QSpacerItem* spacer = new QSpacerItem( 0, 212, QSizePolicy::Minimum, QSizePolicy::Expanding ); + LayoutA->addItem( spacer, 4, 0 ); + + LayoutC = new QGridLayout( 0, 1, 1, 0, 6, "LayoutC"); + + PushButton4 = new QPushButton( GroupBox1, "PushButton4" ); + PushButton4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton4->sizePolicy().hasHeightForWidth() ) ); + PushButton4->setText( trUtf8( "" ) ); + + LayoutC->addWidget( PushButton4, 0, 2 ); + + PushButton6 = new QPushButton( GroupBox1, "PushButton6" ); + PushButton6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton6->sizePolicy().hasHeightForWidth() ) ); + PushButton6->setText( trUtf8( "" ) ); + + LayoutC->addWidget( PushButton6, 0, 4 ); + + PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); + PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); + PushButton2->setText( trUtf8( "" ) ); + + LayoutC->addWidget( PushButton2, 0, 0 ); + + PushButton5 = new QPushButton( GroupBox1, "PushButton5" ); + PushButton5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton5->sizePolicy().hasHeightForWidth() ) ); + PushButton5->setText( trUtf8( "" ) ); + + LayoutC->addWidget( PushButton5, 0, 3 ); + + PushButton3 = new QPushButton( GroupBox1, "PushButton3" ); + PushButton3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton3->sizePolicy().hasHeightForWidth() ) ); + PushButton3->setText( trUtf8( "" ) ); + + LayoutC->addWidget( PushButton3, 0, 1 ); + + LayoutA->addLayout( LayoutC, 2, 0 ); + + GroupBox1Layout->addLayout( LayoutA, 0, 0 ); + + /***************************************************************/ setCaption(tr("GEOM_ANIM_TITLE")); QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_ANIMATION"))); QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_ANIM_FIRST"))); QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_ANIM_PREV"))); - QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_ANIM_STOP"))); - QPixmap image4(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_ANIM_PLAY"))); - QPixmap image5(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_ANIM_NEXT"))); - QPixmap image6(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_ANIM_LAST"))); + QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_ANIM_PLAY"))); + QPixmap image4(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_ANIM_NEXT"))); + QPixmap image5(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_ANIM_LAST"))); + QPixmap image6(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); /***************************************************************/ GroupConstructors->setTitle(tr("GEOM_ANIM")); RadioButton1->setPixmap(image0); + PushButton1->setPixmap(image6); + PushButton2->setPixmap(image1); + PushButton3->setPixmap(image2); + PushButton4->setPixmap(image3); + PushButton5->setPixmap(image4); + PushButton6->setPixmap(image5); + TextLabel1->setText(tr("GEOM_OBJECT")); + PushButton7->setText(tr("GEOM_ANIM_EXPORT")); + CheckButton1->setText(tr("GEOM_ANIM_SHADING")); - Group1 = new KinematicGUI_Anim_QTD(this, "Group1"); - Group1->PushButton1->setPixmap(image1); - Group1->PushButton2->setPixmap(image2); - Group1->PushButton3->setPixmap(image3); - Group1->PushButton4->setPixmap(image4); - Group1->PushButton5->setPixmap(image5); - Group1->PushButton6->setPixmap(image6); - Group1->PushButton7->setText(tr("GEOM_ANIM_EXPORT")); - Group1->CheckButton1->setText(tr("GEOM_ANIM_SHADING")); - Group1->CheckButton2->setText(tr("GEOM_ANIM_INLOOP")); - - Layout1->addWidget(Group1, 1, 0); + Layout1->addWidget(GroupBox1, 1, 0); /***************************************************************/ /* Initialisation */ myKinematicGUI = theKinematicGUI; + mySelection = Sel; + myIC = ic; QApplication::setOverrideCursor(Qt::waitCursor); - Init(Sel, ic); + Init(); QApplication::restoreOverrideCursor(); } @@ -270,7 +186,6 @@ KinematicGUI_AnimDlg::KinematicGUI_AnimDlg(QWidget* parent, const char* name, Ki KinematicGUI_AnimDlg::~KinematicGUI_AnimDlg() { // no need to delete child widgets, Qt does it all for us - this->destroy(TRUE, TRUE); } @@ -278,61 +193,38 @@ KinematicGUI_AnimDlg::~KinematicGUI_AnimDlg() // function : Init() // purpose : //================================================================================= -void KinematicGUI_AnimDlg::Init(SALOME_Selection* Sel, Handle(AIS_InteractiveContext) ic) +void KinematicGUI_AnimDlg::Init() { /* init variables */ - mySelection = Sel; - myGeomBase = new GEOMBase(); myGeomGUI = GEOMContext::GetGeomGUI(); myGeomGUI->SetActiveDialogBox((QDialog*)this); - myGeom = myGeomGUI->myComponentGeom; - - Standard_Boolean testResult; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); - GEOM::GEOM_Animation_var myGeomAnim = myGeomBase->ConvertIOinAnimation(IO, testResult); - if(!testResult) - ClickOnCancel(); + RadioButton1->setChecked(TRUE); + Slider1->setPageStep(1); + Slider1->setValue(0); - Kinematic_Animation* KAnimation = myKinematicGUI->CreateAnimation(myGeomAnim); - - bool IsOk = false; - for(int cpt = 1; cpt <= KAnimation->myIndexToShape.Extent(); cpt++) { - TopoDS_Shape myShape = KAnimation->myIndexToShape.FindKey(cpt); - if(myShape == KAnimation->Frame()) - IsOk = true; - } - if(!IsOk) - ClickOnCancel(); - - Group1->CheckButton2->setEnabled(false); - - Group1->Slider1->setMaxValue(KAnimation->NbSeq()); - Group1->Slider1->setPageStep(1); - Group1->Slider1->setValue(0); + myDuration = 5.0; + myNbSeq = 50; + myIsActive = false; + myType = 0; /* signals and slots connections */ connect(buttonClose, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); connect(myGeomGUI, SIGNAL(SignalDeactivateActiveDialog()), this, SLOT(DeactivateActiveDialog())); connect(myGeomGUI, SIGNAL(SignalCloseAllDialogs()), this, SLOT(ClickOnCancel())); - connect(Group1->Slider1, SIGNAL(valueChanged(int)), this, SLOT(ClickOnSlider(int))); - connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(ClickOnFirst())); - connect(Group1->PushButton2, SIGNAL(clicked()), this, SLOT(ClickOnPrevious())); - connect(Group1->PushButton3, SIGNAL(clicked()), this, SLOT(ClickOnStop())); - connect(Group1->PushButton4, SIGNAL(clicked()), this, SLOT(ClickOnPlay())); - connect(Group1->PushButton5, SIGNAL(clicked()), this, SLOT(ClickOnNext())); - connect(Group1->PushButton6, SIGNAL(clicked()), this, SLOT(ClickOnLast())); - connect(Group1->PushButton7, SIGNAL(clicked()), this, SLOT(ClickOnExport())); - connect(Group1->CheckButton1, SIGNAL(clicked()), this, SLOT(ClickOnShading())); + connect(Slider1, SIGNAL(valueChanged(int)), this, SLOT(ClickOnSlider(int))); + connect(PushButton2, SIGNAL(clicked()), this, SLOT(ClickOnFirst())); + connect(PushButton3, SIGNAL(clicked()), this, SLOT(ClickOnPrevious())); + connect(PushButton4, SIGNAL(clicked()), this, SLOT(ClickOnPlay())); + connect(PushButton5, SIGNAL(clicked()), this, SLOT(ClickOnNext())); + connect(PushButton6, SIGNAL(clicked()), this, SLOT(ClickOnLast())); + connect(PushButton7, SIGNAL(clicked()), this, SLOT(ClickOnExport())); + connect(CheckButton1, SIGNAL(clicked()), this, SLOT(ClickOnShading())); - myAnimator = new MyThread(KAnimation, ic); - connect(myAnimator, SIGNAL(frameChanged()), this, SLOT(OnNext())); - connect(myAnimator, SIGNAL(stopped()), this, SLOT(ClickOnStop())); - myAnimator->InitAnim(); - myAnimator->myValue = 0; - myAnimator->NextFrame(); + connect(PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); /* Move widget on the botton right corner of main widget */ // int x, y; @@ -340,22 +232,89 @@ void KinematicGUI_AnimDlg::Init(SALOME_Selection* Sel, Handle(AIS_InteractiveCon // this->move(x, y); /* displays Dialog */ - RadioButton1->setChecked(TRUE); - Group1->show(); + this->SelectionIntoArgument(); this->show(); return; } +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void KinematicGUI_AnimDlg::SelectionIntoArgument() +{ + LineEdit1->setText(""); + QString aString = ""; + this->ClearAnim(true); + myType = 0; + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) + return; + + /* nbSel == 1 */ + Standard_Boolean testResult; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + + myGeomAnimation = myGeomBase->ConvertIOinAnimation(IO, testResult); + if(!testResult) { + myGeomContact = myGeomBase->ConvertIOinContact(IO, testResult); + if(!testResult) + return; + + myKContact = myKinematicGUI->CreateContact(myGeomContact); + + myType = 1; + myNbSeq = 50; + myDuration = 5.0; + } + else { + myKAnimation = myKinematicGUI->CreateAnimation(myGeomAnimation); + + bool IsOk = false; + for(int cpt = 1; cpt <= myKAnimation->myIndexToShape.Extent(); cpt++) { + TopoDS_Shape myShape = myKAnimation->myIndexToShape.FindKey(cpt); + if(myShape == myKAnimation->GetFrame()) + IsOk = true; + } + if(!IsOk) + return; + + myType = 2; + myNbSeq = myKAnimation->GetNbSeq(); + myDuration = myKAnimation->GetDuration(); + myKAnimation->myIsShading = CheckButton1->isChecked(); + } + + Slider1->setMaxValue(myNbSeq); + LineEdit1->setText(aString); + + this->InitAnim(); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void KinematicGUI_AnimDlg::SetEditCurrentArgument() +{ + LineEdit1->setFocus(); + SelectionIntoArgument(); + return; +} + + //================================================================================= // function : ClickOnCancel() // purpose : //================================================================================= void KinematicGUI_AnimDlg::ClickOnCancel() { - this->ClickOnStop(); - myAnimator->ClearAnim(true); + this->ClearAnim(true); disconnect(mySelection, 0, this, 0); reject(); QApplication::restoreOverrideCursor(); @@ -369,6 +328,7 @@ void KinematicGUI_AnimDlg::ClickOnCancel() //================================================================================= void KinematicGUI_AnimDlg::DeactivateActiveDialog() { + this->ClearAnim(true); this->setEnabled(false); disconnect(mySelection, 0, this, 0); myGeomGUI->SetActiveDialogBox(0); @@ -387,6 +347,7 @@ void KinematicGUI_AnimDlg::ActivateThisDialog() this->setEnabled(true); myGeomGUI->SetActiveDialogBox((QDialog*)this); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + this->SelectionIntoArgument(); return; } @@ -422,9 +383,8 @@ void KinematicGUI_AnimDlg::enterEvent(QEvent * e) //================================================================================= void KinematicGUI_AnimDlg::ClickOnSlider(int newValue) { - myAnimator->myValue = newValue; - if(!myAnimator->running()) - myAnimator->NextFrame(); + myValue = newValue; + this->NextFrame(); return; } @@ -435,14 +395,13 @@ void KinematicGUI_AnimDlg::ClickOnSlider(int newValue) //================================================================================= void KinematicGUI_AnimDlg::ClickOnFirst() { - this->ClickOnStop(); - int aVal = Group1->Slider1->value(); + int aVal = Slider1->value(); if(aVal == 0) { - myAnimator->myValue = 0; - myAnimator->NextFrame(); + myValue = 0; + this->NextFrame(); } else - Group1->Slider1->setValue(0); + Slider1->setValue(0); return; } @@ -453,21 +412,9 @@ void KinematicGUI_AnimDlg::ClickOnFirst() //================================================================================= void KinematicGUI_AnimDlg::ClickOnPrevious() { - this->ClickOnStop(); - int aVal = Group1->Slider1->value(); + int aVal = Slider1->value(); if(aVal != 0) - Group1->Slider1->setValue(aVal - 1); - return; -} - - -//================================================================================= -// function : ClickOnStop() -// purpose : -//================================================================================= -void KinematicGUI_AnimDlg::ClickOnStop() -{ - myAnimator->stopAnimation(); + Slider1->setValue(aVal - 1); return; } @@ -478,27 +425,21 @@ void KinematicGUI_AnimDlg::ClickOnStop() //================================================================================= void KinematicGUI_AnimDlg::ClickOnPlay() { - if(!myAnimator->running()) - myAnimator->startAnimation(); - return; -} + QApplication::setOverrideCursor(Qt::waitCursor); + myIsActive = true; + qApp->lock(); + while(myIsActive) { + this->ClickOnNext(); + qApp->syncX(); + qApp->unlock(); + usleep((int)(myDuration / myNbSeq * 1e6)); + qApp->lock(); -//================================================================================= -// function : OnNext() -// purpose : -//================================================================================= -void KinematicGUI_AnimDlg::OnNext() -{ - int aVal = Group1->Slider1->value(); - if(aVal != myAnimator->myKAnimation->NbSeq()) - Group1->Slider1->setValue(aVal + 1); - else { - if(Group1->CheckButton2->isChecked()) - Group1->Slider1->setValue(0); - else - this->ClickOnStop(); + if (!myIsActive) break; } + + QApplication::restoreOverrideCursor(); return; } @@ -509,8 +450,11 @@ void KinematicGUI_AnimDlg::OnNext() //================================================================================= void KinematicGUI_AnimDlg::ClickOnNext() { - this->ClickOnStop(); - this->OnNext(); + int aVal = Slider1->value(); + if(aVal != myNbSeq) + Slider1->setValue(aVal + 1); + else + myIsActive = false; return; } @@ -521,32 +465,158 @@ void KinematicGUI_AnimDlg::ClickOnNext() //================================================================================= void KinematicGUI_AnimDlg::ClickOnLast() { - this->ClickOnStop(); - int aVal = Group1->Slider1->value(); - if(aVal == myAnimator->myKAnimation->NbSeq()) { - myAnimator->myValue = myAnimator->myKAnimation->NbSeq(); - myAnimator->NextFrame(); + int aVal = Slider1->value(); + if(aVal == myNbSeq) { + myValue = myNbSeq; + this->NextFrame(); } else - Group1->Slider1->setValue(myAnimator->myKAnimation->NbSeq()); + Slider1->setValue(myNbSeq); return; } +//================================================================================= +// class : InitAnim() +// purpose : +//================================================================================= +void KinematicGUI_AnimDlg::InitAnim() +{ + if(myType == 0) + return; + + myAISFrame = new AIS_Shape(TopoDS_Shape()); + + if(myType == 1) { //Contact + myAISFrame->Set(myKContact->GetShape1()); + + myAISShape = new AIS_Shape(TopoDS_Shape()); + myAISShape->Set(myKContact->GetShape2()); + + if(CheckButton1->isChecked()) { //In Shading + myAISShape->SetColor(Quantity_NOC_GOLDENROD); + myIC->Display(myAISShape, 1, 1, Standard_False); + } + else { + myAISShape->SetColor(Quantity_NOC_GREEN); + myIC->Display(myAISShape, 0, 1, Standard_False); + } + } + else if(myType == 2) { //Assembly + myKAnimation->myMovedShape.Clear(); + myKAnimation->myMovedShape.Add(myKAnimation->GetFrame()); + + gp_Trsf aLoc; + myLoc = aLoc; + if(!myKAnimation->IsCreated) + myKAnimation->GetNextShape(myIC, myLoc, myKAnimation->GetFrame(), 1); + myKAnimation->IsCreated = true; + + myAISFrame->Set(myKAnimation->GetFrame()); + } + + if(CheckButton1->isChecked()) { //In Shading + myAISFrame->SetColor(Quantity_NOC_GOLDENROD); + myIC->Display(myAISFrame, 1, 1, Standard_False); + } + else { + myAISFrame->SetColor(Quantity_NOC_RED); + myIC->Display(myAISFrame, 0, 1, Standard_False); + } + + this->ClickOnFirst(); + this->NextFrame(); + return; +} + + +//================================================================================= +// class : ClearAnim() +// purpose : +//================================================================================= +void KinematicGUI_AnimDlg::ClearAnim(int ClearPrs) +{ + myIC->Erase(myAISFrame, Standard_False, Standard_False); + if(ClearPrs) + myIC->ClearPrs(myAISFrame); + + if(myType == 1) { //Contact + myIC->Erase(myAISShape, Standard_False, Standard_False); + if(ClearPrs) + myIC->ClearPrs(myAISShape); + } + if(myType == 2) { //Assembly + if(!myKAnimation->myListOfAIS.IsEmpty()) { + for(int i = 1; i <= myKAnimation->myNbAIS; i++) { + Handle(AIS_Shape) myShape = Handle(AIS_Shape)::DownCast(myKAnimation->myListOfAIS.Value(i)); + myIC->Erase(myShape, Standard_False, Standard_False); + if(ClearPrs) + myIC->ClearPrs(myShape); + } + } + } + myIC->UpdateCurrentViewer(); + return; +} + + +//================================================================================= +// class : NextFrame() +// purpose : +//================================================================================= +void KinematicGUI_AnimDlg::NextFrame() { + double Step, Val; + Step = 1.0 / myNbSeq; + Val = myValue * Step; + + if(myType == 1) { //Contact + gp_Trsf aTrans = myKContact->GetTransformation(Val); + Handle(Geom_Transformation) aGTrans = new Geom_Transformation(); + aGTrans->SetTrsf(aTrans); + myAISShape->SetTransformation(aGTrans, false, false); + + if(CheckButton1->isChecked()) { //In Shading + myAISShape->SetColor(Quantity_NOC_GOLDENROD); + myIC->SetDisplayMode(myAISShape, 1, Standard_False); + } + else { + myAISShape->SetColor(Quantity_NOC_GREEN); + myIC->SetDisplayMode(myAISShape, 0, Standard_False); + } + myIC->Display(myAISShape, Standard_True); + } + else if(myType == 2) { //Assembly + myKAnimation->myMovedShape.Clear(); + myKAnimation->myMovedShape.Add(myKAnimation->GetFrame()); + + myKAnimation->myNbAIS = 0; + myKAnimation->GetNextShape(myIC, myLoc, myKAnimation->GetFrame(), Val); + + myIC->UpdateCurrentViewer(); + } + return; +} + + //================================================================================= // function : ClickOnShading() // purpose : //================================================================================= void KinematicGUI_AnimDlg::ClickOnShading() { + if(myType == 0) + return; + QApplication::setOverrideCursor(Qt::waitCursor); - this->ClickOnStop(); - myAnimator->ClearAnim(false); - myAnimator->myKAnimation->myIsShading = Group1->CheckButton1->isChecked(); - myAnimator->InitAnim(); - this->ClickOnFirst(); + this->ClearAnim(false); + + if(myType == 2) + myKAnimation->myIsShading = CheckButton1->isChecked(); + + this->InitAnim(); QApplication::restoreOverrideCursor(); + return; } @@ -557,6 +627,9 @@ void KinematicGUI_AnimDlg::ClickOnShading() //================================================================================= void KinematicGUI_AnimDlg::ClickOnExport() { + if(myType == 0) + return; + this->ClickOnFirst(); QString fName = QAD_FileDlg::getFileName(QAD_Application::getDesktop(), QString::null, tr("OCC_IMAGE_FILES"), tr("INF_APP_DUMP_VIEW"), false); @@ -568,7 +641,7 @@ void KinematicGUI_AnimDlg::ClickOnExport() QApplication::setOverrideCursor(Qt::waitCursor); qApp->processEvents(); - for(int i = 0; i <= myAnimator->myKAnimation->NbSeq(); i++) { + for(int i = 0; i <= myNbSeq; i++) { qApp->processEvents(); QWidget* qw = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewWidget(); QPixmap px = QPixmap::grabWindow(qw->winId()); @@ -588,7 +661,7 @@ void KinematicGUI_AnimDlg::ClickOnExport() bool bOk = px.save(fileName, fmt.latin1()); - this->OnNext(); + this->ClickOnNext(); } QApplication::restoreOverrideCursor(); diff --git a/src/KinematicGUI/KinematicGUI_AnimDlg.h b/src/KinematicGUI/KinematicGUI_AnimDlg.h index 2634513fe..e1f6839bc 100644 --- a/src/KinematicGUI/KinematicGUI_AnimDlg.h +++ b/src/KinematicGUI/KinematicGUI_AnimDlg.h @@ -30,50 +30,15 @@ #define KINEMATICGUI_ANIMDLG_H #include "KinematicGUI_Skeleton_QTD.h" -#include "KinematicGUI_Anim_QTD.h" #include "KinematicGUI.h" -#include +#include #include -#include #include #include +#include #include -#include -#include - -class MyThread : public QObject, public QThread -{ - Q_OBJECT - -public: - MyThread(Kinematic_Animation* KAnimation = 0, Handle(AIS_InteractiveContext) ic = 0); - ~MyThread(); - -private: - bool myIsActive; - Handle(AIS_Shape) myAISFrame; - Handle(AIS_InteractiveContext) myIC; /* Interactive context */ - gp_Trsf myLoc; - -public: - Kinematic_Animation* myKAnimation; - - int myValue; - virtual void run(); - void startAnimation(); - void stopAnimation(); - void InitAnim(); - void ClearAnim(int ClearPrs); - void NextFrame(); - -signals: - void frameChanged(); - void stopped(); - -}; - class KinematicGUI_AnimDlg : public KinematicGUI_Skeleton_QTD { @@ -84,36 +49,68 @@ public: ~KinematicGUI_AnimDlg(); private : - void Init(SALOME_Selection* Sel, Handle(AIS_InteractiveContext) ic); + void Init(); void enterEvent(QEvent * e); void closeEvent(QCloseEvent* e); KinematicGUI* myKinematicGUI; - MyThread* myAnimator; - SALOME_Selection* mySelection; /* User shape selection */ - GEOM::GEOM_Gen_var myGeom; /* Current GeomI object */ GEOMBase* myGeomBase; GEOMContext* myGeomGUI; /* Current GeomGUI object */ - KinematicGUI_Anim_QTD* Group1; + GEOM::GEOM_Animation_var myGeomAnimation; + GEOM::GEOM_Contact_var myGeomContact; + Handle(AIS_InteractiveContext) myIC; /* Interactive context */ + Handle(AIS_Shape) myAISFrame; + Handle(AIS_Shape) myAISShape; + + Kinematic_Animation* myKAnimation; + Kinematic_Contact* myKContact; + int myType, myValue, myNbSeq; + double myDuration; + gp_Trsf myLoc; + bool myIsActive; + void NextFrame(); + void InitAnim(); + void ClearAnim(int ClearPrs); + + QGroupBox* GroupBox1; + QPushButton* PushButton8; + QRadioButton* CheckButton1; + QSlider* Slider1; + QLabel* TextLabel1; + QPushButton* PushButton1; + QLineEdit* LineEdit1; + QPushButton* PushButton4; + QPushButton* PushButton6; + QPushButton* PushButton3; + QPushButton* PushButton5; + QPushButton* PushButton7; + QPushButton* PushButton2; private slots: void ClickOnCancel(); + void SetEditCurrentArgument(); + void SelectionIntoArgument(); void DeactivateActiveDialog(); void ActivateThisDialog(); void ClickOnSlider(int newValue); void ClickOnFirst(); void ClickOnPrevious(); - void ClickOnStop(); void ClickOnPlay(); - void OnNext(); void ClickOnNext(); void ClickOnLast(); void ClickOnShading(); void ClickOnExport(); +protected: + QGridLayout* GroupBox1Layout; + QGridLayout* LayoutA; + QGridLayout* LayoutB; + QGridLayout* LayoutC; + QGridLayout* LayoutD; + }; #endif // KINEMATICGUI_ANIMDLG_H diff --git a/src/KinematicGUI/KinematicGUI_AnimValuesDlg.cxx b/src/KinematicGUI/KinematicGUI_AnimValuesDlg.cxx new file mode 100644 index 000000000..4e7f1cc90 --- /dev/null +++ b/src/KinematicGUI/KinematicGUI_AnimValuesDlg.cxx @@ -0,0 +1,557 @@ +// 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 : KinematicGUI_AnimValuesDlg.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "KinematicGUI_AnimValuesDlg.h" + +using namespace std; + +//================================================================================= +// class : KinematicGUI_AnimValuesDlg() +// purpose : Constructs a KinematicGUI_AnimValuesDlg 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. +//================================================================================= +KinematicGUI_AnimValuesDlg::KinematicGUI_AnimValuesDlg(QWidget* parent, const char* name, KinematicGUI* theKinematicGUI, SALOME_Selection* Sel, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_ANIMATION"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_ANIMVALUES_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_ANIMVALUES")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupBox1 = new QGroupBox( this, "GroupBox1" ); + GroupBox1->setColumnLayout(0, Qt::Vertical ); + GroupBox1->layout()->setSpacing( 6 ); + GroupBox1->layout()->setMargin( 11 ); + GroupBox1Layout = new QGridLayout( GroupBox1->layout() ); + GroupBox1Layout->setAlignment( Qt::AlignTop ); + + LayoutD = new QGridLayout( 0, 1, 1, 0, 6, "LayoutD"); + QSpacerItem* spacer = new QSpacerItem( 0, 50, QSizePolicy::Minimum, QSizePolicy::Expanding ); + LayoutD->addItem( spacer, 2, 1 ); + + LayoutC = new QGridLayout( 0, 1, 1, 0, 6, "LayoutC"); + + TextLabel8 = new QLabel( GroupBox1, "TextLabel8" ); + TextLabel8->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel8->sizePolicy().hasHeightForWidth() ) ); + LayoutC->addWidget( TextLabel8, 5, 0 ); + + TextLabel9 = new QLabel( GroupBox1, "TextLabel9" ); + TextLabel9->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel9->sizePolicy().hasHeightForWidth() ) ); + LayoutC->addWidget( TextLabel9, 6, 0 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + LayoutC->addWidget( TextLabel4, 1, 0 ); + + TextLabel5 = new QLabel( GroupBox1, "TextLabel5" ); + TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) ); + LayoutC->addWidget( TextLabel5, 2, 0 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setAlignment( int( QLabel::AlignCenter ) ); + LayoutC->addWidget( TextLabel3, 0, 2 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setAlignment( int( QLabel::AlignCenter ) ); + LayoutC->addWidget( TextLabel2, 0, 1 ); + + TextLabel6 = new QLabel( GroupBox1, "TextLabel6" ); + TextLabel6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel6->sizePolicy().hasHeightForWidth() ) ); + LayoutC->addWidget( TextLabel6, 3, 0 ); + + TextLabel10 = new QLabel( GroupBox1, "TextLabel10" ); + TextLabel10->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel10->sizePolicy().hasHeightForWidth() ) ); + QFont TextLabel10_font( TextLabel10->font() ); + TextLabel10_font.setBold( TRUE ); + TextLabel10->setFont( TextLabel10_font ); + LayoutC->addWidget( TextLabel10, 0, 0 ); + + TextLabel7 = new QLabel( GroupBox1, "TextLabel7" ); + TextLabel7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel7->sizePolicy().hasHeightForWidth() ) ); + LayoutC->addWidget( TextLabel7, 4, 0 ); + + SpinBox1 = new DlgRef_SpinBox(GroupBox1, "SpinBox1"); + LayoutC->addWidget( SpinBox1, 1, 1 ); + + SpinBox2 = new DlgRef_SpinBox(GroupBox1, "SpinBox2"); + LayoutC->addWidget( SpinBox2, 1, 2 ); + + SpinBox3 = new DlgRef_SpinBox(GroupBox1, "SpinBox3"); + LayoutC->addWidget( SpinBox3, 2, 1 ); + + SpinBox4 = new DlgRef_SpinBox(GroupBox1, "SpinBox4"); + LayoutC->addWidget( SpinBox4, 2, 2 ); + + SpinBox5 = new DlgRef_SpinBox(GroupBox1, "SpinBox5"); + LayoutC->addWidget( SpinBox5, 3, 1 ); + + SpinBox6 = new DlgRef_SpinBox(GroupBox1, "SpinBox6"); + LayoutC->addWidget( SpinBox6, 3, 2 ); + + SpinBox7 = new DlgRef_SpinBox(GroupBox1, "SpinBox7"); + LayoutC->addWidget( SpinBox7, 4, 1 ); + + SpinBox8 = new DlgRef_SpinBox(GroupBox1, "SpinBox8"); + LayoutC->addWidget( SpinBox8, 4, 2 ); + + SpinBox9 = new DlgRef_SpinBox(GroupBox1, "SpinBox9"); + LayoutC->addWidget( SpinBox9, 5, 1 ); + + SpinBox10 = new DlgRef_SpinBox(GroupBox1, "SpinBox10"); + LayoutC->addWidget( SpinBox10, 5, 2 ); + + SpinBox11 = new DlgRef_SpinBox(GroupBox1, "SpinBox11"); + LayoutC->addWidget( SpinBox11, 6, 1 ); + + SpinBox12 = new DlgRef_SpinBox(GroupBox1, "SpinBox12"); + LayoutC->addWidget( SpinBox12, 6, 2 ); + + LayoutD->addLayout( LayoutC, 1, 1 ); + + ListBox1 = new QListBox( GroupBox1, "ListBox1" ); + ListBox1->insertItem( trUtf8( "New Item" ) ); + ListBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)7, 0, 0, ListBox1->sizePolicy().hasHeightForWidth() ) ); + LayoutD->addMultiCellWidget( ListBox1, 1, 2, 0, 0 ); + + LayoutB = new QGridLayout( 0, 1, 1, 0, 6, "LayoutB"); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + LayoutB->addWidget( LineEdit1, 0, 2 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + LayoutB->addWidget( PushButton1, 0, 1 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + LayoutB->addWidget( TextLabel1, 0, 0 ); + + LayoutD->addMultiCellLayout( LayoutB, 0, 0, 0, 1 ); + + GroupBox1Layout->addLayout( LayoutD, 0, 0 ); + + GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + TextLabel1->setText(tr("GEOM_ANIMATION")); + TextLabel2->setText(tr("GEOM_BEGIN")); + TextLabel3->setText(tr("GEOM_END")); + TextLabel4->setText(tr("GEOM_RX")); + TextLabel5->setText(tr("GEOM_RY")); + TextLabel6->setText(tr("GEOM_RZ")); + TextLabel7->setText(tr("GEOM_TX")); + TextLabel8->setText(tr("GEOM_TY")); + TextLabel9->setText(tr("GEOM_TZ")); + PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupBox1, 1, 0); + /***************************************************************/ + + /* Initialisation */ + resize(0, 250); + myKinematicGUI = theKinematicGUI; + Init(); +} + + +//================================================================================= +// function : ~KinematicGUI_AnimValuesDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +KinematicGUI_AnimValuesDlg::~KinematicGUI_AnimValuesDlg() +{ + /* no need to delete child widgets, Qt does it all for us */ +} + + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void KinematicGUI_AnimValuesDlg::Init() +{ + /* init variables */ + myEditCurrentArgument = LineEdit1; + myOkAnimation = false; + + /* min, max, step and decimals for spin boxes & initial values */ + SpinBox1->RangeStepAndValidator(-99999.999, 99999.999, 5.0, 3); + SpinBox2->RangeStepAndValidator(-99999.999, 99999.999, 5.0, 3); + SpinBox3->RangeStepAndValidator(-99999.999, 99999.999, 5.0, 3); + SpinBox4->RangeStepAndValidator(-99999.999, 99999.999, 5.0, 3); + SpinBox5->RangeStepAndValidator(-99999.999, 99999.999, 5.0, 3); + SpinBox6->RangeStepAndValidator(-99999.999, 99999.999, 5.0, 3); + SpinBox7->RangeStepAndValidator(-99999.999, 99999.999, 100.0, 3); + SpinBox8->RangeStepAndValidator(-99999.999, 99999.999, 100.0, 3); + SpinBox9->RangeStepAndValidator(-99999.999, 99999.999, 100.0, 3); + SpinBox10->RangeStepAndValidator(-99999.999, 99999.999, 100.0, 3); + SpinBox11->RangeStepAndValidator(-99999.999, 99999.999, 100.0, 3); + SpinBox12->RangeStepAndValidator(-99999.999, 99999.999, 100.0, 3); + + SpinBox1->SetValue(0.0); + SpinBox2->SetValue(0.0); + SpinBox3->SetValue(0.0); + SpinBox4->SetValue(0.0); + SpinBox5->SetValue(0.0); + SpinBox6->SetValue(0.0); + SpinBox7->SetValue(0.0); + SpinBox8->SetValue(0.0); + SpinBox9->SetValue(0.0); + SpinBox10->SetValue(0.0); + SpinBox11->SetValue(0.0); + SpinBox12->SetValue(0.0); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + + connect(PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(ListBox1, SIGNAL(highlighted(int)), this, SLOT(ClickOnListBox(int))); + + connect(SpinBox1, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(SpinBox2, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(SpinBox3, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(SpinBox4, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(SpinBox5, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(SpinBox6, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(SpinBox7, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(SpinBox8, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(SpinBox9, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(SpinBox10, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(SpinBox11, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(SpinBox12, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), SpinBox1, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), SpinBox2, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), SpinBox3, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), SpinBox4, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), SpinBox5, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), SpinBox6, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), SpinBox7, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), SpinBox8, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), SpinBox9, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), SpinBox10, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), SpinBox11, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), SpinBox12, SLOT(SetStep(double))); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + this->SelectionIntoArgument(); + this->show(); + + return; +} + + +//================================================================================= +// function : SetEnabledValues() +// purpose : +//================================================================================= +void KinematicGUI_AnimValuesDlg::SetEnabledValues() +{ + cout<<"KinematicGUI_AnimValuesDlg::SetEnabledValues"<GetType(); + + TCollection_AsciiString aTypeName = myKinematicGUI->GetNameFromType(type); + TextLabel10->setText(aTypeName.ToCString()); + + cout<<"KinematicGUI_AnimValuesDlg::SetEnabledValues : 1"<SetValue(myList[0]); + SpinBox2->SetValue(myList[1]); + SpinBox3->SetValue(myList[2]); + SpinBox4->SetValue(myList[3]); + SpinBox5->SetValue(myList[4]); + SpinBox6->SetValue(myList[5]); + SpinBox7->SetValue(myList[6]); + SpinBox8->SetValue(myList[7]); + SpinBox9->SetValue(myList[8]); + SpinBox10->SetValue(myList[9]); + SpinBox11->SetValue(myList[10]); + SpinBox12->SetValue(myList[11]); + cout<<"KinematicGUI_AnimValuesDlg::SetEnabledValues : 2"<show(); + SpinBox2->show(); + TextLabel4->show(); + + SpinBox3->show(); + SpinBox4->show(); + TextLabel5->show(); + + SpinBox5->show(); + SpinBox6->show(); + TextLabel6->show(); + + SpinBox7->show(); + SpinBox8->show(); + TextLabel7->show(); + + SpinBox9->show(); + SpinBox10->show(); + TextLabel8->show(); + + SpinBox11->show(); + SpinBox12->show(); + TextLabel9->show(); + + if(type == 0 || type == 2 || type == 5) { // RX + SpinBox1->hide(); + SpinBox2->hide(); + TextLabel4->hide(); + } + if(type == 0 || type == 1 || type == 2 || type == 3 || type == 5 || type == 7 || type == 9) { // RY + SpinBox3->hide(); + SpinBox4->hide(); + TextLabel5->hide(); + } + if(type == 0 || type == 1 || type == 2 || type == 3 || type == 9) { // RZ + SpinBox5->hide(); + SpinBox6->hide(); + TextLabel6->hide(); + } + if(type == 0 || type == 1 || type == 4 || type == 8) { // TX + SpinBox7->hide(); + SpinBox8->hide(); + TextLabel7->hide(); + } + if(type == 0 || type == 1 || type == 2 || type == 3 || type == 4 || type == 6 || type == 9) { // TY + SpinBox9->hide(); + SpinBox10->hide(); + TextLabel8->hide(); + } + if(type == 0 || type == 1 || type == 2 || type == 3 || type == 4 || type == 5 || type == 6 || type == 7 || type == 9) { // TZ + SpinBox11->hide(); + SpinBox12->hide(); + TextLabel9->hide(); + } + + return; +} + + +//================================================================================= +// function : ClickOnListBox() +// purpose : +//================================================================================= +void KinematicGUI_AnimValuesDlg::ClickOnListBox(int Item) +{ + cout<<"KinematicGUI_AnimValuesDlg::ClickOnListBox"<GetAssembly()->GetContactList(); + myGeomContact = aContactList[Item]; + myOkContact = true; + myList = myGeomAnimation->GetDisplacement(myGeomContact); + this->SetEnabledValues(); + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void KinematicGUI_AnimValuesDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void KinematicGUI_AnimValuesDlg::ClickOnApply() +{ + buttonApply->setFocus(); + QAD_Application::getDesktop()->putInfo(tr("")); + + if(myOkAnimation && myOkContact) + myKinematicGUI->SetDisplacement(myGeomAnimation, myGeomContact, myList); + + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void KinematicGUI_AnimValuesDlg::SelectionIntoArgument() +{ + cout<<"KinematicGUI_AnimValuesDlg::SelectionIntoArgument"<setText(""); + QString aString = ""; + myOkAnimation = false; + myOkContact = false; + ListBox1->clear(); + TextLabel10->setText(""); + + SpinBox1->SetValue(0.0); + SpinBox2->SetValue(0.0); + SpinBox3->SetValue(0.0); + SpinBox4->SetValue(0.0); + SpinBox5->SetValue(0.0); + SpinBox6->SetValue(0.0); + SpinBox7->SetValue(0.0); + SpinBox8->SetValue(0.0); + SpinBox9->SetValue(0.0); + SpinBox10->SetValue(0.0); + SpinBox11->SetValue(0.0); + SpinBox12->SetValue(0.0); + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) + return; + + /* nbSel == 1 */ + Standard_Boolean testResult; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + + if(myEditCurrentArgument == LineEdit1) { + myGeomAnimation = myGeomBase->ConvertIOinAnimation(IO, testResult); + if(!testResult) + return; + LineEdit1->setText(aString); + myOkAnimation = true; + + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + GEOM::ListOfContact_var aContactList = myGeomAnimation->GetAssembly()->GetContactList(); + for(int i = 0; i < myGeomAnimation->GetAssembly()->NbContacts(); i++) { + GEOM::GEOM_Contact_var aContact = aContactList[i]; + SALOMEDS::SObject_var SO = aStudy->FindObjectIOR(aContact->Name()); + ListBox1->insertItem(SO->GetName()); + } + ListBox1->setSelected(0, true); + } + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void KinematicGUI_AnimValuesDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == PushButton1) { + LineEdit1->setFocus(); + myEditCurrentArgument = LineEdit1; + } + SelectionIntoArgument(); + + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void KinematicGUI_AnimValuesDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + this->SelectionIntoArgument(); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : when mouse enter onto the QWidget +//================================================================================= +void KinematicGUI_AnimValuesDlg::enterEvent(QEvent * e) +{ + if (GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void KinematicGUI_AnimValuesDlg::ValueChangedInSpinBox(double newValue) +{ + DlgRef_SpinBox* send = (DlgRef_SpinBox*)sender(); + + if(myOkContact == false) + return; + + int type = myGeomContact->GetType(); + double step = myGeomContact->GetStep(); + GEOM::ListOfDouble_var aAngList = myGeomContact->GetAngularRange(); + GEOM::ListOfDouble_var aLinList = myGeomContact->GetLinearRange(); + + int i, j; + if(send == SpinBox1) {i = 0; j = 0;} + else if(send == SpinBox2) {i = 0; j = 1;} + else if(send == SpinBox3) {i = 1; j = 0;} + else if(send == SpinBox4) {i = 1; j = 1;} + else if(send == SpinBox5) {i = 2; j = 0;} + else if(send == SpinBox6) {i = 2; j = 1;} + else if(send == SpinBox7) {i = 3; j = 0;} + else if(send == SpinBox8) {i = 3; j = 1;} + else if(send == SpinBox9) {i = 4; j = 0;} + else if(send == SpinBox10) {i = 4; j = 1;} + else if(send == SpinBox11) {i = 5; j = 0;} + else if(send == SpinBox12) {i = 5; j = 1;} + + if(newValue >= aAngList[2*i] && newValue <= aAngList[2*i+1]) { + myList[2*i+j] = newValue; + if(type == 9) { + if(i == 0 && j == 0) + SpinBox7->SetValue(newValue * step / 360); + else if(i == 0 && j == 1) + SpinBox8->SetValue(newValue * step / 360); + else if(i == 3 && j == 0) + SpinBox1->SetValue(newValue / step * 360); + else if(i == 3 && j == 1) + SpinBox2->SetValue(newValue / step * 360); + } + } + else + send->SetValue(myList[2*i+j]); + + return; +} diff --git a/src/KinematicGUI/KinematicGUI_AnimValuesDlg.h b/src/KinematicGUI/KinematicGUI_AnimValuesDlg.h new file mode 100644 index 000000000..706133edc --- /dev/null +++ b/src/KinematicGUI/KinematicGUI_AnimValuesDlg.h @@ -0,0 +1,108 @@ +// 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 : KinematicGUI_AnimValuesDlg.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef DIALOGBOX_ANIMVALUES_H +#define DIALOGBOX_ANIMVALUES_H + +#include "GEOMBase_Skeleton.h" +#include "DlgRef_SpinBox.h" + +#include "KinematicGUI.h" + +#include + +//================================================================================= +// class : KinematicGUI_AnimValuesDlg +// purpose : +//================================================================================= +class KinematicGUI_AnimValuesDlg : public GEOMBase_Skeleton +{ + Q_OBJECT + +public: + KinematicGUI_AnimValuesDlg(QWidget* parent = 0, const char* name = 0, KinematicGUI* theKinematicGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~KinematicGUI_AnimValuesDlg(); + +private: + void Init(); + void enterEvent(QEvent * e); + + KinematicGUI* myKinematicGUI; + + GEOM::GEOM_Animation_var myGeomAnimation; + GEOM::GEOM_Contact_var myGeomContact; + GEOM::ListOfDouble_var myList; + bool myOkAnimation; + bool myOkContact; + + QGroupBox* GroupBox1; + QLabel* TextLabel1; + QLabel* TextLabel2; + QLabel* TextLabel3; + QLabel* TextLabel4; + QLabel* TextLabel5; + QLabel* TextLabel6; + QLabel* TextLabel7; + QLabel* TextLabel8; + QLabel* TextLabel9; + QLabel* TextLabel10; + QListBox* ListBox1; + QLineEdit* LineEdit1; + QPushButton* PushButton1; + DlgRef_SpinBox* SpinBox1; + DlgRef_SpinBox* SpinBox2; + DlgRef_SpinBox* SpinBox3; + DlgRef_SpinBox* SpinBox4; + DlgRef_SpinBox* SpinBox5; + DlgRef_SpinBox* SpinBox6; + DlgRef_SpinBox* SpinBox7; + DlgRef_SpinBox* SpinBox8; + DlgRef_SpinBox* SpinBox9; + DlgRef_SpinBox* SpinBox10; + DlgRef_SpinBox* SpinBox11; + DlgRef_SpinBox* SpinBox12; + +private slots: + void ClickOnOk(); + void ClickOnApply(); + void SetEditCurrentArgument(); + void SelectionIntoArgument(); + void ActivateThisDialog(); + void SetEnabledValues(); + void ValueChangedInSpinBox(double newValue); + void ClickOnListBox(int Item); + +protected: + QGridLayout* GroupBox1Layout; + QGridLayout* LayoutD; + QGridLayout* LayoutC; + QGridLayout* LayoutB; + +}; + +#endif // DIALOGBOX_CONTACT_H diff --git a/src/KinematicGUI/KinematicGUI_Anim_QTD.cxx b/src/KinematicGUI/KinematicGUI_Anim_QTD.cxx deleted file mode 100644 index 55841517f..000000000 --- a/src/KinematicGUI/KinematicGUI_Anim_QTD.cxx +++ /dev/null @@ -1,122 +0,0 @@ -/**************************************************************************** -** Form implementation generated from reading ui file 'KinematicGUI_Anim_QTD.ui' -** -** Created: jeu mar 4 16:48:10 2004 -** by: The User Interface Compiler (uic) -** -** WARNING! All changes made in this file will be lost! -****************************************************************************/ -#include "KinematicGUI_Anim_QTD.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * Constructs a KinematicGUI_Anim_QTD which is a child of 'parent', with the - * name 'name' and widget flags set to 'f'. - */ -KinematicGUI_Anim_QTD::KinematicGUI_Anim_QTD( QWidget* parent, const char* name, WFlags fl ) - : QWidget( parent, name, fl ) -{ - if ( !name ) - setName( "KinematicGUI_Anim_QTD" ); - resize( 334, 121 ); - setCaption( trUtf8( "KinematicGUI_Anim_QTD" ) ); - KinematicGUI_Anim_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "KinematicGUI_Anim_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"); - QSpacerItem* spacer = new QSpacerItem( 0, 156, QSizePolicy::Minimum, QSizePolicy::Expanding ); - Layout1->addItem( spacer, 3, 0 ); - - Layout2 = new QGridLayout( 0, 1, 1, 0, 6, "Layout2"); - - PushButton3 = new QPushButton( GroupBox1, "PushButton3" ); - PushButton3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton3->sizePolicy().hasHeightForWidth() ) ); - PushButton3->setText( trUtf8( "" ) ); - - Layout2->addWidget( PushButton3, 0, 2 ); - - PushButton5 = new QPushButton( GroupBox1, "PushButton5" ); - PushButton5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton5->sizePolicy().hasHeightForWidth() ) ); - PushButton5->setText( trUtf8( "" ) ); - - Layout2->addWidget( PushButton5, 0, 4 ); - - PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); - PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); - PushButton2->setText( trUtf8( "" ) ); - - Layout2->addWidget( PushButton2, 0, 1 ); - - PushButton4 = new QPushButton( GroupBox1, "PushButton4" ); - PushButton4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton4->sizePolicy().hasHeightForWidth() ) ); - PushButton4->setText( trUtf8( "" ) ); - - Layout2->addWidget( PushButton4, 0, 3 ); - - PushButton6 = new QPushButton( GroupBox1, "PushButton6" ); - PushButton6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton6->sizePolicy().hasHeightForWidth() ) ); - PushButton6->setText( trUtf8( "" ) ); - - Layout2->addWidget( PushButton6, 0, 5 ); - - PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); - PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); - PushButton1->setText( trUtf8( "" ) ); - - Layout2->addWidget( PushButton1, 0, 0 ); - - Layout1->addLayout( Layout2, 1, 0 ); - - Slider1 = new QSlider( GroupBox1, "Slider1" ); - Slider1->setOrientation( QSlider::Horizontal ); - - Layout1->addWidget( Slider1, 0, 0 ); - - Layout3 = new QGridLayout( 0, 1, 1, 0, 6, "Layout3"); - - CheckButton1 = new QRadioButton( GroupBox1, "CheckButton1" ); - CheckButton1->setText( trUtf8( "" ) ); - - Layout3->addWidget( CheckButton1, 0, 0 ); - - PushButton7 = new QPushButton( GroupBox1, "PushButton7" ); - PushButton7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton7->sizePolicy().hasHeightForWidth() ) ); - PushButton7->setText( trUtf8( "" ) ); - - Layout3->addWidget( PushButton7, 0, 2 ); - - CheckButton2 = new QRadioButton( GroupBox1, "CheckButton2" ); - CheckButton2->setText( trUtf8( "" ) ); - - Layout3->addWidget( CheckButton2, 0, 1 ); - - Layout1->addLayout( Layout3, 2, 0 ); - - GroupBox1Layout->addLayout( Layout1, 0, 0 ); - - KinematicGUI_Anim_QTDLayout->addWidget( GroupBox1, 0, 0 ); -} - -/* - * Destroys the object and frees any allocated resources - */ -KinematicGUI_Anim_QTD::~KinematicGUI_Anim_QTD() -{ - // no need to delete child widgets, Qt does it all for us -} - diff --git a/src/KinematicGUI/KinematicGUI_Anim_QTD.h b/src/KinematicGUI/KinematicGUI_Anim_QTD.h deleted file mode 100644 index 2630f6c32..000000000 --- a/src/KinematicGUI/KinematicGUI_Anim_QTD.h +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************** -** Form interface generated from reading ui file 'KinematicGUI_Anim_QTD.ui' -** -** Created: jeu mar 4 16:48:10 2004 -** by: The User Interface Compiler (uic) -** -** WARNING! All changes made in this file will be lost! -****************************************************************************/ -#ifndef KINEMATICGUI_ANIM_QTD_H -#define KINEMATICGUI_ANIM_QTD_H - -#include -#include -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QGroupBox; -class QPushButton; -class QRadioButton; -class QSlider; - -class KinematicGUI_Anim_QTD : public QWidget -{ - Q_OBJECT - -public: - KinematicGUI_Anim_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); - ~KinematicGUI_Anim_QTD(); - - QGroupBox* GroupBox1; - QPushButton* PushButton3; - QPushButton* PushButton5; - QPushButton* PushButton2; - QPushButton* PushButton4; - QPushButton* PushButton6; - QPushButton* PushButton1; - QSlider* Slider1; - QRadioButton* CheckButton1; - QPushButton* PushButton7; - QRadioButton* CheckButton2; - - -protected: - QGridLayout* KinematicGUI_Anim_QTDLayout; - QGridLayout* GroupBox1Layout; - QGridLayout* Layout1; - QGridLayout* Layout2; - QGridLayout* Layout3; -}; - -#endif // KINEMATICGUI_ANIM_QTD_H diff --git a/src/KinematicGUI/KinematicGUI_AnimationDlg.cxx b/src/KinematicGUI/KinematicGUI_AnimationDlg.cxx index a852339e7..f2204ba11 100644 --- a/src/KinematicGUI/KinematicGUI_AnimationDlg.cxx +++ b/src/KinematicGUI/KinematicGUI_AnimationDlg.cxx @@ -26,9 +26,10 @@ // Module : GEOM // $Header: -using namespace std; #include "KinematicGUI_AnimationDlg.h" +using namespace std; + //================================================================================= // class : KinematicGUI_AnimationDlg() // purpose : Constructs a KinematicGUI_AnimationDlg which is a child of 'parent', with the @@ -141,6 +142,7 @@ void KinematicGUI_AnimationDlg::ClickOnOk() //================================================================================= void KinematicGUI_AnimationDlg::ClickOnApply() { + buttonApply->setFocus(); QAD_Application::getDesktop()->putInfo(tr("")); if(myOkAssembly && myOkShape1) @@ -274,7 +276,7 @@ void KinematicGUI_AnimationDlg::ValueChangedInSpinBox(double newValue) if(send == Group1->SpinBox_DX) myDuration = newValue; else if(send == Group1->SpinBox_DY) - myNbSeq = newValue; + myNbSeq = int(newValue); return; } diff --git a/src/KinematicGUI/KinematicGUI_AnimationDlg.h b/src/KinematicGUI/KinematicGUI_AnimationDlg.h index a8b058e39..073e710c1 100644 --- a/src/KinematicGUI/KinematicGUI_AnimationDlg.h +++ b/src/KinematicGUI/KinematicGUI_AnimationDlg.h @@ -57,7 +57,7 @@ private: bool myOkAssembly; bool myOkShape1; /* to check when arguments are defined */ double myDuration; - int myNbSeq; + int myNbSeq; DlgRef_2Sel2Spin* Group1; diff --git a/src/KinematicGUI/KinematicGUI_ContactDlg.cxx b/src/KinematicGUI/KinematicGUI_ContactDlg.cxx index cd0ab2fb4..eeb8fa4ed 100644 --- a/src/KinematicGUI/KinematicGUI_ContactDlg.cxx +++ b/src/KinematicGUI/KinematicGUI_ContactDlg.cxx @@ -26,9 +26,10 @@ // Module : GEOM // $Header: -using namespace std; #include "KinematicGUI_ContactDlg.h" +using namespace std; + //================================================================================= // class : KinematicGUI_ContactDlg() // purpose : Constructs a KinematicGUI_ContactDlg which is a child of 'parent', with the @@ -36,7 +37,7 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -KinematicGUI_ContactDlg::KinematicGUI_ContactDlg(QWidget* parent, const char* name, KinematicGUI* theKinematicGUI, SALOME_Selection* Sel, int type, bool modal, WFlags fl) +KinematicGUI_ContactDlg::KinematicGUI_ContactDlg(QWidget* parent, const char* name, KinematicGUI* theKinematicGUI, SALOME_Selection* Sel, bool modal, WFlags fl) :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) { QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_CONTACT"))); @@ -50,22 +51,111 @@ KinematicGUI_ContactDlg::KinematicGUI_ContactDlg(QWidget* parent, const char* na RadioButton2->close(TRUE); RadioButton3->close(TRUE); - Group1 = new KinematicGUI_3Sel1List_QTD(this, "Group1"); - Group1->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); - Group1->TextLabel1->setText(tr("GEOM_ASSEMBLY")); - Group1->TextLabel2->setText(tr("GEOM_TYPE")); - Group1->TextLabel3->setText(tr("GEOM_OBJECT_I").arg("1")); - Group1->TextLabel4->setText(tr("GEOM_OBJECT_I").arg("2")); - Group1->PushButton1->setPixmap(image1); - Group1->PushButton2->setPixmap(image1); - Group1->PushButton3->setPixmap(image1); + 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->addWidget(Group1, 1, 0); + LayoutA = new QGridLayout( 0, 1, 1, 0, 6, "LayoutA"); + + LineEdit3 = new QLineEdit( GroupBox1, "LineEdit3" ); + + LayoutA->addWidget( LineEdit3, 3, 2 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + LayoutA->addWidget( TextLabel4, 3, 0 ); + + LayoutB = new QGridLayout( 0, 1, 1, 0, 6, "LayoutB"); + + TextLabel5 = new QLabel( GroupBox1, "TextLabel5" ); + TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) ); + TextLabel5->setText( trUtf8( "TL5" ) ); + + LayoutB->addWidget( TextLabel5, 0, 0 ); + + SpinBox_DX = new DlgRef_SpinBox(GroupBox1, "SpinBox_DX"); + LayoutB->addWidget( SpinBox_DX, 0, 1 ); + + LayoutA->addMultiCellLayout( LayoutB, 4, 4, 0, 2 ); + + PushButton2 = new QPushButton( GroupBox1, "PushButton2" ); + PushButton2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton2->sizePolicy().hasHeightForWidth() ) ); + PushButton2->setText( trUtf8( "" ) ); + + LayoutA->addWidget( PushButton2, 2, 1 ); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + LayoutA->addWidget( LineEdit1, 0, 2 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + LayoutA->addWidget( PushButton1, 0, 1 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + LayoutA->addWidget( TextLabel1, 0, 0 ); + + LineEdit2 = new QLineEdit( GroupBox1, "LineEdit2" ); + + LayoutA->addWidget( LineEdit2, 2, 2 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + + LayoutA->addWidget( TextLabel3, 2, 0 ); + + LayoutB = new QGridLayout( 0, 1, 1, 0, 6, "LayoutB"); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + + LayoutB->addWidget( TextLabel2, 0, 0 ); + + ComboBox1 = new QComboBox( FALSE, GroupBox1, "ComboBox1" ); + ComboBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, ComboBox1->sizePolicy().hasHeightForWidth() ) ); + + LayoutB->addWidget( ComboBox1, 0, 1 ); + + LayoutA->addMultiCellLayout( LayoutB, 1, 1, 0, 2 ); + QSpacerItem* spacer = new QSpacerItem( 0, 90, QSizePolicy::Minimum, QSizePolicy::Expanding ); + LayoutA->addItem( spacer, 5, 2 ); + + PushButton3 = new QPushButton( GroupBox1, "PushButton3" ); + PushButton3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton3->sizePolicy().hasHeightForWidth() ) ); + PushButton3->setText( trUtf8( "" ) ); + + LayoutA->addWidget( PushButton3, 3, 1 ); + + GroupBox1Layout->addLayout( LayoutA, 0, 0 ); + + GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + TextLabel1->setText(tr("GEOM_ASSEMBLY")); + TextLabel2->setText(tr("GEOM_TYPE")); + TextLabel3->setText(tr("GEOM_OBJECT_I").arg("1")); + TextLabel4->setText(tr("GEOM_OBJECT_I").arg("2")); + TextLabel5->setText(tr("GEOM_STEP")); + PushButton1->setPixmap(image1); + PushButton2->setPixmap(image1); + PushButton3->setPixmap(image1); + + Layout1->addWidget(GroupBox1, 1, 0); /***************************************************************/ /* Initialisation */ myKinematicGUI = theKinematicGUI; - myType = type; Init(); } @@ -88,40 +178,51 @@ KinematicGUI_ContactDlg::~KinematicGUI_ContactDlg() void KinematicGUI_ContactDlg::Init() { /* init variables */ - myEditCurrentArgument = Group1->LineEdit1; + myEditCurrentArgument = LineEdit1; myOkAssembly = myOkShape1 = myOkShape2 = false; + myType = 0; + myStep = 0.0; + + /* min, max, step and decimals for spin boxes & initial values */ + SpinBox_DX->RangeStepAndValidator(0.0, 999.999, 0.1, 3); + SpinBox_DX->SetValue(myStep); + SpinBox_DX->setEnabled(false); /* type for sub shape selection */ - Group1->ComboBox1->insertItem("Embedding"); - Group1->ComboBox1->insertItem("Pivot"); - Group1->ComboBox1->insertItem("Slide"); - Group1->ComboBox1->insertItem("Sliding Pivot"); - Group1->ComboBox1->insertItem("Spherical"); - Group1->ComboBox1->insertItem("Plane"); - Group1->ComboBox1->insertItem("Annular"); - Group1->ComboBox1->insertItem("Rectilinear"); - Group1->ComboBox1->insertItem("Ponctual"); + ComboBox1->insertItem("Embedding"); + ComboBox1->insertItem("Pivot"); + ComboBox1->insertItem("Slide"); + ComboBox1->insertItem("Sliding Pivot"); + ComboBox1->insertItem("Spherical"); + ComboBox1->insertItem("Plane"); + ComboBox1->insertItem("Annular"); + ComboBox1->insertItem("Rectilinear"); + ComboBox1->insertItem("Ponctual"); + ComboBox1->insertItem("Helicoidal"); - Group1->ComboBox1->setCurrentItem(myType); + ComboBox1->setCurrentItem(myType); /* signals and slots connections */ connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group1->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group1->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group1->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group1->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group1->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged())); + connect(SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), SpinBox_DX, SLOT(SetStep(double))); + + connect(ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged())); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); /* displays Dialog */ - Group1->show(); + this->SelectionIntoArgument(); this->show(); return; @@ -146,10 +247,11 @@ void KinematicGUI_ContactDlg::ClickOnOk() //================================================================================= void KinematicGUI_ContactDlg::ClickOnApply() { + buttonApply->setFocus(); QAD_Application::getDesktop()->putInfo(tr("")); if(myOkAssembly && myOkShape1 && myOkShape2) - myKinematicGUI->AddContact(myGeomAssembly, myGeomShape1, myGeomShape2, myType); + myKinematicGUI->AddContact(myGeomAssembly, myGeomShape1, myGeomShape2, myType, myStep); return; } @@ -166,11 +268,11 @@ void KinematicGUI_ContactDlg::SelectionIntoArgument() int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); if(nbSel != 1) { - if(myEditCurrentArgument == Group1->LineEdit1) + if(myEditCurrentArgument == LineEdit1) myOkAssembly = false; - else if( myEditCurrentArgument == Group1->LineEdit2) + else if( myEditCurrentArgument == LineEdit2) myOkShape1 = false; - else if( myEditCurrentArgument == Group1->LineEdit3) + else if( myEditCurrentArgument == LineEdit3) myOkShape2 = false; return; } @@ -179,11 +281,11 @@ void KinematicGUI_ContactDlg::SelectionIntoArgument() Standard_Boolean testResult; Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); - if(myEditCurrentArgument == Group1->LineEdit1) { + if(myEditCurrentArgument == LineEdit1) { myGeomAssembly = myGeomBase->ConvertIOinAssembly(IO, testResult); if(!testResult) return; - Group1->LineEdit1->setText(aString); + LineEdit1->setText(aString); myOkAssembly = true; } else { @@ -191,18 +293,18 @@ void KinematicGUI_ContactDlg::SelectionIntoArgument() if(!myGeomBase->GetTopoFromSelection(mySelection, S)) return; - if(myEditCurrentArgument == Group1->LineEdit2) { + if(myEditCurrentArgument == LineEdit2) { myGeomShape1 = myGeomBase->ConvertIOinGEOMShape(IO, testResult); if(!testResult) return; - Group1->LineEdit2->setText(aString); + LineEdit2->setText(aString); myOkShape1 = true; } - else if(myEditCurrentArgument == Group1->LineEdit3) { + else if(myEditCurrentArgument == LineEdit3) { myGeomShape2 = myGeomBase->ConvertIOinGEOMShape(IO, testResult); if(!testResult) return; - Group1->LineEdit3->setText(aString); + LineEdit3->setText(aString); myOkShape2 = true; } } @@ -218,17 +320,17 @@ void KinematicGUI_ContactDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - if(send == Group1->PushButton1) { - Group1->LineEdit1->setFocus(); - myEditCurrentArgument = Group1->LineEdit1; + if(send == PushButton1) { + LineEdit1->setFocus(); + myEditCurrentArgument = LineEdit1; } - else if(send == Group1->PushButton2) { - Group1->LineEdit2->setFocus(); - myEditCurrentArgument = Group1->LineEdit2; + else if(send == PushButton2) { + LineEdit2->setFocus(); + myEditCurrentArgument = LineEdit2; } - else if(send == Group1->PushButton3) { - Group1->LineEdit3->setFocus(); - myEditCurrentArgument = Group1->LineEdit3; + else if(send == PushButton3) { + LineEdit3->setFocus(); + myEditCurrentArgument = LineEdit3; } SelectionIntoArgument(); @@ -244,12 +346,12 @@ void KinematicGUI_ContactDlg::SetEditCurrentArgument() void KinematicGUI_ContactDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); - if(send == Group1->LineEdit1) - myEditCurrentArgument = Group1->LineEdit1; - else if(send == Group1->LineEdit2) - myEditCurrentArgument = Group1->LineEdit2; - else if(send == Group1->LineEdit3) - myEditCurrentArgument = Group1->LineEdit3; + if(send == LineEdit1) + myEditCurrentArgument = LineEdit1; + else if(send == LineEdit2) + myEditCurrentArgument = LineEdit2; + else if(send == LineEdit3) + myEditCurrentArgument = LineEdit3; else return; @@ -289,6 +391,26 @@ void KinematicGUI_ContactDlg::enterEvent(QEvent * e) //================================================================================= void KinematicGUI_ContactDlg::ComboTextChanged() { - myType = Group1->ComboBox1->currentItem(); + myType = ComboBox1->currentItem(); + if(myType == 9) { + SpinBox_DX->SetValue(1.0); + SpinBox_DX->setEnabled(true); + } + else { + SpinBox_DX->SetValue(0.0); + SpinBox_DX->setEnabled(false); + } + + return; +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void KinematicGUI_ContactDlg::ValueChangedInSpinBox(double newValue) +{ + myStep = newValue; return; } diff --git a/src/KinematicGUI/KinematicGUI_ContactDlg.h b/src/KinematicGUI/KinematicGUI_ContactDlg.h index c5967ef2f..3504adb7a 100644 --- a/src/KinematicGUI/KinematicGUI_ContactDlg.h +++ b/src/KinematicGUI/KinematicGUI_ContactDlg.h @@ -30,7 +30,7 @@ #define DIALOGBOX_CONTACT_H #include "GEOMBase_Skeleton.h" -#include "KinematicGUI_3Sel1List_QTD.h" +#include "DlgRef_SpinBox.h" #include "KinematicGUI.h" @@ -43,7 +43,7 @@ class KinematicGUI_ContactDlg : public GEOMBase_Skeleton Q_OBJECT public: - KinematicGUI_ContactDlg(QWidget* parent = 0, const char* name = 0, KinematicGUI* theKinematicGUI = 0, SALOME_Selection* Sel = 0, int type = 0, bool modal = FALSE, WFlags fl = 0); + KinematicGUI_ContactDlg(QWidget* parent = 0, const char* name = 0, KinematicGUI* theKinematicGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); ~KinematicGUI_ContactDlg(); private: @@ -59,8 +59,23 @@ private: bool myOkShape1; bool myOkShape2; /* to check when arguments are defined */ int myType; + double myStep; + + QGroupBox* GroupBox1; + QLabel* TextLabel1; + QLabel* TextLabel3; + QLabel* TextLabel2; + QLabel* TextLabel4; + QLabel* TextLabel5; + QPushButton* PushButton1; + QPushButton* PushButton2; + QPushButton* PushButton3; + QLineEdit* LineEdit1; + QLineEdit* LineEdit2; + QLineEdit* LineEdit3; + QComboBox* ComboBox1; + DlgRef_SpinBox* SpinBox_DX; - KinematicGUI_3Sel1List_QTD* Group1; private slots: void ClickOnOk(); @@ -70,6 +85,13 @@ private slots: void LineEditReturnPressed(); void ActivateThisDialog(); void ComboTextChanged(); + void ValueChangedInSpinBox(double newValue); + +protected: + QGridLayout* GroupBox1Layout; + QGridLayout* LayoutA; + QGridLayout* LayoutB; + QGridLayout* LayoutC; }; diff --git a/src/KinematicGUI/KinematicGUI_ContactHDlg.cxx b/src/KinematicGUI/KinematicGUI_ContactHDlg.cxx deleted file mode 100644 index 7f4433eb1..000000000 --- a/src/KinematicGUI/KinematicGUI_ContactHDlg.cxx +++ /dev/null @@ -1,286 +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 : KinematicGUI_ContactHDlg.cxx -// Author : Damien COQUERET -// Module : GEOM -// $Header: - -using namespace std; -#include "KinematicGUI_ContactHDlg.h" - -//================================================================================= -// class : KinematicGUI_ContactHDlg() -// purpose : Constructs a KinematicGUI_ContactHDlg 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. -//================================================================================= -KinematicGUI_ContactHDlg::KinematicGUI_ContactHDlg(QWidget* parent, const char* name, KinematicGUI* theKinematicGUI, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_CONTACT"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); - - setCaption(tr("GEOM_CONTACT_TITLE")); - - /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_CONTACT")); - RadioButton1->setPixmap(image0); - RadioButton2->close(TRUE); - RadioButton3->close(TRUE); - - Group1 = new KinematicGUI_3Sel1Spin(this, "Group1"); - Group1->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); - Group1->TextLabel1->setText(tr("GEOM_ASSEMBLY")); - Group1->TextLabel2->setText(tr("GEOM_OBJECT_I").arg("1")); - Group1->TextLabel3->setText(tr("GEOM_OBJECT_I").arg("2")); - Group1->TextLabel4->setText(tr("GEOM_STEP")); - Group1->PushButton1->setPixmap(image1); - Group1->PushButton2->setPixmap(image1); - Group1->PushButton3->setPixmap(image1); - - Layout1->addWidget(Group1, 1, 0); - /***************************************************************/ - - /* Initialisation */ - myKinematicGUI = theKinematicGUI; - Init(); -} - - -//================================================================================= -// function : ~KinematicGUI_ContactHDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -KinematicGUI_ContactHDlg::~KinematicGUI_ContactHDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void KinematicGUI_ContactHDlg::Init() -{ - /* init variables */ - myEditCurrentArgument = Group1->LineEdit1; - myOkAssembly = myOkShape1 = myOkShape2 = false; - - myStep = 1.0; - /* min, max, step and decimals for spin boxes & initial values */ - Group1->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, 0.1, 3); - Group1->SpinBox_DX->SetValue(myStep); - - /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - - connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group1->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - connect(Group1->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); - - connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group1->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(Group1->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - - connect(Group1->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group1->SpinBox_DX, SLOT(SetStep(double))); - - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - - /* displays Dialog */ - Group1->show(); - this->show(); - - return; -} - - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void KinematicGUI_ContactHDlg::ClickOnOk() -{ - this->ClickOnApply(); - ClickOnCancel(); - return ; -} - - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void KinematicGUI_ContactHDlg::ClickOnApply() -{ - QAD_Application::getDesktop()->putInfo(tr("")); - - if(myOkAssembly && myOkShape1 && myOkShape2) - myKinematicGUI->AddContact(myGeomAssembly, myGeomShape1, myGeomShape2, 9, myStep); - - return; -} - - -//================================================================================= -// function : SelectionIntoArgument() -// purpose : Called when selection has changed -//================================================================================= -void KinematicGUI_ContactHDlg::SelectionIntoArgument() -{ - myEditCurrentArgument->setText(""); - QString aString = ""; - - int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); - if(nbSel != 1) { - if(myEditCurrentArgument == Group1->LineEdit1) - myOkAssembly = false; - else if( myEditCurrentArgument == Group1->LineEdit2) - myOkShape1 = false; - else if( myEditCurrentArgument == Group1->LineEdit3) - myOkShape2 = false; - return; - } - - /* nbSel == 1 */ - Standard_Boolean testResult; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); - - if(myEditCurrentArgument == Group1->LineEdit1) { - myGeomAssembly = myGeomBase->ConvertIOinAssembly(IO, testResult); - if(!testResult) - return; - Group1->LineEdit1->setText(aString); - myOkAssembly = true; - } - else { - TopoDS_Shape S; - if(!myGeomBase->GetTopoFromSelection(mySelection, S)) - return; - - if(myEditCurrentArgument == Group1->LineEdit2) { - myGeomShape1 = myGeomBase->ConvertIOinGEOMShape(IO, testResult); - if(!testResult) - return; - Group1->LineEdit2->setText(aString); - myOkShape1 = true; - } - else if(myEditCurrentArgument == Group1->LineEdit3) { - myGeomShape2 = myGeomBase->ConvertIOinGEOMShape(IO, testResult); - if(!testResult) - return; - Group1->LineEdit3->setText(aString); - myOkShape2 = true; - } - } - return; -} - - -//================================================================================= -// function : SetEditCurrentArgument() -// purpose : -//================================================================================= -void KinematicGUI_ContactHDlg::SetEditCurrentArgument() -{ - QPushButton* send = (QPushButton*)sender(); - - if(send == Group1->PushButton1) { - Group1->LineEdit1->setFocus(); - myEditCurrentArgument = Group1->LineEdit1; - } - else if(send == Group1->PushButton2) { - Group1->LineEdit2->setFocus(); - myEditCurrentArgument = Group1->LineEdit2; - } - else if(send == Group1->PushButton3) { - Group1->LineEdit3->setFocus(); - myEditCurrentArgument = Group1->LineEdit3; - } - SelectionIntoArgument(); - - return; -} - - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void KinematicGUI_ContactHDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if(send == Group1->LineEdit1) - myEditCurrentArgument = Group1->LineEdit1; - else if(send == Group1->LineEdit2) - myEditCurrentArgument = Group1->LineEdit2; - else if(send == Group1->LineEdit3) - myEditCurrentArgument = Group1->LineEdit3; - else - return; - - GEOMBase_Skeleton::LineEditReturnPressed(); - return; -} - - -//================================================================================= -// function : ActivateThisDialog() -// purpose : -//================================================================================= -void KinematicGUI_ContactHDlg::ActivateThisDialog() -{ - GEOMBase_Skeleton::ActivateThisDialog(); - connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - return; -} - - -//================================================================================= -// function : enterEvent() -// purpose : when mouse enter onto the QWidget -//================================================================================= -void KinematicGUI_ContactHDlg::enterEvent(QEvent * e) -{ - if (GroupConstructors->isEnabled()) - return; - this->ActivateThisDialog(); - return; -} - - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void KinematicGUI_ContactHDlg::ValueChangedInSpinBox(double newValue) -{ - myStep = newValue; - return; -} diff --git a/src/KinematicGUI/KinematicGUI_PositionDlg.cxx b/src/KinematicGUI/KinematicGUI_PositionDlg.cxx index a0b2f2cd0..2f05ead4b 100644 --- a/src/KinematicGUI/KinematicGUI_PositionDlg.cxx +++ b/src/KinematicGUI/KinematicGUI_PositionDlg.cxx @@ -118,12 +118,20 @@ void KinematicGUI_PositionDlg::Init() if(!testResult) ClickOnCancel(); - myGeomPosition = GEOM::GEOM_Position::_narrow(myGeomContact->GetPosition()); + GEOM::ListOfDouble_var aList = myGeomContact->GetPosition(); - P0 = myGeomPosition->GetOrigin(); - VX = myGeomPosition->GetVX(); - VY = myGeomPosition->GetVY(); - VZ = myGeomPosition->GetVZ(); + P0.x = aList[0]; + P0.y = aList[1]; + P0.z = aList[2]; + VX.PS.x = aList[3]; + VX.PS.y = aList[4]; + VX.PS.z = aList[5]; + VY.PS.x = aList[6]; + VY.PS.y = aList[7]; + VY.PS.z = aList[8]; + VZ.PS.x = aList[9]; + VZ.PS.y = aList[10]; + VZ.PS.z = aList[11]; Group1->SpinBox_11->SetValue(P0.x); Group1->SpinBox_12->SetValue(P0.y); @@ -177,7 +185,7 @@ void KinematicGUI_PositionDlg::Init() //================================================================================= -// function : InitValues() +// function : SetEnabledValues() // purpose : //================================================================================= void KinematicGUI_PositionDlg::SetEnabledValues() @@ -185,52 +193,33 @@ void KinematicGUI_PositionDlg::SetEnabledValues() int type = myGeomContact->GetType(); if(type == 0) { //EMBEDDING - Group1->SpinBox_21->setEnabled(false); - Group1->SpinBox_22->setEnabled(false); - Group1->SpinBox_23->setEnabled(false); - Group1->SpinBox_31->setEnabled(false); - Group1->SpinBox_32->setEnabled(false); - Group1->SpinBox_33->setEnabled(false); - Group1->SpinBox_41->setEnabled(false); - Group1->SpinBox_42->setEnabled(false); - Group1->SpinBox_43->setEnabled(false); - Group1->TextLabel5->setEnabled(false); - Group1->TextLabel6->setEnabled(false); - Group1->TextLabel7->setEnabled(false); - Group1->TextLabel8->setEnabled(false); - Group1->TextLabel9->setEnabled(false); - Group1->TextLabel10->setEnabled(false); - Group1->TextLabel11->setEnabled(false); - Group1->TextLabel12->setEnabled(false); - Group1->TextLabel13->setEnabled(false); - Group1->TextLabel14->setEnabled(false); - Group1->TextLabel15->setEnabled(false); - Group1->TextLabel16->setEnabled(false); + Group1->SpinBox_21->hide(); + Group1->SpinBox_22->hide(); + Group1->SpinBox_23->hide(); + Group1->TextLabel5->hide(); + Group1->TextLabel6->hide(); + Group1->TextLabel7->hide(); + Group1->TextLabel8->hide(); } - else if(type == 1 || type == 3 || type == 5 || type == 9) { //PIVOT || SLIDING PIVOT || PLANE || HELICOIDAL - Group1->SpinBox_31->setEnabled(false); - Group1->SpinBox_32->setEnabled(false); - Group1->SpinBox_33->setEnabled(false); - Group1->SpinBox_41->setEnabled(false); - Group1->SpinBox_42->setEnabled(false); - Group1->SpinBox_43->setEnabled(false); - Group1->TextLabel9->setEnabled(false); - Group1->TextLabel10->setEnabled(false); - Group1->TextLabel11->setEnabled(false); - Group1->TextLabel12->setEnabled(false); - Group1->TextLabel13->setEnabled(false); - Group1->TextLabel14->setEnabled(false); - Group1->TextLabel15->setEnabled(false); - Group1->TextLabel16->setEnabled(false); + + if(type == 0 || type == 1 || type == 3 || type == 5 || type == 9) { //EMBEDDING || PIVOT || SLIDING PIVOT || PLANE || HELICOIDAL + Group1->SpinBox_31->hide(); + Group1->SpinBox_32->hide(); + Group1->SpinBox_33->hide(); + Group1->TextLabel9->hide(); + Group1->TextLabel10->hide(); + Group1->TextLabel11->hide(); + Group1->TextLabel12->hide(); } - else if(type == 7) { //RECTILINEAR - Group1->SpinBox_41->setEnabled(false); - Group1->SpinBox_42->setEnabled(false); - Group1->SpinBox_43->setEnabled(false); - Group1->TextLabel13->setEnabled(false); - Group1->TextLabel14->setEnabled(false); - Group1->TextLabel15->setEnabled(false); - Group1->TextLabel16->setEnabled(false); + + if(type == 0 || type == 1 || type == 3 || type == 5 || type == 7 || type == 9) { //EMBEDDING || PIVOT || SLIDING PIVOT || PLANE || RECTILINEAR || HELICOIDAL + Group1->SpinBox_41->hide(); + Group1->SpinBox_42->hide(); + Group1->SpinBox_43->hide(); + Group1->TextLabel13->hide(); + Group1->TextLabel14->hide(); + Group1->TextLabel15->hide(); + Group1->TextLabel16->hide(); } return; diff --git a/src/KinematicGUI/KinematicGUI_PositionDlg.h b/src/KinematicGUI/KinematicGUI_PositionDlg.h index 2c7dd0dcc..c44a257b9 100644 --- a/src/KinematicGUI/KinematicGUI_PositionDlg.h +++ b/src/KinematicGUI/KinematicGUI_PositionDlg.h @@ -53,7 +53,6 @@ private: KinematicGUI* myKinematicGUI; GEOM::GEOM_Contact_var myGeomContact; - GEOM::GEOM_Position_var myGeomPosition; GEOM::PointStruct P0; GEOM::DirStruct VX; diff --git a/src/KinematicGUI/KinematicGUI_RangeDlg.cxx b/src/KinematicGUI/KinematicGUI_RangeDlg.cxx new file mode 100644 index 000000000..f98034392 --- /dev/null +++ b/src/KinematicGUI/KinematicGUI_RangeDlg.cxx @@ -0,0 +1,373 @@ +// 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 : KinematicGUI_RangeDlg.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "KinematicGUI_RangeDlg.h" + +using namespace std; + +//================================================================================= +// class : KinematicGUI_RangeDlg() +// purpose : Constructs a KinematicGUI_RangeDlg 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. +//================================================================================= +KinematicGUI_RangeDlg::KinematicGUI_RangeDlg(QWidget* parent, const char* name, KinematicGUI* theKinematicGUI, SALOME_Selection* Sel, int type, bool modal, WFlags fl) + :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_RANGE_TITLE")); + + /***************************************************************/ + if(type == 0) + GroupConstructors->setTitle(tr("GEOM_ANG_RANGE")); + else if(type == 1) + GroupConstructors->setTitle(tr("GEOM_LIN_RANGE")); + RadioButton1->setText(tr("GEOM_RANGE_X")); + RadioButton2->setText(tr("GEOM_RANGE_Y")); + RadioButton3->setText(tr("GEOM_RANGE_Z")); + + Group1 = new DlgRef_1Sel2Spin(this, "Group1"); + Group1->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + Group1->TextLabel1->setText(tr("GEOM_CONTACT")); + Group1->TextLabel2->setText(tr("GEOM_MIN")); + Group1->TextLabel3->setText(tr("GEOM_MAX")); + Group1->PushButton1->setPixmap(image0); + + Layout1->addWidget(Group1, 1, 0); + /***************************************************************/ + + /* Initialisation */ + myType = type; + myKinematicGUI = theKinematicGUI; + Init(); +} + + +//================================================================================= +// function : ~KinematicGUI_RangeDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +KinematicGUI_RangeDlg::~KinematicGUI_RangeDlg() +{ + /* no need to delete child widgets, Qt does it all for us */ +} + + + +//================================================================================= +// function : Init() +// purpose : +//================================================================================= +void KinematicGUI_RangeDlg::Init() +{ + /* init variables */ + myConstructorId = 0; + myEditCurrentArgument = Group1->LineEdit1; + myOkShape = false; + + myMinValX = 0.0; + myMaxValX = 0.0; + myMinValY = 0.0; + myMaxValY = 0.0; + myMinValZ = 0.0; + myMaxValZ = 0.0; + + double step = 5.0; + Group1->SpinBox_DX->RangeStepAndValidator(-99999.999, 99999.999, step, 3); + Group1->SpinBox_DY->RangeStepAndValidator(-99999.999, 99999.999, step, 3); + + Group1->SpinBox_DX->SetValue(myMinValX); + Group1->SpinBox_DY->SetValue(myMaxValX); + + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + + connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(Group1->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group1->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group1->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group1->SpinBox_DY, SLOT(SetStep(double))); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + this->SelectionIntoArgument(); + Group1->show(); + this->show(); + + return; +} + + +//================================================================================= +// function : SetEnabledValues() +// purpose : +//================================================================================= +void KinematicGUI_RangeDlg::SetEnabledValues() +{ + bool IsOk = true; + int aType = myGeomContact->GetType(); + + GEOM::ListOfDouble_var aList; + if(myType == 0) /* Angular */ + aList = myGeomContact->GetAngularRange(); + else if(myType == 1) /* Linear */ + aList = myGeomContact->GetLinearRange(); + + myMinValX = aList[0]; + myMaxValX = aList[1]; + myMinValY = aList[2]; + myMaxValY = aList[3]; + myMinValZ = aList[4]; + myMaxValZ = aList[5]; + + if(myConstructorId == 0) { // X + Group1->SpinBox_DX->SetValue(aList[0]); + Group1->SpinBox_DY->SetValue(aList[1]); + } + else if(myConstructorId == 1) { // Y + Group1->SpinBox_DX->SetValue(aList[2]); + Group1->SpinBox_DY->SetValue(aList[3]); + } + else if(myConstructorId == 2) { // Z + Group1->SpinBox_DX->SetValue(aList[4]); + Group1->SpinBox_DY->SetValue(aList[5]); + } + + if(myType == 0) { //ANGULAR + if(myConstructorId == 0 && (aType == 2 || aType == 5)) // X + IsOk = false; + else if(myConstructorId == 1 && (aType == 1 || aType == 2 || aType == 3 || aType == 5 || aType == 7 || aType == 9)) // Y + IsOk = false; + else if(myConstructorId == 2 && (aType == 1 || aType == 2 || aType == 3 || aType == 9)) // Z + IsOk = false; + } + else if(myType == 1) { //LINEAR + if(myConstructorId == 0 && (aType == 1 || aType == 4 || aType == 8)) // X + IsOk = false; + else if(myConstructorId == 1 && (aType == 1 || aType == 2 || aType == 3 || aType == 4 || aType == 6 || aType == 9)) // Y + IsOk = false; + else if(myConstructorId == 2 && (aType == 1 || aType == 2 || aType == 3 || aType == 4 || aType == 5 || aType == 6 || aType == 7 || aType == 9)) // Z + IsOk = false; + } + + if(aType == 0) + IsOk = false; + + Group1->TextLabel2->setEnabled(IsOk); + Group1->TextLabel3->setEnabled(IsOk); + Group1->SpinBox_DX->setEnabled(IsOk); + Group1->SpinBox_DY->setEnabled(IsOk); + + return; +} + + +//================================================================================= +// function : ConstructorsClicked() +// purpose : Radio button management +//================================================================================= +void KinematicGUI_RangeDlg::ConstructorsClicked(int constructorId) +{ + myConstructorId = constructorId; + this->SelectionIntoArgument(); + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void KinematicGUI_RangeDlg::ClickOnOk() +{ + this->ClickOnApply(); + ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnApply() +// purpose : +//================================================================================= +void KinematicGUI_RangeDlg::ClickOnApply() +{ + buttonApply->setFocus(); + QAD_Application::getDesktop()->putInfo(tr("")); + + if(myType == 0 && myOkShape) /* Angular */ + myKinematicGUI->SetAngularRange(myGeomContact, myMinValX, myMaxValX, + myMinValY, myMaxValY, myMinValZ, myMaxValZ); + else if(myType == 1 && myOkShape) /* Linear */ + myKinematicGUI->SetLinearRange(myGeomContact, myMinValX, myMaxValX, + myMinValY, myMaxValY, myMinValZ, myMaxValZ); + + return; +} + + +//================================================================================= +// function : SelectionIntoArgument() +// purpose : Called when selection has changed +//================================================================================= +void KinematicGUI_RangeDlg::SelectionIntoArgument() +{ + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ + + myMinValX = 0.0; + myMaxValX = 0.0; + myMinValY = 0.0; + myMaxValY = 0.0; + myMinValZ = 0.0; + myMaxValZ = 0.0; + Group1->SpinBox_DX->SetValue(0.0); + Group1->SpinBox_DY->SetValue(0.0); + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + myOkShape = false; + return; + } + + /* nbSel == 1 */ + Standard_Boolean testResult; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + + myGeomContact = myGeomBase->ConvertIOinContact(IO, testResult); + if(!testResult) + return; + + Group1->LineEdit1->setText(aString); + myOkShape = true; + this->SetEnabledValues(); + return; +} + + +//================================================================================= +// function : SetEditCurrentArgument() +// purpose : +//================================================================================= +void KinematicGUI_RangeDlg::SetEditCurrentArgument() +{ + QPushButton* send = (QPushButton*)sender(); + + if(send == Group1->PushButton1) + Group1->LineEdit1->setFocus(); + + this->SelectionIntoArgument(); + return; +} + + +//================================================================================= +// function : ActivateThisDialog() +// purpose : +//================================================================================= +void KinematicGUI_RangeDlg::ActivateThisDialog() +{ + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + return; +} + + +//================================================================================= +// function : enterEvent() +// purpose : +//================================================================================= +void KinematicGUI_RangeDlg::enterEvent(QEvent* e) +{ + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void KinematicGUI_RangeDlg::ValueChangedInSpinBox(double newValue) +{ + DlgRef_SpinBox* send = (DlgRef_SpinBox*)sender(); + + if(myConstructorId == 0) { + if(send == Group1->SpinBox_DX) { + if(newValue <= myMaxValX) + myMinValX = newValue; + else + Group1->SpinBox_DX->SetValue(myMinValX); + } + else if(send == Group1->SpinBox_DY) { + if(newValue >= myMinValX) + myMaxValX = newValue; + else + Group1->SpinBox_DY->SetValue(myMaxValX); + } + } + else if(myConstructorId == 1) { + if(send == Group1->SpinBox_DX) { + if(newValue <= myMaxValY) + myMinValY = newValue; + else + Group1->SpinBox_DX->SetValue(myMinValY); + } + else if(send == Group1->SpinBox_DY) { + if(newValue >= myMinValY) + myMaxValY = newValue; + else + Group1->SpinBox_DY->SetValue(myMaxValY); + } + } + else if(myConstructorId == 2) { + if(send == Group1->SpinBox_DX) { + if(newValue <= myMaxValZ) + myMinValZ = newValue; + else + Group1->SpinBox_DX->SetValue(myMinValZ); + } + else if(send == Group1->SpinBox_DY) { + if(newValue >= myMinValZ) + myMaxValZ = newValue; + else + Group1->SpinBox_DY->SetValue(myMaxValZ); + } + } + + return; +} diff --git a/src/KinematicGUI/KinematicGUI_ContactHDlg.h b/src/KinematicGUI/KinematicGUI_RangeDlg.h similarity index 64% rename from src/KinematicGUI/KinematicGUI_ContactHDlg.h rename to src/KinematicGUI/KinematicGUI_RangeDlg.h index 8a77fab0c..9c0c39f41 100644 --- a/src/KinematicGUI/KinematicGUI_ContactHDlg.h +++ b/src/KinematicGUI/KinematicGUI_RangeDlg.h @@ -21,56 +21,61 @@ // // // -// File : KinematicGUI_ContactHDlg.h +// File : KinematicGUI_RangeDlg.h // Author : Damien COQUERET // Module : GEOM // $Header: -#ifndef DIALOGBOX_CONTACTH_H -#define DIALOGBOX_CONTACTH_H +#ifndef DIALOGBOX_RANGE_H +#define DIALOGBOX_RANGE_H #include "GEOMBase_Skeleton.h" -#include "KinematicGUI_3Sel1Spin.h" +#include "DlgRef_1Sel2Spin.h" #include "KinematicGUI.h" //================================================================================= -// class : KinematicGUI_ContactHDlg +// class : KinematicGUI_RangeDlg // purpose : //================================================================================= -class KinematicGUI_ContactHDlg : public GEOMBase_Skeleton +class KinematicGUI_RangeDlg : public GEOMBase_Skeleton { Q_OBJECT public: - KinematicGUI_ContactHDlg(QWidget* parent = 0, const char* name = 0, KinematicGUI* theKinematicGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); - ~KinematicGUI_ContactHDlg(); + KinematicGUI_RangeDlg(QWidget* parent = 0, const char* name = 0, KinematicGUI* theKinematicGUI = 0, SALOME_Selection* Sel = 0, int type = 0, bool modal = FALSE, WFlags fl = 0); + ~KinematicGUI_RangeDlg(); private: void Init(); - void enterEvent(QEvent * e); + void SetEnabledValues(); + void enterEvent(QEvent* e); KinematicGUI* myKinematicGUI; - GEOM::GEOM_Assembly_var myGeomAssembly; - GEOM::GEOM_Shape_var myGeomShape1; /* is myShape1 */ - GEOM::GEOM_Shape_var myGeomShape2; /* is myShape2 */ - bool myOkAssembly; - bool myOkShape1; - bool myOkShape2; /* to check when arguments are defined */ - double myStep; + int myConstructorId; /* Current constructor id = radio button id */ - KinematicGUI_3Sel1Spin* Group1; + GEOM::GEOM_Contact_var myGeomContact; + bool myOkShape; + int myType; + double myMinValX; + double myMaxValX; + double myMinValY; + double myMaxValY; + double myMinValZ; + double myMaxValZ; + + DlgRef_1Sel2Spin* Group1; private slots: void ClickOnOk(); void ClickOnApply(); - void SetEditCurrentArgument(); - void SelectionIntoArgument(); - void LineEditReturnPressed(); void ActivateThisDialog(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); void ValueChangedInSpinBox(double newValue); + void ConstructorsClicked(int constructorId); }; -#endif // DIALOGBOX_CONTACT_H +#endif // DIALOGBOX_RANGE_H diff --git a/src/KinematicGUI/KinematicGUI_RotationDlg.cxx b/src/KinematicGUI/KinematicGUI_RotationDlg.cxx deleted file mode 100644 index 666913864..000000000 --- a/src/KinematicGUI/KinematicGUI_RotationDlg.cxx +++ /dev/null @@ -1,319 +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 : KinematicGUI_RotationDlg.cxx -// Author : Damien COQUERET -// Module : GEOM -// $Header: - -using namespace std; -#include "KinematicGUI_RotationDlg.h" - -//================================================================================= -// class : KinematicGUI_RotationDlg() -// purpose : Constructs a KinematicGUI_RotationDlg 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. -//================================================================================= -KinematicGUI_RotationDlg::KinematicGUI_RotationDlg(QWidget* parent, const char* name, KinematicGUI* theKinematicGUI, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_CONTACT"))); - - setCaption(tr("GEOM_KROTATION_TITLE")); - - /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_KROTATION")); - RadioButton1->setPixmap(image0); - RadioButton2->close(TRUE); - RadioButton3->close(TRUE); - - Group1 = new KinematicGUI_3List3Spin(this, "Group1"); - Group1->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); - Group1->TextLabel1->setText(tr("GEOM_1ROT")); - Group1->TextLabel2->setText(tr("GEOM_VALUE")); - Group1->TextLabel3->setText(tr("GEOM_2ROT")); - Group1->TextLabel4->setText(tr("GEOM_VALUE")); - Group1->TextLabel5->setText(tr("GEOM_3ROT")); - Group1->TextLabel6->setText(tr("GEOM_VALUE")); - - Layout1->addWidget(Group1, 1, 0); - /***************************************************************/ - - /* Initialisation */ - myKinematicGUI = theKinematicGUI; - Init(); -} - - -//================================================================================= -// function : ~KinematicGUI_RotationDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -KinematicGUI_RotationDlg::~KinematicGUI_RotationDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void KinematicGUI_RotationDlg::Init() -{ - double step = 5.0; - - Group1->SpinBox_DX->RangeStepAndValidator(-99999.999, 99999.999, step, 3); - Group1->SpinBox_DY->RangeStepAndValidator(-99999.999, 99999.999, step, 3); - Group1->SpinBox_DZ->RangeStepAndValidator(-99999.999, 99999.999, step, 3); - - Standard_Boolean testResult; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); - myGeomContact = myGeomBase->ConvertIOinContact(IO, testResult); - if(!testResult) - ClickOnCancel(); - - myGeomRotation = GEOM::GEOM_Rotation::_narrow(myGeomContact->GetRotation()); - - myVal1 = myGeomRotation->GetVal1(); - myVal2 = myGeomRotation->GetVal2(); - myVal3 = myGeomRotation->GetVal3(); - - Group1->SpinBox_DX->SetValue(myVal1); - Group1->SpinBox_DY->SetValue(myVal2); - Group1->SpinBox_DZ->SetValue(myVal3); - - myRot1 = myGeomRotation->GetRot1(); - myRot2 = myGeomRotation->GetRot2(); - myRot3 = myGeomRotation->GetRot3(); - - Group1->ComboBox1->insertItem("X"); - Group1->ComboBox1->insertItem("Y"); - Group1->ComboBox1->insertItem("Z"); - Group1->ComboBox2->insertItem("Y"); - Group1->ComboBox2->insertItem("Z"); - Group1->ComboBox3->insertItem("Z"); - - Group1->ComboBox1->setCurrentItem(myRot1 - 1); - - InitValues(); - SetEnabledValues(); - - /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - - connect(Group1->ComboBox1, SIGNAL(activated(int)), this, SLOT(ComboTextChanged())); - connect(Group1->ComboBox2, SIGNAL(activated(int)), this, SLOT(ComboTextChanged())); - connect(Group1->ComboBox3, SIGNAL(activated(int)), this, SLOT(ComboTextChanged())); - - connect(Group1->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(Group1->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(Group1->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group1->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group1->SpinBox_DY, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group1->SpinBox_DZ, SLOT(SetStep(double))); - - /* displays Dialog */ - Group1->show(); - this->show(); - - return; -} - - -//================================================================================= -// function : InitValues() -// purpose : -//================================================================================= -void KinematicGUI_RotationDlg::InitValues() -{ - if(myRot1 == 1) { - Group1->ComboBox2->changeItem("Y", 0); - Group1->ComboBox2->changeItem("Z", 1); - if(myRot2 == 2) { - Group1->ComboBox3->changeItem("Z", 0); - Group1->ComboBox2->setCurrentItem(0); - } - else if(myRot2 == 3) { - Group1->ComboBox3->changeItem("Y", 0); - Group1->ComboBox2->setCurrentItem(1); - } - } - else if(myRot1 == 2) { - Group1->ComboBox2->changeItem("X", 0); - Group1->ComboBox2->changeItem("Z", 1); - if(myRot2 == 1) { - Group1->ComboBox3->changeItem("Z", 0); - Group1->ComboBox2->setCurrentItem(0); - } - else if(myRot2 == 3) { - Group1->ComboBox3->changeItem("X", 0); - Group1->ComboBox2->setCurrentItem(1); - } - } - else if(myRot1 == 3) { - Group1->ComboBox2->changeItem("X", 0); - Group1->ComboBox2->changeItem("Y", 1); - if(myRot2 == 1) { - Group1->ComboBox3->changeItem("Y", 0); - Group1->ComboBox2->setCurrentItem(0); - } - else if(myRot2 == 2) { - Group1->ComboBox3->changeItem("X", 0); - Group1->ComboBox2->setCurrentItem(1); - } - } - return; -} - - -//================================================================================= -// function : InitValues() -// purpose : -//================================================================================= -void KinematicGUI_RotationDlg::SetEnabledValues() -{ - int type = myGeomContact->GetType(); - - if(type == 1 || type == 3 || type == 5 || type == 9) { //PIVOT || SLIDING PIVOT || PLANE || HELICOIDAL - Group1->TextLabel3->setEnabled(false); - Group1->ComboBox2->setEnabled(false); - Group1->TextLabel4->setEnabled(false); - Group1->SpinBox_DY->setEnabled(false); - Group1->TextLabel5->setEnabled(false); - Group1->ComboBox3->setEnabled(false); - Group1->TextLabel6->setEnabled(false); - Group1->SpinBox_DZ->setEnabled(false); - } - else if(type == 7) { //RECTILINEAR - Group1->TextLabel5->setEnabled(false); - Group1->ComboBox3->setEnabled(false); - Group1->TextLabel6->setEnabled(false); - Group1->SpinBox_DZ->setEnabled(false); - } - - return; -} - - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void KinematicGUI_RotationDlg::ClickOnOk() -{ - this->ClickOnApply(); - ClickOnCancel(); - return; -} - - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void KinematicGUI_RotationDlg::ClickOnApply() -{ - QAD_Application::getDesktop()->putInfo(tr("")); - - myKinematicGUI->SetRotation(myGeomContact, myRot1, myRot2, myRot3, - myVal1, myVal2, myVal3); - - return; -} - - -//================================================================================= -// function : ComboTextChanged() -// purpose : -//================================================================================= -void KinematicGUI_RotationDlg::ComboTextChanged() -{ - QComboBox* send = (QComboBox*)sender(); - - if(send == Group1->ComboBox1) { - myRot1 = Group1->ComboBox1->currentItem() + 1; - if(myRot1 == 1) { //X - myRot2 = 2; //Y - myRot3 = 3; //Z - } else if(myRot1 == 2) { //Y - myRot2 = 1;//X - myRot3 = 3;//Z - } else if(myRot1 == 3) { //Z - myRot2 = 1;//X - myRot3 = 2;//Y - } - } else if(send == Group1->ComboBox2) { - if(myRot1 == 1) { - if(Group1->ComboBox2->currentItem() == 0) { - myRot2 = 2; - myRot3 = 3; - } else if(Group1->ComboBox2->currentItem() == 1) { - myRot2 = 3; - myRot3 = 2; - } - } else if(myRot1 == 2) { - if(Group1->ComboBox2->currentItem() == 0) { - myRot2 = 1; - myRot3 = 3; - } else if(Group1->ComboBox2->currentItem() == 1) { - myRot2 = 3; - myRot3 = 1; - } - } else if(myRot1 == 3) { - if(Group1->ComboBox2->currentItem() == 0) { - myRot2 = 1; - myRot3 = 2; - } else if(Group1->ComboBox2->currentItem() == 1) { - myRot2 = 2; - myRot3 = 1; - } - } - } - - InitValues(); - return; -} - - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void KinematicGUI_RotationDlg::ValueChangedInSpinBox(double newValue) -{ - DlgRef_SpinBox* send = (DlgRef_SpinBox*)sender(); - - if(send == Group1->SpinBox_DX) - myVal1 = newValue; - else if(send == Group1->SpinBox_DY) - myVal2 = newValue; - else if(send == Group1->SpinBox_DZ) - myVal3 = newValue; - - return; -} diff --git a/src/KinematicGUI/KinematicGUI_RotationDlg.h b/src/KinematicGUI/KinematicGUI_RotationDlg.h deleted file mode 100644 index b8e55f0b0..000000000 --- a/src/KinematicGUI/KinematicGUI_RotationDlg.h +++ /dev/null @@ -1,77 +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 : KinematicGUI_RotationDlg.h -// Author : Damien COQUERET -// Module : GEOM -// $Header: - -#ifndef DIALOGBOX_ROTATION_H -#define DIALOGBOX_ROTATION_H - -#include "GEOMBase_Skeleton.h" -#include "KinematicGUI_3List3Spin.h" - -#include "KinematicGUI.h" - -//================================================================================= -// class : KinematicGUI_RotationDlg -// purpose : -//================================================================================= -class KinematicGUI_RotationDlg : public GEOMBase_Skeleton -{ - Q_OBJECT - -public: - KinematicGUI_RotationDlg(QWidget* parent = 0, const char* name = 0, KinematicGUI* theKinematicGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); - ~KinematicGUI_RotationDlg(); - -private: - void Init(); - void InitValues(); - void SetEnabledValues(); - - KinematicGUI* myKinematicGUI; - - GEOM::GEOM_Contact_var myGeomContact; - GEOM::GEOM_Rotation_var myGeomRotation; - - int myRot1; - int myRot2; - int myRot3; - - double myVal1; - double myVal2; - double myVal3; - - KinematicGUI_3List3Spin* Group1; - -private slots: - void ClickOnOk(); - void ClickOnApply(); - void ComboTextChanged(); - void ValueChangedInSpinBox(double newValue); - -}; - -#endif // DIALOGBOX_ROTATION_H diff --git a/src/KinematicGUI/KinematicGUI_Skeleton_QTD.cxx b/src/KinematicGUI/KinematicGUI_Skeleton_QTD.cxx index c190f954d..6ef5949e7 100644 --- a/src/KinematicGUI/KinematicGUI_Skeleton_QTD.cxx +++ b/src/KinematicGUI/KinematicGUI_Skeleton_QTD.cxx @@ -1,7 +1,7 @@ /**************************************************************************** ** Form implementation generated from reading ui file 'KinematicGUI_Skeleton_QTD.ui' ** -** Created: mer mar 3 16:54:07 2004 +** Created: mer avr 28 10:43:40 2004 ** by: The User Interface Compiler (uic) ** ** WARNING! All changes made in this file will be lost! diff --git a/src/KinematicGUI/KinematicGUI_Skeleton_QTD.h b/src/KinematicGUI/KinematicGUI_Skeleton_QTD.h index efc25e589..097836fde 100644 --- a/src/KinematicGUI/KinematicGUI_Skeleton_QTD.h +++ b/src/KinematicGUI/KinematicGUI_Skeleton_QTD.h @@ -1,7 +1,7 @@ /**************************************************************************** ** Form interface generated from reading ui file 'KinematicGUI_Skeleton_QTD.ui' ** -** Created: mer mar 3 16:54:07 2004 +** Created: mer avr 28 10:43:40 2004 ** by: The User Interface Compiler (uic) ** ** WARNING! All changes made in this file will be lost! diff --git a/src/KinematicGUI/KinematicGUI_TranslationDlg.cxx b/src/KinematicGUI/KinematicGUI_TranslationDlg.cxx deleted file mode 100644 index 2789eb17f..000000000 --- a/src/KinematicGUI/KinematicGUI_TranslationDlg.cxx +++ /dev/null @@ -1,198 +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 : KinematicGUI_TranslationDlg.cxx -// Author : Damien COQUERET -// Module : GEOM -// $Header: - -using namespace std; -#include "KinematicGUI_TranslationDlg.h" - -//================================================================================= -// class : KinematicGUI_TranslationDlg() -// purpose : Constructs a KinematicGUI_TranslationDlg 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. -//================================================================================= -KinematicGUI_TranslationDlg::KinematicGUI_TranslationDlg(QWidget* parent, const char* name, KinematicGUI* theKinematicGUI, SALOME_Selection* Sel, bool modal, WFlags fl) - :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) -{ - QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_CONTACT"))); - - setCaption(tr("GEOM_KTRANSLATION_TITLE")); - - /***************************************************************/ - GroupConstructors->setTitle(tr("GEOM_KTRANSLATION")); - RadioButton1->setPixmap(image0); - RadioButton2->close(TRUE); - RadioButton3->close(TRUE); - - Group1 = new DlgRef_3Spin(this, "Group1"); - Group1->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); - Group1->TextLabel1->setText(tr("GEOM_X")); - Group1->TextLabel2->setText(tr("GEOM_Y")); - Group1->TextLabel3->setText(tr("GEOM_Z")); - - Layout1->addWidget(Group1, 1, 0); - /***************************************************************/ - - /* Initialisation */ - myKinematicGUI = theKinematicGUI; - Init(); -} - - -//================================================================================= -// function : ~KinematicGUI_TranslationDlg() -// purpose : Destroys the object and frees any allocated resources -//================================================================================= -KinematicGUI_TranslationDlg::~KinematicGUI_TranslationDlg() -{ - /* no need to delete child widgets, Qt does it all for us */ -} - - - -//================================================================================= -// function : Init() -// purpose : -//================================================================================= -void KinematicGUI_TranslationDlg::Init() -{ - /* Get setting of step value from file configuration */ - QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); - double step = St.toDouble(); - - Group1->SpinBox_DX->RangeStepAndValidator(-99999.999, 99999.999, step, 3); - Group1->SpinBox_DY->RangeStepAndValidator(-99999.999, 99999.999, step, 3); - Group1->SpinBox_DZ->RangeStepAndValidator(-99999.999, 99999.999, step, 3); - - Standard_Boolean testResult; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); - myGeomContact = myGeomBase->ConvertIOinContact(IO, testResult); - if(!testResult) - ClickOnCancel(); - - myGeomTranslation = GEOM::GEOM_Translation::_narrow(myGeomContact->GetTranslation()); - - myValX = myGeomTranslation->GetValX(); - myValY = myGeomTranslation->GetValY(); - myValZ = myGeomTranslation->GetValZ(); - - Group1->SpinBox_DX->SetValue(myValX); - Group1->SpinBox_DY->SetValue(myValY); - Group1->SpinBox_DZ->SetValue(myValZ); - - SetEnabledValues(); - - /* signals and slots connections */ - connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); - connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); - - connect(Group1->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(Group1->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(Group1->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group1->SpinBox_DX, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group1->SpinBox_DY, SLOT(SetStep(double))); - connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group1->SpinBox_DZ, SLOT(SetStep(double))); - - /* displays Dialog */ - Group1->show(); - this->show(); - - return; -} - - -//================================================================================= -// function : InitValues() -// purpose : -//================================================================================= -void KinematicGUI_TranslationDlg::SetEnabledValues() -{ - int type = myGeomContact->GetType(); - - if(type == 2 || type == 3 || type == 6 || type == 9) { //SLIDE || SLIDING PIVOT || ANNULAR || HELICOIDAL - Group1->TextLabel2->setEnabled(false); - Group1->SpinBox_DY->setEnabled(false); - Group1->TextLabel3->setEnabled(false); - Group1->SpinBox_DZ->setEnabled(false); - } - else if(type == 7) { //RECTILINEAR - Group1->TextLabel2->setEnabled(false); - Group1->SpinBox_DY->setEnabled(false); - } - else if(type == 5 || type == 8) { //PLANE || PONCTUAL - Group1->TextLabel1->setEnabled(false); - Group1->SpinBox_DX->setEnabled(false); - } - - return; -} - - -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void KinematicGUI_TranslationDlg::ClickOnOk() -{ - this->ClickOnApply(); - ClickOnCancel(); - return ; -} - - -//================================================================================= -// function : ClickOnApply() -// purpose : -//================================================================================= -void KinematicGUI_TranslationDlg::ClickOnApply() -{ - QAD_Application::getDesktop()->putInfo(tr("")); - - myKinematicGUI->SetTranslation(myGeomContact, myValX, myValY, myValZ); - - return; -} - - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void KinematicGUI_TranslationDlg::ValueChangedInSpinBox(double newValue) -{ - DlgRef_SpinBox* send = (DlgRef_SpinBox*)sender(); - - if(send == Group1->SpinBox_DX) - myValX = newValue; - else if(send == Group1->SpinBox_DY) - myValY = newValue; - else if(send == Group1->SpinBox_DZ) - myValZ = newValue; - - return; -} diff --git a/src/KinematicGUI/KinematicGUI_TranslationDlg.h b/src/KinematicGUI/KinematicGUI_TranslationDlg.h deleted file mode 100644 index 6045e0578..000000000 --- a/src/KinematicGUI/KinematicGUI_TranslationDlg.h +++ /dev/null @@ -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 : KinematicGUI_TranslationDlg.h -// Author : Damien COQUERET -// Module : GEOM -// $Header: - -#ifndef DIALOGBOX_TRANSLATION_H -#define DIALOGBOX_TRANSLATION_H - -#include "GEOMBase_Skeleton.h" -#include "DlgRef_3Spin.h" - -#include "KinematicGUI.h" - -//================================================================================= -// class : KinematicGUI_TranslationDlg -// purpose : -//================================================================================= -class KinematicGUI_TranslationDlg : public GEOMBase_Skeleton -{ - Q_OBJECT - -public: - KinematicGUI_TranslationDlg(QWidget* parent = 0, const char* name = 0, KinematicGUI* theKinematicGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); - ~KinematicGUI_TranslationDlg(); - -private: - void Init(); - void SetEnabledValues(); - - KinematicGUI* myKinematicGUI; - - GEOM::GEOM_Contact_var myGeomContact; - GEOM::GEOM_Translation_var myGeomTranslation; - - double myValX; - double myValY; - double myValZ; - - DlgRef_3Spin* Group1; - -private slots: - void ClickOnOk(); - void ClickOnApply(); - void ValueChangedInSpinBox(double newValue); - -}; - -#endif // DIALOGBOX_TRANSLATION_H diff --git a/src/KinematicGUI/Makefile.in b/src/KinematicGUI/Makefile.in index fd4ac856f..23a58ff46 100644 --- a/src/KinematicGUI/Makefile.in +++ b/src/KinematicGUI/Makefile.in @@ -41,41 +41,27 @@ EXPORT_HEADERS= LIB = libKinematicGUI.la LIB_SRC = KinematicGUI.cxx \ - KinematicGUI_3Sel1List_QTD.cxx \ - KinematicGUI_3Sel1Spin_QTD.cxx \ - KinematicGUI_3List3Spin_QTD.cxx \ - KinematicGUI_12Spin_QTD.cxx \ KinematicGUI_Skeleton_QTD.cxx \ - KinematicGUI_Anim_QTD.cxx \ - KinematicGUI_3Sel1Spin.cxx \ - KinematicGUI_3List3Spin.cxx \ + KinematicGUI_12Spin_QTD.cxx \ KinematicGUI_12Spin.cxx \ KinematicGUI_ContactDlg.cxx \ - KinematicGUI_ContactHDlg.cxx \ KinematicGUI_PositionDlg.cxx \ - KinematicGUI_RotationDlg.cxx \ - KinematicGUI_TranslationDlg.cxx \ - KinematicGUI_AnimDlg.cxx \ - KinematicGUI_AnimationDlg.cxx + KinematicGUI_RangeDlg.cxx \ + KinematicGUI_AnimationDlg.cxx \ + KinematicGUI_AnimValuesDlg.cxx \ + KinematicGUI_AnimDlg.cxx LIB_MOC = \ KinematicGUI.h \ - KinematicGUI_3Sel1List_QTD.h \ - KinematicGUI_3Sel1Spin_QTD.h \ - KinematicGUI_3List3Spin_QTD.h \ - KinematicGUI_12Spin_QTD.h \ KinematicGUI_Skeleton_QTD.h \ - KinematicGUI_Anim_QTD.h \ - KinematicGUI_3Sel1Spin.h \ - KinematicGUI_3List3Spin.h \ + KinematicGUI_12Spin_QTD.h \ KinematicGUI_12Spin.h \ KinematicGUI_ContactDlg.h \ - KinematicGUI_ContactHDlg.h \ KinematicGUI_PositionDlg.h \ - KinematicGUI_RotationDlg.h \ - KinematicGUI_TranslationDlg.h \ - KinematicGUI_AnimDlg.h \ - KinematicGUI_AnimationDlg.h + KinematicGUI_RangeDlg.h \ + KinematicGUI_AnimationDlg.h \ + KinematicGUI_AnimValuesDlg.h \ + KinematicGUI_AnimDlg.h LIB_CLIENT_IDL = GEOM_Kinematic.idl diff --git a/src/KinematicGUI/UIFiles/KinematicGUI_3List3Spin_QTD.ui b/src/KinematicGUI/UIFiles/DlgRef_3Spin_QTD.ui similarity index 58% rename from src/KinematicGUI/UIFiles/KinematicGUI_3List3Spin_QTD.ui rename to src/KinematicGUI/UIFiles/DlgRef_3Spin_QTD.ui index 24e8d0e1c..96f6b4dfb 100644 --- a/src/KinematicGUI/UIFiles/KinematicGUI_3List3Spin_QTD.ui +++ b/src/KinematicGUI/UIFiles/DlgRef_3Spin_QTD.ui @@ -1,25 +1,19 @@ -KinematicGUI_3List3Spin_QTD +DlgRef_3Spin_QTD - KinematicGUI_3List3Spin_QTD + DlgRef_3Spin_QTD 0 0 - 279 + 124 111 - - - 100 - 0 - - - KinematicGUI_3List3Spin_QTD + DlgRef_3Spin_QTD @@ -62,42 +56,9 @@ 6 - + - TextLabel2 - - - - 0 - 0 - 0 - 0 - - - - TL2 - - - - - Spacer7 - - - Vertical - - - Expanding - - - - 0 - 100 - - - - - - SpinBox1 + SpinBox2 @@ -108,23 +69,24 @@ - + - TextLabel4 + Spacer1 - - - 0 - 0 - 0 - 0 - + + Vertical - - TL4 + + Expanding - - + + + 0 + 16 + + + + TextLabel3 @@ -140,6 +102,32 @@ TL3 + + + SpinBox1 + + + + 7 + 0 + 0 + 0 + + + + + + SpinBox3 + + + + 7 + 0 + 0 + 0 + + + TextLabel1 @@ -156,48 +144,9 @@ TL1 - + - ComboBox3 - - - - 7 - 0 - 0 - 0 - - - - - - SpinBox2 - - - - 7 - 0 - 0 - 0 - - - - - - SpinBox3 - - - - 7 - 0 - 0 - 0 - - - - - - TextLabel6 + TextLabel2 @@ -208,49 +157,7 @@ - TL6 - - - - - ComboBox1 - - - - 7 - 0 - 0 - 0 - - - - - - ComboBox2 - - - - 7 - 0 - 0 - 0 - - - - - - TextLabel5 - - - - 0 - 0 - 0 - 0 - - - - TL5 + TL2 diff --git a/src/KinematicGUI/UIFiles/KinematicGUI_3Sel1List_QTD.ui b/src/KinematicGUI/UIFiles/KinematicGUI_3Sel1List_QTD.ui index e38d3d6cc..a253f9efd 100644 --- a/src/KinematicGUI/UIFiles/KinematicGUI_3Sel1List_QTD.ui +++ b/src/KinematicGUI/UIFiles/KinematicGUI_3Sel1List_QTD.ui @@ -8,8 +8,8 @@ 0 0 - 129 - 145 + 329 + 226 @@ -56,23 +56,72 @@ 6 - + - Spacer5 + LineEdit3 - - Vertical + + + + TextLabel4 - - Expanding + + + 0 + 0 + 0 + 0 + - - - 0 - 90 - + + TL4 - + + + + Layout3 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel5 + + + + 0 + 0 + 0 + 0 + + + + TL5 + + + + + SpinBox1 + + + + 7 + 0 + 0 + 0 + + + + + PushButton2 @@ -89,6 +138,27 @@ + + + LineEdit1 + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + TextLabel1 @@ -105,41 +175,9 @@ TL1 - + - TextLabel4 - - - - 0 - 0 - 0 - 0 - - - - TL4 - - - - - LineEdit1 - - - - - PushButton1 - - - - 0 - 0 - 0 - 0 - - - - + LineEdit2 @@ -158,6 +196,68 @@ TL3 + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + ComboBox1 + + + + 7 + 0 + 0 + 0 + + + + + + + + Spacer5 + + + Vertical + + + Expanding + + + + 0 + 90 + + + PushButton3 @@ -174,45 +274,6 @@ - - - ComboBox1 - - - - 7 - 0 - 0 - 0 - - - - - - LineEdit2 - - - - - LineEdit3 - - - - - TextLabel2 - - - - 0 - 0 - 0 - 0 - - - - TL2 - - diff --git a/src/KinematicGUI/UIFiles/KinematicGUI_AnimValues_QTD.cxx b/src/KinematicGUI/UIFiles/KinematicGUI_AnimValues_QTD.cxx new file mode 100644 index 000000000..7c3d4c0ff --- /dev/null +++ b/src/KinematicGUI/UIFiles/KinematicGUI_AnimValues_QTD.cxx @@ -0,0 +1,208 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'KinematicGUI_AnimValues_QTD.ui' +** +** Created: lun mai 3 09:48:44 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "KinematicGUI_AnimValues_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a KinematicGUI_AnimValues_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +KinematicGUI_AnimValues_QTD::KinematicGUI_AnimValues_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "KinematicGUI_AnimValues_QTD" ); + resize( 469, 249 ); + setCaption( trUtf8( "KinematicGUI_AnimValues_QTD" ) ); + KinematicGUI_AnimValues_QTDLayout = new QGridLayout( this, 1, 1, 0, 6, "KinematicGUI_AnimValues_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 ); + + LayoutD = new QGridLayout( 0, 1, 1, 0, 6, "LayoutD"); + QSpacerItem* spacer = new QSpacerItem( 0, 50, QSizePolicy::Minimum, QSizePolicy::Expanding ); + LayoutD->addItem( spacer, 2, 1 ); + + LayoutC = new QGridLayout( 0, 1, 1, 0, 6, "LayoutC"); + + TextLabel8 = new QLabel( GroupBox1, "TextLabel8" ); + TextLabel8->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel8->sizePolicy().hasHeightForWidth() ) ); + TextLabel8->setText( trUtf8( "TL8" ) ); + + LayoutC->addWidget( TextLabel8, 5, 0 ); + + SpinBox1 = new QSpinBox( GroupBox1, "SpinBox1" ); + SpinBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox1->sizePolicy().hasHeightForWidth() ) ); + + LayoutC->addMultiCellWidget( SpinBox1, 1, 1, 1, 2 ); + + TextLabel9 = new QLabel( GroupBox1, "TextLabel9" ); + TextLabel9->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel9->sizePolicy().hasHeightForWidth() ) ); + TextLabel9->setText( trUtf8( "TL9" ) ); + + LayoutC->addWidget( TextLabel9, 6, 0 ); + + SpinBox6 = new QSpinBox( GroupBox1, "SpinBox6" ); + SpinBox6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox6->sizePolicy().hasHeightForWidth() ) ); + + LayoutC->addWidget( SpinBox6, 3, 3 ); + + SpinBox2 = new QSpinBox( GroupBox1, "SpinBox2" ); + SpinBox2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox2->sizePolicy().hasHeightForWidth() ) ); + + LayoutC->addWidget( SpinBox2, 1, 3 ); + + TextLabel4 = new QLabel( GroupBox1, "TextLabel4" ); + TextLabel4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel4->sizePolicy().hasHeightForWidth() ) ); + TextLabel4->setText( trUtf8( "TL4" ) ); + + LayoutC->addWidget( TextLabel4, 1, 0 ); + + SpinBox12 = new QSpinBox( GroupBox1, "SpinBox12" ); + SpinBox12->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox12->sizePolicy().hasHeightForWidth() ) ); + + LayoutC->addWidget( SpinBox12, 6, 3 ); + + SpinBox9 = new QSpinBox( GroupBox1, "SpinBox9" ); + SpinBox9->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox9->sizePolicy().hasHeightForWidth() ) ); + + LayoutC->addMultiCellWidget( SpinBox9, 5, 5, 1, 2 ); + + SpinBox5 = new QSpinBox( GroupBox1, "SpinBox5" ); + SpinBox5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox5->sizePolicy().hasHeightForWidth() ) ); + + LayoutC->addMultiCellWidget( SpinBox5, 3, 3, 1, 2 ); + + TextLabel5 = new QLabel( GroupBox1, "TextLabel5" ); + TextLabel5->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel5->sizePolicy().hasHeightForWidth() ) ); + TextLabel5->setText( trUtf8( "TL5" ) ); + + LayoutC->addWidget( TextLabel5, 2, 0 ); + + TextLabel3 = new QLabel( GroupBox1, "TextLabel3" ); + TextLabel3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, TextLabel3->sizePolicy().hasHeightForWidth() ) ); + TextLabel3->setText( trUtf8( "TL3" ) ); + TextLabel3->setAlignment( int( QLabel::AlignCenter ) ); + + LayoutC->addWidget( TextLabel3, 0, 3 ); + + SpinBox8 = new QSpinBox( GroupBox1, "SpinBox8" ); + SpinBox8->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox8->sizePolicy().hasHeightForWidth() ) ); + + LayoutC->addWidget( SpinBox8, 4, 3 ); + + TextLabel2 = new QLabel( GroupBox1, "TextLabel2" ); + TextLabel2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, TextLabel2->sizePolicy().hasHeightForWidth() ) ); + TextLabel2->setText( trUtf8( "TL2" ) ); + TextLabel2->setAlignment( int( QLabel::AlignCenter ) ); + + LayoutC->addWidget( TextLabel2, 0, 2 ); + + SpinBox7 = new QSpinBox( GroupBox1, "SpinBox7" ); + SpinBox7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox7->sizePolicy().hasHeightForWidth() ) ); + + LayoutC->addMultiCellWidget( SpinBox7, 4, 4, 1, 2 ); + + TextLabel6 = new QLabel( GroupBox1, "TextLabel6" ); + TextLabel6->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel6->sizePolicy().hasHeightForWidth() ) ); + TextLabel6->setText( trUtf8( "TL6" ) ); + + LayoutC->addWidget( TextLabel6, 3, 0 ); + + TextLabel10 = new QLabel( GroupBox1, "TextLabel10" ); + TextLabel10->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel10->sizePolicy().hasHeightForWidth() ) ); + QFont TextLabel10_font( TextLabel10->font() ); + TextLabel10_font.setBold( TRUE ); + TextLabel10->setFont( TextLabel10_font ); + TextLabel10->setText( trUtf8( "TL10" ) ); + + LayoutC->addMultiCellWidget( TextLabel10, 0, 0, 0, 1 ); + + SpinBox10 = new QSpinBox( GroupBox1, "SpinBox10" ); + SpinBox10->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox10->sizePolicy().hasHeightForWidth() ) ); + + LayoutC->addWidget( SpinBox10, 5, 3 ); + + TextLabel7 = new QLabel( GroupBox1, "TextLabel7" ); + TextLabel7->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel7->sizePolicy().hasHeightForWidth() ) ); + TextLabel7->setText( trUtf8( "TL7" ) ); + + LayoutC->addWidget( TextLabel7, 4, 0 ); + + SpinBox11 = new QSpinBox( GroupBox1, "SpinBox11" ); + SpinBox11->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox11->sizePolicy().hasHeightForWidth() ) ); + + LayoutC->addMultiCellWidget( SpinBox11, 6, 6, 1, 2 ); + + SpinBox4 = new QSpinBox( GroupBox1, "SpinBox4" ); + SpinBox4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox4->sizePolicy().hasHeightForWidth() ) ); + + LayoutC->addWidget( SpinBox4, 2, 3 ); + + SpinBox3 = new QSpinBox( GroupBox1, "SpinBox3" ); + SpinBox3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox3->sizePolicy().hasHeightForWidth() ) ); + + LayoutC->addMultiCellWidget( SpinBox3, 2, 2, 1, 2 ); + + LayoutD->addLayout( LayoutC, 1, 1 ); + + ListBox1 = new QListBox( GroupBox1, "ListBox1" ); + ListBox1->insertItem( trUtf8( "New Item" ) ); + ListBox1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)7, 0, 0, ListBox1->sizePolicy().hasHeightForWidth() ) ); + + LayoutD->addMultiCellWidget( ListBox1, 1, 2, 0, 0 ); + + LayoutB = new QGridLayout( 0, 1, 1, 0, 6, "LayoutB"); + + LineEdit1 = new QLineEdit( GroupBox1, "LineEdit1" ); + + LayoutB->addWidget( LineEdit1, 0, 2 ); + + PushButton1 = new QPushButton( GroupBox1, "PushButton1" ); + PushButton1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, PushButton1->sizePolicy().hasHeightForWidth() ) ); + PushButton1->setText( trUtf8( "" ) ); + + LayoutB->addWidget( PushButton1, 0, 1 ); + + TextLabel1 = new QLabel( GroupBox1, "TextLabel1" ); + TextLabel1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)0, (QSizePolicy::SizeType)0, 0, 0, TextLabel1->sizePolicy().hasHeightForWidth() ) ); + TextLabel1->setText( trUtf8( "TL1" ) ); + + LayoutB->addWidget( TextLabel1, 0, 0 ); + + LayoutD->addMultiCellLayout( LayoutB, 0, 0, 0, 1 ); + + GroupBox1Layout->addLayout( LayoutD, 0, 0 ); + + KinematicGUI_AnimValues_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +KinematicGUI_AnimValues_QTD::~KinematicGUI_AnimValues_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/KinematicGUI/UIFiles/KinematicGUI_AnimValues_QTD.h b/src/KinematicGUI/UIFiles/KinematicGUI_AnimValues_QTD.h new file mode 100644 index 000000000..02ee01e1b --- /dev/null +++ b/src/KinematicGUI/UIFiles/KinematicGUI_AnimValues_QTD.h @@ -0,0 +1,69 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'KinematicGUI_AnimValues_QTD.ui' +** +** Created: lun mai 3 09:48:44 2004 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef KINEMATICGUI_ANIMVALUES_QTD_H +#define KINEMATICGUI_ANIMVALUES_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QLineEdit; +class QListBox; +class QListBoxItem; +class QPushButton; +class QSpinBox; + +class KinematicGUI_AnimValues_QTD : public QWidget +{ + Q_OBJECT + +public: + KinematicGUI_AnimValues_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~KinematicGUI_AnimValues_QTD(); + + QGroupBox* GroupBox1; + QLabel* TextLabel8; + QSpinBox* SpinBox1; + QLabel* TextLabel9; + QSpinBox* SpinBox6; + QSpinBox* SpinBox2; + QLabel* TextLabel4; + QSpinBox* SpinBox12; + QSpinBox* SpinBox9; + QSpinBox* SpinBox5; + QLabel* TextLabel5; + QLabel* TextLabel3; + QSpinBox* SpinBox8; + QLabel* TextLabel2; + QSpinBox* SpinBox7; + QLabel* TextLabel6; + QLabel* TextLabel10; + QSpinBox* SpinBox10; + QLabel* TextLabel7; + QSpinBox* SpinBox11; + QSpinBox* SpinBox4; + QSpinBox* SpinBox3; + QListBox* ListBox1; + QLineEdit* LineEdit1; + QPushButton* PushButton1; + QLabel* TextLabel1; + + +protected: + QGridLayout* KinematicGUI_AnimValues_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* LayoutD; + QGridLayout* LayoutC; + QGridLayout* LayoutB; +}; + +#endif // KINEMATICGUI_ANIMVALUES_QTD_H diff --git a/src/KinematicGUI/UIFiles/KinematicGUI_AnimValues_QTD.ui b/src/KinematicGUI/UIFiles/KinematicGUI_AnimValues_QTD.ui new file mode 100644 index 000000000..1927cc58f --- /dev/null +++ b/src/KinematicGUI/UIFiles/KinematicGUI_AnimValues_QTD.ui @@ -0,0 +1,481 @@ + +KinematicGUI_AnimValues_QTD + + + KinematicGUI_AnimValues_QTD + + + + 0 + 0 + 426 + 249 + + + + KinematicGUI_AnimValues_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + + + + + unnamed + + + 11 + + + 6 + + + + LayoutD + + + + unnamed + + + 0 + + + 6 + + + + Spacer1 + + + Vertical + + + Expanding + + + + 0 + 50 + + + + + + LayoutC + + + + unnamed + + + 0 + + + 6 + + + + TextLabel8 + + + + 0 + 0 + 0 + 0 + + + + TL8 + + + + + SpinBox1 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel9 + + + + 0 + 0 + 0 + 0 + + + + TL9 + + + + + SpinBox6 + + + + 7 + 0 + 0 + 0 + + + + + + SpinBox2 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel4 + + + + 0 + 0 + 0 + 0 + + + + TL4 + + + + + SpinBox12 + + + + 7 + 0 + 0 + 0 + + + + + + SpinBox9 + + + + 7 + 0 + 0 + 0 + + + + + + SpinBox5 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel5 + + + + 0 + 0 + 0 + 0 + + + + TL5 + + + + + TextLabel3 + + + + 7 + 0 + 0 + 0 + + + + TL3 + + + AlignCenter + + + + + SpinBox8 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel2 + + + + 7 + 0 + 0 + 0 + + + + TL2 + + + AlignCenter + + + + + SpinBox7 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel6 + + + + 0 + 0 + 0 + 0 + + + + TL6 + + + + + TextLabel10 + + + + 0 + 0 + 0 + 0 + + + + + 1 + + + + TL10 + + + + + SpinBox10 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel7 + + + + 0 + 0 + 0 + 0 + + + + TL7 + + + + + SpinBox11 + + + + 7 + 0 + 0 + 0 + + + + + + SpinBox4 + + + + 7 + 0 + 0 + 0 + + + + + + SpinBox3 + + + + 7 + 0 + 0 + 0 + + + + + + + + + New Item + + + + ListBox1 + + + + 5 + 7 + 0 + 0 + + + + + + LayoutB + + + + unnamed + + + 0 + + + 6 + + + + LineEdit1 + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + + + + + + + + diff --git a/src/KinematicGUI/UIFiles/KinematicGUI_Anim_QTD.ui b/src/KinematicGUI/UIFiles/KinematicGUI_Anim_QTD.ui index c66425a13..54843955f 100644 --- a/src/KinematicGUI/UIFiles/KinematicGUI_Anim_QTD.ui +++ b/src/KinematicGUI/UIFiles/KinematicGUI_Anim_QTD.ui @@ -8,8 +8,8 @@ 0 0 - 334 - 121 + 349 + 250 @@ -44,7 +44,7 @@ - Layout1 + LayoutA @@ -56,7 +56,108 @@ 6 - + + + LayoutD + + + + unnamed + + + 0 + + + 6 + + + + PushButton7 + + + + 0 + 0 + 0 + 0 + + + + + + + + + CheckButton1 + + + + + + + + + + Slider1 + + + Horizontal + + + + + LayoutB + + + + unnamed + + + 0 + + + 6 + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + LineEdit1 + + + + + Spacer5 @@ -69,13 +170,13 @@ 0 - 156 + 212 - + - Layout2 + LayoutC @@ -88,54 +189,6 @@ 6 - - PushButton3 - - - - 0 - 0 - 0 - 0 - - - - - - - - - PushButton5 - - - - 0 - 0 - 0 - 0 - - - - - - - - - PushButton2 - - - - 0 - 0 - 0 - 0 - - - - - - - PushButton4 @@ -151,7 +204,7 @@ - + PushButton6 @@ -169,7 +222,7 @@ - PushButton1 + PushButton2 @@ -183,41 +236,9 @@ - - - - - Slider1 - - - Horizontal - - - - - Layout3 - - - - unnamed - - - 0 - - - 6 - - + - CheckButton1 - - - - - - - - PushButton7 + PushButton5 @@ -231,9 +252,17 @@ - + - CheckButton2 + PushButton3 + + + + 0 + 0 + 0 + 0 + diff --git a/src/KinematicGUI/UIFiles/ui_to_cxx b/src/KinematicGUI/UIFiles/ui_to_cxx index 575739b16..88b89aeb4 100755 --- a/src/KinematicGUI/UIFiles/ui_to_cxx +++ b/src/KinematicGUI/UIFiles/ui_to_cxx @@ -15,8 +15,11 @@ #uic -o KinematicGUI_2Sel2Spin2Check_QTD.h KinematicGUI_2Sel2Spin2Check_QTD.ui #uic -o KinematicGUI_2Sel2Spin2Check_QTD.cxx -impl KinematicGUI_2Sel2Spin2Check_QTD.h KinematicGUI_2Sel2Spin2Check_QTD.ui -uic -o KinematicGUI_Anim_QTD.h KinematicGUI_Anim_QTD.ui -uic -o KinematicGUI_Anim_QTD.cxx -impl KinematicGUI_Anim_QTD.h KinematicGUI_Anim_QTD.ui +#uic -o KinematicGUI_Anim_QTD.h KinematicGUI_Anim_QTD.ui +#uic -o KinematicGUI_Anim_QTD.cxx -impl KinematicGUI_Anim_QTD.h KinematicGUI_Anim_QTD.ui + +uic -o KinematicGUI_AnimValues_QTD.h KinematicGUI_AnimValues_QTD.ui +uic -o KinematicGUI_AnimValues_QTD.cxx -impl KinematicGUI_AnimValues_QTD.h KinematicGUI_AnimValues_QTD.ui #uic -o KinematicGUI_Skeleton_QTD.h KinematicGUI_Skeleton_QTD.ui #uic -o KinematicGUI_Skeleton_QTD.cxx -impl KinematicGUI_Skeleton_QTD.h KinematicGUI_Skeleton_QTD.ui diff --git a/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx b/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx index fc9feffb6..838f140e7 100644 --- a/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx @@ -26,12 +26,15 @@ // Module : GEOM // $Header$ -using namespace std; #include "MeasureGUI_BndBoxDlg.h" #include #include +#include "utilities.h" + +using namespace std; + //================================================================================= // class : MeasureGUI_BndBoxDlg() // purpose : Constructs a MeasureGUI_BndBoxDlg which is a child of 'parent', with the diff --git a/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx b/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx index 691fd8694..2ddbc82f0 100644 --- a/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "MeasureGUI_CenterMassDlg.h" #include @@ -34,6 +33,10 @@ using namespace std; #include #include +#include "utilities.h" + +using namespace std; + //================================================================================= // class : MeasureGUI_CenterMassDlg() // purpose : Constructs a MeasureGUI_CenterMassDlg which is a child of 'parent', with the diff --git a/src/MeasureGUI/MeasureGUI_CheckShapeDlg.cxx b/src/MeasureGUI/MeasureGUI_CheckShapeDlg.cxx index fa6d776ca..407824be7 100644 --- a/src/MeasureGUI/MeasureGUI_CheckShapeDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_CheckShapeDlg.cxx @@ -26,13 +26,16 @@ // Module : GEOM // $Header$ -using namespace std; #include "MeasureGUI_CheckShapeDlg.h" #include #include +#include "utilities.h" + +using namespace std; + //================================================================================= // class : MeasureGUI_CheckShapeDlg() // purpose : Constructs a MeasureGUI_CheckShapeDlg which is a child of 'parent', with the diff --git a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx index d527eee7f..f33a3415b 100644 --- a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "MeasureGUI_DistanceDlg.h" #include "QAD_RightFrame.h" @@ -42,6 +41,10 @@ using namespace std; #include #include +#include "utilities.h" + +using namespace std; + //================================================================================= // class : MeasureGUI_DistanceDlg() // purpose : Constructs a MeasureGUI_DistanceDlg which is a child of 'parent', with the @@ -322,7 +325,9 @@ void MeasureGUI_DistanceDlg::MakeDistanceSimulationAndDisplay(const TopoDS_Shape gp_Pln gp_P = gce_MP.Value(); Handle(Geom_Plane) P = new Geom_Plane(gp_P); - Handle(AIS_LengthDimension) Distance = new AIS_LengthDimension(V1, V2, P, Dist, TCollection_ExtendedString(strdup(S))); + char* aCopyS = CORBA::string_dup(S); + Handle(AIS_LengthDimension) Distance = new AIS_LengthDimension(V1, V2, P, Dist, TCollection_ExtendedString(aCopyS)); + delete(aCopyS); GroupC1->LineEdit3->setText(S); diff --git a/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx b/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx index e8c796ad8..8ceaea053 100644 --- a/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx @@ -25,13 +25,16 @@ // Author : Lucien PIGNOLONI // Module : GEOM -using namespace std; #include "MeasureGUI_InertiaDlg.h" #include #include #include +#include "utilities.h" + +using namespace std; + //================================================================================= // class : MeasureGUI_InertiaDlg() // purpose : Constructs a MeasureGUI_InertiaDlg which is a child of 'parent', with the diff --git a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx index 93f2da25f..04b810b89 100644 --- a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "MeasureGUI_MaxToleranceDlg.h" #include @@ -35,6 +34,10 @@ using namespace std; #include #include +#include "utilities.h" + +using namespace std; + //================================================================================= // class : MeasureGUI_MaxToleranceDlg() // purpose : Constructs a MeasureGUI_MaxToleranceDlg which is a child of 'parent', with the diff --git a/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx b/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx index 934551b84..ede6403fa 100644 --- a/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "MeasureGUI_PropertiesDlg.h" #include @@ -34,6 +33,10 @@ using namespace std; #include #include +#include "utilities.h" + +using namespace std; + //================================================================================= // class : MeasureGUI_PropertiesDlg() // purpose : Constructs a MeasureGUI_PropertiesDlg which is a child of 'parent', with the diff --git a/src/MeasureGUI/MeasureGUI_Skeleton.h b/src/MeasureGUI/MeasureGUI_Skeleton.h index 015951864..299c51a85 100644 --- a/src/MeasureGUI/MeasureGUI_Skeleton.h +++ b/src/MeasureGUI/MeasureGUI_Skeleton.h @@ -39,6 +39,7 @@ #include #include #include +#include class MeasureGUI_Skeleton : public MeasureGUI_Skeleton_QTD { diff --git a/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx b/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx index 6c3f1a91c..3fddd8492 100644 --- a/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "MeasureGUI_WhatisDlg.h" #include @@ -39,6 +38,10 @@ using namespace std; #include +#include "utilities.h" + +using namespace std; + //================================================================================= // class : MeasureGUI_WhatisDlg() // purpose : Constructs a MeasureGUI_WhatisDlg which is a child of 'parent', with the @@ -216,11 +219,11 @@ void MeasureGUI_WhatisDlg::CalculateWhatis(const TopoDS_Shape& S) if ( S.ShapeType() == TopAbs_EDGE ) { if( BRep_Tool::Degenerated(TopoDS::Edge(S)) ) { - Astr = Astr + " " + strdup(SelectedName.latin1()) + " is a degenerated edge \n"; + Astr = Astr + " " + CORBA::string_dup(SelectedName.latin1()) + " is a degenerated edge \n"; } } - Astr = Astr + " Number of shapes in " + strdup(SelectedName.latin1()) + " : \n"; + Astr = Astr + " Number of shapes in " + CORBA::string_dup(SelectedName.latin1()) + " : \n"; try { int iType, nbTypes [TopAbs_SHAPE]; diff --git a/src/OBJECT/GEOM_AISShape.jxx b/src/OBJECT/GEOM_AISShape.jxx index 8f66299fd..c3d2a67e9 100644 --- a/src/OBJECT/GEOM_AISShape.jxx +++ b/src/OBJECT/GEOM_AISShape.jxx @@ -38,4 +38,4 @@ #endif #ifndef _Prs3d_Presentation_HeaderFile #include -#endif \ No newline at end of file +#endif diff --git a/src/OperationGUI/OperationGUI_ChamferDlg.cxx b/src/OperationGUI/OperationGUI_ChamferDlg.cxx index 3698d3ffa..b4a171f40 100644 --- a/src/OperationGUI/OperationGUI_ChamferDlg.cxx +++ b/src/OperationGUI/OperationGUI_ChamferDlg.cxx @@ -32,6 +32,8 @@ using namespace std; #include "DisplayGUI.h" #include "QAD_MessageBox.h" +#include +#include #include #include #include diff --git a/src/OperationGUI/OperationGUI_FilletDlg.cxx b/src/OperationGUI/OperationGUI_FilletDlg.cxx index d9da9cdae..6f81cae0f 100644 --- a/src/OperationGUI/OperationGUI_FilletDlg.cxx +++ b/src/OperationGUI/OperationGUI_FilletDlg.cxx @@ -32,6 +32,7 @@ using namespace std; #include "DisplayGUI.h" #include "QAD_MessageBox.h" +#include #include #include #include diff --git a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx index 641feabfe..f9af4748d 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "PrimitiveGUI_ConeDlg.h" #include @@ -36,6 +35,10 @@ using namespace std; #include #include "QAD_Config.h" +#include "utilities.h" + +using namespace std; + //================================================================================= // class : PrimitiveGUI_ConeDlg() // purpose : Constructs a PrimitiveGUI_ConeDlg which is a child of 'parent', with the diff --git a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx index 4eaf7d976..d12e8dc42 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "PrimitiveGUI_CylinderDlg.h" #include @@ -35,6 +34,10 @@ using namespace std; #include #include "QAD_Config.h" +#include "utilities.h" + +using namespace std; + //================================================================================= // class : PrimitiveGUI_CylinderDlg() // purpose : Constructs a PrimitiveGUI_CylinderDlg which is a child of 'parent', with the diff --git a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx index 3a2c44ff9..90aa6db8b 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "PrimitiveGUI_TorusDlg.h" #include @@ -34,6 +33,10 @@ using namespace std; #include #include "QAD_Config.h" +#include "utilities.h" + +using namespace std; + //================================================================================= // class : PrimitiveGUI_TorusDlg() // purpose : Constructs a PrimitiveGUI_TorusDlg which is a child of 'parent', with the diff --git a/src/RepairGUI/RepairGUI.cxx b/src/RepairGUI/RepairGUI.cxx index b13756881..ab9be2e20 100644 --- a/src/RepairGUI/RepairGUI.cxx +++ b/src/RepairGUI/RepairGUI.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header: -using namespace std; #include "RepairGUI.h" #include "QAD_RightFrame.h" @@ -38,6 +37,10 @@ using namespace std; #include "RepairGUI_SuppressFacesDlg.h" // Method SUPPRESS FACES #include "RepairGUI_SuppressHoleDlg.h" // Method SUPPRESS HOLE +#include "utilities.h" + +using namespace std; + //======================================================================= // function : RepairGUI() // purpose : Constructor diff --git a/src/RepairGUI/RepairGUI_OrientationDlg.cxx b/src/RepairGUI/RepairGUI_OrientationDlg.cxx index 6571d351c..fd88ba8ab 100644 --- a/src/RepairGUI/RepairGUI_OrientationDlg.cxx +++ b/src/RepairGUI/RepairGUI_OrientationDlg.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "RepairGUI_OrientationDlg.h" #include @@ -36,6 +35,10 @@ using namespace std; #include #include +#include "utilities.h" + +using namespace std; + //================================================================================= // class : RepairGUI_OrientationDlg() // purpose : Constructs a RepairGUI_OrientationDlg which is a child of 'parent', with the diff --git a/src/SKETCHER/GEOM_Sketcher.cxx b/src/SKETCHER/GEOM_Sketcher.cxx deleted file mode 100644 index 7734c2b8f..000000000 --- a/src/SKETCHER/GEOM_Sketcher.cxx +++ /dev/null @@ -1,1389 +0,0 @@ -// GEOM SKETCHER : basic sketcher -// -// 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 : GEOM_Sketcher.cxx -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -using namespace std; -#include "GEOM_Sketcher.h" -#include "utilities.h" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include - -/*! - \class GEOM_Sketcher GEOM_Sketcher.h - \brief ... -*/ - -Standard_Real resol = 1.0; - -/*! - Constructor. -*/ -Sketch::Sketch() -{ - -} - -/*! - Destructor. -*/ -Sketch::~Sketch() -{ - -} - - -/*! - Constructor. - - \param V3d_Viewer -*/ -Sketch::Sketch(const Handle(V3d_Viewer)& aViewer) : -myInteractiveContext(new AIS_InteractiveContext(aViewer)), -myAxisColor(Quantity_Color(Quantity_NOC_YELLOW)), -myCurrentColor(Quantity_Color(Quantity_NOC_GREEN)), -myWireColor(Quantity_Color(Quantity_NOC_RED)) -{ - Init(); -} - -/*! - Constructor. - - \param V3d_Viewer - \param Quantity_Color - \param Quantity_Color - \param Quantity_Color -*/ -Sketch::Sketch(const Handle(V3d_Viewer)& aViewer, - const Quantity_Color& anAxisColor, - const Quantity_Color& aCurrentColor, - const Quantity_Color& aWireColor): -myInteractiveContext(new AIS_InteractiveContext(aViewer)), -myAxisColor(anAxisColor), -myCurrentColor(aCurrentColor), -myWireColor(aWireColor) -{ - Init(); -} - -/*! - Build the current edge in a graphic mode. - The first signature with view coordinates is used to connect to the move event from the user interface. - The second signature is used when the current point is known by 2d real coordinates. - - \param Xp - \param Yp - \param V3d_View -*/ -void Sketch::MakeCurrentEdge(const Standard_Integer Xp , - const Standard_Integer Yp , - const Handle(V3d_View)& aView ) -{ - /* 3d coordinates of the picked point */ - Standard_Real Xv,Yv,Zv; - aView->Convert(Xp,Yp,Xv,Yv,Zv); - /* computation of real 2d coordinates in plane of sketch */ - Standard_Real Vx,Vy,Vz; - aView->Proj(Vx,Vy,Vz); - gp_Dir D(Vx,Vy,Vz); - gp_Pnt P(Xv,Yv,Zv); - gp_Lin L(P,D); - Standard_Real X,Y; - gp_Pnt Sol; - IntAna_IntConicQuad Int(L,myPlane->Pln(),Precision::Angular()); - if (Int.IsDone()) { - if (!Int.IsParallel()) { - if (Int.NbPoints() > 0 ) { - Sol = Int.Point(1); - ElSLib::Parameters(myPlane->Pln(),Sol,X,Y); - } - } - } - MakeCurrentEdge(X,Y); -} - -/*! - Build the current edge in a graphic mode. - The first signature with view coordinates is used to connect to the move event from the user interface. - The second signature is used when the current point is known by 2d real coordinates. - - \param X - \param Y -*/ -void Sketch::MakeCurrentEdge(const Standard_Real X, const Standard_Real Y) -{ - /* Create the current edge depending on the active mode */ - switch (myCurrentStatus) { - case BEGIN_SKETCH: - myCurrentEdge = BRepBuilderAPI_MakeVertex(ElCLib::To3d(myPlane->Pln().Position().Ax2(),gp_Pnt2d(X,Y))); - break; - case SEGMENT: - MakeCurrentSegment(X,Y); - break; - case ARC_CHORD: - MakeCurrentSegment(X,Y); - break; - case ARC_CHORD_END: - MakeCurrentArc(X,Y); - break; - } - DisplayCurrentEdge(); -} - -/*! - Build the current edge in a graphic mode. - Function to connect to the input event from the user interface. -*/ -void Sketch::ValidateEdge() -{ - gp_Pnt pt; - gp_Pnt2d pt2d; - switch (myCurrentStatus) { - case BEGIN_SKETCH: - { - myFirstPointSketch = TopoDS::Vertex(myCurrentEdge); - myPresentableWire = new AIS_Shape(myFirstPointSketch); - myPresentableWire->SetColor(myWireColor.Name()); - myInteractiveContext->Display(myPresentableWire); - pt = BRep_Tool::Pnt(myFirstPointSketch); - pt2d = ProjLib::Project(myPlane->Pln(),pt); - myLastX = pt2d.X(); - myLastY = pt2d.Y(); - myCurrentStatus = SEGMENT; - break; - } - case SEGMENT: - { - Standard_Real first,last; - TopLoc_Location L; - Handle(Geom2d_Curve) C = BRep_Tool::CurveOnSurface(TopoDS::Edge(myCurrentEdge),myPlane,L,first,last); - myCurrentEdge = BRepBuilderAPI_MakeEdge2d(Handle(Geom2d_Line)::DownCast(C)->Lin2d(),0.,myLengthDimension->Value()); - if (myTransitionStatus == ANGLE || - myTransitionStatus == LENGTH_FIXED || - myTransitionStatus == X_FIXED || - myTransitionStatus == Y_FIXED) - myTransitionStatus = NOCONSTRAINT; - AddEdgeToWire(); - break; - } - case ARC_CHORD: - { - myInteractiveContext->CloseLocalContext(); - myInteractiveContext->OpenLocalContext(); - gp_Pnt2d p1 (myLastX,myLastY); - pt = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(myCurrentEdge))); - gp_Pnt2d p2 = ProjLib::Project(myPlane->Pln(),pt); - GccAna_Pnt2dBisec ComputeMediatrice(p1,p2); - if (ComputeMediatrice.HasSolution()) { - myMediatrice = new Geom2d_Line(ComputeMediatrice.ThisSolution()); - Handle(Geom_Curve) aMediatrice3d = GeomAPI::To3d(myMediatrice,myPlane->Pln()); - myPresentableMediatrice = new AIS_Axis(Handle(Geom_Line)::DownCast(aMediatrice3d)); - myInteractiveContext->Display(myPresentableMediatrice); - } - TopoDS_Edge e = BRepBuilderAPI_MakeEdge2d(gce_MakeCirc2d(gp_Pnt2d(0.,0),1.)); - BRepLib::BuildCurve3d(e); - myLengthDimension->SetText(TCollection_ExtendedString()); - myInteractiveContext->Redisplay(myLengthDimension,Standard_False); - if (myEdgesNumber == 0) - myPreviousEdge = TopoDS::Edge(myCurrentEdge); - pt2d = ProjLib::Project(myPlane->Pln(),pt); - myLastX = pt2d.X(); - myLastY = pt2d.Y(); - myTransitionStatus = NOCONSTRAINT; - myCurrentStatus = ARC_CHORD_END; - break; - } - case ARC_CHORD_END: - myCurrentStatus = ARC_CHORD; - AddEdgeToWire(); - break; - } -} - -/*! - Add edge to current wire on an edge validation . -*/ -void Sketch::AddEdgeToWire() -{ - myPreviousEdge = TopoDS::Edge(myCurrentEdge); - BRepLib::BuildCurve3d(myPreviousEdge); - myCurrentWire.Add(TopoDS::Edge(myPreviousEdge)); - myEdgesNumber++; - myPresentableWire->Set( myCurrentWire.Wire() ); - myInteractiveContext->Redisplay(myPresentableWire); - myConstructionMode.Append(myCurrentStatus); - myConstraintMode.Append(myTransitionStatus); - myInteractiveContext->CloseLocalContext(); - gp_Pnt pt; - if (myPreviousEdge.Orientation() == TopAbs_FORWARD ) - pt = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(myPreviousEdge))); - else - pt = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(myPreviousEdge))); - gp_Pnt2d pt2d= ProjLib::Project(myPlane->Pln(),pt); - myLastX = pt2d.X(); - myLastY = pt2d.Y(); -} - -/*! - Set the numeric dimension for the current edge and validate creation. - - \param aValue - \return Standard_Boolean -*/ -Standard_Boolean Sketch::SetDimension(Standard_Real& aValue) -{ - fitInResol(aValue); - if (myCurrentStatus == SEGMENT || - myCurrentStatus == ARC_CHORD){ - Standard_Real first,last; - TopLoc_Location L; - Handle(Geom2d_Curve) C = - BRep_Tool::CurveOnSurface(TopoDS::Edge(myCurrentEdge),myPlane,L,first,last); - myCurrentEdge = - BRepBuilderAPI_MakeEdge2d(Handle(Geom2d_Line)::DownCast(C)->Lin2d(),0.,aValue); - DisplayCurrentEdge(); - if (myTransitionStatus == NOCONSTRAINT) { - mySegmentLength = aValue; - myTransitionStatus = LENGTH_FIXED; - } - else - ValidateEdge(); - return Standard_True; - } - - else if( myCurrentStatus == ARC_CHORD_END){ - if (myTransitionStatus == TANGENT) return Standard_False; - gp_Pnt2d p; - if (myEdgesNumber > 0) { - if (myPreviousEdge.Orientation() == TopAbs_FORWARD) - p = ProjLib::Project(myPlane->Pln(),BRep_Tool::Pnt(TopExp::LastVertex(myPreviousEdge))); - else - p = ProjLib::Project(myPlane->Pln(),BRep_Tool::Pnt(TopExp::FirstVertex(myPreviousEdge))); - } - else - p = ProjLib::Project(myPlane->Pln(),BRep_Tool::Pnt(myFirstPointSketch)); - GccAna_Circ2d2TanRad aSol(p, gp_Pnt2d(myLastX,myLastY),aValue,Precision::Confusion()); - Standard_Real dist = RealLast(); - if (aSol.NbSolutions() > 0) { - gp_Circ2d CirSol; - gp_Pnt2d pc = ProjLib::Project(myPlane->Pln(),BRep_Tool::Pnt(TopoDS::Vertex(myCenterCircle->Shape()))); - for (Standard_Integer i =1; i<= aSol.NbSolutions(); i++) { - if (pc.Distance(aSol.ThisSolution(i).Location()) < dist) - CirSol = aSol.ThisSolution(i); - } - if (myCurrentEdge.Orientation() == TopAbs_FORWARD) - myCurrentEdge = BRepBuilderAPI_MakeEdge2d(aSol.ThisSolution(1),p,gp_Pnt2d(myLastX,myLastY)); - else { - myCurrentEdge = BRepBuilderAPI_MakeEdge2d(aSol.ThisSolution(1),gp_Pnt2d(myLastX,myLastY),p); - myCurrentEdge.Reverse(); - } - DisplayCurrentEdge(); - ValidateEdge(); - return Standard_True; - } - } - - return Standard_False; -} - -/*! - Set the numeric dimension for the current edge and validate creation. - - \param deltaX - \param deltaY -*/ -void Sketch::SetDimension(Standard_Real& deltaX, Standard_Real& deltaY) -{ - fitInResol(deltaX); - fitInResol(deltaY); - Standard_Real X = myLastX + deltaX; - Standard_Real Y = myLastY + deltaY; - MakeCurrentEdge(X,Y); - ValidateEdge(); -} - -/*! - Set the numeric value of the X coordinate of current point giving a deltaX relative to previous point. - - \param deltaX -*/ -void Sketch::SetXDimension(Standard_Real& deltaX) -{ - fitInResol(deltaX); - Standard_Real X = myLastX + deltaX; - Standard_Real Y = myLastY; - if ( deltaX == 0. ) - Y = Y + 100.0 * Precision::Confusion(); - - if (myTransitionStatus == NOCONSTRAINT) { - MakeCurrentEdge(X,Y); - myTransitionStatus = X_FIXED; - mySegmentX = X; - } - else if (myTransitionStatus == Y_FIXED) { - myTransitionStatus = NOCONSTRAINT; - MakeCurrentEdge(X,mySegmentY); - ValidateEdge(); - } - else if (myTransitionStatus == ANGLE) { - myTransitionStatus = NOCONSTRAINT; - Standard_Real angle; - if (0 <= mySegmentAngle && mySegmentAngle<= PI ) - angle = PI - mySegmentAngle; - else - angle = mySegmentAngle - PI; - Y = X*Tan(angle); - MakeCurrentEdge(X,Y); - ValidateEdge(); - } - else - myTransitionStatus = NOCONSTRAINT; -} - -/*! - Set the numeric value of the Y coordinate of current point giving a deltaY relative to previous point. - - \param deltaY -*/ -void Sketch::SetYDimension(Standard_Real& deltaY) -{ - fitInResol(deltaY); - Standard_Real X = myLastX; - Standard_Real Y = myLastY + deltaY; - - if ( deltaY == 0. ) - X = X + 100.0 * Precision::Confusion(); - - if (myTransitionStatus == NOCONSTRAINT) { - MakeCurrentEdge(X,Y); - myTransitionStatus = Y_FIXED; - mySegmentY = Y; - } - else if (myTransitionStatus == X_FIXED) { - myTransitionStatus = NOCONSTRAINT; - MakeCurrentEdge(mySegmentX,Y); - ValidateEdge(); - } - else if (myTransitionStatus == ANGLE) { - myTransitionStatus = NOCONSTRAINT; - Standard_Real angle; - if (0 <= mySegmentAngle && mySegmentAngle<= PI ) - angle = PI - mySegmentAngle; - else - angle = mySegmentAngle - PI; - X = Y/Tan(angle); - MakeCurrentEdge(X,Y); - ValidateEdge(); - } - else - myTransitionStatus = NOCONSTRAINT; -} - -/*! - Set the numeric value of angle between 2 segments. - - \param aValue -*/ -void Sketch::SetSegmentAngle(Standard_Real& aValue) -{ - if (myEdgesNumber > 0) { - Standard_Real First,Last; - TopLoc_Location L; - Standard_Real angle; - if (0 <= aValue && aValue<= PI ) - angle = PI - aValue; - else - angle = aValue - PI; - Handle (Geom2d_Curve) PreviousCurve = BRep_Tool::CurveOnSurface(myPreviousEdge,myPlane,L,First,Last); - if (PreviousCurve->IsKind(STANDARD_TYPE(Geom2d_Line))) { - Handle (Geom2d_Curve) PreviousCurve = BRep_Tool::CurveOnSurface(TopoDS::Edge(myPreviousEdge),myPlane,L,First,Last); - - GccAna_Lin2dTanObl aSol(gp_Pnt2d(myLastX,myLastY),Handle(Geom2d_Line)::DownCast(PreviousCurve)->Lin2d(),angle); - myCurrentEdge = BRepBuilderAPI_MakeEdge2d(aSol.ThisSolution(1),0.,myLengthDimension->Value()); - } - if (myTransitionStatus == LENGTH_FIXED) { - ValidateEdge(); - } - else if (myTransitionStatus == X_FIXED) { - Standard_Real length = mySegmentX/Cos(angle); - SetDimension(length); - ValidateEdge(); - } - else if (myTransitionStatus == Y_FIXED) { - Standard_Real length = mySegmentY/Sin(angle); - SetDimension(length); - ValidateEdge(); - } - else { - mySegmentAngle = aValue; - myTransitionStatus = ANGLE; - } - } -} - -/*! - Get the angle value between 2 segments. - - \return Standard_Real -*/ -Standard_Real Sketch::GetSegmentAngle() -{ - return mySegmentAngle; -} - -/*! - Close automatically an open sketch. - - \return TopoDS_Wire. Return null shape if not possible. -*/ -TopoDS_Wire Sketch::Close() -{ - myCurrentStatus = END_SKETCH; - myInteractiveContext->CloseAllContexts(); - myInteractiveContext->EraseAll(Standard_False); - if (myEdgesNumber >= 2) { - BRepTools_WireExplorer Ex(myCurrentWire.Wire()); - TopoDS_Vertex V1; - if (myPreviousEdge.Orientation() == TopAbs_FORWARD) - V1 = TopExp::LastVertex(myPreviousEdge); - else - V1 = TopExp::FirstVertex(myPreviousEdge); - myCurrentWire.Add(BRepBuilderAPI_MakeEdge(V1,myFirstPointSketch).Edge()); - myEdgesNumber++; - return myCurrentWire.Wire(); - } - else - return TopoDS_Wire(); -} - - - -/*! - Clear sketch presentation. -*/ -void Sketch::Clear() -{ - myCurrentStatus = END_SKETCH; - myInteractiveContext->CloseAllContexts(); - myInteractiveContext->EraseAll(Standard_False); -} - -/*! - Terminate sketch without closing. - - \return TopoDS_Wire. Return null shape if not possible. -*/ -TopoDS_Wire Sketch::End() -{ - myCurrentStatus = END_SKETCH; - myInteractiveContext->CloseAllContexts(); - myInteractiveContext->EraseAll(Standard_False); - if (myCurrentWire.IsDone()) { - return myCurrentWire.Wire(); - } - else - return TopoDS_Wire(); -} - - -/*! - Delete current edge. -*/ -Standard_Boolean Sketch::Delete() -{ - myInteractiveContext->Erase(myAngleDimension,Standard_True,Standard_False); - myInteractiveContext->Erase(myLengthDimension,Standard_True,Standard_False); - myInteractiveContext->Erase(myRadiusDimension,Standard_True,Standard_False); - myInteractiveContext->Erase(myCenterCircle,Standard_True,Standard_False); - myInteractiveContext->Erase(myXDimension,Standard_True,Standard_False); - myInteractiveContext->Erase(myYDimension,Standard_True,Standard_False); - - if (myCurrentStatus == BEGIN_SKETCH) { - myCurrentStatus = END_SKETCH; - myInteractiveContext->CloseAllContexts(); - myInteractiveContext->EraseAll(Standard_False); - return true; - } - else if(myCurrentStatus == SEGMENT || - myCurrentStatus == ARC_CHORD ) { - RemoveLastEdge(); - } - else if(myCurrentStatus == ARC_CHORD_END) { - myCurrentStatus = ARC_CHORD; - myInteractiveContext->CloseAllContexts(); - } - gp_Pnt pt; - if (myEdgesNumber == 0) { - //myInteractiveContext->EraseAll(Standard_False); - ChangeMode(BEGIN_SKETCH); // DCQ - pt = BRep_Tool::Pnt(myFirstPointSketch); - } - else { - if (myPreviousEdge.Orientation() == TopAbs_FORWARD ) - pt = BRep_Tool::Pnt(TopExp::LastVertex(TopoDS::Edge(myPreviousEdge))); - else - pt = BRep_Tool::Pnt(TopExp::FirstVertex(TopoDS::Edge(myPreviousEdge))); - } - gp_Pnt2d pt2d= ProjLib::Project(myPlane->Pln(),pt); - myLastX = pt2d.X(); - myLastY = pt2d.Y(); - - return false; -} - -/*! - Set a specific plane for sketch. - - \param GeomyPlane -*/ -void Sketch::SetPlane(const Handle(Geom_Plane)& aPlane) -{ - myPlane = aPlane; -} - -/*! - Set display parameters. - - \param aColor -*/ -void Sketch::SetWireColor(const Quantity_Color& aColor) -{ - myWireColor = aColor; -} - -/*! - Set display parameters. - - \param aColor -*/ -void Sketch::SetCurrentColor(const Quantity_Color& aColor) -{ - myCurrentColor = aColor; -} - -/*! - Set display parameters. - - \param aColor -*/ -void Sketch::SetAxisColor(const Quantity_Color& aColor) -{ - myAxisColor = aColor; -} - - -/*! - Change mode of construction line. - - \param aMode : SEGMENT, ARC_CHORD. -*/ -void Sketch::ChangeMode(const SketchStatus aMode) -{ - gp_Pnt2d p; - if (myEdgesNumber > 0) { - if (myPreviousEdge.Orientation() == TopAbs_FORWARD) - p = ProjLib::Project(myPlane->Pln(),BRep_Tool::Pnt(TopExp::LastVertex(myPreviousEdge))); - else - p = ProjLib::Project(myPlane->Pln(),BRep_Tool::Pnt(TopExp::FirstVertex(myPreviousEdge))); - myLastX = p.X(); - myLastY = p.Y(); - myInteractiveContext->CloseLocalContext(myInteractiveContext->IndexOfCurrentLocal()); - } - if (!myCurrentStatus == BEGIN_SKETCH) - myCurrentStatus = aMode; /* change the mode only when the sketch is not in state BEGIN_SKETCH, i.d. fist point has been fixed */ - -} - -/*! - Set transition constraint between consecutive edges. - - \param aStatus : NOCONSTRAINT, TANGENT, PERPENDICULAR, ANGLE, LENGTH_FIXED, X_FIXED, Y_FIXED. -*/ -void Sketch::SetTransitionStatus(const TransitionStatus aStatus) -{ - myTransitionStatus = aStatus; -} - -/*! - Set or unset the display of dimensions. - - \param atype - \param OnOff -*/ -void Sketch::SetParameterVisibility(const TypeOfParameter atype, const Standard_Boolean OnOff) -{ - switch (atype) { - case ANGLE_PARAMETER: - myIsAngleDimensionVisible = OnOff; - if (!myIsAngleDimensionVisible && !myAngleDimension.IsNull()) - myInteractiveContext->Erase(myAngleDimension,Standard_True,Standard_False); - //else DCQ - // DisplayCurrentEdge(); - break; - case LENGTH_PARAMETER: - myIsLengthDimensionVisible = OnOff; - if (!myIsLengthDimensionVisible&& !myLengthDimension.IsNull()) - myInteractiveContext->Erase(myLengthDimension,Standard_True,Standard_False); - //else DCQ - // DisplayCurrentEdge(); - break; - case RADIUS_PARAMETER: - myIsRadiusDimensionVisible = OnOff; - if (!myIsRadiusDimensionVisible&& !myRadiusDimension.IsNull()){ - myInteractiveContext->Erase(myRadiusDimension,Standard_True,Standard_False); - myInteractiveContext->Erase(myCenterCircle,Standard_True,Standard_False); - } - //else DCQ - // DisplayCurrentEdge(); - break; - case XVALUE_PARAMETER: - myIsXDimensionVisible = OnOff; - if (!myIsXDimensionVisible&& !myXDimension.IsNull()) - myInteractiveContext->Erase(myXDimension,Standard_True,Standard_False); - break; - case YVALUE_PARAMETER: - myIsYDimensionVisible = OnOff; - if (!myIsYDimensionVisible&& !myYDimension.IsNull()) - myInteractiveContext->Erase(myYDimension,Standard_True,Standard_False); - break; - } -} - -/*! - Hilight parameters. - - \param atype - \param acolor -*/ -void Sketch::HiligthWithColor(const TypeOfParameter atype, const Quantity_NameOfColor acolor) -{ - switch (atype) { - case ANGLE_PARAMETER: - myInteractiveContext->HilightWithColor(myAngleDimension, acolor); - break; - case LENGTH_PARAMETER: - myInteractiveContext->HilightWithColor(myLengthDimension, acolor); - break; - case RADIUS_PARAMETER: - myInteractiveContext->HilightWithColor(myRadiusDimension, acolor); - break; - case XVALUE_PARAMETER: - myInteractiveContext->HilightWithColor(myXDimension, acolor); - break; - case YVALUE_PARAMETER: - myInteractiveContext->HilightWithColor(myYDimension, acolor); - break; - } -} - - -/*! - Unhilight parameters. - - \param atype -*/ -void Sketch::Unhiligth(const TypeOfParameter atype) -{ - switch (atype) { - case ANGLE_PARAMETER: - myInteractiveContext->Unhilight(myAngleDimension); - break; - case LENGTH_PARAMETER: - myInteractiveContext->Unhilight(myLengthDimension); - break; - case RADIUS_PARAMETER: - myInteractiveContext->Unhilight(myRadiusDimension); - break; - case XVALUE_PARAMETER: - myInteractiveContext->Unhilight(myXDimension); - break; - case YVALUE_PARAMETER: - myInteractiveContext->Unhilight(myYDimension); - break; - } -} - -/*! - Check if the edition of a type of parameter is relevant depending on sketch current status. - - \param atype - \return Standard_Boolean -*/ -Standard_Boolean Sketch::IsValidCurrentParameter(const TypeOfParameter atype) -{ - switch (atype) { - case ANGLE_PARAMETER: - if (myCurrentStatus != SEGMENT && myCurrentStatus != ARC_CHORD) - return Standard_False; - else if (myTransitionStatus == TANGENT || myTransitionStatus == PERPENDICULAR) - return Standard_False; - else if (myEdgesNumber < 1) - return Standard_False; - else { - TopLoc_Location L; - Standard_Real First,Last; - Handle (Geom2d_Curve) PreviousCurve = BRep_Tool::CurveOnSurface(myPreviousEdge,myPlane,L,First,Last); - if (!PreviousCurve->IsKind(STANDARD_TYPE(Geom2d_Line))) - return Standard_False; - } - break; - case LENGTH_PARAMETER: - if (myCurrentStatus != SEGMENT && - myCurrentStatus != ARC_CHORD /*&& - myCurrentStatus != CURVE_POINTS*/ - ) - return Standard_False; - else if (myTransitionStatus == LENGTH_FIXED) - return Standard_False; - break; - case RADIUS_PARAMETER: - if (myCurrentStatus != ARC_CHORD_END) - return Standard_False; - break; - case XVALUE_PARAMETER: - if (myCurrentStatus != SEGMENT && - myCurrentStatus != ARC_CHORD /*&& - myCurrentStatus != CURVE_POINTS*/ - ) - return Standard_False; - else if (myTransitionStatus == X_FIXED) - return Standard_False; - break; - case YVALUE_PARAMETER: - if (myCurrentStatus != SEGMENT && - myCurrentStatus != ARC_CHORD /*&& - myCurrentStatus != CURVE_POINTS*/ - ) - return Standard_False; - else if (myTransitionStatus == Y_FIXED) - return Standard_False; - break; - } - return Standard_True; -} - -/*! - Set a parameter value. - - \param atype - \param aValue -*/ -void Sketch::SetParameterValue(const TypeOfParameter atype, Standard_Real aValue) -{ - switch (atype) { - case ANGLE_PARAMETER: - SetSegmentAngle(aValue); - break; - case LENGTH_PARAMETER: - SetDimension(aValue); - break; - case RADIUS_PARAMETER: - SetDimension(aValue); - break; - case XVALUE_PARAMETER: - SetXDimension(aValue); - break; - case YVALUE_PARAMETER: - SetYDimension(aValue); - break; - } -} - -/*! - Initialisation of sketch parameters or options. -*/ -void Sketch::Init() -{ - myPlane = new Geom_Plane (0.,0.,1.,0.); - CreateConstraints(); - BRepLib::Plane(myPlane); - myEdgesNumber = 0; - myCurrentStatus = BEGIN_SKETCH; - /* In order to update the visulisation of current objects by using Redisplay method from InteractiveContext */ - myCurrentEdge = BRepBuilderAPI_MakeVertex(gp_Pnt(0.,0.,0.)); - myPresentableEdge = new AIS_Shape(myCurrentEdge); - myPresentableEdge->SetColor(myCurrentColor.Name()); - myInteractiveContext->Display(myPresentableEdge); - myTransitionStatus = NOCONSTRAINT; - /* Init for display objects */ - TopoDS_Vertex V1 = BRepBuilderAPI_MakeVertex(gp_Pnt(0.,0.,0.)); - TopoDS_Vertex V2 = BRepBuilderAPI_MakeVertex(gp_Pnt(10.,0.,0.)); - myLengthDimension = new AIS_LengthDimension (V1,V2,myPlane,0.,TCollection_ExtendedString()); - myXDimension = new AIS_LengthDimension (V1,V2,myPlane,0.,TCollection_ExtendedString(),gp_Pnt(),DsgPrs_AS_NONE, - AIS_TOD_Horizontal); - myYDimension = new AIS_LengthDimension (V1,V2,myPlane,0.,TCollection_ExtendedString(),gp_Pnt(),DsgPrs_AS_NONE, - AIS_TOD_Vertical); - myRadiusDimension = new AIS_LengthDimension (V1,V2,myPlane,0.,TCollection_ExtendedString()); - myCenterCircle = new AIS_Shape(V1); - myIsLengthDimensionVisible = Standard_False; - myIsXDimensionVisible = Standard_False; - myIsYDimensionVisible = Standard_False; - myIsRadiusDimensionVisible = Standard_False; -} - -/*! - Build the current segment. - - \param X - \param Y -*/ -void Sketch::MakeCurrentSegment(Standard_Real X, Standard_Real Y) -{ - if (myTransitionStatus == NOCONSTRAINT) - myCurrentEdge = BRepBuilderAPI_MakeEdge2d(gp_Pnt2d(myLastX,myLastY), gp_Pnt2d(X,Y)); - else if (myTransitionStatus == X_FIXED) - myCurrentEdge = BRepBuilderAPI_MakeEdge2d(gp_Pnt2d(myLastX,myLastY),gp_Pnt2d(mySegmentX,Y)); - else if (myTransitionStatus == Y_FIXED) - myCurrentEdge = BRepBuilderAPI_MakeEdge2d(gp_Pnt2d(myLastX,myLastY),gp_Pnt2d(X,mySegmentY)); - else if (myTransitionStatus == TANGENT && myEdgesNumber > 0) { - Standard_Real first,last; - TopLoc_Location L; - Handle(Geom2d_Curve) C = BRep_Tool::CurveOnSurface(myPreviousEdge,myPlane,L,first,last); - gp_Pnt2d p1; - gp_Vec2d Vt; - if (myPreviousEdge.Orientation() == TopAbs_FORWARD) - C->D1(last,p1,Vt); - else - C->D1(first,p1,Vt); - gp_Lin2d aline(p1,Vt); - Geom2dAPI_ProjectPointOnCurve proj(gp_Pnt2d(X,Y),new Geom2d_Line(aline)); - if (proj.NbPoints() > 0) - myCurrentEdge = BRepBuilderAPI_MakeEdge2d(p1,proj.Point(1)); - } - else if (myTransitionStatus == PERPENDICULAR && myEdgesNumber > 0) { - Standard_Real first,last; - TopLoc_Location L; - Handle(Geom2d_Curve) C = BRep_Tool::CurveOnSurface(myPreviousEdge,myPlane,L,first,last); - gp_Pnt2d p1; - gp_Lin2d perpen; - if (myPreviousEdge.Orientation() == TopAbs_FORWARD) - C->D0(last,p1); - else - C->D0(first,p1); - if (C->IsKind(STANDARD_TYPE(Geom2d_Line))) { - GccAna_Lin2dTanPer aSol(p1,Handle(Geom2d_Line)::DownCast(C)->Lin2d()); - perpen = aSol.ThisSolution(1); - } - else if (C->IsKind(STANDARD_TYPE(Geom2d_Circle))) { - GccAna_Lin2dTanPer aSol(p1,Handle(Geom2d_Circle)::DownCast(C)->Circ2d()); - perpen = aSol.ThisSolution(1); - } - Geom2dAPI_ProjectPointOnCurve proj(gp_Pnt2d(X,Y),new Geom2d_Line(perpen)); - if (proj.NbPoints() > 0) - myCurrentEdge = BRepBuilderAPI_MakeEdge2d(p1,proj.Point(1)); - } - else if (myTransitionStatus == ANGLE && myEdgesNumber > 0) { - Standard_Real First,Last; - TopLoc_Location L; - Handle (Geom2d_Curve) PreviousCurve = BRep_Tool::CurveOnSurface(myPreviousEdge,myPlane,L,First,Last); - if (PreviousCurve->IsKind(STANDARD_TYPE(Geom2d_Line))) { - Handle (Geom2d_Curve) PreviousCurve = BRep_Tool::CurveOnSurface(TopoDS::Edge(myPreviousEdge),myPlane,L,First,Last); - Standard_Real angle; - if (0 <= mySegmentAngle && mySegmentAngle<= PI ) - angle = PI - mySegmentAngle; - else - angle = mySegmentAngle - PI; - GccAna_Lin2dTanObl aSol(gp_Pnt2d(myLastX,myLastY),Handle(Geom2d_Line)::DownCast(PreviousCurve)->Lin2d(),angle); - Standard_Real dist = RealLast(); - gp_Pnt2d pt(X,Y),ptproj; - for (Standard_Integer i =1; i<=aSol.NbSolutions(); i++) { - Geom2dAPI_ProjectPointOnCurve proj(pt,new Geom2d_Line(aSol.ThisSolution(i))); - if (pt.Distance(proj.Point(1)) < dist) { - dist = pt.Distance(proj.Point(1)); - ptproj = proj.Point(1); - } - } - myCurrentEdge = BRepBuilderAPI_MakeEdge2d(gp_Pnt2d(myLastX,myLastY),ptproj); - } - } - else if (myTransitionStatus == LENGTH_FIXED && myEdgesNumber > 0) { - Standard_Real First,Last; - TopLoc_Location L; - Handle (Geom2d_Curve) PreviousCurve = BRep_Tool::CurveOnSurface(myPreviousEdge,myPlane,L,First,Last); - if (PreviousCurve->IsKind(STANDARD_TYPE(Geom2d_Line))) { - Handle (Geom2d_Curve) PreviousCurve = BRep_Tool::CurveOnSurface(TopoDS::Edge(myPreviousEdge),myPlane,L,First,Last); - gp_Lin2d aline = gce_MakeLin2d(gp_Pnt2d(myLastX,myLastY), gp_Pnt2d(X,Y)); - myCurrentEdge = BRepBuilderAPI_MakeEdge2d(aline,0.,mySegmentLength); - } - } -} - -/*! - Build the current arc. - - \param X - \param Y -*/ -void Sketch::MakeCurrentArc(Standard_Real X, Standard_Real Y) -{ - gp_Circ2d CircSol; - Standard_Boolean OK(Standard_False); - - if (myTransitionStatus == NOCONSTRAINT) { - GccAna_Circ2d2TanOn aSol(gp_Pnt2d(myLastX,myLastY), gp_Pnt2d(X,Y),myMediatrice->Lin2d(),Precision::Confusion()); - if (aSol.NbSolutions() > 0){ - CircSol = aSol.ThisSolution(1); - OK = Standard_True; - } - } - /* Tangency with previous edge */ - else if (myTransitionStatus == TANGENT && myEdgesNumber > 0) { - Standard_Real first,last; - TopLoc_Location L; - Handle(Geom2d_Curve) C = BRep_Tool::CurveOnSurface(myPreviousEdge,myPlane,L,first,last); - if (C->IsKind(STANDARD_TYPE(Geom2d_Line))){ - GccAna_Circ2d2TanOn aSol(GccEnt::Unqualified(Handle(Geom2d_Line)::DownCast(C)->Lin2d()), gp_Pnt2d(myLastX,myLastY),myMediatrice->Lin2d(),Precision::Confusion()); - if (aSol.NbSolutions() > 0){ - CircSol = aSol.ThisSolution(1); - OK = Standard_True; - } - } - else if (C->IsKind(STANDARD_TYPE(Geom2d_Circle))) { - GccAna_Circ2d2TanOn aSol(GccEnt::Unqualified(Handle(Geom2d_Circle)::DownCast(C)->Circ2d()), gp_Pnt2d(myLastX,myLastY),myMediatrice->Lin2d(),Precision::Confusion()); - if (aSol.NbSolutions() > 0){ - CircSol = aSol.ThisSolution(1); - OK = Standard_True; - } - } - else if(C->IsKind(STANDARD_TYPE(Geom2d_BSplineCurve))) { - gp_Pnt2d pc; - gp_Vec2d Vt; - C->D1(last,pc,Vt); - gp_Lin2d alin2d(pc,gp_Dir2d(Vt)); - GccAna_Circ2d2TanOn aSol(GccEnt::Unqualified(alin2d), gp_Pnt2d(myLastX,myLastY),myMediatrice->Lin2d(),Precision::Confusion()); - if (aSol.NbSolutions() > 0){ - CircSol = aSol.ThisSolution(1); - OK = Standard_True; - } - } - } - /* Tangency with the perpendicular to the previous edge */ - else if (myTransitionStatus == PERPENDICULAR && myEdgesNumber > 0) { - Standard_Real first,last; - TopLoc_Location L; - Handle(Geom2d_Curve) C = BRep_Tool::CurveOnSurface(myPreviousEdge,myPlane,L,first,last); - gp_Pnt2d p1; - gp_Lin2d perpen; - if (myPreviousEdge.Orientation() == TopAbs_FORWARD) - C->D0(last,p1); - else - C->D0(first,p1); - if (C->IsKind(STANDARD_TYPE(Geom2d_Line))) { - GccAna_Lin2dTanPer aSol(p1,Handle(Geom2d_Line)::DownCast(C)->Lin2d()); - perpen = aSol.ThisSolution(1); - } - else if (C->IsKind(STANDARD_TYPE(Geom2d_Circle))) { - GccAna_Lin2dTanPer aSol(p1,Handle(Geom2d_Circle)::DownCast(C)->Circ2d()); - perpen = aSol.ThisSolution(1); - } - GccAna_Circ2d2TanOn aSol(GccEnt::Unqualified(perpen), gp_Pnt2d(myLastX,myLastY),myMediatrice->Lin2d(),Precision::Confusion()); - if (aSol.NbSolutions() > 0){ - CircSol = aSol.ThisSolution(1); - OK = Standard_True; - } - } - - gp_Pnt2d p; - if (myEdgesNumber > 0) { - if (myPreviousEdge.Orientation() == TopAbs_FORWARD) - p = ProjLib::Project(myPlane->Pln(),BRep_Tool::Pnt(TopExp::LastVertex(myPreviousEdge))); - else - p = ProjLib::Project(myPlane->Pln(),BRep_Tool::Pnt(TopExp::FirstVertex(myPreviousEdge))); - } - else - p = ProjLib::Project(myPlane->Pln(),BRep_Tool::Pnt(myFirstPointSketch)); - if (OK){ - gp_Vec2d V1(p,gp_Pnt2d(X,Y)); - gp_Vec2d V2(p,gp_Pnt2d(myLastX,myLastY)); - if (V1.Angle(V2) > 0 ) - myCurrentEdge = BRepBuilderAPI_MakeEdge2d(CircSol,p,gp_Pnt2d(myLastX,myLastY)); - else { - myCurrentEdge = BRepBuilderAPI_MakeEdge2d(CircSol,gp_Pnt2d(myLastX,myLastY),p); - myCurrentEdge.Reverse(); - } - } - else { - myCurrentStatus = ARC_CHORD; - myLastX = p.X(); - myLastY = p.Y(); - myInteractiveContext->CloseLocalContext(); - } - -} - -/*! - Display the current edge under construction with it's dimension. -*/ -void Sketch::DisplayCurrentEdge() -{ - myPresentableEdge->Set(myCurrentEdge); - myInteractiveContext->Redisplay(myPresentableEdge); - if (myCurrentStatus == SEGMENT || - myCurrentStatus == ARC_CHORD ) { - /* Length dimension */ - TopoDS_Vertex V1 = TopExp::FirstVertex(TopoDS::Edge(myCurrentEdge)); - TopoDS_Vertex V2 = TopExp::LastVertex(TopoDS::Edge(myCurrentEdge)); - DisplayLengthDimension(V1,V2); - /* Angular dimension */ - DisplayAngleDimension(); - DisplayXDimension(V1,V2); - DisplayYDimension(V1,V2); - } - else if (myCurrentStatus == ARC_CHORD_END ) - DisplayRadiusDimension(); - else { - TopoDS_Vertex V1 = TopoDS::Vertex(myCurrentEdge); - TopoDS_Vertex V2 = BRepBuilderAPI_MakeVertex(gp_Pnt(0.,0.,0.)); - DisplayXDimension(V1,V2); - DisplayYDimension(V1,V2); - } - -} - -/*! - Display the current length dimension. - - \param V1 - \param V2 -*/ -void Sketch::DisplayLengthDimension(const TopoDS_Vertex& V1,const TopoDS_Vertex& V2) -{ - gp_Pnt p1 = BRep_Tool::Pnt(TopoDS::Vertex(V1)); - gp_Pnt p2 = BRep_Tool::Pnt(TopoDS::Vertex(V2)); - Standard_Real length = p1.Distance(p2); - if (length <= Precision::Confusion()) return; - myLengthDimension->SetFirstShape(V1); - myLengthDimension->SetSecondShape(V2); - fitInResol(length); - myLengthDimension->SetValue(length); - QString S; - S.sprintf("%.1f",length); - myLengthDimension->SetText(TCollection_ExtendedString(strdup(S))); - if (myIsLengthDimensionVisible) { - if (myInteractiveContext->IsDisplayed(myLengthDimension)) - myInteractiveContext->Redisplay(myLengthDimension); - else - myInteractiveContext->Display(myLengthDimension); - } -} - -/*! - Display the current X dimension. - - \param V1 - \param V2 -*/ -void Sketch::DisplayXDimension(const TopoDS_Vertex& V1,const TopoDS_Vertex& V2) -{ - if (myTransitionStatus != X_FIXED) { - gp_Pnt p1 = BRep_Tool::Pnt(TopoDS::Vertex(V1)); - gp_Pnt p2 = BRep_Tool::Pnt(TopoDS::Vertex(V2)); - - gp_Lin aline(p1,myPlane->Pln().XAxis().Direction()); - GeomAPI_ProjectPointOnCurve proj(p2,new Geom_Line(aline)); - - gp_Pnt pb = p1; - - if (proj.NbPoints() > 0) { - Standard_Real length = p1.Distance(proj.Point(1)); - if (length <= Precision::Confusion()) return; - myXDimension->SetFirstShape(V1); - myXDimension->SetSecondShape(V2); - fitInResol(length); - myXDimension->SetValue(length); - QString S; - S.sprintf("%.1f",length); - myXDimension->SetText(TCollection_ExtendedString(strdup(S))); - // myXDimension->SetPosition(proj.Point(1)); - pb.BaryCenter(5,proj.Point(1),5); - myXDimension->SetPosition(pb); - if (myIsXDimensionVisible) { - if (myInteractiveContext->IsDisplayed(myXDimension)) - myInteractiveContext->Redisplay(myXDimension); - else - myInteractiveContext->Display(myXDimension); - } - } - } else - myInteractiveContext->Erase(myXDimension,Standard_True,Standard_False); -} - -/*! - Display the current Y dimension. - - \param V1 - \param V2 -*/ -void Sketch::DisplayYDimension(const TopoDS_Vertex& V1,const TopoDS_Vertex& V2) -{ - if (myTransitionStatus != Y_FIXED) { - - gp_Pnt p1 = BRep_Tool::Pnt(TopoDS::Vertex(V1)); - gp_Pnt p2 = BRep_Tool::Pnt(TopoDS::Vertex(V2)); - gp_Lin aline(p2 /*p1*/, myPlane->Pln().YAxis().Direction()); - gp_Pnt pb = p2 /*p1*/; - GeomAPI_ProjectPointOnCurve proj(p1 /*p2*/,new Geom_Line(aline)); - if (proj.NbPoints() > 0) { - Standard_Real length = /*p1*/ p2.Distance(proj.Point(1)); - if (length <= Precision::Confusion()) return; - myYDimension->SetFirstShape(V1); - myYDimension->SetSecondShape(V2); - fitInResol(length); - myYDimension->SetValue(length); - QString S; - S.sprintf("%.1f",length); - myYDimension->SetText(TCollection_ExtendedString(strdup(S))); - pb.BaryCenter(5,proj.Point(1),5); - myYDimension->SetPosition(pb); - // myYDimension->SetPosition(p2); - if (myIsYDimensionVisible) { - if (myInteractiveContext->IsDisplayed(myYDimension)) - myInteractiveContext->Redisplay(myYDimension); - else - myInteractiveContext->Display(myYDimension); - } - } - } else - myInteractiveContext->Erase(myYDimension,Standard_True,Standard_False); -} - -/*! - Display the current angle dimension. -*/ -void Sketch::DisplayAngleDimension() -{ - if (!myIsAngleDimensionVisible) - return; - if (myEdgesNumber > 0) { - Standard_Real First,Last; - TopLoc_Location L; - Handle (Geom2d_Curve) PreviousCurve = BRep_Tool::CurveOnSurface(myPreviousEdge,myPlane,L,First,Last); - Handle (Geom2d_Curve) CurrentCurve = BRep_Tool::CurveOnSurface(TopoDS::Edge(myCurrentEdge),myPlane,L,First,Last); - if (PreviousCurve->IsKind(STANDARD_TYPE(Geom2d_Line)) && CurrentCurve->IsKind(STANDARD_TYPE(Geom2d_Line))) { - Standard_Real angle = Handle(Geom2d_Line)::DownCast(PreviousCurve)->Lin2d().Angle(Handle(Geom2d_Line)::DownCast(CurrentCurve)->Lin2d()); - gp_Pnt2d apos; - if (0 <= angle && angle<= PI) - angle = PI - angle; - else - angle = PI + angle; - CurrentCurve->D0((First+Last)/5.,apos); - gp_Pnt apos3d = ElCLib::To3d(myPlane->Pln().Position().Ax2(),apos); - Standard_Real angtext = angle*180./PI; - mySegmentAngle = angle; - BRepLib::BuildCurve3d(TopoDS::Edge(myCurrentEdge)); - fitInResol(angtext); - - QString S; - S.sprintf("%.1f",angtext); - if (myInteractiveContext->IndexOfCurrentLocal() == 0) { - myInteractiveContext->OpenLocalContext(); - myAngleDimension = new AIS_AngleDimension(myPreviousEdge,TopoDS::Edge(myCurrentEdge),myPlane,angle, - TCollection_ExtendedString(strdup(S))); - myInteractiveContext->Display(myAngleDimension); - } - else { - myAngleDimension->SetSecondShape(myCurrentEdge); - myAngleDimension->SetValue(angle); - myAngleDimension->SetPosition(apos3d); - myAngleDimension->SetText(TCollection_ExtendedString(strdup(S))); - myInteractiveContext->Redisplay(myAngleDimension); - } - } - } -} - -/*! - Display the current radius dimension. -*/ -void Sketch::DisplayRadiusDimension() -{ - if (! myIsRadiusDimensionVisible) - return; - BRepLib::BuildCurve3d(TopoDS::Edge(myCurrentEdge)); - Standard_Real First,Last; - Handle (Geom_Circle) C = Handle (Geom_Circle)::DownCast(BRep_Tool::Curve(TopoDS::Edge(myCurrentEdge),First,Last)); - if (!C.IsNull()) { - Standard_Real R = C->Radius(); - TopoDS_Shape V1 = BRepBuilderAPI_MakeVertex(C->Location()); - gp_Pnt MidlePoint ; - C->D0((First+Last)/2.,MidlePoint); - TopoDS_Vertex V2 = BRepBuilderAPI_MakeVertex(MidlePoint); - myRadiusDimension->SetFirstShape(V1); - myRadiusDimension->SetSecondShape(V2); - myRadiusDimension->SetValue(R); - fitInResol(R); - QString S; - S.sprintf("%.1f",R); - myRadiusDimension->SetText(TCollection_ExtendedString(strdup(S))); - if (myInteractiveContext->IsDisplayed(myRadiusDimension)) - myInteractiveContext->Redisplay(myRadiusDimension); - else - myInteractiveContext->Display(myRadiusDimension); - myCenterCircle->Set(V1); - if (myInteractiveContext->IsDisplayed(myCenterCircle)) - myInteractiveContext->Redisplay(myCenterCircle); - else - myInteractiveContext->Display(myCenterCircle); - } -} - -/*! - Remove last edge from the current wire. -*/ -void Sketch::RemoveLastEdge() -{ - if (myEdgesNumber == 0) { - myCurrentStatus = END_SKETCH; - myInteractiveContext->CloseAllContexts(); - myInteractiveContext->EraseAll(Standard_False); - return; - } - else { - BRepTools_WireExplorer Ex; - BRepBuilderAPI_MakeWire MW; - Standard_Integer index = 1; - myCurrentEdge = myPreviousEdge; - for (Ex.Init(myCurrentWire.Wire());Ex.More();Ex.Next()){ - if (index <= myEdgesNumber-1) { - MW.Add(Ex.Current()); - myPreviousEdge = Ex.Current(); - index++; - } - } - myCurrentWire = MW; - myCurrentStatus = (SketchStatus)myConstructionMode(myEdgesNumber); - myTransitionStatus = (TransitionStatus)myConstraintMode(myEdgesNumber); - myEdgesNumber--; - myConstructionMode.Remove(index); - myConstraintMode.Remove(index); - if (myEdgesNumber == 0) - myPresentableWire->Set(myFirstPointSketch); - else - myPresentableWire->Set(myCurrentWire.Wire()); - myInteractiveContext->Redisplay(myPresentableWire); - myInteractiveContext->CloseLocalContext(); - myPresentableEdge->Set(myCurrentEdge); - myInteractiveContext->Redisplay(myPresentableEdge); - } -} - -/*! - Create initial constraints. -*/ -void Sketch::CreateConstraints() -{ - Handle(Geom_Axis1Placement) xAxis = new Geom_Axis1Placement(myPlane->Pln().XAxis()); - Handle(Geom_Axis1Placement) yAxis = new Geom_Axis1Placement(myPlane->Pln().YAxis()); - myHAxis = new AIS_Axis(xAxis); - myVAxis = new AIS_Axis(yAxis); - myAngularAxis = myVAxis; - myHAxis->SetColor(myAxisColor.Name()); - myVAxis->SetColor(myAxisColor.Name()); - myAngularAxis->SetColor(myAxisColor.Name()); -} - -/*! - fitInResol. - - \param toFit - \param minIsResol -*/ -void Sketch::fitInResol(Standard_Real &toFit, Standard_Boolean minIsResol) -{ - Standard_Real sign = (toFit < 0) ? -1. : +1.; - Standard_Real value = toFit + sign * resol/2.0; /* why "+ resol/2.0" ? because if resol = 0.5, 3.3 is rounded to 3.5 */ - int nTimesResol = int(value/resol); - if ((nTimesResol == 0) && (minIsResol)) nTimesResol = 1; - toFit = nTimesResol*resol; -} - -SketchStatus Sketch::GetCurrentStatus() -{ - return myCurrentStatus; -} - -Standard_Integer Sketch::GetmyEdgesNumber() -{ - return myEdgesNumber; -} - - - diff --git a/src/SKETCHER/GEOM_Sketcher.h b/src/SKETCHER/GEOM_Sketcher.h deleted file mode 100644 index 89b12c086..000000000 --- a/src/SKETCHER/GEOM_Sketcher.h +++ /dev/null @@ -1,201 +0,0 @@ -// GEOM SKETCHER : basic sketcher -// -// 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 : GEOM_Sketcher.h -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -#include "GEOM_SketcherStatus.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -class Sketch -{ -public: - Sketch(); - ~Sketch(); - Sketch(const Handle(V3d_Viewer)& aViewer); - Sketch(const Handle(V3d_Viewer)& aViewer, - const Quantity_Color& anAxisColor, - const Quantity_Color& aCurrentColor, - const Quantity_Color& aWireColor); - - static void fitInResol(Standard_Real &toFit, - Standard_Boolean minIsResol = Standard_False); - - void MakeCurrentEdge(const Standard_Integer Xp , - const Standard_Integer Yp , - const Handle(V3d_View)& aView ); - - void MakeCurrentEdge(const Standard_Real X, const Standard_Real Y); - - Standard_Boolean SetDimension(Standard_Real& aValue); - void SetDimension(Standard_Real& deltaX,Standard_Real& deltaY); - - void SetXDimension(Standard_Real& deltaX); - void SetYDimension(Standard_Real& deltaY); - - void SetSegmentAngle(Standard_Real& aValue); - Standard_Real GetSegmentAngle(); - - void ValidateEdge(); - - TopoDS_Wire Close(); - TopoDS_Wire End(); - - void Clear(); - - Standard_Boolean Delete(); - - void SetPlane(const Handle(Geom_Plane)& aPlane); - - void SetWireColor(const Quantity_Color& aColor); - void SetCurrentColor(const Quantity_Color& aColor); - void SetAxisColor(const Quantity_Color& aColor); - - void SetParameterVisibility(const TypeOfParameter atype, - const Standard_Boolean OnOff); - - void HiligthWithColor(const TypeOfParameter atype, - const Quantity_NameOfColor acolor); - void Unhiligth(const TypeOfParameter atype); - - Standard_Boolean IsValidCurrentParameter(const TypeOfParameter atype); - - void SetParameterValue(const TypeOfParameter atype, Standard_Real aValue); - - void ChangeMode(const SketchStatus aMode); - - void SetTransitionStatus(const TransitionStatus aStatus); - - SketchStatus GetCurrentStatus(); - Standard_Integer GetmyEdgesNumber(); - -private : - - void Init(); - - void MakeCurrentSegment(Standard_Real X, Standard_Real Y); - - void MakeCurrentArc(Standard_Real X, Standard_Real Y); - - void DisplayCurrentEdge(); - - void DisplayLengthDimension(const TopoDS_Vertex& V1,const TopoDS_Vertex& V2); - void DisplayXDimension(const TopoDS_Vertex& V1,const TopoDS_Vertex& V2); - void DisplayYDimension(const TopoDS_Vertex& V1,const TopoDS_Vertex& V2); - void DisplayAngleDimension(); - void DisplayRadiusDimension(); - - void AddEdgeToWire(); - - void RemoveLastEdge(); - - void CreateConstraints(); - -private: - // Current status of construction - SketchStatus myCurrentStatus; - // Transition status between arcs and segments - TransitionStatus myTransitionStatus; - // Current wire - BRepBuilderAPI_MakeWire myCurrentWire; - // Current presentable wire - Handle_AIS_Shape myPresentableWire; - // Number of edges into the current wire - Standard_Integer myEdgesNumber; - // Store for each edge how it has been built i.d the value of myCurrentStatus - TColStd_SequenceOfInteger myConstructionMode; - // Store for each edge how it has been built i.d the value of myTransitionStatus - TColStd_SequenceOfInteger myConstraintMode; - // Current edge - TopoDS_Shape myCurrentEdge; - // Previous edge - TopoDS_Edge myPreviousEdge; - // List of points to interpolate when computing a curve by interpolation - TColgp_SequenceOfPnt2d myPointsToInterpolate; - // Tangent vector at beginning of curve - gp_Vec2d myTangentVector; - // Tangent flag at beginning og curve - Standard_Boolean myTangentFlag; - - // Origin of sketch - TopoDS_Vertex myFirstPointSketch; - // Last x coordinate of end point of previous edge or picked point - Standard_Real myLastX; - // Last y coordinate of end point of previous edge or picked point - Standard_Real myLastY; - // angle between 2 segments when an ANGLE TransitionStatus is set. - Standard_Real mySegmentAngle; - // Length of segment when the length of the segment is fixed before the angle - Standard_Real mySegmentLength; - // Value of X fixed coordinate - Standard_Real mySegmentX; - // Value of Y fixed Coordinate - Standard_Real mySegmentY; - Handle_AIS_Shape myPresentableEdge; // Current presentable edge - Handle_AIS_LengthDimension myLengthDimension;// For display of current length segment dimension - Handle_AIS_LengthDimension myXDimension; // For display of current X segment dimension - Handle_AIS_LengthDimension myYDimension; // For display of current Y segment dimension - Handle_AIS_LengthDimension myRadiusDimension;// For display of current radius dimension - Handle_AIS_AngleDimension myAngleDimension; // For display of current angle dimension - Standard_Boolean myIsLengthDimensionVisible; // Visibility flag for LengthDimension - Standard_Boolean myIsXDimensionVisible; // Visibility flag for X Dimension - Standard_Boolean myIsYDimensionVisible; // Visibility flag for Y Dimension - Standard_Boolean myIsRadiusDimensionVisible; // Visibility flag for RadiusDimension - Standard_Boolean myIsAngleDimensionVisible; // Visibility flag for AngleDimension - Handle_AIS_Axis myPresentableMediatrice; // Chord mediatrice of current circle as a presentable object - Handle_Geom2d_Line myMediatrice; // Chord mediatrice of current circle as a 2d line - Handle_AIS_Shape myCenterCircle; // to visualise center of current arc - - Handle_AIS_Axis myHAxis; // Horizontal axis - Handle_AIS_Axis myVAxis; // Vertical axis - Handle_AIS_Axis myAngularAxis; // Axis making a predefined angle with the previous edge - - Quantity_Color myWireColor; // Color of wire and of build edges - Quantity_Color myCurrentColor; // Color of edge under construction - Quantity_Color myAxisColor; // Color for axis - Handle_AIS_InteractiveContext myInteractiveContext; // Interactive context for display management - - Handle_Geom_Plane myPlane; // Plane of sketch - - BRepBuilderAPI_MakeWire myPasteWire; - Standard_Integer myPasteEdgesNumber; - TColStd_SequenceOfInteger myPasteConstructionMode; - TColStd_SequenceOfInteger myPasteConstraintMode; -}; diff --git a/src/SKETCHER/GEOM_SketcherStatus.h b/src/SKETCHER/GEOM_SketcherStatus.h deleted file mode 100644 index 4e3adbc1a..000000000 --- a/src/SKETCHER/GEOM_SketcherStatus.h +++ /dev/null @@ -1,53 +0,0 @@ -// GEOM SKETCHER : basic sketcher -// -// 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 : GEOM_SketcherStatus.h -// Author : Nicolas REJNERI -// Module : GEOM -// $Header$ - -enum TransitionStatus { - NOCONSTRAINT, // no constraint between consecutive edges - TANGENT, // arc and segment are tangent - PERPENDICULAR,// arc is tangent to the perpendicular to the segment - ANGLE, // Angular constraint between 2 segments - LENGTH_FIXED, // Length of segment has been fixed - X_FIXED, // X coordinate for segment has been fixed - Y_FIXED // Y coordinate for segment has been fixed - }; - -enum TypeOfParameter { - ANGLE_PARAMETER, - LENGTH_PARAMETER, - RADIUS_PARAMETER, - XVALUE_PARAMETER, - YVALUE_PARAMETER - }; - -enum SketchStatus { - BEGIN_SKETCH, // Begin sketch; no edges created yet - SEGMENT, // Current mode for creation is segment - ARC_CHORD, // Current mode for creation is arc by chord - ARC_CHORD_END,// Chord validated, waiting for radius or center - END_SKETCH // End sketch -}; diff --git a/src/SKETCHER/Makefile.in b/src/SKETCHER/Makefile.in index 7b8a2758e..924e7e9b6 100644 --- a/src/SKETCHER/Makefile.in +++ b/src/SKETCHER/Makefile.in @@ -36,22 +36,16 @@ VPATH=.:@srcdir@:@top_srcdir@/idl # Libraries targets LIB = libGEOMSketcher.la -LIB_SRC = GEOM_Sketcher.cxx +LIB_SRC = Sketcher_Profile.cxx LIB_CLIENT_IDL = SALOME_Component.idl SALOMEDS.idl SALOME_Exception.idl GEOM_Shape.idl GEOM_Gen.idl GEOM_Kinematic.idl # header files -EXPORT_HEADERS= GEOM_Sketcher.h \ - GEOM_SketcherStatus.h +EXPORT_HEADERS= Sketcher_Profile.hxx # additionnal information to compil and link file -CPPFLAGS += $(OCC_INCLUDES) $(QT_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome -CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += $(QT_LIBS) $(CAS_LDPATH) -lTKTopAlgo -L${KERNEL_ROOT_DIR}/lib/salome - -# additional file to be cleaned -MOSTLYCLEAN = -CLEAN = -DISTCLEAN = +CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome +LDFLAGS += $(OCC_KERNEL_LIBS) $(OCC_MODELER_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome @CONCLUDE@ diff --git a/src/SKETCHER/Sketcher_Profile.cxx b/src/SKETCHER/Sketcher_Profile.cxx new file mode 100644 index 000000000..4df75a7bf --- /dev/null +++ b/src/SKETCHER/Sketcher_Profile.cxx @@ -0,0 +1,382 @@ +// GEOM SKETCHER : basic sketcher +// +// 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 : Sketcher_Profile.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +using namespace std; +#include "Sketcher_Profile.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include CORBA_SERVER_HEADER(SALOMEDS) + +//======================================================================= +// profile +// command to build a profile +//======================================================================= +Sketcher_Profile::Sketcher_Profile() +{ +} + + +//======================================================================= +// profile +// command to build a profile +//======================================================================= +Sketcher_Profile::Sketcher_Profile(const char* aCmd) +{ + enum {line, circle, point, none} move; + + Standard_Integer i = 1; + Standard_Real x0, y0, x, y, dx, dy; + x0 = y0 = x = y = dy = 0; + dx = 1; + + Standard_Boolean first, stayfirst, face, close; + first = Standard_True; + stayfirst = face = close = Standard_False; + + TopoDS_Shape S; + TopoDS_Vertex MP; + BRepBuilderAPI_MakeWire MW; + gp_Ax3 DummyHP(gp::XOY()); + gp_Pln P(DummyHP); + TopLoc_Location TheLocation; + Handle(Geom_Surface) Surface; + + myOK = Standard_False; + + TCollection_AsciiString aCommand(CORBA::string_dup(aCmd)); + TCollection_AsciiString aToken = aCommand.Token(":", 1); + int n = 0; + TCollection_AsciiString aTab[aCommand.Length()]; + while(aToken.Length() != 0) { + if(aCommand.Token(":", n + 1).Length() > 0) + aTab[n] = aCommand.Token(":", n + 1); + aToken = aCommand.Token(":", ++n); + } + n = n - 1; + + while(i < n) { + Standard_Real length = 0, radius = 0, angle = 0; + move = point; + + int n1 = 0; + TCollection_AsciiString a[aTab[0].Length()]; + aToken = aTab[i].Token(" ", 1); + while(aToken.Length() != 0) { + if(aTab[i].Token(" ", n1 + 1).Length() > 0) + a[n1] = aTab[i].Token(" ", n1 + 1); + aToken = aTab[i].Token(" ", ++n1); + } + n1 = n1 - 1; + + switch(a[0].Value(1)) + { + case 'F': + { + if (n1 != 3) goto badargs; + if (!first) { + cout<<"profile : The F instruction must precede all moves"< Precision::Confusion()) + move = line; + else + move = none; + break; + } + case 'T': + { + if (n1 != 3) goto badargs; + Standard_Real vx = a[1].RealValue(); + Standard_Real vy = a[2].RealValue(); + if (a[0] == "TT") { + vx -= x; + vy -= y; + } + length = Sqrt(vx * vx + vy * vy); + if (length > Precision::Confusion()) { + move = line; + dx = vx / length; + dy = vy / length; + } + else + move = none; + break; + } + case 'R': + { + if (n1 != 2) goto badargs; + angle = a[1].RealValue() * PI180; + if (a[0] == "RR") { + dx = Cos(angle); + dy = Sin(angle); + } + else { + Standard_Real c = Cos(angle); + Standard_Real s = Sin(angle); + Standard_Real t = c * dx - s * dy; + dy = s * dx + c * dy; + dx = t; + } + break; + } + case 'D': + { + if (n1 != 3) goto badargs; + Standard_Real vx = a[1].RealValue(); + Standard_Real vy = a[2].RealValue(); + length = Sqrt(vx * vx + vy * vy); + if (length > Precision::Confusion()) { + dx = vx / length; + dy = vy / length; + } + else + move = none; + break; + } + case 'C': + { + if (n1 != 3) goto badargs; + radius = a[1].RealValue(); + if (Abs(radius) > Precision::Confusion()) { + angle = a[2].RealValue() * PI180; + move = circle; + } + else + move = none; + break; + } + case 'I': + { + if (n1 != 2) goto badargs; + length = a[1].RealValue(); + if (a[0] == "IX") { + if (Abs(dx) < Precision::Confusion()) { + cout<<"profile : cannot intersect, arg "< Precision::Confusion()) + move = line; + else + move = none; + break; + } + case 'W': + { + if (a[0] == "WW") + close = Standard_True; + else if(a[0] == "WF") { + close = Standard_True; + face = Standard_True; + } + i = n - 1; + break; + } + default: + { + cout<<"profile : unknown code "<D1(angle,p,v); + x = p.X(); + y = p.Y(); + dx = v.X() / radius; + dy = v.Y() / radius; + break; + } + case point: + { + MP = BRepBuilderAPI_MakeVertex(gp_Pnt(x, y, 0.0)); + break; + } + case none: + { + i = n - 1; + break; + } + } + + // update first + first = stayfirst; + stayfirst = Standard_False; + + if(!(dx == 0 && dy == 0)) + myLastDir.SetCoord(dx, dy, 0.0); + else + return; + myLastPoint.SetX(x); + myLastPoint.SetY(y); + + // next segment.... + i++; + if ((i == n) && close) { + // the closing segment + dx = x0 - x; + dy = y0 - y; + length = Sqrt(dx * dx + dy * dy); + move = line; + if (length > Precision::Confusion()) { + dx = dx / length; + dy = dy / length; + goto again; + } + } + } + + // get the result, face or wire + if (move == none) + return; + else if (move == point) + S = MP; + else if (face) + S = BRepBuilderAPI_MakeFace(P, MW.Wire()); + else + S = MW; + + if(!TheLocation.IsIdentity()) + S.Move(TheLocation); + + myShape = S; + myOK = true; + return; + + badargs : + cout<<"profile : bad number of arguments"< +#include +#include -class Kinematic_Translation +class Sketcher_Profile { + public: - Kinematic_Translation(); - Kinematic_Translation(double ValX, double ValY, double ValZ); - ~Kinematic_Translation(); + Sketcher_Profile(); + Sketcher_Profile(const char* aCmd); private: - double myValX; - double myValY; - double myValZ; + gp_Pnt myLastPoint; + gp_Dir myLastDir; + + TopoDS_Shape myShape; + bool myOK; public: - void ValX(double ValX){myValX = ValX;}; - void ValY(double ValY){myValY = ValY;}; - void ValZ(double ValZ){myValZ = ValZ;}; + gp_Pnt GetLastPoint(){return myLastPoint;}; + gp_Dir GetLastDir(){return myLastDir;}; - double& ValX(){return myValX;}; - double& ValY(){return myValY;}; - double& ValZ(){return myValZ;}; + const TopoDS_Shape& GetShape(){return myShape;}; + bool IsDone(){return myOK;}; }; - -#endif diff --git a/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx index ef5b63648..5b9d8126f 100644 --- a/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx @@ -26,13 +26,16 @@ // Module : GEOM // $Header$ -using namespace std; #include "TransformationGUI_MirrorDlg.h" #include #include #include +#include "utilities.h" + +using namespace std; + //================================================================================= // class : TransformationGUI_MirrorDlg() // purpose : Constructs a TransformationGUI_MirrorDlg which is a child of 'parent', with the diff --git a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx index 479bd0116..2d7b5aae1 100644 --- a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "TransformationGUI_MultiRotationDlg.h" #include @@ -42,6 +41,10 @@ using namespace std; #include #include "QAD_Config.h" +#include "utilities.h" + +using namespace std; + //================================================================================= // class : TransformationGUI_MultiRotationDlg() // purpose : Constructs a TransformationGUI_MultiRotationDlg which is a child of 'parent', with the diff --git a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx index 39646b6e3..9a78c2ecb 100644 --- a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx @@ -26,7 +26,6 @@ // Module : GEOM // $Header$ -using namespace std; #include "TransformationGUI_MultiTranslationDlg.h" #include @@ -39,6 +38,10 @@ using namespace std; #include #include "QAD_Config.h" +#include "utilities.h" + +using namespace std; + //================================================================================= // class : TransformationGUI_MultiTranslationDlg() // purpose : Constructs a TransformationGUI_MultiTranslationDlg which is a child of 'parent', with the diff --git a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx index 6fefe1d78..6d61325c3 100644 --- a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx @@ -26,13 +26,16 @@ // Module : GEOM // $Header$ -using namespace std; #include "TransformationGUI_RotationDlg.h" #include #include #include +#include "utilities.h" + +using namespace std; + //================================================================================= // class : TransformationGUI_RotationDlg() // purpose : Constructs a TransformationGUI_RotationDlg which is a child of 'parent', with the diff --git a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx index 3edcbf8b0..96b875d8b 100644 --- a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx @@ -26,11 +26,14 @@ // Module : GEOM // $Header$ -using namespace std; #include "TransformationGUI_ScaleDlg.h" #include +#include "utilities.h" + +using namespace std; + //================================================================================= // class : TransformationGUI_ScaleDlg() // purpose : Constructs a TransformationGUI_ScaleDlg which is a child of 'parent', with the diff --git a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx index 2a38b49eb..59f6e60d1 100644 --- a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx @@ -26,12 +26,15 @@ // Module : GEOM // $Header$ -using namespace std; #include "TransformationGUI_TranslationDlg.h" #include #include "QAD_Config.h" +#include "utilities.h" + +using namespace std; + //================================================================================= // class : TransformationGUI_TranslationDlg() // purpose : Constructs a TransformationGUI_TranslationDlg which is a child of 'parent', with the