From 84f8423a0ddb5da3f4c149eb168ddca3bcd3a39b Mon Sep 17 00:00:00 2001 From: dcq Date: Mon, 15 Dec 2003 16:09:35 +0000 Subject: [PATCH] DCQ : Sketcher --- idl/GEOM_Gen.idl | 7 +- src/BuildGUI/BuildGUI.cxx | 511 ------ src/BuildGUI/BuildGUI.h | 9 - src/BuildGUI/Makefile.in | 6 +- src/DisplayGUI/DisplayGUI.cxx | 24 - src/EntityGUI/EntityGUI.cxx | 763 +++++++++ src/EntityGUI/EntityGUI.h | 72 + src/EntityGUI/EntityGUI_1Sel_QTD.cxx | 93 ++ src/EntityGUI/EntityGUI_1Sel_QTD.h | 46 + src/EntityGUI/EntityGUI_1Spin.cxx | 56 + src/EntityGUI/EntityGUI_1Spin.h | 47 + src/EntityGUI/EntityGUI_1Spin_QTD.cxx | 88 ++ src/EntityGUI/EntityGUI_1Spin_QTD.h | 45 + src/EntityGUI/EntityGUI_2Spin.cxx | 60 + src/EntityGUI/EntityGUI_2Spin.h | 48 + src/EntityGUI/EntityGUI_2Spin_QTD.cxx | 99 ++ src/EntityGUI/EntityGUI_2Spin_QTD.h | 47 + src/EntityGUI/EntityGUI_3Spin.cxx | 63 + src/EntityGUI/EntityGUI_3Spin.h | 49 + src/EntityGUI/EntityGUI_3Spin_QTD.cxx | 110 ++ src/EntityGUI/EntityGUI_3Spin_QTD.h | 49 + src/EntityGUI/EntityGUI_4Spin.cxx | 67 + src/EntityGUI/EntityGUI_4Spin.h | 50 + src/EntityGUI/EntityGUI_4Spin_QTD.cxx | 121 ++ src/EntityGUI/EntityGUI_4Spin_QTD.h | 51 + src/EntityGUI/EntityGUI_Dir1_QTD.cxx | 80 + src/EntityGUI/EntityGUI_Dir1_QTD.h | 41 + src/EntityGUI/EntityGUI_Dir2_QTD.cxx | 76 + src/EntityGUI/EntityGUI_Dir2_QTD.h | 40 + src/EntityGUI/EntityGUI_Point_QTD.cxx | 74 + src/EntityGUI/EntityGUI_Point_QTD.h | 40 + src/EntityGUI/EntityGUI_Skeleton_QTD.cxx | 176 +++ src/EntityGUI/EntityGUI_Skeleton_QTD.h | 61 + src/EntityGUI/EntityGUI_SketcherDlg.cxx | 1103 +++++++++++++ src/EntityGUI/EntityGUI_SketcherDlg.h | 149 ++ .../EntityGUI_SplineDlg.cxx} | 68 +- .../EntityGUI_SplineDlg.h} | 16 +- .../EntityGUI_SubShapeDlg.cxx} | 52 +- .../EntityGUI_SubShapeDlg.h} | 14 +- src/EntityGUI/Makefile.in | 91 ++ src/EntityGUI/UIFiles/EntityGUI_1Sel_QTD.ui | 185 +++ src/EntityGUI/UIFiles/EntityGUI_1Spin_QTD.ui | 177 +++ src/EntityGUI/UIFiles/EntityGUI_2Spin_QTD.ui | 206 +++ src/EntityGUI/UIFiles/EntityGUI_3Spin_QTD.ui | 235 +++ src/EntityGUI/UIFiles/EntityGUI_4Spin_QTD.ui | 264 ++++ src/EntityGUI/UIFiles/EntityGUI_Dir1_QTD.ui | 112 ++ src/EntityGUI/UIFiles/EntityGUI_Dir2_QTD.ui | 120 ++ src/EntityGUI/UIFiles/EntityGUI_Point_QTD.ui | 103 ++ .../UIFiles/EntityGUI_Skeleton_QTD.ui | 379 +++++ src/EntityGUI/UIFiles/ui_to_cxx | 28 + src/GEOM/GEOM_Gen_i.cc | 35 +- src/GEOM/GEOM_Gen_i.hh | 13 +- src/GEOMContext/GEOM_icons.po | 4 +- src/GEOMContext/GEOM_msg_en.po | 113 +- src/GEOMGUI/GeometryGUI.cxx | 10 +- src/Makefile.in | 2 +- src/SKETCHER/GEOM_Sketcher.cxx | 1389 ----------------- src/SKETCHER/GEOM_Sketcher.h | 201 --- src/SKETCHER/Makefile.in | 26 +- src/SKETCHER/Sketcher_Profile.cxx | 382 +++++ ..._SketcherStatus.h => Sketcher_Profile.hxx} | 57 +- 61 files changed, 6432 insertions(+), 2271 deletions(-) create mode 100644 src/EntityGUI/EntityGUI.cxx create mode 100644 src/EntityGUI/EntityGUI.h create mode 100644 src/EntityGUI/EntityGUI_1Sel_QTD.cxx create mode 100644 src/EntityGUI/EntityGUI_1Sel_QTD.h create mode 100644 src/EntityGUI/EntityGUI_1Spin.cxx create mode 100644 src/EntityGUI/EntityGUI_1Spin.h create mode 100644 src/EntityGUI/EntityGUI_1Spin_QTD.cxx create mode 100644 src/EntityGUI/EntityGUI_1Spin_QTD.h create mode 100644 src/EntityGUI/EntityGUI_2Spin.cxx create mode 100644 src/EntityGUI/EntityGUI_2Spin.h create mode 100644 src/EntityGUI/EntityGUI_2Spin_QTD.cxx create mode 100644 src/EntityGUI/EntityGUI_2Spin_QTD.h create mode 100644 src/EntityGUI/EntityGUI_3Spin.cxx create mode 100644 src/EntityGUI/EntityGUI_3Spin.h create mode 100644 src/EntityGUI/EntityGUI_3Spin_QTD.cxx create mode 100644 src/EntityGUI/EntityGUI_3Spin_QTD.h create mode 100644 src/EntityGUI/EntityGUI_4Spin.cxx create mode 100644 src/EntityGUI/EntityGUI_4Spin.h create mode 100644 src/EntityGUI/EntityGUI_4Spin_QTD.cxx create mode 100644 src/EntityGUI/EntityGUI_4Spin_QTD.h create mode 100644 src/EntityGUI/EntityGUI_Dir1_QTD.cxx create mode 100644 src/EntityGUI/EntityGUI_Dir1_QTD.h create mode 100644 src/EntityGUI/EntityGUI_Dir2_QTD.cxx create mode 100644 src/EntityGUI/EntityGUI_Dir2_QTD.h create mode 100644 src/EntityGUI/EntityGUI_Point_QTD.cxx create mode 100644 src/EntityGUI/EntityGUI_Point_QTD.h create mode 100644 src/EntityGUI/EntityGUI_Skeleton_QTD.cxx create mode 100644 src/EntityGUI/EntityGUI_Skeleton_QTD.h create mode 100644 src/EntityGUI/EntityGUI_SketcherDlg.cxx create mode 100644 src/EntityGUI/EntityGUI_SketcherDlg.h rename src/{BuildGUI/BuildGUI_SplineDlg.cxx => EntityGUI/EntityGUI_SplineDlg.cxx} (84%) rename src/{BuildGUI/BuildGUI_SplineDlg.h => EntityGUI/EntityGUI_SplineDlg.h} (83%) rename src/{BuildGUI/BuildGUI_SubShapeDlg.cxx => EntityGUI/EntityGUI_SubShapeDlg.cxx} (92%) rename src/{BuildGUI/BuildGUI_SubShapeDlg.h => EntityGUI/EntityGUI_SubShapeDlg.h} (86%) create mode 100644 src/EntityGUI/Makefile.in create mode 100644 src/EntityGUI/UIFiles/EntityGUI_1Sel_QTD.ui create mode 100644 src/EntityGUI/UIFiles/EntityGUI_1Spin_QTD.ui create mode 100644 src/EntityGUI/UIFiles/EntityGUI_2Spin_QTD.ui create mode 100644 src/EntityGUI/UIFiles/EntityGUI_3Spin_QTD.ui create mode 100644 src/EntityGUI/UIFiles/EntityGUI_4Spin_QTD.ui create mode 100644 src/EntityGUI/UIFiles/EntityGUI_Dir1_QTD.ui create mode 100644 src/EntityGUI/UIFiles/EntityGUI_Dir2_QTD.ui create mode 100644 src/EntityGUI/UIFiles/EntityGUI_Point_QTD.ui create mode 100644 src/EntityGUI/UIFiles/EntityGUI_Skeleton_QTD.ui create mode 100755 src/EntityGUI/UIFiles/ui_to_cxx delete mode 100644 src/SKETCHER/GEOM_Sketcher.cxx delete mode 100644 src/SKETCHER/GEOM_Sketcher.h create mode 100644 src/SKETCHER/Sketcher_Profile.cxx rename src/SKETCHER/{GEOM_SketcherStatus.h => Sketcher_Profile.hxx} (52%) diff --git a/idl/GEOM_Gen.idl b/idl/GEOM_Gen.idl index 4e76a246b..829930744 100644 --- a/idl/GEOM_Gen.idl +++ b/idl/GEOM_Gen.idl @@ -233,7 +233,12 @@ module GEOM // Splines // //-----------------------------------------------------------// GEOM_Shape MakeBezier (in ListOfIOR ListShape) raises (SALOME::SALOME_Exception) ; - GEOM_Shape MakeBSpline(in ListOfIOR ListShape) raises (SALOME::SALOME_Exception) ; + GEOM_Shape MakeInterpol(in ListOfIOR ListShape) raises (SALOME::SALOME_Exception) ; + + //-----------------------------------------------------------// + // Sketcher // + //-----------------------------------------------------------// + GEOM_Shape MakeSketcher (in string Cmd) raises (SALOME::SALOME_Exception) ; //-----------------------------------------------------------// // Build // diff --git a/src/BuildGUI/BuildGUI.cxx b/src/BuildGUI/BuildGUI.cxx index 28ef04541..4d404afc2 100644 --- a/src/BuildGUI/BuildGUI.cxx +++ b/src/BuildGUI/BuildGUI.cxx @@ -29,21 +29,8 @@ using namespace std; #include "BuildGUI.h" -#include "DisplayGUI.h" - -#include "OCCViewer_Viewer3d.h" -#include "VTKViewer_ViewFrame.h" -#include "QAD_RightFrame.h" -#include "GEOM_AssemblyBuilder.h" -#include "SALOMEGUI_ImportOperation.h" #include "SALOMEGUI_QtCatchCorbaException.hxx" -#include -#include -#include - -#include "BuildGUI_SubShapeDlg.h" // Method SUBSHAPE -#include "BuildGUI_SplineDlg.h" // Method SPLINE #include "BuildGUI_EdgeDlg.h" // Method EDGE #include "BuildGUI_WireDlg.h" // Method WIRE #include "BuildGUI_FaceDlg.h" // Method FACE @@ -85,21 +72,6 @@ bool BuildGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) switch (theCommandID) { - case 406: // GEOM::SPLINE - { - BuildGUI_SplineDlg *aDlg = new BuildGUI_SplineDlg(parent, "", myBuildGUI, Sel); - break; - } - case 407: // EXPLODE : use ic - { - Handle(AIS_InteractiveContext) ic; - if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - ic = v3d->getAISContext(); - } - BuildGUI_SubShapeDlg *aDlg = new BuildGUI_SubShapeDlg(parent, "", myBuildGUI, Sel, ic); - break ; - } case 4081: // GEOM::EDGE { BuildGUI_EdgeDlg *aDlg = new BuildGUI_EdgeDlg(parent, "", myBuildGUI, Sel); @@ -140,52 +112,6 @@ bool BuildGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) } -//===================================================================================== -// function : MakeBSplineAndDisplay() -// purpose : -//===================================================================================== -void BuildGUI::MakeBSplineAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR) -{ - try { - GEOM::GEOM_Shape_var result = myGeom->MakeBSpline(listShapesIOR); - if(result->_is_nil()) { - QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); - return; - } - result->NameType(tr("GEOM_WIRE")); - if(myGeomBase->Display(result)) - QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); - } - catch(const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return; -} - - -//===================================================================================== -// function : MakeBSplineAndDisplay() -// purpose : -//===================================================================================== -void BuildGUI::MakeBezierAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR) -{ - try { - GEOM::GEOM_Shape_var result = myGeom->MakeBezier(listShapesIOR); - if(result->_is_nil()) { - QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); - return; - } - result->NameType(tr("GEOM_WIRE")); - if(myGeomBase->Display(result)) - QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); - } - catch(const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - return; -} - - //===================================================================================== // function : MakeLinearEdgeAndDisplay() // purpose : @@ -329,443 +255,6 @@ void BuildGUI::MakeCompoundAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR) } - - -//===================================================================================== -// function : SObjectExist() -// purpose : -//===================================================================================== -bool BuildGUI::SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* IOR) -{ - SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); - SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(theFatherObject); - SALOMEDS::SObject_var RefSO; - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeIOR_var anIOR; - for(; it->More();it->Next()) { - SALOMEDS::SObject_var SO= it->Value(); - if(SO->FindAttribute(anAttr, "AttributeIOR")) { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - if(strcmp( anIOR->Value(), IOR ) == 0) - return true; - } - if(SO->ReferencedObject(RefSO)) { - if(RefSO->FindAttribute(anAttr, "AttributeIOR")) { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - if(strcmp(anIOR->Value(), IOR) == 0) - return true; - } - } - } - return false; -} - - -//===================================================================================== -// function : OnSubShapeGetAll() -// purpose : Explode a shape in all sub shapes with a SubShapeType -//===================================================================================== -bool BuildGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType) -{ - SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); - SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(ShapeTopoIOR); - if(theObj->_is_nil()) { - QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); - return false; - } - - SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry()); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeName_var aName; - SALOMEDS::AttributeIOR_var anIOR; - SALOMEDS::AttributePixMap_var aPixmap; - - /* We create a sub object for each sub shape as attribute of the main object */ - /* Each sub object contains list (length=1) containing its index in the main shape */ - GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(ShapeTopoIOR); - GEOM::GEOM_Gen::ListOfGeomShapes_var listGeomShapes = new GEOM::GEOM_Gen::ListOfGeomShapes; - GEOM::GEOM_Shape_var aResult; - - try { - listGeomShapes = myGeom->SubShapeAll(aShape, SubShapeType); - if(listGeomShapes->length() < 1) { - QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_ABORT")); - return false; - } - } - catch(const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - - /* open transaction */ - QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy()); - op->start(); - - TopoDS_Shape mainTopo = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); - TopoDS_Shape mainShape; - bool main = false; - while(!main) { - if(aShape->IsMainShape()) { - mainShape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); - main = true; - } - else - aShape = myGeom->GetIORFromString(aShape->MainName()); - } - - /* Loop on each sub shape created */ - /* int i = 1 ; /* index for the nameType */ - for(int j=0; jlength(); j++) { - /* Get each sub shape extracted CORBA and OCC */ - aResult = listGeomShapes[j] ; - TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, aResult); - - if (S.IsNull()) { - QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_ABORT")); - return false; - } - - /* Set the nameType of sub shape */ - char* nameG = (char *)malloc(20); - Standard_CString Type; - if(myGeomBase->GetShapeTypeString(S, Type)) { - aResult->NameType(Type); - sprintf(nameG, "%s_%d", Type, myGeomBase->GetIndex(S, mainShape, SubShapeType)); - } - else { - aResult->NameType(tr("GEOM_SHAPE")); - sprintf(nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->GetNbGeom()++); - } - SALOMEDS::SObject_var SO = aStudy->FindObjectIOR(aResult->Name()); - - bool allreadyexist = false; - - if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - - Handle(GEOM_AISShape) result = new GEOM_AISShape(S, nameG); - Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM"); - - MESSAGE ("SO->_is_nil() " << SO->_is_nil()) - - if(SO->_is_nil()) { - SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(theObj); - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName"); - aName = SALOMEDS::AttributeName::_narrow(anAttr); - aName->SetValue(nameG); - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"); - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - anIOR->SetValue(aResult->Name()); - - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap"); - aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); - MESSAGE(" Type " << S.ShapeType()) - if (S.ShapeType() == TopAbs_COMPOUND) - aPixmap->SetPixMap("ICON_OBJBROWSER_COMPOUND"); - else if(S.ShapeType() == TopAbs_COMPSOLID) - aPixmap->SetPixMap("ICON_OBJBROWSER_COMPSOLID"); - else if(S.ShapeType() == TopAbs_SOLID) - aPixmap->SetPixMap("ICON_OBJBROWSER_SOLID"); - else if(S.ShapeType() == TopAbs_SHELL) - aPixmap->SetPixMap("ICON_OBJBROWSER_SHELL"); - else if(S.ShapeType() == TopAbs_FACE) - aPixmap->SetPixMap("ICON_OBJBROWSER_FACE"); - else if(S.ShapeType() == TopAbs_WIRE) - aPixmap->SetPixMap("ICON_OBJBROWSER_WIRE"); - else if(S.ShapeType() == TopAbs_EDGE) - aPixmap->SetPixMap("ICON_OBJBROWSER_EDGE"); - else if(S.ShapeType() == TopAbs_VERTEX) - aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX"); - - MESSAGE(" aPixmap->GetPixMap " << aPixmap->GetPixMap()) - - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); - aStudyBuilder->Addreference(newObj1, newObj); - IO->setEntry(newObj->GetID()); - - aResult->StudyShapeId(newObj->GetID()); - } - else { - allreadyexist = true; - if(!this->SObjectExist(theObj, aResult->Name())) { - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj); - aStudyBuilder->Addreference(newObj1, SO); - IO->setEntry(SO->GetID()); - aResult->StudyShapeId(SO->GetID()); - } - } - - result->setIO(IO); - result->setName(nameG); - if(!allreadyexist) - ic->Display(result); - - } - else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { - VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - - int themode = myRenderInter->GetDisplayMode(); - vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); - vtkRenderWindow *renWin = theRenderer->GetRenderWindow(); - - Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM"); - - if(SO->_is_nil()) { - SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(theObj); - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"); - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - anIOR->SetValue(aResult->Name()); - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName"); - aName = SALOMEDS::AttributeName::_narrow(anAttr); - aName->SetValue(nameG); - - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap"); - aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); - if(S.ShapeType() == TopAbs_COMPOUND) - aPixmap->SetPixMap("ICON_OBJBROWSER_COMPOUND"); - else if(S.ShapeType() == TopAbs_COMPSOLID) - aPixmap->SetPixMap("ICON_OBJBROWSER_COMPSOLID"); - else if(S.ShapeType() == TopAbs_SOLID) - aPixmap->SetPixMap("ICON_OBJBROWSER_SOLID"); - else if(S.ShapeType() == TopAbs_SHELL) - aPixmap->SetPixMap("ICON_OBJBROWSER_SHELL"); - else if(S.ShapeType() == TopAbs_FACE) - aPixmap->SetPixMap("ICON_OBJBROWSER_FACE"); - else if(S.ShapeType() == TopAbs_WIRE) - aPixmap->SetPixMap("ICON_OBJBROWSER_WIRE"); - else if(S.ShapeType() == TopAbs_EDGE) - aPixmap->SetPixMap("ICON_OBJBROWSER_EDGE"); - else if(S.ShapeType() == TopAbs_VERTEX) - aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX"); - - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); - aStudyBuilder->Addreference(newObj1, newObj); - IO->setEntry(newObj->GetID()); - } - else { - allreadyexist = true; - if(!this->SObjectExist(theObj, aResult->Name())) { - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj); - aStudyBuilder->Addreference(newObj1, SO); - IO->setEntry(SO->GetID()); - } - } - - if(!allreadyexist) { - vtkActorCollection* theActors = GEOM_AssemblyBuilder::BuildActors(S,0,themode,Standard_True); - theActors->InitTraversal(); - vtkActor* anActor = (vtkActor*)theActors->GetNextActor(); - while(!(anActor==NULL)) { - GEOM_Actor* GActor = GEOM_Actor::SafeDownCast(anActor); - GActor->setIO(IO); - GActor->setName(nameG); - theRenderer->AddActor(GActor); - renWin->Render(); - anActor = (vtkActor*)theActors->GetNextActor(); - } - } - } - } - - /* commit transaction */ - op->finish(); - - QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(); - QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_READY")); - return true; -} - - -//===================================================================================== -// function : OnSubShapeGetSelected() -// purpose : -//===================================================================================== -bool BuildGUI::OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType, Standard_Integer& aLocalContextId, bool& myUseLocalContext) -{ - //* Test the type of viewer */ - if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) - return false; - - SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); - SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(ShapeTopoIOR); - if(theObj->_is_nil()) { - QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); - return false; - } - - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); - - if( myUseLocalContext == false ) { - /* local context is from DialogBox */ - MESSAGE("Error : No local context opened for sub shapes method" << endl ) ; - return false ; - } - - GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString( ShapeTopoIOR ); - TopoDS_Shape mainTopo = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); - - TopoDS_Shape mainShape; - bool main = false; - while(!main) { - if(aShape->IsMainShape()) { - mainShape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); - main = true; - } - else - aShape = myGeom->GetIORFromString(aShape->MainName()); - } - - GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; - ic->InitSelected(); - int nbSelected = ic->NbSelected(); - ListOfID->length(nbSelected); - - TopoDS_Compound compound; - ic->InitSelected(); /* to init again */ - BRep_Builder B; - B.MakeCompound(compound); - - int i = 0; - /* We create a unique compound containing all the sub shapes selected by user as attribute of the main shape */ - /* the compound is homogenous by selection */ - while(ic->MoreSelected()) { - int index = myGeomBase->GetIndex(ic->SelectedShape(), mainShape, SubShapeType); - ListOfID[i] = index; - B.Add(compound, ic->SelectedShape()); - i++; - ic->NextSelected(); - } - - /* Test if user has selected sub shapes */ - if(ListOfID->length() < 1) - return false; - - GEOM::GEOM_Shape_var aResult; - try { - aResult = myGeom->SubShape(aShape, SubShapeType, ListOfID); - } - catch (const SALOME::SALOME_Exception& S_ex) { - QtCatchCorbaException(S_ex); - } - - /* local context from DialogBox */ - ic->CloseLocalContext(aLocalContextId); - myUseLocalContext = false ; - - char* nameG = (char *)malloc(20); - Standard_CString Type; - - Handle(GEOM_AISShape) result; - Handle(GEOM_InteractiveObject) IO; - - if(nbSelected == 1) { - TopExp_Explorer Exp (compound, TopAbs_ShapeEnum(SubShapeType)); - if(Exp.More()) { - if(myGeomBase->GetShapeTypeString(Exp.Current(),Type)) { - aResult->NameType(Type); - sprintf (nameG, "%s_%d", Type, myGeomBase->GetIndex( Exp.Current(), mainTopo, SubShapeType)); - } - else { - aResult->NameType(tr("GEOM_SHAPE")); - sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->GetNbGeom()++); - } - result = new GEOM_AISShape(Exp.Current(), nameG); - IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM"); - } - } - else { - if ( myGeomBase->GetShapeTypeString(compound,Type)) { - aResult->NameType(Type); - sprintf (nameG, "%s_%d", Type, myGeomGUI->GetNbGeom()++); - } else { - aResult->NameType(tr("GEOM_SHAPE")); - sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->GetNbGeom()++); - } - result = new GEOM_AISShape(compound, nameG); - IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM"); - } - - SALOMEDS::SObject_var SO = aStudy->FindObjectIOR(aResult->Name()); - - /* open transaction */ - QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy()); - op->start(); - - SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry()); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeName_var aName; - SALOMEDS::AttributeIOR_var anIOR; - SALOMEDS::AttributePixMap_var aPixmap; - - bool allreadyexist = false; - - if(SO->_is_nil()) { - SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(theObj); - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"); - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - anIOR->SetValue(aResult->Name()); - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName"); - aName = SALOMEDS::AttributeName::_narrow(anAttr); - aName->SetValue(result->getName()); - - anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap"); - aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); - if(result->Shape().ShapeType() == TopAbs_COMPOUND) - aPixmap->SetPixMap("ICON_OBJBROWSER_COMPOUND"); - else if(result->Shape().ShapeType() == TopAbs_COMPSOLID) - aPixmap->SetPixMap("ICON_OBJBROWSER_COMPSOLID"); - else if(result->Shape().ShapeType() == TopAbs_SOLID) - aPixmap->SetPixMap("ICON_OBJBROWSER_SOLID"); - else if(result->Shape().ShapeType() == TopAbs_SHELL) - aPixmap->SetPixMap("ICON_OBJBROWSER_SHELL"); - else if(result->Shape().ShapeType() == TopAbs_FACE) - aPixmap->SetPixMap("ICON_OBJBROWSER_FACE"); - else if(result->Shape().ShapeType() == TopAbs_WIRE) - aPixmap->SetPixMap("ICON_OBJBROWSER_WIRE"); - else if(result->Shape().ShapeType() == TopAbs_EDGE) - aPixmap->SetPixMap("ICON_OBJBROWSER_EDGE"); - else if(result->Shape().ShapeType() == TopAbs_VERTEX) - aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX"); - - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); - aStudyBuilder->Addreference(newObj1, newObj); - - IO->setEntry(newObj->GetID()); - aResult->StudyShapeId(newObj->GetID()); - } - else { - allreadyexist = true; - if(!this->SObjectExist(theObj, aResult->Name())) { - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj); - aStudyBuilder->Addreference(newObj1, SO); - - IO->setEntry(SO->GetID()); - aResult->StudyShapeId(SO->GetID()); - } - } - - /* commit transaction */ - op->finish(); - - result->setIO(IO); - result->setName(nameG); - - if(!allreadyexist) - ic->Display(result); - - DisplayGUI* myDisplayGUI = new DisplayGUI(); - myDisplayGUI->OnDisplayAll(true); - - QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(); - QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_READY")); - return true; -} - - //===================================================================================== // EXPORTED METHODS //===================================================================================== diff --git a/src/BuildGUI/BuildGUI.h b/src/BuildGUI/BuildGUI.h index d5b376e84..c8672d5ac 100644 --- a/src/BuildGUI/BuildGUI.h +++ b/src/BuildGUI/BuildGUI.h @@ -53,15 +53,6 @@ public : void MakeSolidAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR); void MakeCompoundAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR); - void MakeBSplineAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR); - void MakeBezierAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR); - - /* Methods for sub shapes explode */ - bool SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* IOR); - bool OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType); - bool OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType, - Standard_Integer& aLocalContextId, bool& myUseLocalContext); - GEOMBase* myGeomBase; GEOMContext* myGeomGUI; GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ diff --git a/src/BuildGUI/Makefile.in b/src/BuildGUI/Makefile.in index 1d59f5437..3b29f7b59 100644 --- a/src/BuildGUI/Makefile.in +++ b/src/BuildGUI/Makefile.in @@ -41,8 +41,6 @@ EXPORT_HEADERS= LIB = libBuildGUI.la LIB_SRC = BuildGUI.cxx \ - BuildGUI_SubShapeDlg.cxx \ - BuildGUI_SplineDlg.cxx \ BuildGUI_EdgeDlg.cxx \ BuildGUI_WireDlg.cxx \ BuildGUI_FaceDlg.cxx \ @@ -52,8 +50,6 @@ LIB_SRC = BuildGUI.cxx \ LIB_MOC = \ BuildGUI.h \ - BuildGUI_SubShapeDlg.h \ - BuildGUI_SplineDlg.h \ BuildGUI_EdgeDlg.h \ BuildGUI_WireDlg.h \ BuildGUI_FaceDlg.h \ @@ -70,6 +66,6 @@ LIB_SERVER_IDL = CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lGEOMFiltersSelection -lDisplayGUI +LDFLAGS += -lGEOMFiltersSelection -lGEOMBase @CONCLUDE@ diff --git a/src/DisplayGUI/DisplayGUI.cxx b/src/DisplayGUI/DisplayGUI.cxx index f14ed3474..b42972f89 100644 --- a/src/DisplayGUI/DisplayGUI.cxx +++ b/src/DisplayGUI/DisplayGUI.cxx @@ -125,9 +125,6 @@ bool DisplayGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) } case 212: // MENU VIEW - DISPLAY ALL { -// if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) -// ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->DisplayAll(); -// else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) myDisplayGUI->OnDisplayAll(); break; } @@ -189,10 +186,8 @@ bool DisplayGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) if(mode == -1) mode = (AIS_DisplayMode)ic->DisplayMode(); - QApplication::setOverrideCursor(Qt::waitCursor); ic->SetDisplayMode(Shape, mode == AIS_WireFrame ? AIS_Shaded : AIS_WireFrame, false); } - QApplication::restoreOverrideCursor(); } ic->UpdateCurrentViewer(); } @@ -517,22 +512,6 @@ void DisplayGUI::OnDisplayAll(bool onlyPreviousDisplayedObject) } } } -// AIS_ListOfInteractive List1; -// myContext->ObjectsInCollector(List1); -// AIS_ListIteratorOfListOfInteractive ite1(List1); -// while(ite1.More()) { -// cout<<"DCQ 1"<IsInstance(STANDARD_TYPE(GEOM_AISShape))) { -// Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite1.Value()); -// if(aSh->hasIO()) { -// Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO()); -// if(v3d->isInViewer(GIO, true)) { -// myContext->Display(aSh); -// } -// } -// } -// ite1.Next(); -// } } else { AIS_ListOfInteractive aListDisplayedObject; @@ -565,9 +544,7 @@ void DisplayGUI::OnDisplayAll(bool onlyPreviousDisplayedObject) GEOM_Actor* aSh = myGeomBase->ConvertIORinGEOMActor(anIOR->Value(), testResult); if(testResult) { Handle(SALOME_InteractiveObject) IObject = aSh->getIO(); - // if(myRenderInter->isInViewer(IObject)) { ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->Display(IObject); - //} } else { GEOM::GEOM_Shape_ptr aShape = myGeom->GetIORFromString(anIOR->Value()); @@ -578,7 +555,6 @@ void DisplayGUI::OnDisplayAll(bool onlyPreviousDisplayedObject) } } } -// ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->DisplayAll(); } return; } diff --git a/src/EntityGUI/EntityGUI.cxx b/src/EntityGUI/EntityGUI.cxx new file mode 100644 index 000000000..2399a60ae --- /dev/null +++ b/src/EntityGUI/EntityGUI.cxx @@ -0,0 +1,763 @@ +// 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.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +using namespace std; +#include "EntityGUI.h" + +#include "QAD_RightFrame.h" +#include "OCCViewer_Viewer3d.h" +#include "VTKViewer_ViewFrame.h" +#include "GEOM_AssemblyBuilder.h" +#include "SALOMEGUI_ImportOperation.h" +#include "SALOMEGUI_QtCatchCorbaException.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "DisplayGUI.h" + +#include "EntityGUI_SketcherDlg.h" // Sketcher +#include "EntityGUI_SplineDlg.h" // Method SPLINE +#include "EntityGUI_SubShapeDlg.h" // Method SUBSHAPE + +//======================================================================= +// function : EntityGUI() +// purpose : Constructor +//======================================================================= +EntityGUI::EntityGUI() : + QObject() +{ + myGeomBase = new GEOMBase(); + myGeomGUI = GEOMContext::GetGeomGUI(); + myGeom = myGeomGUI->myComponentGeom; + + mySimulationShape1 = new AIS_Shape(TopoDS_Shape()); + mySimulationShape2 = new AIS_Shape(TopoDS_Shape()); +} + + +//======================================================================= +// function : ~EntityGUI() +// purpose : Destructor +//======================================================================= +EntityGUI::~EntityGUI() +{ +} + + +//======================================================================= +// function : OnGUIEvent() +// purpose : +//======================================================================= +bool EntityGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) +{ + EntityGUI* myEntityGUI = new EntityGUI(); + myEntityGUI->myGeomGUI->EmitSignalDeactivateDialog(); + SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection()); + + switch (theCommandID) + { + case 404: // SKETCHER + { + ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->onViewTop(); // DCQ : 28/02/2002 + EntityGUI_SketcherDlg* aDlg = new EntityGUI_SketcherDlg(parent, "", myEntityGUI, Sel); + break; + } + case 406: // GEOM::SPLINE + { + EntityGUI_SplineDlg *aDlg = new EntityGUI_SplineDlg(parent, "", myEntityGUI, Sel); + break; + } + case 407: // EXPLODE : use ic + { + Handle(AIS_InteractiveContext) ic; + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + ic = v3d->getAISContext(); + } + EntityGUI_SubShapeDlg *aDlg = new EntityGUI_SubShapeDlg(parent, "", myEntityGUI, Sel, ic); + break ; + } + default: + { + parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + break; + } + } + return true; +} + + +//======================================================================= +// function : OnSketchEnd() +// purpose : +//======================================================================= +void EntityGUI::OnSketchEnd(TopoDS_Shape myShape) +{ + TopoDS_Wire W = TopoDS::Wire(myShape); + + if(!W.IsNull()) { + GEOM::GEOM_Gen::ListOfIOR_var listShapes = new GEOM::GEOM_Gen::ListOfIOR; + listShapes->length(0); + unsigned int i = 0; + + BRepTools_WireExplorer Ex(W); + while(Ex.More()) { + TopoDS_Edge E = TopoDS::Edge(Ex.Current()); + + gp_Pnt pt1, pt2; + pt1 = BRep_Tool::Pnt(TopExp::FirstVertex(E)); + pt2 = BRep_Tool::Pnt(TopExp::LastVertex(E)); + + gp_Pnt CenterPoint; + Handle(Geom_Curve) Curve; + Handle(Geom_Circle) Circle; + gp_Circ Circ; + Standard_Real First,Last; + + Curve = BRep_Tool::Curve(E,First,Last); + if(Curve->IsKind(STANDARD_TYPE(Geom_Circle))) { + Circle = Handle(Geom_Circle)::DownCast(Curve); // pointer on geom_circ + Circ = Circle->Circ(); // gp_Circ + + Curve->D0((First + Last) / 2., CenterPoint); + + GEOM::PointStruct pI = myGeom->MakePointStruct(pt1.X(), pt1.Y(), pt1.Z()); + GEOM::PointStruct pC = myGeom->MakePointStruct(CenterPoint.X(), CenterPoint.Y(), CenterPoint.Z()); + GEOM::PointStruct pE = myGeom->MakePointStruct(pt2.X(), pt2.Y(), pt2.Z()); + + GEOM::GEOM_Shape_var arc; + + try { + arc = myGeom->MakeArc(pI, pC, pE); + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + + listShapes->length(i+1); + listShapes[i] = strdup(arc->Name()); + i++; + } else { + GEOM::PointStruct pI = myGeom->MakePointStruct(pt1.X(), pt1.Y(), pt1.Z()); + GEOM::PointStruct pE = myGeom->MakePointStruct(pt2.X(), pt2.Y(), pt2.Z()); + GEOM::GEOM_Shape_var segment; + + try { + segment = myGeom->MakeEdge(pI,pE); + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + + listShapes->length(i+1); + listShapes[i] = strdup(segment->Name()); + i++; + } + Ex.Next(); + } + + GEOM::GEOM_Shape_var Wire = myGeom->MakeWire(listShapes); + TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, Wire); + Standard_CString type; + myGeomBase->GetShapeTypeString(S,type); + Wire->NameType(type); + + if(myGeomBase->Display(Wire)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + 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 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(); + ic->Erase(mySimulationShape1, Standard_True, Standard_False); + ic->ClearPrs(mySimulationShape1); + ic->Erase(mySimulationShape2, Standard_True, Standard_False); + ic->ClearPrs(mySimulationShape2); + ic->UpdateCurrentViewer(); + } + } +} + + +//===================================================================================== +// function : MakeBSplineAndDisplay() +// purpose : +//===================================================================================== +void EntityGUI::MakeBezierAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR) +{ + try { + GEOM::GEOM_Shape_var result = myGeom->MakeBezier(listShapesIOR); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + return; + } + result->NameType(tr("GEOM_WIRE")); + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//===================================================================================== +// function : MakeInterpolAndDisplay() +// purpose : +//===================================================================================== +void EntityGUI::MakeInterpolAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR) +{ + try { + GEOM::GEOM_Shape_var result = myGeom->MakeInterpol(listShapesIOR); + if(result->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); + return; + } + result->NameType(tr("GEOM_WIRE")); + if(myGeomBase->Display(result)) + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE")); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + return; +} + + +//===================================================================================== +// function : SObjectExist() +// purpose : +//===================================================================================== +bool EntityGUI::SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* IOR) +{ + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(theFatherObject); + SALOMEDS::SObject_var RefSO; + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + for(; it->More();it->Next()) { + SALOMEDS::SObject_var SO= it->Value(); + if(SO->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + if(strcmp( anIOR->Value(), IOR ) == 0) + return true; + } + if(SO->ReferencedObject(RefSO)) { + if(RefSO->FindAttribute(anAttr, "AttributeIOR")) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + if(strcmp(anIOR->Value(), IOR) == 0) + return true; + } + } + } + return false; +} + + +//===================================================================================== +// function : OnSubShapeGetAll() +// purpose : Explode a shape in all sub shapes with a SubShapeType +//===================================================================================== +bool EntityGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType) +{ + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(ShapeTopoIOR); + if(theObj->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); + return false; + } + + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeIOR_var anIOR; + SALOMEDS::AttributePixMap_var aPixmap; + + /* We create a sub object for each sub shape as attribute of the main object */ + /* Each sub object contains list (length=1) containing its index in the main shape */ + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(ShapeTopoIOR); + GEOM::GEOM_Gen::ListOfGeomShapes_var listGeomShapes = new GEOM::GEOM_Gen::ListOfGeomShapes; + GEOM::GEOM_Shape_var aResult; + + try { + listGeomShapes = myGeom->SubShapeAll(aShape, SubShapeType); + if(listGeomShapes->length() < 1) { + QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_ABORT")); + return false; + } + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + + /* open transaction */ + QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy()); + op->start(); + + TopoDS_Shape mainTopo = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); + TopoDS_Shape mainShape; + bool main = false; + while(!main) { + if(aShape->IsMainShape()) { + mainShape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); + main = true; + } + else + aShape = myGeom->GetIORFromString(aShape->MainName()); + } + + /* Loop on each sub shape created */ + /* int i = 1 ; /* index for the nameType */ + for(int j=0; jlength(); j++) { + /* Get each sub shape extracted CORBA and OCC */ + aResult = listGeomShapes[j] ; + TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, aResult); + + if (S.IsNull()) { + QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_ABORT")); + return false; + } + + /* Set the nameType of sub shape */ + char* nameG = (char *)malloc(20); + Standard_CString Type; + if(myGeomBase->GetShapeTypeString(S, Type)) { + aResult->NameType(Type); + sprintf(nameG, "%s_%d", Type, myGeomBase->GetIndex(S, mainShape, SubShapeType)); + } + else { + aResult->NameType(tr("GEOM_SHAPE")); + sprintf(nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->GetNbGeom()++); + } + SALOMEDS::SObject_var SO = aStudy->FindObjectIOR(aResult->Name()); + + bool allreadyexist = false; + + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + + Handle(GEOM_AISShape) result = new GEOM_AISShape(S, nameG); + Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM"); + + MESSAGE ("SO->_is_nil() " << SO->_is_nil()) + + if(SO->_is_nil()) { + SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(theObj); + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue(nameG); + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"); + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + anIOR->SetValue(aResult->Name()); + + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + MESSAGE(" Type " << S.ShapeType()) + if (S.ShapeType() == TopAbs_COMPOUND) + aPixmap->SetPixMap("ICON_OBJBROWSER_COMPOUND"); + else if(S.ShapeType() == TopAbs_COMPSOLID) + aPixmap->SetPixMap("ICON_OBJBROWSER_COMPSOLID"); + else if(S.ShapeType() == TopAbs_SOLID) + aPixmap->SetPixMap("ICON_OBJBROWSER_SOLID"); + else if(S.ShapeType() == TopAbs_SHELL) + aPixmap->SetPixMap("ICON_OBJBROWSER_SHELL"); + else if(S.ShapeType() == TopAbs_FACE) + aPixmap->SetPixMap("ICON_OBJBROWSER_FACE"); + else if(S.ShapeType() == TopAbs_WIRE) + aPixmap->SetPixMap("ICON_OBJBROWSER_WIRE"); + else if(S.ShapeType() == TopAbs_EDGE) + aPixmap->SetPixMap("ICON_OBJBROWSER_EDGE"); + else if(S.ShapeType() == TopAbs_VERTEX) + aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX"); + + MESSAGE(" aPixmap->GetPixMap " << aPixmap->GetPixMap()) + + SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); + aStudyBuilder->Addreference(newObj1, newObj); + IO->setEntry(newObj->GetID()); + + aResult->StudyShapeId(newObj->GetID()); + } + else { + allreadyexist = true; + if(!this->SObjectExist(theObj, aResult->Name())) { + SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj); + aStudyBuilder->Addreference(newObj1, SO); + IO->setEntry(SO->GetID()); + aResult->StudyShapeId(SO->GetID()); + } + } + + result->setIO(IO); + result->setName(nameG); + if(!allreadyexist) + ic->Display(result); + + } + else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + + int themode = myRenderInter->GetDisplayMode(); + vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + vtkRenderWindow *renWin = theRenderer->GetRenderWindow(); + + Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM"); + + if(SO->_is_nil()) { + SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(theObj); + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"); + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + anIOR->SetValue(aResult->Name()); + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue(nameG); + + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + if(S.ShapeType() == TopAbs_COMPOUND) + aPixmap->SetPixMap("ICON_OBJBROWSER_COMPOUND"); + else if(S.ShapeType() == TopAbs_COMPSOLID) + aPixmap->SetPixMap("ICON_OBJBROWSER_COMPSOLID"); + else if(S.ShapeType() == TopAbs_SOLID) + aPixmap->SetPixMap("ICON_OBJBROWSER_SOLID"); + else if(S.ShapeType() == TopAbs_SHELL) + aPixmap->SetPixMap("ICON_OBJBROWSER_SHELL"); + else if(S.ShapeType() == TopAbs_FACE) + aPixmap->SetPixMap("ICON_OBJBROWSER_FACE"); + else if(S.ShapeType() == TopAbs_WIRE) + aPixmap->SetPixMap("ICON_OBJBROWSER_WIRE"); + else if(S.ShapeType() == TopAbs_EDGE) + aPixmap->SetPixMap("ICON_OBJBROWSER_EDGE"); + else if(S.ShapeType() == TopAbs_VERTEX) + aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX"); + + SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); + aStudyBuilder->Addreference(newObj1, newObj); + IO->setEntry(newObj->GetID()); + } + else { + allreadyexist = true; + if(!this->SObjectExist(theObj, aResult->Name())) { + SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj); + aStudyBuilder->Addreference(newObj1, SO); + IO->setEntry(SO->GetID()); + } + } + + if(!allreadyexist) { + vtkActorCollection* theActors = GEOM_AssemblyBuilder::BuildActors(S,0,themode,Standard_True); + theActors->InitTraversal(); + vtkActor* anActor = (vtkActor*)theActors->GetNextActor(); + while(!(anActor==NULL)) { + GEOM_Actor* GActor = GEOM_Actor::SafeDownCast(anActor); + GActor->setIO(IO); + GActor->setName(nameG); + theRenderer->AddActor(GActor); + renWin->Render(); + anActor = (vtkActor*)theActors->GetNextActor(); + } + } + } + } + + /* commit transaction */ + op->finish(); + + QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(); + QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_READY")); + return true; +} + + +//===================================================================================== +// function : OnSubShapeGetSelected() +// purpose : +//===================================================================================== +bool EntityGUI::OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType, Standard_Integer& aLocalContextId, bool& myUseLocalContext) +{ + //* Test the type of viewer */ + if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + return false; + + SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument(); + SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(ShapeTopoIOR); + if(theObj->_is_nil()) { + QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); + return false; + } + + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); + + if( myUseLocalContext == false ) { + /* local context is from DialogBox */ + MESSAGE("Error : No local context opened for sub shapes method" << endl ) ; + return false ; + } + + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString( ShapeTopoIOR ); + TopoDS_Shape mainTopo = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); + + TopoDS_Shape mainShape; + bool main = false; + while(!main) { + if(aShape->IsMainShape()) { + mainShape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); + main = true; + } + else + aShape = myGeom->GetIORFromString(aShape->MainName()); + } + + GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; + ic->InitSelected(); + int nbSelected = ic->NbSelected(); + ListOfID->length(nbSelected); + + TopoDS_Compound compound; + ic->InitSelected(); /* to init again */ + BRep_Builder B; + B.MakeCompound(compound); + + int i = 0; + /* We create a unique compound containing all the sub shapes selected by user as attribute of the main shape */ + /* the compound is homogenous by selection */ + while(ic->MoreSelected()) { + int index = myGeomBase->GetIndex(ic->SelectedShape(), mainShape, SubShapeType); + ListOfID[i] = index; + B.Add(compound, ic->SelectedShape()); + i++; + ic->NextSelected(); + } + + /* Test if user has selected sub shapes */ + if(ListOfID->length() < 1) + return false; + + GEOM::GEOM_Shape_var aResult; + try { + aResult = myGeom->SubShape(aShape, SubShapeType, ListOfID); + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + + /* local context from DialogBox */ + ic->CloseLocalContext(aLocalContextId); + myUseLocalContext = false ; + + char* nameG = (char *)malloc(20); + Standard_CString Type; + + Handle(GEOM_AISShape) result; + Handle(GEOM_InteractiveObject) IO; + + if(nbSelected == 1) { + TopExp_Explorer Exp (compound, TopAbs_ShapeEnum(SubShapeType)); + if(Exp.More()) { + if(myGeomBase->GetShapeTypeString(Exp.Current(),Type)) { + aResult->NameType(Type); + sprintf (nameG, "%s_%d", Type, myGeomBase->GetIndex( Exp.Current(), mainTopo, SubShapeType)); + } + else { + aResult->NameType(tr("GEOM_SHAPE")); + sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->GetNbGeom()++); + } + result = new GEOM_AISShape(Exp.Current(), nameG); + IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM"); + } + } + else { + if ( myGeomBase->GetShapeTypeString(compound,Type)) { + aResult->NameType(Type); + sprintf (nameG, "%s_%d", Type, myGeomGUI->GetNbGeom()++); + } else { + aResult->NameType(tr("GEOM_SHAPE")); + sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->GetNbGeom()++); + } + result = new GEOM_AISShape(compound, nameG); + IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM"); + } + + SALOMEDS::SObject_var SO = aStudy->FindObjectIOR(aResult->Name()); + + /* open transaction */ + QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy()); + op->start(); + + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeIOR_var anIOR; + SALOMEDS::AttributePixMap_var aPixmap; + + bool allreadyexist = false; + + if(SO->_is_nil()) { + SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(theObj); + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR"); + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + anIOR->SetValue(aResult->Name()); + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + aName->SetValue(result->getName()); + + anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + if(result->Shape().ShapeType() == TopAbs_COMPOUND) + aPixmap->SetPixMap("ICON_OBJBROWSER_COMPOUND"); + else if(result->Shape().ShapeType() == TopAbs_COMPSOLID) + aPixmap->SetPixMap("ICON_OBJBROWSER_COMPSOLID"); + else if(result->Shape().ShapeType() == TopAbs_SOLID) + aPixmap->SetPixMap("ICON_OBJBROWSER_SOLID"); + else if(result->Shape().ShapeType() == TopAbs_SHELL) + aPixmap->SetPixMap("ICON_OBJBROWSER_SHELL"); + else if(result->Shape().ShapeType() == TopAbs_FACE) + aPixmap->SetPixMap("ICON_OBJBROWSER_FACE"); + else if(result->Shape().ShapeType() == TopAbs_WIRE) + aPixmap->SetPixMap("ICON_OBJBROWSER_WIRE"); + else if(result->Shape().ShapeType() == TopAbs_EDGE) + aPixmap->SetPixMap("ICON_OBJBROWSER_EDGE"); + else if(result->Shape().ShapeType() == TopAbs_VERTEX) + aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX"); + + SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); + aStudyBuilder->Addreference(newObj1, newObj); + + IO->setEntry(newObj->GetID()); + aResult->StudyShapeId(newObj->GetID()); + } + else { + allreadyexist = true; + if(!this->SObjectExist(theObj, aResult->Name())) { + SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj); + aStudyBuilder->Addreference(newObj1, SO); + + IO->setEntry(SO->GetID()); + aResult->StudyShapeId(SO->GetID()); + } + } + + /* commit transaction */ + op->finish(); + + result->setIO(IO); + result->setName(nameG); + + if(!allreadyexist) + ic->Display(result); + + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); + + QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser(); + QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_READY")); + return true; +} + + +//===================================================================================== +// EXPORTED METHODS +//===================================================================================== +extern "C" +{ + bool OnGUIEvent(int theCommandID, QAD_Desktop* parent) + {return EntityGUI::OnGUIEvent(theCommandID, parent);} +} diff --git a/src/EntityGUI/EntityGUI.h b/src/EntityGUI/EntityGUI.h new file mode 100644 index 000000000..1ccd2dc4d --- /dev/null +++ b/src/EntityGUI/EntityGUI.h @@ -0,0 +1,72 @@ +// 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.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef ENTITYGUI_H +#define ENTITYGUI_H + +#include "GEOMBase.h" + +//================================================================================= +// class : EntityGUI +// purpose : +//================================================================================= +class EntityGUI : public QObject +{ + Q_OBJECT /* for QT compatibility */ + +public : + EntityGUI(); + ~EntityGUI(); + + static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + + void OnSketchEnd(TopoDS_Shape myShape); + + void DisplaySimulationShape(const TopoDS_Shape& S1, const TopoDS_Shape& S2); + void EraseSimulationShape(); + + void MakeInterpolAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR); + void MakeBezierAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR); + + /* Methods for sub shapes explode */ + bool SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* IOR); + bool OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType); + bool OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType, + Standard_Integer& aLocalContextId, bool& myUseLocalContext); + + /* 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 */ + +}; + +#endif diff --git a/src/EntityGUI/EntityGUI_1Sel_QTD.cxx b/src/EntityGUI/EntityGUI_1Sel_QTD.cxx new file mode 100644 index 000000000..0f6b9221c --- /dev/null +++ b/src/EntityGUI/EntityGUI_1Sel_QTD.cxx @@ -0,0 +1,93 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'EntityGUI_1Sel_QTD.ui' +** +** Created: ven déc 12 11:17:12 2003 +** 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( 186, 96 ); + 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" ); + + 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..ae8a92412 --- /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: ven déc 12 11:17:12 2003 +** 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/EntityGUI/EntityGUI_1Spin.cxx b/src/EntityGUI/EntityGUI_1Spin.cxx new file mode 100644 index 000000000..131a45500 --- /dev/null +++ b/src/EntityGUI/EntityGUI_1Spin.cxx @@ -0,0 +1,56 @@ +// 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_1Spin.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "EntityGUI_1Spin.h" + +#include +#include +#include + +/* + * Constructs a EntityGUI_1Spin which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +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"); + Layout1->addWidget(SpinBox_DX, 0, 1); + +} + + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_1Spin::~EntityGUI_1Spin() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/EntityGUI/EntityGUI_1Spin.h b/src/EntityGUI/EntityGUI_1Spin.h new file mode 100644 index 000000000..fb5814ca2 --- /dev/null +++ b/src/EntityGUI/EntityGUI_1Spin.h @@ -0,0 +1,47 @@ +// 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_1Spin.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef ENTITYGUI_1SPIN_H +#define ENTITYGUI_1SPIN_H + +#include "EntityGUI_1Spin_QTD.h" +#include "DlgRef_SpinBox.h" + +class EntityGUI_1Spin : public EntityGUI_1Spin_QTD +{ + Q_OBJECT + +public: + EntityGUI_1Spin(QWidget* parent = 0, const char* name = 0, WFlags fl = 0); + ~EntityGUI_1Spin(); + + DlgRef_SpinBox* SpinBox_DX; + +}; + +#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/EntityGUI/EntityGUI_3Spin.cxx b/src/EntityGUI/EntityGUI_3Spin.cxx new file mode 100644 index 000000000..fe73aeba5 --- /dev/null +++ b/src/EntityGUI/EntityGUI_3Spin.cxx @@ -0,0 +1,63 @@ +// 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_3Spin.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#include "EntityGUI_3Spin.h" + +#include +#include +#include + +/* + * Constructs a EntityGUI_3Spin which is a child of 'parent', with the + * name 'name' and widget flags set to 'f' + */ +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_DZ, 2, 1); +} + + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_3Spin::~EntityGUI_3Spin() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/EntityGUI/EntityGUI_3Spin.h b/src/EntityGUI/EntityGUI_3Spin.h new file mode 100644 index 000000000..58b732d31 --- /dev/null +++ b/src/EntityGUI/EntityGUI_3Spin.h @@ -0,0 +1,49 @@ +// 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_3Spin.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef ENTITYGUI_3SPIN_H +#define ENTITYGUI_3SPIN_H + +#include "EntityGUI_3Spin_QTD.h" +#include "DlgRef_SpinBox.h" + +class EntityGUI_3Spin : public EntityGUI_3Spin_QTD +{ + Q_OBJECT + +public: + EntityGUI_3Spin( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_3Spin(); + + DlgRef_SpinBox* SpinBox_DX; + DlgRef_SpinBox* SpinBox_DY; + DlgRef_SpinBox* SpinBox_DZ; + +}; + +#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/EntityGUI/EntityGUI_3Spin_QTD.h b/src/EntityGUI/EntityGUI_3Spin_QTD.h new file mode 100644 index 000000000..1efc3a5c1 --- /dev/null +++ b/src/EntityGUI/EntityGUI_3Spin_QTD.h @@ -0,0 +1,49 @@ +/**************************************************************************** +** Form interface 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! +****************************************************************************/ +#ifndef ENTITYGUI_3SPIN_QTD_H +#define ENTITYGUI_3SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QPushButton; +class QSpinBox; + +class EntityGUI_3Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + EntityGUI_3Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_3Spin_QTD(); + + QGroupBox* GroupBox1; + QPushButton* buttonUndo; + QPushButton* buttonApply; + QLabel* TextLabel2; + QLabel* TextLabel1; + QSpinBox* SpinBox1; + QSpinBox* SpinBox2; + QLabel* TextLabel3; + QSpinBox* SpinBox3; + + +protected: + QGridLayout* EntityGUI_3Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout3; + QGridLayout* Layout2; + QGridLayout* Layout1; +}; + +#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/EntityGUI/EntityGUI_4Spin_QTD.cxx b/src/EntityGUI/EntityGUI_4Spin_QTD.cxx new file mode 100644 index 000000000..875457db2 --- /dev/null +++ b/src/EntityGUI/EntityGUI_4Spin_QTD.cxx @@ -0,0 +1,121 @@ +/**************************************************************************** +** Form implementation generated from reading ui file 'EntityGUI_4Spin_QTD.ui' +** +** Created: ven déc 12 11:17:12 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#include "EntityGUI_4Spin_QTD.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +/* + * Constructs a EntityGUI_4Spin_QTD which is a child of 'parent', with the + * name 'name' and widget flags set to 'f'. + */ +EntityGUI_4Spin_QTD::EntityGUI_4Spin_QTD( QWidget* parent, const char* name, WFlags fl ) + : QWidget( parent, name, fl ) +{ + if ( !name ) + setName( "EntityGUI_4Spin_QTD" ); + resize( 154, 148 ); + 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( "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, 1, 0 ); + QSpacerItem* spacer_2 = new QSpacerItem( 0, 70, QSizePolicy::Minimum, QSizePolicy::Expanding ); + Layout1->addItem( spacer_2, 4, 1 ); + + SpinBox4 = new QSpinBox( GroupBox1, "SpinBox4" ); + SpinBox4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)7, (QSizePolicy::SizeType)0, 0, 0, SpinBox4->sizePolicy().hasHeightForWidth() ) ); + + 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, 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() ) ); + 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 ); + + Layout3->addLayout( Layout1, 0, 0 ); + + GroupBox1Layout->addLayout( Layout3, 0, 0 ); + + EntityGUI_4Spin_QTDLayout->addWidget( GroupBox1, 0, 0 ); +} + +/* + * Destroys the object and frees any allocated resources + */ +EntityGUI_4Spin_QTD::~EntityGUI_4Spin_QTD() +{ + // no need to delete child widgets, Qt does it all for us +} + diff --git a/src/EntityGUI/EntityGUI_4Spin_QTD.h b/src/EntityGUI/EntityGUI_4Spin_QTD.h new file mode 100644 index 000000000..939ef640b --- /dev/null +++ b/src/EntityGUI/EntityGUI_4Spin_QTD.h @@ -0,0 +1,51 @@ +/**************************************************************************** +** Form interface generated from reading ui file 'EntityGUI_4Spin_QTD.ui' +** +** Created: ven déc 12 11:17:12 2003 +** by: The User Interface Compiler (uic) +** +** WARNING! All changes made in this file will be lost! +****************************************************************************/ +#ifndef ENTITYGUI_4SPIN_QTD_H +#define ENTITYGUI_4SPIN_QTD_H + +#include +#include +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QGroupBox; +class QLabel; +class QPushButton; +class QSpinBox; + +class EntityGUI_4Spin_QTD : public QWidget +{ + Q_OBJECT + +public: + EntityGUI_4Spin_QTD( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 ); + ~EntityGUI_4Spin_QTD(); + + QGroupBox* GroupBox1; + QPushButton* buttonUndo; + QPushButton* buttonApply; + QSpinBox* SpinBox3; + QSpinBox* SpinBox2; + QLabel* TextLabel2; + QSpinBox* SpinBox4; + QLabel* TextLabel3; + QSpinBox* SpinBox1; + QLabel* TextLabel1; + QLabel* TextLabel4; + + +protected: + QGridLayout* EntityGUI_4Spin_QTDLayout; + QGridLayout* GroupBox1Layout; + QGridLayout* Layout3; + QGridLayout* Layout2; + QGridLayout* Layout1; +}; + +#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..be77e5e57 --- /dev/null +++ b/src/EntityGUI/EntityGUI_SketcherDlg.cxx @@ -0,0 +1,1103 @@ +// 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 +#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_CLOSE")); + 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); + + buttonEnd->setFocus(); + 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(); + 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(); + this->MakeSimulationAndDisplay(); + } + else if(constructorId == 2) { // Selection + mySketchType = PT_SEL; + myEditCurrentArgument = Group1Sel->LineEdit1; + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + Group1Sel->show(); + 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->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(); + + 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(); + + 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(); + + 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(); + } + } + 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(); + } + } + 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(); + } + } + 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(); + } + } + } + + 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(myShape); + + this->ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ClickOnClose() +// purpose : +//================================================================================= +void EntityGUI_SketcherDlg::ClickOnClose() +{ + if(mySketchState != FIRST_POINT && mySketchState != SECOND_POINT) { + myCommand = myCommand + ":WW"; + + Sketcher_Profile aProfile (myCommand.ascii()); + + if(aProfile.IsDone()) { + myShape = aProfile.GetShape(); + myEntityGUI->OnSketchEnd(myShape); + } + } + + 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() +{ + myEditCurrentArgument->setText(""); + QString aString = ""; + + myX = 0.0; + myY = 0.0; + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel != 1) { + this->MakeSimulationAndDisplay(); + return; + } + + /* nbSel == 1 */ + TopoDS_Shape S; + gp_Pnt myPoint1; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) { + this->MakeSimulationAndDisplay(); + return; + } + + if(myEditCurrentArgument == Group1Sel->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) { + myX = myPoint1.X(); + myY = myPoint1.Y(); + Group1Sel->LineEdit1->setText(aString); + } + + 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; + } + else if(send == Group2Spin->SpinBox_DX) { + vx = newValue; + vy = Group2Spin->SpinBox_DY->GetValue(); + } + else if(send == Group2Spin->SpinBox_DY) { + vx = Group2Spin->SpinBox_DX->GetValue(); + vy = newValue; + } + else if(send == Group3Spin->SpinBox_DX) { + vx = newValue; + vy = Group3Spin->SpinBox_DY->GetValue(); + vz = Group3Spin->SpinBox_DZ->GetValue(); + } + else if(send == Group3Spin->SpinBox_DY) { + vx = Group3Spin->SpinBox_DX->GetValue(); + vy = newValue; + vz = Group3Spin->SpinBox_DZ->GetValue(); + } + else if(send == Group3Spin->SpinBox_DZ) { + vx = Group3Spin->SpinBox_DX->GetValue(); + vy = Group3Spin->SpinBox_DY->GetValue(); + vz = newValue; + } + else if(send == Group4Spin->SpinBox_DX) { + vx = newValue; + vy = Group4Spin->SpinBox_DY->GetValue(); + vz = Group4Spin->SpinBox_DZ->GetValue(); + vs = Group4Spin->SpinBox_DS->GetValue(); + } + else if(send == Group4Spin->SpinBox_DY) { + vx = Group4Spin->SpinBox_DX->GetValue(); + vy = newValue; + vz = Group4Spin->SpinBox_DZ->GetValue(); + vs = Group4Spin->SpinBox_DS->GetValue(); + } + else if(send == Group4Spin->SpinBox_DZ) { + vx = Group4Spin->SpinBox_DX->GetValue(); + vy = Group4Spin->SpinBox_DY->GetValue(); + vz = newValue; + vs = Group4Spin->SpinBox_DS->GetValue(); + } + else if(send == Group4Spin->SpinBox_DS) { + vx = Group4Spin->SpinBox_DX->GetValue(); + vy = Group4Spin->SpinBox_DY->GetValue(); + vz = Group4Spin->SpinBox_DZ->GetValue(); + vs = newValue; + } + + 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 : MakeSimulationAndDisplay() +// 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(); + } + + myEntityGUI->DisplaySimulationShape(mySimulationTopoDs1, mySimulationTopoDs2); + } + catch(Standard_Failure) { + MESSAGE("Exception catched in MakSimulationAndDisplay"); + 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/BuildGUI/BuildGUI_SplineDlg.cxx b/src/EntityGUI/EntityGUI_SplineDlg.cxx similarity index 84% rename from src/BuildGUI/BuildGUI_SplineDlg.cxx rename to src/EntityGUI/EntityGUI_SplineDlg.cxx index c7cbe76d2..61bc2bd31 100644 --- a/src/BuildGUI/BuildGUI_SplineDlg.cxx +++ b/src/EntityGUI/EntityGUI_SplineDlg.cxx @@ -21,13 +21,13 @@ // // // -// File : BuildGUI_SplineDlg.cxx +// File : EntityGUI_SplineDlg.cxx // Author : Lucien PIGNOLONI // Module : GEOM // $Header$ using namespace std; -#include "BuildGUI_SplineDlg.h" +#include "EntityGUI_SplineDlg.h" #include #include @@ -37,17 +37,17 @@ using namespace std; #include //================================================================================= -// class : BuildGUI_SplineDlg() -// purpose : Constructs a BuildGUI_SplineDlg which is a child of 'parent', with the +// class : EntityGUI_SplineDlg() +// purpose : Constructs a EntityGUI_SplineDlg 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. //================================================================================= -BuildGUI_SplineDlg::BuildGUI_SplineDlg(QWidget* parent, const char* name, BuildGUI* theBuildGUI, SALOME_Selection* Sel, bool modal, WFlags fl) +EntityGUI_SplineDlg::EntityGUI_SplineDlg(QWidget* parent, const char* name, EntityGUI* theEntityGUI, 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_DLG_BEZIER"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_BSPLINE"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_INTERPOL"))); QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); setCaption(tr("GEOM_SPLINE_TITLE")); @@ -63,26 +63,26 @@ BuildGUI_SplineDlg::BuildGUI_SplineDlg(QWidget* parent, const char* name, BuildG GroupBezier->TextLabel1->setText(tr("GEOM_POINTS")); GroupBezier->PushButton1->setPixmap(image2); - GroupBSpline = new DlgRef_1Sel_QTD(this, "GroupBSpline"); - GroupBSpline->GroupBox1->setTitle(tr("GEOM_BSPLINE")); - GroupBSpline->TextLabel1->setText(tr("GEOM_POINTS")); - GroupBSpline->PushButton1->setPixmap(image2); + GroupInterpol = new DlgRef_1Sel_QTD(this, "GroupInterpol"); + GroupInterpol->GroupBox1->setTitle(tr("GEOM_INTERPOL")); + GroupInterpol->TextLabel1->setText(tr("GEOM_POINTS")); + GroupInterpol->PushButton1->setPixmap(image2); Layout1->addWidget(GroupBezier, 1, 0); - Layout1->addWidget(GroupBSpline, 1, 0); + Layout1->addWidget(GroupInterpol, 1, 0); /***************************************************************/ /* Initialisations */ - myBuildGUI = theBuildGUI; + myEntityGUI = theEntityGUI; Init(); } //================================================================================= -// function : ~BuildGUI_SplineDlg() +// function : ~EntityGUI_SplineDlg() // purpose : Destroys the object and frees any allocated resources //================================================================================= -BuildGUI_SplineDlg::~BuildGUI_SplineDlg() +EntityGUI_SplineDlg::~EntityGUI_SplineDlg() { // no need to delete child widgets, Qt does it all for us } @@ -92,7 +92,7 @@ BuildGUI_SplineDlg::~BuildGUI_SplineDlg() // function : Init() // purpose : //================================================================================= -void BuildGUI_SplineDlg::Init() +void EntityGUI_SplineDlg::Init() { /* init variables */ myConstructorId = 0; @@ -109,12 +109,12 @@ void BuildGUI_SplineDlg::Init() connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); connect(GroupBezier->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); - connect(GroupBSpline->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupInterpol->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); /* displays Dialog */ - GroupBSpline->hide(); + GroupInterpol->hide(); GroupBezier->show(); this->show(); @@ -126,7 +126,7 @@ void BuildGUI_SplineDlg::Init() // function : ConstructorsClicked() // purpose : Radio button management //================================================================================= -void BuildGUI_SplineDlg::ConstructorsClicked(int constructorId) +void EntityGUI_SplineDlg::ConstructorsClicked(int constructorId) { myConstructorId = constructorId; mySelection->ClearFilters(); @@ -139,7 +139,7 @@ void BuildGUI_SplineDlg::ConstructorsClicked(int constructorId) { case 0: { - GroupBSpline->hide(); + GroupInterpol->hide(); resize(0, 0); GroupBezier->show(); @@ -151,10 +151,10 @@ void BuildGUI_SplineDlg::ConstructorsClicked(int constructorId) { GroupBezier->hide(); resize(0, 0); - GroupBSpline->show(); + GroupInterpol->show(); - myEditCurrentArgument = GroupBSpline->LineEdit1; - GroupBSpline->LineEdit1->setText(""); + myEditCurrentArgument = GroupInterpol->LineEdit1; + GroupInterpol->LineEdit1->setText(""); break; } } @@ -169,7 +169,7 @@ void BuildGUI_SplineDlg::ConstructorsClicked(int constructorId) // function : ClickOnOk() // purpose : //================================================================================= -void BuildGUI_SplineDlg::ClickOnOk() +void EntityGUI_SplineDlg::ClickOnOk() { this->ClickOnApply(); ClickOnCancel(); @@ -181,7 +181,7 @@ void BuildGUI_SplineDlg::ClickOnOk() // function : ClickOnApply() // purpose : //================================================================================= -void BuildGUI_SplineDlg::ClickOnApply() +void EntityGUI_SplineDlg::ClickOnApply() { QAD_Application::getDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) @@ -194,13 +194,13 @@ void BuildGUI_SplineDlg::ClickOnApply() case 0 : { if(myOkListShapes) - myBuildGUI->MakeBezierAndDisplay(myListShapes); + myEntityGUI->MakeBezierAndDisplay(myListShapes); break; } case 1 : { if(myOkListShapes) - myBuildGUI->MakeBSplineAndDisplay(myListShapes); + myEntityGUI->MakeInterpolAndDisplay(myListShapes); break; } } @@ -212,7 +212,7 @@ void BuildGUI_SplineDlg::ClickOnApply() // function : SelectionIntoArgument() // purpose : Called when selection as changed or other case //================================================================================= -void BuildGUI_SplineDlg::SelectionIntoArgument() +void EntityGUI_SplineDlg::SelectionIntoArgument() { myGeomBase->EraseSimulationShape(); myEditCurrentArgument->setText(""); @@ -237,7 +237,7 @@ void BuildGUI_SplineDlg::SelectionIntoArgument() // function : SetEditCurrentArgument() // purpose : //================================================================================= -void BuildGUI_SplineDlg::SetEditCurrentArgument() +void EntityGUI_SplineDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); @@ -245,9 +245,9 @@ void BuildGUI_SplineDlg::SetEditCurrentArgument() GroupBezier->LineEdit1->setFocus(); myEditCurrentArgument = GroupBezier->LineEdit1; } - else if(send == GroupBSpline->PushButton1) { - GroupBSpline->LineEdit1->setFocus(); - myEditCurrentArgument = GroupBSpline->LineEdit1; + else if(send == GroupInterpol->PushButton1) { + GroupInterpol->LineEdit1->setFocus(); + myEditCurrentArgument = GroupInterpol->LineEdit1; } mySelection->AddFilter(myVertexFilter); this->SelectionIntoArgument(); @@ -260,7 +260,7 @@ void BuildGUI_SplineDlg::SetEditCurrentArgument() // function : ActivateThisDialog() // purpose : //================================================================================= -void BuildGUI_SplineDlg::ActivateThisDialog() +void EntityGUI_SplineDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); @@ -275,7 +275,7 @@ void BuildGUI_SplineDlg::ActivateThisDialog() // function : enterEvent() // purpose : //================================================================================= -void BuildGUI_SplineDlg::enterEvent(QEvent* e) +void EntityGUI_SplineDlg::enterEvent(QEvent* e) { if (GroupConstructors->isEnabled()) return; @@ -288,7 +288,7 @@ void BuildGUI_SplineDlg::enterEvent(QEvent* e) // function : MakeSplineSimulationAndDisplay() // purpose : //================================================================================= -void BuildGUI_SplineDlg::MakeSplineSimulationAndDisplay() +void EntityGUI_SplineDlg::MakeSplineSimulationAndDisplay() { myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); diff --git a/src/BuildGUI/BuildGUI_SplineDlg.h b/src/EntityGUI/EntityGUI_SplineDlg.h similarity index 83% rename from src/BuildGUI/BuildGUI_SplineDlg.h rename to src/EntityGUI/EntityGUI_SplineDlg.h index 07bb28377..10bb28813 100644 --- a/src/BuildGUI/BuildGUI_SplineDlg.h +++ b/src/EntityGUI/EntityGUI_SplineDlg.h @@ -21,7 +21,7 @@ // // // -// File : BuildGUI_SplineDlg.h +// File : EntityGUI_SplineDlg.h // Author : Damien COQUERET // Module : GEOM // $Header: @@ -32,28 +32,28 @@ #include "GEOMBase_Skeleton.h" #include "DlgRef_1Sel_QTD.h" -#include "BuildGUI.h" +#include "EntityGUI.h" #include "GEOM_ShapeTypeFilter.hxx" //================================================================================= -// class : BuildGUI_WireDlg +// class : EntityGUI_WireDlg // purpose : //================================================================================= -class BuildGUI_SplineDlg : public GEOMBase_Skeleton +class EntityGUI_SplineDlg : public GEOMBase_Skeleton { Q_OBJECT public: - BuildGUI_SplineDlg(QWidget* parent = 0, const char* name = 0, BuildGUI* theBuildGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); - ~BuildGUI_SplineDlg(); + EntityGUI_SplineDlg(QWidget* parent = 0, const char* name = 0, EntityGUI* theEntityGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); + ~EntityGUI_SplineDlg(); private: void Init(); void enterEvent(QEvent* e); void MakeSplineSimulationAndDisplay(); - BuildGUI* myBuildGUI; + EntityGUI* myEntityGUI; int myConstructorId; Handle(GEOM_ShapeTypeFilter) myVertexFilter; /* filter for selection */ @@ -62,7 +62,7 @@ private: bool myOkListShapes; /* to check when arguments is defined */ DlgRef_1Sel_QTD* GroupBezier; - DlgRef_1Sel_QTD* GroupBSpline; + DlgRef_1Sel_QTD* GroupInterpol; private slots: void ClickOnOk(); diff --git a/src/BuildGUI/BuildGUI_SubShapeDlg.cxx b/src/EntityGUI/EntityGUI_SubShapeDlg.cxx similarity index 92% rename from src/BuildGUI/BuildGUI_SubShapeDlg.cxx rename to src/EntityGUI/EntityGUI_SubShapeDlg.cxx index 375bb75f4..28923363f 100644 --- a/src/BuildGUI/BuildGUI_SubShapeDlg.cxx +++ b/src/EntityGUI/EntityGUI_SubShapeDlg.cxx @@ -21,13 +21,13 @@ // // // -// File : BuildGUI_SubShapeDlg.cxx +// File : EntityGUI_SubShapeDlg.cxx // Author : Lucien PIGNOLONI // Module : GEOM // $Header$ using namespace std; -#include "BuildGUI_SubShapeDlg.h" +#include "EntityGUI_SubShapeDlg.h" #include "DisplayGUI.h" #include "QAD_RightFrame.h" @@ -39,13 +39,13 @@ using namespace std; #include //================================================================================= -// class : BuildGUI_SubShapeDlg() -// purpose : Constructs a BuildGUI_SubShapeDlg which is a child of 'parent', with the +// class : EntityGUI_SubShapeDlg() +// purpose : Constructs a EntityGUI_SubShapeDlg 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. //================================================================================= -BuildGUI_SubShapeDlg::BuildGUI_SubShapeDlg(QWidget* parent, const char* name, BuildGUI* theBuildGUI, SALOME_Selection* Sel, Handle(AIS_InteractiveContext) ic, bool modal, WFlags fl) +EntityGUI_SubShapeDlg::EntityGUI_SubShapeDlg(QWidget* parent, const char* name, EntityGUI* theEntityGUI, SALOME_Selection* Sel, Handle(AIS_InteractiveContext) ic, 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_DLG_SUBSHAPE"))); @@ -70,16 +70,16 @@ BuildGUI_SubShapeDlg::BuildGUI_SubShapeDlg(QWidget* parent, const char* name, Bu /***************************************************************/ /* Initialisations */ - myBuildGUI = theBuildGUI; + myEntityGUI = theEntityGUI; Init(ic); } //================================================================================= -// function : ~BuildGUI_SubShapeDlg() +// function : ~EntityGUI_SubShapeDlg() // purpose : Destroys the object and frees any allocated resources //================================================================================= -BuildGUI_SubShapeDlg::~BuildGUI_SubShapeDlg() +EntityGUI_SubShapeDlg::~EntityGUI_SubShapeDlg() { // no need to delete child widgets, Qt does it all for us } @@ -89,7 +89,7 @@ BuildGUI_SubShapeDlg::~BuildGUI_SubShapeDlg() // function : Init() // purpose : //================================================================================= -void BuildGUI_SubShapeDlg::Init(Handle(AIS_InteractiveContext) ic) +void EntityGUI_SubShapeDlg::Init(Handle(AIS_InteractiveContext) ic) { /* init variables */ myEditCurrentArgument = GroupPoints->LineEdit1; @@ -144,7 +144,7 @@ void BuildGUI_SubShapeDlg::Init(Handle(AIS_InteractiveContext) ic) // function : ClickOnOk() // purpose : //================================================================================= -void BuildGUI_SubShapeDlg::ClickOnOk() +void EntityGUI_SubShapeDlg::ClickOnOk() { this->ClickOnApply(); @@ -162,7 +162,7 @@ void BuildGUI_SubShapeDlg::ClickOnOk() // function : ClickOnApply() // purpose : //================================================================================= -void BuildGUI_SubShapeDlg::ClickOnApply() +void EntityGUI_SubShapeDlg::ClickOnApply() { QAD_Application::getDesktop()->putInfo(tr("")); bool testResult = false; @@ -179,16 +179,16 @@ void BuildGUI_SubShapeDlg::ClickOnApply() const QString button1 = tr("GEOM_BUT_CANCEL"); if(QMessageBox::warning(this, caption, text, button0, button1) == 0) - testResult = myBuildGUI->OnSubShapeGetAll(myShape, myShapeIOR, myShapeType); + testResult = myEntityGUI->OnSubShapeGetAll(myShape, myShapeIOR, myShapeType); else myAbort = true; /* aborted */ } else - testResult = myBuildGUI->OnSubShapeGetAll(myShape, myShapeIOR, myShapeType); + testResult = myEntityGUI->OnSubShapeGetAll(myShape, myShapeIOR, myShapeType); } /* explode only selected sub shapes */ else if(myOkShape && myOkSelectSubMode) - testResult = myBuildGUI->OnSubShapeGetSelected(myShape, myShapeIOR, myShapeType, myLocalContextId, myUseLocalContext); + testResult = myEntityGUI->OnSubShapeGetSelected(myShape, myShapeIOR, myShapeType, myLocalContextId, myUseLocalContext); if(!testResult) { QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT")); @@ -207,7 +207,7 @@ void BuildGUI_SubShapeDlg::ClickOnApply() // function : ClickOnCancel() // purpose : //================================================================================= -void BuildGUI_SubShapeDlg::ClickOnCancel() +void EntityGUI_SubShapeDlg::ClickOnCancel() { if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); @@ -229,7 +229,7 @@ void BuildGUI_SubShapeDlg::ClickOnCancel() // purpose : Called when selection as changed or other case // : used only by SelectButtonC1A1 (LineEditC1A1) //================================================================================= -void BuildGUI_SubShapeDlg::SelectionIntoArgument() +void EntityGUI_SubShapeDlg::SelectionIntoArgument() { myEditCurrentArgument->setText(""); this->ResetStateOfDialog(); @@ -330,7 +330,7 @@ void BuildGUI_SubShapeDlg::SelectionIntoArgument() // function : SetEditCurrentArgument() // purpose : //================================================================================= -void BuildGUI_SubShapeDlg::SetEditCurrentArgument() +void EntityGUI_SubShapeDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); @@ -348,7 +348,7 @@ void BuildGUI_SubShapeDlg::SetEditCurrentArgument() // function : LineEditReturnPressed() // purpose : //================================================================================= -void BuildGUI_SubShapeDlg::LineEditReturnPressed() +void EntityGUI_SubShapeDlg::LineEditReturnPressed() { QLineEdit* send = (QLineEdit*)sender(); if(send == GroupPoints->LineEdit1) @@ -365,7 +365,7 @@ void BuildGUI_SubShapeDlg::LineEditReturnPressed() // function : DeactivateActiveDialog() // purpose : //================================================================================= -void BuildGUI_SubShapeDlg::DeactivateActiveDialog() +void EntityGUI_SubShapeDlg::DeactivateActiveDialog() { if(GroupConstructors->isEnabled()) { this->ResetStateOfDialog(); @@ -379,7 +379,7 @@ void BuildGUI_SubShapeDlg::DeactivateActiveDialog() // function : ActivateThisDialog() // purpose : //================================================================================= -void BuildGUI_SubShapeDlg::ActivateThisDialog() +void EntityGUI_SubShapeDlg::ActivateThisDialog() { GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); @@ -395,7 +395,7 @@ void BuildGUI_SubShapeDlg::ActivateThisDialog() // function : enterEvent() // purpose : //================================================================================= -void BuildGUI_SubShapeDlg::enterEvent(QEvent* e) +void EntityGUI_SubShapeDlg::enterEvent(QEvent* e) { if(GroupConstructors->isEnabled()) return; @@ -408,7 +408,7 @@ void BuildGUI_SubShapeDlg::enterEvent(QEvent* e) // function : closeEvent() // purpose : //================================================================================= -void BuildGUI_SubShapeDlg::closeEvent(QCloseEvent* e) +void EntityGUI_SubShapeDlg::closeEvent(QCloseEvent* e) { /* same than click on cancel button */ this->ClickOnCancel(); @@ -420,7 +420,7 @@ void BuildGUI_SubShapeDlg::closeEvent(QCloseEvent* e) // function : ResetStateOfDialog() // purpose : Completely reset the state of method including local context //================================================================================= -void BuildGUI_SubShapeDlg::ResetStateOfDialog() +void EntityGUI_SubShapeDlg::ResetStateOfDialog() { if(myAbort == true) { myOkShape = false; @@ -472,7 +472,7 @@ void BuildGUI_SubShapeDlg::ResetStateOfDialog() // purpose : Allow user selection of all or only selected sub shapes // : Called when 'CheckButton1' state change //================================================================================= -void BuildGUI_SubShapeDlg::AllOrNotAll() +void EntityGUI_SubShapeDlg::AllOrNotAll() { /* No sub shape selection if main shape not selected */ if(!myOkShape) { @@ -524,7 +524,7 @@ void BuildGUI_SubShapeDlg::AllOrNotAll() // function : ComboTextChanged() // purpose : //================================================================================= -void BuildGUI_SubShapeDlg::ComboTextChanged() +void EntityGUI_SubShapeDlg::ComboTextChanged() { if(myOkShape) myShapeType = GroupPoints->ComboBox1->currentItem() + myShape.ShapeType() + 1; @@ -554,7 +554,7 @@ void BuildGUI_SubShapeDlg::ComboTextChanged() // function : NumberOfSubShapes() // purpose : //================================================================================= -unsigned int BuildGUI_SubShapeDlg::NumberOfSubShapes(const TopoDS_Shape& S, const int shapeType) +unsigned int EntityGUI_SubShapeDlg::NumberOfSubShapes(const TopoDS_Shape& S, const int shapeType) { if(S.IsNull()) return 0; diff --git a/src/BuildGUI/BuildGUI_SubShapeDlg.h b/src/EntityGUI/EntityGUI_SubShapeDlg.h similarity index 86% rename from src/BuildGUI/BuildGUI_SubShapeDlg.h rename to src/EntityGUI/EntityGUI_SubShapeDlg.h index e6295ced5..cd85ce051 100644 --- a/src/BuildGUI/BuildGUI_SubShapeDlg.h +++ b/src/EntityGUI/EntityGUI_SubShapeDlg.h @@ -21,7 +21,7 @@ // // // -// File : BuildGUI_SubShapeDlg.h +// File : EntityGUI_SubShapeDlg.h // Author : Lucien PIGNOLONI // Module : GEOM // $Header$ @@ -32,19 +32,19 @@ #include "GEOMBase_Skeleton.h" #include "DlgRef_1Sel1Check1List_QTD.h" -#include "BuildGUI.h" +#include "EntityGUI.h" //================================================================================= -// class : BuildGUI_SubShapeDlg +// class : EntityGUI_SubShapeDlg // purpose : //================================================================================= -class BuildGUI_SubShapeDlg : public GEOMBase_Skeleton +class EntityGUI_SubShapeDlg : public GEOMBase_Skeleton { Q_OBJECT public: - BuildGUI_SubShapeDlg(QWidget* parent = 0, const char* name = 0, BuildGUI* theBuildGUI = 0, SALOME_Selection* Sel = 0, Handle(AIS_InteractiveContext) ic = 0, bool modal = FALSE, WFlags fl = 0); - ~BuildGUI_SubShapeDlg(); + EntityGUI_SubShapeDlg(QWidget* parent = 0, const char* name = 0, EntityGUI* theEntityGUI = 0, SALOME_Selection* Sel = 0, Handle(AIS_InteractiveContext) ic = 0, bool modal = FALSE, WFlags fl = 0); + ~EntityGUI_SubShapeDlg(); private : void Init(Handle(AIS_InteractiveContext) ic); @@ -54,7 +54,7 @@ private : void ResetStateOfDialog(); unsigned int NumberOfSubShapes(const TopoDS_Shape& S, const int shapeType); - BuildGUI* myBuildGUI; + EntityGUI* myEntityGUI; /* Interactive and local context management see also : bool myUseLocalContext() */ Handle(AIS_InteractiveContext) myIC; /* Interactive context */ diff --git a/src/EntityGUI/Makefile.in b/src/EntityGUI/Makefile.in new file mode 100644 index 000000000..40dd91b93 --- /dev/null +++ b/src/EntityGUI/Makefile.in @@ -0,0 +1,91 @@ +# GEOM ENTITYGUI : +# +# 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 : Makefile.in +# Author : Damien COQUERET (OCC) +# Module : GEOM +# $Header: + +top_srcdir=@top_srcdir@ +top_builddir=../.. +srcdir=@srcdir@ +VPATH=.:@srcdir@:@top_srcdir@/idl + + +@COMMENCE@ + +# Libraries targets +LIB = libEntityGUI.la + +# header files +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_SplineDlg.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_SplineDlg.h \ + EntityGUI_SubShapeDlg.h + +LIB_CLIENT_IDL = + +LIB_SERVER_IDL = + +# additionnal information to compil and link file + +CPPFLAGS += $(QT_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome + +LDFLAGS += -lGEOMSketcher -lGEOMFiltersSelection -lDisplayGUI + +@CONCLUDE@ diff --git a/src/EntityGUI/UIFiles/EntityGUI_1Sel_QTD.ui b/src/EntityGUI/UIFiles/EntityGUI_1Sel_QTD.ui new file mode 100644 index 000000000..31427bd1d --- /dev/null +++ b/src/EntityGUI/UIFiles/EntityGUI_1Sel_QTD.ui @@ -0,0 +1,185 @@ + +EntityGUI_1Sel_QTD + + + EntityGUI_1Sel_QTD + + + + 0 + 0 + 186 + 96 + + + + EntityGUI_1Sel_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + Values + + + + unnamed + + + 11 + + + 6 + + + + Layout3 + + + + unnamed + + + 0 + + + 6 + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + buttonUndo + + + Undo + + + + + buttonApply + + + Create + + + + + Spacer5 + + + Vertical + + + Expanding + + + + 0 + 51 + + + + + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 0 + 180 + + + + + + PushButton1 + + + + 0 + 0 + 0 + 0 + + + + + + + + + LineEdit1 + + + + + + + + + + + + diff --git a/src/EntityGUI/UIFiles/EntityGUI_1Spin_QTD.ui b/src/EntityGUI/UIFiles/EntityGUI_1Spin_QTD.ui new file mode 100644 index 000000000..9c699d6c1 --- /dev/null +++ b/src/EntityGUI/UIFiles/EntityGUI_1Spin_QTD.ui @@ -0,0 +1,177 @@ + +EntityGUI_1Spin_QTD + + + EntityGUI_1Spin_QTD + + + + 0 + 0 + 154 + 96 + + + + EntityGUI_1Spin_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + Values + + + + unnamed + + + 11 + + + 6 + + + + Layout3 + + + + unnamed + + + 0 + + + 6 + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + buttonUndo + + + Undo + + + + + buttonApply + + + Create + + + + + Spacer5 + + + Vertical + + + Expanding + + + + 0 + 51 + + + + + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + SpinBox1 + + + + 7 + 0 + 0 + 0 + + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 0 + 82 + + + + + + + + + + + + + diff --git a/src/EntityGUI/UIFiles/EntityGUI_2Spin_QTD.ui b/src/EntityGUI/UIFiles/EntityGUI_2Spin_QTD.ui new file mode 100644 index 000000000..7b8088b49 --- /dev/null +++ b/src/EntityGUI/UIFiles/EntityGUI_2Spin_QTD.ui @@ -0,0 +1,206 @@ + +EntityGUI_2Spin_QTD + + + EntityGUI_2Spin_QTD + + + + 0 + 0 + 154 + 96 + + + + EntityGUI_2Spin_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + Values + + + + unnamed + + + 11 + + + 6 + + + + Layout3 + + + + unnamed + + + 0 + + + 6 + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + buttonUndo + + + Undo + + + + + buttonApply + + + Create + + + + + Spacer5 + + + Vertical + + + Expanding + + + + 0 + 51 + + + + + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + SpinBox1 + + + + 7 + 0 + 0 + 0 + + + + + + SpinBox2 + + + + 7 + 0 + 0 + 0 + + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 0 + 82 + + + + + + + + + + + + + diff --git a/src/EntityGUI/UIFiles/EntityGUI_3Spin_QTD.ui b/src/EntityGUI/UIFiles/EntityGUI_3Spin_QTD.ui new file mode 100644 index 000000000..578aebf72 --- /dev/null +++ b/src/EntityGUI/UIFiles/EntityGUI_3Spin_QTD.ui @@ -0,0 +1,235 @@ + +EntityGUI_3Spin_QTD + + + EntityGUI_3Spin_QTD + + + + 0 + 0 + 154 + 120 + + + + EntityGUI_3Spin_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + Values + + + + unnamed + + + 11 + + + 6 + + + + Layout3 + + + + unnamed + + + 0 + + + 6 + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + buttonUndo + + + Undo + + + + + buttonApply + + + Create + + + + + Spacer5 + + + Vertical + + + Expanding + + + + 0 + 51 + + + + + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + SpinBox1 + + + + 7 + 0 + 0 + 0 + + + + + + SpinBox2 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel3 + + + + 0 + 0 + 0 + 0 + + + + TL3 + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 0 + 82 + + + + + + SpinBox3 + + + + 7 + 0 + 0 + 0 + + + + + + + + + + + + + diff --git a/src/EntityGUI/UIFiles/EntityGUI_4Spin_QTD.ui b/src/EntityGUI/UIFiles/EntityGUI_4Spin_QTD.ui new file mode 100644 index 000000000..bd62ca929 --- /dev/null +++ b/src/EntityGUI/UIFiles/EntityGUI_4Spin_QTD.ui @@ -0,0 +1,264 @@ + +EntityGUI_4Spin_QTD + + + EntityGUI_4Spin_QTD + + + + 0 + 0 + 154 + 148 + + + + EntityGUI_4Spin_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupBox1 + + + Values + + + + unnamed + + + 11 + + + 6 + + + + Layout3 + + + + unnamed + + + 0 + + + 6 + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + buttonUndo + + + Undo + + + + + buttonApply + + + Create + + + + + Spacer5 + + + Vertical + + + Expanding + + + + 0 + 51 + + + + + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + SpinBox3 + + + + 7 + 0 + 0 + 0 + + + + + + SpinBox2 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel2 + + + + 0 + 0 + 0 + 0 + + + + TL2 + + + + + Spacer1 + + + Vertical + + + Expanding + + + + 0 + 70 + + + + + + SpinBox4 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel3 + + + + 0 + 0 + 0 + 0 + + + + TL3 + + + + + SpinBox1 + + + + 7 + 0 + 0 + 0 + + + + + + TextLabel1 + + + + 0 + 0 + 0 + 0 + + + + TL1 + + + + + TextLabel4 + + + + 0 + 0 + 0 + 0 + + + + TL4 + + + + + + + + + + + + diff --git a/src/EntityGUI/UIFiles/EntityGUI_Dir1_QTD.ui b/src/EntityGUI/UIFiles/EntityGUI_Dir1_QTD.ui new file mode 100644 index 000000000..59f644641 --- /dev/null +++ b/src/EntityGUI/UIFiles/EntityGUI_Dir1_QTD.ui @@ -0,0 +1,112 @@ + +EntityGUI_Dir1_QTD + + + EntityGUI_Dir1_QTD + + + + 0 + 0 + 131 + 123 + + + + EntityGUI_Dir1_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupDir1 + + + + 7 + 0 + 0 + 0 + + + + Direction + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + RB_Dir12 + + + Perpendicular + + + + + RB_Dir13 + + + Tangent + + + + + RB_Dir11 + + + Angle + + + + + RB_Dir14 + + + VX-VY + + + + + + + + + + RB_Dir11 + RB_Dir12 + RB_Dir13 + RB_Dir14 + + + diff --git a/src/EntityGUI/UIFiles/EntityGUI_Dir2_QTD.ui b/src/EntityGUI/UIFiles/EntityGUI_Dir2_QTD.ui new file mode 100644 index 000000000..617d3c3f6 --- /dev/null +++ b/src/EntityGUI/UIFiles/EntityGUI_Dir2_QTD.ui @@ -0,0 +1,120 @@ + +EntityGUI_Dir2_QTD + + + EntityGUI_Dir2_QTD + + + + 0 + 0 + 124 + 106 + + + + EntityGUI_Dir2_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupDir2 + + + + 7 + 7 + 0 + 0 + + + + Direction + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + RB_Dir22 + + + X + + + + + RB_Dir23 + + + Y + + + + + Spacer4 + + + Vertical + + + Expanding + + + + 0 + 20 + + + + + + RB_Dir21 + + + Length + + + + + + + + + + RB_Dir21 + RB_Dir22 + RB_Dir23 + + + diff --git a/src/EntityGUI/UIFiles/EntityGUI_Point_QTD.ui b/src/EntityGUI/UIFiles/EntityGUI_Point_QTD.ui new file mode 100644 index 000000000..8e0bd22ad --- /dev/null +++ b/src/EntityGUI/UIFiles/EntityGUI_Point_QTD.ui @@ -0,0 +1,103 @@ + +EntityGUI_Point_QTD + + + EntityGUI_Point_QTD + + + + 0 + 0 + 124 + 106 + + + + EntityGUI_Point_QTD + + + + unnamed + + + 0 + + + 6 + + + + GroupPoint + + + + 7 + 0 + 0 + 0 + + + + Point + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + RB_Point2 + + + Relative + + + + + RB_Point1 + + + Absolute + + + + + RB_Point3 + + + Selection + + + + + + + + + + RB_Point1 + RB_Point2 + RB_Point3 + + + diff --git a/src/EntityGUI/UIFiles/EntityGUI_Skeleton_QTD.ui b/src/EntityGUI/UIFiles/EntityGUI_Skeleton_QTD.ui new file mode 100644 index 000000000..1a27ca107 --- /dev/null +++ b/src/EntityGUI/UIFiles/EntityGUI_Skeleton_QTD.ui @@ -0,0 +1,379 @@ + +EntityGUI_Skeleton_QTD + + + EntityGUI_Skeleton_QTD + + + + 0 + 0 + 317 + 276 + + + + + 5 + 7 + 0 + 0 + + + + EntityGUI_Skeleton_QTD + + + + unnamed + + + 11 + + + 6 + + + + Layout1 + + + + unnamed + + + 0 + + + 6 + + + + GroupVal + + + + 7 + 7 + 0 + 0 + + + + + + + + + GroupConstructors + + + + 5 + 0 + 0 + 0 + + + + Element Type + + + + unnamed + + + 11 + + + 6 + + + + Layout2 + + + + unnamed + + + 0 + + + 6 + + + + RadioButton1 + + + Segment + + + + + RadioButton2 + + + Arc + + + + + + + + + GroupDest + + + + 7 + 0 + 0 + 0 + + + + Destination + + + + unnamed + + + 11 + + + 6 + + + + Layout5 + + + + unnamed + + + 0 + + + 6 + + + + GroupDest1 + + + + 7 + 0 + 0 + 0 + + + + Type + + + + unnamed + + + 11 + + + 6 + + + + Layout4 + + + + unnamed + + + 0 + + + 6 + + + + RB_Dest2 + + + Direction + + + + + RB_Dest1 + + + Point + + + + + + + + + GroupDest2 + + + + 7 + 7 + 0 + 0 + + + + + + + + unnamed + + + 11 + + + 6 + + + + + + GroupDest3 + + + + 7 + 7 + 0 + 0 + + + + + + + + unnamed + + + 11 + + + 6 + + + + + + + + + + GroupButtons + + + + 7 + 0 + 0 + 0 + + + + + + + + unnamed + + + 11 + + + 6 + + + + Layout3 + + + + unnamed + + + 0 + + + 6 + + + + buttonEnd + + + End Sketch + + + + + buttonClose + + + Close Sketch + + + + + Spacer1 + + + Horizontal + + + Expanding + + + + 91 + 0 + + + + + + buttonCancel + + + &Cancel + + + + + + + + + + + + RadioButton1 + RadioButton2 + RB_Dest1 + RB_Dest2 + buttonEnd + buttonClose + buttonCancel + + + diff --git a/src/EntityGUI/UIFiles/ui_to_cxx b/src/EntityGUI/UIFiles/ui_to_cxx new file mode 100755 index 000000000..e370f446a --- /dev/null +++ b/src/EntityGUI/UIFiles/ui_to_cxx @@ -0,0 +1,28 @@ +#!/bin/sh + +uic -o EntityGUI_Skeleton_QTD.h EntityGUI_Skeleton_QTD.ui +uic -o EntityGUI_Skeleton_QTD.cxx -impl EntityGUI_Skeleton_QTD.h EntityGUI_Skeleton_QTD.ui + +uic -o EntityGUI_Point_QTD.h EntityGUI_Point_QTD.ui +uic -o EntityGUI_Point_QTD.cxx -impl EntityGUI_Point_QTD.h EntityGUI_Point_QTD.ui + +uic -o EntityGUI_Dir1_QTD.h EntityGUI_Dir1_QTD.ui +uic -o EntityGUI_Dir1_QTD.cxx -impl EntityGUI_Dir1_QTD.h EntityGUI_Dir1_QTD.ui + +uic -o EntityGUI_Dir2_QTD.h EntityGUI_Dir2_QTD.ui +uic -o EntityGUI_Dir2_QTD.cxx -impl EntityGUI_Dir2_QTD.h EntityGUI_Dir2_QTD.ui + +uic -o EntityGUI_1Spin_QTD.h EntityGUI_1Spin_QTD.ui +uic -o EntityGUI_1Spin_QTD.cxx -impl EntityGUI_1Spin_QTD.h EntityGUI_1Spin_QTD.ui + +uic -o EntityGUI_2Spin_QTD.h EntityGUI_2Spin_QTD.ui +uic -o EntityGUI_2Spin_QTD.cxx -impl EntityGUI_2Spin_QTD.h EntityGUI_2Spin_QTD.ui + +uic -o EntityGUI_3Spin_QTD.h EntityGUI_3Spin_QTD.ui +uic -o EntityGUI_3Spin_QTD.cxx -impl EntityGUI_3Spin_QTD.h EntityGUI_3Spin_QTD.ui + +uic -o EntityGUI_4Spin_QTD.h EntityGUI_4Spin_QTD.ui +uic -o EntityGUI_4Spin_QTD.cxx -impl EntityGUI_4Spin_QTD.h EntityGUI_4Spin_QTD.ui + +uic -o EntityGUI_1Sel_QTD.h EntityGUI_1Sel_QTD.ui +uic -o EntityGUI_1Sel_QTD.cxx -impl EntityGUI_1Sel_QTD.h EntityGUI_1Sel_QTD.ui diff --git a/src/GEOM/GEOM_Gen_i.cc b/src/GEOM/GEOM_Gen_i.cc index 14a1c3b09..ed2828604 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" @@ -4424,6 +4425,36 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeWire( const GEOM::GEOM_Gen::ListOfIOR& List } +//================================================================================= +// 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::MakeBox", SALOME::BAD_PARAM); + } + + if (tds.IsNull()) { + THROW_SALOME_CORBA_EXCEPTION("Make Box aborted : null shape", SALOME::BAD_PARAM); + } + else { + result = CreateObject(tds); + const char *entry = InsertInLabel(tds, result->Name(), myCurrentOCAFDoc) ; + result->ShapeId(entry) ; + } + return result; +} + + //================================================================================= // function : MakeBezier() // purpose : Make a wire from a list containing many points @@ -4466,10 +4497,10 @@ GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeBezier( const GEOM::GEOM_Gen::ListOfIOR& Li //================================================================================= -// function : MakeBSpline() +// function : MakeInterpol() // purpose : Make a wire from a list containing many points //================================================================================= -GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeBSpline( const GEOM::GEOM_Gen::ListOfIOR& ListShapes ) +GEOM::GEOM_Shape_ptr GEOM_Gen_i::MakeInterpol( const GEOM::GEOM_Gen::ListOfIOR& ListShapes ) throw (SALOME::SALOME_Exception) { GEOM::GEOM_Shape_var result; diff --git a/src/GEOM/GEOM_Gen_i.hh b/src/GEOM/GEOM_Gen_i.hh index 1ba8a8243..b5a518efb 100644 --- a/src/GEOM/GEOM_Gen_i.hh +++ b/src/GEOM/GEOM_Gen_i.hh @@ -591,9 +591,20 @@ class GEOM_Gen_i: public POA_GEOM::GEOM_Gen, GEOM::GEOM_Shape_ptr MakeSolid (const GEOM::GEOM_Gen::ListOfIOR& ListShapes) throw (SALOME::SALOME_Exception) ; + + //-------------------------------------------------------------------// + // Speciic method Sketcher // + //-------------------------------------------------------------------// + GEOM::GEOM_Shape_ptr MakeSketcher (const char* Cmd) + throw (SALOME::SALOME_Exception) ; + + + //-------------------------------------------------------------------// + // Speciic method Spline // + //-------------------------------------------------------------------// GEOM::GEOM_Shape_ptr MakeBezier (const GEOM::GEOM_Gen::ListOfIOR& ListShapes) throw (SALOME::SALOME_Exception) ; - GEOM::GEOM_Shape_ptr MakeBSpline (const GEOM::GEOM_Gen::ListOfIOR& ListShapes) + GEOM::GEOM_Shape_ptr MakeInterpol (const GEOM::GEOM_Gen::ListOfIOR& ListShapes) throw (SALOME::SALOME_Exception) ; diff --git a/src/GEOMContext/GEOM_icons.po b/src/GEOMContext/GEOM_icons.po index a313a820b..ed64a379c 100644 --- a/src/GEOMContext/GEOM_icons.po +++ b/src/GEOMContext/GEOM_icons.po @@ -355,8 +355,8 @@ msgid "ICON_DLG_BEZIER" msgstr "bezier.png" #SplineDlg -msgid "ICON_DLG_BSPLINE" -msgstr "bspline.png" +msgid "ICON_DLG_INTERPOL" +msgstr "interpol.png" diff --git a/src/GEOMContext/GEOM_msg_en.po b/src/GEOMContext/GEOM_msg_en.po index 4a3409141..1b91d57f8 100644 --- a/src/GEOMContext/GEOM_msg_en.po +++ b/src/GEOMContext/GEOM_msg_en.po @@ -1188,5 +1188,114 @@ msgid "GEOM_SPLINE" msgstr "Spline" msgid "GEOM_BEZIER" msgstr "Bezier" -msgid "GEOM_BSPLINE" -msgstr "BSpline" +msgid "GEOM_INTERPOL" +msgstr "Interpolation" + +# +#============================================================================== +# + +msgid "GEOM_SKETCHER_EL" +msgstr "Element Type" + +msgid "GEOM_BUT_CLOSE_SKETCH" +msgstr "Close Sketcher" + +msgid "GEOM_BUT_END_SKETCH" +msgstr "End Sketcher" + +msgid "GEOM_SKETCHER_TITLE" +msgstr "Spline Construction" + +msgid "GEOM_SKETCHER_POINT" +msgstr "Point" + +msgid "GEOM_SKETCHER_SEGMENT" +msgstr "Segment" + +msgid "GEOM_SKETCHER_ARC" +msgstr "Arc" + +msgid "GEOM_SKETCHER_DIR" +msgstr "Direction" + +msgid "GEOM_SKETCHER_POINT2" +msgstr "Point :" + +msgid "GEOM_SKETCHER_DEST" +msgstr "Destination" + +msgid "GEOM_SKETCHER_ABS" +msgstr "Absolute" + +msgid "GEOM_SKETCHER_REL" +msgstr "Relative" + +msgid "GEOM_SKETCHER_SEL" +msgstr "Selection" + +msgid "GEOM_SKETCHER_ANGLE" +msgstr "Angle" + +msgid "GEOM_SKETCHER_PER" +msgstr "Perpendicular" + +msgid "GEOM_SKETCHER_TAN" +msgstr "Tangent" + +msgid "GEOM_SKETCHER_VXVY" +msgstr "VX-VY" + +msgid "GEOM_SKETCHER_LENGTH" +msgstr "Length" + +msgid "GEOM_SKETCHER_X" +msgstr "X" + +msgid "GEOM_SKETCHER_Y" +msgstr "Y" + +msgid "GEOM_SKETCHER_X2" +msgstr "X :" + +msgid "GEOM_SKETCHER_Y2" +msgstr "Y :" + +msgid "GEOM_SKETCHER_X3" +msgstr "Abs. X :" + +msgid "GEOM_SKETCHER_Y3" +msgstr "Abs. Y :" + +msgid "GEOM_SKETCHER_DX2" +msgstr "DX :" + +msgid "GEOM_SKETCHER_DY2" +msgstr "DY :" + +msgid "GEOM_SKETCHER_VX2" +msgstr "VX :" + +msgid "GEOM_SKETCHER_VY2" +msgstr "VY :" + +msgid "GEOM_SKETCHER_LENGTH2" +msgstr "Length :" + +msgid "GEOM_SKETCHER_ANGLE2" +msgstr "Angle :" + +msgid "GEOM_SKETCHER_RADIUS2" +msgstr "Radius :" + +msgid "GEOM_SKETCHER_UNDO" +msgstr "Undo" + +msgid "GEOM_SKETCHER_APPLY" +msgstr "Apply" + +msgid "GEOM_SKETCHER_VALUES" +msgstr "Values" + +msgid "GEOM_SKETCHER_TYPE" +msgstr "Type" diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index a41b0b9d3..c088103b9 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -166,13 +166,13 @@ bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) if(!GeomGUI->LoadLibrary("libGenerationGUI.so")) return false; } - else if(theCommandID == 404) { // SKETCHER - if(!GeomGUI->LoadLibrary("libSketcherGUI.so")) + else if(theCommandID == 404 || // MENU ENTITY - SKETCHER + theCommandID == 406 || // MENU ENTITY - SPLINE + theCommandID == 407) { // MENU ENTITY - EXPLODE + if(!GeomGUI->LoadLibrary("libEntityGUI.so")) return false; } - else if(theCommandID == 406 || // MENU BUILD - SPLINE - theCommandID == 407 || // MENU BUILD - EXPLODE - theCommandID == 4081 || // MENU BUILD - EDGE + else if(theCommandID == 4081 || // MENU BUILD - EDGE theCommandID == 4082 || // MENU BUILD - WIRE theCommandID == 4083 || // MENU BUILD - FACE theCommandID == 4084 || // MENU BUILD - SHELL diff --git a/src/Makefile.in b/src/Makefile.in index ca45ef2ce..766733aad 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -32,6 +32,6 @@ VPATH=.:@srcdir@ @COMMENCE@ -SUBDIRS = OBJECT ARCHIMEDE PARTITION GEOMDS GEOM GEOMClient GEOMFiltersSelection DlgRef GEOMContext GEOMBase DisplayGUI GEOMToolsGUI SketcherGUI BasicGUI PrimitiveGUI GenerationGUI BuildGUI BooleanGUI TransformationGUI OperationGUI RepairGUI MeasureGUI GEOMGUI GEOM_SWIG +SUBDIRS = OBJECT ARCHIMEDE PARTITION SKETCHER GEOMDS GEOM GEOMClient GEOMFiltersSelection DlgRef GEOMContext GEOMBase DisplayGUI GEOMToolsGUI BasicGUI PrimitiveGUI GenerationGUI EntityGUI BuildGUI BooleanGUI TransformationGUI OperationGUI RepairGUI MeasureGUI GEOMGUI GEOM_SWIG @MODULE@ 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/Makefile.in b/src/SKETCHER/Makefile.in index eedb7f2cd..01e012f75 100644 --- a/src/SKETCHER/Makefile.in +++ b/src/SKETCHER/Makefile.in @@ -1,4 +1,4 @@ -# GEOM SKETCHER : basic sketcher +# GEOM GEOMBASE : # # Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -22,9 +22,9 @@ # # # File : Makefile.in -# Author : Patrick GOLDBRONN (CEA) +# Author : Damien COQUERET (OCC) # Module : GEOM -# $Header$ +# $Header: top_srcdir=@top_srcdir@ top_builddir=../.. @@ -36,22 +36,18 @@ VPATH=.:@srcdir@:@top_srcdir@/idl # Libraries targets LIB = libGEOMSketcher.la -LIB_SRC = GEOM_Sketcher.cxx -LIB_CLIENT_IDL = SALOME_Component.idl SALOMEDS.idl SALOME_Exception.idl GEOM_Shape.idl GEOM_Gen.idl +LIB_SRC = Sketcher_Profile.cxx +LIB_CLIENT_IDL = SALOME_Exception.idl \ + SALOMEDS.idl \ + SALOMEDS_Attributes.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 += $(OCC_KERNEL_LIBS) $(OCC_MODELER_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome +CPPFLAGS += $(OCC_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += -I${KERNEL_ROOT_DIR}/include/salome -# additional file to be cleaned -MOSTLYCLEAN = -CLEAN = -DISTCLEAN = +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..24353d4a8 --- /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); + if (length > Precision::Confusion()) { + move = line; + 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 Sketcher_Profile +{ + +public: + Sketcher_Profile(); + Sketcher_Profile(const char* aCmd); + +private: + gp_Pnt myLastPoint; + gp_Dir myLastDir; + + TopoDS_Shape myShape; + bool myOK; + +public: + gp_Pnt GetLastPoint(){return myLastPoint;}; + gp_Dir GetLastDir(){return myLastDir;}; + + const TopoDS_Shape& GetShape(){return myShape;}; + bool IsDone(){return myOK;}; + }; -- 2.39.2