--- /dev/null
+// 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 <AIS_ListIteratorOfListOfInteractive.hxx>
+
+//=======================================================================
+// 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);}
+}
--- /dev/null
+// 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
--- /dev/null
+# 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@
#include "GeometryGUI.h"
// Open CASCADE Includes
-#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <Prs3d_Drawer.hxx>
#include <Prs3d_IsoAspect.hxx>
-#include <BRep_Tool.hxx>
-#include <OSD_SharedLibrary.hxx>
// 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:
// 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;
// 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);
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 = "<<theCommandID<<endl;
-// QString theCommandID_str = itoa(theCommandID);
-// theCommandID_str.truncate(3);
-// int theCommandID_Group = theCommandID_str.toInt();
if(theCommandID == 111 || // MENU FILE - IMPORT BREP
theCommandID == 112 || // MENU FILE - IMPORT IGES
theCommandID == 113 || // MENU FILE - IMPORT STEP
theCommandID == 804 || // POPUP VIEWER - ADD IN STUDY
theCommandID == 901 || // OBJECT BROWSER - RENAME
theCommandID == 9024) { // OBJECT BROWSER - OPEN
- GEOMBase_Tools* myToolsGUI = new GEOMBase_Tools();
- myToolsGUI->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);
}
-//==================================================================================
+//=================================================================================
// function : 0nMousePress()
// purpose : [static] manage mouse events
-//==================================================================================
+//=================================================================================
bool GeometryGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
{
GeometryGUI::GetOrCreateGeometryGUI(parent);
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) {
}
}
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);
}
-//=====================================================================================
+//=================================================================================
// 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");
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());
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)
{
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);
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
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())
}
-//=======================================================================
+//=================================================================================
// function : activeStudyChanged()
// purpose : static
-//=======================================================================
+//=================================================================================
void GeometryGUI::activeStudyChanged(QAD_Desktop* parent)
{
GeometryGUI::GetOrCreateGeometryGUI(parent);
Mb->setItemEnabled(413, ViewOCC);// ShadingColor Settings
Mb->setItemEnabled(414, ViewOCC);// Isos Settings
- GeomGUI->EraseSimulationShape();
+ //GeomGUI->EraseSimulationShape();
GeomGUI->EmitSignalCloseAllDialogs();
GeomGUI = 0;
}
{
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)
#ifndef GEOMETRYGUI_H
#define GEOMETRYGUI_H
-#include "GEOMBase_Display.h"
+#include "GEOMContext.h"
//=================================================================================
// class : GeometryGUI
//=================================================================================
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);
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@
--- /dev/null
+// 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 <AIS_Drawer.hxx>
+#include <AIS_ListIteratorOfListOfInteractive.hxx>
+#include <Prs3d_IsoAspect.hxx>
+
+#include <qcolordialog.h>
+#include <qspinbox.h>
+
+#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);}
+}
--- /dev/null
+// 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
--- /dev/null
+// 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 <qlabel.h>
+#include <qpushbutton.h>
+#include <qgroupbox.h>
+#include <qlayout.h>
+#include <qspinbox.h>
+
+//=================================================================================
+// class : GEOMBase_NbIsosDlg()
+// purpose : Constructs a GEOMBase_NbIsosDlg which is a child of 'parent', with the
+// name 'name' and widget flags set to 'f'.
+// The dialog will by default be modeless, unless you set 'modal' to
+// TRUE to construct a modal dialog.
+//=================================================================================
+GEOMBase_NbIsosDlg::GEOMBase_NbIsosDlg(QWidget* parent, const char* name, bool modal, WFlags fl)
+ :QDialog( parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+{
+ if( !name )
+ setName("GEOMBase_NbIsosDlg");
+ setCaption(name);
+ setSizeGripEnabled(TRUE);
+ QGridLayout* MyDialogLayout = new QGridLayout(this);
+ MyDialogLayout->setSpacing(6);
+ MyDialogLayout->setMargin(11);
+
+ /***************************************************************/
+ QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" );
+ GroupC1->setColumnLayout(0, Qt::Vertical );
+ GroupC1->layout()->setSpacing( 0 );
+ GroupC1->layout()->setMargin( 0 );
+ QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
+ GroupC1Layout->setAlignment( Qt::AlignTop );
+ GroupC1Layout->setSpacing( 6 );
+ GroupC1Layout->setMargin( 11 );
+
+ TextLabel1 = new QLabel( GroupC1, "TextLabel1" );
+ TextLabel1->setText( tr( "GEOM_MEN_ISOU") );
+ GroupC1Layout->addWidget( TextLabel1, 0, 0 );
+
+ SpinBoxU = new QSpinBox( GroupC1, "SpinBoxU" );
+ SpinBoxU->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ SpinBoxU->setMinValue( 1 );
+ SpinBoxU->setValue( 1 );
+ GroupC1Layout->addWidget( SpinBoxU, 0, 1 );
+
+ TextLabel2 = new QLabel( GroupC1, "TextLabel2" );
+ TextLabel2->setText( tr( "GEOM_MEN_ISOV") ) ;
+ GroupC1Layout->addWidget( TextLabel2, 0, 2 );
+
+ SpinBoxV = new QSpinBox( GroupC1, "SpinBoxV");
+ SpinBoxV->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+ SpinBoxV->setValue( 1 );
+ SpinBoxV->setMinValue( 1 );
+ GroupC1Layout->addWidget( SpinBoxV, 0, 3 );
+
+ /***************************************************************/
+ QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setSpacing( 0 );
+ GroupButtons->layout()->setMargin( 0 );
+ QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setSpacing( 6 );
+ GroupButtonsLayout->setMargin( 11 );
+
+ buttonOk = new QPushButton( GroupButtons, "buttonOk" );
+ buttonOk->setText( tr( "GEOM_BUT_OK" ) ) ;
+ buttonOk->setAutoDefault( TRUE );
+ buttonOk->setDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonOk, 0, 0 );
+
+ GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
+
+ buttonCancel = new QPushButton( GroupButtons, "buttonCancel" );
+ buttonCancel->setText( tr( "GEOM_BUT_CANCEL" ) ) ;
+ buttonCancel->setAutoDefault( TRUE );
+ GroupButtonsLayout->addWidget( buttonCancel, 0, 2 );
+ /***************************************************************/
+
+ MyDialogLayout->addWidget(GroupC1, 0, 0);
+ MyDialogLayout->addWidget(GroupButtons, 1, 0);
+
+
+ // 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
+}
--- /dev/null
+// GEOM GEOMGUI : GUI for Geometry component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : GEOMBase_NbIsosDlg.h
+// Author :
+// Module : GEOM
+// $Header:
+
+#ifndef GEOMBASE_NBISOSDLG_H
+#define GEOMBASE_NBISOSDLG_H
+
+#include <qdialog.h>
+
+class QLabel;
+class QSpinBox;
+class QPushButton;
+
+//=================================================================================
+// class : GEOMBase_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
--- /dev/null
+// 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 <qframe.h>
+#include <qlabel.h>
+#include <qpushbutton.h>
+#include <qslider.h>
+#include <qlayout.h>
+#include <qvariant.h>
+#include <qtooltip.h>
+#include <qwhatsthis.h>
+#include <qapplication.h>
+#include <qgroupbox.h>
+
+#include "VTKViewer_ViewFrame.h"
+#include "VTKViewer_RenderWindowInteractor.h"
+
+//=================================================================================
+// class : GEOMBase_TransparencyDlg()
+// purpose : Constructs a GEOMBase_SUBSHAPE which is a child of 'parent', with the
+// name 'name' and widget flags set to 'f'.
+//
+// : WARNING : this dialog is modal !
+//
+//=================================================================================
+GEOMBase_TransparencyDlg::GEOMBase_TransparencyDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, const Handle(AIS_InteractiveContext)& ic, bool modal, WFlags fl)
+ :QDialog(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+{
+ if(!name)
+ setName("GEOMBase_TransparencyDlg");
+ resize(152, 107);
+ setCaption(tr("GEOM_TRANSPARENCY_TITLE"));
+ setSizeGripEnabled(TRUE);
+ GEOMBase_TransparencyDlgLayout = new QGridLayout(this);
+ GEOMBase_TransparencyDlgLayout->setSpacing(6);
+ GEOMBase_TransparencyDlgLayout->setMargin(11);
+
+ /*************************************************************************/
+ QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
+ GroupButtons->setColumnLayout(0, Qt::Vertical );
+ GroupButtons->layout()->setSpacing( 0 );
+ GroupButtons->layout()->setMargin( 0 );
+ QGridLayout* GroupButtonsLayout = new QGridLayout( GroupButtons->layout() );
+ GroupButtonsLayout->setAlignment( Qt::AlignTop );
+ GroupButtonsLayout->setSpacing( 6 );
+ GroupButtonsLayout->setMargin( 11 );
+
+ buttonOk = new QPushButton( GroupButtons, "buttonOk" );
+ buttonOk->setText( tr( "GEOM_BUT_OK" ) );
+ buttonOk->setAutoDefault( TRUE );
+ buttonOk->setDefault( TRUE );
+ GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 0 );
+ GroupButtonsLayout->addWidget( buttonOk, 0, 1 );
+ GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 2 );
+
+ /*************************************************************************/
+ QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" );
+ GroupC1->setColumnLayout(0, Qt::Vertical );
+ GroupC1->layout()->setSpacing( 0 );
+ GroupC1->layout()->setMargin( 0 );
+ QGridLayout* GroupC1Layout = new QGridLayout( GroupC1->layout() );
+ GroupC1Layout->setAlignment( Qt::AlignTop );
+ GroupC1Layout->setSpacing( 6 );
+ GroupC1Layout->setMargin( 11 );
+
+ TextLabelOpaque = new QLabel( GroupC1, "TextLabelOpaque" );
+ TextLabelOpaque->setText( tr( "GEOM_TRANSPARENCY_OPAQUE" ) );
+ TextLabelOpaque->setAlignment( int( QLabel::AlignLeft ) );
+ GroupC1Layout->addWidget( TextLabelOpaque, 0, 0 );
+ GroupC1Layout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ), 0, 1 );
+
+ TextLabelTransparent = new QLabel( GroupC1, "TextLabelTransparent" );
+ TextLabelTransparent->setText( tr( "GEOM_TRANSPARENCY_TRANSPARENT" ) );
+ TextLabelTransparent->setAlignment( int( QLabel::AlignRight ) );
+ GroupC1Layout->addWidget( TextLabelTransparent, 0, 2 );
+
+ Slider1 = new QSlider( 0, 10, 1, 5, Horizontal, GroupC1, "Slider1" );
+ Slider1->setMinimumSize( 300, 0 );
+ Slider1->setTickmarks( QSlider::Left );
+ GroupC1Layout->addMultiCellWidget( Slider1, 1, 1, 0, 2 );
+ /*************************************************************************/
+
+ GEOMBase_TransparencyDlgLayout->addWidget(GroupC1, 0, 0);
+ GEOMBase_TransparencyDlgLayout->addWidget(GroupButtons, 1, 0);
+
+ /* Initialisations */
+ this->myGeomGUI = 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;
+}
--- /dev/null
+// GEOM GEOMGUI : GUI for Geometry component
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+//
+//
+//
+// File : GEOMBase_TransparencyDlg.h
+// Author : Lucien PIGNOLONI
+// Module : GEOM
+// $Header$
+
+#ifndef DIALOGBOX_TRANSPARENCYDLG_H
+#define DIALOGBOX_TRANSPARENCYDLG_H
+
+#include <qvariant.h>
+#include <qdialog.h>
+
+#include "SALOME_Selection.h"
+#include "SALOME_InteractiveObject.hxx"
+#include "GEOM_InteractiveObject.hxx"
+#include "GEOM_AISShape.hxx"
+
+#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
+
--- /dev/null
+# 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@
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
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;
}
}
-//=======================================================================
-// 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());
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) {
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) {
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;
}
{
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"));
#ifndef GENERATIONGUI_H
#define GENERATIONGUI_H
-#include "GEOMBase_Display.h"
+#include "GEOMBase.h"
//=================================================================================
// class : GenerationGUI
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);
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 */
};
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;
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;
#include "GenerationGUI.h"
+#include "GEOM_ShapeTypeFilter.hxx"
+
//=================================================================================
// class : GenerationGUI_FillingDlg
// purpose :
myGeomGUI->GetDesktop()->putInfo(tr(""));
if (mySimulationTopoDs.IsNull())
return;
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify();
if(myOkShape1 && myOkShape2)
//=================================================================================
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;
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);
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);
GEOMBase_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if(!mySimulationTopoDs.IsNull())
- myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
+ myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
return;
}
//=================================================================================
void GenerationGUI_PipeDlg::MakePipeSimulationAndDisplay()
{
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify();
try {
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;
myGeomGUI->GetDesktop()->putInfo(tr(""));
if (mySimulationTopoDs.IsNull())
return;
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify();
gp_Pnt P1, P2;
//=================================================================================
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;
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)
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;
}
GEOMBase_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if(!mySimulationTopoDs.IsNull())
- myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
+ myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
return;
}
//=================================================================================
void GenerationGUI_PrismDlg::MakePrismSimulationAndDisplay()
{
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify();
try {
if(mySimulationTopoDs.IsNull())
return;
else
- myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
+ myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
}
catch(Standard_Failure) {
MESSAGE("Exception catched in MakePrismSimulationAndDisplay" << endl);
#include "GenerationGUI.h"
+#include "GEOM_ShapeTypeFilter.hxx"
+
//=================================================================================
// class : GenerationGUI_PrismDlg
// purpose :
myGeomGUI->GetDesktop()->putInfo(tr(""));
if (mySimulationTopoDs.IsNull())
return;
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify();
if(myOkBase && myOkAxis)
//=================================================================================
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;
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();
GEOMBase_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if(!mySimulationTopoDs.IsNull())
- myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
+ myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
return;
}
//=================================================================================
void GenerationGUI_RevolDlg::MakeRevolutionSimulationAndDisplay()
{
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify();
TopAbs_ShapeEnum aType = myBase.ShapeType();
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");
#include "GenerationGUI.h"
+#include "GEOM_ShapeTypeFilter.hxx"
#include <gp_Dir.hxx>
//=================================================================================
@COMMENCE@
# header files
-EXPORT_HEADERS= GenerationGUI.h
+EXPORT_HEADERS=
# Libraries targets
LIB = libGenerationGUI.la
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@
@COMMENCE@
# header files
-EXPORT_HEADERS= MeasureGUI.h
+EXPORT_HEADERS=
# Libraries targets
LIB = libMeasureGUI.la
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@
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
#include "MeasureGUI_WhatisDlg.h" // Method WHATIS
#include "MeasureGUI_CheckShape.h" // Method CHECKSHAPE
-static MeasureGUI* myMeasureGUI = 0;
-
//=======================================================================
// function : MeasureGUI()
// purpose : Constructor
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;
}
}
-//=======================================================================
-// 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());
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) {
#ifndef MEASUREGUI_H
#define MEASUREGUI_H
-#include "GEOMBase_Context.h"
+#include "GEOMBase.h"
//=================================================================================
// class : MeasureGUI
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 */
};
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 ?
/* 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 */
//=================================================================================
void MeasureGUI_BndBoxDlg::ClickOnCancel()
{
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
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() ) {
/* 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 ) ;
}
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 ) ;
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 */
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() ;
/* 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 */
//=================================================================================
void MeasureGUI_CenterMassDlg::ClickOnCancel()
{
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
//=================================================================================
void MeasureGUI_CenterMassDlg::ClickOnApply()
{
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
if( myOkCenterMass) {
//=================================================================================
void MeasureGUI_CenterMassDlg::SelectionIntoArgument()
{
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
myEditCurrentArgument->setText("") ;
myOkCenterMass = false ;
Standard_Boolean testResult ;
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) ;
/* 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 ;
void MeasureGUI_CenterMassDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
disconnect( mySelection, 0, this, 0 );
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ;
GroupButtons->setEnabled(true) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
if( !mySimulationTopoDs.IsNull() )
- myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
+ myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
return ;
}
//=================================================================================
bool MeasureGUI_CenterMassDlg::CalculateAndDisplayCenterMass()
{
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
try {
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);
if( !mySimulationTopoDs.IsNull() ) {
- myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
+ myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
return true ;
}
}
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 */
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 ?
/* 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 */
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() ) {
/* 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 ;
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 */
myShape2.Nullify() ;
myConstructorId = 0 ;
- myGeomGUI = GEOMBase_Context::GetGeomGUI() ;
+ myGeomGUI = GEOMContext::GetGeomGUI() ;
+ myGeomBase = new GEOMBase() ;
GroupConstructor1->show();
myConstructorId = 0 ;
/* 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 */
void MeasureGUI_DistanceDlg::ConstructorsClicked(int constructorId)
{
EraseDistance();
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
switch (constructorId)
{
void MeasureGUI_DistanceDlg::ClickOnApply()
{
EraseDistance() ;
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
switch(myConstructorId)
void MeasureGUI_DistanceDlg::ClickOnCancel()
{
EraseDistance() ;
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
//=================================================================================
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)
{
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 ;
myOkShape1 = true ;
}
else if ( myEditCurrentArgument == LineEditC1A2Shape ) {
- myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ;
+ myGeomShape2 = myGeomBase->ConvertIOinGEOMShape(IO, testResult) ;
if( !testResult )
return ;
myShape2 = S ;
/* 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 ;
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
if( !mySimulationTopoDs.IsNull() )
- myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
+ myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
return ;
}
{
LineEdit_Length->setText("") ;
EraseDistance() ;
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
BRepExtrema_DistShapeShape dst( S1, S2 );
if (dst.IsDone()) {
if (Dist<=1.e-9) {
BRepBuilderAPI_MakeVertex MakeVertex(P1);
mySimulationTopoDs = MakeVertex.Vertex();
- myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
+ myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
LineEdit_Length->setText("0.0") ;
} else {
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 ;
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 ?
/* 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 ;
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) ;
/* 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 ;
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 */
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 ?
/* 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 ;
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() ) {
/* 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 ;
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 */
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 ?
/* 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 ;
//=================================================================================
void MeasureGUI_PropertiesDlg::ClickOnCancel()
{
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
disconnect( mySelection, 0, this, 0 );
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
myGeomGUI->ResetState() ;
reject() ;
return ;
//=================================================================================
void MeasureGUI_PropertiesDlg::SelectionIntoArgument()
{
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
LineEdit_Length->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) )
+ if( !myGeomBase->GetTopoFromSelection(mySelection, S) )
return ;
if( S.IsNull() || S.ShapeType() == TopAbs_VERTEX ) {
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) ;
/* 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 ;
disconnect( mySelection, 0, this, 0 );
GroupConstructors->setEnabled(false) ;
GroupConstructor1->setEnabled(false) ;
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
GroupButtons->setEnabled(false) ;
}
return ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
if( !mySimulationTopoDs.IsNull() )
- myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
+ myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
return ;
}
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 */
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 ?
/* 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 */
//=================================================================================
void MeasureGUI_WhatisDlg::ClickOnCancel()
{
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
reject() ;
//=================================================================================
void MeasureGUI_WhatisDlg::SelectionIntoArgument()
{
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
Text->setText("") ;
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() ) {
}
/* 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) ;
/* 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 ;
disconnect( mySelection, 0, this, 0 );
GroupConstructors->setEnabled(false) ;
GroupConstructor1->setEnabled(false) ;
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
GroupButtons->setEnabled(false) ;
}
return ;
GroupButtons->setEnabled(true) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
if( !mySimulationTopoDs.IsNull() )
- myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
+ myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
return ;
}
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 */
@COMMENCE@
# header files
-EXPORT_HEADERS= OperationGUI.h
+EXPORT_HEADERS=
# Libraries targets
LIB = libOperationGUI.la
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@
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 <TopExp_Explorer.hxx>
+#include <Precision.hxx>
#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
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;
}
}
-//=======================================================================
-// 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());
// 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,
return;
}
result->NameType(tr("GEOM_PARTITION"));
- if(myGeomGUI->Display(result))
+ if(myGeomBase->Display(result))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
return;
}
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;
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"));
}
}
}
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) {
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();
}
else {
ListOfID->length(i + 1);
- ListOfID[i] = myGeomGUI->GetIndex(ic->SelectedShape(), ShapeTopo, SubShapeType);
+ ListOfID[i] = myGeomBase->GetIndex(ic->SelectedShape(), ShapeTopo, SubShapeType);
i++;
}
ic->NextSelected();
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) {
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"));
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) {
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();
}
else {
ListOfID->length(i + 1);
- ListOfID[i] = myGeomGUI->GetIndex(ic->SelectedShape(), ShapeTopo, SubShapeType);
+ ListOfID[i] = myGeomBase->GetIndex(ic->SelectedShape(), ShapeTopo, SubShapeType);
i++;
}
ic->NextSelected();
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) {
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"));
#ifndef OPERATIONGUI_H
#define OPERATIONGUI_H
-#include "GEOMBase_Display.h"
+#include "GEOMBase.h"
//=================================================================================
// class : OperationGUI
OperationGUI();
~OperationGUI();
- static OperationGUI* GetOrCreateGUI();
static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
void MakePartitionAndDisplay(const GEOM::GEOM_Gen::ListOfIOR& listShapesIOR,
Standard_Integer& aLocalContextId,
bool& myUseLocalContext);
- GEOMBase_Context* myGeomGUI;
+ GEOMBase* myGeomBase;
+ GEOMContext* myGeomGUI;
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
};
using namespace std;
#include "OperationGUI_ArchimedeDlg.h"
-#include "QAD_Tools.h"
-
-#include "SALOME_InteractiveObject.hxx"
-
-#include <qbuttongroup.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qradiobutton.h>
-#include <qlayout.h>
-#include <qvariant.h>
-#include <qtooltip.h>
-#include <qvalidator.h>
-#include <qwhatsthis.h>
-#include <qimage.h>
-#include <qpixmap.h>
+#include "QAD_Config.h"
//=================================================================================
// class : OperationGUI_ArchimedeDlg()
// 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();
}
//=================================================================================
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
}
// 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;
}
//=================================================================================
void OperationGUI_ArchimedeDlg::ClickOnOk()
{
- this->ClickOnApply() ;
- this->ClickOnCancel() ;
-
- return ;
+ this->ClickOnApply();
+ ClickOnCancel();
+ return;
}
//=================================================================================
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;
}
//=================================================================================
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;
}
//=================================================================================
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;
}
//=================================================================================
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;
+}
#ifndef DIALOGBOX_ARCHIMEDE_H
#define DIALOGBOX_ARCHIMEDE_H
-#include "OperationGUI.h"
-
-#include <qvariant.h>
-#include <qdialog.h>
-#include <qvalidator.h>
+#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
using namespace std;
#include "OperationGUI_ChamferDlg.h"
+#include "DisplayGUI.h"
#include "QAD_Config.h"
#include "QAD_RightFrame.h"
#include "OCCViewer_Viewer3d.h"
-#include <qbuttongroup.h>
-#include <qcheckbox.h>
-#include <qcombobox.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qradiobutton.h>
-#include <qlayout.h>
-#include <qvariant.h>
-#include <qtooltip.h>
-#include <qwhatsthis.h>
-#include <qimage.h>
-#include <qpixmap.h>
-
#include <BRepFilletAPI_MakeChamfer.hxx>
#include <BRepTools.hxx>
#include <BRep_Tool.hxx>
#include <TopExp.hxx>
-#include <Standard_ErrorHandler.hxx>
-#include <Standard_Failure.hxx>
-
//=================================================================================
// class : OperationGUI_ChamferDlg()
// purpose : Constructs a OperationGUI_ChamferDlg which is a child of 'parent', with the
// 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);
}
OperationGUI_ChamferDlg::~OperationGUI_ChamferDlg()
{
/* no need to delete child widgets, Qt does it all for us */
- this->destroy(TRUE, TRUE) ;
}
// 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;
}
//=================================================================================
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;
}
//=================================================================================
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()
//=================================================================================
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;
+ }
}
//=================================================================================
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;
}
{
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;
}
//=================================================================================
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;
}
// 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;
}
// 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;
}
//=================================================================================
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;
}
#ifndef DIALOGBOX_CHAMFER_H
#define DIALOGBOX_CHAMFER_H
-#include "OperationGUI.h"
-
-#include "DlgRef_SpinBox.h"
-
-// Qt Includes
-#include <qvariant.h>
-#include <qdialog.h>
-#include <qvalidator.h>
+#include "GEOMBase_Skeleton.h"
+#include "DlgRef_1Sel2Spin.h"
-// Open CASCADE Includes
-#include <AIS_InteractiveContext.hxx>
-
-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
using namespace std;
#include "OperationGUI_FilletDlg.h"
-
+#include "DisplayGUI.h"
#include "QAD_Config.h"
#include "QAD_RightFrame.h"
#include "OCCViewer_Viewer3d.h"
-#include <qbuttongroup.h>
-#include <qcheckbox.h>
-#include <qcombobox.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qradiobutton.h>
-#include <qlayout.h>
-#include <qvariant.h>
-#include <qtooltip.h>
-#include <qwhatsthis.h>
-#include <qimage.h>
-#include <qpixmap.h>
-
#include <TopExp_Explorer.hxx>
#include <BRepFilletAPI_MakeFillet.hxx>
-#include <Standard_ErrorHandler.hxx>
-#include <Standard_Failure.hxx>
-
-
//=================================================================================
// class : OperationGUI_FilletDlg()
// purpose : Constructs a OperationGUI_FilletDlg which is a child of 'parent', with the
// 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);
}
OperationGUI_FilletDlg::~OperationGUI_FilletDlg()
{
/* no need to delete child widgets, Qt does it all for us */
- this->destroy(TRUE, TRUE) ;
}
// 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;
+}
//=================================================================================
//=================================================================================
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;
}
//=================================================================================
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;
}
//=================================================================================
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;
}
//=================================================================================
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;
}
// 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;
}
// 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;
}
//=================================================================================
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;
}
#ifndef DIALOGBOX_FILLET_H
#define DIALOGBOX_FILLET_H
-#include "OperationGUI.h"
-
-#include "DlgRef_SpinBox.h"
-
-// Qt Includes
-#include <qvariant.h>
-#include <qdialog.h>
-#include <qvalidator.h>
+#include "GEOMBase_Skeleton.h"
+#include "DlgRef_1Sel1Spin.h"
-// Open CASCADE Includes
-#include <AIS_InteractiveContext.hxx>
-
-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
{
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel;
- myGeomGUI = GEOMBase_Context::GetGeomGUI() ;
+ myGeomBase = new GEOMBase() ;
+ myGeomGUI = GEOMContext::GetGeomGUI() ;
myOkListShapes = myOkListTools = myOkKeepShape = myOkRemoveShape = false ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
/* 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 */
//=================================================================================
void OperationGUI_PartitionDlg::ClickOnCancel()
{
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
reject() ;
{
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 ) {
}
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 ;
}
/* 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 ;
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 ;
@COMMENCE@
# header files
-EXPORT_HEADERS= PrimitiveGUI.h
+EXPORT_HEADERS=
# Libraries targets
LIB = libPrimitiveGUI.la
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@
using namespace std;
#include "PrimitiveGUI.h"
+#include "SALOMEGUI_QtCatchCorbaException.hxx"
+#include <Precision.hxx>
+
#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
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;
}
}
-//=======================================================================
-// 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:
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) {
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) {
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) {
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) {
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) {
#ifndef PRIMITIVEGUI_H
#define PRIMITIVEGUI_H
-#include "GEOMBase_Display.h"
-#include "QAD_Config.h"
+#include "GEOMBase.h"
//=================================================================================
// class : PrimitiveGUI
PrimitiveGUI();
~PrimitiveGUI();
- static PrimitiveGUI* GetOrCreateGUI();
static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
void MakeBoxAndDisplay(const gp_Pnt P1, const gp_Pnt P2);
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 */
};
#include "PrimitiveGUI_BoxDlg.h"
#include <BRepPrimAPI_MakeBox.hxx>
+#include <Precision.hxx>
+#include "QAD_Config.h"
//=================================================================================
// class : PrimitiveGUI_BoxDlg()
{
myConstructorId = constructorId;
mySelection->ClearFilters();
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
disconnect(mySelection, 0, this, 0);
myOkPoint1 = myOkPoint2 = false;
myPoint2.SetCoord(initValue, initValue, initValue);
mySimulationTopoDs = BRepPrimAPI_MakeBox(myPoint1, myPoint2).Shape();
- myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
+ myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
break;
}
}
myGeomGUI->GetDesktop()->putInfo(tr(""));
if (mySimulationTopoDs.IsNull())
return;
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify();
switch(myConstructorId)
//=================================================================================
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;
// 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;
}
GEOMBase_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if(!mySimulationTopoDs.IsNull())
- myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
+ myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
return;
}
//=================================================================================
void PrimitiveGUI_BoxDlg::ValueChangedInSpinBox(double newValue)
{
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify();
QObject* send = (QObject*)sender();
double vx, vy, vz;
if(TestBoxDimensions(myPoint1, myPoint2)) {
mySimulationTopoDs = BRepPrimAPI_MakeBox(myPoint1, myPoint2).Shape();
- myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
+ myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
}
return;
}
#include "PrimitiveGUI.h"
+#include "GEOM_ShapeTypeFilter.hxx"
#include <gp_Pnt.hxx>
//=================================================================================
#include <BRepPrimAPI_MakeCone.hxx>
#include <BRepPrimAPI_MakeCylinder.hxx>
#include <BRepAdaptor_Curve.hxx>
+#include <Precision.hxx>
+#include "QAD_Config.h"
//=================================================================================
// class : PrimitiveGUI_ConeDlg()
{
myConstructorId = constructorId;
mySelection->ClearFilters();
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
disconnect(mySelection, 0, this, 0);
myOkHeight = myOkRadius1 = myOkRadius2 = true;
myRadius1 = 100.0;
myGeomGUI->GetDesktop()->putInfo(tr(""));
if (mySimulationTopoDs.IsNull())
return;
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify();
if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight) {
//=================================================================================
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;
/* 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;
}
GEOMBase_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if(!mySimulationTopoDs.IsNull())
- myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
+ myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
return;
}
//=================================================================================
void PrimitiveGUI_ConeDlg::ValueChangedInSpinBox(double newValue)
{
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify();
QObject* send = (QObject*)sender();
//=================================================================================
void PrimitiveGUI_ConeDlg::MakeConeSimulationAndDisplay()
{
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify();
gp_Dir aDir = myDir;
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");
#include "PrimitiveGUI.h"
#include "GEOM_EdgeFilter.hxx"
+#include "GEOM_ShapeTypeFilter.hxx"
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
#include <BRepPrimAPI_MakeCylinder.hxx>
#include <BRepAdaptor_Curve.hxx>
+#include <Precision.hxx>
+#include "QAD_Config.h"
//=================================================================================
// class : PrimitiveGUI_CylinderDlg()
{
myConstructorId = constructorId;
mySelection->ClearFilters();
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
disconnect(mySelection, 0, this, 0);
myOkHeight = myOkRadius = true;
myRadius = 100.0;
myGeomGUI->GetDesktop()->putInfo(tr(""));
if (mySimulationTopoDs.IsNull())
return;
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify();
if(myOkPoint1 && myOkDir && myOkRadius && myOkHeight) {
//=================================================================================
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;
/* 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;
}
GEOMBase_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if(!mySimulationTopoDs.IsNull())
- myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
+ myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
return;
}
//=================================================================================
void PrimitiveGUI_CylinderDlg::ValueChangedInSpinBox( double newValue )
{
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify();
QObject* send = (QObject*)sender();
//=================================================================================
void PrimitiveGUI_CylinderDlg::MakeCylinderSimulationAndDisplay()
{
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify();
gp_Dir aDir = this->myDir;
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");
#include "PrimitiveGUI.h"
#include "GEOM_EdgeFilter.hxx"
+#include "GEOM_ShapeTypeFilter.hxx"
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
#include "PrimitiveGUI_SphereDlg.h"
#include <BRepPrimAPI_MakeSphere.hxx>
+#include "QAD_Config.h"
//=================================================================================
// class : PrimitiveGUI_SphereDlg()
{
myConstructorId = constructorId;
mySelection->ClearFilters();
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
disconnect(mySelection, 0, this, 0);
myRadius = 100.0;
myOkRadius = true;
myOkPoint1 = true;
mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape();
- myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
+ myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
break;
}
}
myGeomGUI->GetDesktop()->putInfo(tr(""));
if(mySimulationTopoDs.IsNull())
return;
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify();
if(myOkPoint1 && myOkRadius)
//=================================================================================
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("");
/* 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 ;
}
GEOMBase_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if(!mySimulationTopoDs.IsNull())
- myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
+ myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
return;
}
//=================================================================================
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;
}
#include "PrimitiveGUI.h"
+#include "GEOM_ShapeTypeFilter.hxx"
#include <gp_Pnt.hxx>
//=================================================================================
#include <BRepPrimAPI_MakeTorus.hxx>
#include <BRepAdaptor_Curve.hxx>
+#include "QAD_Config.h"
//=================================================================================
// class : PrimitiveGUI_TorusDlg()
{
myConstructorId = constructorId;
mySelection->ClearFilters();
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
disconnect(mySelection, 0, this, 0);
myOkRadius1 = myOkRadius2 = true;
myRadius1 = 300.0;
myGeomGUI->GetDesktop()->putInfo(tr(""));
if (mySimulationTopoDs.IsNull())
return;
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify();
if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 )
//=================================================================================
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;
/* 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;
}
GEOMBase_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if(!mySimulationTopoDs.IsNull())
- myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
+ myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
return;
}
//=================================================================================
void PrimitiveGUI_TorusDlg::ValueChangedInSpinBox(double newValue)
{
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify();
QObject* send = (QObject*)sender();
//=================================================================================
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");
#include "PrimitiveGUI.h"
#include "GEOM_EdgeFilter.hxx"
+#include "GEOM_ShapeTypeFilter.hxx"
#include <gp_Pnt.hxx>
#include <gp_Dir.hxx>
@COMMENCE@
# header files
-EXPORT_HEADERS= RepairGUI.h
+EXPORT_HEADERS=
# Libraries targets
LIB = libRepairGUI.la
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@
#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
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;
}
}
-//=======================================================================
-// 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());
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;
}
return;
}
result->NameType(Shape->NameType());
- if(myGeomGUI->Display(result))
+ if(myGeomBase->Display(result))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
return;
}
// : 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;
}
// 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;
}
// 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;
/* 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; i<listGeomShapes->length(); i++ ) {
+ for(int i=0; i<listGeomShapes->length(); 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;
}
#ifndef REPAIRGUI_H
#define REPAIRGUI_H
-#include "GEOMBase_Display.h"
+#include "GEOMBase.h"
//=================================================================================
// class : RepairGUI
RepairGUI();
~RepairGUI();
- static RepairGUI* GetOrCreateGUI();
static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
void MakeSewingAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR,
const Standard_Integer& aLocalContextId,
bool& myUseLocalContext);
- GEOMBase_Context* myGeomGUI;
+ GEOMBase* myGeomBase;
+ GEOMContext* myGeomGUI;
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
};
using namespace std;
#include "RepairGUI_OrientationDlg.h"
-
+#include <Precision.hxx>
#include "QAD_Config.h"
#include <TopoDS_Compound.hxx>
CheckBoxReverse->setChecked( FALSE );
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel;
- myGeomGUI = GEOMBase_Context::GetGeomGUI() ;
+ myGeomBase = new GEOMBase() ;
+ myGeomGUI = GEOMContext::GetGeomGUI() ;
myLength = 25.0 ;
myOkShape = false ;
/* 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 */
//=================================================================================
void RepairGUI_OrientationDlg::ClickOnCancel()
{
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
/* 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 ;
//=================================================================================
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("") ;
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) ;
//=================================================================================
void RepairGUI_OrientationDlg::ValueChangedInSpinBox( double newValue )
{
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
QObject* send = (QObject*)sender() ;
GroupButtons->setEnabled(false) ;
GroupC1->setEnabled(false) ;
disconnect( mySelection, 0, this, 0 );
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
}
return ;
}
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
if( !mySimulationTopoDs.IsNull() )
- myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
+ myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
return ;
}
//===========================================================================================
void RepairGUI_OrientationDlg::MakeOrientationSimulationAndDisplay(const TopoDS_Shape& aTopoDS, Standard_Real length )
{
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
TopoDS_Compound aCompound1, aCompound2 ;
else
tmpShape.Orientation(TopAbs_FORWARD) ;
}
- if( myGeomGUI->CreateArrowForLinearEdge( tmpShape, mySimulationTopoDs ) ) {
- myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
+ if( myGeomBase->CreateArrowForLinearEdge( tmpShape, mySimulationTopoDs ) ) {
+ myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
}
return ;
}
mySimulationTopoDs = aCompound2 ;
}
if(!mySimulationTopoDs.IsNull() )
- myGeomGUI->DisplaySimulationShape(mySimulationTopoDs) ;
+ myGeomBase->DisplaySimulationShape(mySimulationTopoDs) ;
return ;
}
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 */
using namespace std;
#include "RepairGUI_SewingDlg.h"
-#include <qbuttongroup.h>
-#include <qgroupbox.h>
-#include <qlabel.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qradiobutton.h>
-#include <qlayout.h>
-#include <qvariant.h>
-#include <qtooltip.h>
-#include <qvalidator.h>
-#include <qwhatsthis.h>
-#include <qimage.h>
-#include <qpixmap.h>
-
-
+#include "QAD_Config.h"
//=================================================================================
// class : RepairGUI_SewingDlg()
// 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();
}
//=================================================================================
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
}
// 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;
}
//=================================================================================
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 :
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;
}
//=================================================================================
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;
}
//=================================================================================
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;
}
-
#ifndef DIALOGBOX_SEWING_H
#define DIALOGBOX_SEWING_H
-#include "RepairGUI.h"
-
-#include <qvariant.h>
-#include <qdialog.h>
-
-class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
-class QButtonGroup;
-class QGroupBox;
-class QLabel;
-class QLineEdit;
-class QPushButton;
-class QRadioButton;
+#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
using namespace std;
#include "RepairGUI_SuppressFacesDlg.h"
+#include "DisplayGUI.h"
+
+
#include <qbuttongroup.h>
#include <qcheckbox.h>
#include <qgroupbox.h>
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 );
/* 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 ;
if(myUseLocalContext) {
myIC->CloseLocalContext(myLocalContextId) ;
this->myUseLocalContext = false ;
- GEOMBase_Display* myDisplayGUI = new GEOMBase_Display();
+ DisplayGUI* myDisplayGUI = new DisplayGUI();
myDisplayGUI->OnDisplayAll(true) ;
}
reject() ;
QString aString = ""; /* name of selection */
- int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
+ int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel != 1 )
return ;
TopoDS_Shape S ;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
- if( !myGeomGUI->GetTopoFromSelection(mySelection, S) )
+ if( !myGeomBase->GetTopoFromSelection(mySelection, S) )
return ;
if( !IO->hasEntry() ) {
GroupButtons->setEnabled(false) ;
myGeomGUI->ResetState() ;
myGeomGUI->SetActiveDialogBox(0) ;
- GEOMBase_Display* myDisplayGUI = new GEOMBase_Display();
+ DisplayGUI* myDisplayGUI = new DisplayGUI();
myDisplayGUI->OnDisplayAll(true) ;
}
return ;
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")) ;
}
if( this->myUseLocalContext ) {
myIC->CloseLocalContext(this->myLocalContextId) ;
this->myUseLocalContext = false ;
- GEOMBase_Display* myDisplayGUI = new GEOMBase_Display();
+ DisplayGUI* myDisplayGUI = new DisplayGUI();
myDisplayGUI->OnDisplayAll(true) ;
}
return ;
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 ;
using namespace std;
#include "RepairGUI_SuppressHoleDlg.h"
-
+#include "DisplayGUI.h"
#include "TopExp_Explorer.hxx"
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 */
/* 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 ;
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) ;
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) ;
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 ) {
if(myUseLocalContext) {
myIC->CloseLocalContext(myLocalContextId) ;
this->myUseLocalContext = false ;
- GEOMBase_Display* myDisplayGUI = new GEOMBase_Display();
+ DisplayGUI* myDisplayGUI = new DisplayGUI();
myDisplayGUI->OnDisplayAll(true) ;
}
}
QString aString = ""; /* Name of selection */
- int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ;
+ int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel != 1 )
return ;
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 ) {
/* 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 ) ;
}
myGeomGUI->ResetState() ;
myGeomGUI->SetActiveDialogBox(0) ;
- GEOMBase_Display* myDisplayGUI = new GEOMBase_Display();
+ DisplayGUI* myDisplayGUI = new DisplayGUI();
myDisplayGUI->OnDisplayAll(true) ;
}
return ;
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") ) ;
}
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) ;
/* 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") ) ;
}
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 ) {
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") ) ;
}
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") ) ;
}
// 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 )
if( this->myUseLocalContext ) {
myIC->CloseLocalContext(this->myLocalContextId) ;
this->myUseLocalContext = false ;
- GEOMBase_Display* myDisplayGUI = new GEOMBase_Display();
+ DisplayGUI* myDisplayGUI = new DisplayGUI();
myDisplayGUI->OnDisplayAll(true) ;
}
}
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 */
@COMMENCE@
# header files
-EXPORT_HEADERS= TransformationGUI.h
+EXPORT_HEADERS=
# Libraries targets
LIB = libTransformationGUI.la
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@
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
#include "TransformationGUI_MultiTranslationDlg.h" // Method MULTI TRANSLATION
#include "TransformationGUI_MultiRotationDlg.h" // Method MULTI ROTATION
-static TransformationGUI* myTransformationGUI = 0;
-
//=======================================================================
// function : TransformationGUI()
// purpose : Constructor
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;
}
}
-//=======================================================================
-// 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());
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) {
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) {
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) {
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"));
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) {
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) {
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) {
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) {
#ifndef TRANSFORMATIONGUI_H
#define TRANSFORMATIONGUI_H
-#include "GEOMBase_Display.h"
-#include "QAD_Config.h"
+#include "GEOMBase.h"
//=================================================================================
// class : TransformationGUI
TransformationGUI();
~TransformationGUI();
- static TransformationGUI* GetOrCreateGUI();
static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
void MakeTranslationAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Vec V);
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 */
};
myGeomGUI->GetDesktop()->putInfo(tr(""));
if (mySimulationTopoDs.IsNull())
return;
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify();
if(myOkShape1 && myOkShape2)
//=================================================================================
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;
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;
myOkShape1 = true;
}
else if(myEditCurrentArgument == GroupPoints->LineEdit2) {
- myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult);
+ myGeomShape2 = myGeomBase->ConvertIOinGEOMShape(IO, testResult);
if(!testResult)
return ;
myShape2 = S;
GEOMBase_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if(!mySimulationTopoDs.IsNull())
- myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
+ myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
return;
}
//=================================================================================
void TransformationGUI_MirrorDlg::MakeMirrorSimulationAndDisplay()
{
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify();
try {
if(mySimulationTopoDs.IsNull())
return;
else
- myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
+ myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
}
catch(Standard_Failure) {
MESSAGE("Exception catched in MakeMirrorSimulationAndDisplay");
using namespace std;
#include "TransformationGUI_MultiRotationDlg.h"
+#include "DisplayGUI.h"
#include "QAD_Config.h"
+#include <Precision.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx>
Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel;
- myGeomGUI = GEOMBase_Context::GetGeomGUI() ;
+ myGeomBase = new GEOMBase() ;
+ myGeomGUI = GEOMContext::GetGeomGUI() ;
myOkBase = myOkDir = false ;
mySimulationTopoDs.Nullify() ;
/* 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 */
MakeMultiRotationSimulationAndDisplay() ;
}
else {
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
}
return ;
void TransformationGUI_MultiRotationDlg::ConstructorsClicked(int constructorId)
{
myEditCurrentArgument->setText(tr("")) ;
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
myAng = 45.0 ;
//=================================================================================
void TransformationGUI_MultiRotationDlg::ClickOnApply()
{
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
switch(myConstructorId)
void TransformationGUI_MultiRotationDlg::ClickOnCancel()
{
mySelection->ClearFilters() ;
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
/* 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 ;
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 ;
}
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) ;
MakeMultiRotationSimulationAndDisplay() ;
}
else {
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
}
break;
}
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) ;
MakeMultiRotationSimulationAndDisplay() ;
}
else {
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
}
break;
MakeMultiRotationSimulationAndDisplay() ;
}
else {
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
}
break;
MakeMultiRotationSimulationAndDisplay() ;
}
else {
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
}
break;
MakeMultiRotationSimulationAndDisplay() ;
}
else {
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
}
break;
MakeMultiRotationSimulationAndDisplay() ;
}
else {
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
}
break;
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 ;
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
if( !mySimulationTopoDs.IsNull() )
- myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
+ myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
return ;
}
//=================================================================================
void TransformationGUI_MultiRotationDlg::MakeMultiRotationSimulationAndDisplay()
{
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
gp_Trsf theTransformation ;
gp_Trsf theTransformation1 ;
gp_Trsf theTransformation2 ;
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);
B.Add( compound, myBRepTransformation.Shape() );
}
mySimulationTopoDs = compound;
- myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
+ myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
break;
}
case 1 :
}
}
mySimulationTopoDs = compound ;
- myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
+ myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
break;
}
}
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 ;
#include "TransformationGUI_MultiTranslationDlg.h"
#include "QAD_Config.h"
+#include "DisplayGUI.h"
#include <BRepBuilderAPI_MakeVertex.hxx>
#include <BRepBuilderAPI_Transform.hxx>
Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel;
- myGeomGUI = GEOMBase_Context::GetGeomGUI() ;
+ myGeomBase = new GEOMBase() ;
+ myGeomGUI = GEOMContext::GetGeomGUI() ;
myOkBase = myOkDir1 = myOkDir2 = false ;
mySimulationTopoDs.Nullify() ;
/* 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 */
MakeMultiTranslationSimulationAndDisplay() ;
}
else {
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
}
return ;
MakeMultiTranslationSimulationAndDisplay() ;
}
else {
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
}
return ;
void TransformationGUI_MultiTranslationDlg::ConstructorsClicked(int constructorId)
{
myEditCurrentArgument->setText(tr("")) ;
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
myStep1 = 50.0 ;
//=================================================================================
void TransformationGUI_MultiTranslationDlg::ClickOnApply()
{
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
switch(myConstructorId)
void TransformationGUI_MultiTranslationDlg::ClickOnCancel()
{
mySelection->ClearFilters() ;
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ;
/* 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 ;
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 ;
}
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) ;
MakeMultiTranslationSimulationAndDisplay() ;
}
else {
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
}
break;
}
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) ;
MakeMultiTranslationSimulationAndDisplay() ;
}
else {
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
}
break;
MakeMultiTranslationSimulationAndDisplay() ;
}
else {
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
}
break;
MakeMultiTranslationSimulationAndDisplay() ;
}
else {
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
}
break;
MakeMultiTranslationSimulationAndDisplay() ;
}
else {
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
}
break;
MakeMultiTranslationSimulationAndDisplay() ;
}
else {
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ;
}
break;
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 ;
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
if( !mySimulationTopoDs.IsNull() )
- myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
+ myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
return ;
}
//=================================================================================
void TransformationGUI_MultiTranslationDlg::MakeMultiTranslationSimulationAndDisplay()
{
- myGeomGUI->EraseSimulationShape() ;
+ myGeomBase->EraseSimulationShape() ;
gp_Trsf theTransformation ;
mySimulationTopoDs.Nullify() ;
B.Add( compound, myBRepTransformation.Shape() );
}
mySimulationTopoDs = compound;
- myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
+ myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
break;
}
case 1 :
}
}
mySimulationTopoDs = compound ;
- myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ;
+ myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
break;
}
}
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 ;
#include "TransformationGUI_RotationDlg.h"
#include "QAD_Config.h"
-//#include <TopLoc_Location.hxx>
#include <BRepBuilderAPI_Transform.hxx>
#include <BRepAdaptor_Curve.hxx>
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())) ;
myGeomGUI->GetDesktop()->putInfo(tr(""));
if (mySimulationTopoDs.IsNull())
return;
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify();
if(myOkBase && myOkAxis)
//=================================================================================
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;
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);
GEOMBase_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if(!mySimulationTopoDs.IsNull())
- myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
+ myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
return;
}
//=================================================================================
void TransformationGUI_RotationDlg::MakeRotationSimulationAndDisplay()
{
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify();
try {
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");
#include "TransformationGUI.h"
+#include "GEOM_ShapeTypeFilter.hxx"
#include <gp_Dir.hxx>
//=================================================================================
using namespace std;
#include "TransformationGUI_ScaleDlg.h"
+#include "QAD_Config.h"
#include <BRepBuilderAPI_Transform.hxx>
//=================================================================================
myGeomGUI->GetDesktop()->putInfo(tr(""));
if (mySimulationTopoDs.IsNull())
return;
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify();
if(myOkBaseTopo && myOkPoint1)
//=================================================================================
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;
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;
}
GEOMBase_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if(!mySimulationTopoDs.IsNull())
- myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
+ myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
return;
}
//=================================================================================
void TransformationGUI_ScaleDlg::MakeScaleSimulationAndDisplay()
{
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify();
try {
if(mySimulationTopoDs.IsNull())
return;
else
- myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
+ myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
}
catch(Standard_Failure) {
MESSAGE("Exception catched in MakeScaleSimulationAndDisplay");
#include "TransformationGUI.h"
+#include "GEOM_ShapeTypeFilter.hxx"
+
//=================================================================================
// class : TransformationGUI_ScaleDlg
// purpose :
#include "TransformationGUI_TranslationDlg.h"
#include <BRepBuilderAPI_Transform.hxx>
+#include "QAD_Config.h"
//=================================================================================
// class : TransformationGUI_TranslationDlg()
myGeomGUI->GetDesktop()->putInfo(tr(""));
if (mySimulationTopoDs.IsNull())
return;
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify();
if(myOkBase)
//=================================================================================
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;
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);
GEOMBase_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if(!mySimulationTopoDs.IsNull())
- myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
+ myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
return;
}
//=================================================================================
void TransformationGUI_TranslationDlg::MakeTranslationSimulationAndDisplay()
{
- myGeomGUI->EraseSimulationShape();
+ myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify();
try {
if(mySimulationTopoDs.IsNull())
return;
else
- myGeomGUI->DisplaySimulationShape(mySimulationTopoDs);
+ myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
}
catch(Standard_Failure) {
MESSAGE("Exception catched in MakeTranslationSimulationAndDisplay");