From: dcq Date: Wed, 22 Oct 2003 12:09:38 +0000 (+0000) Subject: DCQ : Architecture GEOM... X-Git-Tag: DCQ_03_12_03~15 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=cd1b14bda9d8ac12b506599236c105523d4b4f42;p=modules%2Fgeom.git DCQ : Architecture GEOM... --- diff --git a/src/DisplayGUI/DisplayGUI.cxx b/src/DisplayGUI/DisplayGUI.cxx new file mode 100644 index 000000000..00fba79f2 --- /dev/null +++ b/src/DisplayGUI/DisplayGUI.cxx @@ -0,0 +1,979 @@ +// 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 : DisplayGUI.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +using namespace std; +#include "DisplayGUI.h" + +#include "QAD_RightFrame.h" +#include "GEOM_AssemblyBuilder.h" +#include "VTKViewer_ViewFrame.h" +#include "OCCViewer_ViewFrame.h" +#include "OCCViewer_Viewer3d.h" +#include "SALOMEGUI_ImportOperation.h" +#include "SALOME_ListIteratorOfListIO.hxx" + +#include + +//======================================================================= +// function : DisplayGUI() +// purpose : Constructor +//======================================================================= +DisplayGUI::DisplayGUI() : + QObject() +{ + myGeomBase = new GEOMBase(); + myGeomGUI = GEOMContext::GetGeomGUI(); + myGeom = myGeomGUI->myComponentGeom; +} + + +//======================================================================= +// function : ~DisplayGUI() +// purpose : Destructor +//======================================================================= +DisplayGUI::~DisplayGUI() +{ +} + + +//======================================================================= +// function : OnGUIEvent() +// purpose : +//======================================================================= +bool DisplayGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) +{ + DisplayGUI* myDisplayGUI = new DisplayGUI(); + + switch (theCommandID) + { + case 211: // MENU VIEW - WIREFRAME/SHADING + { + if(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + QApplication::setOverrideCursor(waitCursor); + + VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + + int themode = myRenderInter->GetDisplayMode(); + if(themode==0) { + myRenderInter->SetDisplayMode(1); + myDisplayGUI->myGeomGUI->GetDesktop()->menuBar()->changeItem(211, tr("GEOM_MEN_WIREFRAME")); + } + else { + myRenderInter->SetDisplayMode(0); + myDisplayGUI->myGeomGUI->GetDesktop()->menuBar()->changeItem(211, tr("GEOM_MEN_SHADING")); + } + + QApplication::restoreOverrideCursor(); + } + else if(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + QApplication::setOverrideCursor(Qt::waitCursor); + + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); + AIS_DisplayMode mode = (AIS_DisplayMode)ic->DisplayMode(); + AIS_DisplayMode newmode = (mode == AIS_WireFrame ? AIS_Shaded : AIS_WireFrame); + + AIS_ListOfInteractive List; + ic->DisplayedObjects(List); + AIS_ListOfInteractive List1; + ic->ObjectsInCollector(List1); + List.Append(List1); + + AIS_ListIteratorOfListOfInteractive ite(List); + while(ite.More()) { + if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { + Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value()); + ic->SetDisplayMode(aSh,Standard_Integer(newmode),true); + } + ite.Next(); + } + + ic->SetDisplayMode(newmode, Standard_False); + if(newmode == 1) + myDisplayGUI->myGeomGUI->GetDesktop()->menuBar()->changeItem(211, tr("GEOM_MEN_WIREFRAME")); + else + myDisplayGUI->myGeomGUI->GetDesktop()->menuBar()->changeItem(211, tr("GEOM_MEN_SHADING")); + + QApplication::restoreOverrideCursor(); + } + break; + } + case 212: // MENU VIEW - DISPLAY ALL + { + if(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) + ((VTKViewer_ViewFrame*)myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->DisplayAll(); + else if(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) + myDisplayGUI->OnDisplayAll(); + break; + } + case 213: // MENU VIEW - DISPLAY ONLY + { + if(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) + myDisplayGUI->OnVTKDisplayOnly(); + else if(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) + myDisplayGUI->OnDisplayOnly(); + break; + } + case 214: // MENU VIEW - ERASE ALL + { + if(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) + ((VTKViewer_ViewFrame*)myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor()->EraseAll(); + else if(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); + + ic->EraseAll(Standard_True, Standard_False); + ic->Display(v3d->getTrihedron()); + } + break; + } + case 215: // MENU VIEW - ERASE ONLY + { + myDisplayGUI->OnErase(); + break; + } + case 8031: // POPUP VIEWER - WIREFRAME/SHADING + { + if(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + // VTK + VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + + SALOME_Selection* Sel = SALOME_Selection::Selection(myDisplayGUI->myGeomGUI->GetActiveStudy()->getSelection()); + SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); + + QApplication::setOverrideCursor(Qt::waitCursor); + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IOS = It.Value(); + myRenderInter->SwitchRepresentation(IOS, false); + } + myRenderInter->Render(); + QApplication::restoreOverrideCursor(); + } + else if(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + QApplication::setOverrideCursor(Qt::waitCursor); + SALOME_Selection* Sel = SALOME_Selection::Selection(myDisplayGUI->myGeomGUI->GetActiveStudy()->getSelection()); + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); + SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + Standard_Boolean found; + Handle(GEOM_AISShape) Shape = myDisplayGUI->myGeomBase->ConvertIOinGEOMAISShape(IObject, found, true); + if(!Shape.IsNull()) { + AIS_DisplayMode mode = (AIS_DisplayMode)Shape->DisplayMode(); + if(mode == -1) + mode = (AIS_DisplayMode)ic->DisplayMode(); + + QApplication::setOverrideCursor(Qt::waitCursor); + ic->SetDisplayMode(Shape, mode == AIS_WireFrame ? AIS_Shaded : AIS_WireFrame, false); + } + QApplication::restoreOverrideCursor(); + } + ic->UpdateCurrentViewer(); + } + QApplication::restoreOverrideCursor(); + break; + } + default: + { + parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + break; + } + } + return true; +} + + +//================================================================================= +// function : BuildPresentation() +// purpose : static +//================================================================================= +void DisplayGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO) +{ + DisplayGUI* myDisplayGUI = new DisplayGUI(); + + SALOMEDS::Study_var aStudy = myDisplayGUI->myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + + OCCViewer_Viewer3d* v3d; + Handle(AIS_InteractiveContext) ic; + vtkRenderer* Renderer; + + if(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + v3d = ((OCCViewer_ViewFrame*)myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + ic = v3d->getAISContext(); + } + else if(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + Renderer = ((VTKViewer_ViewFrame*)myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + } + else + return; + + if(theIO.IsNull()) + MESSAGE("BuildPresentation(): null SALOME_InteractiveObject passed") + + if(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + // VTK + + SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->entry()); + + SALOMEDS::SObject_var obj = aStudy->FindObjectID(theIO->getEntry()); + + VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeIOR_var anIOR; + + if(myRenderInter->isInViewer(theIO)) { + myRenderInter->Display(theIO, false); + } + else { + // Create new actor + if(!obj->_is_nil()) { + if(obj->FindAttribute(anAttr, "AttributeIOR")) { + // this SObject may be GEOM module root SObject + + bool useSubItems = false; + SALOMEDS::ChildIterator_var anIter = myDisplayGUI->myGeomGUI->GetActiveStudy()->getStudyDocument()->NewChildIterator(obj); + if(myDisplayGUI->myGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(anAttr)->Value())->_is_nil()) { + while (anIter->More() && !useSubItems) { + SALOMEDS::SObject_var subobj = anIter->Value(); + SALOMEDS::GenericAttribute_var aTmpAttr; + if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) { + if (!myDisplayGUI->myGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(aTmpAttr)->Value())->_is_nil()) { + anAttr = aTmpAttr; + obj = subobj; + useSubItems = true; + } + else + anIter->Next(); + } + else + anIter->Next(); + } + } + + while(useSubItems?anIter->More():!anAttr->_is_nil()) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + GEOM::GEOM_Shape_var aShape = myDisplayGUI->myGeom->GetIORFromString(anIOR->Value()); + TopoDS_Shape Shape = myDisplayGUI->myGeomGUI->GetShapeReader().GetShape(myDisplayGUI->myGeom,aShape); + + if(obj->FindAttribute(anAttr, "AttributeName")) { + aName = SALOMEDS::AttributeName::_narrow(anAttr); + + vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + vtkActorCollection* theAllActors = theRenderer->GetActors(); + theAllActors->InitTraversal(); + vtkActor* actor = (vtkActor*)theAllActors->GetNextActor(); + Handle(SALOME_InteractiveObject) anIObj; + // don't create new study object if it already exists + bool isDisplayed = false; + while(!(actor==NULL)) { + SALOME_Actor* Gactor = SALOME_Actor::SafeDownCast(actor); + if(Gactor!=NULL) { + if(Gactor->hasIO()) { + if(strcmp(Gactor->getIO()->getEntry(),obj->GetID())==0) { + isDisplayed = true; + anIObj = Gactor->getIO(); + if(!anIObj.IsNull()) myRenderInter->Display(anIObj, false); + } + } + } + actor=(vtkActor*)(theAllActors->GetNextActor()); + } + if(!isDisplayed) { + // open transaction + QAD_Operation* op = new SALOMEGUI_ImportOperation( myDisplayGUI->myGeomGUI->GetActiveStudy() ); + op->start(); + + SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); + aStudyBuilder->Addreference(newObj1, obj); + // commit transaction + op->finish(); + + vtkRenderWindow *renWin = theRenderer->GetRenderWindow(); + int themode = myRenderInter->GetDisplayMode(); + + vtkActorCollection* theActors = + GEOM_AssemblyBuilder::BuildActors(Shape,0,themode,Standard_True); + theActors->InitTraversal(); + vtkActor* anActor = (vtkActor*)theActors->GetNextActor(); + while(!(anActor==NULL)) { + GEOM_Actor* GActor = GEOM_Actor::SafeDownCast(anActor); + Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(), myDisplayGUI->myGeomGUI->GetFatherior(),"GEOM"); + IO->setEntry(obj->GetID()); + GActor->setIO(IO); + GActor->setName(theIO->getName()); + + theRenderer->AddActor(GActor); + // renWin->Render(); + anActor = (vtkActor*)theActors->GetNextActor(); + } + } + } + // next item iteration + if(useSubItems) { + anIter->Next(); + anAttr = SALOMEDS::GenericAttribute::_nil(); + while(anIter->More() && anAttr->_is_nil()) { + SALOMEDS::SObject_var subobject = anIter->Value(); + SALOMEDS::GenericAttribute_var aTmpAttribute; + if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) { + anAttr = aTmpAttribute; + obj = subobject; + } + else + anIter->Next(); + } + } + else + anAttr = SALOMEDS::GenericAttribute::_nil(); + } + } + } + } + // No viewer update should be done here! + //myRenderInter->Render(); + //myDisplayGUI->myGeomGUI->GetActiveStudy()->updateObjBrowser( true ); + } + else if(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(myDisplayGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->entry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeIOR_var anIOR; + + if(v3d->isInViewer(theIO, true)) { + Standard_Boolean found; + Handle(GEOM_AISShape) aSh = myDisplayGUI->myGeomBase->ConvertIOinGEOMAISShape(theIO, found, true); + if(found) { + ic->Display(aSh, false); + ic->AddOrRemoveCurrentObject(aSh, false); + } + + } + else { + SALOMEDS::SObject_var obj = aStudy->FindObjectID(theIO->getEntry()); + if(!obj->_is_nil()) { + MESSAGE("BuildPresentation(): SObject not null") + if(obj->FindAttribute(anAttr, "AttributeIOR")) { + MESSAGE("BuildPresentation(): SObject has IOR") + // this SObject may be GEOM module root SObject + + bool useSubItems = false; + SALOMEDS::ChildIterator_var anIter = myDisplayGUI->myGeomGUI->GetActiveStudy()->getStudyDocument()->NewChildIterator(obj); + if(myDisplayGUI->myGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(anAttr)->Value())->_is_nil()) { + while(anIter->More() && !useSubItems) { + SALOMEDS::SObject_var subobj = anIter->Value(); + SALOMEDS::GenericAttribute_var aTmpAttr; + if(subobj->FindAttribute(aTmpAttr, "AttributeIOR")) { + if(!myDisplayGUI->myGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(aTmpAttr)->Value())->_is_nil()) { + anAttr = aTmpAttr; + obj = subobj; + useSubItems = true; + } + else + anIter->Next(); + } + else + anIter->Next(); + } + } + + while(useSubItems?anIter->More():!anAttr->_is_nil()) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + GEOM::GEOM_Shape_var aShape = myDisplayGUI->myGeom->GetIORFromString(anIOR->Value()); + TopoDS_Shape Shape = myDisplayGUI->myGeomGUI->GetShapeReader().GetShape(myDisplayGUI->myGeom,aShape); + if(Shape.IsNull()) + MESSAGE("BuildPresentation(): TopoDS_Shape is null!") + if(obj->FindAttribute(anAttr, "AttributeName")) { + MESSAGE("BuildPresentation(): SObject has Name") + aName = SALOMEDS::AttributeName::_narrow(anAttr); + // searchin for already displayed objects with the same shape + AIS_ListOfInteractive aDisplayed; + ic->DisplayedObjects(aDisplayed); + AIS_ListIteratorOfListOfInteractive anIObjects(aDisplayed); + Handle(AIS_Shape) anAISShape; + for(;anIObjects.More();anIObjects.Next()) { + anAISShape = Handle(AIS_Shape)::DownCast(anIObjects.Value()); + if(!anAISShape.IsNull()) { + if(anAISShape->Shape().IsSame(Shape)) + break; + anAISShape.Nullify(); + } + } + if(!anAISShape.IsNull()) { + if(!ic->IsDisplayed(anAISShape)) + ic->Display(anAISShape, false); + } + else { + if(!useSubItems) { + // open transaction + QAD_Operation* op = new SALOMEGUI_ImportOperation( myDisplayGUI->myGeomGUI->GetActiveStudy() ); + op->start(); + if (fatherSF->_is_nil()) + MESSAGE("BuildPresentation(): fatherSF is nil!") + SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); + aStudyBuilder->Addreference(newObj1, obj); + // commit transaction + op->finish(); + } + Handle(GEOM_AISShape) aSh = new GEOM_AISShape(Shape, aName->Value()); + aSh->SetShadingColor(myDisplayGUI->myGeomGUI->GetShadingColor()); + Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(), myDisplayGUI->myGeomGUI->GetFatherior(), "GEOM"); + IO->setEntry(obj->GetID()); + aSh->setIO(IO); + aSh->setName(aName->Value()); + ic->Display(aSh, false); + if(!useSubItems) + ic->AddOrRemoveCurrentObject(aSh, false); + } + } + // next item iteration + if(useSubItems) { + anIter->Next(); + anAttr=SALOMEDS::GenericAttribute::_nil(); + while (anIter->More() && anAttr->_is_nil()) { + SALOMEDS::SObject_var subobject = anIter->Value(); + SALOMEDS::GenericAttribute_var aTmpAttribute; + if(subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) { + anAttr = aTmpAttribute; + obj = subobject; + } + else + anIter->Next(); + } + } + else + anAttr = SALOMEDS::GenericAttribute::_nil(); + } + } + } + } + // No viewer update should be done here! + //myDisplayGUI->myGeomGUI->GetActiveStudy()->updateObjBrowser( true ); + //ic->UpdateCurrentViewer(); + } +} + + +//===================================================================================== +// function : OnDisplayAll() +// purpose : +//===================================================================================== +void DisplayGUI::OnDisplayAll(bool onlyPreviousDisplayedObject) +{ + if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + return; + + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) myContext = v3d->getAISContext(); + + myContext->Display(v3d->getTrihedron()); + + if(!onlyPreviousDisplayedObject) { + AIS_ListOfInteractive List1; + myContext->ObjectsInCollector(List1); + AIS_ListIteratorOfListOfInteractive ite1(List1); + while(ite1.More()) { + if(ite1.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { + Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite1.Value()); + if(aSh->hasIO()) { + Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO()); + if(v3d->isInViewer(GIO, true)) { + myContext->Display(aSh); + } + } + } + ite1.Next(); + } + } + else { + AIS_ListIteratorOfListOfInteractive ite(myGeomGUI->GetListDisplayedObject()); + while(ite.More()) { + if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { + Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value()); + if (aSh->hasIO()) { + Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO()); + if (v3d->isInViewer(GIO,true)) { + myContext->Display(aSh); + } + } + } + ite.Next(); + } + } + return; +} + + +//===================================================================================== +// function : OnVTKDisplayOnly() +// purpose : +//===================================================================================== +void DisplayGUI::OnVTKDisplayOnly() +{ + QApplication::setOverrideCursor(Qt::waitCursor); + + // Erase all not selected actors + vtkRenderer* aren = ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + vtkActorCollection* theActors = aren->GetActors(); + theActors->InitTraversal(); + vtkActor *ac = theActors->GetNextActor(); + while(!(ac==NULL)) { + if(ac->IsA("SALOME_Actor")) { + SALOME_Actor* anActor = SALOME_Actor::SafeDownCast(ac); + if(!anActor->isHighlighted()) + anActor->VisibilityOff(); + } + ac = theActors->GetNextActor(); + } + + // Display selection + SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->entry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeIOR_var anIOR; + + SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection()); + SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); + + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() ); + + VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + + if(myRenderInter->isInViewer(IObject)) { + myRenderInter->Display(IObject); + } + else { + // Create new actor + if(!obj->_is_nil()) { + if(!obj->FindAttribute(anAttr, "AttributeIOR")) + break; + // If selected object contains displayable subobjects, then do nothing + SALOMEDS::ChildIterator_var anIter = myGeomGUI->GetActiveStudy()->getStudyDocument()->NewChildIterator(obj); + SALOMEDS::GenericAttribute_var aTmpAttr; + + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(anIOR->Value()); + if(CORBA::is_nil(aShape)) continue; + TopoDS_Shape Shape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); + + if(obj->FindAttribute(anAttr, "AttributeName")) { + aName = SALOMEDS::AttributeName::_narrow(anAttr); + // open transaction + QAD_Operation* op = new SALOMEGUI_ImportOperation(myGeomGUI->GetActiveStudy()); + op->start(); + + SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); + aStudyBuilder->Addreference(newObj1, obj); + // commit transaction + op->finish(); + + vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + int themode = myRenderInter->GetDisplayMode(); + vtkActorCollection* theActors = GEOM_AssemblyBuilder::BuildActors(Shape, 0, themode, Standard_True); + theActors->InitTraversal(); + vtkActor* anActor = (vtkActor*)theActors->GetNextActor(); + while(!(anActor==NULL)) { + GEOM_Actor* GActor = GEOM_Actor::SafeDownCast(anActor); + GActor->setIO(IObject); + GActor->setName(IObject->getName()); + + theRenderer->AddActor(GActor); + vtkRenderWindow *renWin = ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer()->GetRenderWindow(); + renWin->Render(); + anActor = (vtkActor*)theActors->GetNextActor(); + } + } + } + } + } + myGeomGUI->GetActiveStudy()->updateObjBrowser(true); + + QApplication::restoreOverrideCursor(); + return; +} + + +//===================================================================================== +// function : OnDisplayOnly() +// purpose : +//===================================================================================== +void DisplayGUI::OnDisplayOnly() +{ + if (myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + return; + + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + + AIS_ListOfInteractive List; + ic->DisplayedObjects(List); + AIS_ListIteratorOfListOfInteractive ite(List); + while(ite.More()) { + if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { + Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value()); + if (!ic->IsSelected( aSh )) { + ic->Erase(aSh, Standard_True, Standard_True); + } + } + ite.Next(); + } + + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection()); + + SALOME_ListIteratorOfListIO It1(Sel->StoredIObjects()); + for(;It1.More();It1.Next()) { + Handle(SALOME_InteractiveObject) IObject = It1.Value(); + + SALOMEDS::SObject_var fatherSF = + aStudy->FindObjectID(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->entry()); + if(v3d->isInViewer(IObject, true)) { + AIS_ListOfInteractive List1; + ic->ObjectsInCollector(List1); + AIS_ListIteratorOfListOfInteractive ite1(List1); + while(ite1.More()) { + if(ite1.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { + Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite1.Value()); + if (aSh->hasIO()) { + Handle(GEOM_InteractiveObject) GIO = Handle(GEOM_InteractiveObject)::DownCast(aSh->getIO()); + if (IObject->isSame(GIO)) { + ic->Display(aSh); + ic->AddOrRemoveCurrentObject(aSh, true); + break; + } + } + } + ite1.Next(); + } + } + else { + if (IObject->hasEntry()) { + SALOMEDS::SObject_var obj = aStudy->FindObjectID(IObject->getEntry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributeIOR_var anIOR; + if (!obj->_is_nil()) { + if (obj->FindAttribute(anAttr, "AttributeIOR")) { + // this SObject may be GEOM module root SObject + + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(anIOR->Value()); + if(CORBA::is_nil(aShape)) continue; + TopoDS_Shape Shape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); + + if(obj->FindAttribute(anAttr, "AttributeName")) { + aName = SALOMEDS::AttributeName::_narrow(anAttr); + // open transaction + QAD_Operation* op = new SALOMEGUI_ImportOperation(myGeomGUI->GetActiveStudy()); + op->start(); + + SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); + aStudyBuilder->Addreference(newObj1, obj); + // commit transaction + op->finish(); + } + + Handle(GEOM_AISShape) aSh = new GEOM_AISShape(Shape, aName->Value()); + Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(), myGeomGUI->GetFatherior(),"GEOM"); + + IO->setEntry(obj->GetID()); + aSh->setIO(IO); + aSh->setName(aName->Value()); + ic->Display(aSh); + ic->AddOrRemoveCurrentObject(aSh, true); + } + } + } + } + } +} + + +//===================================================================================== +// function : OnErase() +// purpose : +//===================================================================================== +void DisplayGUI::OnErase() +{ + SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection()); + if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + // VTK + SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); + Handle(SALOME_InteractiveObject) anIObject; + for(;It.More();It.Next()) { + anIObject = It.Value(); + VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + + if(myRenderInter->isInViewer(anIObject)) { + myRenderInter->Erase(anIObject); + } + else { + SALOMEDS::SObject_var obj = aStudy->FindObjectID(anIObject->getEntry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + if(!obj->_is_nil()) { + if(obj->FindAttribute(anAttr, "AttributeIOR")) { + // this SObject may be GEOM module root SObject + SALOMEDS::ChildIterator_var anIter = myGeomGUI->GetActiveStudy()->getStudyDocument()->NewChildIterator(obj); + bool useSubItems = false; + while(anIter->More() && !useSubItems) { + SALOMEDS::SObject_var subobj = anIter->Value(); + SALOMEDS::GenericAttribute_var aTmpAttr; + if(subobj->FindAttribute(aTmpAttr, "AttributeIOR")) { + anAttr = aTmpAttr; + obj = subobj; + useSubItems = true; + } + else + anIter->Next(); + } + + while(useSubItems?anIter->More():!anAttr->_is_nil()) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(anIOR->Value()); + TopoDS_Shape Shape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); + if(obj->FindAttribute(anAttr, "AttributeName")) { + // searchin for already displayed objects with the same shape + vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); + vtkActorCollection* theAllActors = theRenderer->GetActors(); + theAllActors->InitTraversal(); + vtkActor* actor = (vtkActor*)theAllActors->GetNextActor(); + Handle(SALOME_InteractiveObject) anIObj; + // don't create new study object if it already exists + bool isDisplayed = false; + while(!(actor==NULL)) { + SALOME_Actor* Gactor = SALOME_Actor::SafeDownCast(actor); + if(Gactor!=NULL) { + if(Gactor->hasIO()) { + if(strcmp(Gactor->getIO()->getEntry(),obj->GetID())==0) { + isDisplayed = true; + anIObj = Gactor->getIO(); + if(!anIObj.IsNull()) + myRenderInter->Erase(anIObj); + } + } + } + actor=(vtkActor*)(theAllActors->GetNextActor()); + } + } + if(useSubItems) { + anIter->Next(); + anAttr=SALOMEDS::GenericAttribute::_nil(); + while(anIter->More() && anAttr->_is_nil()) { + SALOMEDS::SObject_var subobject = anIter->Value(); + SALOMEDS::GenericAttribute_var aTmpAttribute; + if(subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) { + anAttr = aTmpAttribute; + obj = subobject; + } + else + anIter->Next(); + } + } + else + anAttr = SALOMEDS::GenericAttribute::_nil(); + } + } + } + } + } + } + else if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + // OCC + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); + Handle(SALOME_InteractiveObject) anIObject; + for(;It.More();It.Next()) { + anIObject = It.Value(); + if(v3d->isInViewer(anIObject, true)) { + Standard_Boolean found; + Handle(GEOM_AISShape) aSh = myGeomBase->ConvertIOinGEOMAISShape(anIObject, found, true); + if(found) { + ic->Erase(aSh); + ic->AddOrRemoveCurrentObject(aSh, true); + } + } + else { + SALOMEDS::SObject_var obj = aStudy->FindObjectID(anIObject->getEntry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + if(!obj->_is_nil()) { + if(obj->FindAttribute(anAttr, "AttributeIOR")) { + // this SObject may be GEOM module root SObject + SALOMEDS::ChildIterator_var anIter = myGeomGUI->GetActiveStudy()->getStudyDocument()->NewChildIterator(obj); + bool useSubItems = false; + while(anIter->More() && !useSubItems) { + SALOMEDS::SObject_var subobj = anIter->Value(); + SALOMEDS::GenericAttribute_var aTmpAttr; + if(subobj->FindAttribute(aTmpAttr, "AttributeIOR")) { + anAttr = aTmpAttr; + obj = subobj; + useSubItems = true; + } + else + anIter->Next(); + } + + while(useSubItems?anIter->More():!anAttr->_is_nil()) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(anIOR->Value()); + TopoDS_Shape Shape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape); + if(obj->FindAttribute(anAttr, "AttributeName")) { + // searchin for already displayed objects with the same shape + AIS_ListOfInteractive aDisplayed; + ic->DisplayedObjects(aDisplayed); + AIS_ListIteratorOfListOfInteractive anIObjects(aDisplayed); + Handle(AIS_Shape) anAISShape; + for(;anIObjects.More();anIObjects.Next()) { + anAISShape = Handle(AIS_Shape)::DownCast(anIObjects.Value()); + if(!anAISShape.IsNull()) { + if(anAISShape->Shape().IsSame(Shape)) + break; + anAISShape.Nullify(); + } + } + if(!anAISShape.IsNull()) { + if(ic->IsDisplayed(anAISShape)) + ic->Erase(anAISShape); + } + } + if(useSubItems) { + anIter->Next(); + anAttr=SALOMEDS::GenericAttribute::_nil(); + while(anIter->More() && anAttr->_is_nil()) { + SALOMEDS::SObject_var subobject = anIter->Value(); + SALOMEDS::GenericAttribute_var aTmpAttribute; + if(subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) { + anAttr = aTmpAttribute; + obj = subobject; + } + else + anIter->Next(); + } + } + else + anAttr = SALOMEDS::GenericAttribute::_nil(); + } + } + } + } + } + } + Sel->ClearIObjects(); +} + + +//===================================================================================== +// function : PrepareSubShapeSelection() +// purpose : (localContextId of the method is opened and defined here) +//===================================================================================== +bool DisplayGUI::PrepareSubShapeSelection(const int SubShapeType, Standard_Integer& returnLocalContextId) +{ + //* Test the type of viewer */ + if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + return false; + + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + + /* local context opening */ + myGeomBase->SetDisplayedObjectList(); + this->OnDisplayOnly(); + + returnLocalContextId = ic->OpenLocalContext(Standard_False, Standard_True, Standard_False, Standard_False); + SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection()); + SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + Standard_Boolean found; + Handle(GEOM_AISShape) Shape = myGeomBase->ConvertIOinGEOMAISShape(IObject, found); + if(found && SubShapeType >= Shape->Shape().ShapeType()) { + ic->Load(Shape, (8 - SubShapeType), Standard_True); + ic->HilightWithColor(Shape, Quantity_NOC_RED); + } + } + myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_SUBSHAPES")); + return true; +} + + +//===================================================================================== +// function : PrepareSubShapeSelectionArgumentShape() +// purpose : ( localContextId of the method is opened and defined here ) +//===================================================================================== +bool DisplayGUI::PrepareSubShapeSelectionArgumentShape(const TopoDS_Shape& aShape,const int SubShapeType, Standard_Integer& returnLocalContextId) +{ + //* Test the type of viewer */ + if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + return false; + + if(aShape.IsNull()) + return false ; + + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + + /* local context opening */ + myGeomBase->SetDisplayedObjectList(); + this->OnDisplayOnly(); + + returnLocalContextId = ic->OpenLocalContext(Standard_False, Standard_True, Standard_False, Standard_False) ; + + Handle(GEOM_AISShape) Shape = new GEOM_AISShape(aShape, ""); + ic->Display(Shape, 0, (8 - SubShapeType)); + + // Not Load(...) but Display(...) + // ic->Load(Shape, (8 - SubShapeType), Standard_True); + ic->HilightWithColor(Shape, Quantity_NOC_RED); + + myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_SUBSHAPES")); + return true; +} + + +//===================================================================================== +// EXPORTED METHODS +//===================================================================================== +extern "C" +{ + bool OnGUIEvent(int theCommandID, QAD_Desktop* parent) + {return DisplayGUI::OnGUIEvent(theCommandID, parent);} + + void BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO) + {return DisplayGUI::BuildPresentation(theIO);} +} diff --git a/src/DisplayGUI/DisplayGUI.h b/src/DisplayGUI/DisplayGUI.h new file mode 100644 index 000000000..1c4aef111 --- /dev/null +++ b/src/DisplayGUI/DisplayGUI.h @@ -0,0 +1,66 @@ +// 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 : DisplayGUI.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef DISPLAYGUI_H +#define DISPLAYGUI_H + +#include "GEOMBase.h" + +//================================================================================= +// class : GEOMBase_Display +// purpose : +//================================================================================= +class DisplayGUI : public QObject +{ + Q_OBJECT /* for QT compatibility */ + +public : + DisplayGUI(); + ~DisplayGUI(); + + static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + static void BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO); + + void OnDisplayAll(bool onlyPreviousDisplayedObject = false); + void OnVTKDisplayOnly(); + void OnDisplayOnly(); + void OnErase(); + + /* Method opening context for any sub shape selection */ + bool PrepareSubShapeSelection(const int SubShapeType, Standard_Integer& returnLocalContextId); + /* Method opening context for sub shape selection on an argument shape */ + bool PrepareSubShapeSelectionArgumentShape(const TopoDS_Shape& aShape, const int SubShapeType, + Standard_Integer& returnLocalContextId); + + GEOMBase* myGeomBase; + GEOMContext* myGeomGUI; + GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ + +}; + +#endif diff --git a/src/DisplayGUI/Makefile.in b/src/DisplayGUI/Makefile.in new file mode 100644 index 000000000..d49c3f64c --- /dev/null +++ b/src/DisplayGUI/Makefile.in @@ -0,0 +1,65 @@ +# GEOM DISPLAYGUI : +# +# 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 = libDisplayGUI.la + +# header files +EXPORT_HEADERS= DisplayGUI.h + +LIB_SRC = DisplayGUI.cxx + +LIB_MOC = \ + DisplayGUI.h + +LIB_CLIENT_IDL = SALOME_Exception.idl \ + GEOM_Gen.idl \ + GEOM_Shape.idl \ + SALOMEDS.idl \ + SALOMEDS_Attributes.idl \ + SALOME_ModuleCatalog.idl \ + SALOME_Component.idl \ + +LIB_SERVER_IDL = + +# additionnal information to compil and link file + +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome + +LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMContext -lGEOMBase -L${KERNEL_ROOT_DIR}/lib/salome + +@CONCLUDE@ diff --git a/src/GEOMGUI/GeometryGUI.cxx b/src/GEOMGUI/GeometryGUI.cxx index c103087d9..4b116987e 100644 --- a/src/GEOMGUI/GeometryGUI.cxx +++ b/src/GEOMGUI/GeometryGUI.cxx @@ -30,39 +30,33 @@ using namespace std; #include "GeometryGUI.h" // Open CASCADE Includes -#include #include #include -#include -#include // SALOME Includes #include "QAD_RightFrame.h" #include "QAD_Resource.h" -#include "QAD_Tools.h" #include "QAD_Config.h" #include "OCCViewer_ViewPort.h" #include "OCCViewer_ViewPort3d.h" #include "OCCViewer_Viewer3d.h" #include "VTKViewer_ViewFrame.h" -#include "GEOM_AssemblyBuilder.h" +#include "SALOME_Selection.h" #include "SALOME_ListIteratorOfListIO.hxx" -#include "SALOMEGUI_ImportOperation.h" - -#include "GEOMBase_Tools.h" -#include "GEOMBase_Sketcher.h" -// #include "BasicGUI_PointDlg.h" /* The object itself created in the static method 'GetOrCreateGEOMBase()' */ -static GEOMBase_Context* GeomGUI = 0; -typedef bool OneDim(int, QAD_Desktop*); +static GEOMContext* GeomGUI = 0; -//======================================================================= +typedef bool OGE(int, QAD_Desktop*); +typedef bool OMP(QMouseEvent*, QAD_Desktop*, QAD_StudyFrame*); +typedef void BP(const Handle(SALOME_InteractiveObject)&); + +//================================================================================= // class : CustomItem // purpose : Set Font to a text. -//======================================================================= +//================================================================================= class CustomItem : public QCustomMenuItem { public: @@ -113,7 +107,7 @@ GeometryGUI::~GeometryGUI() // purpose : Gets or create an object 'GEOMBase' with initialisations // : Returns 'GeomGUI' as a pointer //======================================================================= -GEOMBase_Context* GeometryGUI::GetOrCreateGeometryGUI(QAD_Desktop* desktop) +GEOMContext* GeometryGUI::GetOrCreateGeometryGUI(QAD_Desktop* desktop) { GeomGUI = GeomGUI->GetOrCreateGeomGUI(desktop); return GeomGUI; @@ -124,51 +118,7 @@ GEOMBase_Context* GeometryGUI::GetOrCreateGeometryGUI(QAD_Desktop* desktop) // function : OnGUIEvent() [static] // purpose : manage all events on GUI //======================================================================= -bool GeometryGUI::LoadLibrary(int theCommandID, QAD_Desktop* parent, QString GUILibrary) -{ - QCString libs; - QFileInfo fileInfo; - QString GUILib, fileString, dir; - - OSD_SharedLibrary myGUILibrary = OSD_SharedLibrary(); - - if(libs = getenv("LD_LIBRARY_PATH")) { - QStringList dirList = QStringList::split(":", libs, false); // skip empty entries - for(int i = dirList.count()-1; i >= 0; i--) { - dir = dirList[i]; - fileString = QAD_Tools::addSlash(dir) + GUILibrary; - fileInfo.setFile(fileString); - if(fileInfo.exists()) { - GUILib = fileInfo.fileName(); - break; - } - } - } - - myGUILibrary.SetName(TCollection_AsciiString((char*)GUILib.latin1()).ToCString()); - bool ok = myGUILibrary.DlOpen(OSD_RTLD_LAZY); - if(!ok) { - return false; - } - - OSD_Function osdF = myGUILibrary.DlSymb("OnGUIEvent"); - OneDim (*f1) = NULL; - if(osdF != NULL) { - f1 = (bool (*) (int, QAD_Desktop*)) osdF; - (*f1)(theCommandID, parent); - } - else - return false; - - return true; -} - - -//======================================================================= -// function : OnGUIEvent() [static] -// purpose : manage all events on GUI -//======================================================================= -bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) +bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) { GeometryGUI::GetOrCreateGeometryGUI(parent); @@ -195,10 +145,6 @@ bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) if (GeomGUI->GetState() == CURRENT_SKETCH && theCommandID != 404 && theCommandID != 4041 && theCommandID != 4042 && theCommandID != 4043 && theCommandID != 4044 && theCommandID != 4045 && theCommandID != 4046 && theCommandID != 4047 && theCommandID != 4048 && theCommandID != 4051 && theCommandID != 4052 && theCommandID != 4053 && theCommandID != 4061 && theCommandID != 4062 && theCommandID != 4063 && theCommandID != 4064 && theCommandID != 4065) return false; -// cout<<"GeometryGUI::OnGUIEvent : theCommandID = "<OnGUIEvent(theCommandID, parent); - return true; + if(!GeomGUI->LoadLibrary("libGEOMToolsGUI.so")) + return false; } - if(theCommandID == 211 || // MENU VIEW - WIREFRAME/SHADING - theCommandID == 212 || // MENU VIEW - DISPLAY ALL - theCommandID == 213 || // MENU VIEW - DISPLAY ONLY - theCommandID == 214 || // MENU VIEW - ERASE ALL - theCommandID == 215 || // MENU VIEW - ERASE ONLY - theCommandID == 8031) { // POPUP VIEWER - WIREFRAME/SHADING - - GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); - myDisplayGUI->OnGUIEvent(theCommandID, parent); - return true; + else if(theCommandID == 211 || // MENU VIEW - WIREFRAME/SHADING + theCommandID == 212 || // MENU VIEW - DISPLAY ALL + theCommandID == 213 || // MENU VIEW - DISPLAY ONLY + theCommandID == 214 || // MENU VIEW - ERASE ALL + theCommandID == 215 || // MENU VIEW - ERASE ONLY + theCommandID == 8031) { // POPUP VIEWER - WIREFRAME/SHADING + if(!GeomGUI->LoadLibrary("libDisplayGUI.so")) + return false; } - if(theCommandID == 404 || // SKETCHER - theCommandID == 4041 || // SKETCHER - POPUP VIEWER - SEGMENT - theCommandID == 4042 || // SKETCHER - POPUP VIEWER - ARC - theCommandID == 4043 || // SKETCHER - POPUP VIEWER - SET ANGLE - theCommandID == 4044 || // SKETCHER - POPUP VIEWER - SET X - theCommandID == 4045 || // SKETCHER - POPUP VIEWER - SET Y - theCommandID == 4046 || // SKETCHER - POPUP VIEWER - DELETE - theCommandID == 4047 || // SKETCHER - POPUP VIEWER - END - theCommandID == 4048 || // SKETCHER - POPUP VIEWER - CLOSE - theCommandID == 4051 || // SKETCHER - MENU - SET PLANE - theCommandID == 4052 || // SKETCHER - MENU - TANGENT - theCommandID == 4053 || // SKETCHER - MENU - PERPENDICULAR - theCommandID == 4061 || // SKETCHER - MENU - LENGTH - theCommandID == 4062 || // SKETCHER - MENU - ANGLE - theCommandID == 4063 || // SKETCHER - MENU - RADIUS - theCommandID == 4064 || // SKETCHER - MENU - X - theCommandID == 4065) { // SKETCHER - MENU - Y - GEOMBase_Sketcher* mySketcherGUI = new GEOMBase_Sketcher(); - mySketcherGUI->OnGUIEvent(theCommandID, parent); + else if(theCommandID == 404 || // SKETCHER + theCommandID == 4041 || // SKETCHER - POPUP VIEWER - SEGMENT + theCommandID == 4042 || // SKETCHER - POPUP VIEWER - ARC + theCommandID == 4043 || // SKETCHER - POPUP VIEWER - SET ANGLE + theCommandID == 4044 || // SKETCHER - POPUP VIEWER - SET X + theCommandID == 4045 || // SKETCHER - POPUP VIEWER - SET Y + theCommandID == 4046 || // SKETCHER - POPUP VIEWER - DELETE + theCommandID == 4047 || // SKETCHER - POPUP VIEWER - END + theCommandID == 4048 || // SKETCHER - POPUP VIEWER - CLOSE + theCommandID == 4051 || // SKETCHER - MENU - SET PLANE + theCommandID == 4052 || // SKETCHER - MENU - TANGENT + theCommandID == 4053 || // SKETCHER - MENU - PERPENDICULAR + theCommandID == 4061 || // SKETCHER - MENU - LENGTH + theCommandID == 4062 || // SKETCHER - MENU - ANGLE + theCommandID == 4063 || // SKETCHER - MENU - RADIUS + theCommandID == 4064 || // SKETCHER - MENU - X + theCommandID == 4065) { // SKETCHER - MENU - Y + // GEOMBase_Sketcher* mySketcherGUI = new GEOMBase_Sketcher(); + // mySketcherGUI->OnGUIEvent(theCommandID, parent); return true; } - if(theCommandID == 4011 || // MENU BASIC - POINT - theCommandID == 4012 || // MENU BASIC - LINE - theCommandID == 4013 || // MENU BASIC - CIRCLE - theCommandID == 4014 || // MENU BASIC - ELLIPSE - theCommandID == 4015 || // MENU BASIC - ARC - theCommandID == 4016 || // MENU BASIC - VECTOR - theCommandID == 4017 || // MENU BASIC - PLANE - theCommandID == 4018) { // MENU BASIC - WPLANE - bool testlib = GeometryGUI::LoadLibrary(theCommandID, parent, "libBasicGUI.so"); - return testlib; + else if(theCommandID == 4011 || // MENU BASIC - POINT + theCommandID == 4012 || // MENU BASIC - LINE + theCommandID == 4013 || // MENU BASIC - CIRCLE + theCommandID == 4014 || // MENU BASIC - ELLIPSE + theCommandID == 4015 || // MENU BASIC - ARC + theCommandID == 4016 || // MENU BASIC - VECTOR + theCommandID == 4017 || // MENU BASIC - PLANE + theCommandID == 4018) { // MENU BASIC - WPLANE + if(!GeomGUI->LoadLibrary("libBasicGUI.so")) + return false; } - if(theCommandID == 4021 || // MENU PRIMITIVE - BOX - theCommandID == 4022 || // MENU PRIMITIVE - CYLINDER - theCommandID == 4023 || // MENU PRIMITIVE - SPHERE - theCommandID == 4024 || // MENU PRIMITIVE - TORUS - theCommandID == 4025) { // MENU PRIMITIVE - CONE - bool testlib = GeometryGUI::LoadLibrary(theCommandID, parent, "libPrimitiveGUI.so"); - return testlib; + else if(theCommandID == 4021 || // MENU PRIMITIVE - BOX + theCommandID == 4022 || // MENU PRIMITIVE - CYLINDER + theCommandID == 4023 || // MENU PRIMITIVE - SPHERE + theCommandID == 4024 || // MENU PRIMITIVE - TORUS + theCommandID == 4025) { // MENU PRIMITIVE - CONE + if(!GeomGUI->LoadLibrary("libPrimitiveGUI.so")) + return false; } - if(theCommandID == 4031 || // MENU GENERATION - PRISM - theCommandID == 4032 || // MENU GENERATION - REVOLUTION - theCommandID == 4033 || // MENU GENERATION - FILLING - theCommandID == 4034) { // MENU GENERATION - PIPE - bool testlib = GeometryGUI::LoadLibrary(theCommandID, parent, "libGenerationGUI.so"); - return testlib; + else if(theCommandID == 4031 || // MENU GENERATION - PRISM + theCommandID == 4032 || // MENU GENERATION - REVOLUTION + theCommandID == 4033 || // MENU GENERATION - FILLING + theCommandID == 4034) { // MENU GENERATION - PIPE + if(!GeomGUI->LoadLibrary("libGenerationGUI.so")) + return false; } - if(theCommandID == 407 || // MENU BUILD - EXPLODE - theCommandID == 4081 || // MENU BUILD - EDGE - theCommandID == 4082 || // MENU BUILD - WIRE - theCommandID == 4083 || // MENU BUILD - FACE - theCommandID == 4084 || // MENU BUILD - SHELL - theCommandID == 4085 || // MENU BUILD - SOLID - theCommandID == 4086) { // MENU BUILD - COMPUND - bool testlib = GeometryGUI::LoadLibrary(theCommandID, parent, "libBuildGUI.so"); - return testlib; + else if(theCommandID == 407 || // MENU BUILD - EXPLODE + theCommandID == 4081 || // MENU BUILD - EDGE + theCommandID == 4082 || // MENU BUILD - WIRE + theCommandID == 4083 || // MENU BUILD - FACE + theCommandID == 4084 || // MENU BUILD - SHELL + theCommandID == 4085 || // MENU BUILD - SOLID + theCommandID == 4086) { // MENU BUILD - COMPUND + if(!GeomGUI->LoadLibrary("libBuildGUI.so")) + return false; } - if(theCommandID == 5011 || // MENU BOOLEAN - FUSE - theCommandID == 5012 || // MENU BOOLEAN - COMMON - theCommandID == 5013 || // MENU BOOLEAN - CUT - theCommandID == 5014) { // MENU BOOLEAN - SECTION - bool testlib = GeometryGUI::LoadLibrary(theCommandID, parent, "libBooleanGUI.so"); - return testlib; + else if(theCommandID == 5011 || // MENU BOOLEAN - FUSE + theCommandID == 5012 || // MENU BOOLEAN - COMMON + theCommandID == 5013 || // MENU BOOLEAN - CUT + theCommandID == 5014) { // MENU BOOLEAN - SECTION + if(!GeomGUI->LoadLibrary("libBooleanGUI.so")) + return false; } - if(theCommandID == 5021 || // MENU TRANSFORMATION - TRANSLATION - theCommandID == 5022 || // MENU TRANSFORMATION - ROTATION - theCommandID == 5023 || // MENU TRANSFORMATION - MIRROR - theCommandID == 5024 || // MENU TRANSFORMATION - SCALE - theCommandID == 5025 || // MENU TRANSFORMATION - MULTI-TRANSLATION - theCommandID == 5026) { // MENU TRANSFORMATION - MULTI-ROTATION - bool testlib = GeometryGUI::LoadLibrary(theCommandID, parent, "libTransformationGUI.so"); - return testlib; + else if(theCommandID == 5021 || // MENU TRANSFORMATION - TRANSLATION + theCommandID == 5022 || // MENU TRANSFORMATION - ROTATION + theCommandID == 5023 || // MENU TRANSFORMATION - MIRROR + theCommandID == 5024 || // MENU TRANSFORMATION - SCALE + theCommandID == 5025 || // MENU TRANSFORMATION - MULTI-TRANSLATION + theCommandID == 5026) { // MENU TRANSFORMATION - MULTI-ROTATION + if(!GeomGUI->LoadLibrary("libTransformationGUI.so")) + return false; } - if(theCommandID == 503 || // MENU OPERATION - PARTITION - theCommandID == 504 || // MENU OPERATION - ARCHIMEDE - theCommandID == 505 || // MENU OPERATION - FILLET - theCommandID == 506) { // MENU OPERATION - CHAMFER - bool testlib = GeometryGUI::LoadLibrary(theCommandID, parent, "libOperationGUI.so"); - return testlib; + else if(theCommandID == 503 || // MENU OPERATION - PARTITION + theCommandID == 504 || // MENU OPERATION - ARCHIMEDE + theCommandID == 505 || // MENU OPERATION - FILLET + theCommandID == 506) { // MENU OPERATION - CHAMFER + if(!GeomGUI->LoadLibrary("libOperationGUI.so")) + return false; } - if(theCommandID == 601 || // MENU REPAIR - SEWING - theCommandID == 602 || // MENU REPAIR - ORIENTATION - theCommandID == 603 || // MENU REPAIR - SUPPRESS FACES - theCommandID == 604) { // MENU REPAIR - SUPPRESS HOLE - bool testlib = GeometryGUI::LoadLibrary(theCommandID, parent, "libRepairGUI.so"); - return testlib; + else if(theCommandID == 601 || // MENU REPAIR - SEWING + theCommandID == 602 || // MENU REPAIR - ORIENTATION + theCommandID == 603 || // MENU REPAIR - SUPPRESS FACES + theCommandID == 604) { // MENU REPAIR - SUPPRESS HOLE + if(!GeomGUI->LoadLibrary("libRepairGUI.so")) + return false; } - if(theCommandID == 701 || // MENU MEASURE - PROPERTIES - theCommandID == 702 || // MENU MEASURE - CDG - theCommandID == 703 || // MENU MEASURE - INERTIA - theCommandID == 7041 || // MENU MEASURE - BOUNDING BOX - theCommandID == 7042 || // MENU MEASURE - MIN DISTANCE - theCommandID == 705 || // MENU MEASURE - TOLERANCE - theCommandID == 706 || // MENU MEASURE - WHATIS - theCommandID == 707) { // MENU MEASURE - CHECK - bool testlib = GeometryGUI::LoadLibrary(theCommandID, parent, "libMeasureGUI.so"); - return testlib; + else if(theCommandID == 701 || // MENU MEASURE - PROPERTIES + theCommandID == 702 || // MENU MEASURE - CDG + theCommandID == 703 || // MENU MEASURE - INERTIA + theCommandID == 7041 || // MENU MEASURE - BOUNDING BOX + theCommandID == 7042 || // MENU MEASURE - MIN DISTANCE + theCommandID == 705 || // MENU MEASURE - TOLERANCE + theCommandID == 706 || // MENU MEASURE - WHATIS + theCommandID == 707) { // MENU MEASURE - CHECK + if(!GeomGUI->LoadLibrary("libMeasureGUI.so")) + return false; } + else + return false; + + //Load Function OnGUIEvent + OSD_Function osdF = GeomGUI->myGUILibrary.DlSymb("OnGUIEvent"); + OGE (*f1) = NULL; + if(osdF != NULL) { + f1 = (bool (*) (int, QAD_Desktop*)) osdF; + (*f1)(theCommandID, parent); + } + else + return false; + return true; } -//===================================================================================== +//================================================================================= // function : OnKeyPress() // purpose : [static] -//===================================================================================== +//================================================================================= bool GeometryGUI::OnKeyPress(QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) { GeometryGUI::GetOrCreateGeometryGUI(parent); @@ -350,10 +306,10 @@ bool GeometryGUI::OnKeyPress(QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* } -//================================================================================== +//================================================================================= // function : 0nMousePress() // purpose : [static] manage mouse events -//================================================================================== +//================================================================================= bool GeometryGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) { GeometryGUI::GetOrCreateGeometryGUI(parent); @@ -361,13 +317,6 @@ bool GeometryGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFr if(GeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) return false; - OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)GeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); - OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)studyFrame->getRightFrame()->getViewFrame())->getViewPort(); - - /* Get the clicked or selected point */ - gp_Pnt thePoint; - if(GeomGUI->GetState() == CURRENT_SKETCH) { GeomGUI->GetSketcher().ValidateEdge(); if(GeomGUI->GetSketcher().GetmyEdgesNumber() == 1) { @@ -378,37 +327,26 @@ bool GeometryGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFr } } else if(GeomGUI->GetState() == POINT_METHOD) { -// GeomGUI->EraseSimulationShape(); -// BasicGUI_PointDlg *DialogPt = (BasicGUI_PointDlg*)(GeomGUI->GetActiveDialogBox()); - -// if(DialogPt->UseLocalContext()) { -// ic->InitSelected(); -// if(pe->state() == Qt::ShiftButton) -// v3d->getAISSelector()->shiftSelect(); /* Append selection */ -// else -// v3d->getAISSelector()->select(); /* New selection */ - -// if(ic->MoreSelected()) -// thePoint = BRep_Tool::Pnt( TopoDS::Vertex(ic->SelectedShape())); -// else -// thePoint = GeomGUI->ConvertClickToPoint(pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView()); -// } -// else -// thePoint = GeomGUI->ConvertClickToPoint(pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView()); - -// if(DialogPt != 0) -// DialogPt->PointIntoCoordinates(thePoint, true); /* display point */ -// else -// GeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + if(!GeomGUI->LoadLibrary("libBasicGUI.so")) + return false; + + //Load Function OnMousePress + OSD_Function osdF = GeomGUI->myGUILibrary.DlSymb("OnMousePress"); + OMP (*f1) = NULL; + if(osdF != NULL) { + f1 = (bool (*) (QMouseEvent*, QAD_Desktop*, QAD_StudyFrame*)) osdF; + (*f1)(pe, parent, studyFrame); + } } + return false; } -//======================================================================= +//================================================================================= // function : OnMouseMove() // purpose : [static] manage mouse events -//======================================================================= +//================================================================================= bool GeometryGUI::OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) { GeometryGUI::GetOrCreateGeometryGUI(parent); @@ -427,16 +365,14 @@ bool GeometryGUI::OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFra } -//===================================================================================== +//================================================================================= // function : SetSettings() // purpose : [static] -//===================================================================================== +//================================================================================= bool GeometryGUI::SetSettings(QAD_Desktop* parent) { GeometryGUI::GetOrCreateGeometryGUI(parent); - parent->menuBar()->setItemEnabled( 405, false); // SKETCH CONTRAINTS - /* Shading Color */ QString SCr = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorRed"); QString SCg = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorGreen"); @@ -515,11 +451,13 @@ bool GeometryGUI::SetSettings(QAD_Desktop* parent) return true; } + SALOME_Selection* Sel = SALOME_Selection::Selection(GeomGUI->GetActiveStudy()->getSelection()); + theObject = ""; -//===================================================================================== +//================================================================================= // function : DefinePopup() // purpose : [static] -//===================================================================================== +//================================================================================= void GeometryGUI::DefinePopup(QString & theContext, QString & theParent, QString & theObject) { GeometryGUI::GetOrCreateGeometryGUI(QAD_Application::getDesktop()); @@ -557,11 +495,23 @@ void GeometryGUI::DefinePopup(QString & theContext, QString & theParent, QString return; } + if((theParent.compare("Viewer")==0)) { + if(GeomGUI->GetState() == CURRENT_SKETCH) + theContext = "Sketch"; + else { + if(Sel->IObjectCount() > 0) + theContext = ""; + else + theContext = "NothingSelected"; + } + } + else + theContext = ""; -//===================================================================================== +//================================================================================= // function : CustomPopup() // purpose : [static] -//===================================================================================== +//================================================================================= bool GeometryGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext, const QString& theParent, const QString& theObject) { @@ -612,17 +562,17 @@ bool GeometryGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QStr else popup->setItemEnabled(804, true); //Add in Study Menu - if(IObject->IsKind(STANDARD_TYPE(GEOM_InteractiveObject))) { - Standard_Boolean found; - Handle(GEOM_AISShape) Result = GeomGUI->ConvertIOinGEOMAISShape(IObject, found, true); - - if(found) { - if(Result->DisplayMode() == 1) - popup->changeItem(8031, tr("GEOM_MEN_WIREFRAME")); //Shading/Wireframe Menu - else - popup->changeItem(8031, tr("GEOM_MEN_SHADING")); //Shading/Wireframe Menu - } - } +// if(IObject->IsKind(STANDARD_TYPE(GEOM_InteractiveObject))) { +// Standard_Boolean found; +// Handle(GEOM_AISShape) Result = GeomGUI->ConvertIOinGEOMAISShape(IObject, found, true); + +// if(found) { +// if(Result->DisplayMode() == 1) +// popup->changeItem(8031, tr("GEOM_MEN_WIREFRAME")); //Shading/Wireframe Menu +// else +// popup->changeItem(8031, tr("GEOM_MEN_SHADING")); //Shading/Wireframe Menu +// } +// } if(!(v3d->isInViewer(IObject) && v3d->isVisible(IObject))) popup->removeItem(QAD_Erase_Popup_ID); @@ -747,26 +697,26 @@ bool GeometryGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QStr SALOMEDS::SObject_var SO = aStudy->FindObjectID(IObject->getEntry()); SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::AttributeIOR_var anIOR; - if(!SO->_is_nil()) { - if(SO->FindAttribute(anAttr, "AttributeIOR")) { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - Standard_Boolean found; - GEOM_Actor* Result = GeomGUI->ConvertIORinGEOMActor(anIOR->Value(), found, true); - if(found) { - if(Result->getDisplayMode() == 1) - popup->changeItem(8031, tr("GEOM_MEN_WIREFRAME")); //Shading/Wireframe Menu - else - popup->changeItem(8031, tr("GEOM_MEN_SHADING")); //Shading/Wireframe Menu +// if(!SO->_is_nil()) { +// if(SO->FindAttribute(anAttr, "AttributeIOR")) { +// anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); +// Standard_Boolean found; +// GEOM_Actor* Result = GeomGUI->ConvertIORinGEOMActor(anIOR->Value(), found, true); +// if(found) { +// if(Result->getDisplayMode() == 1) +// popup->changeItem(8031, tr("GEOM_MEN_WIREFRAME")); //Shading/Wireframe Menu +// else +// popup->changeItem(8031, tr("GEOM_MEN_SHADING")); //Shading/Wireframe Menu - if(!Result->GetVisibility()) - popup->removeItem(QAD_Erase_Popup_ID); - else - popup->removeItem(QAD_Display_Popup_ID); - } - else - popup->removeItem(QAD_Erase_Popup_ID); - } - } +// if(!Result->GetVisibility()) +// popup->removeItem(QAD_Erase_Popup_ID); +// else +// popup->removeItem(QAD_Display_Popup_ID); +// } +// else +// popup->removeItem(QAD_Erase_Popup_ID); +// } +// } } else popup->setItemEnabled(804, true); //Add in Study Menu @@ -794,7 +744,7 @@ bool GeometryGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QStr bool needDisplay = false; bool needErase = false; SALOMEDS::GenericAttribute_var aTmpAttr; - VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)GeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)GeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); for(;It.More();It.Next()) { anIObject = It.Value(); if(!anIObject->hasEntry()) @@ -886,10 +836,10 @@ bool GeometryGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QStr } -//======================================================================= +//================================================================================= // function : activeStudyChanged() // purpose : static -//======================================================================= +//================================================================================= void GeometryGUI::activeStudyChanged(QAD_Desktop* parent) { GeometryGUI::GetOrCreateGeometryGUI(parent); @@ -915,7 +865,7 @@ void GeometryGUI::activeStudyChanged(QAD_Desktop* parent) Mb->setItemEnabled(413, ViewOCC);// ShadingColor Settings Mb->setItemEnabled(414, ViewOCC);// Isos Settings - GeomGUI->EraseSimulationShape(); + //GeomGUI->EraseSimulationShape(); GeomGUI->EmitSignalCloseAllDialogs(); GeomGUI = 0; } @@ -931,286 +881,34 @@ void GeometryGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theI { GeometryGUI::GetOrCreateGeometryGUI(QAD_Application::getDesktop()); - Engines::Component_var comp = GeomGUI->GetDesktop()->getEngine("FactoryServer", "GEOM"); - GEOM::GEOM_Gen_var myComponentGeom = GEOM::GEOM_Gen::_narrow(comp); - - SALOMEDS::Study_var aStudy = GeomGUI->GetActiveStudy()->getStudyDocument(); - SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); - - OCCViewer_Viewer3d* v3d; - Handle(AIS_InteractiveContext) ic; - vtkRenderer* Renderer; - - if(GeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - v3d = ((OCCViewer_ViewFrame*)GeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - ic = v3d->getAISContext(); - } - else if(GeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { - Renderer = ((VTKViewer_ViewFrame*)GeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); - } - else + if(!GeomGUI->LoadLibrary("libDisplayGUI.so")) return; - if(theIO.IsNull()) - MESSAGE("BuildPresentation(): null SALOME_InteractiveObject passed") - - if(GeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { - // VTK - - SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(GeomGUI->GetActiveStudy()->getActiveStudyFrame()->entry()); - - SALOMEDS::SObject_var obj = aStudy->FindObjectID(theIO->getEntry()); - - VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)GeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); - - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeName_var aName; - SALOMEDS::AttributeIOR_var anIOR; - - if(myRenderInter->isInViewer(theIO)) { - myRenderInter->Display(theIO, false); - } - else { - // Create new actor - if(!obj->_is_nil()) { - if(obj->FindAttribute(anAttr, "AttributeIOR")) { - // this SObject may be GEOM module root SObject - - bool useSubItems = false; - SALOMEDS::ChildIterator_var anIter = GeomGUI->GetActiveStudy()->getStudyDocument()->NewChildIterator(obj); - if(myComponentGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(anAttr)->Value())->_is_nil()) { - while (anIter->More() && !useSubItems) { - SALOMEDS::SObject_var subobj = anIter->Value(); - SALOMEDS::GenericAttribute_var aTmpAttr; - if (subobj->FindAttribute(aTmpAttr, "AttributeIOR")) { - if (!myComponentGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(aTmpAttr)->Value())->_is_nil()) { - anAttr = aTmpAttr; - obj = subobj; - useSubItems = true; - } - else - anIter->Next(); - } - else - anIter->Next(); - } - } - - while(useSubItems?anIter->More():!anAttr->_is_nil()) { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString(anIOR->Value()); - TopoDS_Shape Shape = GeomGUI->GetShapeReader().GetShape(myComponentGeom,aShape); - - if(obj->FindAttribute(anAttr, "AttributeName")) { - aName = SALOMEDS::AttributeName::_narrow(anAttr); - - vtkRenderer* theRenderer = ((VTKViewer_ViewFrame*)GeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer(); - vtkActorCollection* theAllActors = theRenderer->GetActors(); - theAllActors->InitTraversal(); - vtkActor* actor = (vtkActor*)theAllActors->GetNextActor(); - Handle(SALOME_InteractiveObject) anIObj; - // don't create new study object if it already exists - bool isDisplayed = false; - while(!(actor==NULL)) { - SALOME_Actor* Gactor = SALOME_Actor::SafeDownCast(actor); - if(Gactor!=NULL) { - if(Gactor->hasIO()) { - if(strcmp(Gactor->getIO()->getEntry(),obj->GetID())==0) { - isDisplayed = true; - anIObj = Gactor->getIO(); - if(!anIObj.IsNull()) myRenderInter->Display(anIObj, false); - } - } - } - actor=(vtkActor*)(theAllActors->GetNextActor()); - } - if(!isDisplayed) { - // open transaction - QAD_Operation* op = new SALOMEGUI_ImportOperation( GeomGUI->GetActiveStudy() ); - op->start(); - - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); - aStudyBuilder->Addreference(newObj1, obj); - // commit transaction - op->finish(); - - vtkRenderWindow *renWin = theRenderer->GetRenderWindow(); - int themode = myRenderInter->GetDisplayMode(); - - vtkActorCollection* theActors = - GEOM_AssemblyBuilder::BuildActors(Shape,0,themode,Standard_True); - theActors->InitTraversal(); - vtkActor* anActor = (vtkActor*)theActors->GetNextActor(); - while(!(anActor==NULL)) { - GEOM_Actor* GActor = GEOM_Actor::SafeDownCast(anActor); - Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(), GeomGUI->GetFatherior(),"GEOM"); - IO->setEntry(obj->GetID()); - GActor->setIO(IO); - GActor->setName(theIO->getName()); - - theRenderer->AddActor(GActor); - // renWin->Render(); - anActor = (vtkActor*)theActors->GetNextActor(); - } - } - } - // next item iteration - if(useSubItems) { - anIter->Next(); - anAttr = SALOMEDS::GenericAttribute::_nil(); - while(anIter->More() && anAttr->_is_nil()) { - SALOMEDS::SObject_var subobject = anIter->Value(); - SALOMEDS::GenericAttribute_var aTmpAttribute; - if (subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) { - anAttr = aTmpAttribute; - obj = subobject; - } - else - anIter->Next(); - } - } - else - anAttr = SALOMEDS::GenericAttribute::_nil(); - } - } - } - } - // No viewer update should be done here! - //myRenderInter->Render(); - //GeomGUI->GetActiveStudy()->updateObjBrowser( true ); - } - else if(GeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { - SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(GeomGUI->GetActiveStudy()->getActiveStudyFrame()->entry()); - SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeName_var aName; - SALOMEDS::AttributeIOR_var anIOR; - - if(v3d->isInViewer(theIO, true)) { - Standard_Boolean found; - Handle(GEOM_AISShape) aSh = GeomGUI->ConvertIOinGEOMAISShape(theIO, found, true); - if(found) { - ic->Display(aSh, false); - ic->AddOrRemoveCurrentObject(aSh, false); - } - - } - else { - SALOMEDS::SObject_var obj = aStudy->FindObjectID(theIO->getEntry()); - if(!obj->_is_nil()) { - MESSAGE("BuildPresentation(): SObject not null") - if(obj->FindAttribute(anAttr, "AttributeIOR")) { - MESSAGE("BuildPresentation(): SObject has IOR") - // this SObject may be GEOM module root SObject - - bool useSubItems = false; - SALOMEDS::ChildIterator_var anIter = GeomGUI->GetActiveStudy()->getStudyDocument()->NewChildIterator(obj); - if(myComponentGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(anAttr)->Value())->_is_nil()) { - while(anIter->More() && !useSubItems) { - SALOMEDS::SObject_var subobj = anIter->Value(); - SALOMEDS::GenericAttribute_var aTmpAttr; - if(subobj->FindAttribute(aTmpAttr, "AttributeIOR")) { - if(!myComponentGeom->GetIORFromString(SALOMEDS::AttributeIOR::_narrow(aTmpAttr)->Value())->_is_nil()) { - anAttr = aTmpAttr; - obj = subobj; - useSubItems = true; - } - else - anIter->Next(); - } - else - anIter->Next(); - } - } - - while(useSubItems?anIter->More():!anAttr->_is_nil()) { - anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); - GEOM::GEOM_Shape_var aShape = myComponentGeom->GetIORFromString(anIOR->Value()); - TopoDS_Shape Shape = GeomGUI->GetShapeReader().GetShape(myComponentGeom,aShape); - if(Shape.IsNull()) - MESSAGE("BuildPresentation(): TopoDS_Shape is null!") - if(obj->FindAttribute(anAttr, "AttributeName")) { - MESSAGE("BuildPresentation(): SObject has Name") - aName = SALOMEDS::AttributeName::_narrow(anAttr); - // searchin for already displayed objects with the same shape - AIS_ListOfInteractive aDisplayed; - ic->DisplayedObjects(aDisplayed); - AIS_ListIteratorOfListOfInteractive anIObjects(aDisplayed); - Handle(AIS_Shape) anAISShape; - for(;anIObjects.More();anIObjects.Next()) { - anAISShape = Handle(AIS_Shape)::DownCast(anIObjects.Value()); - if(!anAISShape.IsNull()) { - if(anAISShape->Shape().IsSame(Shape)) - break; - anAISShape.Nullify(); - } - } - if(!anAISShape.IsNull()) { - if(!ic->IsDisplayed(anAISShape)) - ic->Display(anAISShape, false); - } - else { - if(!useSubItems) { - // open transaction - QAD_Operation* op = new SALOMEGUI_ImportOperation( GeomGUI->GetActiveStudy() ); - op->start(); - if (fatherSF->_is_nil()) - MESSAGE("BuildPresentation(): fatherSF is nil!") - SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF); - aStudyBuilder->Addreference(newObj1, obj); - // commit transaction - op->finish(); - } - Handle(GEOM_AISShape) aSh = new GEOM_AISShape(Shape, aName->Value()); - aSh->SetShadingColor(GeomGUI->GetShadingColor()); - Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(anIOR->Value(), GeomGUI->GetFatherior(), "GEOM"); - IO->setEntry(obj->GetID()); - aSh->setIO(IO); - aSh->setName(aName->Value()); - ic->Display(aSh, false); - if(!useSubItems) - ic->AddOrRemoveCurrentObject(aSh, false); - } - } - // next item iteration - if(useSubItems) { - anIter->Next(); - anAttr=SALOMEDS::GenericAttribute::_nil(); - while (anIter->More() && anAttr->_is_nil()) { - SALOMEDS::SObject_var subobject = anIter->Value(); - SALOMEDS::GenericAttribute_var aTmpAttribute; - if(subobject->FindAttribute(aTmpAttribute, "AttributeIOR")) { - anAttr = aTmpAttribute; - obj = subobject; - } - else - anIter->Next(); - } - } - else - anAttr = SALOMEDS::GenericAttribute::_nil(); - } - } - } - } - // No viewer update should be done here! - //GeomGUI->GetActiveStudy()->updateObjBrowser( true ); - //ic->UpdateCurrentViewer(); + //Load Function BuildPresentation + OSD_Function osdF = GeomGUI->myGUILibrary.DlSymb("BuildPresentation"); + BP (*f1) = NULL; + if(osdF != NULL) { + f1 = (void (*) (const Handle(SALOME_InteractiveObject)&)) osdF; + (*f1)(theIO); } + else + return; + return; } -//===================================================================================== +//================================================================================= // EXPORTED METHODS -//===================================================================================== +//================================================================================= extern "C" { bool OnGUIEvent(int theCommandID, QAD_Desktop* parent) {return GeometryGUI::OnGUIEvent(theCommandID, parent);} - bool OnKeyPress (QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) + bool OnKeyPress(QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) {return GeometryGUI::OnKeyPress(pe, parent, studyFrame);} - bool OnMousePress (QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) + bool OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) {return GeometryGUI::OnMousePress(pe, parent, studyFrame);} bool OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) diff --git a/src/GEOMGUI/GeometryGUI.h b/src/GEOMGUI/GeometryGUI.h index a61a342b4..dd133add0 100644 --- a/src/GEOMGUI/GeometryGUI.h +++ b/src/GEOMGUI/GeometryGUI.h @@ -29,7 +29,7 @@ #ifndef GEOMETRYGUI_H #define GEOMETRYGUI_H -#include "GEOMBase_Display.h" +#include "GEOMContext.h" //================================================================================= // class : GeometryGUI @@ -37,18 +37,16 @@ //================================================================================= class GeometryGUI : public QObject { - Q_OBJECT /* for QT compatibility */ + Q_OBJECT /* for QT compatibility */ public : GeometryGUI(); ~GeometryGUI(); - static GEOMBase_Context* GetOrCreateGeometryGUI(QAD_Desktop* desktop); - - static bool LoadLibrary(int theCommandID, QAD_Desktop* parent, QString GUILibrary); + static GEOMContext* GetOrCreateGeometryGUI(QAD_Desktop* desktop); /* Managed by IAPP */ - Standard_EXPORT static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + Standard_EXPORT static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); Standard_EXPORT static bool OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame); Standard_EXPORT static bool OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame); Standard_EXPORT static bool OnKeyPress(QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame); diff --git a/src/GEOMGUI/Makefile.in b/src/GEOMGUI/Makefile.in index c2bf788d8..a1330313c 100644 --- a/src/GEOMGUI/Makefile.in +++ b/src/GEOMGUI/Makefile.in @@ -61,6 +61,6 @@ LIB_SERVER_IDL = CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lGEOMBase $(OCC_KERNEL_LIBS) $(OCC_MODELER_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMSketcher -lGEOMContext -L${KERNEL_ROOT_DIR}/lib/salome @CONCLUDE@ diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.cxx b/src/GEOMToolsGUI/GEOMToolsGUI.cxx new file mode 100644 index 000000000..23e811f16 --- /dev/null +++ b/src/GEOMToolsGUI/GEOMToolsGUI.cxx @@ -0,0 +1,901 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GEOMBase_Tools.cxx +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +using namespace std; +#include "GEOMToolsGUI.h" + +#include "QAD_Config.h" +#include "QAD_FileDlg.h" +#include "QAD_Tools.h" +#include "QAD_MessageBox.h" +#include "QAD_RightFrame.h" + +#include "OCCViewer_Viewer3d.h" +#include "VTKViewer_ViewFrame.h" + +#include "SALOME_ListIteratorOfListIO.hxx" +#include "SALOMEGUI_NameDlg.h" +#include "SALOMEGUI_ImportOperation.h" +#include "SALOMEGUI_QtCatchCorbaException.hxx" + +#include +#include +#include + +#include +#include + +#include "GEOMToolsGUI_NbIsosDlg.h" // Method ISOS adjustement +#include "GEOMToolsGUI_TransparencyDlg.h" // Method TRANSPARENCY adjustement + +//======================================================================= +// function : GEOMToolsGUI() +// purpose : Constructor +//======================================================================= +GEOMToolsGUI::GEOMToolsGUI() : + QObject() +{ + myGeomBase = new GEOMBase(); + myGeomGUI = GEOMContext::GetGeomGUI(); + myGeom = myGeomGUI->myComponentGeom; +} + + +//======================================================================= +// function : ~GEOMToolsGUI() +// purpose : Destructor +//======================================================================= +GEOMToolsGUI::~GEOMToolsGUI() +{ +} + + +//======================================================================= +// function : OnGUIEvent() +// purpose : +//======================================================================= +bool GEOMToolsGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) +{ + GEOMToolsGUI* myGEOMToolsGUI = new GEOMToolsGUI(); + myGEOMToolsGUI->myGeomGUI->EmitSignalDeactivateDialog(); + SALOME_Selection* Sel = SALOME_Selection::Selection(myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->getSelection()); + + SALOMEDS::Study_var aStudy = myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->getStudyDocument(); + switch (theCommandID) + { + case 31: // COPY + { + myGEOMToolsGUI->OnEditCopy(); + break; + } + case 33: // DELETE + { + myGEOMToolsGUI->OnEditDelete(); + break; + } + case 111: // IMPORT BREP + { + myGEOMToolsGUI->myGeomGUI->SetState(111); + myGEOMToolsGUI->Import(); + myGEOMToolsGUI->myGeomGUI->ResetState(); + break; + } + case 112: // IMPORT IGES + { + myGEOMToolsGUI->myGeomGUI->SetState(112); + myGEOMToolsGUI->Import(); + myGEOMToolsGUI->myGeomGUI->ResetState(); + break; + } + case 113: // IMPORT STEP + { + myGEOMToolsGUI->myGeomGUI->SetState(113); + myGEOMToolsGUI->Import(); + myGEOMToolsGUI->myGeomGUI->ResetState(); + break; + } + case 121: // EXPORT BREP + { + myGEOMToolsGUI->myGeomGUI->SetState(121); + myGEOMToolsGUI->Export(); + myGEOMToolsGUI->myGeomGUI->ResetState(); + break; + } + case 122: // EXPORT IGES + { + myGEOMToolsGUI->myGeomGUI->SetState(122); + myGEOMToolsGUI->Export(); + myGEOMToolsGUI->myGeomGUI->ResetState(); + break; + } + case 123: // EXPORT STEP + { + myGEOMToolsGUI->myGeomGUI->SetState(123); + myGEOMToolsGUI->Export(); + myGEOMToolsGUI->myGeomGUI->ResetState(); + break; + } + case 411: // SETTINGS - COPY + { + QMenuBar* Mb = myGEOMToolsGUI->myGeomGUI->GetDesktop()->getMainMenuBar(); + QMenuData* pp; + QMenuItem* item = parent->menuBar()->findItem(411, &pp); + bool check = !pp->isItemChecked(411); + pp->setItemChecked(411, check); + myGEOMToolsGUI->myGeomGUI->GetSettings_Copy() = check; + QAD_CONFIG->addSetting("Geometry:SettingsCopy", myGEOMToolsGUI->myGeomGUI->GetSettings_Copy()); + break; + } + case 412: // SETTINGS - ADD IN STUDY + { + QMenuBar* Mb = myGEOMToolsGUI->myGeomGUI->GetDesktop()->getMainMenuBar(); + QMenuData* pp; + QMenuItem* item = parent->menuBar()->findItem(412, &pp); + bool check = !pp->isItemChecked(412); + pp->setItemChecked(412,check); + myGEOMToolsGUI->myGeomGUI->GetSettings_AddInStudy() = check; + QAD_CONFIG->addSetting("Geometry:SettingsAddInStudy", myGEOMToolsGUI->myGeomGUI->GetSettings_AddInStudy()); + break; + } + case 413: // SETTINGS - SHADING COLOR + { + if(myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + break; + + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + + QString SCr = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorRed"); + QString SCg = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorGreen"); + QString SCb = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorBlue"); + QColor color; + if(!SCr.isEmpty() && !SCg.isEmpty() && !SCb.isEmpty()) { + color = QColor (SCr.toInt(), SCg.toInt(), SCb.toInt()); + } + else { + Quantity_Color Default = Quantity_Color(); + color = QColor ((int)Default.Red() * 255.0, (int)Default.Green()* 255.0, (int)Default.Blue() * 255.0); + } + + QColor c = QColorDialog::getColor(color, myGEOMToolsGUI->myGeomGUI->GetDesktop()); + if(c.isValid()) { + myGEOMToolsGUI->myGeomGUI->GetShadingColor() = Quantity_Color(c.red() / 255.0, c.green() / 255.0, c.blue() / 255.0, Quantity_TOC_RGB); + + AIS_ListOfInteractive List; + ic->DisplayedObjects(List); + AIS_ListOfInteractive List1; + ic->ObjectsInCollector(List1); + List.Append(List1); + + AIS_ListIteratorOfListOfInteractive ite(List); + while(ite.More()) { + if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { + Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value()); + aSh->SetShadingColor(myGEOMToolsGUI->myGeomGUI->GetShadingColor()); + ic->Redisplay(aSh, Standard_True, Standard_True); + } + ite.Next(); + } + + ic->UpdateCurrentViewer(); + + QAD_CONFIG->addSetting("Geometry:SettingsShadingColorRed", c.red()); + QAD_CONFIG->addSetting("Geometry:SettingsShadingColorGreen", c.green()); + QAD_CONFIG->addSetting("Geometry:SettingsShadingColorBlue", c.blue()); + } + break; + } + case 414: // SETTINGS - ISOS + { + if(myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + break; + + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + + QString IsoU = QAD_CONFIG->getSetting("Geometry:SettingsIsoU"); + QString IsoV = QAD_CONFIG->getSetting("Geometry:SettingsIsoV"); + if(!IsoU.isEmpty()) + ic->DefaultDrawer()->UIsoAspect()->SetNumber(IsoU.toInt()); + else + IsoU = "1"; + if (!IsoV.isEmpty()) + ic->DefaultDrawer()->VIsoAspect()->SetNumber(IsoV.toInt()); + else + IsoV = "1"; + + GEOMBase_NbIsosDlg* NbIsosDlg = new GEOMBase_NbIsosDlg(myGEOMToolsGUI->myGeomGUI->GetDesktop(), tr("GEOM_MEN_ISOS"), TRUE); + int UIso = IsoU.toInt(); + int VIso = IsoV.toInt(); + + NbIsosDlg->SpinBoxU->setValue(UIso); + NbIsosDlg->SpinBoxV->setValue(VIso); + + if(NbIsosDlg->exec()) { + UIso = NbIsosDlg->SpinBoxU->text().toInt(); + VIso = NbIsosDlg->SpinBoxV->text().toInt(); + + ic->DefaultDrawer()->UIsoAspect()->SetNumber(UIso); + ic->DefaultDrawer()->VIsoAspect()->SetNumber(VIso); + QAD_CONFIG->addSetting("Geometry:SettingsIsoU", NbIsosDlg->SpinBoxU->text()); /* text format */ + QAD_CONFIG->addSetting("Geometry:SettingsIsoV", NbIsosDlg->SpinBoxV->text()); /* text format */ + } + + AIS_ListOfInteractive List; + ic->DisplayedObjects(List); + AIS_ListOfInteractive List1; + ic->ObjectsInCollector(List1); + List.Append(List1); + + AIS_ListIteratorOfListOfInteractive ite(List); + ic->InitCurrent(); + if(ic->NbCurrents()) + while(ite.More()) { + if(ite.Value()->IsInstance(STANDARD_TYPE(GEOM_AISShape))) { + Handle(GEOM_AISShape) aSh = Handle(GEOM_AISShape)::DownCast(ite.Value()); + Handle (AIS_Drawer) CurDrawer; + CurDrawer = aSh->Attributes(); + CurDrawer->UIsoAspect()->SetNumber(UIso); + CurDrawer->VIsoAspect()->SetNumber(VIso); + ic->SetLocalAttributes(aSh, CurDrawer); + ic->Redisplay(aSh); + } + ite.Next(); + } + ic->UpdateCurrentViewer(); + break; + } + case 415: // SETTINGS : STEP VALUE FOR SPIN BOXES + { + QString step = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); + if(step.isEmpty()) + step = "100.0"; + + Standard_Boolean res = false; + double dd = myGEOMToolsGUI->myGeomBase->Parameter(res, QString("%1").arg(step), tr("GEOM_MEN_STEP_LABEL"), tr("GEOM_STEP_TITLE"), 0.001, 10000.0, 3); + if(res) { + QAD_CONFIG->addSetting("Geometry:SettingsGeomStep", QString("%1").arg(dd)); + + /* Emit signal to GeometryGUI_SpinBoxes */ + myGEOMToolsGUI->myGeomGUI->EmitSignalDefaultStepValueChanged(dd); + } + else + parent->putInfo(tr("GEOM_PRP_ABORT")); + break; + } + case 804: // ADD IN STUDY - POPUP VIEWER + { + const SALOME_ListIO& ListSelected = Sel->StoredIObjects(); + SALOME_ListIteratorOfListIO It(ListSelected); + for(; It.More(); It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + myGEOMToolsGUI->myGeomBase->AddInStudy(true, IObject); + } + /* Is set on the dialog box */ + QApplication::restoreOverrideCursor(); + break; + } + case 901: // RENAME + { + SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); + for(; It.More(); It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + + SALOMEDS::SObject_var obj = aStudy->FindObjectID(IObject->getEntry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + if(!obj->_is_nil()) { + if(obj->FindAttribute(anAttr, "AttributeName")) { + aName = SALOMEDS::AttributeName::_narrow(anAttr); + + QString nm = QString(aName->Value()); + nm = SALOMEGUI_NameDlg::getName(myGEOMToolsGUI->myGeomGUI->GetDesktop(), nm); + if(!nm.isEmpty()) { + QApplication::setOverrideCursor(Qt::waitCursor); + myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->renameIObject(IObject, nm); + QApplication::restoreOverrideCursor(); + } + } + } + } + break; + } + case 5103: // CHECK GEOMETRY + { + QAD_PyEditor* PyEditor = myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getPyEditor(); + PyEditor->setText("from GEOM_usinggeom import *\n"); + PyEditor->setText(">>> "); + PyEditor->handleReturn(); + break; + } + case 8032: // COLOR - POPUP VIEWER + { + if(myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + // VTK + VTKViewer_RenderWindowInteractor* myRenderInter = ((VTKViewer_ViewFrame*)myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + + SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); + Handle(SALOME_InteractiveObject) FirstIOS = Sel->firstIObject(); + if(!FirstIOS.IsNull()) { + QColor initcolor = myRenderInter->GetColor(FirstIOS); + QColor c = QColorDialog::getColor( initcolor, myGEOMToolsGUI->myGeomGUI->GetDesktop()); + + if(c.isValid()) { + QApplication::setOverrideCursor(Qt::waitCursor); + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IOS = It.Value(); + myRenderInter->SetColor(IOS,c); + } + } + QApplication::restoreOverrideCursor(); + } + } + else if(myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + Handle(SALOME_InteractiveObject) IO = Sel->firstIObject(); + Standard_Boolean found; + Handle(GEOM_AISShape) Shape = myGEOMToolsGUI->myGeomBase->ConvertIOinGEOMAISShape(IO, found, true); + if(found) { + Quantity_Color CSFColor; + Shape->Color(CSFColor); + + QColor c = QColorDialog::getColor(QColor(CSFColor.Red() * 255.0, CSFColor.Green()* 255.0, CSFColor.Blue() * 255.0), myGEOMToolsGUI->myGeomGUI->GetDesktop()); + + if(c.isValid()) { + CSFColor = Quantity_Color (c.red()/255., c.green()/255., c.blue()/255., Quantity_TOC_RGB); + QApplication::setOverrideCursor( Qt::waitCursor ); + + SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + Standard_Boolean found; + Handle(GEOM_AISShape) Shape = myGEOMToolsGUI->myGeomBase->ConvertIOinGEOMAISShape(IObject, found, true); + if(found) { + Shape->SetColor(CSFColor); + Shape->SetShadingColor(CSFColor); + } + } + } + } + } + QApplication::restoreOverrideCursor(); + break; + } + case 8033: // TRANSPARENCY - POPUP VIEWER + { + OCCViewer_Viewer3d* v3d; + Handle(AIS_InteractiveContext) ic; + if(myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + } + GEOMBase_TransparencyDlg *aDlg = new GEOMBase_TransparencyDlg(parent, "", Sel, ic); + break; + } + case 8034: // ISOS - POPUP VIEWER + { + if(myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) + break; + + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGEOMToolsGUI->myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + + ic->InitCurrent(); + if(ic->MoreCurrent()) { + Handle(GEOM_AISShape) CurObject = Handle(GEOM_AISShape)::DownCast(ic->Current()); + QString IsoU = QAD_CONFIG->getSetting("Geometry:SettingsIsoU"); + QString IsoV = QAD_CONFIG->getSetting("Geometry:SettingsIsoV"); + + if(!IsoU.isEmpty()) + ic->DefaultDrawer()->UIsoAspect()->SetNumber(IsoU.toInt()); + else + IsoU = "1"; + if (!IsoV.isEmpty()) + ic->DefaultDrawer()->VIsoAspect()->SetNumber(IsoV.toInt()); + else + IsoV = "1"; + + GEOMBase_NbIsosDlg * NbIsosDlg = + new GEOMBase_NbIsosDlg(myGEOMToolsGUI->myGeomGUI->GetDesktop(), tr("GEOM_MEN_ISOS"), TRUE); + + NbIsosDlg->SpinBoxU->setValue(IsoU.toInt()); + NbIsosDlg->SpinBoxV->setValue(IsoV.toInt()); + + if(NbIsosDlg->exec()) { + QApplication::setOverrideCursor(Qt::waitCursor); + for(; ic->MoreCurrent(); ic->NextCurrent()) { + Handle(AIS_Drawer) CurDrawer; + + CurDrawer = ic->Current()->Attributes(); + CurDrawer->UIsoAspect()->SetNumber(NbIsosDlg->SpinBoxU->text().toInt()); + CurDrawer->VIsoAspect()->SetNumber(NbIsosDlg->SpinBoxV->text().toInt()); + + ic->SetLocalAttributes(CurObject, CurDrawer); + ic->Redisplay(CurObject); + } + } + } + QApplication::restoreOverrideCursor(); + break; + } + case 9024 : // OPEN - OBJBROSER POPUP + { + SALOME_ListIteratorOfListIO It(Sel->StoredIObjects()); + Handle(SALOME_InteractiveObject) anIObject; + for(;It.More();It.Next()) { + anIObject = It.Value(); + SALOMEDS::SObject_var obj = aStudy->FindObjectID(anIObject->getEntry()); + SALOMEDS::AttributePersistentRef_var aPersist; + SALOMEDS::AttributeIOR_var anIOR; + if(!obj->_is_nil()) { + // this SObject may be GEOM module root SObject + SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(obj); + SALOMEDS::GenericAttribute_var anAttr; + bool useSubItems = false; + while (anIter->More() && !useSubItems) { + SALOMEDS::SObject_var subobj = anIter->Value(); + if (subobj->FindAttribute(anAttr, "AttributePersistentRef")) { + useSubItems = true; + obj = subobj; + } + else + anIter->Next(); + } + obj->FindAttribute(anAttr, "AttributePersistentRef"); + + while(useSubItems?anIter->More():!anAttr->_is_nil()) { + if(!obj->FindAttribute(anAttr, "AttributeIOR") && + obj->FindAttribute(anAttr, "AttributePersistentRef")) { + // load + Engines::Component_var comp = myGEOMToolsGUI->myGeomGUI->GetDesktop()->getEngine("FactoryServer","GEOM"); + if (!CORBA::is_nil(comp)) { + SALOMEDS::Driver_var driver = SALOMEDS::Driver::_narrow(comp); + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + aStudyBuilder->LoadWith(aStudy->FindComponent("GEOM"),driver); + } + else { + MESSAGE("Component is null"); + } + } + if(useSubItems) { + anIter->Next(); + obj = anIter->Value(); + } + else + anAttr = SALOMEDS::GenericAttribute::_nil(); + } + } + } + break; + } + default: + { + parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID)); + break; + } + } + return true; +} + + +//=============================================================================== +// function : OnEditDelete() +// purpose : +//=============================================================================== +void GEOMToolsGUI::OnEditDelete() +{ + if ( QAD_MessageBox::warn2 + ( myGeomGUI->GetDesktop(), + tr ("GEOM_WRN_WARNING"), + tr ("GEOM_REALLY_DELETE"), + tr ("GEOM_BUT_YES"), tr ("GEOM_BUT_NO"), 1, 0, 0) != 1 ) + return; + + int nbSf = myGeomGUI->GetActiveStudy()->getStudyFramesCount(); + + Standard_Boolean found; + SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeIOR_var anIOR; + + SALOME_Selection* Sel = SALOME_Selection::Selection( myGeomGUI->GetActiveStudy()->getSelection() ); + SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); + for(;It.More();It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + if ( IObject->hasEntry() ) { + SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::SObject_var SO = aStudy->FindObjectID( IObject->getEntry() ); + + /* Erase child graphical objects */ + SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(SO); + for (; it->More();it->Next()) { + SALOMEDS::SObject_var CSO= it->Value(); + if (CSO->FindAttribute(anAttr, "AttributeIOR") ) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + /* Delete child(s) shape in Client : */ + const TCollection_AsciiString ASCior(anIOR->Value()) ; + myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( ASCior ) ; + + for ( int i = 0; i < nbSf; i++ ) { + QAD_StudyFrame* sf = myGeomGUI->GetActiveStudy()->getStudyFrame(i); + if ( sf->getTypeView() == VIEW_OCC ) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) myContext = v3d->getAISContext(); + Handle(GEOM_AISShape) Result = myGeomBase->ConvertIORinGEOMAISShape( anIOR->Value(), found ); + if ( found ) + myContext->Erase( Result, true, false ); + } else if ( sf->getTypeView() == VIEW_VTK ) { + //vtkRenderer* Renderer = ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRenderer(); + VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRWInteractor(); + GEOM_Actor* ac = myGeomBase->ConvertIORinGEOMActor( anIOR->Value(), found ); + if ( found ) { + //Renderer->RemoveActor(ac); + if ( ac->hasIO() ) + myRenderInter->Remove( ac->getIO() ); + } + } + } + } + } + + /* Erase main graphical object */ + for ( int i = 0; i < nbSf; i++ ) { + QAD_StudyFrame* sf = myGeomGUI->GetActiveStudy()->getStudyFrame(i); + if ( sf->getTypeView() == VIEW_OCC ) { + OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getViewer(); + Handle (AIS_InteractiveContext) myContext = v3d->getAISContext(); + Handle(GEOM_AISShape) Result = myGeomBase->ConvertIOinGEOMAISShape( IObject, found ); + if ( found ) + myContext->Erase( Result, true, false ); + } else if ( sf->getTypeView() == VIEW_VTK ) { + VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)sf->getRightFrame()->getViewFrame())->getRWInteractor(); + myRenderInter->Remove( IObject ); + } + } + + /* Delete main shape in Client : */ + if (SO->FindAttribute(anAttr, "AttributeIOR") ) { + anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); + const TCollection_AsciiString ASCIor(anIOR->Value()) ; + myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( ASCIor ) ; + } + + /* Erase objects in Study */ + SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() ); + if ( !obj->_is_nil() ) { + QAD_Operation* op = new SALOMEGUI_ImportOperation(myGeomGUI->GetActiveStudy()); + op->start(); + aStudyBuilder->RemoveObject(obj); + op->finish(); + } + + } /* IObject->hasEntry() */ + } /* more/next */ + + /* Clear any previous selection */ + Sel->ClearIObjects() ; + myGeomGUI->GetActiveStudy()->updateObjBrowser(); +} + + +//============================================================================== +// function : OnEditCopy() +// purpose : +//============================================================================== +void GEOMToolsGUI::OnEditCopy() +{ + SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection() ); + GEOM::GEOM_Gen::ListOfIOR_var listIOR = new GEOM::GEOM_Gen::ListOfIOR; + + const SALOME_ListIO& List = Sel->StoredIObjects(); + + myGeomBase->ConvertListOfIOInListOfIOR(List, listIOR); + + Sel->ClearIObjects(); + + for (unsigned int ind = 0; ind < listIOR->length();ind++) { + GEOM::GEOM_Shape_var aShapeInit = myGeom->GetIORFromString(listIOR[ind]); + try { + GEOM::GEOM_Shape_var result = myGeom->MakeCopy(aShapeInit) ; + result->NameType( aShapeInit->NameType() ); + myGeomBase->Display(result); + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + } + + myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_READY")); +} + + +//===================================================================================== +// function : Import +// purpose : BRep, Iges, Step +//===================================================================================== +bool GEOMToolsGUI::Import() +{ + SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + + GEOM::GEOM_Shape_var aShape; + QString file; + QStringList filtersList; + + switch(myGeomGUI->GetState()) + { + case 111 : // Import BREP + { + filtersList.append(tr("GEOM_MEN_IMPORT_BREP")); + filtersList.append(tr("GEOM_MEN_ALL_FILES")); + + file = QAD_FileDlg::getFileName(myGeomGUI->GetDesktop(), "", filtersList, tr("GEOM_MEN_IMPORT"), true); + if(!file.isEmpty()) { + QApplication::setOverrideCursor(Qt::waitCursor); + try { + aShape = myGeom->ImportBREP(file.latin1()); + } + catch(const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + } + break; + } + case 112 : // Import IGES + { + filtersList.append( tr("GEOM_MEN_IMPORT_IGES") ) ; + filtersList.append( tr("GEOM_MEN_ALL_FILES") ) ; + + file = QAD_FileDlg::getFileName(myGeomGUI->GetDesktop(), + "", + filtersList, + tr("GEOM_MEN_IMPORT"), + true); + if ( !file.isEmpty() ) { + QApplication::setOverrideCursor( Qt::waitCursor ); + try { + aShape = myGeom->ImportIGES( file.latin1() ); + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + } + break; + } + case 113 : // Import STEP + { + filtersList.append( tr("GEOM_MEN_IMPORT_STEP") ) ; + filtersList.append( tr("GEOM_MEN_ALL_FILES") ) ; + + file = QAD_FileDlg::getFileName(myGeomGUI->GetDesktop(), + "", + filtersList, + tr("GEOM_MEN_IMPORT"), + true); + if ( !file.isEmpty() ) { + QApplication::setOverrideCursor( Qt::waitCursor ); + try { + aShape = myGeom->ImportSTEP( file.latin1() ); + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + } + break; + } + } + + if ( !file.isEmpty() ) { + myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_LOADING").arg(QAD_Tools::getFileNameFromPath( file )) ); + + SALOMEDS::SComponent_var father = aStudy->FindComponent("GEOM"); + SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->entry()); + SALOMEDS::GenericAttribute_var anAttr; + SALOMEDS::AttributeName_var aName; + SALOMEDS::AttributePixMap_var aPixmap; + int aLocked = false; + if (father->_is_nil()) { + QAD_Operation* op = new SALOMEGUI_ImportOperation(myGeomGUI->GetActiveStudy() ); + op->start(); + aLocked = aStudy->GetProperties()->IsLocked(); + if (aLocked) aStudy->GetProperties()->SetLocked(false); + father = aStudyBuilder->NewComponent("GEOM"); + anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributeName"); + aName = SALOMEDS::AttributeName::_narrow(anAttr); + // aName->SetValue( tr("GEOM_MEN_COMPONENT") ); + aName->SetValue(myGeomGUI->GetDesktop()->getComponentUserName( "GEOM" ) ); + anAttr = aStudyBuilder->FindOrCreateAttribute(father, "AttributePixMap"); + aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr); + aPixmap->SetPixMap( "ICON_OBJBROWSER_Geometry" ); + if (aLocked) aStudy->GetProperties()->SetLocked(true); + op->finish(); + } +// if (aLocked) return false; + aStudyBuilder->DefineComponentInstance( father, myGeom ); + father->ComponentIOR(myGeomGUI->GetFatherior()); + + QString nameShape = QAD_Tools::getFileNameFromPath(file,false) + QString("_%1").arg(myGeomGUI->GetNbGeom()++); + + if(myGeomBase->Display(aShape, strdup(nameShape.latin1()))) { + myGeomGUI->GetActiveStudy()->setMessage( tr("GEOM_INF_LOADED").arg(QAD_Tools::getFileNameFromPath( file )) ); + myGeomGUI->GetDesktop()->putInfo( tr("GEOM_PRP_READY")); + } + } + QApplication::restoreOverrideCursor(); + return true; +} + + +//===================================================================================== +// function : Export +// purpose : BRep, Iges, Step +//===================================================================================== +bool GEOMToolsGUI::Export() +{ + SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); + + GEOM::GEOM_Shape_var aShape; + + static QString filters[] = { tr("GEOM_MEN_IMPORT_BREP"), + tr("GEOM_MEN_IMPORT_IGES"), + tr("GEOM_MEN_IMPORT_STEP") }; + + SALOME_Selection* Sel = SALOME_Selection::Selection(myGeomGUI->GetActiveStudy()->getSelection()); + SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() ); + + switch (myGeomGUI->GetState()) + { + case 121 : + { + for(;It.More();It.Next()) { + QApplication::restoreOverrideCursor(); + Handle(SALOME_InteractiveObject) IObject = It.Value(); + Standard_Boolean found; + GEOM::GEOM_Shape_var aShape = myGeomBase->ConvertIOinGEOMShape(IObject, found); + // Handle(GEOM_AISShape) Shape = myGeomGUI->ConvertIOinGEOMAISShape(IObject, found, true); + if ( found ) { + QString file = QAD_FileDlg::getFileName(myGeomGUI->GetDesktop(), + QString( IObject->getName() ) + ".brep", + tr("GEOM_MEN_IMPORT_BREP"), + tr("GEOM_MEN_EXPORT"), + false); + if ( !file.isEmpty() && !aShape->_is_nil() ) { + QApplication::setOverrideCursor( Qt::waitCursor ); + // Standard_Boolean result = BRepTools::Write(Shape->Shape(), strdup(file.latin1()) ); + try { + myGeom->ExportBREP(strdup( file.latin1()), aShape); + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } + } + } + } + break; + } + case 122 : + { + for(;It.More();It.Next()) { + QApplication::restoreOverrideCursor(); + Handle(SALOME_InteractiveObject) IObject = It.Value(); + Standard_Boolean found; + GEOM::GEOM_Shape_var aShape = myGeomBase->ConvertIOinGEOMShape(IObject, found); + // Handle(GEOM_AISShape) Shape = myGeomGUI->ConvertIOinGEOMAISShape(IObject, found, true); + if ( found ) { + QString file = QAD_FileDlg::getFileName(myGeomGUI->GetDesktop(), + QString( IObject->getName() ) + ".igs", + tr("GEOM_MEN_IMPORT_IGES"), + tr("GEOM_MEN_EXPORT"), + false); + if ( !file.isEmpty() && !aShape->_is_nil() ) { + QApplication::setOverrideCursor( Qt::waitCursor ); + try { + myGeom->ExportIGES(strdup( file.latin1()), aShape); + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } +// //VRV: OCC 4.0 migration +// IGESControl_Controller::Init(); +// IGESControl_Writer ICW (Interface_Static::CVal("XSTEP.iges.unit"), +// Interface_Static::IVal("XSTEP.iges.writebrep.mode")); +// //VRV: OCC 4.0 migration + +// ICW.AddShape (Shape->Shape()); +// ICW.ComputeModel(); +// Standard_Boolean result = ICW.Write( strdup(file.latin1()) ); + } + } + } + break; + } + + case 123 : + { +// bool test = false ; +// IFSelect_ReturnStatus status ; +// //VRV: OCC 4.0 migration +// STEPControl_Writer aWriter; +// //VRV: OCC 4.0 migration + QString file; + + for( ; It.More(); It.Next() ) { +// GEOM::GEOM_Shape_var aShape = myGeomBase->ConvertIOinGEOMShape(IObject, found); + QApplication::restoreOverrideCursor(); + Handle(SALOME_InteractiveObject) IObject = It.Value(); + Standard_Boolean found; + GEOM::GEOM_Shape_var aShape = myGeomBase->ConvertIOinGEOMShape(IObject, found); + // Handle(GEOM_AISShape) Shape = myGeomBase->ConvertIOinGEOMAISShape(IObject, found, true); + if ( found ) { + file = QAD_FileDlg::getFileName(myGeomGUI->GetDesktop(), + QString( IObject->getName() ) + ".stp", + tr("GEOM_MEN_IMPORT_STEP"), + tr("GEOM_MEN_EXPORT"), + false); + if ( !file.isEmpty() && !aShape->_is_nil() ) { + + QApplication::setOverrideCursor( Qt::waitCursor ) ; + try { + myGeom->ExportSTEP(strdup( file.latin1()), aShape); + } + catch (const SALOME::SALOME_Exception& S_ex) { + QtCatchCorbaException(S_ex); + } +// //VRV: OCC 4.0 migration +// status = aWriter.Transfer( Shape->Shape(), STEPControl_ManifoldSolidBrep ) ; +// //VRV: OCC 4.0 migration +// test = true ; +// if ( status != IFSelect_RetDone ) { +// QApplication::restoreOverrideCursor() ; +// return false ; +// } + } + } + } +// if(test) { +// status = aWriter.Write( strdup(file.latin1()) ) ; +// QApplication::restoreOverrideCursor() ; +// return status ; +// } + break; + } + + } + QApplication::restoreOverrideCursor() ; +} + + +//===================================================================================== +// EXPORTED METHODS +//===================================================================================== +extern "C" +{ + bool OnGUIEvent(int theCommandID, QAD_Desktop* parent) + {return GEOMToolsGUI::OnGUIEvent(theCommandID, parent);} +} diff --git a/src/GEOMToolsGUI/GEOMToolsGUI.h b/src/GEOMToolsGUI/GEOMToolsGUI.h new file mode 100644 index 000000000..54c3ef764 --- /dev/null +++ b/src/GEOMToolsGUI/GEOMToolsGUI.h @@ -0,0 +1,61 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GEOMBase_Tools.h +// Author : Damien COQUERET +// Module : GEOM +// $Header: + +#ifndef GEOMTOOLSGUI_H +#define GEOMTOOLSGUI_H + +#include "GEOMBase.h" + +//================================================================================= +// class : GEOMBase_Tools +// purpose : +//================================================================================= +class GEOMToolsGUI : public QObject +{ + Q_OBJECT /* for QT compatibility */ + +public : + GEOMToolsGUI(); + ~GEOMToolsGUI(); + + static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + + /* Import and export topology methods */ + bool Import(); + bool Export(); + + void OnEditCopy(); + void OnEditDelete(); + + GEOMBase* myGeomBase; + GEOMContext* myGeomGUI; + GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ + +}; + +#endif diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx new file mode 100644 index 000000000..5ef80f650 --- /dev/null +++ b/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.cxx @@ -0,0 +1,131 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GEOMBase_NbIsosDlg.cxx +// Author : +// Module : GEOM +// $Header: + +using namespace std; +#include "GEOMToolsGUI_NbIsosDlg.h" +#include "QAD_Tools.h" + +#include +#include +#include +#include +#include + +//================================================================================= +// class : GEOMBase_NbIsosDlg() +// purpose : Constructs a GEOMBase_NbIsosDlg which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// The dialog will by default be modeless, unless you set 'modal' to +// TRUE to construct a modal dialog. +//================================================================================= +GEOMBase_NbIsosDlg::GEOMBase_NbIsosDlg(QWidget* parent, const char* name, bool modal, WFlags fl) + :QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + if( !name ) + setName("GEOMBase_NbIsosDlg"); + setCaption(name); + setSizeGripEnabled(TRUE); + QGridLayout* MyDialogLayout = new QGridLayout(this); + MyDialogLayout->setSpacing(6); + MyDialogLayout->setMargin(11); + + /***************************************************************/ + QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" ); + GroupC1->setColumnLayout(0, Qt::Vertical ); + GroupC1->layout()->setSpacing( 0 ); + GroupC1->layout()->setMargin( 0 ); + QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() ); + GroupC1Layout->setAlignment( Qt::AlignTop ); + GroupC1Layout->setSpacing( 6 ); + GroupC1Layout->setMargin( 11 ); + + TextLabel1 = new QLabel( GroupC1, "TextLabel1" ); + TextLabel1->setText( tr( "GEOM_MEN_ISOU") ); + GroupC1Layout->addWidget( TextLabel1, 0, 0 ); + + SpinBoxU = new QSpinBox( GroupC1, "SpinBoxU" ); + SpinBoxU->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + SpinBoxU->setMinValue( 1 ); + SpinBoxU->setValue( 1 ); + GroupC1Layout->addWidget( SpinBoxU, 0, 1 ); + + TextLabel2 = new QLabel( GroupC1, "TextLabel2" ); + TextLabel2->setText( tr( "GEOM_MEN_ISOV") ) ; + GroupC1Layout->addWidget( TextLabel2, 0, 2 ); + + SpinBoxV = new QSpinBox( GroupC1, "SpinBoxV"); + SpinBoxV->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + SpinBoxV->setValue( 1 ); + SpinBoxV->setMinValue( 1 ); + GroupC1Layout->addWidget( SpinBoxV, 0, 3 ); + + /***************************************************************/ + QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + GroupButtonsLayout->setSpacing( 6 ); + GroupButtonsLayout->setMargin( 11 ); + + buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + buttonOk->setText( tr( "GEOM_BUT_OK" ) ) ; + buttonOk->setAutoDefault( TRUE ); + buttonOk->setDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); + + GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 ); + + buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); + buttonCancel->setText( tr( "GEOM_BUT_CANCEL" ) ) ; + buttonCancel->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonCancel, 0, 2 ); + /***************************************************************/ + + MyDialogLayout->addWidget(GroupC1, 0, 0); + MyDialogLayout->addWidget(GroupButtons, 1, 0); + + + // signals and slots connections + connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept())); + connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); + + /* Move widget on the botton right corner of main widget */ + QAD_Tools::centerWidget(this, parent); +} + + +//================================================================================= +// function : ~GEOMBase_NbIsosDlg() +// purpose : Destroys the object and frees any allocated resources +//================================================================================= +GEOMBase_NbIsosDlg::~GEOMBase_NbIsosDlg() +{ + // no need to delete child widgets, Qt does it all for us +} diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.h b/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.h new file mode 100644 index 000000000..48c70c563 --- /dev/null +++ b/src/GEOMToolsGUI/GEOMToolsGUI_NbIsosDlg.h @@ -0,0 +1,59 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GEOMBase_NbIsosDlg.h +// Author : +// Module : GEOM +// $Header: + +#ifndef GEOMBASE_NBISOSDLG_H +#define GEOMBASE_NBISOSDLG_H + +#include + +class QLabel; +class QSpinBox; +class QPushButton; + +//================================================================================= +// class : GEOMBase_NbIsosDlg +// purpose : +//================================================================================= +class GEOMBase_NbIsosDlg : public QDialog +{ + Q_OBJECT + +public: + GEOMBase_NbIsosDlg(QWidget* parent = 0, const char* name = 0, bool modal = FALSE, WFlags fl = 0); + ~GEOMBase_NbIsosDlg(); + + QPushButton* buttonOk; + QPushButton* buttonCancel; + QLabel* TextLabel1; + QLabel* TextLabel2; + QSpinBox* SpinBoxU; + QSpinBox* SpinBoxV; + +}; + +#endif // GEOMETRYGUI_NBISOSDLG_H diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx new file mode 100644 index 000000000..8c3f4d21f --- /dev/null +++ b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx @@ -0,0 +1,238 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GEOMBase_TransparencyDlg.cxx +// Author : Lucien PIGNOLONI +// Module : GEOM + +using namespace std; +#include "GEOMToolsGUI_TransparencyDlg.h" + +#include "QAD_RightFrame.h" +#include "SALOME_ListIteratorOfListIO.hxx" + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "VTKViewer_ViewFrame.h" +#include "VTKViewer_RenderWindowInteractor.h" + +//================================================================================= +// class : GEOMBase_TransparencyDlg() +// purpose : Constructs a GEOMBase_SUBSHAPE which is a child of 'parent', with the +// name 'name' and widget flags set to 'f'. +// +// : WARNING : this dialog is modal ! +// +//================================================================================= +GEOMBase_TransparencyDlg::GEOMBase_TransparencyDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, const Handle(AIS_InteractiveContext)& ic, bool modal, WFlags fl) + :QDialog(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu) +{ + if(!name) + setName("GEOMBase_TransparencyDlg"); + resize(152, 107); + setCaption(tr("GEOM_TRANSPARENCY_TITLE")); + setSizeGripEnabled(TRUE); + GEOMBase_TransparencyDlgLayout = new QGridLayout(this); + GEOMBase_TransparencyDlgLayout->setSpacing(6); + GEOMBase_TransparencyDlgLayout->setMargin(11); + + /*************************************************************************/ + QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" ); + GroupButtons->setColumnLayout(0, Qt::Vertical ); + GroupButtons->layout()->setSpacing( 0 ); + GroupButtons->layout()->setMargin( 0 ); + QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); + GroupButtonsLayout->setAlignment( Qt::AlignTop ); + GroupButtonsLayout->setSpacing( 6 ); + GroupButtonsLayout->setMargin( 11 ); + + buttonOk = new QPushButton( GroupButtons, "buttonOk" ); + buttonOk->setText( tr( "GEOM_BUT_OK" ) ); + buttonOk->setAutoDefault( TRUE ); + buttonOk->setDefault( TRUE ); + GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 0 ); + GroupButtonsLayout->addWidget( buttonOk, 0, 1 ); + GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 2 ); + + /*************************************************************************/ + QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" ); + GroupC1->setColumnLayout(0, Qt::Vertical ); + GroupC1->layout()->setSpacing( 0 ); + GroupC1->layout()->setMargin( 0 ); + QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() ); + GroupC1Layout->setAlignment( Qt::AlignTop ); + GroupC1Layout->setSpacing( 6 ); + GroupC1Layout->setMargin( 11 ); + + TextLabelOpaque = new QLabel( GroupC1, "TextLabelOpaque" ); + TextLabelOpaque->setText( tr( "GEOM_TRANSPARENCY_OPAQUE" ) ); + TextLabelOpaque->setAlignment( int( QLabel::AlignLeft ) ); + GroupC1Layout->addWidget( TextLabelOpaque, 0, 0 ); + GroupC1Layout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 ); + + TextLabelTransparent = new QLabel( GroupC1, "TextLabelTransparent" ); + TextLabelTransparent->setText( tr( "GEOM_TRANSPARENCY_TRANSPARENT" ) ); + TextLabelTransparent->setAlignment( int( QLabel::AlignRight ) ); + GroupC1Layout->addWidget( TextLabelTransparent, 0, 2 ); + + Slider1 = new QSlider( 0, 10, 1, 5, Horizontal, GroupC1, "Slider1" ); + Slider1->setMinimumSize( 300, 0 ); + Slider1->setTickmarks( QSlider::Left ); + GroupC1Layout->addMultiCellWidget( Slider1, 1, 1, 0, 2 ); + /*************************************************************************/ + + GEOMBase_TransparencyDlgLayout->addWidget(GroupC1, 0, 0); + GEOMBase_TransparencyDlgLayout->addWidget(GroupButtons, 1, 0); + + /* Initialisations */ + this->myGeomGUI = GEOMContext::GetGeomGUI(); + this->myGeomBase = new GEOMBase(); + this->myIc = ic; + this->mySel = Sel; + + /* First call valueChanged() method for initialisation */ + /* The default value of transparency will change with the selection */ + this->myFirstInit = true; +// Slider1->setMaxValue( 10 ); +// Slider1->setValue( 5 ) ; + this->ValueHasChanged(Slider1->value()); + + // signals and slots connections : after ValueHasChanged() + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(Slider1, SIGNAL(valueChanged(int)), this, SLOT(ValueHasChanged(int))); + + /* Move widget on the botton right corner of main widget */ + int x, y ; + myGeomBase->DefineDlgPosition(this, x, y); + this->move(x, y) ; + this->show() ; /* Displays this Dialog */ +} + + +//================================================================================= +// function : ~GEOMBase_TransparencyDlg() +// purpose : +//================================================================================= +GEOMBase_TransparencyDlg::~GEOMBase_TransparencyDlg() +{ + // no need to delete child widgets, Qt does it all for us +} + + +//======================================================================= +// function : ClickOnOk() +// purpose : +//======================================================================= +void GEOMBase_TransparencyDlg::ClickOnOk() +{ + accept(); + return; +} + + +//======================================================================= +// function : ClickOnClose() +// purpose : +//======================================================================= +void GEOMBase_TransparencyDlg::ClickOnClose() +{ + accept(); + return; +} + + +//================================================================================= +// function : ValueHasChanged() +// purpose : Called when value of slider change +// : or the first time as initilisation +//================================================================================= +void GEOMBase_TransparencyDlg::ValueHasChanged(int newValue) +{ + if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) { + // VTK + VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor(); + SALOME_ListIteratorOfListIO It(this->mySel->StoredIObjects()); + + Handle(SALOME_InteractiveObject) FirstIOS = mySel->firstIObject(); + if(!FirstIOS.IsNull()) { + /* The first time as initialisation */ + if(this->myFirstInit) { + this->myFirstInit = false; + float transp = (myRenderInter->GetTransparency(FirstIOS))*10.0; + this->Slider1->setValue(int(transp)); + } + } + + QApplication::setOverrideCursor(Qt::waitCursor); + for(;It.More(); It.Next()) { + Handle(SALOME_InteractiveObject) IOS = It.Value(); + myRenderInter->SetTransparency(IOS, newValue/10.0); + } + QApplication::restoreOverrideCursor(); + } + + else if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { + // OCC + SALOME_ListIteratorOfListIO It(this->mySel->StoredIObjects()); + Handle(SALOME_InteractiveObject) FirstIOS = mySel->firstIObject(); + if(!FirstIOS.IsNull()) { + + /* The first time as initialisation */ + if(this->myFirstInit) { + this->myFirstInit = false; + Standard_Boolean found; + Handle(GEOM_AISShape) Shape = myGeomBase->ConvertIOinGEOMAISShape(FirstIOS, found); + if(!found) + return; + float transp = (int(Shape->Transparency() * 10.0 + 0.001)); + this->Slider1->setValue(int(transp)); + return; + } + } + + QApplication::setOverrideCursor(Qt::waitCursor); + for(;It.More(); It.Next()) { + Handle(SALOME_InteractiveObject) IObject = It.Value(); + Standard_Boolean found; + Handle(GEOM_AISShape) Shape = myGeomBase->ConvertIOinGEOMAISShape(IObject, found); + if(!found) { + QApplication::restoreOverrideCursor(); + return; + } + this->myIc->SetTransparency(Shape, newValue / 10.0, false); + myIc->Redisplay(Shape, Standard_False, Standard_True); + } + myIc->UpdateCurrentViewer(); + } + QApplication::restoreOverrideCursor(); + return; +} diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.h b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.h new file mode 100644 index 000000000..72dd1838e --- /dev/null +++ b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.h @@ -0,0 +1,98 @@ +// GEOM GEOMGUI : GUI for Geometry component +// +// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// +// +// +// File : GEOMBase_TransparencyDlg.h +// Author : Lucien PIGNOLONI +// Module : GEOM +// $Header$ + +#ifndef DIALOGBOX_TRANSPARENCYDLG_H +#define DIALOGBOX_TRANSPARENCYDLG_H + +#include +#include + +#include "SALOME_Selection.h" +#include "SALOME_InteractiveObject.hxx" +#include "GEOM_InteractiveObject.hxx" +#include "GEOM_AISShape.hxx" + +#include "GEOMBase.h" + + +class QVBoxLayout; +class QHBoxLayout; +class QGridLayout; +class QFrame; +class QLabel; +class QPushButton; +class QSlider; + + + +//================================================================================= +// class : GEOMBase_TransparencyDlg +// purpose : +// : WARNING : that is a MODAL dialog. +//================================================================================= +class GEOMBase_TransparencyDlg : public QDialog +{ + Q_OBJECT + +public: + GEOMBase_TransparencyDlg( QWidget* parent = 0, + const char* name = 0, + SALOME_Selection* Sel = 0, + const Handle(AIS_InteractiveContext)& ic = 0, + bool modal = TRUE, + WFlags fl = 0 ); + + ~GEOMBase_TransparencyDlg(); + +private : + + GEOMContext* myGeomGUI ; /* Current GeomGUI object */ + GEOMBase* myGeomBase ; /* Current GeomGUI object */ + bool myFirstInit ; /* Inform for the first init */ + SALOME_Selection* mySel; /* User selection */ + Handle(AIS_InteractiveContext) myIc ; /* Interactive context */ + + QPushButton* buttonOk; + QLabel* TextLabelOpaque; + QLabel* TextLabelTransparent; + QSlider* Slider1; + +public slots: + + void ClickOnOk(); + void ClickOnClose(); + void ValueHasChanged( int newValue ) ; + +protected: + QGridLayout* GEOMBase_TransparencyDlgLayout; + QHBoxLayout* Layout1; + QHBoxLayout* Layout2; +}; + +#endif // DIALOGBOX_TRANSPARENCYDLG_H + diff --git a/src/GEOMToolsGUI/Makefile.in b/src/GEOMToolsGUI/Makefile.in new file mode 100644 index 000000000..8571b935d --- /dev/null +++ b/src/GEOMToolsGUI/Makefile.in @@ -0,0 +1,69 @@ +# GEOM GEOMTOOLSGUI : +# +# 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 = libGEOMToolsGUI.la + +# header files +EXPORT_HEADERS= + +LIB_SRC = GEOMToolsGUI.cxx \ + GEOMToolsGUI_NbIsosDlg.cxx \ + GEOMToolsGUI_TransparencyDlg.cxx + +LIB_MOC = \ + GEOMToolsGUI.h \ + GEOMToolsGUI_NbIsosDlg.h \ + GEOMToolsGUI_TransparencyDlg.h + +LIB_CLIENT_IDL = SALOME_Exception.idl \ + GEOM_Gen.idl \ + GEOM_Shape.idl \ + SALOMEDS.idl \ + SALOMEDS_Attributes.idl \ + SALOME_ModuleCatalog.idl \ + SALOME_Component.idl \ + +LIB_SERVER_IDL = + +# additionnal information to compil and link file + +CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome +CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome + +LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lGEOMContext -lGEOMBase -L${KERNEL_ROOT_DIR}/lib/salome + +@CONCLUDE@ diff --git a/src/GenerationGUI/GenerationGUI.cxx b/src/GenerationGUI/GenerationGUI.cxx index ed1ce4a18..ea904ab92 100644 --- a/src/GenerationGUI/GenerationGUI.cxx +++ b/src/GenerationGUI/GenerationGUI.cxx @@ -29,13 +29,13 @@ using namespace std; #include "GenerationGUI.h" +#include "SALOMEGUI_QtCatchCorbaException.hxx" + #include "GenerationGUI_PrismDlg.h" // Method PRISM #include "GenerationGUI_RevolDlg.h" // Method REVOL #include "GenerationGUI_FillingDlg.h" // Method FILLING #include "GenerationGUI_PipeDlg.h" // Method PIPE -static GenerationGUI* myGenerationGUI = 0; - //======================================================================= // function : GenerationGUI() // purpose : Constructor @@ -43,9 +43,9 @@ static GenerationGUI* myGenerationGUI = 0; GenerationGUI::GenerationGUI() : QObject() { - myGeomGUI = GEOMBase_Context::GetGeomGUI(); - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); + myGeomBase = new GEOMBase(); + myGeomGUI = GEOMContext::GetGeomGUI(); + myGeom = myGeomGUI->myComponentGeom; } @@ -58,25 +58,13 @@ GenerationGUI::~GenerationGUI() } -//======================================================================= -// function : GetOrCreateGUI() -// purpose : Gets or create an object 'GUI' with initialisations -// : Returns 'GUI' as a pointer -//======================================================================= -GenerationGUI* GenerationGUI::GetOrCreateGUI() -{ - myGenerationGUI = new GenerationGUI(); - return myGenerationGUI; -} - - //======================================================================= // function : OnGUIEvent() // purpose : //======================================================================= bool GenerationGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) { - GenerationGUI::GetOrCreateGUI(); + GenerationGUI* myGenerationGUI = new GenerationGUI(); myGenerationGUI->myGeomGUI->EmitSignalDeactivateDialog(); SALOME_Selection* Sel = SALOME_Selection::Selection(myGenerationGUI->myGeomGUI->GetActiveStudy()->getSelection()); @@ -134,10 +122,10 @@ void GenerationGUI::MakePrismAndDisplay(GEOM::GEOM_Shape_ptr BaseShape, const gp TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result); Standard_CString type; - myGeomGUI->GetShapeTypeString(S,type); + myGeomBase->GetShapeTypeString(S,type); result->NameType(type); - if(myGeomGUI->Display(result)) + if(myGeomBase->Display(result)) myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { @@ -163,10 +151,10 @@ void GenerationGUI::MakeRevolutionAndDisplay(GEOM::GEOM_Shape_ptr Shape, const g TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result); Standard_CString type; - myGeomGUI->GetShapeTypeString(S,type); + myGeomBase->GetShapeTypeString(S,type); result->NameType(type); - if(myGeomGUI->Display(result)) + if(myGeomBase->Display(result)) myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { @@ -194,10 +182,10 @@ void GenerationGUI::MakeFillingAndDisplay(GEOM::GEOM_Shape_ptr SectionShape, con TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result); Standard_CString type; - myGeomGUI->GetShapeTypeString(S,type); + myGeomBase->GetShapeTypeString(S,type); result->NameType(type); - if(myGeomGUI->Display(result)) + if(myGeomBase->Display(result)) myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); return; } @@ -216,10 +204,10 @@ void GenerationGUI::MakePipeAndDisplay(GEOM::GEOM_Shape_ptr aPath, GEOM::GEOM_Sh { try { GEOM::GEOM_Shape_ptr result = myGeom->MakePipe(aPath, aBase); - if (!result->_is_nil() && myGeomGUI->Display(result)) { + if (!result->_is_nil() && myGeomBase->Display(result)) { TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result); Standard_CString type; - myGeomGUI->GetShapeTypeString(S,type); + myGeomBase->GetShapeTypeString(S,type); result->NameType(type); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); diff --git a/src/GenerationGUI/GenerationGUI.h b/src/GenerationGUI/GenerationGUI.h index d5d4e9ab6..c565bda16 100644 --- a/src/GenerationGUI/GenerationGUI.h +++ b/src/GenerationGUI/GenerationGUI.h @@ -29,7 +29,7 @@ #ifndef GENERATIONGUI_H #define GENERATIONGUI_H -#include "GEOMBase_Display.h" +#include "GEOMBase.h" //================================================================================= // class : GenerationGUI @@ -43,7 +43,6 @@ public : GenerationGUI(); ~GenerationGUI(); - static GenerationGUI* GetOrCreateGUI(); static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); void MakePrismAndDisplay(GEOM::GEOM_Shape_ptr BaseShape, const gp_Pnt P1, const gp_Pnt P2); @@ -53,7 +52,8 @@ public : const double tol3d, const double tol2d, const short nbiter); void MakePipeAndDisplay(GEOM::GEOM_Shape_ptr aPath, GEOM::GEOM_Shape_ptr aBase); - GEOMBase_Context* myGeomGUI; + GEOMBase* myGeomBase; + GEOMContext* myGeomGUI; GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ }; diff --git a/src/GenerationGUI/GenerationGUI_FillingDlg.cxx b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx index a7a807fcf..788106f0e 100644 --- a/src/GenerationGUI/GenerationGUI_FillingDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_FillingDlg.cxx @@ -175,7 +175,7 @@ void GenerationGUI_FillingDlg::SelectionIntoArgument() myEditCurrentArgument->setText(""); QString aString = ""; /* name of selection */ - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); if(nbSel != 1) { if(myEditCurrentArgument == GroupPoints->LineEdit1) myOkSectionShape = false; @@ -186,12 +186,12 @@ void GenerationGUI_FillingDlg::SelectionIntoArgument() TopoDS_Shape S; Standard_Boolean testResult; Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); - if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) return; if(myEditCurrentArgument == GroupPoints->LineEdit1 && S.ShapeType() == TopAbs_COMPOUND) { myEditCurrentArgument->setText(aString); - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult); + myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult); if(!testResult) return; myOkSectionShape = true; diff --git a/src/GenerationGUI/GenerationGUI_FillingDlg.h b/src/GenerationGUI/GenerationGUI_FillingDlg.h index 6bd6c47b4..e10c2d6fa 100644 --- a/src/GenerationGUI/GenerationGUI_FillingDlg.h +++ b/src/GenerationGUI/GenerationGUI_FillingDlg.h @@ -34,6 +34,8 @@ #include "GenerationGUI.h" +#include "GEOM_ShapeTypeFilter.hxx" + //================================================================================= // class : GenerationGUI_FillingDlg // purpose : diff --git a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx index 11b5b6ef7..599410905 100644 --- a/src/GenerationGUI/GenerationGUI_PipeDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PipeDlg.cxx @@ -131,7 +131,7 @@ void GenerationGUI_PipeDlg::ClickOnApply() myGeomGUI->GetDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); if(myOkShape1 && myOkShape2) @@ -147,12 +147,12 @@ void GenerationGUI_PipeDlg::ClickOnApply() //================================================================================= void GenerationGUI_PipeDlg::SelectionIntoArgument() { - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); myEditCurrentArgument->setText(""); QString aString = ""; /* name of selection */ - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); if(nbSel != 1) { if(myEditCurrentArgument == GroupPoints->LineEdit1) myOkShape1 = false; @@ -165,11 +165,11 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument() TopoDS_Shape S; Standard_Boolean testResult; Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); - if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) return; if(myEditCurrentArgument == GroupPoints->LineEdit1 && S.ShapeType() != TopAbs_COMPSOLID && S.ShapeType() != TopAbs_COMPOUND && S.ShapeType() != TopAbs_SOLID && S.ShapeType() != TopAbs_SHAPE) { - myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult); + myGeomShape1 = myGeomBase->ConvertIOinGEOMShape(IO, testResult); if(!testResult) return; myEditCurrentArgument->setText(aString); @@ -177,7 +177,7 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument() myShape1 = S; } else if(myEditCurrentArgument == GroupPoints->LineEdit2 && S.ShapeType() != TopAbs_COMPSOLID && S.ShapeType() != TopAbs_COMPOUND && S.ShapeType() != TopAbs_SOLID && S.ShapeType() != TopAbs_SHAPE) { - myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult); + myGeomShape2 = myGeomBase->ConvertIOinGEOMShape(IO, testResult); if(!testResult) return; myEditCurrentArgument->setText(aString); @@ -254,7 +254,7 @@ void GenerationGUI_PipeDlg::ActivateThisDialog() GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); if(!mySimulationTopoDs.IsNull()) - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; } @@ -265,7 +265,7 @@ void GenerationGUI_PipeDlg::ActivateThisDialog() //================================================================================= void GenerationGUI_PipeDlg::MakePipeSimulationAndDisplay() { - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); try { @@ -282,11 +282,11 @@ void GenerationGUI_PipeDlg::MakePipeSimulationAndDisplay() if(BRepAlgoAPI::IsValid(tds)) { //Draw Pipe mySimulationTopoDs = tds; - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); } } catch(Standard_Failure) { - MESSAGE("Exception catched in MakeMirrorSimulationAndDisplay"); + MESSAGE("Exception catched in MakePipeSimulationAndDisplay"); return; } return; diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx index 8a64c4d09..041a6ebb5 100644 --- a/src/GenerationGUI/GenerationGUI_PrismDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.cxx @@ -149,7 +149,7 @@ void GenerationGUI_PrismDlg::ClickOnApply() myGeomGUI->GetDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); gp_Pnt P1, P2; @@ -179,12 +179,12 @@ void GenerationGUI_PrismDlg::ClickOnApply() //================================================================================= void GenerationGUI_PrismDlg::SelectionIntoArgument() { - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); myEditCurrentArgument->setText(""); QString aString = ""; /* name of selection */ - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); if(nbSel != 1) { if(myEditCurrentArgument == GroupPoints->LineEdit1) myOkBase = false; @@ -197,13 +197,13 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() TopoDS_Shape S; Standard_Boolean testResult; Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); - if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) return; gp_Pnt aPoint1, aPoint2; if(myEditCurrentArgument == GroupPoints->LineEdit1) { - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult); + myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult); if(!testResult) return; if(S.ShapeType() <= 2) @@ -212,8 +212,8 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument() myOkBase = true; myBaseTopo = S; } - else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomGUI->LinearEdgeExtremities(S, aPoint1, aPoint2)) { - myGeomGUI->GetBipointDxDyDz(aPoint1, aPoint2, myDx, myDy, myDz); + else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomBase->LinearEdgeExtremities(S, aPoint1, aPoint2)) { + myGeomBase->GetBipointDxDyDz(aPoint1, aPoint2, myDx, myDy, myDz); myEditCurrentArgument->setText(aString); myOkLine = true; } @@ -289,7 +289,7 @@ void GenerationGUI_PrismDlg::ActivateThisDialog() GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); if(!mySimulationTopoDs.IsNull()) - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; } @@ -328,7 +328,7 @@ void GenerationGUI_PrismDlg::ReverseVector(int state) //================================================================================= void GenerationGUI_PrismDlg::MakePrismSimulationAndDisplay() { - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); try { @@ -339,7 +339,7 @@ void GenerationGUI_PrismDlg::MakePrismSimulationAndDisplay() if(mySimulationTopoDs.IsNull()) return; else - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); } catch(Standard_Failure) { MESSAGE("Exception catched in MakePrismSimulationAndDisplay" << endl); diff --git a/src/GenerationGUI/GenerationGUI_PrismDlg.h b/src/GenerationGUI/GenerationGUI_PrismDlg.h index 1eec6575a..77b47a410 100644 --- a/src/GenerationGUI/GenerationGUI_PrismDlg.h +++ b/src/GenerationGUI/GenerationGUI_PrismDlg.h @@ -34,6 +34,8 @@ #include "GenerationGUI.h" +#include "GEOM_ShapeTypeFilter.hxx" + //================================================================================= // class : GenerationGUI_PrismDlg // purpose : diff --git a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx index 98cfaaf16..66bec8ee4 100644 --- a/src/GenerationGUI/GenerationGUI_RevolDlg.cxx +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.cxx @@ -148,7 +148,7 @@ void GenerationGUI_RevolDlg::ClickOnApply() myGeomGUI->GetDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); if(myOkBase && myOkAxis) @@ -163,12 +163,12 @@ void GenerationGUI_RevolDlg::ClickOnApply() //================================================================================= void GenerationGUI_RevolDlg::SelectionIntoArgument() { - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); myEditCurrentArgument->setText(""); QString aString = ""; /* name of selection */ - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); if(nbSel != 1) { if(myEditCurrentArgument == GroupPoints->LineEdit1) myOkBase = false; @@ -181,11 +181,11 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument() TopoDS_Shape S; Standard_Boolean testResult; Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); - if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) return; if(myEditCurrentArgument == GroupPoints->LineEdit1) { - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult); + myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult); if(!testResult) return; TopAbs_ShapeEnum aType = S.ShapeType(); @@ -261,7 +261,7 @@ void GenerationGUI_RevolDlg::ActivateThisDialog() GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); if(!mySimulationTopoDs.IsNull()) - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; } @@ -312,7 +312,7 @@ void GenerationGUI_RevolDlg::ReverseAngle(int state) //================================================================================= void GenerationGUI_RevolDlg::MakeRevolutionSimulationAndDisplay() { - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); TopAbs_ShapeEnum aType = myBase.ShapeType(); @@ -322,7 +322,7 @@ void GenerationGUI_RevolDlg::MakeRevolutionSimulationAndDisplay() try { gp_Ax1 AX(myLoc, myDir); mySimulationTopoDs = BRepPrimAPI_MakeRevol(myBase, AX, myAngle*PI180); - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); } catch(Standard_Failure) { MESSAGE("Exception catched in MakeRevolutionSimulationAndDisplay"); diff --git a/src/GenerationGUI/GenerationGUI_RevolDlg.h b/src/GenerationGUI/GenerationGUI_RevolDlg.h index 97fd799ba..1344b6595 100644 --- a/src/GenerationGUI/GenerationGUI_RevolDlg.h +++ b/src/GenerationGUI/GenerationGUI_RevolDlg.h @@ -34,6 +34,7 @@ #include "GenerationGUI.h" +#include "GEOM_ShapeTypeFilter.hxx" #include //================================================================================= diff --git a/src/GenerationGUI/Makefile.in b/src/GenerationGUI/Makefile.in index 8ba5726fb..fad3011b9 100644 --- a/src/GenerationGUI/Makefile.in +++ b/src/GenerationGUI/Makefile.in @@ -35,7 +35,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl @COMMENCE@ # header files -EXPORT_HEADERS= GenerationGUI.h +EXPORT_HEADERS= # Libraries targets LIB = libGenerationGUI.la @@ -68,6 +68,6 @@ LIB_SERVER_IDL = CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lDlgRef -lGEOMBase $(OCC_KERNEL_LIBS) $(OCC_MODELER_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lDlgRef -lGEOMContext -lGEOMBase $(CAS_LDPATH) -lTKOffset -L${KERNEL_ROOT_DIR}/lib/salome @CONCLUDE@ diff --git a/src/MeasureGUI/Makefile.in b/src/MeasureGUI/Makefile.in index 92a0683fc..48ccd7da4 100644 --- a/src/MeasureGUI/Makefile.in +++ b/src/MeasureGUI/Makefile.in @@ -35,7 +35,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl @COMMENCE@ # header files -EXPORT_HEADERS= MeasureGUI.h +EXPORT_HEADERS= # Libraries targets LIB = libMeasureGUI.la @@ -76,6 +76,6 @@ LIB_SERVER_IDL = CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lDlgRef -lGEOMBase $(OCC_KERNEL_LIBS) $(OCC_MODELER_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lDlgRef -lGEOMContext -lGEOMBase -L${KERNEL_ROOT_DIR}/lib/salome @CONCLUDE@ diff --git a/src/MeasureGUI/MeasureGUI.cxx b/src/MeasureGUI/MeasureGUI.cxx index 51890210f..835d609cc 100644 --- a/src/MeasureGUI/MeasureGUI.cxx +++ b/src/MeasureGUI/MeasureGUI.cxx @@ -29,6 +29,8 @@ using namespace std; #include "MeasureGUI.h" +#include "SALOMEGUI_QtCatchCorbaException.hxx" + #include "MeasureGUI_PropertiesDlg.h" // Method PROPERTIES #include "MeasureGUI_CenterMassDlg.h" // Method CENTER MASS #include "MeasureGUI_InertiaDlg.h" // Method INERTIA @@ -38,8 +40,6 @@ using namespace std; #include "MeasureGUI_WhatisDlg.h" // Method WHATIS #include "MeasureGUI_CheckShape.h" // Method CHECKSHAPE -static MeasureGUI* myMeasureGUI = 0; - //======================================================================= // function : MeasureGUI() // purpose : Constructor @@ -47,9 +47,9 @@ static MeasureGUI* myMeasureGUI = 0; MeasureGUI::MeasureGUI() : QObject() { - myGeomGUI = GEOMBase_Context::GetGeomGUI(); - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); + myGeomBase = new GEOMBase(); + myGeomGUI = GEOMContext::GetGeomGUI(); + myGeom = myGeomGUI->myComponentGeom; } @@ -62,25 +62,13 @@ MeasureGUI::~MeasureGUI() } -//======================================================================= -// function : GetOrCreateGUI() -// purpose : Gets or create an object 'GUI' with initialisations -// : Returns 'GUI' as a pointer -//======================================================================= -MeasureGUI* MeasureGUI::GetOrCreateGUI() -{ - myMeasureGUI = new MeasureGUI(); - return myMeasureGUI; -} - - //======================================================================= // function : OnGUIEvent() // purpose : //======================================================================= bool MeasureGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) { - MeasureGUI::GetOrCreateGUI(); + MeasureGUI* myMeasureGUI = new MeasureGUI(); myMeasureGUI->myGeomGUI->EmitSignalDeactivateDialog(); SALOME_Selection* Sel = SALOME_Selection::Selection(myMeasureGUI->myGeomGUI->GetActiveStudy()->getSelection()); @@ -149,7 +137,7 @@ void MeasureGUI::MakeCDGAndDisplay(GEOM::GEOM_Shape_ptr Shape) return; } result->NameType(tr("GEOM_POINT")); - if(myGeomGUI->Display(result)) + if(myGeomBase->Display(result)) myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { diff --git a/src/MeasureGUI/MeasureGUI.h b/src/MeasureGUI/MeasureGUI.h index 53ecbbe4e..751574e47 100644 --- a/src/MeasureGUI/MeasureGUI.h +++ b/src/MeasureGUI/MeasureGUI.h @@ -29,7 +29,7 @@ #ifndef MEASUREGUI_H #define MEASUREGUI_H -#include "GEOMBase_Context.h" +#include "GEOMBase.h" //================================================================================= // class : MeasureGUI @@ -43,12 +43,12 @@ public : MeasureGUI(); ~MeasureGUI(); - static MeasureGUI* GetOrCreateGUI(); static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); void MakeCDGAndDisplay(GEOM::GEOM_Shape_ptr Shape); - GEOMBase_Context* myGeomGUI; + GEOMBase* myGeomBase; + GEOMContext* myGeomGUI; GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ }; diff --git a/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx b/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx index c86045907..90daf1cf3 100644 --- a/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_BndBoxDlg.cxx @@ -242,7 +242,8 @@ void MeasureGUI_BndBoxDlg::Init( SALOME_Selection* Sel ) Constructor1->setChecked( TRUE ); myEditCurrentArgument = LineEditC1A1 ; mySelection = Sel; - myGeomGUI = GEOMBase_Context::GetGeomGUI() ; + myGeomBase = new GEOMBase() ; + myGeomGUI = GEOMContext::GetGeomGUI() ; myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; // TODO : previous selection into argument ? @@ -265,7 +266,7 @@ void MeasureGUI_BndBoxDlg::Init( SALOME_Selection* Sel ) /* Move widget on the botton right corner of main widget */ int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; + myGeomBase->DefineDlgPosition( this, x, y ) ; this->move( x, y ) ; this->show() ; /* displays Dialog */ @@ -290,7 +291,7 @@ void MeasureGUI_BndBoxDlg::ConstructorsClicked(int constructorId) //================================================================================= void MeasureGUI_BndBoxDlg::ClickOnCancel() { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; disconnect( mySelection, 0, this, 0 ); myGeomGUI->ResetState() ; @@ -316,14 +317,14 @@ void MeasureGUI_BndBoxDlg::SelectionIntoArgument() QString aString = ""; /* future the name of selection */ - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ; if ( nbSel != 1 ) { return ; } /* nbSel == 1 */ TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) + if( !myGeomBase->GetTopoFromSelection(mySelection, S) ) return ; if( S.IsNull() ) { @@ -379,7 +380,7 @@ void MeasureGUI_BndBoxDlg::LineEditReturnPressed() /* so SelectionIntoArgument() is automatically called. */ const QString objectUserName = myEditCurrentArgument->text() ; QWidget* thisWidget = (QWidget*)this ; - if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { + if( myGeomBase->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { myEditCurrentArgument->setText( objectUserName ) ; } @@ -473,7 +474,7 @@ void MeasureGUI_BndBoxDlg::CalculateAndDisplayBndBox(const TopoDS_Shape& S) mySimulationTopoDs = BRepPrimAPI_MakeBox( gp_Pnt(axmin,aymin,azmin), gp_Pnt(axmax,aymax,azmax) ).Shape(); - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; + myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; } catch(Standard_Failure) { MESSAGE("Catch intercepted in CalculateAndDisplayBndBox()" << endl ) ; diff --git a/src/MeasureGUI/MeasureGUI_BndBoxDlg.h b/src/MeasureGUI/MeasureGUI_BndBoxDlg.h index 6649fe99b..fa65c5b9d 100644 --- a/src/MeasureGUI/MeasureGUI_BndBoxDlg.h +++ b/src/MeasureGUI/MeasureGUI_BndBoxDlg.h @@ -64,7 +64,8 @@ private: void CalculateAndDisplayBndBox(const TopoDS_Shape& S) ; GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */ + GEOMContext* myGeomGUI ; /* Current GeomGUI object */ + GEOMBase* myGeomBase ; /* Current GeomGUI object */ SALOME_Selection* mySelection ; /* User shape selection */ int myConstructorId ; /* Current constructor id = radio button id */ QLineEdit* myEditCurrentArgument; /* Current LineEdit */ diff --git a/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx b/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx index f61f4b3b6..2cf97db3f 100644 --- a/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_CenterMassDlg.cxx @@ -233,7 +233,8 @@ void MeasureGUI_CenterMassDlg::Init( SALOME_Selection* Sel ) Constructor1->setChecked( TRUE ); myEditCurrentArgument = LineEditC1A1 ; mySelection = Sel; - myGeomGUI = GEOMBase_Context::GetGeomGUI() ; + myGeomBase = new GEOMBase() ; + myGeomGUI = GEOMContext::GetGeomGUI() ; myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; mySimulationTopoDs.Nullify() ; myShape.Nullify() ; @@ -259,7 +260,7 @@ void MeasureGUI_CenterMassDlg::Init( SALOME_Selection* Sel ) /* Move widget on the botton right corner of main widget */ int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; + myGeomBase->DefineDlgPosition( this, x, y ) ; this->move( x, y ) ; this->show() ; /* displays Dialog */ @@ -284,7 +285,7 @@ void MeasureGUI_CenterMassDlg::ConstructorsClicked(int constructorId) //================================================================================= void MeasureGUI_CenterMassDlg::ClickOnCancel() { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; disconnect( mySelection, 0, this, 0 ); myGeomGUI->ResetState() ; @@ -310,7 +311,7 @@ void MeasureGUI_CenterMassDlg::ClickOnOk() //================================================================================= void MeasureGUI_CenterMassDlg::ClickOnApply() { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; myGeomGUI->GetDesktop()->putInfo( tr("") ) ; if( myOkCenterMass) { @@ -328,7 +329,7 @@ void MeasureGUI_CenterMassDlg::ClickOnApply() //================================================================================= void MeasureGUI_CenterMassDlg::SelectionIntoArgument() { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; myEditCurrentArgument->setText("") ; myOkCenterMass = false ; Standard_Boolean testResult ; @@ -339,17 +340,17 @@ void MeasureGUI_CenterMassDlg::SelectionIntoArgument() QString aString = ""; /* future the name of selection */ - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ; if ( nbSel != 1 ) { return ; } /* nbSel == 1 */ Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(mySelection, this->myShape) ) + if( !myGeomBase->GetTopoFromSelection(mySelection, this->myShape) ) return ; - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; + myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult) ; if( !testResult ) return ; myEditCurrentArgument->setText(aString) ; @@ -402,7 +403,7 @@ void MeasureGUI_CenterMassDlg::LineEditReturnPressed() /* so SelectionIntoArgument() is automatically called. */ const QString objectUserName = myEditCurrentArgument->text() ; QWidget* thisWidget = (QWidget*)this ; - if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { + if( myGeomBase->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { myEditCurrentArgument->setText( objectUserName ) ; } return ; @@ -416,7 +417,7 @@ void MeasureGUI_CenterMassDlg::LineEditReturnPressed() void MeasureGUI_CenterMassDlg::DeactivateActiveDialog() { if ( GroupConstructors->isEnabled() ) { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; disconnect( mySelection, 0, this, 0 ); GroupConstructors->setEnabled(false) ; GroupC1->setEnabled(false) ; @@ -439,7 +440,7 @@ void MeasureGUI_CenterMassDlg::ActivateThisDialog() GroupButtons->setEnabled(true) ; connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; + myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; return ; } @@ -475,7 +476,7 @@ void MeasureGUI_CenterMassDlg::closeEvent( QCloseEvent* e ) //================================================================================= bool MeasureGUI_CenterMassDlg::CalculateAndDisplayCenterMass() { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; try { @@ -484,7 +485,7 @@ bool MeasureGUI_CenterMassDlg::CalculateAndDisplayCenterMass() GProp_GProps System; if ( this->myShape.ShapeType() == TopAbs_VERTEX) { - myGeomGUI->VertexToPoint( this->myShape, this->myCenterMass ); + myGeomBase->VertexToPoint( this->myShape, this->myCenterMass ); } else if ( this->myShape.ShapeType() == TopAbs_EDGE || this->myShape.ShapeType() == TopAbs_WIRE ) { BRepGProp::LinearProperties(this->myShape, System); @@ -513,7 +514,7 @@ bool MeasureGUI_CenterMassDlg::CalculateAndDisplayCenterMass() if( !mySimulationTopoDs.IsNull() ) { - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; + myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; return true ; } } diff --git a/src/MeasureGUI/MeasureGUI_CenterMassDlg.h b/src/MeasureGUI/MeasureGUI_CenterMassDlg.h index 75d553a58..4eac188a0 100644 --- a/src/MeasureGUI/MeasureGUI_CenterMassDlg.h +++ b/src/MeasureGUI/MeasureGUI_CenterMassDlg.h @@ -67,7 +67,8 @@ private: bool CalculateAndDisplayCenterMass() ; GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */ + GEOMBase* myGeomBase ; /* Current GeomGUI object */ + GEOMContext* myGeomGUI ; /* Current GeomGUI object */ SALOME_Selection* mySelection ; /* User shape selection */ TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */ diff --git a/src/MeasureGUI/MeasureGUI_CheckShape.cxx b/src/MeasureGUI/MeasureGUI_CheckShape.cxx index d11fbb04f..586f58d1c 100644 --- a/src/MeasureGUI/MeasureGUI_CheckShape.cxx +++ b/src/MeasureGUI/MeasureGUI_CheckShape.cxx @@ -178,7 +178,8 @@ void MeasureGUI_CheckShape::Init( SALOME_Selection* Sel ) Constructor1->setChecked( TRUE ); myEditCurrentArgument = LineEditC1A1 ; mySelection = Sel; - myGeomGUI = GEOMBase_Context::GetGeomGUI() ; + myGeomBase = new GEOMBase() ; + myGeomGUI = GEOMContext::GetGeomGUI() ; myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; // TODO : previous selection into argument ? @@ -203,7 +204,7 @@ void MeasureGUI_CheckShape::Init( SALOME_Selection* Sel ) /* Move widget on the botton right corner of main widget */ int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; + myGeomBase->DefineDlgPosition( this, x, y ) ; this->move( x, y ) ; this->show() ; /* displays Dialog */ @@ -246,14 +247,14 @@ void MeasureGUI_CheckShape::SelectionIntoArgument() SelectedName = ""; /* future the name of selection */ - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, SelectedName) ; + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, SelectedName) ; if ( nbSel != 1 ) { return ; } /* nbSel == 1 */ TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) + if( !myGeomBase->GetTopoFromSelection(mySelection, S) ) return ; if( S.IsNull() ) { @@ -309,7 +310,7 @@ void MeasureGUI_CheckShape::LineEditReturnPressed() /* so SelectionIntoArgument() is automatically called. */ const QString objectUserName = myEditCurrentArgument->text() ; QWidget* thisWidget = (QWidget*)this ; - if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { + if( myGeomBase->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { myEditCurrentArgument->setText( objectUserName ) ; } return ; diff --git a/src/MeasureGUI/MeasureGUI_CheckShape.h b/src/MeasureGUI/MeasureGUI_CheckShape.h index d68cf4969..2bde05a3c 100644 --- a/src/MeasureGUI/MeasureGUI_CheckShape.h +++ b/src/MeasureGUI/MeasureGUI_CheckShape.h @@ -65,7 +65,8 @@ private: void Check(const TopoDS_Shape S) ; GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */ + GEOMBase* myGeomBase ; /* Current GeomGUI object */ + GEOMContext* myGeomGUI ; /* Current GeomGUI object */ SALOME_Selection* mySelection ; /* User shape selection */ int myConstructorId ; /* Current constructor id = radio button id */ diff --git a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx index 0ad1bafee..4c2857f3f 100644 --- a/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_DistanceDlg.cxx @@ -207,7 +207,8 @@ void MeasureGUI_DistanceDlg::Init( SALOME_Selection* Sel ) myShape2.Nullify() ; myConstructorId = 0 ; - myGeomGUI = GEOMBase_Context::GetGeomGUI() ; + myGeomGUI = GEOMContext::GetGeomGUI() ; + myGeomBase = new GEOMBase() ; GroupConstructor1->show(); myConstructorId = 0 ; @@ -240,7 +241,7 @@ void MeasureGUI_DistanceDlg::Init( SALOME_Selection* Sel ) /* Move widget on the botton right corner of main widget */ int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; + myGeomBase->DefineDlgPosition( this, x, y ) ; this->move( x, y ) ; this->show() ; /* Displays Dialog */ @@ -256,7 +257,7 @@ void MeasureGUI_DistanceDlg::Init( SALOME_Selection* Sel ) void MeasureGUI_DistanceDlg::ConstructorsClicked(int constructorId) { EraseDistance(); - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; switch (constructorId) { @@ -293,7 +294,7 @@ void MeasureGUI_DistanceDlg::ClickOnOk() void MeasureGUI_DistanceDlg::ClickOnApply() { EraseDistance() ; - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; myGeomGUI->GetDesktop()->putInfo( tr("") ) ; switch(myConstructorId) @@ -319,7 +320,7 @@ void MeasureGUI_DistanceDlg::ClickOnApply() void MeasureGUI_DistanceDlg::ClickOnCancel() { EraseDistance() ; - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; disconnect( mySelection, 0, this, 0 ); myGeomGUI->ResetState() ; @@ -335,14 +336,14 @@ void MeasureGUI_DistanceDlg::ClickOnCancel() //================================================================================= void MeasureGUI_DistanceDlg::SelectionIntoArgument() { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; LineEdit_Length->setText("") ; myEditCurrentArgument->setText("") ; /* by default */ QString aString = ""; /* the name of selection */ - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ; if ( nbSel != 1 ) { switch (myConstructorId) { @@ -365,11 +366,11 @@ void MeasureGUI_DistanceDlg::SelectionIntoArgument() Standard_Boolean testResult ; Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) + if( !myGeomBase->GetTopoFromSelection(mySelection, S) ) return ; if ( myEditCurrentArgument == LineEditC1A1Shape ) { - myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; + myGeomShape1 = myGeomBase->ConvertIOinGEOMShape(IO, testResult) ; if( !testResult ) return ; myShape1 = S ; @@ -377,7 +378,7 @@ void MeasureGUI_DistanceDlg::SelectionIntoArgument() myOkShape1 = true ; } else if ( myEditCurrentArgument == LineEditC1A2Shape ) { - myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; + myGeomShape2 = myGeomBase->ConvertIOinGEOMShape(IO, testResult) ; if( !testResult ) return ; myShape2 = S ; @@ -437,7 +438,7 @@ void MeasureGUI_DistanceDlg::LineEditReturnPressed() /* so SelectionIntoArgument() is automatically called. */ const QString objectUserName = myEditCurrentArgument->text() ; QWidget* thisWidget = (QWidget*)this ; - if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { + if( myGeomBase->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { myEditCurrentArgument->setText( objectUserName ) ; } return ; @@ -501,7 +502,7 @@ void MeasureGUI_DistanceDlg::ActivateThisDialog() connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; + myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; return ; } @@ -516,7 +517,7 @@ void MeasureGUI_DistanceDlg::MakeDistanceSimulationAndDisplay(const TopoDS_Shape { LineEdit_Length->setText("") ; EraseDistance() ; - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; BRepExtrema_DistShapeShape dst( S1, S2 ); if (dst.IsDone()) { @@ -530,7 +531,7 @@ void MeasureGUI_DistanceDlg::MakeDistanceSimulationAndDisplay(const TopoDS_Shape if (Dist<=1.e-9) { BRepBuilderAPI_MakeVertex MakeVertex(P1); mySimulationTopoDs = MakeVertex.Vertex(); - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; + myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; LineEdit_Length->setText("0.0") ; } else { diff --git a/src/MeasureGUI/MeasureGUI_DistanceDlg.h b/src/MeasureGUI/MeasureGUI_DistanceDlg.h index 633a4919c..70c4bd878 100644 --- a/src/MeasureGUI/MeasureGUI_DistanceDlg.h +++ b/src/MeasureGUI/MeasureGUI_DistanceDlg.h @@ -70,7 +70,8 @@ private: void EraseDistance() ; GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */ + GEOMContext* myGeomGUI ; /* Current GeomGUI object */ + GEOMBase* myGeomBase ; /* Current GeomGUI object */ SALOME_Selection* mySelection ; /* User shape selection */ TopoDS_Shape myShape1 ; TopoDS_Shape myShape2 ; diff --git a/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx b/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx index 8978e941e..c6d629d9e 100644 --- a/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_InertiaDlg.cxx @@ -280,7 +280,8 @@ void MeasureGUI_InertiaDlg::Init( SALOME_Selection* Sel ) Constructor1->setChecked( TRUE ); myEditCurrentArgument = LineEditC1A1 ; mySelection = Sel; - myGeomGUI = GEOMBase_Context::GetGeomGUI() ; + myGeomBase = new GEOMBase() ; + myGeomGUI = GEOMContext::GetGeomGUI() ; myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; // TODO : previous selection into argument ? @@ -304,7 +305,7 @@ void MeasureGUI_InertiaDlg::Init( SALOME_Selection* Sel ) /* Move widget on the botton right corner of main widget */ int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; + myGeomBase->DefineDlgPosition( this, x, y ) ; this->move( x, y ) ; this->show() ; /* displays Dialog */ return ; @@ -358,14 +359,14 @@ void MeasureGUI_InertiaDlg::SelectionIntoArgument() myEditCurrentArgument->setText("") ; QString aString = ""; /* future the name of selection */ - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ; if ( nbSel != 1 ) { return ; } /* nbSel == 1 */ TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) || S.IsNull() ) + if( !myGeomBase->GetTopoFromSelection(mySelection, S) || S.IsNull() ) return ; LineEditC1A1->setText(aString) ; @@ -415,7 +416,7 @@ void MeasureGUI_InertiaDlg::LineEditReturnPressed() /* so SelectionIntoArgument() is automatically called. */ const QString objectUserName = myEditCurrentArgument->text() ; QWidget* thisWidget = (QWidget*)this ; - if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { + if( myGeomBase->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { myEditCurrentArgument->setText( objectUserName ) ; } return ; diff --git a/src/MeasureGUI/MeasureGUI_InertiaDlg.h b/src/MeasureGUI/MeasureGUI_InertiaDlg.h index 882c6c84b..5980f9926 100644 --- a/src/MeasureGUI/MeasureGUI_InertiaDlg.h +++ b/src/MeasureGUI/MeasureGUI_InertiaDlg.h @@ -67,7 +67,8 @@ public: void CalculateAndDisplayInertia(const TopoDS_Shape& S) ; GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */ + GEOMBase* myGeomBase ; /* Current GeomGUI object */ + GEOMContext* myGeomGUI ; /* Current GeomGUI object */ SALOME_Selection* mySelection ; int myConstructorId ; /* Current constructor id = radio button id */ diff --git a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx index 40fcc7da0..d1053be6a 100644 --- a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.cxx @@ -252,7 +252,8 @@ void MeasureGUI_MaxToleranceDlg::Init( SALOME_Selection* Sel ) Constructor1->setChecked( TRUE ); myEditCurrentArgument = LineEditC1A1 ; mySelection = Sel; - myGeomGUI = GEOMBase_Context::GetGeomGUI() ; + myGeomGUI = GEOMContext::GetGeomGUI() ; + myGeomBase = new GEOMBase() ; myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; // TODO : previous selection into argument ? @@ -275,7 +276,7 @@ void MeasureGUI_MaxToleranceDlg::Init( SALOME_Selection* Sel ) /* Move widget on the botton right corner of main widget */ int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; + myGeomBase->DefineDlgPosition( this, x, y ) ; this->move( x, y ) ; this->show() ; /* displays Dialog */ return ; @@ -322,14 +323,14 @@ void MeasureGUI_MaxToleranceDlg::SelectionIntoArgument() QString aString = ""; /* future the name of selection */ - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ; if ( nbSel != 1 ) { return ; } /* nbSel == 1 */ TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) + if( !myGeomBase->GetTopoFromSelection(mySelection, S) ) return ; if( S.IsNull() ) { @@ -385,7 +386,7 @@ void MeasureGUI_MaxToleranceDlg::LineEditReturnPressed() /* so SelectionIntoArgument() is automatically called. */ const QString objectUserName = myEditCurrentArgument->text() ; QWidget* thisWidget = (QWidget*)this ; - if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { + if( myGeomBase->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { myEditCurrentArgument->setText( objectUserName ) ; } return ; diff --git a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.h b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.h index fddd69202..d2fcfa2e0 100644 --- a/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.h +++ b/src/MeasureGUI/MeasureGUI_MaxToleranceDlg.h @@ -64,7 +64,8 @@ private: void CalculateMaxTolerance(const TopoDS_Shape& S) ; GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */ + GEOMContext* myGeomGUI ; /* Current GeomGUI object */ + GEOMBase* myGeomBase ; /* Current GeomGUI object */ SALOME_Selection* mySelection ; /* User shape selection */ int myConstructorId ; /* Current constructor id = radio button id */ diff --git a/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx b/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx index bac538107..81cd61ca0 100644 --- a/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_PropertiesDlg.cxx @@ -195,7 +195,8 @@ void MeasureGUI_PropertiesDlg::Init( SALOME_Selection* Sel ) Constructor1->setChecked( TRUE ); myEditCurrentArgument = LineEditC1A1 ; mySelection = Sel; - myGeomGUI = GEOMBase_Context::GetGeomGUI() ; + myGeomBase = new GEOMBase() ; + myGeomGUI = GEOMContext::GetGeomGUI() ; myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; // TODO : previous selection into argument ? @@ -217,7 +218,7 @@ void MeasureGUI_PropertiesDlg::Init( SALOME_Selection* Sel ) /* Move widget on the botton right corner of main widget */ int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; + myGeomBase->DefineDlgPosition( this, x, y ) ; this->move( x, y ) ; this->show() ; /* displays Dialog */ return ; @@ -241,9 +242,9 @@ void MeasureGUI_PropertiesDlg::ConstructorsClicked(int constructorId) //================================================================================= void MeasureGUI_PropertiesDlg::ClickOnCancel() { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; myGeomGUI->ResetState() ; reject() ; return ; @@ -256,7 +257,7 @@ void MeasureGUI_PropertiesDlg::ClickOnCancel() //================================================================================= void MeasureGUI_PropertiesDlg::SelectionIntoArgument() { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; LineEdit_Length->setText("") ; @@ -266,14 +267,14 @@ void MeasureGUI_PropertiesDlg::SelectionIntoArgument() QString aString = ""; /* future the name of selection */ - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ; if ( nbSel != 1 ) { return ; } /* nbSel == 1 */ TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) + if( !myGeomBase->GetTopoFromSelection(mySelection, S) ) return ; if( S.IsNull() || S.ShapeType() == TopAbs_VERTEX ) { @@ -284,8 +285,8 @@ void MeasureGUI_PropertiesDlg::SelectionIntoArgument() LineEditC1A1->setText(aString) ; /* Try to display of a cone simulation shape to show direction of a linear edge only in OCC viewer */ - if( myGeomGUI->CreateArrowForLinearEdge( S, mySimulationTopoDs ) ) { - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; + if( myGeomBase->CreateArrowForLinearEdge( S, mySimulationTopoDs ) ) { + myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; } this->CalculateAndDisplayProperties(S) ; @@ -334,7 +335,7 @@ void MeasureGUI_PropertiesDlg::LineEditReturnPressed() /* so SelectionIntoArgument() is automatically called. */ const QString objectUserName = myEditCurrentArgument->text() ; QWidget* thisWidget = (QWidget*)this ; - if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { + if( myGeomBase->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { myEditCurrentArgument->setText( objectUserName ) ; } return ; @@ -351,7 +352,7 @@ void MeasureGUI_PropertiesDlg::DeactivateActiveDialog() disconnect( mySelection, 0, this, 0 ); GroupConstructors->setEnabled(false) ; GroupConstructor1->setEnabled(false) ; - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; GroupButtons->setEnabled(false) ; } return ; @@ -372,7 +373,7 @@ void MeasureGUI_PropertiesDlg::ActivateThisDialog() connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; + myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; return ; } diff --git a/src/MeasureGUI/MeasureGUI_PropertiesDlg.h b/src/MeasureGUI/MeasureGUI_PropertiesDlg.h index 569ee8fe5..1259983b1 100644 --- a/src/MeasureGUI/MeasureGUI_PropertiesDlg.h +++ b/src/MeasureGUI/MeasureGUI_PropertiesDlg.h @@ -68,7 +68,8 @@ private: void CalculateAndDisplayProperties(const TopoDS_Shape& S) ; GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */ + GEOMContext* myGeomGUI ; /* Current GeomGUI object */ + GEOMBase* myGeomBase ; /* Current GeomGUI object */ SALOME_Selection* mySelection ; /* User shape selection */ TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */ diff --git a/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx b/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx index 88e892f12..29823591a 100644 --- a/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx +++ b/src/MeasureGUI/MeasureGUI_WhatisDlg.cxx @@ -176,7 +176,8 @@ void MeasureGUI_WhatisDlg::Init( SALOME_Selection* Sel ) Constructor1->setChecked( TRUE ); myEditCurrentArgument = LineEditC1A1 ; mySelection = Sel; - myGeomGUI = GEOMBase_Context::GetGeomGUI() ; + myGeomBase = new GEOMBase() ; + myGeomGUI = GEOMContext::GetGeomGUI() ; myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; // TODO : previous selection into argument ? @@ -201,7 +202,7 @@ void MeasureGUI_WhatisDlg::Init( SALOME_Selection* Sel ) /* Move widget on the botton right corner of main widget */ int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; + myGeomBase->DefineDlgPosition( this, x, y ) ; this->move( x, y ) ; this->show() ; /* displays Dialog */ @@ -226,7 +227,7 @@ void MeasureGUI_WhatisDlg::ConstructorsClicked(int constructorId) //================================================================================= void MeasureGUI_WhatisDlg::ClickOnCancel() { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; disconnect( mySelection, 0, this, 0 ); myGeomGUI->ResetState() ; reject() ; @@ -240,7 +241,7 @@ void MeasureGUI_WhatisDlg::ClickOnCancel() //================================================================================= void MeasureGUI_WhatisDlg::SelectionIntoArgument() { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; Text->setText("") ; @@ -248,14 +249,14 @@ void MeasureGUI_WhatisDlg::SelectionIntoArgument() SelectedName = ""; /* future the name of selection */ - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, SelectedName) ; + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, SelectedName) ; if ( nbSel != 1 ) { return ; } /* nbSel == 1 */ TopoDS_Shape S; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) + if( !myGeomBase->GetTopoFromSelection(mySelection, S) ) return ; if( S.IsNull() ) { @@ -264,8 +265,8 @@ void MeasureGUI_WhatisDlg::SelectionIntoArgument() } /* Try to display of a cone simulation shape to show direction of a linear edge only in OCC viewer */ - if( myGeomGUI->CreateArrowForLinearEdge( S, mySimulationTopoDs ) ) { - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; + if( myGeomBase->CreateArrowForLinearEdge( S, mySimulationTopoDs ) ) { + myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; } LineEditC1A1->setText(SelectedName) ; this->CalculateWhatis(S) ; @@ -315,7 +316,7 @@ void MeasureGUI_WhatisDlg::LineEditReturnPressed() /* so SelectionIntoArgument() is automatically called. */ const QString objectUserName = myEditCurrentArgument->text() ; QWidget* thisWidget = (QWidget*)this ; - if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { + if( myGeomBase->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { myEditCurrentArgument->setText( objectUserName ) ; } return ; @@ -332,7 +333,7 @@ void MeasureGUI_WhatisDlg::DeactivateActiveDialog() disconnect( mySelection, 0, this, 0 ); GroupConstructors->setEnabled(false) ; GroupConstructor1->setEnabled(false) ; - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; GroupButtons->setEnabled(false) ; } return ; @@ -352,7 +353,7 @@ void MeasureGUI_WhatisDlg::ActivateThisDialog() GroupButtons->setEnabled(true) ; connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; + myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; return ; } diff --git a/src/MeasureGUI/MeasureGUI_WhatisDlg.h b/src/MeasureGUI/MeasureGUI_WhatisDlg.h index a4a5c76e5..f7c981aec 100644 --- a/src/MeasureGUI/MeasureGUI_WhatisDlg.h +++ b/src/MeasureGUI/MeasureGUI_WhatisDlg.h @@ -68,7 +68,8 @@ private: void CalculateWhatis(const TopoDS_Shape& S) ; GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */ + GEOMContext* myGeomGUI ; /* Current GeomGUI object */ + GEOMBase* myGeomBase ; /* Current GeomGUI object */ SALOME_Selection* mySelection ; /* User shape selection */ TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */ diff --git a/src/OperationGUI/Makefile.in b/src/OperationGUI/Makefile.in index 78ae410b3..ad6e914ec 100644 --- a/src/OperationGUI/Makefile.in +++ b/src/OperationGUI/Makefile.in @@ -35,7 +35,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl @COMMENCE@ # header files -EXPORT_HEADERS= OperationGUI.h +EXPORT_HEADERS= # Libraries targets LIB = libOperationGUI.la @@ -68,6 +68,6 @@ LIB_SERVER_IDL = CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lDlgRef -lGEOMBase $(OCC_KERNEL_LIBS) $(OCC_MODELER_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lDlgRef -lGEOMContext -lGEOMBase -lDisplayGUI $(CAS_LDPATH) -lTKFillet -L${KERNEL_ROOT_DIR}/lib/salome @CONCLUDE@ diff --git a/src/OperationGUI/OperationGUI.cxx b/src/OperationGUI/OperationGUI.cxx index c122a99d6..a8b16ffbc 100644 --- a/src/OperationGUI/OperationGUI.cxx +++ b/src/OperationGUI/OperationGUI.cxx @@ -29,19 +29,21 @@ using namespace std; #include "OperationGUI.h" +#include "DisplayGUI.h" + #include "QAD_RightFrame.h" #include "OCCViewer_Viewer3d.h" #include "OCCViewer_ViewFrame.h" +#include "SALOMEGUI_QtCatchCorbaException.hxx" #include +#include #include "OperationGUI_PartitionDlg.h" // Method PARTITION #include "OperationGUI_ArchimedeDlg.h" // Method ARCHIMEDE #include "OperationGUI_FilletDlg.h" // Method FILLET #include "OperationGUI_ChamferDlg.h" // Method CHAMFER -static OperationGUI* myOperationGUI = 0; - //======================================================================= // function : OperationGUI() // purpose : Constructor @@ -49,9 +51,11 @@ static OperationGUI* myOperationGUI = 0; OperationGUI::OperationGUI() : QObject() { - myGeomGUI = GEOMBase_Context::GetGeomGUI(); - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); + myGeomBase = new GEOMBase(); + myGeomGUI = GEOMContext::GetGeomGUI(); +// Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); +// myGeom = GEOM::GEOM_Gen::_narrow(comp); + myGeom = myGeomGUI->myComponentGeom; } @@ -64,25 +68,13 @@ OperationGUI::~OperationGUI() } -//======================================================================= -// function : GetOrCreateGUI() -// purpose : Gets or create an object 'GUI' with initialisations -// : Returns 'GUI' as a pointer -//======================================================================= -OperationGUI* OperationGUI::GetOrCreateGUI() -{ - myOperationGUI = new OperationGUI(); - return myOperationGUI; -} - - //======================================================================= // function : OnGUIEvent() // purpose : //======================================================================= bool OperationGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) { - OperationGUI::GetOrCreateGUI(); + OperationGUI* myOperationGUI = new OperationGUI(); myOperationGUI->myGeomGUI->EmitSignalDeactivateDialog(); SALOME_Selection* Sel = SALOME_Selection::Selection(myOperationGUI->myGeomGUI->GetActiveStudy()->getSelection()); @@ -133,10 +125,10 @@ bool OperationGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) // purpose : //===================================================================================== void OperationGUI::MakePartitionAndDisplay(const GEOM::GEOM_Gen::ListOfIOR& listShapesIOR, - const GEOM::GEOM_Gen::ListOfIOR& listToolsIOR, - const GEOM::GEOM_Gen::ListOfIOR& listKeepInsIOR, - const GEOM::GEOM_Gen::ListOfIOR& listRemoveInsIOR, - const GEOM::shape_type limit) + const GEOM::GEOM_Gen::ListOfIOR& listToolsIOR, + const GEOM::GEOM_Gen::ListOfIOR& listKeepInsIOR, + const GEOM::GEOM_Gen::ListOfIOR& listRemoveInsIOR, + const GEOM::shape_type limit) { try { GEOM::GEOM_Shape_var result = myGeom->Partition(listShapesIOR, listToolsIOR, @@ -147,7 +139,7 @@ void OperationGUI::MakePartitionAndDisplay(const GEOM::GEOM_Gen::ListOfIOR& list return; } result->NameType(tr("GEOM_PARTITION")); - if(myGeomGUI->Display(result)) + if(myGeomBase->Display(result)) myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); return; } @@ -171,7 +163,7 @@ void OperationGUI::Archimede(const Handle(SALOME_InteractiveObject)& IO, const d GEOM::GEOM_Shape_var Result = myGeom->Archimede(Shape, aWeight, aWaterDensity, aMeshingDeflection); Result->NameType(tr("GEOM_PLANE")); - if(myGeomGUI->Display(Result)) { + if(myGeomBase->Display(Result)) { myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); } return; @@ -187,7 +179,7 @@ void OperationGUI::Archimede(const Handle(SALOME_InteractiveObject)& IO, const d GEOM::GEOM_Shape_var Shape = myGeom->GetIORFromString(anIOR->Value()); GEOM::GEOM_Shape_var Result = myGeom->Archimede(Shape, aWeight, aWaterDensity, aMeshingDeflection); Result->NameType(tr("GEOM_PLANE")); - if (myGeomGUI->Display(Result)) { + if (myGeomBase->Display(Result)) { myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); } } @@ -229,10 +221,10 @@ bool OperationGUI::OnFilletGetAll(const TopoDS_Shape& ShapeTopo, const double Ra } TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result); Standard_CString type; - myGeomGUI->GetShapeTypeString(S,type); + myGeomBase->GetShapeTypeString(S,type); result->NameType(type); - if(myGeomGUI->Display(result)) + if(myGeomBase->Display(result)) myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch (const SALOME::SALOME_Exception& S_ex) { @@ -276,7 +268,7 @@ bool OperationGUI::OnFilletGetSelected(const TopoDS_Shape& ShapeTopo, const char while(Exp.More()) { if(M.Add(Exp.Current())) { /* if a new edge : do not add doublons indices */ ListOfID->length(i + 1); - ListOfID[i] = myGeomGUI->GetIndex(Exp.Current(), ShapeTopo, (int)TopAbs_EDGE); + ListOfID[i] = myGeomBase->GetIndex(Exp.Current(), ShapeTopo, (int)TopAbs_EDGE); i++; } Exp.Next(); @@ -284,7 +276,7 @@ bool OperationGUI::OnFilletGetSelected(const TopoDS_Shape& ShapeTopo, const char } else { ListOfID->length(i + 1); - ListOfID[i] = myGeomGUI->GetIndex(ic->SelectedShape(), ShapeTopo, SubShapeType); + ListOfID[i] = myGeomBase->GetIndex(ic->SelectedShape(), ShapeTopo, SubShapeType); i++; } ic->NextSelected(); @@ -301,10 +293,10 @@ bool OperationGUI::OnFilletGetSelected(const TopoDS_Shape& ShapeTopo, const char TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, aResult); Standard_CString type; - myGeomGUI->GetShapeTypeString(S,type); + myGeomBase->GetShapeTypeString(S,type); aResult->NameType(type); - if(myGeomGUI->Display(aResult)) + if(myGeomBase->Display(aResult)) myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { @@ -317,7 +309,7 @@ bool OperationGUI::OnFilletGetSelected(const TopoDS_Shape& ShapeTopo, const char myUseLocalContext = false; } - GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); + DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->OnDisplayAll(true) ; myGeomGUI->GetActiveStudy()->updateObjBrowser(); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_READY")); @@ -357,10 +349,10 @@ bool OperationGUI::OnChamferGetAll(const TopoDS_Shape& ShapeTopo, const double D TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result); Standard_CString type; - myGeomGUI->GetShapeTypeString(S,type); + myGeomBase->GetShapeTypeString(S,type); result->NameType(type); - if(myGeomGUI->Display(result)) + if(myGeomBase->Display(result)) myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch (const SALOME::SALOME_Exception& S_ex) { @@ -404,7 +396,7 @@ bool OperationGUI::OnChamferGetSelected(const TopoDS_Shape& ShapeTopo, const cha while(Exp.More()) { if(M.Add(Exp.Current())) { /* if a new edge : do not add doublons indices */ ListOfID->length(i + 1); - ListOfID[i] = myGeomGUI->GetIndex(Exp.Current(), ShapeTopo, (int)TopAbs_EDGE); + ListOfID[i] = myGeomBase->GetIndex(Exp.Current(), ShapeTopo, (int)TopAbs_EDGE); i++; } Exp.Next(); @@ -412,7 +404,7 @@ bool OperationGUI::OnChamferGetSelected(const TopoDS_Shape& ShapeTopo, const cha } else { ListOfID->length(i + 1); - ListOfID[i] = myGeomGUI->GetIndex(ic->SelectedShape(), ShapeTopo, SubShapeType); + ListOfID[i] = myGeomBase->GetIndex(ic->SelectedShape(), ShapeTopo, SubShapeType); i++; } ic->NextSelected(); @@ -429,10 +421,10 @@ bool OperationGUI::OnChamferGetSelected(const TopoDS_Shape& ShapeTopo, const cha TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, aResult); Standard_CString type; - myGeomGUI->GetShapeTypeString(S,type); + myGeomBase->GetShapeTypeString(S,type); aResult->NameType(type); - if(myGeomGUI->Display(aResult)) + if(myGeomBase->Display(aResult)) myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { @@ -445,7 +437,7 @@ bool OperationGUI::OnChamferGetSelected(const TopoDS_Shape& ShapeTopo, const cha myUseLocalContext = false; } - GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); + DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->OnDisplayAll(true) ; myGeomGUI->GetActiveStudy()->updateObjBrowser(); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_READY")); diff --git a/src/OperationGUI/OperationGUI.h b/src/OperationGUI/OperationGUI.h index da0dc160f..c30dc16f7 100644 --- a/src/OperationGUI/OperationGUI.h +++ b/src/OperationGUI/OperationGUI.h @@ -29,7 +29,7 @@ #ifndef OPERATIONGUI_H #define OPERATIONGUI_H -#include "GEOMBase_Display.h" +#include "GEOMBase.h" //================================================================================= // class : OperationGUI @@ -43,7 +43,6 @@ public : OperationGUI(); ~OperationGUI(); - static OperationGUI* GetOrCreateGUI(); static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); void MakePartitionAndDisplay(const GEOM::GEOM_Gen::ListOfIOR& listShapesIOR, @@ -70,7 +69,8 @@ public : Standard_Integer& aLocalContextId, bool& myUseLocalContext); - GEOMBase_Context* myGeomGUI; + GEOMBase* myGeomBase; + GEOMContext* myGeomGUI; GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ }; diff --git a/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx b/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx index 97fe98870..f75fd01ec 100644 --- a/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx +++ b/src/OperationGUI/OperationGUI_ArchimedeDlg.cxx @@ -29,23 +29,7 @@ using namespace std; #include "OperationGUI_ArchimedeDlg.h" -#include "QAD_Tools.h" - -#include "SALOME_InteractiveObject.hxx" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "QAD_Config.h" //================================================================================= // class : OperationGUI_ArchimedeDlg() @@ -54,143 +38,34 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -OperationGUI_ArchimedeDlg::OperationGUI_ArchimedeDlg( QWidget* parent, const char* name, OperationGUI* theOperationGUI, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +OperationGUI_ArchimedeDlg::OperationGUI_ArchimedeDlg(QWidget* parent, const char* name, OperationGUI* theOperationGUI, 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_ARCHIMEDE"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_ARCHIMEDE"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); - if ( !name ) - setName( "OperationGUI_ArchimedeDlg" ); - resize( 303, 219 ); - setCaption( tr( "GEOM_ARCHIMEDE_TITLE" ) ); - setSizeGripEnabled( TRUE ); - OperationGUI_ArchimedeDlgLayout = new QGridLayout( this ); - OperationGUI_ArchimedeDlgLayout->setSpacing( 6 ); - OperationGUI_ArchimedeDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_ARCHIMEDE" ) ); - GroupConstructors->setExclusive( TRUE ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - OperationGUI_ArchimedeDlgLayout->addWidget( GroupConstructors, 0, 0 ); + setCaption(tr("GEOM_ARCHIMEDE_TITLE")); /***************************************************************/ - GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); - GroupButtons->setTitle( tr( "" ) ); - GroupButtons->setColumnLayout(0, Qt::Vertical ); - GroupButtons->layout()->setSpacing( 0 ); - GroupButtons->layout()->setMargin( 0 ); - GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); - GroupButtonsLayout->setAlignment( Qt::AlignTop ); - GroupButtonsLayout->setSpacing( 6 ); - GroupButtonsLayout->setMargin( 11 ); - buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); - buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) ); - buttonCancel->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); - buttonApply = new QPushButton( GroupButtons, "buttonApply" ); - buttonApply->setText( tr( "GEOM_BUT_APPLY" ) ); - buttonApply->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); - QSpacerItem* spacer_1 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_1, 0, 2 ); - buttonOk = new QPushButton( GroupButtons, "buttonOk" ); - buttonOk->setText( tr( "GEOM_BUT_OK" ) ); - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); - OperationGUI_ArchimedeDlgLayout->addWidget( GroupButtons, 2, 0 ); - - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - GroupC1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, GroupC1->sizePolicy().hasHeightForWidth() ) ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setSpacing( 0 ); - GroupC1->layout()->setMargin( 0 ); - GroupC1Layout = new QGridLayout( GroupC1->layout() ); - GroupC1Layout->setAlignment( Qt::AlignTop ); - GroupC1Layout->setSpacing( 6 ); - GroupC1Layout->setMargin( 11 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - LineEditC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2->sizePolicy().hasHeightForWidth() ) ); - LineEditC1A2->setMinimumSize( QSize( 40, 0 ) ); - LineEditC1A2->setMaximumSize( QSize( 32767, 32767 ) ); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - - LineEditC1A3 = new QLineEdit( GroupC1, "LineEditC1A3" ); - LineEditC1A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A3->sizePolicy().hasHeightForWidth() ) ); - LineEditC1A3->setMinimumSize( QSize( 40, 0 ) ); - LineEditC1A3->setMaximumSize( QSize( 32767, 32767 ) ); - GroupC1Layout->addWidget( LineEditC1A3, 2, 2 ); - - LineEditC1A4 = new QLineEdit( GroupC1, "LineEditC1A4" ); - LineEditC1A4->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A4->sizePolicy().hasHeightForWidth() ) ); - LineEditC1A4->setMinimumSize( QSize( 40, 0 ) ); - LineEditC1A4->setMaximumSize( QSize( 32767, 32767 ) ); - GroupC1Layout->addWidget( LineEditC1A4, 3, 2 ); - - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_OBJECTS" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_WEIGHT" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A2->setFrameShape( QLabel::NoFrame ); - TextLabelC1A2->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - - TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" ); - TextLabelC1A3->setText( tr( "GEOM_WATER_DENSITY" ) ); - TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A3->setFrameShape( QLabel::NoFrame ); - TextLabelC1A3->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 ); - - TextLabelC1A4 = new QLabel( GroupC1, "TextLabelC1A4" ); - TextLabelC1A4->setText( tr( "GEOM_MESHING_DEFLECTION" ) ); - TextLabelC1A4->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A4->setFrameShape( QLabel::NoFrame ); - TextLabelC1A4->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A4, 3, 0 ); - - OperationGUI_ArchimedeDlgLayout->addWidget( GroupC1, 1, 0 ); + GroupConstructors->setTitle(tr("GEOM_ARCHIMEDE")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1Sel3Spin(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); + GroupPoints->TextLabel2->setText(tr("GEOM_WEIGHT")); + GroupPoints->TextLabel3->setText(tr("GEOM_WATER_DENSITY")); + GroupPoints->TextLabel4->setText(tr("GEOM_MESHING_DEFLECTION")); + GroupPoints->PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupPoints, 1, 0); /***************************************************************/ + + /* Initialisations */ myOperationGUI = theOperationGUI; - Init(Sel) ; /* Initialisations */ - -/* Move widget on the botton right corner of main widget */ - QAD_Tools::alignWidget(this, parent, AlignBottom | AlignRight); - /* Display Dialog */ - this->show() ; + Init(); } @@ -200,7 +75,7 @@ OperationGUI_ArchimedeDlg::OperationGUI_ArchimedeDlg( QWidget* parent, const ch //================================================================================= OperationGUI_ArchimedeDlg::~OperationGUI_ArchimedeDlg() { - // no need to delete child widgets, Qt does it all for us + // no need to delete child widgets, Qt does it all for us } @@ -208,70 +83,51 @@ OperationGUI_ArchimedeDlg::~OperationGUI_ArchimedeDlg() // function : Init() // purpose : //================================================================================= -void OperationGUI_ArchimedeDlg::Init( SALOME_Selection* Sel ) +void OperationGUI_ArchimedeDlg::Init() { - LineEditC1A2->setMaxLength( 10 ); - LineEditC1A3->setMaxLength( 10 ); - LineEditC1A4->setMaxLength( 10 ); - this->myVa = new QDoubleValidator( 0, +999999.999, 3, LineEditC1A2 ) ; - this->myVb = new QDoubleValidator( 0, +999999.999, 3, LineEditC1A3 ) ; - this->myVc = new QDoubleValidator( 0, +999999.999, 3, LineEditC1A4 ) ; - LineEditC1A2->setValidator( myVa ) ; - LineEditC1A3->setValidator( myVb ) ; - LineEditC1A4->setValidator( myVc ) ; - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - - this->myWeight = 100.0 ; - LineEditC1A2->setText("100.0") ; - this->myWaterDensity = 1.0 ; - LineEditC1A3->setText("1.0") ; - this->myMeshingDeflection = 0.01 ; - LineEditC1A4->setText("0.01") ; - - myOkWeight = myOkWaterDensity = myOkMeshingDeflection = true ; - myOkIO = false ; - - myGeomGUI = GEOMBase_Context::GetGeomGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; - /* signals and slots connections */ - connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; - connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); + myWeight = 100.0; + myWaterDensity = 1.0; + myMeshingDeflection = 0.01; + myOkIO = false; - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; + /* Get setting of step value from file configuration */ + QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); + step = St.toDouble(); - connect( LineEditC1A2, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ; - connect( LineEditC1A3, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ; - connect( LineEditC1A4, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ; + /* min, max, step and decimals for spin boxes & initial values */ + GroupPoints->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); + GroupPoints->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, step, 3); + GroupPoints->SpinBox_DZ->RangeStepAndValidator(0.001, 999.999, step, 3); - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - /* to close dialog if study change */ - connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); + GroupPoints->SpinBox_DX->SetValue(myWeight); + GroupPoints->SpinBox_DY->SetValue(myWaterDensity); + GroupPoints->SpinBox_DZ->SetValue(myMeshingDeflection); - return ; -} + /* signals and slots connections */ + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(GroupPoints->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void OperationGUI_ArchimedeDlg::ConstructorsClicked(int constructorId) -{ - return ; + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DZ, SLOT(SetStep(double))); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; + + /* displays Dialog */ + GroupPoints->show(); + this->show(); + + return; } @@ -281,10 +137,9 @@ void OperationGUI_ArchimedeDlg::ConstructorsClicked(int constructorId) //================================================================================= void OperationGUI_ArchimedeDlg::ClickOnOk() { - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; + this->ClickOnApply(); + ClickOnCancel(); + return; } @@ -294,30 +149,10 @@ void OperationGUI_ArchimedeDlg::ClickOnOk() //================================================================================= void OperationGUI_ArchimedeDlg::ClickOnApply() { - switch(myConstructorId) - { - case 0 : - { - if(myOkIO && myOkWeight && myOkWaterDensity && myOkMeshingDeflection ) { - myOperationGUI->Archimede( myIO, myWeight, myWaterDensity, myMeshingDeflection ); - } - } - break ; - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void OperationGUI_ArchimedeDlg::ClickOnCancel() -{ - myGeomGUI->ResetState() ; - reject() ; - return ; + myGeomGUI->GetDesktop()->putInfo(tr("")); + if(myOkIO) + myOperationGUI->Archimede(myIO, myWeight, myWaterDensity, myMeshingDeflection); + return; } @@ -327,100 +162,55 @@ void OperationGUI_ArchimedeDlg::ClickOnCancel() //================================================================================= void OperationGUI_ArchimedeDlg::SelectionIntoArgument() { - myEditCurrentArgument->setText("") ; - QString aString = ""; + myEditCurrentArgument->setText(""); + QString aString = ""; /* name of selection */ - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel != 1 ) { - myEditCurrentArgument->setText("") ; - myOkIO = false ; + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if (nbSel != 1) { + myOkIO = false; + return; } else { - myEditCurrentArgument->setText(aString) ; + myEditCurrentArgument->setText(aString); myIO = mySelection->firstIObject(); - myOkIO = true ; + myOkIO = true; } - return ; + return; } //================================================================================= -// function : SetEditCurrentArgument() +// function : LineEditReturnPressed() // purpose : //================================================================================= -void OperationGUI_ArchimedeDlg::SetEditCurrentArgument() +void OperationGUI_ArchimedeDlg::LineEditReturnPressed() { - QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - SelectionIntoArgument() ; - break; - } - } - return ; + QLineEdit* send = (QLineEdit*)sender(); + if(send == GroupPoints->LineEdit1) + myEditCurrentArgument = GroupPoints->LineEdit1; + else + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; } //================================================================================= -// function : TextChangedInLineEdit() +// function : SetEditCurrentArgument() // purpose : //================================================================================= -void OperationGUI_ArchimedeDlg::TextChangedInLineEdit(const QString& newText) +void OperationGUI_ArchimedeDlg::SetEditCurrentArgument() { - QLineEdit* send = (QLineEdit*)sender(); - QString newT = strdup(newText) ; - int i ; - - if(send == LineEditC1A2) { - if( myVa->validate(newT, i) == myVa->Acceptable ) { - this->myWeight = newText.toFloat() ; - myOkWeight = true ; - } - else { - myOkWeight = false ; - } - } - else if(send == LineEditC1A3) { - if( myVb->validate(newT, i) == myVb->Acceptable ) { - this->myWaterDensity = newText.toFloat() ; - myOkWaterDensity = true ; - } - else { - myOkWaterDensity = false ; - } - } - else if(send == LineEditC1A4) { - if( myVc->validate(newT, i) == myVc->Acceptable ) { - this->myMeshingDeflection = newText.toFloat() ; - myOkMeshingDeflection = true ; - } - else { - myOkMeshingDeflection = false ; - } - } - - return ; -} - + QPushButton* send = (QPushButton*)sender(); -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void OperationGUI_ArchimedeDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + this->SelectionIntoArgument(); } - return ; + + return; } @@ -430,12 +220,9 @@ void OperationGUI_ArchimedeDlg::DeactivateActiveDialog() //================================================================================= void OperationGUI_ArchimedeDlg::ActivateThisDialog() { - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - return ; + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + return; } @@ -445,22 +232,27 @@ void OperationGUI_ArchimedeDlg::ActivateThisDialog() //================================================================================= void OperationGUI_ArchimedeDlg::enterEvent(QEvent* e) { - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; } //================================================================================= -// function : closeEvent() +// function : ValueChangedInSpinBox() // purpose : //================================================================================= -void OperationGUI_ArchimedeDlg::closeEvent( QCloseEvent* e ) +void OperationGUI_ArchimedeDlg::ValueChangedInSpinBox(double newValue) { - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; -} + QObject* send = (QObject*)sender(); + if(send == GroupPoints->SpinBox_DX) + myWeight = newValue; + else if(send == GroupPoints->SpinBox_DY) + myWaterDensity = newValue; + else if(send == GroupPoints->SpinBox_DZ) + myMeshingDeflection = newValue; + return; +} diff --git a/src/OperationGUI/OperationGUI_ArchimedeDlg.h b/src/OperationGUI/OperationGUI_ArchimedeDlg.h index 6ed596c9a..a9a14a1fe 100644 --- a/src/OperationGUI/OperationGUI_ArchimedeDlg.h +++ b/src/OperationGUI/OperationGUI_ArchimedeDlg.h @@ -29,97 +29,50 @@ #ifndef DIALOGBOX_ARCHIMEDE_H #define DIALOGBOX_ARCHIMEDE_H -#include "OperationGUI.h" - -#include -#include -#include +#include "GEOMBase_Skeleton.h" +#include "DlgRef_1Sel3Spin.h" -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; +#include "OperationGUI.h" +//#include "SALOME_InteractiveObject.hxx" //================================================================================= // class : OperationGUI_ArchimedeDlg // purpose : //================================================================================= -class OperationGUI_ArchimedeDlg : public QDialog +class OperationGUI_ArchimedeDlg : public GEOMBase_Skeleton { Q_OBJECT public: - OperationGUI_ArchimedeDlg( QWidget* parent = 0, const char* name = 0, OperationGUI* theOperationGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + OperationGUI_ArchimedeDlg(QWidget* parent = 0, const char* name = 0, OperationGUI* theOperationGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); ~OperationGUI_ArchimedeDlg(); private: - OperationGUI* myOperationGUI; - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ + void Init(); + void enterEvent(QEvent* e); - Handle(SALOME_InteractiveObject) myIO ; + double step; - Standard_Real myWeight ; - Standard_Real myWaterDensity ; - Standard_Real myMeshingDeflection ; - - bool myOkIO ; - bool myOkWeight ; - bool myOkWaterDensity ; - bool myOkMeshingDeflection ; - - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ + OperationGUI* myOperationGUI; - QDoubleValidator *myVa ; /* Double validator for numeric input */ - QDoubleValidator *myVb ; /* Double validator for numeric input */ - QDoubleValidator *myVc ; /* Double validator for numeric input */ + Handle(SALOME_InteractiveObject) myIO; + Standard_Real myWeight; + Standard_Real myWaterDensity; + Standard_Real myMeshingDeflection; + bool myOkIO; - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QGroupBox* GroupC1; - QLineEdit* LineEditC1A1; - QLineEdit* LineEditC1A2; - QLineEdit* LineEditC1A3; - QLineEdit* LineEditC1A4; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; - QLabel* TextLabelC1A3; - QLabel* TextLabelC1A4; + DlgRef_1Sel3Spin* GroupPoints; private slots: - - void ConstructorsClicked(int constructorId); void ClickOnOk(); - void ClickOnCancel(); void ClickOnApply(); - void SetEditCurrentArgument() ; - void TextChangedInLineEdit(const QString&) ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; + void ActivateThisDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ValueChangedInSpinBox(double newValue); -protected: - QGridLayout* OperationGUI_ArchimedeDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; }; #endif // DIALOGBOX_ARCHIMEDE_H diff --git a/src/OperationGUI/OperationGUI_ChamferDlg.cxx b/src/OperationGUI/OperationGUI_ChamferDlg.cxx index eed5428f9..26cb4de39 100644 --- a/src/OperationGUI/OperationGUI_ChamferDlg.cxx +++ b/src/OperationGUI/OperationGUI_ChamferDlg.cxx @@ -29,33 +29,16 @@ using namespace std; #include "OperationGUI_ChamferDlg.h" +#include "DisplayGUI.h" #include "QAD_Config.h" #include "QAD_RightFrame.h" #include "OCCViewer_Viewer3d.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include #include #include #include -#include -#include - //================================================================================= // class : OperationGUI_ChamferDlg() // purpose : Constructs a OperationGUI_ChamferDlg which is a child of 'parent', with the @@ -63,283 +46,51 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -OperationGUI_ChamferDlg::OperationGUI_ChamferDlg( QWidget* parent, - const char* name, - OperationGUI* theOperationGUI, - SALOME_Selection* Sel, - Handle (AIS_InteractiveContext) ic, - bool modal, - WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +OperationGUI_ChamferDlg::OperationGUI_ChamferDlg(QWidget* parent, const char* name, OperationGUI* theOperationGUI, 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_CHAMFER_ALL"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_CHAMFER_EDGE"))); - QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_CHAMFER_FACE"))); - - if ( !name ) - setName( "OperationGUI_ChamferDlg" ); - resize( 365, 220 ); - setCaption( tr( "GEOM_CHAMFER_TITLE" ) ); - setSizeGripEnabled( TRUE ); - OperationGUI_ChamferDlgLayout = new QGridLayout( this ); - OperationGUI_ChamferDlgLayout->setSpacing( 6 ); - OperationGUI_ChamferDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); - GroupButtons->setTitle( tr( "" ) ); - GroupButtons->setColumnLayout(0, Qt::Vertical ); - GroupButtons->layout()->setSpacing( 0 ); - GroupButtons->layout()->setMargin( 0 ); - GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); - GroupButtonsLayout->setAlignment( Qt::AlignTop ); - GroupButtonsLayout->setSpacing( 6 ); - GroupButtonsLayout->setMargin( 11 ); - buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); - buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) ); - buttonCancel->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); - buttonApply = new QPushButton( GroupButtons, "buttonApply" ); - buttonApply->setText( tr( "GEOM_BUT_APPLY" ) ); - buttonApply->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer, 0, 2 ); - buttonOk = new QPushButton( GroupButtons, "buttonOk" ); - buttonOk->setText( tr( "GEOM_BUT_OK" ) ); - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); - OperationGUI_ChamferDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_CHAMFER" ) ); - GroupConstructors->setExclusive( TRUE ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" ); - Constructor2->setText( tr( "" ) ); - Constructor2->setPixmap( image2 ); - Constructor2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor2->sizePolicy().hasHeightForWidth() ) ); - Constructor2->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor2, 0, 2 ); - QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_2, 0, 3 ); - QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_3, 0, 1 ); - Constructor3 = new QRadioButton( GroupConstructors, "Constructor3" ); - Constructor3->setText( tr( "" ) ); - Constructor3->setPixmap( image3 ); - Constructor3->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor3, 0, 4 ); - QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_4, 0, 5 ); - OperationGUI_ChamferDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_CHAMFER_ALL" ) ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setSpacing( 0 ); - GroupC1->layout()->setMargin( 0 ); - GroupC1Layout = new QGridLayout( GroupC1->layout() ); - GroupC1Layout->setAlignment( Qt::AlignTop ); - GroupC1Layout->setSpacing( 6 ); - GroupC1Layout->setMargin( 11 ); - - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_MAIN_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_D1" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A2->setFrameShape( QLabel::NoFrame ); - TextLabelC1A2->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - - TextLabelC1A3 = new QLabel( GroupC1, "TextLabelC1A3" ); - TextLabelC1A3->setText( tr( "GEOM_D2" ) ); - TextLabelC1A3->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A3->setFrameShape( QLabel::NoFrame ); - TextLabelC1A3->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A3, 2, 0 ); - - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - -// LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); -// LineEditC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2->sizePolicy().hasHeightForWidth() ) ); -// GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - -// LineEditC1A3 = new QLineEdit( GroupC1, "LineEditC1A3" ); -// LineEditC1A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A3->sizePolicy().hasHeightForWidth() ) ); -// GroupC1Layout->addWidget( LineEditC1A3, 2, 2 ); - - SpinBox_C1A2 = new DlgRef_SpinBox( GroupC1, "GeomSpinBox_C1A2" ) ; - SpinBox_C1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A2->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( SpinBox_C1A2, 1, 2 ); - - SpinBox_C1A3 = new DlgRef_SpinBox( GroupC1, "GeomSpinBox_C1A3" ) ; - SpinBox_C1A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A3->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( SpinBox_C1A3, 2, 2 ); - - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - SelectButtonC1A1->setMaximumSize( QSize( 28, 32767 ) ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - OperationGUI_ChamferDlgLayout->addWidget( GroupC1, 1, 0 ); - - /***************************************************************/ - GroupC2 = new QGroupBox( this, "GroupC2" ); - GroupC2->setTitle( tr( "GEOM_CHAMFER_EDGES" ) ); - GroupC2->setMinimumSize( QSize( 0, 0 ) ); - GroupC2->setFrameShape( QGroupBox::Box ); - GroupC2->setFrameShadow( QGroupBox::Sunken ); - GroupC2->setColumnLayout(0, Qt::Vertical ); - GroupC2->layout()->setSpacing( 0 ); - GroupC2->layout()->setMargin( 0 ); - GroupC2Layout = new QGridLayout( GroupC2->layout() ); - GroupC2Layout->setAlignment( Qt::AlignTop ); - GroupC2Layout->setSpacing( 6 ); - GroupC2Layout->setMargin( 11 ); - - TextLabelC2A1 = new QLabel( GroupC2, "TextLabelC2A1" ); - TextLabelC2A1->setText( tr( "GEOM_MAIN_OBJECT" ) ); - TextLabelC2A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A1->setFrameShape( QLabel::NoFrame ); - TextLabelC2A1->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A1, 0, 0 ); - - TextLabelC2A2 = new QLabel( GroupC2, "TextLabelC2A2" ); - TextLabelC2A2->setText( tr( "GEOM_D1" ) ); - TextLabelC2A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A2->setFrameShape( QLabel::NoFrame ); - TextLabelC2A2->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A2, 1, 0 ); - - TextLabelC2A3 = new QLabel( GroupC2, "TextLabelC2A3" ); - TextLabelC2A3->setText( tr( "GEOM_D2" ) ); - TextLabelC2A3->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A3->setFrameShape( QLabel::NoFrame ); - TextLabelC2A3->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A3, 2, 0 ); - - LineEditC2A1 = new QLineEdit( GroupC2, "LineEditC2A1" ); - GroupC2Layout->addWidget( LineEditC2A1, 0, 2 ); - - // LineEditC2A2 = new QLineEdit( GroupC2, "LineEditC2A2" ); -// LineEditC2A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC2A2->sizePolicy().hasHeightForWidth() ) ); -// GroupC2Layout->addWidget( LineEditC2A2, 1, 2 ); - -// LineEditC2A3 = new QLineEdit( GroupC2, "LineEditC2A3" ); -// LineEditC2A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC2A3->sizePolicy().hasHeightForWidth() ) ); -// GroupC2Layout->addWidget( LineEditC2A3, 2, 2 ); - - SpinBox_C2A2 = new DlgRef_SpinBox( GroupC2, "GeomSpinBox_C2A2" ) ; - SpinBox_C2A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A2->sizePolicy().hasHeightForWidth() ) ); - GroupC2Layout->addWidget( SpinBox_C2A2, 1, 2 ); - - SpinBox_C2A3 = new DlgRef_SpinBox( GroupC2, "GeomSpinBox_C2A3" ) ; - SpinBox_C2A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A3->sizePolicy().hasHeightForWidth() ) ); - GroupC2Layout->addWidget( SpinBox_C2A3, 2, 2 ); - - SelectButtonC2A1 = new QPushButton( GroupC2, "SelectButtonC2A1" ); - SelectButtonC2A1->setText( tr( "" ) ); - SelectButtonC2A1->setPixmap( image1 ); - SelectButtonC2A1->setToggleButton( FALSE ); - SelectButtonC2A1->setMaximumSize( QSize( 28, 32767 ) ); - GroupC2Layout->addWidget( SelectButtonC2A1, 0, 1 ); - OperationGUI_ChamferDlgLayout->addWidget( GroupC2, 1, 0 ); - - /***************************************************************/ - GroupC3 = new QGroupBox( this, "GroupC3" ); - GroupC3->setTitle( tr( "GEOM_CHAMFER_FACES" ) ); - GroupC3->setMinimumSize( QSize( 0, 0 ) ); - GroupC3->setFrameShape( QGroupBox::Box ); - GroupC3->setFrameShadow( QGroupBox::Sunken ); - GroupC3->setColumnLayout(0, Qt::Vertical ); - GroupC3->layout()->setSpacing( 0 ); - GroupC3->layout()->setMargin( 0 ); - GroupC3Layout = new QGridLayout( GroupC3->layout() ); - GroupC3Layout->setAlignment( Qt::AlignTop ); - GroupC3Layout->setSpacing( 6 ); - GroupC3Layout->setMargin( 11 ); - - TextLabelC3A1 = new QLabel( GroupC3, "TextLabelC3A1" ); - TextLabelC3A1->setText( tr( "GEOM_MAIN_OBJECT" ) ); - TextLabelC3A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC3A1->setFrameShape( QLabel::NoFrame ); - TextLabelC3A1->setFrameShadow( QLabel::Plain ); - GroupC3Layout->addWidget( TextLabelC3A1, 0, 0 ); - - TextLabelC3A2 = new QLabel( GroupC3, "TextLabelC3A2" ); - TextLabelC3A2->setText( tr( "GEOM_D1" ) ); - TextLabelC3A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC3A2->setFrameShape( QLabel::NoFrame ); - TextLabelC3A2->setFrameShadow( QLabel::Plain ); - GroupC3Layout->addWidget( TextLabelC3A2, 1, 0 ); - - TextLabelC3A3 = new QLabel( GroupC3, "TextLabelC3A3" ); - TextLabelC3A3->setText( tr( "GEOM_D2" ) ); - TextLabelC3A3->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC3A3->setFrameShape( QLabel::NoFrame ); - TextLabelC3A3->setFrameShadow( QLabel::Plain ); - GroupC3Layout->addWidget( TextLabelC3A3, 2, 0 ); - - LineEditC3A1 = new QLineEdit( GroupC3, "LineEditC3A1" ); - GroupC3Layout->addWidget( LineEditC3A1, 0, 2 ); - - // LineEditC3A2 = new QLineEdit( GroupC3, "LineEditC3A2" ); -// LineEditC3A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC3A2->sizePolicy().hasHeightForWidth() ) ); -// GroupC3Layout->addWidget( LineEditC3A2, 1, 2 ); - -// LineEditC3A3 = new QLineEdit( GroupC3, "LineEditC3A3" ); -// LineEditC3A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC3A3->sizePolicy().hasHeightForWidth() ) ); -// GroupC3Layout->addWidget( LineEditC3A3, 2, 2 ); - - SpinBox_C3A2 = new DlgRef_SpinBox( GroupC3, "GeomSpinBox_C3A2" ) ; - SpinBox_C3A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C3A2->sizePolicy().hasHeightForWidth() ) ); - GroupC3Layout->addWidget( SpinBox_C3A2, 1, 2 ); - - SpinBox_C3A3 = new DlgRef_SpinBox( GroupC3, "GeomSpinBox_C3A3" ) ; - SpinBox_C3A3->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C3A3->sizePolicy().hasHeightForWidth() ) ); - GroupC3Layout->addWidget( SpinBox_C3A3, 2, 2 ); - - SelectButtonC3A1 = new QPushButton( GroupC3, "SelectButtonC3A1" ); - SelectButtonC3A1->setText( tr( "" ) ); - SelectButtonC3A1->setPixmap( image1 ); - SelectButtonC3A1->setToggleButton( FALSE ); - SelectButtonC3A1->setMaximumSize( QSize( 28, 32767 ) ); - GroupC3Layout->addWidget( SelectButtonC3A1, 0, 1 ); - OperationGUI_ChamferDlgLayout->addWidget( GroupC3, 1, 0 ); - myOperationGUI = theOperationGUI; - /* Initialisation */ - Init( Sel, ic ) ; + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_ALL"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_EDGE"))); + QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_CHAMFER_FACE"))); + QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_CHAMFER_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_CHAMFER")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->setPixmap(image2); + + Group1 = new DlgRef_1Sel2Spin(this, "Group1"); + Group1->GroupBox1->setTitle(tr("GEOM_CHAMFER_ALL")); + Group1->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); + Group1->TextLabel2->setText(tr("GEOM_D1")); + Group1->TextLabel3->setText(tr("GEOM_D2")); + Group1->PushButton1->setPixmap(image3); + + Group2 = new DlgRef_1Sel2Spin(this, "Group2"); + Group2->GroupBox1->setTitle(tr("GEOM_CHAMFER_EDGES")); + Group2->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); + Group2->TextLabel2->setText(tr("GEOM_D1")); + Group2->TextLabel3->setText(tr("GEOM_D2")); + Group2->PushButton1->setPixmap(image3); + + Group3 = new DlgRef_1Sel2Spin(this, "Group3"); + Group3->GroupBox1->setTitle(tr("GEOM_CHAMFER_FACES")); + Group3->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); + Group3->TextLabel2->setText(tr("GEOM_D1")); + Group3->TextLabel3->setText(tr("GEOM_D2")); + Group3->PushButton1->setPixmap(image3); + + Layout1->addWidget(Group1, 1, 0); + Layout1->addWidget(Group2, 1, 0); + Layout1->addWidget(Group3, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myOperationGUI = theOperationGUI; + Init(ic); } @@ -350,7 +101,6 @@ OperationGUI_ChamferDlg::OperationGUI_ChamferDlg( QWidget* parent, OperationGUI_ChamferDlg::~OperationGUI_ChamferDlg() { /* no need to delete child widgets, Qt does it all for us */ - this->destroy(TRUE, TRUE) ; } @@ -358,164 +108,171 @@ OperationGUI_ChamferDlg::~OperationGUI_ChamferDlg() // function : Init() // purpose : //================================================================================= -void OperationGUI_ChamferDlg::Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) +void OperationGUI_ChamferDlg::Init(Handle (AIS_InteractiveContext) ic) { + /* init variables */ + myConstructorId = 0; + myEditCurrentArgument = Group1->LineEdit1; + + myD1 = 50.0; + myOkD1 = true; + myD2 = 50.0; + myOkD2 = true; + myOkShape = false; + myIC = ic; + myLocalContextId = -1; + myUseLocalContext = false; /* Get setting of step value from file configuration */ - double step ; - QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ; - step = St.toDouble() ; - + QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); + step = St.toDouble(); + /* min, max, step and decimals for spin boxes */ - SpinBox_C1A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; /* myD1 */ - SpinBox_C1A2->SetValue( 50 ) ; - SpinBox_C1A3->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; /* myD2 */ - SpinBox_C1A3->SetValue( 50 ) ; - - SpinBox_C2A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C2A2->SetValue( 50 ) ; - SpinBox_C2A3->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C2A3->SetValue( 50 ) ; - - SpinBox_C3A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C3A2->SetValue( 50 ) ; - SpinBox_C3A3->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C3A3->SetValue( 50 ) ; - - GroupC1->show(); - GroupC2->hide() ; - GroupC3->hide() ; - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - - mySelection = Sel ; - myEditCurrentArgument = LineEditC1A1 ; - myShape.Nullify() ; - myD1 = 50.0 ; - myOkD1 = true ; - myD2 = 50.0 ; - myOkD2 = true ; - myIC = ic ; - myUseLocalContext = false ; - myOkShape = false ; - - myGeomGUI = GEOMBase_Context::GetGeomGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - mySimulationTopoDs.Nullify() ; - - /* Filters definition */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); + Group1->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); + Group2->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); + Group3->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); + Group1->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, step, 3); + Group2->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, step, 3); + Group3->SpinBox_DY->RangeStepAndValidator(0.001, 999.999, step, 3); + + Group1->SpinBox_DX->SetValue(myD1); + Group2->SpinBox_DX->SetValue(myD1); + Group3->SpinBox_DX->SetValue(myD1); + Group1->SpinBox_DY->SetValue(myD2); + Group2->SpinBox_DY->SetValue(myD2); + Group3->SpinBox_DY->SetValue(myD2); /* signals and slots connections */ - connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); - connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; - connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC2A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC3A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( SpinBox_C1A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C2A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C3A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - connect( SpinBox_C1A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C2A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C3A3, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC2A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC3A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - /* to close dialog if study change */ - connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; - - /* Move widget on the botton right corner of main widget */ - int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* Displays Dialog */ - - return ; + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + + connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group3->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group3->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(Group1->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group2->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group3->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group1->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group2->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group3->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group1->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group2->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group1->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group2->SpinBox_DY, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3->SpinBox_DY, SLOT(SetStep(double))); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + Group2->hide(); + Group3->hide(); + Group1->show(); + this->show(); + + return; } - //================================================================================= // function : ConstructorsClicked() // purpose : Radio button management //================================================================================= void OperationGUI_ChamferDlg::ConstructorsClicked(int constructorId) { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - myEditCurrentArgument->setText(tr("")) ; - - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { + myConstructorId = constructorId; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + disconnect(mySelection, 0, this, 0); + myOkShape = false; + myD1 = 50.0; + myD2 = 50.0; + myOkD1 = true; + myOkD2 = true; + + + if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); myIC = v3d->getAISContext(); - if(myUseLocalContext ) { - myIC->CloseLocalContext(this->myLocalContextId); - GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); - myDisplayGUI->OnDisplayAll(true) ; - myUseLocalContext = false ; + if(myUseLocalContext) { + myIC->CloseLocalContext(myLocalContextId); + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); + myUseLocalContext = false; } } - - myOkShape = false ; - myD1 = 50.0 ; - myD2 = 50.0 ; - myOkD1 = true ; - myOkD2 = true ; - myConstructorId = constructorId ; switch (constructorId) { case 0: /* Chamfer All */ { - GroupC1->show(); - GroupC2->hide() ; - GroupC3->hide() ; - myEditCurrentArgument = LineEditC1A1 ; - SpinBox_C1A2->SetValue( 50 ) ; - SpinBox_C1A3->SetValue( 50 ) ; - LineEditC1A1->setText(tr("")) ; + Group2->hide(); + Group3->hide(); + resize(0, 0); + Group1->show(); + + myEditCurrentArgument = Group1->LineEdit1; + Group1->LineEdit1->setText(""); myShapeType = -1; + + Group1->SpinBox_DX->SetValue(myD1); + Group1->SpinBox_DY->SetValue(myD2); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); break; } - case 1: /* Chamfer edges */ { + Group1->hide(); + Group3->hide(); + resize(0, 0); + Group2->show(); + + myEditCurrentArgument = Group2->LineEdit1; + Group2->LineEdit1->setText(""); myShapeType = 6; - GroupC1->hide(); - GroupC2->show() ; - GroupC3->hide() ; - myEditCurrentArgument = LineEditC2A1 ; - SpinBox_C2A2->SetValue( 50 ) ; - SpinBox_C2A3->SetValue( 50 ) ; - LineEditC2A1->setText(tr("")) ; - break ; + + Group2->SpinBox_DX->SetValue(myD1); + Group2->SpinBox_DY->SetValue(myD2); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + break; } - case 2: /* Chamfer Faces */ { + Group1->hide(); + Group2->hide(); + resize(0, 0); + Group3->show(); + + myEditCurrentArgument = Group3->LineEdit1; + Group3->LineEdit1->setText(""); myShapeType = 4; - GroupC1->hide(); - GroupC2->hide() ; - GroupC3->show() ; - myEditCurrentArgument = LineEditC3A1 ; - SpinBox_C3A2->SetValue( 50 ) ; - SpinBox_C3A3->SetValue( 50 ) ; - LineEditC3A1->setText(tr("")) ; - break ; + + Group3->SpinBox_DX->SetValue(myD1); + Group3->SpinBox_DY->SetValue(myD2); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + break; } } - return ; + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void OperationGUI_ChamferDlg::ClickOnOk() +{ + this->ClickOnApply(); + this->ClickOnCancel(); + return; } @@ -525,73 +282,44 @@ void OperationGUI_ChamferDlg::ConstructorsClicked(int constructorId) //================================================================================= void OperationGUI_ChamferDlg::ClickOnApply() { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - bool testResult = false ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; + myGeomGUI->GetDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + bool testResult = false; switch(myConstructorId) { case 0 : /* Chamfer All */ { - if(myOkD1 && myOkD2) { - if( myOkShape ) { - testResult = myOperationGUI->OnChamferGetAll( myShape, myD1, myD2, myShapeType, myShapeIOR ) ; - } - } - if( !testResult ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ; - } - else { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ; - } - /* Reset all arguments and local context to allow user a new selection ...*/ - this->ResetStateOfDialog() ; - break ; + if(myOkD1 && myOkD2 && myOkShape) + testResult = myOperationGUI->OnChamferGetAll(myShape, myD1, myD2, myShapeType, myShapeIOR); + break; } - case 1 : /* Chamfer Edge */ { - if(myOkD1 && myOkD2) { - if( myOkShape ) { - testResult = myOperationGUI->OnChamferGetSelected( myShape, myShapeIOR, myD1, myD2, myShapeType, - myLocalContextId, myUseLocalContext ); - } - } - if( !testResult ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ; - } - else { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ; - } - /* Reset all arguments and local context to allow user a new selection ...*/ - this->ResetStateOfDialog() ; - break ; + if(myOkD1 && myOkD2 && myOkShape) + testResult = myOperationGUI->OnChamferGetSelected(myShape, myShapeIOR, myD1, myD2, myShapeType, + myLocalContextId, myUseLocalContext); + break; } - case 2 : /* Chamfer Face */ { - if(myOkD1 && myOkD2) { - if( myOkShape ) { - testResult = myOperationGUI->OnChamferGetSelected( myShape, myShapeIOR, myD1, myD2, myShapeType, - myLocalContextId, myUseLocalContext ) ; - } - } - if( !testResult ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ; - } - else { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ; - } - /* Reset all arguments and local context to allow user a new selection ...*/ - this->ResetStateOfDialog() ; - break ; + if(myOkD1 && myOkD2 && myOkShape) + testResult = myOperationGUI->OnChamferGetSelected(myShape, myShapeIOR, myD1, myD2, myShapeType, + myLocalContextId, myUseLocalContext); + break; } } - // accept(); - return ; + if(!testResult) + myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + else + myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + /* Reset all arguments and local context to allow user a new selection ...*/ + this->ResetStateOfDialog(); + return; } @@ -601,38 +329,21 @@ void OperationGUI_ChamferDlg::ClickOnApply() //================================================================================= void OperationGUI_ChamferDlg::ClickOnCancel() { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { + if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); myIC = v3d->getAISContext(); - if(this->myUseLocalContext ) { - myIC->CloseLocalContext(this->myLocalContextId) ; - this->myUseLocalContext = false ; - GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); - myDisplayGUI->OnDisplayAll(true) ; + + if(myUseLocalContext) { + myIC->CloseLocalContext(myLocalContextId); + myUseLocalContext = false; + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); } } - - reject() ; - return ; + GEOMBase_Skeleton::ClickOnCancel(); + return; } -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void OperationGUI_ChamferDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; -} //================================================================================= // function : SelectionIntoArgument() @@ -640,66 +351,59 @@ void OperationGUI_ChamferDlg::ClickOnOk() //================================================================================= void OperationGUI_ChamferDlg::SelectionIntoArgument() { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - /* Reset all arguments and local context when selection as changed */ - this->ResetStateOfDialog() ; - - /* Future name of argument */ - QString aString = ""; - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel == 1 ) { - - TopoDS_Shape S ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if( !IO->hasEntry() ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")) ; - return ; + myGeomBase->EraseSimulationShape(); + myEditCurrentArgument->setText(""); + this->ResetStateOfDialog(); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if (nbSel == 1) { + TopoDS_Shape S; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + if(!IO->hasEntry()) { + myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); + return; } - - if ( !S.IsNull() && S.ShapeType() <= 2 ) { - if ( IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) { - Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast( IO ); + + if(!S.IsNull() && S.ShapeType() <= 2) { + if(IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject))) { + Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast(IO); myShapeIOR = GIObject->getIOR(); /* the Geom IOR string of selection */ - myEditCurrentArgument->setText(aString) ; - myShape = S ; - myOkShape = true ; + myEditCurrentArgument->setText(aString); + myShape = S; + myOkShape = true; } - - if ( IO->hasEntry() ) { + + if(IO->hasEntry()) { SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); - SALOMEDS::SObject_var obj = aStudy->FindObjectID( IO->getEntry() ); + SALOMEDS::SObject_var obj = aStudy->FindObjectID(IO->getEntry()); SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeIOR_var anIOR; - if ( !obj->_is_nil() ) { - if (obj->FindAttribute(anAttr, "AttributeIOR")) { + SALOMEDS::AttributeIOR_var anIOR; + if(!obj->_is_nil()) { + if(obj->FindAttribute(anAttr, "AttributeIOR")) { anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); myShapeIOR = anIOR->Value(); - myOkShape = true ; - myShape = S ; - myEditCurrentArgument->setText(aString) ; + myOkShape = true; + myShape = S; + myEditCurrentArgument->setText(aString); } } } - - MakePreview(); - } - } else + this->MakePreview(); + + } + else return; - if( myOkShape && myShapeType!=-1 && myConstructorId != 0 ) { + if(myOkShape && myShapeType!=-1 && myConstructorId != 0) { /* local context is defined into the method */ - myGeomGUI->PrepareSubShapeSelection( this->myShapeType, this->myLocalContextId ) ; - myUseLocalContext = true ; - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_EDGE")) ; - } + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->PrepareSubShapeSelection(myShapeType, myLocalContextId); + myUseLocalContext = true; + } } @@ -709,25 +413,18 @@ void OperationGUI_ChamferDlg::SelectionIntoArgument() //================================================================================= void OperationGUI_ChamferDlg::LineEditReturnPressed() { - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC2A1 ) - myEditCurrentArgument = LineEditC2A1 ; - else if ( send == LineEditC3A1 ) - myEditCurrentArgument = LineEditC3A1 ; + QLineEdit* send = (QLineEdit*)sender(); + if(send == Group1->LineEdit1) + myEditCurrentArgument = Group1->LineEdit1; + else if (send == Group2->LineEdit1) + myEditCurrentArgument = Group2->LineEdit1; + else if (send == Group3->LineEdit1) + myEditCurrentArgument = Group3->LineEdit1; else - return ; - - /* User name of object input management */ - /* If successfull the selection is changed and signal emitted... */ - /* so SelectionIntoArgument() is automatically called. */ - const QString objectUserName = myEditCurrentArgument->text() ; - QWidget* thisWidget = (QWidget*)this ; - if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; - } - return ; + return; + + GEOMBase_Skeleton::LineEditReturnPressed(); + return; } @@ -739,88 +436,36 @@ void OperationGUI_ChamferDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - SelectionIntoArgument() ; - } - break; - } - - case 1: - { - if(send ==SelectButtonC2A1 ) { - LineEditC2A1->setFocus() ; - myEditCurrentArgument = LineEditC2A1; - SelectionIntoArgument() ; - } - break; - } - - case 2: - { - if(send ==SelectButtonC3A1 ) { - LineEditC3A1->setFocus() ; - myEditCurrentArgument = LineEditC3A1; - SelectionIntoArgument() ; - } - break; - } - - } - return ; -} - -//================================================================================= -// function : ValueChangedInSpinBox() -// purpose : -//================================================================================= -void OperationGUI_ChamferDlg::ValueChangedInSpinBox( double newValue ) -{ - QObject* send = (QObject*)sender(); - - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - - if( send == SpinBox_C1A2 || send == SpinBox_C2A2 || send == SpinBox_C3A2 ) { /* D1 */ - myD1 = newValue ; - myOkD1 = true ; - MakePreview(); - return ; - } - if( send == SpinBox_C1A3 || send == SpinBox_C2A3 || send == SpinBox_C3A3 ) { /* D2 */ - myD2 = newValue ; - myOkD2 = true ; - MakePreview(); - return ; + if(send == Group1->PushButton1) { + Group1->LineEdit1->setFocus(); + myEditCurrentArgument = Group1->LineEdit1; + } + else if(send == Group2->PushButton1) { + Group2->LineEdit1->setFocus(); + myEditCurrentArgument = Group2->LineEdit1; } + else if(send == Group3->PushButton1) { + Group3->LineEdit1->setFocus(); + myEditCurrentArgument = Group3->LineEdit1; + } + this->SelectionIntoArgument(); + return; } + //================================================================================= // function : DeactivateActiveDialog() // purpose : //================================================================================= void OperationGUI_ChamferDlg::DeactivateActiveDialog() { - if ( GroupConstructors->isEnabled() ) { - this->ResetStateOfDialog() ; - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupC2->setEnabled(false) ; - GroupC3->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - myGeomGUI->SetActiveDialogBox(0) ; - GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); - myDisplayGUI->OnDisplayAll(true) ; + if(GroupConstructors->isEnabled()) { + GEOMBase_Skeleton::DeactivateActiveDialog(); + this->ResetStateOfDialog(); + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); } - return ; + return; } @@ -830,20 +475,11 @@ void OperationGUI_ChamferDlg::DeactivateActiveDialog() //================================================================================= void OperationGUI_ChamferDlg::ActivateThisDialog() { - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupC2->setEnabled(true) ; - GroupC3->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; } @@ -851,12 +487,12 @@ void OperationGUI_ChamferDlg::ActivateThisDialog() // function : enterEvent() // purpose : //================================================================================= -void OperationGUI_ChamferDlg::enterEvent( QEvent* e) +void OperationGUI_ChamferDlg::enterEvent(QEvent* e) { - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; } @@ -864,11 +500,37 @@ void OperationGUI_ChamferDlg::enterEvent( QEvent* e) // function : closeEvent() // purpose : //================================================================================= -void OperationGUI_ChamferDlg::closeEvent( QCloseEvent* e ) +void OperationGUI_ChamferDlg::closeEvent(QCloseEvent* e) { /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; + this->ClickOnCancel(); + return; +} + + +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void OperationGUI_ChamferDlg::ValueChangedInSpinBox( double newValue ) +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + QObject* send = (QObject*)sender(); + if(send == Group1->SpinBox_DX || send == Group2->SpinBox_DX || send == Group3->SpinBox_DX) { /* D1 */ + myD1 = newValue; + myOkD1 = true; + this->MakePreview(); + return ; + } + else if(send == Group1->SpinBox_DY || send == Group2->SpinBox_DY || send == Group3->SpinBox_DY) { /* D2 */ + myD2 = newValue; + myOkD2 = true; + this->MakePreview(); + return; + } + return; } @@ -878,58 +540,58 @@ void OperationGUI_ChamferDlg::closeEvent( QCloseEvent* e ) //================================================================================= void OperationGUI_ChamferDlg::ResetStateOfDialog() { - this->myOkShape = false ; - this->myEditCurrentArgument->setText("") ; + myOkShape = false; + myEditCurrentArgument->setText(""); /* Close its local contact if opened */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { + if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); myIC = v3d->getAISContext(); - if(this->myUseLocalContext) { - myIC->CloseLocalContext(this->myLocalContextId) ; - this->myUseLocalContext = false ; - GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); - myDisplayGUI->OnDisplayAll(true) ; + + if(myUseLocalContext) { + myIC->CloseLocalContext(myLocalContextId); + myUseLocalContext = false; + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); } } - return ; + return; } + +//================================================================================= +// function : MakePreview() +// purpose : +//================================================================================= void OperationGUI_ChamferDlg::MakePreview() { - TopoDS_Shape tds ; - try - { - BRepFilletAPI_MakeChamfer MC(myShape); - switch (myConstructorId) - { - case 0: /* Chamfer All */ + TopoDS_Shape tds; + try { + BRepFilletAPI_MakeChamfer MC(myShape); + switch (myConstructorId) { - TopTools_IndexedDataMapOfShapeListOfShape M; - TopExp::MapShapesAndAncestors(myShape,TopAbs_EDGE,TopAbs_FACE,M); - for (int i = 1;i<=M.Extent();i++) - { + case 0: /* Chamfer All */ + { + TopTools_IndexedDataMapOfShapeListOfShape M; + TopExp::MapShapesAndAncestors(myShape,TopAbs_EDGE,TopAbs_FACE,M); + for(int i = 1;i<=M.Extent();i++) { TopoDS_Edge E = TopoDS::Edge(M.FindKey(i)); TopoDS_Face F = TopoDS::Face(M.FindFromIndex(i).First()); - if (!BRepTools::IsReallyClosed(E, F) && !BRep_Tool::Degenerated(E)) + if(!BRepTools::IsReallyClosed(E, F) && !BRep_Tool::Degenerated(E)) MC.Add(myD1, myD2,E,F); } - tds = MC.Shape(); - break; + tds = MC.Shape(); + break; + } } -// case 1: /* Chamfer edges */ -// case 2: /* Chamfer Faces */ - } - if (!tds.IsNull()) - { + if(!tds.IsNull()) { mySimulationTopoDs = tds; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - } - - } - catch(Standard_Failure) - { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); } + } + catch(Standard_Failure) { + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + } + return; } diff --git a/src/OperationGUI/OperationGUI_ChamferDlg.h b/src/OperationGUI/OperationGUI_ChamferDlg.h index 20c6d5a5b..eeca5c509 100644 --- a/src/OperationGUI/OperationGUI_ChamferDlg.h +++ b/src/OperationGUI/OperationGUI_ChamferDlg.h @@ -29,144 +29,67 @@ #ifndef DIALOGBOX_CHAMFER_H #define DIALOGBOX_CHAMFER_H -#include "OperationGUI.h" - -#include "DlgRef_SpinBox.h" - -// Qt Includes -#include -#include -#include +#include "GEOMBase_Skeleton.h" +#include "DlgRef_1Sel2Spin.h" -// Open CASCADE Includes -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QFrame; -class QGroupBox; -class QLineEdit; -class QPushButton; -class QRadioButton; -class QToolButton; -class QLabel; -class OperationGUI; +#include "OperationGUI.h" //================================================================================= // class : OperationGUI_ChamferDlg // purpose : //================================================================================= -class OperationGUI_ChamferDlg : public QDialog +class OperationGUI_ChamferDlg : public GEOMBase_Skeleton { Q_OBJECT public: - OperationGUI_ChamferDlg( QWidget* parent = 0, - const char* name = 0, - OperationGUI* theOperationGUI = 0, - SALOME_Selection* Sel = 0, - Handle (AIS_InteractiveContext) ic = 0, - bool modal = FALSE, - WFlags fl = 0 ); - + OperationGUI_ChamferDlg(QWidget* parent = 0, const char* name = 0, OperationGUI* theOperationGUI = 0, SALOME_Selection* Sel = 0, Handle(AIS_InteractiveContext) ic = 0, bool modal = FALSE, WFlags fl = 0); ~OperationGUI_ChamferDlg(); private : - OperationGUI* myOperationGUI; - void Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void ResetStateOfDialog() ; + void Init(Handle(AIS_InteractiveContext) ic); + void enterEvent(QEvent* e); + void closeEvent(QCloseEvent* e); + void MakeFilletSimulationAndDisplay(); - /* Interactive and local context management see also : bool myUseLocalContext() */ - Handle (AIS_InteractiveContext) myIC ; /* Interactive context */ - Standard_Integer myLocalContextId ; /* identify a local context used by this method */ - bool myUseLocalContext ; /* true when this method as opened a local context */ - - QDoubleValidator *myVa ; /* Double validator for numeric input */ - QDoubleValidator *myVb ; /* Double validator for numeric input */ - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - - TopoDS_Shape myShape ; - bool myOkShape ; - char* myShapeIOR ; - - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - int myShapeType ; - - TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */ + void ResetStateOfDialog(); void MakePreview(); - bool myOkD1 ; - double myD1 ; - bool myOkD2 ; - double myD2 ; - - QButtonGroup* GroupConstructors; + OperationGUI* myOperationGUI; - QRadioButton* Constructor1; - QRadioButton* Constructor2; - QRadioButton* Constructor3; + double step; + int myConstructorId; /* Current constructor id = radio button id */ - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; - - QGroupBox* GroupC1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - QLabel* TextLabelC1A1; - DlgRef_SpinBox* SpinBox_C1A2 ; - QLabel* TextLabelC1A2; - DlgRef_SpinBox* SpinBox_C1A3 ; - QLabel* TextLabelC1A3; - - QGroupBox* GroupC2; - QPushButton* SelectButtonC2A1; - QLineEdit* LineEditC2A1; - QLabel* TextLabelC2A1; - DlgRef_SpinBox* SpinBox_C2A2 ; - QLabel* TextLabelC2A2; - DlgRef_SpinBox* SpinBox_C2A3; - QLabel* TextLabelC2A3; - - QGroupBox* GroupC3; - QPushButton* SelectButtonC3A1; - QLineEdit* LineEditC3A1; - QLabel* TextLabelC3A1; - DlgRef_SpinBox* SpinBox_C3A2 ; - QLabel* TextLabelC3A2; - DlgRef_SpinBox* SpinBox_C3A3; - QLabel* TextLabelC3A3; + /* Interactive and local context management see also : bool myUseLocalContext() */ + Handle(AIS_InteractiveContext) myIC; /* Interactive context */ + Standard_Integer myLocalContextId; /* identify a local context used by this method */ + bool myUseLocalContext; /* true when this method as opened a local context */ + + TopoDS_Shape myShape; + bool myOkShape; + char* myShapeIOR; + int myShapeType; + bool myOkD1; + double myD1; + bool myOkD2; + double myD2; + + DlgRef_1Sel2Spin* Group1; + DlgRef_1Sel2Spin* Group2; + DlgRef_1Sel2Spin* Group3; private slots: - - void ConstructorsClicked(int constructorId); void ClickOnOk(); - void ClickOnCancel(); void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void LineEditReturnPressed() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: + void ClickOnCancel(); + void ActivateThisDialog(); + void DeactivateActiveDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ValueChangedInSpinBox(double newValue); + void ConstructorsClicked(int constructorId); - QGridLayout* OperationGUI_ChamferDlgLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; - QGridLayout* GroupC2Layout; - QGridLayout* GroupC3Layout; }; #endif // DIALOGBOX_CHAMFER_H diff --git a/src/OperationGUI/OperationGUI_FilletDlg.cxx b/src/OperationGUI/OperationGUI_FilletDlg.cxx index bfb89127d..0fe04bbc7 100644 --- a/src/OperationGUI/OperationGUI_FilletDlg.cxx +++ b/src/OperationGUI/OperationGUI_FilletDlg.cxx @@ -29,33 +29,14 @@ using namespace std; #include "OperationGUI_FilletDlg.h" - +#include "DisplayGUI.h" #include "QAD_Config.h" #include "QAD_RightFrame.h" #include "OCCViewer_Viewer3d.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - #include #include -#include -#include - - //================================================================================= // class : OperationGUI_FilletDlg() // purpose : Constructs a OperationGUI_FilletDlg which is a child of 'parent', with the @@ -63,227 +44,48 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -OperationGUI_FilletDlg::OperationGUI_FilletDlg( QWidget* parent, - const char* name, - OperationGUI* theOperationGUI, - SALOME_Selection* Sel, - Handle (AIS_InteractiveContext) ic, - bool modal, - WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +OperationGUI_FilletDlg::OperationGUI_FilletDlg(QWidget* parent, const char* name, OperationGUI* theOperationGUI, 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_FILLET_ALL"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_FILLET_EDGE"))); - QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_DLG_FILLET_FACE"))); - - if ( !name ) - setName( "OperationGUI_FilletDlg" ); - resize( 365, 220 ); - setCaption( tr( "GEOM_FILLET_TITLE" ) ); - setSizeGripEnabled( TRUE ); - OperationGUI_FilletDlgLayout = new QGridLayout( this ); - OperationGUI_FilletDlgLayout->setSpacing( 6 ); - OperationGUI_FilletDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); - GroupButtons->setTitle( tr( "" ) ); - GroupButtons->setColumnLayout(0, Qt::Vertical ); - GroupButtons->layout()->setSpacing( 0 ); - GroupButtons->layout()->setMargin( 0 ); - GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); - GroupButtonsLayout->setAlignment( Qt::AlignTop ); - GroupButtonsLayout->setSpacing( 6 ); - GroupButtonsLayout->setMargin( 11 ); - buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); - buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) ); - buttonCancel->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); - buttonApply = new QPushButton( GroupButtons, "buttonApply" ); - buttonApply->setText( tr( "GEOM_BUT_APPLY" ) ); - buttonApply->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer, 0, 2 ); - buttonOk = new QPushButton( GroupButtons, "buttonOk" ); - buttonOk->setText( tr( "GEOM_BUT_OK" ) ); - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); - OperationGUI_FilletDlgLayout->addWidget( GroupButtons, 2, 0 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_FILLET" ) ); - GroupConstructors->setExclusive( TRUE ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - Constructor2 = new QRadioButton( GroupConstructors, "Constructor2" ); - Constructor2->setText( tr( "" ) ); - Constructor2->setPixmap( image2 ); - Constructor2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)1, (QSizePolicy::SizeType)0, Constructor2->sizePolicy().hasHeightForWidth() ) ); - Constructor2->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor2, 0, 2 ); - QSpacerItem* spacer_2 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_2, 0, 3 ); - QSpacerItem* spacer_3 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_3, 0, 1 ); - Constructor3 = new QRadioButton( GroupConstructors, "Constructor3" ); - Constructor3->setText( tr( "" ) ); - Constructor3->setPixmap( image3 ); - Constructor3->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor3, 0, 4 ); - QSpacerItem* spacer_4 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer_4, 0, 5 ); - OperationGUI_FilletDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_FILLET_ALL" ) ); - GroupC1->setMinimumSize( QSize( 0, 0 ) ); - GroupC1->setFrameShape( QGroupBox::Box ); - GroupC1->setFrameShadow( QGroupBox::Sunken ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setSpacing( 0 ); - GroupC1->layout()->setMargin( 0 ); - GroupC1Layout = new QGridLayout( GroupC1->layout() ); - GroupC1Layout->setAlignment( Qt::AlignTop ); - GroupC1Layout->setSpacing( 6 ); - GroupC1Layout->setMargin( 11 ); - - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_MAIN_OBJECT" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_RADIUS" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A2->setFrameShape( QLabel::NoFrame ); - TextLabelC1A2->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - - SpinBox_C1A2 = new DlgRef_SpinBox( GroupC1, "GeomSpinBox_C1A2" ) ; - SpinBox_C1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C1A2->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( SpinBox_C1A2, 1, 2 ); - - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - SelectButtonC1A1->setToggleButton( FALSE ); - SelectButtonC1A1->setMaximumSize( QSize( 28, 32767 ) ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - OperationGUI_FilletDlgLayout->addWidget( GroupC1, 1, 0 ); - - /***************************************************************/ - GroupC2 = new QGroupBox( this, "GroupC2" ); - GroupC2->setTitle( tr( "GEOM_FILLET_EDGES" ) ); - GroupC2->setMinimumSize( QSize( 0, 0 ) ); - GroupC2->setFrameShape( QGroupBox::Box ); - GroupC2->setFrameShadow( QGroupBox::Sunken ); - GroupC2->setColumnLayout(0, Qt::Vertical ); - GroupC2->layout()->setSpacing( 0 ); - GroupC2->layout()->setMargin( 0 ); - GroupC2Layout = new QGridLayout( GroupC2->layout() ); - GroupC2Layout->setAlignment( Qt::AlignTop ); - GroupC2Layout->setSpacing( 6 ); - GroupC2Layout->setMargin( 11 ); - - TextLabelC2A1 = new QLabel( GroupC2, "TextLabelC2A1" ); - TextLabelC2A1->setText( tr( "GEOM_MAIN_OBJECT" ) ); - TextLabelC2A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A1->setFrameShape( QLabel::NoFrame ); - TextLabelC2A1->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A1, 0, 0 ); - - TextLabelC2A2 = new QLabel( GroupC2, "TextLabelC2A2" ); - TextLabelC2A2->setText( tr( "GEOM_RADIUS" ) ); - TextLabelC2A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC2A2->setFrameShape( QLabel::NoFrame ); - TextLabelC2A2->setFrameShadow( QLabel::Plain ); - GroupC2Layout->addWidget( TextLabelC2A2, 1, 0 ); - - LineEditC2A1 = new QLineEdit( GroupC2, "LineEditC2A1" ); - GroupC2Layout->addWidget( LineEditC2A1, 0, 2 ); - - SpinBox_C2A2 = new DlgRef_SpinBox( GroupC2, "GeomSpinBox_C2A2" ) ; - SpinBox_C2A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C2A2->sizePolicy().hasHeightForWidth() ) ); - GroupC2Layout->addWidget( SpinBox_C2A2, 1, 2 ); - - SelectButtonC2A1 = new QPushButton( GroupC2, "SelectButtonC2A1" ); - SelectButtonC2A1->setText( tr( "" ) ); - SelectButtonC2A1->setPixmap( image1 ); - SelectButtonC2A1->setToggleButton( FALSE ); - SelectButtonC2A1->setMaximumSize( QSize( 28, 32767 ) ); - GroupC2Layout->addWidget( SelectButtonC2A1, 0, 1 ); - OperationGUI_FilletDlgLayout->addWidget( GroupC2, 1, 0 ); - - /***************************************************************/ - GroupC3 = new QGroupBox( this, "GroupC3" ); - GroupC3->setTitle( tr( "GEOM_FILLET_FACES" ) ); - GroupC3->setMinimumSize( QSize( 0, 0 ) ); - GroupC3->setFrameShape( QGroupBox::Box ); - GroupC3->setFrameShadow( QGroupBox::Sunken ); - GroupC3->setColumnLayout(0, Qt::Vertical ); - GroupC3->layout()->setSpacing( 0 ); - GroupC3->layout()->setMargin( 0 ); - GroupC3Layout = new QGridLayout( GroupC3->layout() ); - GroupC3Layout->setAlignment( Qt::AlignTop ); - GroupC3Layout->setSpacing( 6 ); - GroupC3Layout->setMargin( 11 ); - - TextLabelC3A1 = new QLabel( GroupC3, "TextLabelC3A1" ); - TextLabelC3A1->setText( tr( "GEOM_MAIN_OBJECT" ) ); - TextLabelC3A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC3A1->setFrameShape( QLabel::NoFrame ); - TextLabelC3A1->setFrameShadow( QLabel::Plain ); - GroupC3Layout->addWidget( TextLabelC3A1, 0, 0 ); - - TextLabelC3A2 = new QLabel( GroupC3, "TextLabelC3A2" ); - TextLabelC3A2->setText( tr( "GEOM_RADIUS" ) ); - TextLabelC3A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC3A2->setFrameShape( QLabel::NoFrame ); - TextLabelC3A2->setFrameShadow( QLabel::Plain ); - GroupC3Layout->addWidget( TextLabelC3A2, 1, 0 ); - - LineEditC3A1 = new QLineEdit( GroupC3, "LineEditC3A1" ); - GroupC3Layout->addWidget( LineEditC3A1, 0, 2 ); - - SpinBox_C3A2 = new DlgRef_SpinBox( GroupC3, "GeomSpinBox_C3A2" ) ; - SpinBox_C3A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, SpinBox_C3A2->sizePolicy().hasHeightForWidth() ) ); - GroupC3Layout->addWidget( SpinBox_C3A2, 1, 2 ); - - SelectButtonC3A1 = new QPushButton( GroupC3, "SelectButtonC3A1" ); - SelectButtonC3A1->setText( tr( "" ) ); - SelectButtonC3A1->setPixmap( image1 ); - SelectButtonC3A1->setToggleButton( FALSE ); - SelectButtonC3A1->setMaximumSize( QSize( 28, 32767 ) ); - GroupC3Layout->addWidget( SelectButtonC3A1, 0, 1 ); - OperationGUI_FilletDlgLayout->addWidget( GroupC3, 1, 0 ); - - /* Initialisation */ - myOperationGUI = theOperationGUI; - Init( Sel, ic ) ; + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_FILLET_ALL"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_FILLET_EDGE"))); + QPixmap image2(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_FILLET_FACE"))); + QPixmap image3(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_FILLET_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_FILLET")); + RadioButton1->setPixmap(image0); + RadioButton2->setPixmap(image1); + RadioButton3->setPixmap(image2); + + Group1 = new DlgRef_1Sel1Spin(this, "Group1"); + Group1->GroupBox1->setTitle(tr("GEOM_FILLET_ALL")); + Group1->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); + Group1->TextLabel2->setText(tr("GEOM_RADIUS")); + Group1->PushButton1->setPixmap(image3); + + Group2 = new DlgRef_1Sel1Spin(this, "Group2"); + Group2->GroupBox1->setTitle(tr("GEOM_FILLET_EDGES")); + Group2->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); + Group2->TextLabel2->setText(tr("GEOM_RADIUS")); + Group2->PushButton1->setPixmap(image3); + + Group3 = new DlgRef_1Sel1Spin(this, "Group3"); + Group3->GroupBox1->setTitle(tr("GEOM_FILLET_FACES")); + Group3->TextLabel1->setText(tr("GEOM_MAIN_OBJECT")); + Group3->TextLabel2->setText(tr("GEOM_RADIUS")); + Group3->PushButton1->setPixmap(image3); + + Layout1->addWidget(Group1, 1, 0); + Layout1->addWidget(Group2, 1, 0); + Layout1->addWidget(Group3, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myOperationGUI = theOperationGUI; + Init(ic); } @@ -294,7 +96,6 @@ OperationGUI_FilletDlg::OperationGUI_FilletDlg( QWidget* parent, OperationGUI_FilletDlg::~OperationGUI_FilletDlg() { /* no need to delete child widgets, Qt does it all for us */ - this->destroy(TRUE, TRUE) ; } @@ -302,78 +103,63 @@ OperationGUI_FilletDlg::~OperationGUI_FilletDlg() // function : Init() // purpose : //================================================================================= -void OperationGUI_FilletDlg::Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) +void OperationGUI_FilletDlg::Init(Handle(AIS_InteractiveContext) ic) { + /* init variables */ + myConstructorId = 0; + myEditCurrentArgument = Group1->LineEdit1; + + myRadius = 50.0; + myOkRadius = true; + myOkShape = false; + myIC = ic; + myLocalContextId = -1; + myUseLocalContext = false; /* Get setting of step value from file configuration */ - double step ; - QString St = QAD_CONFIG->getSetting( "Geometry:SettingsGeomStep" ) ; - step = St.toDouble() ; + QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); + step = St.toDouble(); /* min, max, step and decimals for spin boxes */ - SpinBox_C1A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C1A2->SetValue( 50 ) ; - SpinBox_C2A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C2A2->SetValue( 50 ) ; - SpinBox_C3A2->RangeStepAndValidator( 0.001, 999.999, step, 3 ) ; - SpinBox_C3A2->SetValue( 50 ) ; - - GroupC1->show(); - GroupC2->hide() ; - GroupC3->hide() ; - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - - mySelection = Sel ; - myEditCurrentArgument = LineEditC1A1 ; - myShape.Nullify() ; - myRadius = 50.0 ; - myOkRadius = true ; - myIC = ic ; - myLocalContextId = -1 ; - myUseLocalContext = false ; - myOkShape = false ; - - myGeomGUI = GEOMBase_Context::GetGeomGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - mySimulationTopoDs.Nullify() ; - - /* Filters definition */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); + Group1->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); + Group2->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); + Group3->SpinBox_DX->RangeStepAndValidator(0.001, 999.999, step, 3); + + Group1->SpinBox_DX->SetValue(myRadius); + Group2->SpinBox_DX->SetValue(myRadius); + Group3->SpinBox_DX->SetValue(myRadius); /* signals and slots connections */ - connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); - connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) ); - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; - connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC2A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( SelectButtonC3A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - - connect( SpinBox_C1A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C2A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - connect( SpinBox_C3A2, SIGNAL ( valueChanged( double) ), this, SLOT( ValueChangedInSpinBox( double) ) ) ; - - connect( LineEditC1A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC2A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( LineEditC3A1, SIGNAL ( returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - - connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - /* to close dialog if study change */ - connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; - - /* Move widget on the botton right corner of main widget */ - int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* Displays Dialog */ - - return ; -} + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupConstructors, SIGNAL(clicked(int)), this, SLOT(ConstructorsClicked(int))); + connect(Group1->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group2->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(Group3->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + + connect(Group1->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group2->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + connect(Group3->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); + + connect(Group1->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group2->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(Group3->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group1->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group2->SpinBox_DX, SLOT(SetStep(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), Group3->SpinBox_DX, SLOT(SetStep(double))); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + + /* displays Dialog */ + Group2->hide(); + Group3->hide(); + Group1->show(); + this->show(); + + return; +} //================================================================================= @@ -382,68 +168,86 @@ void OperationGUI_FilletDlg::Init( SALOME_Selection* Sel, Handle (AIS_Interactiv //================================================================================= void OperationGUI_FilletDlg::ConstructorsClicked(int constructorId) { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - myEditCurrentArgument->setText(tr("")) ; - - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { + myConstructorId = constructorId; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + disconnect(mySelection, 0, this, 0); + myOkShape = false; + myRadius = 50.0; + myOkRadius = true; + + if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); // myIC = myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getViewerOCC()->getAISContext(); - if(this->myUseLocalContext) { - myIC->CloseLocalContext(this->myLocalContextId) ; - GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); - myDisplayGUI->OnDisplayAll(true) ; - this->myUseLocalContext = false ; + myIC = v3d->getAISContext(); + if(myUseLocalContext) { + myIC->CloseLocalContext(myLocalContextId); + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); + this->myUseLocalContext = false; } } - myOkShape = false ; - myRadius = 50.0 ; - myOkRadius = true ; - myConstructorId = constructorId ; - - // connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - switch (constructorId) { case 0: /* Fillet All */ { + Group2->hide(); + Group3->hide(); + resize(0, 0); + Group1->show(); + + myEditCurrentArgument = Group1->LineEdit1; + Group1->LineEdit1->setText(""); myShapeType = -1; - GroupC1->show(); - GroupC2->hide() ; - GroupC3->hide() ; - myEditCurrentArgument = LineEditC1A1 ; - SpinBox_C1A2->SetValue( 50 ) ;; - LineEditC1A1->setText(tr("")) ; + + Group1->SpinBox_DX->SetValue(myRadius); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); break; } - case 1: /* Fillet edges */ { + Group1->hide(); + Group3->hide(); + resize(0, 0); + Group2->show(); + + myEditCurrentArgument = Group2->LineEdit1; + Group2->LineEdit1->setText(""); myShapeType = 6; - GroupC1->hide(); - GroupC2->show() ; - GroupC3->hide() ; - myEditCurrentArgument = LineEditC2A1 ; - SpinBox_C2A2->SetValue( 50 ) ;; - LineEditC2A1->setText(tr("")) ; - break ; + + Group2->SpinBox_DX->SetValue(myRadius); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + break; } - case 2: /* Fillet Faces */ { + Group1->hide(); + Group2->hide(); + resize(0, 0); + Group3->show(); + + myEditCurrentArgument = Group3->LineEdit1; + Group3->LineEdit1->setText(""); myShapeType = 4; - GroupC1->hide(); - GroupC2->hide() ; - GroupC3->show() ; - myEditCurrentArgument = LineEditC3A1 ; - SpinBox_C3A2->SetValue( 50 ) ;; - LineEditC3A1->setText(tr("")) ; - break ; + + Group3->SpinBox_DX->SetValue(myRadius); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + break; } } - return ; + return; +} + + +//================================================================================= +// function : ClickOnOk() +// purpose : +//================================================================================= +void OperationGUI_FilletDlg::ClickOnOk() +{ + this->ClickOnApply(); + this->ClickOnCancel(); + return; } @@ -453,67 +257,42 @@ void OperationGUI_FilletDlg::ConstructorsClicked(int constructorId) //================================================================================= void OperationGUI_FilletDlg::ClickOnApply() { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; + myGeomGUI->GetDesktop()->putInfo(tr("")); + if (mySimulationTopoDs.IsNull()) + return; + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); - bool testResult = false ; - myGeomGUI->GetDesktop()->putInfo( tr("") ) ; + bool testResult = false; switch(myConstructorId) { case 0 : /* Fillet All */ { - if(myOkRadius) { - if( myOkShape ) { - testResult = myOperationGUI->OnFilletGetAll( myShape, myRadius, myShapeType, myShapeIOR ) ; - } - } - if( !testResult ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ; - } else { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ; - } - /* Reset all arguments and local context to allow user a new selection ...*/ - this->ResetStateOfDialog() ; - break ; + if(myOkRadius && myOkShape) + testResult = myOperationGUI->OnFilletGetAll(myShape, myRadius, myShapeType, myShapeIOR); + break; } - case 1 : /* Fillet Edge */ { - if(myOkRadius) { - if( myOkShape ) { - testResult = myOperationGUI->OnFilletGetSelected( myShape, myShapeIOR, myRadius, myShapeType, myLocalContextId, myUseLocalContext ); - } - } - if( !testResult ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ; - } else { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ; - } - /* Reset all arguments and local context to allow user a new selection ...*/ - this->ResetStateOfDialog() ; - break ; + if(myOkRadius && myOkShape) + testResult = myOperationGUI->OnFilletGetSelected(myShape, myShapeIOR, myRadius, myShapeType, myLocalContextId, myUseLocalContext); + break; } - - case 2 : /* Fillet Face */ + case 2 : /* Fillet Face */ { - if(myOkRadius) { - if( myOkShape ) { - testResult = myOperationGUI->OnFilletGetSelected( myShape, myShapeIOR, myRadius, myShapeType, myLocalContextId, myUseLocalContext ) ; - } - } - if( !testResult ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")) ; - } else { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")) ; - } - /* Reset all arguments and local context to allow user a new selection ...*/ - this->ResetStateOfDialog() ; - break ; + if(myOkRadius && myOkShape) + testResult = myOperationGUI->OnFilletGetSelected(myShape, myShapeIOR, myRadius, myShapeType, myLocalContextId, myUseLocalContext); + break; } } - // accept(); - return ; + if(!testResult) + myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); + else + myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); + /* Reset all arguments and local context to allow user a new selection ...*/ + this->ResetStateOfDialog(); + return; } @@ -523,214 +302,143 @@ void OperationGUI_FilletDlg::ClickOnApply() //================================================================================= void OperationGUI_FilletDlg::ClickOnCancel() { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { + if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); // myIC = myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getViewerOCC()->getAISContext(); - if(this->myUseLocalContext) { - myIC->CloseLocalContext(this->myLocalContextId) ; - this->myUseLocalContext = false ; - GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); - myDisplayGUI->OnDisplayAll(true) ; - } - } - reject() ; - return ; -} + myIC = v3d->getAISContext(); -//================================================================================= -// function : ClickOnOk() -// purpose : -//================================================================================= -void OperationGUI_FilletDlg::ClickOnOk() -{ - this->ClickOnApply() ; - this->ClickOnCancel() ; - return ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void OperationGUI_FilletDlg::LineEditReturnPressed() -{ - QLineEdit* send = (QLineEdit*)sender(); - if( send == LineEditC1A1 ) - myEditCurrentArgument = LineEditC1A1 ; - else if ( send == LineEditC2A1 ) - myEditCurrentArgument = LineEditC2A1 ; - else if ( send == LineEditC3A1 ) - myEditCurrentArgument = LineEditC3A1 ; - else - return ; - - /* User name of object input management */ - /* If successfull the selection is changed and signal emitted... */ - /* so SelectionIntoArgument() is automatically called. */ - const QString objectUserName = myEditCurrentArgument->text() ; - QWidget* thisWidget = (QWidget*)this ; - if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { - myEditCurrentArgument->setText( objectUserName ) ; + if(myUseLocalContext) { + myIC->CloseLocalContext(myLocalContextId); + myUseLocalContext = false; + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); + } } - return ; + GEOMBase_Skeleton::ClickOnCancel(); + return; } - //================================================================================= // function : SelectionIntoArgument() // purpose : Called when selection has changed //================================================================================= void OperationGUI_FilletDlg::SelectionIntoArgument() { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - /* Reset all arguments and local context when selection as changed */ - this->ResetStateOfDialog() ; - - /* Future name of argument */ - QString aString = ""; - - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel == 1 ) { - - TopoDS_Shape S ; - Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) - return ; - - if( !IO->hasEntry() ) { - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")) ; - return ; + myGeomBase->EraseSimulationShape(); + myEditCurrentArgument->setText(""); + this->ResetStateOfDialog(); + QString aString = ""; /* name of selection */ + + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if (nbSel == 1) { + TopoDS_Shape S; + Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) + return; + if(!IO->hasEntry()) { + myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); + return; } - if ( !S.IsNull() && S.ShapeType() <= 2 ) { - if ( IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject)) ) { - Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast( IO ); + if(!S.IsNull() && S.ShapeType() <= 2) { + if(IO->IsInstance(STANDARD_TYPE(GEOM_InteractiveObject))) { + Handle(GEOM_InteractiveObject) GIObject = Handle(GEOM_InteractiveObject)::DownCast(IO); myShapeIOR = GIObject->getIOR(); /* the Geom IOR string of selection */ - myEditCurrentArgument->setText(aString) ; - myShape = S ; - myOkShape = true ; + myEditCurrentArgument->setText(aString); + myShape = S; + myOkShape = true; } - if ( IO->hasEntry() ) { + if(IO->hasEntry()) { SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); - SALOMEDS::SObject_var obj = aStudy->FindObjectID( IO->getEntry() ); + SALOMEDS::SObject_var obj = aStudy->FindObjectID(IO->getEntry()); SALOMEDS::GenericAttribute_var anAttr; - SALOMEDS::AttributeIOR_var anIOR; - if ( !obj->_is_nil() ) { - if (obj->FindAttribute(anAttr, "AttributeIOR")) { + SALOMEDS::AttributeIOR_var anIOR; + if(!obj->_is_nil()) { + if(obj->FindAttribute(anAttr, "AttributeIOR")) { anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); myShapeIOR = anIOR->Value(); - myOkShape = true ; - myShape = S ; - myEditCurrentArgument->setText(aString) ; + myOkShape = true; + myShape = S; + myEditCurrentArgument->setText(aString); } } } } - - MakePreview(); + this->MakePreview(); - } else + } + else return; - if( myOkShape && myShapeType!=-1 && myConstructorId != 0 ) { + if(myOkShape && myShapeType!=-1 && myConstructorId != 0) { /* local context is defined into the method */ - myGeomGUI->PrepareSubShapeSelection( this->myShapeType, this->myLocalContextId ) ; - myUseLocalContext = true ; - myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_EDGE")) ; + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->PrepareSubShapeSelection(myShapeType, myLocalContextId); + myUseLocalContext = true; } } - //================================================================================= -// function : SetEditCurrentArgument() +// function : LineEditReturnPressed() // purpose : //================================================================================= -void OperationGUI_FilletDlg::SetEditCurrentArgument() +void OperationGUI_FilletDlg::LineEditReturnPressed() { - QPushButton* send = (QPushButton*)sender(); - - switch (myConstructorId) - { - case 0: - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - SelectionIntoArgument() ; - } - break; - } + QLineEdit* send = (QLineEdit*)sender(); + if(send == Group1->LineEdit1) + myEditCurrentArgument = Group1->LineEdit1; + else if (send == Group2->LineEdit1) + myEditCurrentArgument = Group2->LineEdit1; + else if (send == Group3->LineEdit1) + myEditCurrentArgument = Group3->LineEdit1; + else + return; - case 1: - { - if(send ==SelectButtonC2A1 ) { - LineEditC2A1->setFocus() ; - myEditCurrentArgument = LineEditC2A1; - SelectionIntoArgument() ; - } - break; - } - - case 2: - { - if(send ==SelectButtonC3A1 ) { - LineEditC3A1->setFocus() ; - myEditCurrentArgument = LineEditC3A1; - SelectionIntoArgument() ; - } - break; - } - } - return ; + GEOMBase_Skeleton::LineEditReturnPressed(); + return; } + //================================================================================= -// function : ValueChangedInSpinBox() +// function : SetEditCurrentArgument() // purpose : //================================================================================= -void OperationGUI_FilletDlg::ValueChangedInSpinBox( double newValue ) +void OperationGUI_FilletDlg::SetEditCurrentArgument() { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - - myRadius = newValue ; - myOkRadius = true ; + QPushButton* send = (QPushButton*)sender(); - MakePreview(); + if(send == Group1->PushButton1) { + Group1->LineEdit1->setFocus(); + myEditCurrentArgument = Group1->LineEdit1; + } + else if(send == Group2->PushButton1) { + Group2->LineEdit1->setFocus(); + myEditCurrentArgument = Group2->LineEdit1; + } + else if(send == Group3->PushButton1) { + Group3->LineEdit1->setFocus(); + myEditCurrentArgument = Group3->LineEdit1; + } + this->SelectionIntoArgument(); + return; } + //================================================================================= // function : DeactivateActiveDialog() // purpose : //================================================================================= void OperationGUI_FilletDlg::DeactivateActiveDialog() { - if ( GroupConstructors->isEnabled() ) { - this->ResetStateOfDialog() ; - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupC2->setEnabled(false) ; - GroupC3->setEnabled(false) ; - GroupButtons->setEnabled(false) ; - disconnect( mySelection, 0, this, 0 ); - myGeomGUI->ResetState() ; - myGeomGUI->SetActiveDialogBox(0) ; - GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); - myDisplayGUI->OnDisplayAll(true) ; + if(GroupConstructors->isEnabled()) { + GEOMBase_Skeleton::DeactivateActiveDialog(); + this->ResetStateOfDialog(); + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); } - return ; + return; } @@ -740,20 +448,11 @@ void OperationGUI_FilletDlg::DeactivateActiveDialog() //================================================================================= void OperationGUI_FilletDlg::ActivateThisDialog() { - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupC2->setEnabled(true) ; - GroupC3->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; - return ; + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + if(!mySimulationTopoDs.IsNull()) + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); + return; } @@ -761,12 +460,12 @@ void OperationGUI_FilletDlg::ActivateThisDialog() // function : enterEvent() // purpose : //================================================================================= -void OperationGUI_FilletDlg::enterEvent( QEvent* e) +void OperationGUI_FilletDlg::enterEvent(QEvent* e) { - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; } @@ -774,11 +473,11 @@ void OperationGUI_FilletDlg::enterEvent( QEvent* e) // function : closeEvent() // purpose : //================================================================================= -void OperationGUI_FilletDlg::closeEvent( QCloseEvent* e ) +void OperationGUI_FilletDlg::closeEvent(QCloseEvent* e) { /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; + this->ClickOnCancel(); + return; } @@ -788,58 +487,75 @@ void OperationGUI_FilletDlg::closeEvent( QCloseEvent* e ) //================================================================================= void OperationGUI_FilletDlg::ResetStateOfDialog() { - this->myOkShape = false ; - this->myEditCurrentArgument->setText("") ; + myOkShape = false; + myEditCurrentArgument->setText(""); /* Close its local contact if opened */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC ) { + if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) { OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - myIC = v3d->getAISContext(); // myIC = myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getViewerOCC()->getAISContext(); - if(this->myUseLocalContext) { - myIC->CloseLocalContext(this->myLocalContextId) ; - this->myUseLocalContext = false ; - GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); - myDisplayGUI->OnDisplayAll(true) ; + myIC = v3d->getAISContext(); + + if(myUseLocalContext) { + myIC->CloseLocalContext(myLocalContextId); + myUseLocalContext = false; + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->OnDisplayAll(true); } } - return ; + return; } +//================================================================================= +// function : ValueChangedInSpinBox() +// purpose : +//================================================================================= +void OperationGUI_FilletDlg::ValueChangedInSpinBox(double newValue) +{ + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + + myRadius = newValue; + myOkRadius = true; + + MakePreview(); + return; +} + + +//================================================================================= +// function : MakePreview() +// purpose : +//================================================================================= void OperationGUI_FilletDlg::MakePreview() { - TopoDS_Shape tds ; - try - { - BRepFilletAPI_MakeFillet fill(myShape); - switch (myConstructorId) - { - case 0: /* Fillet All */ + TopoDS_Shape tds; + try { + BRepFilletAPI_MakeFillet fill(myShape); + switch (myConstructorId) { - TopExp_Explorer Exp ( myShape, TopAbs_EDGE ); - for (Exp; Exp.More(); Exp.Next()) - { - TopoDS_Edge E =TopoDS::Edge(Exp.Current()); + case 0: /* Fillet All */ + { + TopExp_Explorer Exp (myShape, TopAbs_EDGE); + for(Exp; Exp.More(); Exp.Next()) { + TopoDS_Edge E = TopoDS::Edge(Exp.Current()); fill.Add(E); } - for (int i = 1;i<=fill.NbContours();i++) - fill.SetRadius(myRadius,i); + for(int i = 1;i<=fill.NbContours();i++) + fill.SetRadius(myRadius,i); - tds = fill.Shape(); - break; + tds = fill.Shape(); + break; + } } -// case 1: /* Fillet edges */ -// case 2: /* Fillet Faces */ - } - if (!tds.IsNull()) - { + if(!tds.IsNull()) { mySimulationTopoDs = tds; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); } } - catch(Standard_Failure) - { - myGeomGUI->EraseSimulationShape() ; - mySimulationTopoDs.Nullify() ; - } + catch(Standard_Failure) { + myGeomBase->EraseSimulationShape(); + mySimulationTopoDs.Nullify(); + } + return; } diff --git a/src/OperationGUI/OperationGUI_FilletDlg.h b/src/OperationGUI/OperationGUI_FilletDlg.h index a32bc4370..2af0f0bb6 100644 --- a/src/OperationGUI/OperationGUI_FilletDlg.h +++ b/src/OperationGUI/OperationGUI_FilletDlg.h @@ -29,134 +29,65 @@ #ifndef DIALOGBOX_FILLET_H #define DIALOGBOX_FILLET_H -#include "OperationGUI.h" - -#include "DlgRef_SpinBox.h" - -// Qt Includes -#include -#include -#include +#include "GEOMBase_Skeleton.h" +#include "DlgRef_1Sel1Spin.h" -// Open CASCADE Includes -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QFrame; -class QGroupBox; -class QLineEdit; -class QPushButton; -class QRadioButton; -class QToolButton; -class QLabel; +#include "OperationGUI.h" //================================================================================= // class : OperationGUI_FilletDlg // purpose : //================================================================================= -class OperationGUI_FilletDlg : public QDialog +class OperationGUI_FilletDlg : public GEOMBase_Skeleton { Q_OBJECT public: - OperationGUI_FilletDlg( QWidget* parent = 0, - const char* name = 0, - OperationGUI* theOperationGUI = 0, - SALOME_Selection* Sel = 0, - Handle (AIS_InteractiveContext) ic = 0, - bool modal = FALSE, - WFlags fl = 0 ); - + OperationGUI_FilletDlg(QWidget* parent = 0, const char* name = 0, OperationGUI* theOperationGUI = 0, SALOME_Selection* Sel = 0, Handle(AIS_InteractiveContext) ic = 0, bool modal = FALSE, WFlags fl = 0); ~OperationGUI_FilletDlg(); private : - OperationGUI* myOperationGUI; - void Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent( QEvent* e); - void ResetStateOfDialog() ; - - /* Interactive and local context management see also : bool myUseLocalContext() */ - Handle (AIS_InteractiveContext) myIC ; /* Interactive context */ - Standard_Integer myLocalContextId ; /* identify a local context used by this method */ - bool myUseLocalContext ; /* true when this method as opened a local context */ + void Init(Handle(AIS_InteractiveContext) ic); + void enterEvent(QEvent* e); + void closeEvent(QCloseEvent* e); + void MakeFilletSimulationAndDisplay(); - QDoubleValidator *myVa ; /* Double validator for numeric input */ - - GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - - TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */ + void ResetStateOfDialog(); void MakePreview(); - TopoDS_Shape myShape ; - bool myOkShape ; - char* myShapeIOR ; - - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ - int myConstructorId ; /* Current constructor id = radio button id */ - int myShapeType ; - - bool myOkRadius ; - double myRadius ; - - QButtonGroup* GroupConstructors; - - QRadioButton* Constructor1; - QRadioButton* Constructor2; - QRadioButton* Constructor3; - - QGroupBox* GroupButtons; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QPushButton* buttonApply; + OperationGUI* myOperationGUI; - QGroupBox* GroupC1; - QPushButton* SelectButtonC1A1; - QLineEdit* LineEditC1A1; - QLabel* TextLabelC1A1; - DlgRef_SpinBox* SpinBox_C1A2 ; - QLabel* TextLabelC1A2; + double step; + int myConstructorId; /* Current constructor id = radio button id */ - QGroupBox* GroupC2; - QPushButton* SelectButtonC2A1; - QLineEdit* LineEditC2A1; - QLabel* TextLabelC2A1; - DlgRef_SpinBox* SpinBox_C2A2 ; - QLabel* TextLabelC2A2; + /* Interactive and local context management see also : bool myUseLocalContext() */ + Handle(AIS_InteractiveContext) myIC; /* Interactive context */ + Standard_Integer myLocalContextId; /* identify a local context used by this method */ + bool myUseLocalContext; /* true when this method as opened a local context */ + + TopoDS_Shape myShape; + bool myOkShape; + char* myShapeIOR; + int myShapeType; + bool myOkRadius; + double myRadius; - QGroupBox* GroupC3; - QPushButton* SelectButtonC3A1; - QLineEdit* LineEditC3A1; - QLabel* TextLabelC3A1; - DlgRef_SpinBox* SpinBox_C3A2 ; - QLabel* TextLabelC3A2; + DlgRef_1Sel1Spin* Group1; + DlgRef_1Sel1Spin* Group2; + DlgRef_1Sel1Spin* Group3; private slots: - - void ConstructorsClicked(int constructorId); void ClickOnOk(); - void ClickOnCancel(); void ClickOnApply(); - void SetEditCurrentArgument() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void LineEditReturnPressed() ; - void ActivateThisDialog() ; - void ValueChangedInSpinBox( double newValue ) ; - -protected: + void ClickOnCancel(); + void ActivateThisDialog(); + void DeactivateActiveDialog(); + void LineEditReturnPressed(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ValueChangedInSpinBox(double newValue); + void ConstructorsClicked(int constructorId); - QGridLayout* OperationGUI_FilletDlgLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupC1Layout; - QGridLayout* GroupC2Layout; - QGridLayout* GroupC3Layout; }; #endif // DIALOGBOX_FILLET_H diff --git a/src/OperationGUI/OperationGUI_PartitionDlg.cxx b/src/OperationGUI/OperationGUI_PartitionDlg.cxx index 7015a67d1..e0370df1e 100644 --- a/src/OperationGUI/OperationGUI_PartitionDlg.cxx +++ b/src/OperationGUI/OperationGUI_PartitionDlg.cxx @@ -222,7 +222,8 @@ void OperationGUI_PartitionDlg::Init( SALOME_Selection* Sel ) { myEditCurrentArgument = LineEditC1A1 ; mySelection = Sel; - myGeomGUI = GEOMBase_Context::GetGeomGUI() ; + myGeomBase = new GEOMBase() ; + myGeomGUI = GEOMContext::GetGeomGUI() ; myOkListShapes = myOkListTools = myOkKeepShape = myOkRemoveShape = false ; myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; @@ -269,7 +270,7 @@ void OperationGUI_PartitionDlg::Init( SALOME_Selection* Sel ) /* Move widget on the botton right corner of main widget */ int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; + myGeomBase->DefineDlgPosition( this, x, y ) ; this->move( x, y ) ; this->show() ; /* displays Dialog */ @@ -327,7 +328,7 @@ void OperationGUI_PartitionDlg::ClickOnApply() //================================================================================= void OperationGUI_PartitionDlg::ClickOnCancel() { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; disconnect( mySelection, 0, this, 0 ); myGeomGUI->ResetState() ; reject() ; @@ -352,7 +353,7 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument() { myEditCurrentArgument->setText("") ; QString aString = ""; /* name of selection */ - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ; if ( nbSel < 1 ) { if ( myEditCurrentArgument == LineEditC1A1 ) { @@ -371,22 +372,22 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument() } if ( myEditCurrentArgument == LineEditC1A1 ) { - myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes) ; + myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes) ; myEditCurrentArgument->setText(aString) ; myOkListShapes = true ; } else if ( myEditCurrentArgument == LineEditC1A2 ) { - myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListTools) ; + myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListTools) ; myEditCurrentArgument->setText(aString) ; myOkListTools = true ; } else if ( myEditCurrentArgument == LineEditC2A1 ) { - myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListRemoveInside) ; + myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListRemoveInside) ; myEditCurrentArgument->setText(aString) ; myOkKeepShape = true ; } else if ( myEditCurrentArgument == LineEditC2A2 ) { - myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListKeepInside) ; + myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListKeepInside) ; myEditCurrentArgument->setText(aString) ; myOkRemoveShape = true ; } @@ -447,7 +448,7 @@ void OperationGUI_PartitionDlg::LineEditReturnPressed() /* so SelectionIntoArgument() is automatically called. */ const QString objectUserName = myEditCurrentArgument->text() ; QWidget* thisWidget = (QWidget*)this ; - if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { + if( myGeomBase->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { myEditCurrentArgument->setText( objectUserName ) ; } return ; diff --git a/src/OperationGUI/OperationGUI_PartitionDlg.h b/src/OperationGUI/OperationGUI_PartitionDlg.h index aa1526885..cbef3fa4a 100644 --- a/src/OperationGUI/OperationGUI_PartitionDlg.h +++ b/src/OperationGUI/OperationGUI_PartitionDlg.h @@ -61,7 +61,8 @@ private: void enterEvent ( QEvent * ) ; /* Mouse enter the QWidget */ GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */ + GEOMBase* myGeomBase ; /* Current GeomGUI object */ + GEOMContext* myGeomGUI ; /* Current GeomGUI object */ SALOME_Selection* mySelection ; /* User shape selection */ GEOM::GEOM_Gen::ListOfIOR myListShapes ; diff --git a/src/PrimitiveGUI/Makefile.in b/src/PrimitiveGUI/Makefile.in index 925325715..634b377b9 100644 --- a/src/PrimitiveGUI/Makefile.in +++ b/src/PrimitiveGUI/Makefile.in @@ -35,7 +35,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl @COMMENCE@ # header files -EXPORT_HEADERS= PrimitiveGUI.h +EXPORT_HEADERS= # Libraries targets LIB = libPrimitiveGUI.la @@ -70,6 +70,6 @@ LIB_SERVER_IDL = CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lDlgRef -lGEOMBase $(OCC_KERNEL_LIBS) $(OCC_MODELER_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lDlgRef -lGEOMContext -lGEOMBase -L${KERNEL_ROOT_DIR}/lib/salome @CONCLUDE@ diff --git a/src/PrimitiveGUI/PrimitiveGUI.cxx b/src/PrimitiveGUI/PrimitiveGUI.cxx index 44f941e11..dca1f3a2b 100644 --- a/src/PrimitiveGUI/PrimitiveGUI.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI.cxx @@ -29,14 +29,15 @@ using namespace std; #include "PrimitiveGUI.h" +#include "SALOMEGUI_QtCatchCorbaException.hxx" +#include + #include "PrimitiveGUI_BoxDlg.h" // Method BOX #include "PrimitiveGUI_CylinderDlg.h" // Method CYLINDER #include "PrimitiveGUI_SphereDlg.h" // Method SPHERE #include "PrimitiveGUI_TorusDlg.h" // Method TORUS #include "PrimitiveGUI_ConeDlg.h" // Method CONE -static PrimitiveGUI* myPrimitiveGUI = 0; - //======================================================================= // function : PrimitiveGUI() // purpose : Constructor @@ -44,9 +45,9 @@ static PrimitiveGUI* myPrimitiveGUI = 0; PrimitiveGUI::PrimitiveGUI() : QObject() { - myGeomGUI = GEOMBase_Context::GetGeomGUI(); - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); + myGeomBase = new GEOMBase(); + myGeomGUI = GEOMContext::GetGeomGUI(); + myGeom = myGeomGUI->myComponentGeom; } @@ -59,53 +60,40 @@ PrimitiveGUI::~PrimitiveGUI() } -//======================================================================= -// function : GetOrCreateGUI() -// purpose : Gets or create an object 'GUI' with initialisations -// : Returns 'GUI' as a pointer -//======================================================================= -PrimitiveGUI* PrimitiveGUI::GetOrCreateGUI() -{ - myPrimitiveGUI = new PrimitiveGUI(); - return myPrimitiveGUI; -} - - //======================================================================= // function : OnGUIEvent() // purpose : //======================================================================= bool PrimitiveGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) { - PrimitiveGUI::GetOrCreateGUI(); - myPrimitiveGUI->myGeomGUI->EmitSignalDeactivateDialog(); - SALOME_Selection* Sel = SALOME_Selection::Selection(myPrimitiveGUI->myGeomGUI->GetActiveStudy()->getSelection()); - + PrimitiveGUI* aPrimitiveGUI = new PrimitiveGUI(); + aPrimitiveGUI->myGeomGUI->EmitSignalDeactivateDialog(); + SALOME_Selection* Sel = SALOME_Selection::Selection(aPrimitiveGUI->myGeomGUI->GetActiveStudy()->getSelection()); switch (theCommandID) { case 4021: // BOX { - PrimitiveGUI_BoxDlg *aDlg = new PrimitiveGUI_BoxDlg(parent, "", myPrimitiveGUI, Sel); + PrimitiveGUI_BoxDlg* aDlg = new PrimitiveGUI_BoxDlg(parent, "", aPrimitiveGUI, Sel); break; } case 4022: // CYLINDER { - PrimitiveGUI_CylinderDlg *aDlg = new PrimitiveGUI_CylinderDlg(parent, "", myPrimitiveGUI, Sel); + PrimitiveGUI_CylinderDlg* aDlg = new PrimitiveGUI_CylinderDlg(parent, "", aPrimitiveGUI, Sel); break; } case 4023: // SPHERE { - PrimitiveGUI_SphereDlg *aDlg = new PrimitiveGUI_SphereDlg(parent, "", myPrimitiveGUI, Sel); + PrimitiveGUI_SphereDlg* aDlg = new PrimitiveGUI_SphereDlg(parent, "", aPrimitiveGUI, Sel); break; } case 4024: // TORUS { - PrimitiveGUI_TorusDlg *aDlg = new PrimitiveGUI_TorusDlg(parent, "", myPrimitiveGUI, Sel); + PrimitiveGUI_TorusDlg* aDlg = new PrimitiveGUI_TorusDlg(parent, "", aPrimitiveGUI, Sel); break; } case 4025: // CONE { - PrimitiveGUI_ConeDlg *aDlg = new PrimitiveGUI_ConeDlg(parent, "", myPrimitiveGUI, Sel); + PrimitiveGUI_ConeDlg* aDlg = new PrimitiveGUI_ConeDlg(parent, "", aPrimitiveGUI, Sel); break; } default: @@ -127,7 +115,7 @@ void PrimitiveGUI::MakeBoxAndDisplay(const gp_Pnt P1, const gp_Pnt P2) try { GEOM::GEOM_Shape_var box = myGeom->MakeBox(P1.X(), P1.Y(), P1.Z(), P2.X(), P2.Y(), P2.Z()); box->NameType(tr("GEOM_BOX")); - if(myGeomGUI->Display(box, "")) + if(myGeomBase->Display(box)) myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { @@ -157,7 +145,7 @@ void PrimitiveGUI::MakeCylinderAndDisplay(const gp_Pnt BasePoint, const gp_Dir a return; } result->NameType(tr("GEOM_CYLINDER")); - if(myGeomGUI->Display(result, "")) + if(myGeomBase->Display(result)) myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { @@ -179,7 +167,7 @@ void PrimitiveGUI::MakeSphereAndDisplay(const gp_Pnt aCenterPoint, const double GEOM::GEOM_Shape_ptr result = myGeom->MakeSphere(aCenterPoint.X(),aCenterPoint.Y(),aCenterPoint.Z(), aRadius); result->NameType(tr("GEOM_SPHERE")); - if (myGeomGUI->Display(result, "")) + if (myGeomBase->Display(result)) myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch (const SALOME::SALOME_Exception& S_ex) { @@ -210,7 +198,7 @@ void PrimitiveGUI::MakeTorusAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir return; } result->NameType(tr("GEOM_TORUS")); - if(myGeomGUI->Display(result, "")) + if(myGeomBase->Display(result)) myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { @@ -241,7 +229,7 @@ void PrimitiveGUI::MakeConeAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir, return; } result->NameType(tr("GEOM_CONE")); - if(myGeomGUI->Display(result, "")) + if(myGeomBase->Display(result)) myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { diff --git a/src/PrimitiveGUI/PrimitiveGUI.h b/src/PrimitiveGUI/PrimitiveGUI.h index 55b94bc8c..f85e68815 100644 --- a/src/PrimitiveGUI/PrimitiveGUI.h +++ b/src/PrimitiveGUI/PrimitiveGUI.h @@ -29,8 +29,7 @@ #ifndef PRIMITIVEGUI_H #define PRIMITIVEGUI_H -#include "GEOMBase_Display.h" -#include "QAD_Config.h" +#include "GEOMBase.h" //================================================================================= // class : PrimitiveGUI @@ -44,7 +43,6 @@ public : PrimitiveGUI(); ~PrimitiveGUI(); - static PrimitiveGUI* GetOrCreateGUI(); static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); void MakeBoxAndDisplay(const gp_Pnt P1, const gp_Pnt P2); @@ -56,7 +54,8 @@ public : void MakeConeAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir, const double Radius1, const double Radius2, const double aHeight); - GEOMBase_Context* myGeomGUI; + GEOMBase* myGeomBase; + GEOMContext* myGeomGUI; GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ }; diff --git a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx index 447ca237a..8854279be 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx @@ -30,6 +30,8 @@ using namespace std; #include "PrimitiveGUI_BoxDlg.h" #include +#include +#include "QAD_Config.h" //================================================================================= // class : PrimitiveGUI_BoxDlg() @@ -156,7 +158,7 @@ void PrimitiveGUI_BoxDlg::ConstructorsClicked(int constructorId) { myConstructorId = constructorId; mySelection->ClearFilters(); - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); disconnect(mySelection, 0, this, 0); myOkPoint1 = myOkPoint2 = false; @@ -192,7 +194,7 @@ void PrimitiveGUI_BoxDlg::ConstructorsClicked(int constructorId) myPoint2.SetCoord(initValue, initValue, initValue); mySimulationTopoDs = BRepPrimAPI_MakeBox(myPoint1, myPoint2).Shape(); - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); break; } } @@ -221,7 +223,7 @@ void PrimitiveGUI_BoxDlg::ClickOnApply() myGeomGUI->GetDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); switch(myConstructorId) @@ -254,11 +256,11 @@ void PrimitiveGUI_BoxDlg::ClickOnApply() //================================================================================= void PrimitiveGUI_BoxDlg::SelectionIntoArgument() { - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); myEditCurrentArgument->setText(""); QString aString = ""; /* name of selection */ - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); if (nbSel != 1) { if (myEditCurrentArgument == GroupPoints->LineEdit1) myOkPoint1 = false; @@ -269,21 +271,21 @@ void PrimitiveGUI_BoxDlg::SelectionIntoArgument() // nbSel == 1 TopoDS_Shape S; - if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) return; - if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) { + if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) { myEditCurrentArgument->setText(aString); myOkPoint1 = true; } - else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomGUI->VertexToPoint(S, myPoint2)) { + else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomBase->VertexToPoint(S, myPoint2)) { myEditCurrentArgument->setText(aString); myOkPoint2 = true; } if(myOkPoint1 && myOkPoint2 && TestBoxDimensions(myPoint1, myPoint2)) { mySimulationTopoDs = BRepPrimAPI_MakeBox(myPoint1, myPoint2).Shape(); - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); } return; } @@ -343,7 +345,7 @@ void PrimitiveGUI_BoxDlg::ActivateThisDialog() GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); if(!mySimulationTopoDs.IsNull()) - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; } @@ -367,7 +369,7 @@ void PrimitiveGUI_BoxDlg::enterEvent(QEvent* e) //================================================================================= void PrimitiveGUI_BoxDlg::ValueChangedInSpinBox(double newValue) { - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); QObject* send = (QObject*)sender(); double vx, vy, vz; @@ -393,7 +395,7 @@ void PrimitiveGUI_BoxDlg::ValueChangedInSpinBox(double newValue) if(TestBoxDimensions(myPoint1, myPoint2)) { mySimulationTopoDs = BRepPrimAPI_MakeBox(myPoint1, myPoint2).Shape(); - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); } return; } diff --git a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.h b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.h index 655e0a4a3..0638af8fe 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.h +++ b/src/PrimitiveGUI/PrimitiveGUI_BoxDlg.h @@ -35,6 +35,7 @@ #include "PrimitiveGUI.h" +#include "GEOM_ShapeTypeFilter.hxx" #include //================================================================================= diff --git a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx index bd664e701..a0b35c5de 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx @@ -32,6 +32,8 @@ using namespace std; #include #include #include +#include +#include "QAD_Config.h" //================================================================================= // class : PrimitiveGUI_ConeDlg() @@ -175,7 +177,7 @@ void PrimitiveGUI_ConeDlg::ConstructorsClicked(int constructorId) { myConstructorId = constructorId; mySelection->ClearFilters(); - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); disconnect(mySelection, 0, this, 0); myOkHeight = myOkRadius1 = myOkRadius2 = true; myRadius1 = 100.0; @@ -247,7 +249,7 @@ void PrimitiveGUI_ConeDlg::ClickOnApply() myGeomGUI->GetDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight) { @@ -267,11 +269,11 @@ void PrimitiveGUI_ConeDlg::ClickOnApply() //================================================================================= void PrimitiveGUI_ConeDlg::SelectionIntoArgument() { - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); myEditCurrentArgument->setText(""); QString aString = ""; /* name of selection */ - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); if(nbSel != 1) { if(myEditCurrentArgument == GroupPoints->LineEdit1) myOkPoint1 = false; @@ -282,11 +284,11 @@ void PrimitiveGUI_ConeDlg::SelectionIntoArgument() /* nbSel == 1 */ TopoDS_Shape S; - if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) return; /* gp_Pnt : not used */ - if (myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) { + if (myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) { GroupPoints->LineEdit1->setText(aString); myOkPoint1 = true; } @@ -359,7 +361,7 @@ void PrimitiveGUI_ConeDlg::ActivateThisDialog() GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); if(!mySimulationTopoDs.IsNull()) - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; } @@ -383,7 +385,7 @@ void PrimitiveGUI_ConeDlg::enterEvent(QEvent* e) //================================================================================= void PrimitiveGUI_ConeDlg::ValueChangedInSpinBox(double newValue) { - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); QObject* send = (QObject*)sender(); @@ -412,7 +414,7 @@ void PrimitiveGUI_ConeDlg::ValueChangedInSpinBox(double newValue) //================================================================================= void PrimitiveGUI_ConeDlg::MakeConeSimulationAndDisplay() { - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); gp_Dir aDir = myDir; @@ -429,7 +431,7 @@ void PrimitiveGUI_ConeDlg::MakeConeSimulationAndDisplay() if(fabs(myHeight) > Precision::Confusion()) mySimulationTopoDs = BRepPrimAPI_MakeCone(anAxis, myRadius1, myRadius2, fabs(myHeight)).Shape(); } - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); } catch(Standard_Failure) { MESSAGE("Exception catched in MakeConeSimulationAndDisplay"); diff --git a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.h b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.h index 15d101bb6..20ea84f88 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.h +++ b/src/PrimitiveGUI/PrimitiveGUI_ConeDlg.h @@ -36,6 +36,7 @@ #include "PrimitiveGUI.h" #include "GEOM_EdgeFilter.hxx" +#include "GEOM_ShapeTypeFilter.hxx" #include #include diff --git a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx index 85744d1e8..9629891e6 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx @@ -31,6 +31,8 @@ using namespace std; #include #include +#include +#include "QAD_Config.h" //================================================================================= // class : PrimitiveGUI_CylinderDlg() @@ -166,7 +168,7 @@ void PrimitiveGUI_CylinderDlg::ConstructorsClicked(int constructorId) { myConstructorId = constructorId; mySelection->ClearFilters(); - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); disconnect(mySelection, 0, this, 0); myOkHeight = myOkRadius = true; myRadius = 100.0; @@ -234,7 +236,7 @@ void PrimitiveGUI_CylinderDlg::ClickOnApply() myGeomGUI->GetDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); if(myOkPoint1 && myOkDir && myOkRadius && myOkHeight) { @@ -254,11 +256,11 @@ void PrimitiveGUI_CylinderDlg::ClickOnApply() //================================================================================= void PrimitiveGUI_CylinderDlg::SelectionIntoArgument() { - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); myEditCurrentArgument->setText(""); QString aString = ""; /* name of selection */ - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); if(nbSel != 1) { if(myEditCurrentArgument == GroupPoints->LineEdit1) myOkPoint1 = false; @@ -269,11 +271,11 @@ void PrimitiveGUI_CylinderDlg::SelectionIntoArgument() /* nbSel == 1 */ TopoDS_Shape S; - if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) return; /* gp_Pnt : not used */ - if (myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) { + if (myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) { GroupPoints->LineEdit1->setText(aString); myOkPoint1 = true; } @@ -346,7 +348,7 @@ void PrimitiveGUI_CylinderDlg::ActivateThisDialog() GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); if(!mySimulationTopoDs.IsNull()) - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; } @@ -370,7 +372,7 @@ void PrimitiveGUI_CylinderDlg::enterEvent(QEvent* e) //================================================================================= void PrimitiveGUI_CylinderDlg::ValueChangedInSpinBox( double newValue ) { - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); QObject* send = (QObject*)sender(); @@ -396,7 +398,7 @@ void PrimitiveGUI_CylinderDlg::ValueChangedInSpinBox( double newValue ) //================================================================================= void PrimitiveGUI_CylinderDlg::MakeCylinderSimulationAndDisplay() { - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); gp_Dir aDir = this->myDir; @@ -408,7 +410,7 @@ void PrimitiveGUI_CylinderDlg::MakeCylinderSimulationAndDisplay() gp_Ax2 anAxis(this->myPoint1, aDir); mySimulationTopoDs = BRepPrimAPI_MakeCylinder(anAxis, this->myRadius, fabs(myHeight)).Shape(); - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); } catch(Standard_Failure) { MESSAGE("Exception catched in MakeCylinderSimulationAndDisplay"); diff --git a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.h b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.h index 27a77475e..47cc31526 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.h +++ b/src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.h @@ -36,6 +36,7 @@ #include "PrimitiveGUI.h" #include "GEOM_EdgeFilter.hxx" +#include "GEOM_ShapeTypeFilter.hxx" #include #include diff --git a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx index c445d0a6e..185b36598 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx @@ -30,6 +30,7 @@ using namespace std; #include "PrimitiveGUI_SphereDlg.h" #include +#include "QAD_Config.h" //================================================================================= // class : PrimitiveGUI_SphereDlg() @@ -144,7 +145,7 @@ void PrimitiveGUI_SphereDlg::ConstructorsClicked(int constructorId) { myConstructorId = constructorId; mySelection->ClearFilters(); - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); disconnect(mySelection, 0, this, 0); myRadius = 100.0; myOkRadius = true; @@ -179,7 +180,7 @@ void PrimitiveGUI_SphereDlg::ConstructorsClicked(int constructorId) myOkPoint1 = true; mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape(); - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); break; } } @@ -208,7 +209,7 @@ void PrimitiveGUI_SphereDlg::ClickOnApply() myGeomGUI->GetDesktop()->putInfo(tr("")); if(mySimulationTopoDs.IsNull()) return; - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); if(myOkPoint1 && myOkRadius) @@ -223,11 +224,11 @@ void PrimitiveGUI_SphereDlg::ClickOnApply() //================================================================================= void PrimitiveGUI_SphereDlg::SelectionIntoArgument() { - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); myEditCurrentArgument->setText(""); QString aString = ""; /* name of selection */ - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); if(nbSel != 1) { if(myEditCurrentArgument == GroupPoints->LineEdit1) { GroupPoints->LineEdit1->setText(""); @@ -238,18 +239,18 @@ void PrimitiveGUI_SphereDlg::SelectionIntoArgument() /* nbSel == 1 ! */ TopoDS_Shape S; - if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) return; /* Constructor 1 treatment */ - if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) { + if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) { GroupPoints->LineEdit1->setText(aString); myOkPoint1 = true; } if(myOkPoint1 && myOkRadius) { mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape(); - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); } return ; } @@ -302,7 +303,7 @@ void PrimitiveGUI_SphereDlg::ActivateThisDialog() GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); if(!mySimulationTopoDs.IsNull()) - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; } @@ -326,14 +327,14 @@ void PrimitiveGUI_SphereDlg::enterEvent(QEvent* e) //================================================================================= void PrimitiveGUI_SphereDlg::ValueChangedInSpinBox(double newValue) { - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); myRadius = newValue; myOkRadius = true; if(myOkPoint1 && myOkRadius) { mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape(); - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); } return; } diff --git a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.h b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.h index 053a1cbc2..37ca2c969 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.h +++ b/src/PrimitiveGUI/PrimitiveGUI_SphereDlg.h @@ -35,6 +35,7 @@ #include "PrimitiveGUI.h" +#include "GEOM_ShapeTypeFilter.hxx" #include //================================================================================= diff --git a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx index 332a61c52..ff6e50e3c 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx +++ b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx @@ -31,6 +31,7 @@ using namespace std; #include #include +#include "QAD_Config.h" //================================================================================= // class : PrimitiveGUI_TorusDlg() @@ -163,7 +164,7 @@ void PrimitiveGUI_TorusDlg::ConstructorsClicked(int constructorId) { myConstructorId = constructorId; mySelection->ClearFilters(); - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); disconnect(mySelection, 0, this, 0); myOkRadius1 = myOkRadius2 = true; myRadius1 = 300.0; @@ -231,7 +232,7 @@ void PrimitiveGUI_TorusDlg::ClickOnApply() myGeomGUI->GetDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) @@ -246,11 +247,11 @@ void PrimitiveGUI_TorusDlg::ClickOnApply() //================================================================================= void PrimitiveGUI_TorusDlg::SelectionIntoArgument() { - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); myEditCurrentArgument->setText(""); QString aString = ""; /* name of selection */ - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); if(nbSel != 1) { if(myEditCurrentArgument == GroupPoints->LineEdit1) myOkPoint1 = false; @@ -261,11 +262,11 @@ void PrimitiveGUI_TorusDlg::SelectionIntoArgument() /* nbSel == 1 */ TopoDS_Shape S; - if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) return; /* gp_Pnt : not used */ - if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) { + if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) { GroupPoints->LineEdit1->setText(aString); myOkPoint1 = true; } @@ -338,7 +339,7 @@ void PrimitiveGUI_TorusDlg::ActivateThisDialog() GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); if(!mySimulationTopoDs.IsNull()) - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; } @@ -362,7 +363,7 @@ void PrimitiveGUI_TorusDlg::enterEvent(QEvent* e) //================================================================================= void PrimitiveGUI_TorusDlg::ValueChangedInSpinBox(double newValue) { - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); QObject* send = (QObject*)sender(); @@ -387,13 +388,13 @@ void PrimitiveGUI_TorusDlg::ValueChangedInSpinBox(double newValue) //================================================================================= void PrimitiveGUI_TorusDlg::MakeTorusSimulationAndDisplay() { - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); try { gp_Ax2 anAxis(myPoint1, myDir); mySimulationTopoDs = BRepPrimAPI_MakeTorus(anAxis, myRadius1, myRadius2).Shape(); - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); } catch(Standard_Failure) { MESSAGE("Exception catched in MakeTorusSimulationAndDisplay"); diff --git a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h index e95ccba47..2eb3b32b5 100644 --- a/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h +++ b/src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h @@ -36,6 +36,7 @@ #include "PrimitiveGUI.h" #include "GEOM_EdgeFilter.hxx" +#include "GEOM_ShapeTypeFilter.hxx" #include #include diff --git a/src/RepairGUI/Makefile.in b/src/RepairGUI/Makefile.in index 5b846ad34..10100b0c2 100644 --- a/src/RepairGUI/Makefile.in +++ b/src/RepairGUI/Makefile.in @@ -35,7 +35,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl @COMMENCE@ # header files -EXPORT_HEADERS= RepairGUI.h +EXPORT_HEADERS= # Libraries targets LIB = libRepairGUI.la @@ -68,6 +68,6 @@ LIB_SERVER_IDL = CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lDlgRef -lGEOMBase $(OCC_KERNEL_LIBS) $(OCC_MODELER_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lDlgRef -lGEOMContext -lGEOMBase -lDisplayGUI -L${KERNEL_ROOT_DIR}/lib/salome @CONCLUDE@ diff --git a/src/RepairGUI/RepairGUI.cxx b/src/RepairGUI/RepairGUI.cxx index 9ea698d81..0284c6dcd 100644 --- a/src/RepairGUI/RepairGUI.cxx +++ b/src/RepairGUI/RepairGUI.cxx @@ -31,14 +31,13 @@ using namespace std; #include "QAD_RightFrame.h" #include "OCCViewer_Viewer3d.h" +#include "SALOMEGUI_QtCatchCorbaException.hxx" #include "RepairGUI_SewingDlg.h" // Method SEWING #include "RepairGUI_OrientationDlg.h" // Method ORIENTATION #include "RepairGUI_SuppressFacesDlg.h" // Method SUPPRESS FACES #include "RepairGUI_SuppressHoleDlg.h" // Method SUPPRESS HOLE -static RepairGUI* myRepairGUI = 0; - //======================================================================= // function : RepairGUI() // purpose : Constructor @@ -46,9 +45,11 @@ static RepairGUI* myRepairGUI = 0; RepairGUI::RepairGUI() : QObject() { - myGeomGUI = GEOMBase_Context::GetGeomGUI(); - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); + myGeomBase = new GEOMBase(); + myGeomGUI = GEOMContext::GetGeomGUI(); +// Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); +// myGeom = GEOM::GEOM_Gen::_narrow(comp); + myGeom = myGeomGUI->myComponentGeom; } @@ -61,25 +62,13 @@ RepairGUI::~RepairGUI() } -//======================================================================= -// function : GetOrCreateGUI() -// purpose : Gets or create an object 'GUI' with initialisations -// : Returns 'GUI' as a pointer -//======================================================================= -RepairGUI* RepairGUI::GetOrCreateGUI() -{ - myRepairGUI = new RepairGUI(); - return myRepairGUI; -} - - //======================================================================= // function : OnGUIEvent() // purpose : //======================================================================= bool RepairGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) { - RepairGUI::GetOrCreateGUI(); + RepairGUI* myRepairGUI = new RepairGUI(); myRepairGUI->myGeomGUI->EmitSignalDeactivateDialog(); SALOME_Selection* Sel = SALOME_Selection::Selection(myRepairGUI->myGeomGUI->GetActiveStudy()->getSelection()); @@ -141,10 +130,10 @@ void RepairGUI::MakeSewingAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR, TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result); Standard_CString type; - myGeomGUI->GetShapeTypeString(S,type); + myGeomBase->GetShapeTypeString(S,type); result->NameType(type); - if(myGeomGUI->Display(result)) + if(myGeomBase->Display(result)) myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); return; } @@ -168,7 +157,7 @@ void RepairGUI::MakeOrientationChangeAndDisplay(GEOM::GEOM_Shape_ptr Shape) return; } result->NameType(Shape->NameType()); - if(myGeomGUI->Display(result)) + if(myGeomBase->Display(result)) myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); return; } @@ -186,32 +175,31 @@ void RepairGUI::MakeOrientationChangeAndDisplay(GEOM::GEOM_Shape_ptr Shape) // : This means that hole do not traverse ShapeTopo. // : Warning : the hole to be suppressed must be defined by one or two single closed wires ! //===================================================================================== -bool RepairGUI::OnSuppressHole( const char* ShapeTopoIOR, - const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdFace, - const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdWire, - const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdEndFace ) +bool RepairGUI::OnSuppressHole(const char* ShapeTopoIOR, + const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdFace, + const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdWire, + const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdEndFace) { /* Test the type of viewer */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { + if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) return false; - } try { - GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString( ShapeTopoIOR ); - GEOM::GEOM_Shape_var aResult = myGeom->SuppressHole( aShape, ListOfIdFace, ListOfIdWire, ListOfIdEndFace ) ; + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(ShapeTopoIOR); + GEOM::GEOM_Shape_var aResult = myGeom->SuppressHole(aShape, ListOfIdFace, ListOfIdWire, ListOfIdEndFace); TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, aResult); Standard_CString type; - myGeomGUI->GetShapeTypeString(S,type); - aResult->NameType( type ); + myGeomBase->GetShapeTypeString(S,type); + aResult->NameType(type); - if ( myGeomGUI->Display( aResult) ) + if(myGeomBase->Display(aResult)) myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); } - catch (const SALOME::SALOME_Exception& S_ex) { + catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); } - return true ; + return true; } @@ -220,30 +208,29 @@ bool RepairGUI::OnSuppressHole( const char* ShapeTopoIOR, // purpose : To suppress one or more holes on a face // : 'ListOfIdWires' contains indices or wires/holes. //===================================================================================== -bool RepairGUI::OnSuppressHolesInFaceOrShell( const char* ShapeTopoIOR, - const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdWires ) +bool RepairGUI::OnSuppressHolesInFaceOrShell(const char* ShapeTopoIOR, + const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdWires) { /* Test the type of viewer */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { + if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) return false; - } try { - GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString( ShapeTopoIOR ); - GEOM::GEOM_Shape_var aResult = myGeom->SuppressHolesInFaceOrShell( aShape, ListOfIdWires ) ; + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(ShapeTopoIOR); + GEOM::GEOM_Shape_var aResult = myGeom->SuppressHolesInFaceOrShell(aShape, ListOfIdWires); TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, aResult); Standard_CString type; - myGeomGUI->GetShapeTypeString(S,type); - aResult->NameType( type ); + myGeomBase->GetShapeTypeString(S,type); + aResult->NameType(type); - if ( myGeomGUI->Display( aResult) ) + if(myGeomBase->Display(aResult)) myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); } - catch (const SALOME::SALOME_Exception& S_ex) { + catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); } - return true ; + return true; } @@ -252,30 +239,27 @@ bool RepairGUI::OnSuppressHolesInFaceOrShell( const char* ShapeTopoIOR, // purpose : To suppress faces from a shape // : The result is one or more shells/faces as main shapes ! //===================================================================================== -bool RepairGUI::OnSuppressFaces( const TopoDS_Shape& ShapeTopo, - const char* ShapeTopoIOR, - const Standard_Integer& aLocalContextId, - bool& myUseLocalContext ) +bool RepairGUI::OnSuppressFaces(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, + const Standard_Integer& aLocalContextId, bool& myUseLocalContext) { /* Test the type of viewer */ - if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { + if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) return false; - } - SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); - SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR( ShapeTopoIOR ); - if ( theObj->_is_nil() ) { + SALOMEDS::Study_var aStudy = myGeomGUI->GetActiveStudy()->getStudyDocument(); + SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(ShapeTopoIOR); + if(theObj->_is_nil()) { myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY")); - return false ; + return false; } OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); - Handle (AIS_InteractiveContext) ic = v3d->getAISContext(); + Handle(AIS_InteractiveContext) ic = v3d->getAISContext(); - if( myUseLocalContext == false ) { + if(myUseLocalContext == false) { /* local context is from DialogBox */ - MESSAGE("Error : No local context opened for suppress faces method" << endl ) ; - return false ; + MESSAGE("Error : No local context opened for suppress faces method" << endl); + return false; } GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; @@ -285,66 +269,64 @@ bool RepairGUI::OnSuppressFaces( const TopoDS_Shape& ShapeTopo, /* Create a list of indices of faces to be suppressed */ int i = 0; - const int SubShapeType = 4 ; /* GEOM::FACE type */ + const int SubShapeType = 4; /* GEOM::FACE type */ ic->InitSelected(); /* to repositioning at beginning */ - while( ic->MoreSelected() ) { - int index = myGeomGUI->GetIndex( ic->SelectedShape(), ShapeTopo, SubShapeType ); - ListOfID[i] = index ; + while(ic->MoreSelected()) { + int index = myGeomBase->GetIndex(ic->SelectedShape(), ShapeTopo, SubShapeType); + ListOfID[i] = index; i++; ic->NextSelected(); } /* Close local context opened in DialogBox */ - ic->CloseLocalContext(aLocalContextId) ; - myUseLocalContext = false ; + ic->CloseLocalContext(aLocalContextId); + myUseLocalContext = false; /* Here is the main shape */ - GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString( ShapeTopoIOR ); + GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(ShapeTopoIOR); GEOM::GEOM_Gen::ListOfGeomShapes_var listGeomShapes = new GEOM::GEOM_Gen::ListOfGeomShapes; /* Call geom method that return a list of shells/faces as result of suppress */ try { - listGeomShapes = myGeom->SuppressFaces( aShape, ListOfID ); + listGeomShapes = myGeom->SuppressFaces(aShape, ListOfID); } - catch (const SALOME::SALOME_Exception& S_ex) { + catch(const SALOME::SALOME_Exception& S_ex) { QtCatchCorbaException(S_ex); } /* Test list of shells/faces */ - if( listGeomShapes->length() < 1 ) { - return false ; + if(listGeomShapes->length() < 1) { + return false; } /* Loop on each object created */ - for( int i=0; ilength(); i++ ) { + for(int i=0; ilength(); i++) { + GEOM::GEOM_Shape_var aShellOrFace = listGeomShapes[i]; + TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, aShellOrFace); - GEOM::GEOM_Shape_var aShellOrFace = listGeomShapes[i] ; - TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape( myGeom, aShellOrFace ); + if(S.IsNull()) + return false; - if( S.IsNull() ) { - return false ; - } - - char* nameG = (char *)malloc(20); + char* nameG = (char *)malloc(20); Standard_CString Type; - if ( myGeomGUI->GetShapeTypeString(S, Type) ) { - aShellOrFace->NameType( Type ); + if(myGeomBase->GetShapeTypeString(S, Type)) { + aShellOrFace->NameType(Type); sprintf (nameG, "%s_%d", Type, myGeomGUI->GetNbGeom()++); } else { - aShellOrFace->NameType( tr("GEOM_SHAPE") ); - sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->GetNbGeom()++ ); + aShellOrFace->NameType(tr("GEOM_SHAPE")); + sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->GetNbGeom()++); } /* Display with name */ - if( !myGeomGUI->Display( aShellOrFace, nameG) ) { + if(!myGeomBase->Display(aShellOrFace, nameG)) { myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); - return false ; + return false; } } myGeomGUI->GetDesktop()->putInfo (tr("GEOM_PRP_READY")); - return true ; + return true; } diff --git a/src/RepairGUI/RepairGUI.h b/src/RepairGUI/RepairGUI.h index 424d33694..1afe5a85f 100644 --- a/src/RepairGUI/RepairGUI.h +++ b/src/RepairGUI/RepairGUI.h @@ -29,7 +29,7 @@ #ifndef REPAIRGUI_H #define REPAIRGUI_H -#include "GEOMBase_Display.h" +#include "GEOMBase.h" //================================================================================= // class : RepairGUI @@ -43,7 +43,6 @@ public : RepairGUI(); ~RepairGUI(); - static RepairGUI* GetOrCreateGUI(); static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); void MakeSewingAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR, @@ -60,7 +59,8 @@ public : const Standard_Integer& aLocalContextId, bool& myUseLocalContext); - GEOMBase_Context* myGeomGUI; + GEOMBase* myGeomBase; + GEOMContext* myGeomGUI; GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ }; diff --git a/src/RepairGUI/RepairGUI_OrientationDlg.cxx b/src/RepairGUI/RepairGUI_OrientationDlg.cxx index e123c3388..93c427d4e 100644 --- a/src/RepairGUI/RepairGUI_OrientationDlg.cxx +++ b/src/RepairGUI/RepairGUI_OrientationDlg.cxx @@ -29,7 +29,7 @@ using namespace std; #include "RepairGUI_OrientationDlg.h" - +#include #include "QAD_Config.h" #include @@ -200,7 +200,8 @@ void RepairGUI_OrientationDlg::Init( SALOME_Selection* Sel ) CheckBoxReverse->setChecked( FALSE ); myEditCurrentArgument = LineEditC1A1 ; mySelection = Sel; - myGeomGUI = GEOMBase_Context::GetGeomGUI() ; + myGeomBase = new GEOMBase() ; + myGeomGUI = GEOMContext::GetGeomGUI() ; myLength = 25.0 ; myOkShape = false ; @@ -233,7 +234,7 @@ void RepairGUI_OrientationDlg::Init( SALOME_Selection* Sel ) /* Move widget on the botton right corner of main widget */ int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; + myGeomBase->DefineDlgPosition( this, x, y ) ; this->move( x, y ) ; this->show() ; /* displays Dialog */ @@ -293,7 +294,7 @@ void RepairGUI_OrientationDlg::ClickOnApply() //================================================================================= void RepairGUI_OrientationDlg::ClickOnCancel() { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; disconnect( mySelection, 0, this, 0 ); myGeomGUI->ResetState() ; @@ -318,7 +319,7 @@ void RepairGUI_OrientationDlg::LineEditReturnPressed() /* so SelectionIntoArgument() is automatically called. */ const QString objectUserName = myEditCurrentArgument->text() ; QWidget* thisWidget = (QWidget*)this ; - if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { + if( myGeomBase->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { myEditCurrentArgument->setText( objectUserName ) ; } return ; @@ -332,13 +333,13 @@ void RepairGUI_OrientationDlg::LineEditReturnPressed() //================================================================================= void RepairGUI_OrientationDlg::SelectionIntoArgument() { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; this->mySimulationTopoDs.Nullify() ; /* Name of future selection */ QString aString = ""; - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ; if ( nbSel != 1 ) { if ( myEditCurrentArgument == LineEditC1A1 ) { LineEditC1A1->setText("") ; @@ -351,12 +352,12 @@ void RepairGUI_OrientationDlg::SelectionIntoArgument() TopoDS_Shape S; Standard_Boolean testResult ; Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) + if( !myGeomBase->GetTopoFromSelection(mySelection, S) ) return ; /* Constructor */ if ( myEditCurrentArgument == LineEditC1A1 ) { - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; + myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult) ; if( !testResult ) return ; LineEditC1A1->setText(aString) ; @@ -400,7 +401,7 @@ void RepairGUI_OrientationDlg::SetEditCurrentArgument() //================================================================================= void RepairGUI_OrientationDlg::ValueChangedInSpinBox( double newValue ) { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; QObject* send = (QObject*)sender() ; @@ -427,7 +428,7 @@ void RepairGUI_OrientationDlg::DeactivateActiveDialog() GroupButtons->setEnabled(false) ; GroupC1->setEnabled(false) ; disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; } return ; } @@ -447,7 +448,7 @@ void RepairGUI_OrientationDlg::ActivateThisDialog() connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; + myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; return ; } @@ -502,7 +503,7 @@ void RepairGUI_OrientationDlg::ReverseOrientation(int state) //=========================================================================================== void RepairGUI_OrientationDlg::MakeOrientationSimulationAndDisplay(const TopoDS_Shape& aTopoDS, Standard_Real length ) { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; TopoDS_Compound aCompound1, aCompound2 ; @@ -525,8 +526,8 @@ void RepairGUI_OrientationDlg::MakeOrientationSimulationAndDisplay(const TopoDS_ else tmpShape.Orientation(TopAbs_FORWARD) ; } - if( myGeomGUI->CreateArrowForLinearEdge( tmpShape, mySimulationTopoDs ) ) { - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; + if( myGeomBase->CreateArrowForLinearEdge( tmpShape, mySimulationTopoDs ) ) { + myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; } return ; } @@ -599,7 +600,7 @@ void RepairGUI_OrientationDlg::MakeOrientationSimulationAndDisplay(const TopoDS_ mySimulationTopoDs = aCompound2 ; } if(!mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs) ; + myGeomBase->DisplaySimulationShape(mySimulationTopoDs) ; return ; } diff --git a/src/RepairGUI/RepairGUI_OrientationDlg.h b/src/RepairGUI/RepairGUI_OrientationDlg.h index 40d6fd315..79e4f93df 100644 --- a/src/RepairGUI/RepairGUI_OrientationDlg.h +++ b/src/RepairGUI/RepairGUI_OrientationDlg.h @@ -64,7 +64,8 @@ public: private : RepairGUI* myRepairGUI; GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */ + GEOMBase* myGeomBase ; /* Current GeomGUI object */ + GEOMContext* myGeomGUI ; /* Current GeomGUI object */ TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */ SALOME_Selection* mySelection ; /* User shape selection */ GEOM::GEOM_Shape_var myGeomShape ; /* is myShape */ diff --git a/src/RepairGUI/RepairGUI_SewingDlg.cxx b/src/RepairGUI/RepairGUI_SewingDlg.cxx index 47e551eb3..3404d99ca 100644 --- a/src/RepairGUI/RepairGUI_SewingDlg.cxx +++ b/src/RepairGUI/RepairGUI_SewingDlg.cxx @@ -29,21 +29,7 @@ using namespace std; #include "RepairGUI_SewingDlg.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - +#include "QAD_Config.h" //================================================================================= // class : RepairGUI_SewingDlg() @@ -52,108 +38,32 @@ using namespace std; // The dialog will by default be modeless, unless you set 'modal' to // TRUE to construct a modal dialog. //================================================================================= -RepairGUI_SewingDlg::RepairGUI_SewingDlg( QWidget* parent, const char* name, RepairGUI* theRepairGUI, SALOME_Selection* Sel, bool modal, WFlags fl ) - : QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) +RepairGUI_SewingDlg::RepairGUI_SewingDlg(QWidget* parent, const char* name, RepairGUI* theRepairGUI, 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_SEWING"))); - QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); - - if ( !name ) - setName( "RepairGUI_SewingDlg" ); - resize( 303, 219 ); - setCaption( tr( "GEOM_SEWING_TITLE" ) ); - setSizeGripEnabled( TRUE ); - RepairGUI_SewingDlgLayout = new QGridLayout( this ); - RepairGUI_SewingDlgLayout->setSpacing( 6 ); - RepairGUI_SewingDlgLayout->setMargin( 11 ); - - /***************************************************************/ - GroupConstructors = new QButtonGroup( this, "GroupConstructors" ); - GroupConstructors->setTitle( tr( "GEOM_SEWING" ) ); - GroupConstructors->setExclusive( TRUE ); - GroupConstructors->setColumnLayout(0, Qt::Vertical ); - GroupConstructors->layout()->setSpacing( 0 ); - GroupConstructors->layout()->setMargin( 0 ); - GroupConstructorsLayout = new QGridLayout( GroupConstructors->layout() ); - GroupConstructorsLayout->setAlignment( Qt::AlignTop ); - GroupConstructorsLayout->setSpacing( 6 ); - GroupConstructorsLayout->setMargin( 11 ); - Constructor1 = new QRadioButton( GroupConstructors, "Constructor1" ); - Constructor1->setText( tr( "" ) ); - Constructor1->setPixmap( image0 ); - Constructor1->setChecked( TRUE ); - Constructor1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, Constructor1->sizePolicy().hasHeightForWidth() ) ); - Constructor1->setMinimumSize( QSize( 50, 0 ) ); - GroupConstructorsLayout->addWidget( Constructor1, 0, 0 ); - QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupConstructorsLayout->addItem( spacer, 0, 1 ); - RepairGUI_SewingDlgLayout->addWidget( GroupConstructors, 0, 0 ); - - /***************************************************************/ - GroupButtons = new QGroupBox( this, "GroupButtons" ); - GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); - GroupButtons->setTitle( tr( "" ) ); - GroupButtons->setColumnLayout(0, Qt::Vertical ); - GroupButtons->layout()->setSpacing( 0 ); - GroupButtons->layout()->setMargin( 0 ); - GroupButtonsLayout = new QGridLayout( GroupButtons->layout() ); - GroupButtonsLayout->setAlignment( Qt::AlignTop ); - GroupButtonsLayout->setSpacing( 6 ); - GroupButtonsLayout->setMargin( 11 ); - buttonCancel = new QPushButton( GroupButtons, "buttonCancel" ); - buttonCancel->setText( tr( "GEOM_BUT_CLOSE" ) ); - buttonCancel->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonCancel, 0, 3 ); - buttonApply = new QPushButton( GroupButtons, "buttonApply" ); - buttonApply->setText( tr( "GEOM_BUT_APPLY" ) ); - buttonApply->setAutoDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonApply, 0, 1 ); - QSpacerItem* spacer_9 = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); - GroupButtonsLayout->addItem( spacer_9, 0, 2 ); - buttonOk = new QPushButton( GroupButtons, "buttonOk" ); - buttonOk->setText( tr( "GEOM_BUT_OK" ) ); - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); - GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); - RepairGUI_SewingDlgLayout->addWidget( GroupButtons, 2, 0 ); - GroupC1 = new QGroupBox( this, "GroupC1" ); - GroupC1->setTitle( tr( "GEOM_ARGUMENTS" ) ); - GroupC1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)5, GroupC1->sizePolicy().hasHeightForWidth() ) ); - GroupC1->setColumnLayout(0, Qt::Vertical ); - GroupC1->layout()->setSpacing( 0 ); - GroupC1->layout()->setMargin( 0 ); - GroupC1Layout = new QGridLayout( GroupC1->layout() ); - GroupC1Layout->setAlignment( Qt::AlignTop ); - GroupC1Layout->setSpacing( 6 ); - GroupC1Layout->setMargin( 11 ); - LineEditC1A1 = new QLineEdit( GroupC1, "LineEditC1A1" ); - LineEditC1A1->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A1->sizePolicy().hasHeightForWidth() ) ); - GroupC1Layout->addWidget( LineEditC1A1, 0, 2 ); - LineEditC1A2 = new QLineEdit( GroupC1, "LineEditC1A2" ); - LineEditC1A2->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)3, (QSizePolicy::SizeType)0, LineEditC1A2->sizePolicy().hasHeightForWidth() ) ); - LineEditC1A2->setMinimumSize( QSize( 40, 0 ) ); - LineEditC1A2->setMaximumSize( QSize( 32767, 32767 ) ); - GroupC1Layout->addWidget( LineEditC1A2, 1, 2 ); - SelectButtonC1A1 = new QPushButton( GroupC1, "SelectButtonC1A1" ); - SelectButtonC1A1->setText( tr( "" ) ); - SelectButtonC1A1->setPixmap( image1 ); - GroupC1Layout->addWidget( SelectButtonC1A1, 0, 1 ); - TextLabelC1A1 = new QLabel( GroupC1, "TextLabelC1A1" ); - TextLabelC1A1->setText( tr( "GEOM_OBJECTS" ) ); - TextLabelC1A1->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A1->setFrameShape( QLabel::NoFrame ); - TextLabelC1A1->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A1, 0, 0 ); - TextLabelC1A2 = new QLabel( GroupC1, "TextLabelC1A2" ); - TextLabelC1A2->setText( tr( "GEOM_PRECISION" ) ); - TextLabelC1A2->setMinimumSize( QSize( 50, 0 ) ); - TextLabelC1A2->setFrameShape( QLabel::NoFrame ); - TextLabelC1A2->setFrameShadow( QLabel::Plain ); - GroupC1Layout->addWidget( TextLabelC1A2, 1, 0 ); - RepairGUI_SewingDlgLayout->addWidget( GroupC1, 1, 0 ); - /***************************************************************/ - myRepairGUI = theRepairGUI; - Init(Sel) ; /* Initialisations */ + QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SEWING"))); + QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT"))); + + setCaption(tr("GEOM_SEWING_TITLE")); + + /***************************************************************/ + GroupConstructors->setTitle(tr("GEOM_SEWING")); + RadioButton1->setPixmap(image0); + RadioButton2->close(TRUE); + RadioButton3->close(TRUE); + + GroupPoints = new DlgRef_1Sel1Spin(this, "GroupPoints"); + GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS")); + GroupPoints->TextLabel1->setText(tr("GEOM_OBJECTS")); + GroupPoints->TextLabel2->setText(tr("GEOM_PRECISION")); + GroupPoints->PushButton1->setPixmap(image1); + + Layout1->addWidget(GroupPoints, 1, 0); + /***************************************************************/ + + /* Initialisations */ + myRepairGUI = theRepairGUI; + Init(); } @@ -163,7 +73,7 @@ RepairGUI_SewingDlg::RepairGUI_SewingDlg( QWidget* parent, const char* name, Re //================================================================================= RepairGUI_SewingDlg::~RepairGUI_SewingDlg() { - // no need to delete child widgets, Qt does it all for us + // no need to delete child widgets, Qt does it all for us } @@ -171,102 +81,63 @@ RepairGUI_SewingDlg::~RepairGUI_SewingDlg() // function : Init() // purpose : //================================================================================= -void RepairGUI_SewingDlg::Init( SALOME_Selection* Sel ) +void RepairGUI_SewingDlg::Init() { - LineEditC1A1->setMaxLength( 10 ); - QDoubleValidator *Va = new QDoubleValidator( -0.000001, +10000.0, 3, LineEditC1A1 ) ; - LineEditC1A1->setValidator( Va ) ; - - GroupC1->show(); - myConstructorId = 0 ; - Constructor1->setChecked( TRUE ); - myEditCurrentArgument = LineEditC1A1 ; - mySelection = Sel; - this->myOkListShapes = false ; - this->myPrecision = 0.00001 ; - LineEditC1A2->setText("0.00001") ; - myGeomGUI = GEOMBase_Context::GetGeomGUI() ; - myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; - - // TODO previous selection into argument ? - - /* Filter definitions */ - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); + /* init variables */ + myEditCurrentArgument = GroupPoints->LineEdit1; + + myOkListShapes = false; + myPrecision = 0.00001; + /* Get setting of step value from file configuration */ + QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep"); + step = St.toDouble(); + + /* min, max, step and decimals for spin boxes */ + GroupPoints->SpinBox_DX->RangeStepAndValidator(0.00001, 999.99999, step, 5); + GroupPoints->SpinBox_DX->SetValue(myPrecision); + /* signals and slots connections */ - connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); - connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; - connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) ); - connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) ); - - connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; - connect( LineEditC1A2, SIGNAL (returnPressed() ), this, SLOT( LineEditReturnPressed() ) ) ; - connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; - /* to close dialog if study change */ - connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; - - /* Move widget on the botton right corner of main widget */ - int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; - this->move( x, y ) ; - this->show() ; /* displays Dialog */ - return ; -} + connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply())); + connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument())); + connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); + connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double))); + + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); -//================================================================================= -// function : ConstructorsClicked() -// purpose : Radio button management -//================================================================================= -void RepairGUI_SewingDlg::ConstructorsClicked(int constructorId) -{ - return ; + /* displays Dialog */ + GroupPoints->show(); + this->show(); + + return; } + //================================================================================= // function : ClickOnOk() // purpose : //================================================================================= void RepairGUI_SewingDlg::ClickOnOk() { - this->ClickOnApply() ; - this->ClickOnCancel() ; - - return ; + this->ClickOnApply(); + ClickOnCancel(); + return; } + //================================================================================= // function : ClickOnApply() // purpose : //================================================================================= void RepairGUI_SewingDlg::ClickOnApply() { - switch(myConstructorId) - { - case 0 : - { - if(myOkListShapes) { - myRepairGUI->MakeSewingAndDisplay( myListShapes, myPrecision ) ; - } - break ; - } - } - // accept(); - return ; -} - - -//================================================================================= -// function : ClickOnCancel() -// purpose : -//================================================================================= -void RepairGUI_SewingDlg::ClickOnCancel() -{ - myGeomGUI->ResetState() ; - reject() ; - return ; + myGeomGUI->GetDesktop()->putInfo(tr("")); + if(myOkListShapes) + myRepairGUI->MakeSewingAndDisplay(myListShapes, myPrecision); + return; } @@ -276,27 +147,22 @@ void RepairGUI_SewingDlg::ClickOnCancel() //================================================================================= void RepairGUI_SewingDlg::SelectionIntoArgument() { - /* All this for first constructor */ - // if(myEditCurrentArgument == LineEditC1A1 ) - - myOkListShapes = false; - myEditCurrentArgument->setText("") ; + myEditCurrentArgument->setText(""); QString aString = ""; /* name of selection */ + myOkListShapes = false; - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; - if ( nbSel < 2 ) { - return ; - } + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); + if(nbSel < 2) + return; - myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes) ; - myEditCurrentArgument->setText(aString) ; - myOkListShapes = true ; + myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes); + myEditCurrentArgument->setText(aString); + myOkListShapes = true; /* no simulation */ - return ; + return; } - //================================================================================= // function : SetEditCurrentArgument() // purpose : @@ -304,46 +170,13 @@ void RepairGUI_SewingDlg::SelectionIntoArgument() void RepairGUI_SewingDlg::SetEditCurrentArgument() { QPushButton* send = (QPushButton*)sender(); - switch (myConstructorId) - { - case 0: /* default constructor */ - { - if(send == SelectButtonC1A1) { - LineEditC1A1->setFocus() ; - myEditCurrentArgument = LineEditC1A1; - } - SelectionIntoArgument() ; - break; - } - } - return ; -} - - -//================================================================================= -// function : LineEditReturnPressed() -// purpose : -//================================================================================= -void RepairGUI_SewingDlg::LineEditReturnPressed() -{ - this->myPrecision = LineEditC1A2->text().toFloat(); - return ; -} - - -//================================================================================= -// function : DeactivateActiveDialog() -// purpose : -//================================================================================= -void RepairGUI_SewingDlg::DeactivateActiveDialog() -{ - if ( GroupConstructors->isEnabled() ) { - GroupConstructors->setEnabled(false) ; - GroupC1->setEnabled(false) ; - GroupButtons->setEnabled(false) ; + if(send == GroupPoints->PushButton1) { + GroupPoints->LineEdit1->setFocus(); + myEditCurrentArgument = GroupPoints->LineEdit1; + this->SelectionIntoArgument(); } - return ; + return; } @@ -353,12 +186,9 @@ void RepairGUI_SewingDlg::DeactivateActiveDialog() //================================================================================= void RepairGUI_SewingDlg::ActivateThisDialog() { - /* Emit a signal to deactivate the active dialog */ - myGeomGUI->EmitSignalDeactivateDialog() ; - GroupConstructors->setEnabled(true) ; - GroupC1->setEnabled(true) ; - GroupButtons->setEnabled(true) ; - return ; + GEOMBase_Skeleton::ActivateThisDialog(); + connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); + return; } @@ -368,21 +198,19 @@ void RepairGUI_SewingDlg::ActivateThisDialog() //================================================================================= void RepairGUI_SewingDlg::enterEvent(QEvent* e) { - if ( GroupConstructors->isEnabled() ) - return ; - ActivateThisDialog() ; - return ; + if(GroupConstructors->isEnabled()) + return; + this->ActivateThisDialog(); + return; } //================================================================================= -// function : closeEvent() +// function : ValueChangedInSpinBox() // purpose : //================================================================================= -void RepairGUI_SewingDlg::closeEvent( QCloseEvent* e ) +void RepairGUI_SewingDlg::ValueChangedInSpinBox(double newValue) { - /* same than click on cancel button */ - this->ClickOnCancel() ; - return ; + myPrecision = newValue; + return; } - diff --git a/src/RepairGUI/RepairGUI_SewingDlg.h b/src/RepairGUI/RepairGUI_SewingDlg.h index d9fb934d5..7e55b400b 100644 --- a/src/RepairGUI/RepairGUI_SewingDlg.h +++ b/src/RepairGUI/RepairGUI_SewingDlg.h @@ -29,79 +29,45 @@ #ifndef DIALOGBOX_SEWING_H #define DIALOGBOX_SEWING_H -#include "RepairGUI.h" - -#include -#include - -class QVBoxLayout; -class QHBoxLayout; -class QGridLayout; -class QButtonGroup; -class QGroupBox; -class QLabel; -class QLineEdit; -class QPushButton; -class QRadioButton; +#include "GEOMBase_Skeleton.h" +#include "DlgRef_1Sel1Spin.h" +#include "RepairGUI.h" //================================================================================= // class : RepairGUI_SewingDlg // purpose : //================================================================================= -class RepairGUI_SewingDlg : public QDialog +class RepairGUI_SewingDlg : public GEOMBase_Skeleton { Q_OBJECT public: - RepairGUI_SewingDlg( QWidget* parent = 0, const char* name = 0, RepairGUI* theRepairGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0 ); + RepairGUI_SewingDlg(QWidget* parent = 0, const char* name = 0, RepairGUI* theRepairGUI = 0, SALOME_Selection* Sel = 0, bool modal = FALSE, WFlags fl = 0); ~RepairGUI_SewingDlg(); private: + void Init(); + void enterEvent(QEvent* e); + RepairGUI* myRepairGUI; - void Init( SALOME_Selection* Sel ) ; - void closeEvent( QCloseEvent* e ) ; - void enterEvent ( QEvent * ) ; /* mouse enter the QWidget */ - GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ - GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */ - SALOME_Selection* mySelection ; /* User shape selection */ - GEOM::GEOM_Gen::ListOfIOR myListShapes ; - Standard_Real myPrecision ; - bool myOkListShapes ; /* to check when arguments is defined */ - int myConstructorId ; /* Current constructor id = radio button id */ - QLineEdit* myEditCurrentArgument; /* Current LineEdit */ + double step; - QButtonGroup* GroupConstructors; - QRadioButton* Constructor1; - QGroupBox* GroupButtons; - QPushButton* buttonApply; - QPushButton* buttonOk; - QPushButton* buttonCancel; - QGroupBox* GroupC1; - QLineEdit* LineEditC1A1; - QLineEdit* LineEditC1A2; - QPushButton* SelectButtonC1A1; - QLabel* TextLabelC1A1; - QLabel* TextLabelC1A2; + GEOM::GEOM_Gen::ListOfIOR myListShapes; + Standard_Real myPrecision; + bool myOkListShapes; /* to check when arguments is defined */ -private slots: + DlgRef_1Sel1Spin* GroupPoints; - void ConstructorsClicked(int constructorId); +private slots: void ClickOnOk(); - void ClickOnCancel(); void ClickOnApply(); - void SetEditCurrentArgument() ; - void LineEditReturnPressed() ; - void SelectionIntoArgument() ; - void DeactivateActiveDialog() ; - void ActivateThisDialog() ; + void ActivateThisDialog(); + void SelectionIntoArgument(); + void SetEditCurrentArgument(); + void ValueChangedInSpinBox(double newValue); -protected: - QGridLayout* RepairGUI_SewingDlgLayout; - QGridLayout* GroupConstructorsLayout; - QGridLayout* GroupButtonsLayout; - QGridLayout* GroupC1Layout; }; #endif // DIALOGBOX_SEWING_H diff --git a/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx b/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx index ccdfe8744..9112eee7a 100644 --- a/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx +++ b/src/RepairGUI/RepairGUI_SuppressFacesDlg.cxx @@ -29,6 +29,9 @@ using namespace std; #include "RepairGUI_SuppressFacesDlg.h" +#include "DisplayGUI.h" + + #include #include #include @@ -194,7 +197,8 @@ void RepairGUI_SuppressFacesDlg::Init( SALOME_Selection* Sel, Handle (AIS_Intera myIC = ic ; myUseLocalContext = false ; myOkShape = false ; - myGeomGUI = GEOMBase_Context::GetGeomGUI() ; + myGeomBase = new GEOMBase() ; + myGeomGUI = GEOMContext::GetGeomGUI() ; /* Select sub shapes mode not checked */ CheckBox1->setChecked( FALSE ); @@ -220,7 +224,7 @@ void RepairGUI_SuppressFacesDlg::Init( SALOME_Selection* Sel, Handle (AIS_Intera /* Move widget on the botton right corner of main widget */ int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; + myGeomBase->DefineDlgPosition( this, x, y ) ; this->move( x, y ) ; this->show() ; /* display Dialog */ return ; @@ -293,7 +297,7 @@ void RepairGUI_SuppressFacesDlg::ClickOnClose() if(myUseLocalContext) { myIC->CloseLocalContext(myLocalContextId) ; this->myUseLocalContext = false ; - GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); + DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->OnDisplayAll(true) ; } reject() ; @@ -314,7 +318,7 @@ void RepairGUI_SuppressFacesDlg::SelectionIntoArgument() QString aString = ""; /* name of selection */ - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ; if ( nbSel != 1 ) return ; @@ -322,7 +326,7 @@ void RepairGUI_SuppressFacesDlg::SelectionIntoArgument() TopoDS_Shape S ; Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) + if( !myGeomBase->GetTopoFromSelection(mySelection, S) ) return ; if( !IO->hasEntry() ) { @@ -413,7 +417,7 @@ void RepairGUI_SuppressFacesDlg::DeactivateActiveDialog() GroupButtons->setEnabled(false) ; myGeomGUI->ResetState() ; myGeomGUI->SetActiveDialogBox(0) ; - GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); + DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->OnDisplayAll(true) ; } return ; @@ -480,13 +484,14 @@ void RepairGUI_SuppressFacesDlg::ActivateUserSelection() if( this->myUseLocalContext ) { myIC->CloseLocalContext(myLocalContextId) ; this->myUseLocalContext = false ; - GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); + DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->OnDisplayAll(true) ; } if( myOkShape && myOkSelectSubMode ) { /* local context is defined into the method : 4 = FACES sub selection */ - myGeomGUI->PrepareSubShapeSelection( int(TopAbs_FACE), this->myLocalContextId ) ; + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->PrepareSubShapeSelection( int(TopAbs_FACE), this->myLocalContextId ) ; myUseLocalContext = true ; myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_FACE")) ; } @@ -516,7 +521,7 @@ void RepairGUI_SuppressFacesDlg::ResetStateOfDialog() if( this->myUseLocalContext ) { myIC->CloseLocalContext(this->myLocalContextId) ; this->myUseLocalContext = false ; - GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); + DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->OnDisplayAll(true) ; } return ; diff --git a/src/RepairGUI/RepairGUI_SuppressFacesDlg.h b/src/RepairGUI/RepairGUI_SuppressFacesDlg.h index 7d9ef3288..e200493c9 100644 --- a/src/RepairGUI/RepairGUI_SuppressFacesDlg.h +++ b/src/RepairGUI/RepairGUI_SuppressFacesDlg.h @@ -80,7 +80,8 @@ private : bool myUseLocalContext ; /* true when this method as opened a local context */ GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */ + GEOMBase* myGeomBase ; /* Current GeomGUI object */ + GEOMContext* myGeomGUI ; /* Current GeomGUI object */ SALOME_Selection* mySelection ; /* User shape selection */ TopoDS_Shape myShape ; diff --git a/src/RepairGUI/RepairGUI_SuppressHoleDlg.cxx b/src/RepairGUI/RepairGUI_SuppressHoleDlg.cxx index ca4e06b78..6a98dfcaf 100644 --- a/src/RepairGUI/RepairGUI_SuppressHoleDlg.cxx +++ b/src/RepairGUI/RepairGUI_SuppressHoleDlg.cxx @@ -29,7 +29,7 @@ using namespace std; #include "RepairGUI_SuppressHoleDlg.h" - +#include "DisplayGUI.h" #include "TopExp_Explorer.hxx" @@ -294,7 +294,8 @@ void RepairGUI_SuppressHoleDlg::Init( SALOME_Selection* Sel, Handle (AIS_Interac myListOfIdWire->length(0) ; myListOfIdEndFace->length(0) ; - myGeomGUI = GEOMBase_Context::GetGeomGUI() ; + myGeomBase = new GEOMBase() ; + myGeomGUI = GEOMContext::GetGeomGUI() ; /* Select sub modes not checked */ CheckBox1->setChecked( FALSE ); /* sub mode GEOM::FACE */ @@ -334,7 +335,7 @@ void RepairGUI_SuppressHoleDlg::Init( SALOME_Selection* Sel, Handle (AIS_Interac /* Move widget on the botton right corner of main widget */ int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; + myGeomBase->DefineDlgPosition( this, x, y ) ; this->move( x, y ) ; this->show() ; /* display Dialog */ return ; @@ -417,9 +418,9 @@ void RepairGUI_SuppressHoleDlg::ClickOnApply() if( !CheckBox3->isChecked() ) { /* Call method to get sub shape selection of GEOM::WIRE */ - bool aTest = myGeomGUI->GetIndexSubShapeSelected(myFace, int(TopAbs_WIRE), myListOfIdWire, myLocalContextId, myUseLocalContext) ; + bool aTest = myGeomBase->GetIndexSubShapeSelected(myFace, int(TopAbs_WIRE), myListOfIdWire, myLocalContextId, myUseLocalContext) ; - GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); + DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->OnDisplayAll(true) ;/* Display all objects so that next method using ic can memorize them */ if( !aTest || myListOfIdWire->length() != 1 ) { CheckBox2->setChecked(FALSE) ; @@ -435,9 +436,9 @@ void RepairGUI_SuppressHoleDlg::ClickOnApply() else { /* CheckBox3->isChecked() */ /* Call method to get sub shape selection of END GEOM::FACE */ - bool aTest = myGeomGUI->GetIndexSubShapeSelected(myShape, int(TopAbs_FACE), myListOfIdEndFace, myLocalContextId, myUseLocalContext) ; + bool aTest = myGeomBase->GetIndexSubShapeSelected(myShape, int(TopAbs_FACE), myListOfIdEndFace, myLocalContextId, myUseLocalContext) ; - GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); + DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->OnDisplayAll(true) ; /* Display all objects so that next method using ic can memorize them */ if( !aTest || myListOfIdEndFace->length() != 1 ) { CheckBox3->setChecked(FALSE) ; @@ -458,9 +459,9 @@ void RepairGUI_SuppressHoleDlg::ClickOnApply() if( CheckBoxC2_1->isChecked() ) { /* Call method to get sub shape selection of one or more GEOM::WIRE(s) on a face or a shell */ - bool aTest = myGeomGUI->GetIndexSubShapeSelected(myShape, int(TopAbs_WIRE), myListOfIdWire, myLocalContextId, myUseLocalContext) ; + bool aTest = myGeomBase->GetIndexSubShapeSelected(myShape, int(TopAbs_WIRE), myListOfIdWire, myLocalContextId, myUseLocalContext) ; - GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); + DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->OnDisplayAll(true) ; /* Display all objects so that next method using ic can memorize them */ if( !aTest || myListOfIdWire->length() < 1 ) { @@ -505,7 +506,7 @@ void RepairGUI_SuppressHoleDlg::ClickOnClose() if(myUseLocalContext) { myIC->CloseLocalContext(myLocalContextId) ; this->myUseLocalContext = false ; - GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); + DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->OnDisplayAll(true) ; } } @@ -528,7 +529,7 @@ void RepairGUI_SuppressHoleDlg::SelectionIntoArgument() QString aString = ""; /* Name of selection */ - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ; if ( nbSel != 1 ) return ; @@ -536,7 +537,7 @@ void RepairGUI_SuppressHoleDlg::SelectionIntoArgument() TopoDS_Shape S ; Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) + if( !myGeomBase->GetTopoFromSelection(mySelection, S) ) return ; if ( S.IsNull() || S.ShapeType() == TopAbs_VERTEX || S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE ) { @@ -631,7 +632,7 @@ void RepairGUI_SuppressHoleDlg::LineEditReturnPressed() /* so SelectionIntoArgument() is automatically called. */ const QString objectUserName = myEditCurrentArgument->text() ; QWidget* thisWidget = (QWidget*)this ; - if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { + if( myGeomBase->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { myEditCurrentArgument->setText( objectUserName ) ; } @@ -657,7 +658,7 @@ void RepairGUI_SuppressHoleDlg::DeactivateActiveDialog() myGeomGUI->ResetState() ; myGeomGUI->SetActiveDialogBox(0) ; - GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); + DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->OnDisplayAll(true) ; } return ; @@ -732,7 +733,8 @@ void RepairGUI_SuppressHoleDlg::ActivateUserFaceSelection() if( CheckBox1->isChecked() ) { /* local context is opened into the method : Prepare GEOM::FACE sub selection */ - myGeomGUI->PrepareSubShapeSelection( int(TopAbs_FACE), this->myLocalContextId ) ; + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->PrepareSubShapeSelection( int(TopAbs_FACE), this->myLocalContextId ) ; myUseLocalContext = true ; myGeomGUI->GetDesktop()->putInfo( tr("GEOM_SUPPRESSHOLE_SELECTFACE") ) ; } @@ -768,9 +770,9 @@ void RepairGUI_SuppressHoleDlg::ActivateUserWireSelection() if( CheckBox1->isChecked() ) { /* Get sub shape selection GEOM::FACE : local context is closed */ - bool aTest = myGeomGUI->GetIndexSubShapeSelected(myShape, int(TopAbs_FACE), myListOfIdFace, myLocalContextId, myUseLocalContext) ; + bool aTest = myGeomBase->GetIndexSubShapeSelected(myShape, int(TopAbs_FACE), myListOfIdFace, myLocalContextId, myUseLocalContext) ; - GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); + DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->OnDisplayAll(true) ; /* Display all objects so that next method using ic can memorize them */ if( !aTest || myListOfIdFace->length() != 1 ) { CheckBox1->setChecked(FALSE) ; @@ -792,7 +794,8 @@ void RepairGUI_SuppressHoleDlg::ActivateUserWireSelection() /* Get the face selection */ this->myFace = FaceFromList(myShape, myListOfIdFace) ; /* Local context is opened into the method : Prepare GEOM::WIRE sub selection into a face */ - myGeomGUI->PrepareSubShapeSelectionArgumentShape( this->myFace, int(TopAbs_WIRE), this->myLocalContextId ) ; + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->PrepareSubShapeSelectionArgumentShape( this->myFace, int(TopAbs_WIRE), this->myLocalContextId ) ; myUseLocalContext = true ; myGeomGUI->GetDesktop()->putInfo( tr("GEOM_SUPPRESSHOLE_SELECTWIRE") ) ; } @@ -829,9 +832,9 @@ void RepairGUI_SuppressHoleDlg::ActivateUserEndFaceSelection() if( CheckBox2->isChecked() ) { /* Call method to get sub shape selection for the GEOM::WIRE into myFace : local context is closed */ - bool aTest = myGeomGUI->GetIndexSubShapeSelected(this->myFace, int(TopAbs_WIRE), myListOfIdWire, myLocalContextId, myUseLocalContext) ; + bool aTest = myGeomBase->GetIndexSubShapeSelected(this->myFace, int(TopAbs_WIRE), myListOfIdWire, myLocalContextId, myUseLocalContext) ; - GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); + DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->OnDisplayAll(true) ; /* Display all objects so that next method using ic can memorize them */ if( !aTest || myListOfIdWire->length() != 1 ) { @@ -849,7 +852,8 @@ void RepairGUI_SuppressHoleDlg::ActivateUserEndFaceSelection() if( CheckBox3->isChecked() ) { /* Local context is opened into the method : prepare GEOM::FACE(end) into myShape sub selection */ - myGeomGUI->PrepareSubShapeSelectionArgumentShape( this->myShape, int(TopAbs_FACE), this->myLocalContextId ) ; + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->PrepareSubShapeSelectionArgumentShape( this->myShape, int(TopAbs_FACE), this->myLocalContextId ) ; myUseLocalContext = true ; myGeomGUI->GetDesktop()->putInfo( tr("GEOM_SUPPRESSHOLE_SELECTFACE_END") ) ; } @@ -886,7 +890,8 @@ void RepairGUI_SuppressHoleDlg::ActivateUserWiresOnFaceShellSelection() if( CheckBoxC2_1->isChecked() ) { /* Local context is opened to prepare GEOM::WIRE(S) selection into 'myShape' that is a (main) face */ - myGeomGUI->PrepareSubShapeSelectionArgumentShape( this->myShape, int(TopAbs_WIRE), this->myLocalContextId ) ; + DisplayGUI* myDisplayGUI = new DisplayGUI(); + myDisplayGUI->PrepareSubShapeSelectionArgumentShape( this->myShape, int(TopAbs_WIRE), this->myLocalContextId ) ; myUseLocalContext = true ; myGeomGUI->GetDesktop()->putInfo( tr("GEOM_SUPPRESSHOLE_SELECT_HOLES_ON_FACE") ) ; } @@ -903,7 +908,7 @@ void RepairGUI_SuppressHoleDlg::ActivateUserWiresOnFaceShellSelection() // purpose : Return the face (selected by user) that is a sub shape of 'aShape' // : and which unique index is in 'ListOfSub'. // : This allows opening a local context with this face loaded. -// : See : myGeomGUI->PrepareSubShapeSelectionArgumentShape(...) +// : See : myGeomBase->PrepareSubShapeSelectionArgumentShape(...) //================================================================================= TopoDS_Shape RepairGUI_SuppressHoleDlg::FaceFromList( const TopoDS_Shape& aShape, const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfSub ) @@ -967,7 +972,7 @@ void RepairGUI_SuppressHoleDlg::ResetPartial() if( this->myUseLocalContext ) { myIC->CloseLocalContext(this->myLocalContextId) ; this->myUseLocalContext = false ; - GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); + DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->OnDisplayAll(true) ; } } diff --git a/src/RepairGUI/RepairGUI_SuppressHoleDlg.h b/src/RepairGUI/RepairGUI_SuppressHoleDlg.h index e37068d19..85738c985 100644 --- a/src/RepairGUI/RepairGUI_SuppressHoleDlg.h +++ b/src/RepairGUI/RepairGUI_SuppressHoleDlg.h @@ -85,7 +85,8 @@ private : bool myUseLocalContext ; /* true when this method as opened a local context */ GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */ + GEOMBase* myGeomBase ; /* Current GeomGUI object */ + GEOMContext* myGeomGUI ; /* Current GeomGUI object */ SALOME_Selection* mySelection ; /* User shape selection */ TopoDS_Shape myShape ; /* Main shape selected */ diff --git a/src/TransformationGUI/Makefile.in b/src/TransformationGUI/Makefile.in index 5a4bf819d..41c729512 100644 --- a/src/TransformationGUI/Makefile.in +++ b/src/TransformationGUI/Makefile.in @@ -35,7 +35,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl @COMMENCE@ # header files -EXPORT_HEADERS= TransformationGUI.h +EXPORT_HEADERS= # Libraries targets LIB = libTransformationGUI.la @@ -72,6 +72,6 @@ LIB_SERVER_IDL = CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lDlgRef -lGEOMBase $(OCC_KERNEL_LIBS) $(OCC_MODELER_LIBS) -L${KERNEL_ROOT_DIR}/lib/salome +LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lDlgRef -lGEOMContext -lGEOMBase -lDisplayGUI -L${KERNEL_ROOT_DIR}/lib/salome @CONCLUDE@ diff --git a/src/TransformationGUI/TransformationGUI.cxx b/src/TransformationGUI/TransformationGUI.cxx index e9d971a15..c8e99cc14 100644 --- a/src/TransformationGUI/TransformationGUI.cxx +++ b/src/TransformationGUI/TransformationGUI.cxx @@ -29,6 +29,8 @@ using namespace std; #include "TransformationGUI.h" +#include "SALOMEGUI_QtCatchCorbaException.hxx" + #include "TransformationGUI_TranslationDlg.h" // Method TRANSLATION #include "TransformationGUI_RotationDlg.h" // Method ROTATION #include "TransformationGUI_MirrorDlg.h" // Method MIRROR @@ -36,8 +38,6 @@ using namespace std; #include "TransformationGUI_MultiTranslationDlg.h" // Method MULTI TRANSLATION #include "TransformationGUI_MultiRotationDlg.h" // Method MULTI ROTATION -static TransformationGUI* myTransformationGUI = 0; - //======================================================================= // function : TransformationGUI() // purpose : Constructor @@ -45,9 +45,11 @@ static TransformationGUI* myTransformationGUI = 0; TransformationGUI::TransformationGUI() : QObject() { - myGeomGUI = GEOMBase_Context::GetGeomGUI(); - Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); - myGeom = GEOM::GEOM_Gen::_narrow(comp); + myGeomBase = new GEOMBase(); + myGeomGUI = GEOMContext::GetGeomGUI(); +// Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); +// myGeom = GEOM::GEOM_Gen::_narrow(comp); + myGeom = myGeomGUI->myComponentGeom; } @@ -60,25 +62,13 @@ TransformationGUI::~TransformationGUI() } -//======================================================================= -// function : GetOrCreateGUI() -// purpose : Gets or create an object 'GUI' with initialisations -// : Returns 'GUI' as a pointer -//======================================================================= -TransformationGUI* TransformationGUI::GetOrCreateGUI() -{ - myTransformationGUI = new TransformationGUI(); - return myTransformationGUI; -} - - //======================================================================= // function : OnGUIEvent() // purpose : //======================================================================= bool TransformationGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) { - TransformationGUI::GetOrCreateGUI(); + TransformationGUI* myTransformationGUI = new TransformationGUI(); myTransformationGUI->myGeomGUI->EmitSignalDeactivateDialog(); SALOME_Selection* Sel = SALOME_Selection::Selection(myTransformationGUI->myGeomGUI->GetActiveStudy()->getSelection()); @@ -137,7 +127,7 @@ void TransformationGUI::MakeTranslationAndDisplay(GEOM::GEOM_Shape_ptr Shape, gp return; } result->NameType(Shape->NameType()); - if(myGeomGUI->Display(result)) + if(myGeomBase->Display(result)) myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { @@ -163,7 +153,7 @@ void TransformationGUI::MakeRotationAndDisplay(GEOM::GEOM_Shape_ptr Shape, const return ; } result->NameType(Shape->NameType()); - if(myGeomGUI->Display(result)) + if(myGeomBase->Display(result)) myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { @@ -186,7 +176,7 @@ void TransformationGUI::MakeMirrorAndDisplay(GEOM::GEOM_Shape_ptr Shape1, GEOM:: return; } result->NameType(Shape1->NameType()); - if(myGeomGUI->Display(result)) + if(myGeomBase->Display(result)) myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { @@ -207,7 +197,7 @@ void TransformationGUI::MakeScaleAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp GEOM::PointStruct P = myGeom->MakePointStruct(centralPoint.X(), centralPoint.Y(), centralPoint.Z()); GEOM::GEOM_Shape_var result = myGeom->MakeScaleTransform(Shape, P, factor); result->NameType(Shape->NameType()); - if(myGeomGUI->Display(result)) + if(myGeomBase->Display(result)) myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); else myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); @@ -236,7 +226,7 @@ void TransformationGUI::MakeMultiTranslation1DAndDisplay(GEOM::GEOM_Shape_ptr Sh return; } result->NameType(tr("GEOM_COMPOUND")); - if(myGeomGUI->Display(result)) + if(myGeomBase->Display(result)) myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { @@ -267,7 +257,7 @@ void TransformationGUI::MakeMultiTranslation2DAndDisplay(GEOM::GEOM_Shape_ptr Sh return; } result->NameType(tr("GEOM_COMPOUND")); - if(myGeomGUI->Display(result)) + if(myGeomBase->Display(result)) myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { @@ -295,7 +285,7 @@ void TransformationGUI::MakeMultiRotation1DAndDisplay(GEOM::GEOM_Shape_ptr Shape return; } result->NameType(tr("GEOM_COMPOUND")); - if(myGeomGUI->Display(result)) + if(myGeomBase->Display(result)) myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { @@ -325,7 +315,7 @@ void TransformationGUI::MakeMultiRotation2DAndDisplay(GEOM::GEOM_Shape_ptr Shape return; } result->NameType(tr("GEOM_COMPOUND")); - if(myGeomGUI->Display(result)) + if(myGeomBase->Display(result)) myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); } catch(const SALOME::SALOME_Exception& S_ex) { diff --git a/src/TransformationGUI/TransformationGUI.h b/src/TransformationGUI/TransformationGUI.h index 38b44e81e..efe1aba83 100644 --- a/src/TransformationGUI/TransformationGUI.h +++ b/src/TransformationGUI/TransformationGUI.h @@ -29,8 +29,7 @@ #ifndef TRANSFORMATIONGUI_H #define TRANSFORMATIONGUI_H -#include "GEOMBase_Display.h" -#include "QAD_Config.h" +#include "GEOMBase.h" //================================================================================= // class : TransformationGUI @@ -44,7 +43,6 @@ public : TransformationGUI(); ~TransformationGUI(); - static TransformationGUI* GetOrCreateGUI(); static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); void MakeTranslationAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Vec V); @@ -64,7 +62,8 @@ public : const gp_Dir Dir, const gp_Pnt Loc, const double Ang, const short NbTimes1, const double Step, const short NbTimes2); - GEOMBase_Context* myGeomGUI; + GEOMBase* myGeomBase; + GEOMContext* myGeomGUI; GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ }; diff --git a/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx index a7081a016..46c0bc7c8 100644 --- a/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MirrorDlg.cxx @@ -134,7 +134,7 @@ void TransformationGUI_MirrorDlg::ClickOnApply() myGeomGUI->GetDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); if(myOkShape1 && myOkShape2) @@ -149,12 +149,12 @@ void TransformationGUI_MirrorDlg::ClickOnApply() //================================================================================= void TransformationGUI_MirrorDlg::SelectionIntoArgument() { - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); myEditCurrentArgument->setText(""); QString aString = ""; /* name of selection */ - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); if(nbSel != 1) { if(myEditCurrentArgument == GroupPoints->LineEdit1) myOkShape1 = false; @@ -167,11 +167,11 @@ void TransformationGUI_MirrorDlg::SelectionIntoArgument() TopoDS_Shape S; Standard_Boolean testResult; Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); - if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) return; if(myEditCurrentArgument == GroupPoints->LineEdit1) { - myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult); + myGeomShape1 = myGeomBase->ConvertIOinGEOMShape(IO, testResult); if(!testResult) return; myShape1 = S; @@ -179,7 +179,7 @@ void TransformationGUI_MirrorDlg::SelectionIntoArgument() myOkShape1 = true; } else if(myEditCurrentArgument == GroupPoints->LineEdit2) { - myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult); + myGeomShape2 = myGeomBase->ConvertIOinGEOMShape(IO, testResult); if(!testResult) return ; myShape2 = S; @@ -258,7 +258,7 @@ void TransformationGUI_MirrorDlg::ActivateThisDialog() GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); if(!mySimulationTopoDs.IsNull()) - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; } @@ -269,7 +269,7 @@ void TransformationGUI_MirrorDlg::ActivateThisDialog() //================================================================================= void TransformationGUI_MirrorDlg::MakeMirrorSimulationAndDisplay() { - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); try { @@ -289,7 +289,7 @@ void TransformationGUI_MirrorDlg::MakeMirrorSimulationAndDisplay() if(mySimulationTopoDs.IsNull()) return; else - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); } catch(Standard_Failure) { MESSAGE("Exception catched in MakeMirrorSimulationAndDisplay"); diff --git a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx index 4618535ca..9b1b32d2f 100644 --- a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx @@ -29,7 +29,9 @@ using namespace std; #include "TransformationGUI_MultiRotationDlg.h" +#include "DisplayGUI.h" #include "QAD_Config.h" +#include #include #include @@ -362,7 +364,8 @@ void TransformationGUI_MultiRotationDlg::Init( SALOME_Selection* Sel ) Constructor1->setChecked( TRUE ); myEditCurrentArgument = LineEditC1A1 ; mySelection = Sel; - myGeomGUI = GEOMBase_Context::GetGeomGUI() ; + myGeomBase = new GEOMBase() ; + myGeomGUI = GEOMContext::GetGeomGUI() ; myOkBase = myOkDir = false ; mySimulationTopoDs.Nullify() ; @@ -409,7 +412,7 @@ void TransformationGUI_MultiRotationDlg::Init( SALOME_Selection* Sel ) /* Move widget on the botton right corner of main widget */ int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; + myGeomBase->DefineDlgPosition( this, x, y ) ; this->move( x, y ) ; this->show() ; /* displays Dialog */ @@ -428,7 +431,7 @@ void TransformationGUI_MultiRotationDlg::ReverseAngle(int state) MakeMultiRotationSimulationAndDisplay() ; } else { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; } return ; @@ -442,7 +445,7 @@ void TransformationGUI_MultiRotationDlg::ReverseAngle(int state) void TransformationGUI_MultiRotationDlg::ConstructorsClicked(int constructorId) { myEditCurrentArgument->setText(tr("")) ; - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; myAng = 45.0 ; @@ -501,7 +504,7 @@ void TransformationGUI_MultiRotationDlg::ClickOnOk() //================================================================================= void TransformationGUI_MultiRotationDlg::ClickOnApply() { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; myGeomGUI->GetDesktop()->putInfo( tr("") ) ; switch(myConstructorId) @@ -532,7 +535,7 @@ void TransformationGUI_MultiRotationDlg::ClickOnApply() void TransformationGUI_MultiRotationDlg::ClickOnCancel() { mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; disconnect( mySelection, 0, this, 0 ); myGeomGUI->ResetState() ; @@ -564,7 +567,7 @@ void TransformationGUI_MultiRotationDlg::LineEditReturnPressed() /* so SelectionIntoArgument() is automatically called. */ const QString objectUserName = myEditCurrentArgument->text() ; QWidget* thisWidget = (QWidget*)this ; - if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { + if( myGeomBase->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { myEditCurrentArgument->setText( objectUserName ) ; } return ; @@ -579,12 +582,12 @@ void TransformationGUI_MultiRotationDlg::LineEditReturnPressed() void TransformationGUI_MultiRotationDlg::SelectionIntoArgument() { myEditCurrentArgument->setText("") ; - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; /* Name of future selection */ QString aString = ""; - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ; TopoDS_Shape S; Standard_Boolean testResult ; @@ -606,11 +609,11 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument() } Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) + if( !myGeomBase->GetTopoFromSelection(mySelection, S) ) return ; if ( myEditCurrentArgument == LineEditC1A1 ) { - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; + myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult) ; if( !testResult ) return ; myEditCurrentArgument->setText(aString) ; @@ -629,7 +632,7 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument() MakeMultiRotationSimulationAndDisplay() ; } else { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; } break; @@ -649,11 +652,11 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument() } Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) + if( !myGeomBase->GetTopoFromSelection(mySelection, S) ) return ; if ( myEditCurrentArgument == LineEditC2A1 ) { - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; + myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult) ; if( !testResult ) return ; myEditCurrentArgument->setText(aString) ; @@ -672,7 +675,7 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument() MakeMultiRotationSimulationAndDisplay() ; } else { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; } break; @@ -752,7 +755,7 @@ void TransformationGUI_MultiRotationDlg::ValueChangedInt( int newIntValue ) MakeMultiRotationSimulationAndDisplay() ; } else { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; } break; @@ -763,7 +766,7 @@ void TransformationGUI_MultiRotationDlg::ValueChangedInt( int newIntValue ) MakeMultiRotationSimulationAndDisplay() ; } else { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; } break; @@ -796,7 +799,7 @@ void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox( double newValue MakeMultiRotationSimulationAndDisplay() ; } else { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; } break; @@ -807,7 +810,7 @@ void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox( double newValue MakeMultiRotationSimulationAndDisplay() ; } else { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; } break; @@ -829,11 +832,11 @@ void TransformationGUI_MultiRotationDlg::DeactivateActiveDialog() GroupC2->setEnabled(false) ; GroupButtons->setEnabled(false) ; disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySelection->ClearFilters() ; myGeomGUI->ResetState() ; myGeomGUI->SetActiveDialogBox(0) ; - GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); + DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->OnDisplayAll(true) ; } return ; @@ -855,7 +858,7 @@ void TransformationGUI_MultiRotationDlg::ActivateThisDialog() connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; + myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; return ; } @@ -892,7 +895,7 @@ void TransformationGUI_MultiRotationDlg::closeEvent( QCloseEvent* e ) //================================================================================= void TransformationGUI_MultiRotationDlg::MakeMultiRotationSimulationAndDisplay() { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; gp_Trsf theTransformation ; gp_Trsf theTransformation1 ; gp_Trsf theTransformation2 ; @@ -911,7 +914,7 @@ void TransformationGUI_MultiRotationDlg::MakeMultiRotationSimulationAndDisplay() B.MakeCompound( compound ); if ( myBase.ShapeType() == TopAbs_VERTEX) { - myGeomGUI->VertexToPoint( myBase, myPoint ); + myGeomBase->VertexToPoint( myBase, myPoint ); } else if ( myBase.ShapeType() == TopAbs_EDGE || myBase.ShapeType() == TopAbs_WIRE ) { BRepGProp::LinearProperties(myBase, System); @@ -941,7 +944,7 @@ void TransformationGUI_MultiRotationDlg::MakeMultiRotationSimulationAndDisplay() B.Add( compound, myBRepTransformation.Shape() ); } mySimulationTopoDs = compound; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; + myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; break; } case 1 : @@ -969,7 +972,7 @@ void TransformationGUI_MultiRotationDlg::MakeMultiRotationSimulationAndDisplay() } } mySimulationTopoDs = compound ; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; + myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; break; } } diff --git a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h index 870e6f162..829536660 100644 --- a/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h +++ b/src/TransformationGUI/TransformationGUI_MultiRotationDlg.h @@ -68,7 +68,8 @@ public: private : TransformationGUI* myTransformationGUI; GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */ + GEOMBase* myGeomBase ; /* Current GeomGUI object */ + GEOMContext* myGeomGUI ; /* Current GeomGUI object */ TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */ SALOME_Selection* mySelection ; /* User shape selection */ TopoDS_Shape myBase ; diff --git a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx index 3c0db4b38..3e53e51bd 100644 --- a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx @@ -30,6 +30,7 @@ using namespace std; #include "TransformationGUI_MultiTranslationDlg.h" #include "QAD_Config.h" +#include "DisplayGUI.h" #include #include @@ -400,7 +401,8 @@ void TransformationGUI_MultiTranslationDlg::Init( SALOME_Selection* Sel ) Constructor1->setChecked( TRUE ); myEditCurrentArgument = LineEditC1A1 ; mySelection = Sel; - myGeomGUI = GEOMBase_Context::GetGeomGUI() ; + myGeomBase = new GEOMBase() ; + myGeomGUI = GEOMContext::GetGeomGUI() ; myOkBase = myOkDir1 = myOkDir2 = false ; mySimulationTopoDs.Nullify() ; @@ -453,7 +455,7 @@ void TransformationGUI_MultiTranslationDlg::Init( SALOME_Selection* Sel ) /* Move widget on the botton right corner of main widget */ int x, y ; - myGeomGUI->DefineDlgPosition( this, x, y ) ; + myGeomBase->DefineDlgPosition( this, x, y ) ; this->move( x, y ) ; this->show() ; /* displays Dialog */ @@ -473,7 +475,7 @@ void TransformationGUI_MultiTranslationDlg::ReverseAngle1(int state) MakeMultiTranslationSimulationAndDisplay() ; } else { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; } return ; @@ -492,7 +494,7 @@ void TransformationGUI_MultiTranslationDlg::ReverseAngle2(int state) MakeMultiTranslationSimulationAndDisplay() ; } else { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; } return ; @@ -506,7 +508,7 @@ void TransformationGUI_MultiTranslationDlg::ReverseAngle2(int state) void TransformationGUI_MultiTranslationDlg::ConstructorsClicked(int constructorId) { myEditCurrentArgument->setText(tr("")) ; - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; myStep1 = 50.0 ; @@ -569,7 +571,7 @@ void TransformationGUI_MultiTranslationDlg::ClickOnOk() //================================================================================= void TransformationGUI_MultiTranslationDlg::ClickOnApply() { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; myGeomGUI->GetDesktop()->putInfo( tr("") ) ; switch(myConstructorId) @@ -600,7 +602,7 @@ void TransformationGUI_MultiTranslationDlg::ClickOnApply() void TransformationGUI_MultiTranslationDlg::ClickOnCancel() { mySelection->ClearFilters() ; - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; disconnect( mySelection, 0, this, 0 ); myGeomGUI->ResetState() ; @@ -634,7 +636,7 @@ void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed() /* so SelectionIntoArgument() is automatically called. */ const QString objectUserName = myEditCurrentArgument->text() ; QWidget* thisWidget = (QWidget*)this ; - if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { + if( myGeomBase->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { myEditCurrentArgument->setText( objectUserName ) ; } return ; @@ -649,12 +651,12 @@ void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed() void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument() { myEditCurrentArgument->setText("") ; - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; /* Future name of selection */ QString aString = ""; - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ; TopoDS_Shape S; Standard_Boolean testResult ; @@ -676,11 +678,11 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument() } Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) + if( !myGeomBase->GetTopoFromSelection(mySelection, S) ) return ; if ( myEditCurrentArgument == LineEditC1A1 ) { - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; + myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult) ; if( !testResult ) return ; myEditCurrentArgument->setText(aString) ; @@ -698,7 +700,7 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument() MakeMultiTranslationSimulationAndDisplay() ; } else { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; } break; @@ -722,11 +724,11 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument() } Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; - if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) + if( !myGeomBase->GetTopoFromSelection(mySelection, S) ) return ; if ( myEditCurrentArgument == LineEditC2A1 ) { - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; + myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult) ; if( !testResult ) return ; myEditCurrentArgument->setText(aString) ; @@ -750,7 +752,7 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument() MakeMultiTranslationSimulationAndDisplay() ; } else { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; } break; @@ -838,7 +840,7 @@ void TransformationGUI_MultiTranslationDlg::ValueChangedInt( int newIntValue ) MakeMultiTranslationSimulationAndDisplay() ; } else { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; } break; @@ -849,7 +851,7 @@ void TransformationGUI_MultiTranslationDlg::ValueChangedInt( int newIntValue ) MakeMultiTranslationSimulationAndDisplay() ; } else { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; } break; @@ -887,7 +889,7 @@ void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox( double newVal MakeMultiTranslationSimulationAndDisplay() ; } else { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; } break; @@ -898,7 +900,7 @@ void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox( double newVal MakeMultiTranslationSimulationAndDisplay() ; } else { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySimulationTopoDs.Nullify() ; } break; @@ -920,11 +922,11 @@ void TransformationGUI_MultiTranslationDlg::DeactivateActiveDialog() GroupC2->setEnabled(false) ; GroupButtons->setEnabled(false) ; disconnect( mySelection, 0, this, 0 ); - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; mySelection->ClearFilters() ; myGeomGUI->ResetState() ; myGeomGUI->SetActiveDialogBox(0) ; - GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); + DisplayGUI* myDisplayGUI = new DisplayGUI(); myDisplayGUI->OnDisplayAll(true) ; } return ; @@ -946,7 +948,7 @@ void TransformationGUI_MultiTranslationDlg::ActivateThisDialog() connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; if( !mySimulationTopoDs.IsNull() ) - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; + myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; return ; } @@ -983,7 +985,7 @@ void TransformationGUI_MultiTranslationDlg::closeEvent( QCloseEvent* e ) //================================================================================= void TransformationGUI_MultiTranslationDlg::MakeMultiTranslationSimulationAndDisplay() { - myGeomGUI->EraseSimulationShape() ; + myGeomBase->EraseSimulationShape() ; gp_Trsf theTransformation ; mySimulationTopoDs.Nullify() ; @@ -1024,7 +1026,7 @@ void TransformationGUI_MultiTranslationDlg::MakeMultiTranslationSimulationAndDis B.Add( compound, myBRepTransformation.Shape() ); } mySimulationTopoDs = compound; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; + myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; break; } case 1 : @@ -1047,7 +1049,7 @@ void TransformationGUI_MultiTranslationDlg::MakeMultiTranslationSimulationAndDis } } mySimulationTopoDs = compound ; - myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; + myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ; break; } } diff --git a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h index 293247612..acf17c231 100644 --- a/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h +++ b/src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h @@ -68,7 +68,8 @@ public: private : TransformationGUI* myTransformationGUI; GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ - GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */ + GEOMBase* myGeomBase ; /* Current GeomGUI object */ + GEOMContext* myGeomGUI ; /* Current GeomGUI object */ TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */ SALOME_Selection* mySelection ; /* User shape selection */ TopoDS_Shape myBase ; diff --git a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx index 7bd262bc2..69a1b60d3 100644 --- a/src/TransformationGUI/TransformationGUI_RotationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_RotationDlg.cxx @@ -30,7 +30,6 @@ using namespace std; #include "TransformationGUI_RotationDlg.h" #include "QAD_Config.h" -//#include #include #include @@ -116,7 +115,7 @@ void TransformationGUI_RotationDlg::Init() connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); - connect(GroupPoints->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(ReverseVector(int))); + connect(GroupPoints->CheckButton1, SIGNAL(stateChanged(int)), this, SLOT(ReverseAngle(int))); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ; @@ -149,7 +148,7 @@ void TransformationGUI_RotationDlg::ClickOnApply() myGeomGUI->GetDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); if(myOkBase && myOkAxis) @@ -164,12 +163,12 @@ void TransformationGUI_RotationDlg::ClickOnApply() //================================================================================= void TransformationGUI_RotationDlg::SelectionIntoArgument() { - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); myEditCurrentArgument->setText(""); QString aString = ""; /* name of selection */ - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); if(nbSel != 1) { if(myEditCurrentArgument == GroupPoints->LineEdit1) myOkBase = false; @@ -182,11 +181,11 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument() TopoDS_Shape S; Standard_Boolean testResult; Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); - if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) return; if(myEditCurrentArgument == GroupPoints->LineEdit1) { - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult); + myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult); if(!testResult) return; myEditCurrentArgument->setText(aString); @@ -259,7 +258,7 @@ void TransformationGUI_RotationDlg::ActivateThisDialog() GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); if(!mySimulationTopoDs.IsNull()) - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; } @@ -296,7 +295,7 @@ void TransformationGUI_RotationDlg::ValueChangedInSpinBox(double newValue) //================================================================================= void TransformationGUI_RotationDlg::MakeRotationSimulationAndDisplay() { - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); try { @@ -305,7 +304,7 @@ void TransformationGUI_RotationDlg::MakeRotationSimulationAndDisplay() theTransformation.SetRotation(AX, myAngle*PI180); BRepBuilderAPI_Transform myBRepTransformation(myBase, theTransformation, Standard_False); this->mySimulationTopoDs = myBRepTransformation.Shape(); - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); } catch(Standard_Failure) { MESSAGE("Exception catched in MakeRotationSimulationAndDisplay"); diff --git a/src/TransformationGUI/TransformationGUI_RotationDlg.h b/src/TransformationGUI/TransformationGUI_RotationDlg.h index 9938d4d0c..c04d84bc6 100644 --- a/src/TransformationGUI/TransformationGUI_RotationDlg.h +++ b/src/TransformationGUI/TransformationGUI_RotationDlg.h @@ -34,6 +34,7 @@ #include "TransformationGUI.h" +#include "GEOM_ShapeTypeFilter.hxx" #include //================================================================================= diff --git a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx index 87f03db61..86b512d78 100644 --- a/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_ScaleDlg.cxx @@ -29,6 +29,7 @@ using namespace std; #include "TransformationGUI_ScaleDlg.h" +#include "QAD_Config.h" #include //================================================================================= @@ -146,7 +147,7 @@ void TransformationGUI_ScaleDlg::ClickOnApply() myGeomGUI->GetDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); if(myOkBaseTopo && myOkPoint1) @@ -161,12 +162,12 @@ void TransformationGUI_ScaleDlg::ClickOnApply() //================================================================================= void TransformationGUI_ScaleDlg::SelectionIntoArgument() { - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); myEditCurrentArgument->setText(""); QString aString = ""; /* name of selection */ - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); if (nbSel != 1) { if(myEditCurrentArgument == GroupPoints->LineEdit1) myOkBaseTopo = false; @@ -179,19 +180,19 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument() TopoDS_Shape S; Standard_Boolean testResult; Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); - if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) return; /* gp_Pnt : not used */ if(myEditCurrentArgument == GroupPoints->LineEdit1) { - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult); + myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult); if(!testResult) return ; GroupPoints->LineEdit1->setText(aString); myBaseTopo = S; myOkBaseTopo = true; } - else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomGUI->VertexToPoint(S, myPoint1)) { + else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomBase->VertexToPoint(S, myPoint1)) { GroupPoints->LineEdit2->setText(aString); myOkPoint1 = true; } @@ -254,7 +255,7 @@ void TransformationGUI_ScaleDlg::ActivateThisDialog() GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); if(!mySimulationTopoDs.IsNull()) - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; } @@ -291,7 +292,7 @@ void TransformationGUI_ScaleDlg::ValueChangedInSpinBox(double newValue) //================================================================================= void TransformationGUI_ScaleDlg::MakeScaleSimulationAndDisplay() { - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); try { @@ -302,7 +303,7 @@ void TransformationGUI_ScaleDlg::MakeScaleSimulationAndDisplay() if(mySimulationTopoDs.IsNull()) return; else - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); } catch(Standard_Failure) { MESSAGE("Exception catched in MakeScaleSimulationAndDisplay"); diff --git a/src/TransformationGUI/TransformationGUI_ScaleDlg.h b/src/TransformationGUI/TransformationGUI_ScaleDlg.h index 03cd2cdd4..6e6cf8bf2 100644 --- a/src/TransformationGUI/TransformationGUI_ScaleDlg.h +++ b/src/TransformationGUI/TransformationGUI_ScaleDlg.h @@ -34,6 +34,8 @@ #include "TransformationGUI.h" +#include "GEOM_ShapeTypeFilter.hxx" + //================================================================================= // class : TransformationGUI_ScaleDlg // purpose : diff --git a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx index 4d33edfed..ef8015c88 100644 --- a/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx +++ b/src/TransformationGUI/TransformationGUI_TranslationDlg.cxx @@ -30,6 +30,7 @@ using namespace std; #include "TransformationGUI_TranslationDlg.h" #include +#include "QAD_Config.h" //================================================================================= // class : TransformationGUI_TranslationDlg() @@ -150,7 +151,7 @@ void TransformationGUI_TranslationDlg::ClickOnApply() myGeomGUI->GetDesktop()->putInfo(tr("")); if (mySimulationTopoDs.IsNull()) return; - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); if(myOkBase) @@ -165,12 +166,12 @@ void TransformationGUI_TranslationDlg::ClickOnApply() //================================================================================= void TransformationGUI_TranslationDlg::SelectionIntoArgument() { - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); myEditCurrentArgument->setText(""); QString aString = ""; /* name of selection */ - int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); + int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString); if (nbSel != 1) { if(myEditCurrentArgument == GroupPoints->LineEdit1) myOkBase = false; @@ -181,12 +182,12 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument() TopoDS_Shape S; Standard_Boolean testResult; Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); - if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) + if(!myGeomBase->GetTopoFromSelection(mySelection, S)) return; /* gp_Pnt : not used */ if(myEditCurrentArgument == GroupPoints->LineEdit1) { - myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult); + myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult); if(!testResult) return ; GroupPoints->LineEdit1->setText(aString); @@ -244,7 +245,7 @@ void TransformationGUI_TranslationDlg::ActivateThisDialog() GEOMBase_Skeleton::ActivateThisDialog(); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); if(!mySimulationTopoDs.IsNull()) - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); return; } @@ -300,7 +301,7 @@ void TransformationGUI_TranslationDlg::ValueChangedInSpinBox(double newValue) //================================================================================= void TransformationGUI_TranslationDlg::MakeTranslationSimulationAndDisplay() { - myGeomGUI->EraseSimulationShape(); + myGeomBase->EraseSimulationShape(); mySimulationTopoDs.Nullify(); try { @@ -311,7 +312,7 @@ void TransformationGUI_TranslationDlg::MakeTranslationSimulationAndDisplay() if(mySimulationTopoDs.IsNull()) return; else - myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); + myGeomBase->DisplaySimulationShape(mySimulationTopoDs); } catch(Standard_Failure) { MESSAGE("Exception catched in MakeTranslationSimulationAndDisplay");