DCQ : Architecture GEOM...

This commit is contained in:
dcq 2003-10-22 12:09:38 +00:00
parent d819746a78
commit cd1b14bda9
90 changed files with 4424 additions and 3303 deletions

View File

@ -0,0 +1,979 @@
// GEOM GEOMGUI : GUI for Geometry component
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : DisplayGUI.cxx
// Author : Damien COQUERET
// Module : GEOM
// $Header:
using namespace std;
#include "DisplayGUI.h"
#include "QAD_RightFrame.h"
#include "GEOM_AssemblyBuilder.h"
#include "VTKViewer_ViewFrame.h"
#include "OCCViewer_ViewFrame.h"
#include "OCCViewer_Viewer3d.h"
#include "SALOMEGUI_ImportOperation.h"
#include "SALOME_ListIteratorOfListIO.hxx"
#include <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);}
}

View File

@ -0,0 +1,66 @@
// GEOM GEOMGUI : GUI for Geometry component
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : DisplayGUI.h
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#ifndef DISPLAYGUI_H
#define DISPLAYGUI_H
#include "GEOMBase.h"
//=================================================================================
// class : GEOMBase_Display
// purpose :
//=================================================================================
class DisplayGUI : public QObject
{
Q_OBJECT /* for QT compatibility */
public :
DisplayGUI();
~DisplayGUI();
static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
static void BuildPresentation(const Handle(SALOME_InteractiveObject)& theIO);
void OnDisplayAll(bool onlyPreviousDisplayedObject = false);
void OnVTKDisplayOnly();
void OnDisplayOnly();
void OnErase();
/* Method opening context for any sub shape selection */
bool PrepareSubShapeSelection(const int SubShapeType, Standard_Integer& returnLocalContextId);
/* Method opening context for sub shape selection on an argument shape */
bool PrepareSubShapeSelectionArgumentShape(const TopoDS_Shape& aShape, const int SubShapeType,
Standard_Integer& returnLocalContextId);
GEOMBase* myGeomBase;
GEOMContext* myGeomGUI;
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
};
#endif

View File

@ -0,0 +1,65 @@
# GEOM DISPLAYGUI :
#
# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
#
#
#
# File : Makefile.in
# Author : Damien COQUERET (OCC)
# Module : GEOM
# $Header:
top_srcdir=@top_srcdir@
top_builddir=../..
srcdir=@srcdir@
VPATH=.:@srcdir@:@top_srcdir@/idl
@COMMENCE@
# Libraries targets
LIB = libDisplayGUI.la
# header files
EXPORT_HEADERS= DisplayGUI.h
LIB_SRC = DisplayGUI.cxx
LIB_MOC = \
DisplayGUI.h
LIB_CLIENT_IDL = SALOME_Exception.idl \
GEOM_Gen.idl \
GEOM_Shape.idl \
SALOMEDS.idl \
SALOMEDS_Attributes.idl \
SALOME_ModuleCatalog.idl \
SALOME_Component.idl \
LIB_SERVER_IDL =
# additionnal information to compil and link file
CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMContext -lGEOMBase -L${KERNEL_ROOT_DIR}/lib/salome
@CONCLUDE@

View File

@ -30,39 +30,33 @@ using namespace std;
#include "GeometryGUI.h" #include "GeometryGUI.h"
// Open CASCADE Includes // Open CASCADE Includes
#include <AIS_ListIteratorOfListOfInteractive.hxx>
#include <Prs3d_Drawer.hxx> #include <Prs3d_Drawer.hxx>
#include <Prs3d_IsoAspect.hxx> #include <Prs3d_IsoAspect.hxx>
#include <BRep_Tool.hxx>
#include <OSD_SharedLibrary.hxx>
// SALOME Includes // SALOME Includes
#include "QAD_RightFrame.h" #include "QAD_RightFrame.h"
#include "QAD_Resource.h" #include "QAD_Resource.h"
#include "QAD_Tools.h"
#include "QAD_Config.h" #include "QAD_Config.h"
#include "OCCViewer_ViewPort.h" #include "OCCViewer_ViewPort.h"
#include "OCCViewer_ViewPort3d.h" #include "OCCViewer_ViewPort3d.h"
#include "OCCViewer_Viewer3d.h" #include "OCCViewer_Viewer3d.h"
#include "VTKViewer_ViewFrame.h" #include "VTKViewer_ViewFrame.h"
#include "GEOM_AssemblyBuilder.h"
#include "SALOME_Selection.h"
#include "SALOME_ListIteratorOfListIO.hxx" #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()' */ /* The object itself created in the static method 'GetOrCreateGEOMBase()' */
static GEOMBase_Context* GeomGUI = 0; static GEOMContext* GeomGUI = 0;
typedef bool OneDim(int, QAD_Desktop*);
//======================================================================= typedef bool OGE(int, QAD_Desktop*);
typedef bool OMP(QMouseEvent*, QAD_Desktop*, QAD_StudyFrame*);
typedef void BP(const Handle(SALOME_InteractiveObject)&);
//=================================================================================
// class : CustomItem // class : CustomItem
// purpose : Set Font to a text. // purpose : Set Font to a text.
//======================================================================= //=================================================================================
class CustomItem : public QCustomMenuItem class CustomItem : public QCustomMenuItem
{ {
public: public:
@ -113,57 +107,13 @@ GeometryGUI::~GeometryGUI()
// purpose : Gets or create an object 'GEOMBase' with initialisations // purpose : Gets or create an object 'GEOMBase' with initialisations
// : Returns 'GeomGUI' as a pointer // : Returns 'GeomGUI' as a pointer
//======================================================================= //=======================================================================
GEOMBase_Context* GeometryGUI::GetOrCreateGeometryGUI(QAD_Desktop* desktop) GEOMContext* GeometryGUI::GetOrCreateGeometryGUI(QAD_Desktop* desktop)
{ {
GeomGUI = GeomGUI->GetOrCreateGeomGUI(desktop); GeomGUI = GeomGUI->GetOrCreateGeomGUI(desktop);
return GeomGUI; 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] // function : OnGUIEvent() [static]
// purpose : manage all events on GUI // purpose : manage all events on GUI
@ -195,10 +145,6 @@ bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
if (GeomGUI->GetState() == CURRENT_SKETCH && theCommandID != 404 && theCommandID != 4041 && theCommandID != 4042 && theCommandID != 4043 && theCommandID != 4044 && theCommandID != 4045 && theCommandID != 4046 && theCommandID != 4047 && theCommandID != 4048 && theCommandID != 4051 && theCommandID != 4052 && theCommandID != 4053 && theCommandID != 4061 && theCommandID != 4062 && theCommandID != 4063 && theCommandID != 4064 && theCommandID != 4065) 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; 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 if(theCommandID == 111 || // MENU FILE - IMPORT BREP
theCommandID == 112 || // MENU FILE - IMPORT IGES theCommandID == 112 || // MENU FILE - IMPORT IGES
theCommandID == 113 || // MENU FILE - IMPORT STEP theCommandID == 113 || // MENU FILE - IMPORT STEP
@ -219,22 +165,19 @@ bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
theCommandID == 804 || // POPUP VIEWER - ADD IN STUDY theCommandID == 804 || // POPUP VIEWER - ADD IN STUDY
theCommandID == 901 || // OBJECT BROWSER - RENAME theCommandID == 901 || // OBJECT BROWSER - RENAME
theCommandID == 9024) { // OBJECT BROWSER - OPEN theCommandID == 9024) { // OBJECT BROWSER - OPEN
GEOMBase_Tools* myToolsGUI = new GEOMBase_Tools(); if(!GeomGUI->LoadLibrary("libGEOMToolsGUI.so"))
myToolsGUI->OnGUIEvent(theCommandID, parent); return false;
return true;
} }
if(theCommandID == 211 || // MENU VIEW - WIREFRAME/SHADING else if(theCommandID == 211 || // MENU VIEW - WIREFRAME/SHADING
theCommandID == 212 || // MENU VIEW - DISPLAY ALL theCommandID == 212 || // MENU VIEW - DISPLAY ALL
theCommandID == 213 || // MENU VIEW - DISPLAY ONLY theCommandID == 213 || // MENU VIEW - DISPLAY ONLY
theCommandID == 214 || // MENU VIEW - ERASE ALL theCommandID == 214 || // MENU VIEW - ERASE ALL
theCommandID == 215 || // MENU VIEW - ERASE ONLY theCommandID == 215 || // MENU VIEW - ERASE ONLY
theCommandID == 8031) { // POPUP VIEWER - WIREFRAME/SHADING theCommandID == 8031) { // POPUP VIEWER - WIREFRAME/SHADING
if(!GeomGUI->LoadLibrary("libDisplayGUI.so"))
GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); return false;
myDisplayGUI->OnGUIEvent(theCommandID, parent);
return true;
} }
if(theCommandID == 404 || // SKETCHER else if(theCommandID == 404 || // SKETCHER
theCommandID == 4041 || // SKETCHER - POPUP VIEWER - SEGMENT theCommandID == 4041 || // SKETCHER - POPUP VIEWER - SEGMENT
theCommandID == 4042 || // SKETCHER - POPUP VIEWER - ARC theCommandID == 4042 || // SKETCHER - POPUP VIEWER - ARC
theCommandID == 4043 || // SKETCHER - POPUP VIEWER - SET ANGLE theCommandID == 4043 || // SKETCHER - POPUP VIEWER - SET ANGLE
@ -251,11 +194,11 @@ bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
theCommandID == 4063 || // SKETCHER - MENU - RADIUS theCommandID == 4063 || // SKETCHER - MENU - RADIUS
theCommandID == 4064 || // SKETCHER - MENU - X theCommandID == 4064 || // SKETCHER - MENU - X
theCommandID == 4065) { // SKETCHER - MENU - Y theCommandID == 4065) { // SKETCHER - MENU - Y
GEOMBase_Sketcher* mySketcherGUI = new GEOMBase_Sketcher(); // GEOMBase_Sketcher* mySketcherGUI = new GEOMBase_Sketcher();
mySketcherGUI->OnGUIEvent(theCommandID, parent); // mySketcherGUI->OnGUIEvent(theCommandID, parent);
return true; return true;
} }
if(theCommandID == 4011 || // MENU BASIC - POINT else if(theCommandID == 4011 || // MENU BASIC - POINT
theCommandID == 4012 || // MENU BASIC - LINE theCommandID == 4012 || // MENU BASIC - LINE
theCommandID == 4013 || // MENU BASIC - CIRCLE theCommandID == 4013 || // MENU BASIC - CIRCLE
theCommandID == 4014 || // MENU BASIC - ELLIPSE theCommandID == 4014 || // MENU BASIC - ELLIPSE
@ -263,65 +206,65 @@ bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
theCommandID == 4016 || // MENU BASIC - VECTOR theCommandID == 4016 || // MENU BASIC - VECTOR
theCommandID == 4017 || // MENU BASIC - PLANE theCommandID == 4017 || // MENU BASIC - PLANE
theCommandID == 4018) { // MENU BASIC - WPLANE theCommandID == 4018) { // MENU BASIC - WPLANE
bool testlib = GeometryGUI::LoadLibrary(theCommandID, parent, "libBasicGUI.so"); if(!GeomGUI->LoadLibrary("libBasicGUI.so"))
return testlib; return false;
} }
if(theCommandID == 4021 || // MENU PRIMITIVE - BOX else if(theCommandID == 4021 || // MENU PRIMITIVE - BOX
theCommandID == 4022 || // MENU PRIMITIVE - CYLINDER theCommandID == 4022 || // MENU PRIMITIVE - CYLINDER
theCommandID == 4023 || // MENU PRIMITIVE - SPHERE theCommandID == 4023 || // MENU PRIMITIVE - SPHERE
theCommandID == 4024 || // MENU PRIMITIVE - TORUS theCommandID == 4024 || // MENU PRIMITIVE - TORUS
theCommandID == 4025) { // MENU PRIMITIVE - CONE theCommandID == 4025) { // MENU PRIMITIVE - CONE
bool testlib = GeometryGUI::LoadLibrary(theCommandID, parent, "libPrimitiveGUI.so"); if(!GeomGUI->LoadLibrary("libPrimitiveGUI.so"))
return testlib; return false;
} }
if(theCommandID == 4031 || // MENU GENERATION - PRISM else if(theCommandID == 4031 || // MENU GENERATION - PRISM
theCommandID == 4032 || // MENU GENERATION - REVOLUTION theCommandID == 4032 || // MENU GENERATION - REVOLUTION
theCommandID == 4033 || // MENU GENERATION - FILLING theCommandID == 4033 || // MENU GENERATION - FILLING
theCommandID == 4034) { // MENU GENERATION - PIPE theCommandID == 4034) { // MENU GENERATION - PIPE
bool testlib = GeometryGUI::LoadLibrary(theCommandID, parent, "libGenerationGUI.so"); if(!GeomGUI->LoadLibrary("libGenerationGUI.so"))
return testlib; return false;
} }
if(theCommandID == 407 || // MENU BUILD - EXPLODE else if(theCommandID == 407 || // MENU BUILD - EXPLODE
theCommandID == 4081 || // MENU BUILD - EDGE theCommandID == 4081 || // MENU BUILD - EDGE
theCommandID == 4082 || // MENU BUILD - WIRE theCommandID == 4082 || // MENU BUILD - WIRE
theCommandID == 4083 || // MENU BUILD - FACE theCommandID == 4083 || // MENU BUILD - FACE
theCommandID == 4084 || // MENU BUILD - SHELL theCommandID == 4084 || // MENU BUILD - SHELL
theCommandID == 4085 || // MENU BUILD - SOLID theCommandID == 4085 || // MENU BUILD - SOLID
theCommandID == 4086) { // MENU BUILD - COMPUND theCommandID == 4086) { // MENU BUILD - COMPUND
bool testlib = GeometryGUI::LoadLibrary(theCommandID, parent, "libBuildGUI.so"); if(!GeomGUI->LoadLibrary("libBuildGUI.so"))
return testlib; return false;
} }
if(theCommandID == 5011 || // MENU BOOLEAN - FUSE else if(theCommandID == 5011 || // MENU BOOLEAN - FUSE
theCommandID == 5012 || // MENU BOOLEAN - COMMON theCommandID == 5012 || // MENU BOOLEAN - COMMON
theCommandID == 5013 || // MENU BOOLEAN - CUT theCommandID == 5013 || // MENU BOOLEAN - CUT
theCommandID == 5014) { // MENU BOOLEAN - SECTION theCommandID == 5014) { // MENU BOOLEAN - SECTION
bool testlib = GeometryGUI::LoadLibrary(theCommandID, parent, "libBooleanGUI.so"); if(!GeomGUI->LoadLibrary("libBooleanGUI.so"))
return testlib; return false;
} }
if(theCommandID == 5021 || // MENU TRANSFORMATION - TRANSLATION else if(theCommandID == 5021 || // MENU TRANSFORMATION - TRANSLATION
theCommandID == 5022 || // MENU TRANSFORMATION - ROTATION theCommandID == 5022 || // MENU TRANSFORMATION - ROTATION
theCommandID == 5023 || // MENU TRANSFORMATION - MIRROR theCommandID == 5023 || // MENU TRANSFORMATION - MIRROR
theCommandID == 5024 || // MENU TRANSFORMATION - SCALE theCommandID == 5024 || // MENU TRANSFORMATION - SCALE
theCommandID == 5025 || // MENU TRANSFORMATION - MULTI-TRANSLATION theCommandID == 5025 || // MENU TRANSFORMATION - MULTI-TRANSLATION
theCommandID == 5026) { // MENU TRANSFORMATION - MULTI-ROTATION theCommandID == 5026) { // MENU TRANSFORMATION - MULTI-ROTATION
bool testlib = GeometryGUI::LoadLibrary(theCommandID, parent, "libTransformationGUI.so"); if(!GeomGUI->LoadLibrary("libTransformationGUI.so"))
return testlib; return false;
} }
if(theCommandID == 503 || // MENU OPERATION - PARTITION else if(theCommandID == 503 || // MENU OPERATION - PARTITION
theCommandID == 504 || // MENU OPERATION - ARCHIMEDE theCommandID == 504 || // MENU OPERATION - ARCHIMEDE
theCommandID == 505 || // MENU OPERATION - FILLET theCommandID == 505 || // MENU OPERATION - FILLET
theCommandID == 506) { // MENU OPERATION - CHAMFER theCommandID == 506) { // MENU OPERATION - CHAMFER
bool testlib = GeometryGUI::LoadLibrary(theCommandID, parent, "libOperationGUI.so"); if(!GeomGUI->LoadLibrary("libOperationGUI.so"))
return testlib; return false;
} }
if(theCommandID == 601 || // MENU REPAIR - SEWING else if(theCommandID == 601 || // MENU REPAIR - SEWING
theCommandID == 602 || // MENU REPAIR - ORIENTATION theCommandID == 602 || // MENU REPAIR - ORIENTATION
theCommandID == 603 || // MENU REPAIR - SUPPRESS FACES theCommandID == 603 || // MENU REPAIR - SUPPRESS FACES
theCommandID == 604) { // MENU REPAIR - SUPPRESS HOLE theCommandID == 604) { // MENU REPAIR - SUPPRESS HOLE
bool testlib = GeometryGUI::LoadLibrary(theCommandID, parent, "libRepairGUI.so"); if(!GeomGUI->LoadLibrary("libRepairGUI.so"))
return testlib; return false;
} }
if(theCommandID == 701 || // MENU MEASURE - PROPERTIES else if(theCommandID == 701 || // MENU MEASURE - PROPERTIES
theCommandID == 702 || // MENU MEASURE - CDG theCommandID == 702 || // MENU MEASURE - CDG
theCommandID == 703 || // MENU MEASURE - INERTIA theCommandID == 703 || // MENU MEASURE - INERTIA
theCommandID == 7041 || // MENU MEASURE - BOUNDING BOX theCommandID == 7041 || // MENU MEASURE - BOUNDING BOX
@ -329,17 +272,30 @@ bool GeometryGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
theCommandID == 705 || // MENU MEASURE - TOLERANCE theCommandID == 705 || // MENU MEASURE - TOLERANCE
theCommandID == 706 || // MENU MEASURE - WHATIS theCommandID == 706 || // MENU MEASURE - WHATIS
theCommandID == 707) { // MENU MEASURE - CHECK theCommandID == 707) { // MENU MEASURE - CHECK
bool testlib = GeometryGUI::LoadLibrary(theCommandID, parent, "libMeasureGUI.so"); if(!GeomGUI->LoadLibrary("libMeasureGUI.so"))
return testlib; 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; return true;
} }
//===================================================================================== //=================================================================================
// function : OnKeyPress() // function : OnKeyPress()
// purpose : [static] // purpose : [static]
//===================================================================================== //=================================================================================
bool GeometryGUI::OnKeyPress(QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) bool GeometryGUI::OnKeyPress(QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
{ {
GeometryGUI::GetOrCreateGeometryGUI(parent); GeometryGUI::GetOrCreateGeometryGUI(parent);
@ -350,10 +306,10 @@ bool GeometryGUI::OnKeyPress(QKeyEvent* pe, QAD_Desktop* parent, QAD_StudyFrame*
} }
//================================================================================== //=================================================================================
// function : 0nMousePress() // function : 0nMousePress()
// purpose : [static] manage mouse events // purpose : [static] manage mouse events
//================================================================================== //=================================================================================
bool GeometryGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) bool GeometryGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
{ {
GeometryGUI::GetOrCreateGeometryGUI(parent); GeometryGUI::GetOrCreateGeometryGUI(parent);
@ -361,13 +317,6 @@ bool GeometryGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFr
if(GeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC) if(GeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
return false; 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) { if(GeomGUI->GetState() == CURRENT_SKETCH) {
GeomGUI->GetSketcher().ValidateEdge(); GeomGUI->GetSketcher().ValidateEdge();
if(GeomGUI->GetSketcher().GetmyEdgesNumber() == 1) { if(GeomGUI->GetSketcher().GetmyEdgesNumber() == 1) {
@ -378,37 +327,26 @@ bool GeometryGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFr
} }
} }
else if(GeomGUI->GetState() == POINT_METHOD) { else if(GeomGUI->GetState() == POINT_METHOD) {
// GeomGUI->EraseSimulationShape(); if(!GeomGUI->LoadLibrary("libBasicGUI.so"))
// BasicGUI_PointDlg *DialogPt = (BasicGUI_PointDlg*)(GeomGUI->GetActiveDialogBox()); return false;
// if(DialogPt->UseLocalContext()) { //Load Function OnMousePress
// ic->InitSelected(); OSD_Function osdF = GeomGUI->myGUILibrary.DlSymb("OnMousePress");
// if(pe->state() == Qt::ShiftButton) OMP (*f1) = NULL;
// v3d->getAISSelector()->shiftSelect(); /* Append selection */ if(osdF != NULL) {
// else f1 = (bool (*) (QMouseEvent*, QAD_Desktop*, QAD_StudyFrame*)) osdF;
// v3d->getAISSelector()->select(); /* New selection */ (*f1)(pe, parent, studyFrame);
// 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"));
} }
}
return false; return false;
} }
//======================================================================= //=================================================================================
// function : OnMouseMove() // function : OnMouseMove()
// purpose : [static] manage mouse events // purpose : [static] manage mouse events
//======================================================================= //=================================================================================
bool GeometryGUI::OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) bool GeometryGUI::OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
{ {
GeometryGUI::GetOrCreateGeometryGUI(parent); GeometryGUI::GetOrCreateGeometryGUI(parent);
@ -427,16 +365,14 @@ bool GeometryGUI::OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFra
} }
//===================================================================================== //=================================================================================
// function : SetSettings() // function : SetSettings()
// purpose : [static] // purpose : [static]
//===================================================================================== //=================================================================================
bool GeometryGUI::SetSettings(QAD_Desktop* parent) bool GeometryGUI::SetSettings(QAD_Desktop* parent)
{ {
GeometryGUI::GetOrCreateGeometryGUI(parent); GeometryGUI::GetOrCreateGeometryGUI(parent);
parent->menuBar()->setItemEnabled( 405, false); // SKETCH CONTRAINTS
/* Shading Color */ /* Shading Color */
QString SCr = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorRed"); QString SCr = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorRed");
QString SCg = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorGreen"); QString SCg = QAD_CONFIG->getSetting("Geometry:SettingsShadingColorGreen");
@ -515,11 +451,13 @@ bool GeometryGUI::SetSettings(QAD_Desktop* parent)
return true; return true;
} }
SALOME_Selection* Sel = SALOME_Selection::Selection(GeomGUI->GetActiveStudy()->getSelection());
theObject = "";
//===================================================================================== //=================================================================================
// function : DefinePopup() // function : DefinePopup()
// purpose : [static] // purpose : [static]
//===================================================================================== //=================================================================================
void GeometryGUI::DefinePopup(QString & theContext, QString & theParent, QString & theObject) void GeometryGUI::DefinePopup(QString & theContext, QString & theParent, QString & theObject)
{ {
GeometryGUI::GetOrCreateGeometryGUI(QAD_Application::getDesktop()); GeometryGUI::GetOrCreateGeometryGUI(QAD_Application::getDesktop());
@ -557,11 +495,23 @@ void GeometryGUI::DefinePopup(QString & theContext, QString & theParent, QString
return; 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() // function : CustomPopup()
// purpose : [static] // purpose : [static]
//===================================================================================== //=================================================================================
bool GeometryGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext, bool GeometryGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext,
const QString& theParent, const QString& theObject) const QString& theParent, const QString& theObject)
{ {
@ -612,17 +562,17 @@ bool GeometryGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QStr
else else
popup->setItemEnabled(804, true); //Add in Study Menu popup->setItemEnabled(804, true); //Add in Study Menu
if(IObject->IsKind(STANDARD_TYPE(GEOM_InteractiveObject))) { // if(IObject->IsKind(STANDARD_TYPE(GEOM_InteractiveObject))) {
Standard_Boolean found; // Standard_Boolean found;
Handle(GEOM_AISShape) Result = GeomGUI->ConvertIOinGEOMAISShape(IObject, found, true); // Handle(GEOM_AISShape) Result = GeomGUI->ConvertIOinGEOMAISShape(IObject, found, true);
if(found) { // if(found) {
if(Result->DisplayMode() == 1) // if(Result->DisplayMode() == 1)
popup->changeItem(8031, tr("GEOM_MEN_WIREFRAME")); //Shading/Wireframe Menu // popup->changeItem(8031, tr("GEOM_MEN_WIREFRAME")); //Shading/Wireframe Menu
else // else
popup->changeItem(8031, tr("GEOM_MEN_SHADING")); //Shading/Wireframe Menu // popup->changeItem(8031, tr("GEOM_MEN_SHADING")); //Shading/Wireframe Menu
} // }
} // }
if(!(v3d->isInViewer(IObject) && v3d->isVisible(IObject))) if(!(v3d->isInViewer(IObject) && v3d->isVisible(IObject)))
popup->removeItem(QAD_Erase_Popup_ID); popup->removeItem(QAD_Erase_Popup_ID);
@ -747,26 +697,26 @@ bool GeometryGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QStr
SALOMEDS::SObject_var SO = aStudy->FindObjectID(IObject->getEntry()); SALOMEDS::SObject_var SO = aStudy->FindObjectID(IObject->getEntry());
SALOMEDS::GenericAttribute_var anAttr; SALOMEDS::GenericAttribute_var anAttr;
SALOMEDS::AttributeIOR_var anIOR; SALOMEDS::AttributeIOR_var anIOR;
if(!SO->_is_nil()) { // if(!SO->_is_nil()) {
if(SO->FindAttribute(anAttr, "AttributeIOR")) { // if(SO->FindAttribute(anAttr, "AttributeIOR")) {
anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr); // anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
Standard_Boolean found; // Standard_Boolean found;
GEOM_Actor* Result = GeomGUI->ConvertIORinGEOMActor(anIOR->Value(), found, true); // GEOM_Actor* Result = GeomGUI->ConvertIORinGEOMActor(anIOR->Value(), found, true);
if(found) { // if(found) {
if(Result->getDisplayMode() == 1) // if(Result->getDisplayMode() == 1)
popup->changeItem(8031, tr("GEOM_MEN_WIREFRAME")); //Shading/Wireframe Menu // popup->changeItem(8031, tr("GEOM_MEN_WIREFRAME")); //Shading/Wireframe Menu
else // else
popup->changeItem(8031, tr("GEOM_MEN_SHADING")); //Shading/Wireframe Menu // popup->changeItem(8031, tr("GEOM_MEN_SHADING")); //Shading/Wireframe Menu
if(!Result->GetVisibility()) // if(!Result->GetVisibility())
popup->removeItem(QAD_Erase_Popup_ID); // popup->removeItem(QAD_Erase_Popup_ID);
else // else
popup->removeItem(QAD_Display_Popup_ID); // popup->removeItem(QAD_Display_Popup_ID);
} // }
else // else
popup->removeItem(QAD_Erase_Popup_ID); // popup->removeItem(QAD_Erase_Popup_ID);
} // }
} // }
} }
else else
popup->setItemEnabled(804, true); //Add in Study Menu popup->setItemEnabled(804, true); //Add in Study Menu
@ -794,7 +744,7 @@ bool GeometryGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QStr
bool needDisplay = false; bool needDisplay = false;
bool needErase = false; bool needErase = false;
SALOMEDS::GenericAttribute_var aTmpAttr; 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()) { for(;It.More();It.Next()) {
anIObject = It.Value(); anIObject = It.Value();
if(!anIObject->hasEntry()) if(!anIObject->hasEntry())
@ -886,10 +836,10 @@ bool GeometryGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QStr
} }
//======================================================================= //=================================================================================
// function : activeStudyChanged() // function : activeStudyChanged()
// purpose : static // purpose : static
//======================================================================= //=================================================================================
void GeometryGUI::activeStudyChanged(QAD_Desktop* parent) void GeometryGUI::activeStudyChanged(QAD_Desktop* parent)
{ {
GeometryGUI::GetOrCreateGeometryGUI(parent); GeometryGUI::GetOrCreateGeometryGUI(parent);
@ -915,7 +865,7 @@ void GeometryGUI::activeStudyChanged(QAD_Desktop* parent)
Mb->setItemEnabled(413, ViewOCC);// ShadingColor Settings Mb->setItemEnabled(413, ViewOCC);// ShadingColor Settings
Mb->setItemEnabled(414, ViewOCC);// Isos Settings Mb->setItemEnabled(414, ViewOCC);// Isos Settings
GeomGUI->EraseSimulationShape(); //GeomGUI->EraseSimulationShape();
GeomGUI->EmitSignalCloseAllDialogs(); GeomGUI->EmitSignalCloseAllDialogs();
GeomGUI = 0; GeomGUI = 0;
} }
@ -931,286 +881,34 @@ void GeometryGUI::BuildPresentation(const Handle(SALOME_InteractiveObject)& theI
{ {
GeometryGUI::GetOrCreateGeometryGUI(QAD_Application::getDesktop()); GeometryGUI::GetOrCreateGeometryGUI(QAD_Application::getDesktop());
Engines::Component_var comp = GeomGUI->GetDesktop()->getEngine("FactoryServer", "GEOM"); if(!GeomGUI->LoadLibrary("libDisplayGUI.so"))
GEOM::GEOM_Gen_var myComponentGeom = GEOM::GEOM_Gen::_narrow(comp); return;
SALOMEDS::Study_var aStudy = GeomGUI->GetActiveStudy()->getStudyDocument(); //Load Function BuildPresentation
SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder(); OSD_Function osdF = GeomGUI->myGUILibrary.DlSymb("BuildPresentation");
BP (*f1) = NULL;
OCCViewer_Viewer3d* v3d; if(osdF != NULL) {
Handle(AIS_InteractiveContext) ic; f1 = (void (*) (const Handle(SALOME_InteractiveObject)&)) osdF;
vtkRenderer* Renderer; (*f1)(theIO);
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 else
return; return;
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();
}
} }
//===================================================================================== //=================================================================================
// EXPORTED METHODS // EXPORTED METHODS
//===================================================================================== //=================================================================================
extern "C" extern "C"
{ {
bool OnGUIEvent(int theCommandID, QAD_Desktop* parent) bool OnGUIEvent(int theCommandID, QAD_Desktop* parent)
{return GeometryGUI::OnGUIEvent(theCommandID, 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);} {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);} {return GeometryGUI::OnMousePress(pe, parent, studyFrame);}
bool OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame) bool OnMouseMove(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)

View File

@ -29,7 +29,7 @@
#ifndef GEOMETRYGUI_H #ifndef GEOMETRYGUI_H
#define GEOMETRYGUI_H #define GEOMETRYGUI_H
#include "GEOMBase_Display.h" #include "GEOMContext.h"
//================================================================================= //=================================================================================
// class : GeometryGUI // class : GeometryGUI
@ -43,9 +43,7 @@ public :
GeometryGUI(); GeometryGUI();
~GeometryGUI(); ~GeometryGUI();
static GEOMBase_Context* GetOrCreateGeometryGUI(QAD_Desktop* desktop); static GEOMContext* GetOrCreateGeometryGUI(QAD_Desktop* desktop);
static bool LoadLibrary(int theCommandID, QAD_Desktop* parent, QString GUILibrary);
/* Managed by IAPP */ /* Managed by IAPP */
Standard_EXPORT static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); Standard_EXPORT static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);

View File

@ -61,6 +61,6 @@ LIB_SERVER_IDL =
CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome 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@ @CONCLUDE@

View File

@ -0,0 +1,901 @@
// GEOM GEOMGUI : GUI for Geometry component
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GEOMBase_Tools.cxx
// Author : Damien COQUERET
// Module : GEOM
// $Header:
using namespace std;
#include "GEOMToolsGUI.h"
#include "QAD_Config.h"
#include "QAD_FileDlg.h"
#include "QAD_Tools.h"
#include "QAD_MessageBox.h"
#include "QAD_RightFrame.h"
#include "OCCViewer_Viewer3d.h"
#include "VTKViewer_ViewFrame.h"
#include "SALOME_ListIteratorOfListIO.hxx"
#include "SALOMEGUI_NameDlg.h"
#include "SALOMEGUI_ImportOperation.h"
#include "SALOMEGUI_QtCatchCorbaException.hxx"
#include <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);}
}

View File

@ -0,0 +1,61 @@
// GEOM GEOMGUI : GUI for Geometry component
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GEOMBase_Tools.h
// Author : Damien COQUERET
// Module : GEOM
// $Header:
#ifndef GEOMTOOLSGUI_H
#define GEOMTOOLSGUI_H
#include "GEOMBase.h"
//=================================================================================
// class : GEOMBase_Tools
// purpose :
//=================================================================================
class GEOMToolsGUI : public QObject
{
Q_OBJECT /* for QT compatibility */
public :
GEOMToolsGUI();
~GEOMToolsGUI();
static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
/* Import and export topology methods */
bool Import();
bool Export();
void OnEditCopy();
void OnEditDelete();
GEOMBase* myGeomBase;
GEOMContext* myGeomGUI;
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
};
#endif

View File

@ -0,0 +1,131 @@
// GEOM GEOMGUI : GUI for Geometry component
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GEOMBase_NbIsosDlg.cxx
// Author :
// Module : GEOM
// $Header:
using namespace std;
#include "GEOMToolsGUI_NbIsosDlg.h"
#include "QAD_Tools.h"
#include <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
}

View File

@ -0,0 +1,59 @@
// GEOM GEOMGUI : GUI for Geometry component
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GEOMBase_NbIsosDlg.h
// Author :
// Module : GEOM
// $Header:
#ifndef GEOMBASE_NBISOSDLG_H
#define GEOMBASE_NBISOSDLG_H
#include <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

View File

@ -0,0 +1,238 @@
// GEOM GEOMGUI : GUI for Geometry component
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GEOMBase_TransparencyDlg.cxx
// Author : Lucien PIGNOLONI
// Module : GEOM
using namespace std;
#include "GEOMToolsGUI_TransparencyDlg.h"
#include "QAD_RightFrame.h"
#include "SALOME_ListIteratorOfListIO.hxx"
#include <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;
}

View File

@ -0,0 +1,98 @@
// GEOM GEOMGUI : GUI for Geometry component
//
// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
//
//
//
// File : GEOMBase_TransparencyDlg.h
// Author : Lucien PIGNOLONI
// Module : GEOM
// $Header$
#ifndef DIALOGBOX_TRANSPARENCYDLG_H
#define DIALOGBOX_TRANSPARENCYDLG_H
#include <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

View File

@ -0,0 +1,69 @@
# GEOM GEOMTOOLSGUI :
#
# Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
# CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
#
#
#
# File : Makefile.in
# Author : Damien COQUERET (OCC)
# Module : GEOM
# $Header:
top_srcdir=@top_srcdir@
top_builddir=../..
srcdir=@srcdir@
VPATH=.:@srcdir@:@top_srcdir@/idl
@COMMENCE@
# Libraries targets
LIB = libGEOMToolsGUI.la
# header files
EXPORT_HEADERS=
LIB_SRC = GEOMToolsGUI.cxx \
GEOMToolsGUI_NbIsosDlg.cxx \
GEOMToolsGUI_TransparencyDlg.cxx
LIB_MOC = \
GEOMToolsGUI.h \
GEOMToolsGUI_NbIsosDlg.h \
GEOMToolsGUI_TransparencyDlg.h
LIB_CLIENT_IDL = SALOME_Exception.idl \
GEOM_Gen.idl \
GEOM_Shape.idl \
SALOMEDS.idl \
SALOMEDS_Attributes.idl \
SALOME_ModuleCatalog.idl \
SALOME_Component.idl \
LIB_SERVER_IDL =
# additionnal information to compil and link file
CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome
CXXFLAGS += $(OCC_CXXFLAGS) -I${KERNEL_ROOT_DIR}/include/salome
LDFLAGS += -lOCCViewer -lVTKViewer -lSalomeObject -lSalomeGUI -lGEOMClient -lGEOMObject -lGEOMFiltersSelection -lGEOMContext -lGEOMBase -L${KERNEL_ROOT_DIR}/lib/salome
@CONCLUDE@

View File

@ -29,13 +29,13 @@
using namespace std; using namespace std;
#include "GenerationGUI.h" #include "GenerationGUI.h"
#include "SALOMEGUI_QtCatchCorbaException.hxx"
#include "GenerationGUI_PrismDlg.h" // Method PRISM #include "GenerationGUI_PrismDlg.h" // Method PRISM
#include "GenerationGUI_RevolDlg.h" // Method REVOL #include "GenerationGUI_RevolDlg.h" // Method REVOL
#include "GenerationGUI_FillingDlg.h" // Method FILLING #include "GenerationGUI_FillingDlg.h" // Method FILLING
#include "GenerationGUI_PipeDlg.h" // Method PIPE #include "GenerationGUI_PipeDlg.h" // Method PIPE
static GenerationGUI* myGenerationGUI = 0;
//======================================================================= //=======================================================================
// function : GenerationGUI() // function : GenerationGUI()
// purpose : Constructor // purpose : Constructor
@ -43,9 +43,9 @@ static GenerationGUI* myGenerationGUI = 0;
GenerationGUI::GenerationGUI() : GenerationGUI::GenerationGUI() :
QObject() QObject()
{ {
myGeomGUI = GEOMBase_Context::GetGeomGUI(); myGeomBase = new GEOMBase();
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); myGeomGUI = GEOMContext::GetGeomGUI();
myGeom = GEOM::GEOM_Gen::_narrow(comp); myGeom = myGeomGUI->myComponentGeom;
} }
@ -58,25 +58,13 @@ GenerationGUI::~GenerationGUI()
} }
//=======================================================================
// function : GetOrCreateGUI()
// purpose : Gets or create an object 'GUI' with initialisations
// : Returns 'GUI' as a pointer
//=======================================================================
GenerationGUI* GenerationGUI::GetOrCreateGUI()
{
myGenerationGUI = new GenerationGUI();
return myGenerationGUI;
}
//======================================================================= //=======================================================================
// function : OnGUIEvent() // function : OnGUIEvent()
// purpose : // purpose :
//======================================================================= //=======================================================================
bool GenerationGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) bool GenerationGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
{ {
GenerationGUI::GetOrCreateGUI(); GenerationGUI* myGenerationGUI = new GenerationGUI();
myGenerationGUI->myGeomGUI->EmitSignalDeactivateDialog(); myGenerationGUI->myGeomGUI->EmitSignalDeactivateDialog();
SALOME_Selection* Sel = SALOME_Selection::Selection(myGenerationGUI->myGeomGUI->GetActiveStudy()->getSelection()); SALOME_Selection* Sel = SALOME_Selection::Selection(myGenerationGUI->myGeomGUI->GetActiveStudy()->getSelection());
@ -134,10 +122,10 @@ void GenerationGUI::MakePrismAndDisplay(GEOM::GEOM_Shape_ptr BaseShape, const gp
TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result); TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result);
Standard_CString type; Standard_CString type;
myGeomGUI->GetShapeTypeString(S,type); myGeomBase->GetShapeTypeString(S,type);
result->NameType(type); result->NameType(type);
if(myGeomGUI->Display(result)) if(myGeomBase->Display(result))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
} }
catch(const SALOME::SALOME_Exception& S_ex) { catch(const SALOME::SALOME_Exception& S_ex) {
@ -163,10 +151,10 @@ void GenerationGUI::MakeRevolutionAndDisplay(GEOM::GEOM_Shape_ptr Shape, const g
TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result); TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result);
Standard_CString type; Standard_CString type;
myGeomGUI->GetShapeTypeString(S,type); myGeomBase->GetShapeTypeString(S,type);
result->NameType(type); result->NameType(type);
if(myGeomGUI->Display(result)) if(myGeomBase->Display(result))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
} }
catch(const SALOME::SALOME_Exception& S_ex) { catch(const SALOME::SALOME_Exception& S_ex) {
@ -194,10 +182,10 @@ void GenerationGUI::MakeFillingAndDisplay(GEOM::GEOM_Shape_ptr SectionShape, con
TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result); TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result);
Standard_CString type; Standard_CString type;
myGeomGUI->GetShapeTypeString(S,type); myGeomBase->GetShapeTypeString(S,type);
result->NameType(type); result->NameType(type);
if(myGeomGUI->Display(result)) if(myGeomBase->Display(result))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
return; return;
} }
@ -216,10 +204,10 @@ void GenerationGUI::MakePipeAndDisplay(GEOM::GEOM_Shape_ptr aPath, GEOM::GEOM_Sh
{ {
try { try {
GEOM::GEOM_Shape_ptr result = myGeom->MakePipe(aPath, aBase); 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); TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result);
Standard_CString type; Standard_CString type;
myGeomGUI->GetShapeTypeString(S,type); myGeomBase->GetShapeTypeString(S,type);
result->NameType(type); result->NameType(type);
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));

View File

@ -29,7 +29,7 @@
#ifndef GENERATIONGUI_H #ifndef GENERATIONGUI_H
#define GENERATIONGUI_H #define GENERATIONGUI_H
#include "GEOMBase_Display.h" #include "GEOMBase.h"
//================================================================================= //=================================================================================
// class : GenerationGUI // class : GenerationGUI
@ -43,7 +43,6 @@ public :
GenerationGUI(); GenerationGUI();
~GenerationGUI(); ~GenerationGUI();
static GenerationGUI* GetOrCreateGUI();
static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
void MakePrismAndDisplay(GEOM::GEOM_Shape_ptr BaseShape, const gp_Pnt P1, const gp_Pnt P2); void MakePrismAndDisplay(GEOM::GEOM_Shape_ptr BaseShape, const gp_Pnt P1, const gp_Pnt P2);
@ -53,7 +52,8 @@ public :
const double tol3d, const double tol2d, const short nbiter); const double tol3d, const double tol2d, const short nbiter);
void MakePipeAndDisplay(GEOM::GEOM_Shape_ptr aPath, GEOM::GEOM_Shape_ptr aBase); 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 */ GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
}; };

View File

@ -175,7 +175,7 @@ void GenerationGUI_FillingDlg::SelectionIntoArgument()
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
QString aString = ""; /* name of selection */ QString aString = ""; /* name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
if(nbSel != 1) { if(nbSel != 1) {
if(myEditCurrentArgument == GroupPoints->LineEdit1) if(myEditCurrentArgument == GroupPoints->LineEdit1)
myOkSectionShape = false; myOkSectionShape = false;
@ -186,12 +186,12 @@ void GenerationGUI_FillingDlg::SelectionIntoArgument()
TopoDS_Shape S; TopoDS_Shape S;
Standard_Boolean testResult; Standard_Boolean testResult;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) if(!myGeomBase->GetTopoFromSelection(mySelection, S))
return; return;
if(myEditCurrentArgument == GroupPoints->LineEdit1 && S.ShapeType() == TopAbs_COMPOUND) { if(myEditCurrentArgument == GroupPoints->LineEdit1 && S.ShapeType() == TopAbs_COMPOUND) {
myEditCurrentArgument->setText(aString); myEditCurrentArgument->setText(aString);
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult); myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult);
if(!testResult) if(!testResult)
return; return;
myOkSectionShape = true; myOkSectionShape = true;

View File

@ -34,6 +34,8 @@
#include "GenerationGUI.h" #include "GenerationGUI.h"
#include "GEOM_ShapeTypeFilter.hxx"
//================================================================================= //=================================================================================
// class : GenerationGUI_FillingDlg // class : GenerationGUI_FillingDlg
// purpose : // purpose :

View File

@ -131,7 +131,7 @@ void GenerationGUI_PipeDlg::ClickOnApply()
myGeomGUI->GetDesktop()->putInfo(tr("")); myGeomGUI->GetDesktop()->putInfo(tr(""));
if (mySimulationTopoDs.IsNull()) if (mySimulationTopoDs.IsNull())
return; return;
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
if(myOkShape1 && myOkShape2) if(myOkShape1 && myOkShape2)
@ -147,12 +147,12 @@ void GenerationGUI_PipeDlg::ClickOnApply()
//================================================================================= //=================================================================================
void GenerationGUI_PipeDlg::SelectionIntoArgument() void GenerationGUI_PipeDlg::SelectionIntoArgument()
{ {
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
QString aString = ""; /* name of selection */ QString aString = ""; /* name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
if(nbSel != 1) { if(nbSel != 1) {
if(myEditCurrentArgument == GroupPoints->LineEdit1) if(myEditCurrentArgument == GroupPoints->LineEdit1)
myOkShape1 = false; myOkShape1 = false;
@ -165,11 +165,11 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
TopoDS_Shape S; TopoDS_Shape S;
Standard_Boolean testResult; Standard_Boolean testResult;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) if(!myGeomBase->GetTopoFromSelection(mySelection, S))
return; return;
if(myEditCurrentArgument == GroupPoints->LineEdit1 && S.ShapeType() != TopAbs_COMPSOLID && S.ShapeType() != TopAbs_COMPOUND && S.ShapeType() != TopAbs_SOLID && S.ShapeType() != TopAbs_SHAPE) { 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) if(!testResult)
return; return;
myEditCurrentArgument->setText(aString); myEditCurrentArgument->setText(aString);
@ -177,7 +177,7 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
myShape1 = S; myShape1 = S;
} }
else if(myEditCurrentArgument == GroupPoints->LineEdit2 && S.ShapeType() != TopAbs_COMPSOLID && S.ShapeType() != TopAbs_COMPOUND && S.ShapeType() != TopAbs_SOLID && S.ShapeType() != TopAbs_SHAPE) { 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) if(!testResult)
return; return;
myEditCurrentArgument->setText(aString); myEditCurrentArgument->setText(aString);
@ -254,7 +254,7 @@ void GenerationGUI_PipeDlg::ActivateThisDialog()
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if(!mySimulationTopoDs.IsNull()) if(!mySimulationTopoDs.IsNull())
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
return; return;
} }
@ -265,7 +265,7 @@ void GenerationGUI_PipeDlg::ActivateThisDialog()
//================================================================================= //=================================================================================
void GenerationGUI_PipeDlg::MakePipeSimulationAndDisplay() void GenerationGUI_PipeDlg::MakePipeSimulationAndDisplay()
{ {
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
try { try {
@ -282,11 +282,11 @@ void GenerationGUI_PipeDlg::MakePipeSimulationAndDisplay()
if(BRepAlgoAPI::IsValid(tds)) { if(BRepAlgoAPI::IsValid(tds)) {
//Draw Pipe //Draw Pipe
mySimulationTopoDs = tds; mySimulationTopoDs = tds;
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
} }
} }
catch(Standard_Failure) { catch(Standard_Failure) {
MESSAGE("Exception catched in MakeMirrorSimulationAndDisplay"); MESSAGE("Exception catched in MakePipeSimulationAndDisplay");
return; return;
} }
return; return;

View File

@ -149,7 +149,7 @@ void GenerationGUI_PrismDlg::ClickOnApply()
myGeomGUI->GetDesktop()->putInfo(tr("")); myGeomGUI->GetDesktop()->putInfo(tr(""));
if (mySimulationTopoDs.IsNull()) if (mySimulationTopoDs.IsNull())
return; return;
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
gp_Pnt P1, P2; gp_Pnt P1, P2;
@ -179,12 +179,12 @@ void GenerationGUI_PrismDlg::ClickOnApply()
//================================================================================= //=================================================================================
void GenerationGUI_PrismDlg::SelectionIntoArgument() void GenerationGUI_PrismDlg::SelectionIntoArgument()
{ {
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
QString aString = ""; /* name of selection */ QString aString = ""; /* name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
if(nbSel != 1) { if(nbSel != 1) {
if(myEditCurrentArgument == GroupPoints->LineEdit1) if(myEditCurrentArgument == GroupPoints->LineEdit1)
myOkBase = false; myOkBase = false;
@ -197,13 +197,13 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
TopoDS_Shape S; TopoDS_Shape S;
Standard_Boolean testResult; Standard_Boolean testResult;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) if(!myGeomBase->GetTopoFromSelection(mySelection, S))
return; return;
gp_Pnt aPoint1, aPoint2; gp_Pnt aPoint1, aPoint2;
if(myEditCurrentArgument == GroupPoints->LineEdit1) { if(myEditCurrentArgument == GroupPoints->LineEdit1) {
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult); myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult);
if(!testResult) if(!testResult)
return; return;
if(S.ShapeType() <= 2) if(S.ShapeType() <= 2)
@ -212,8 +212,8 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
myOkBase = true; myOkBase = true;
myBaseTopo = S; myBaseTopo = S;
} }
else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomGUI->LinearEdgeExtremities(S, aPoint1, aPoint2)) { else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomBase->LinearEdgeExtremities(S, aPoint1, aPoint2)) {
myGeomGUI->GetBipointDxDyDz(aPoint1, aPoint2, myDx, myDy, myDz); myGeomBase->GetBipointDxDyDz(aPoint1, aPoint2, myDx, myDy, myDz);
myEditCurrentArgument->setText(aString); myEditCurrentArgument->setText(aString);
myOkLine = true; myOkLine = true;
} }
@ -289,7 +289,7 @@ void GenerationGUI_PrismDlg::ActivateThisDialog()
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if(!mySimulationTopoDs.IsNull()) if(!mySimulationTopoDs.IsNull())
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
return; return;
} }
@ -328,7 +328,7 @@ void GenerationGUI_PrismDlg::ReverseVector(int state)
//================================================================================= //=================================================================================
void GenerationGUI_PrismDlg::MakePrismSimulationAndDisplay() void GenerationGUI_PrismDlg::MakePrismSimulationAndDisplay()
{ {
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
try { try {
@ -339,7 +339,7 @@ void GenerationGUI_PrismDlg::MakePrismSimulationAndDisplay()
if(mySimulationTopoDs.IsNull()) if(mySimulationTopoDs.IsNull())
return; return;
else else
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
} }
catch(Standard_Failure) { catch(Standard_Failure) {
MESSAGE("Exception catched in MakePrismSimulationAndDisplay" << endl); MESSAGE("Exception catched in MakePrismSimulationAndDisplay" << endl);

View File

@ -34,6 +34,8 @@
#include "GenerationGUI.h" #include "GenerationGUI.h"
#include "GEOM_ShapeTypeFilter.hxx"
//================================================================================= //=================================================================================
// class : GenerationGUI_PrismDlg // class : GenerationGUI_PrismDlg
// purpose : // purpose :

View File

@ -148,7 +148,7 @@ void GenerationGUI_RevolDlg::ClickOnApply()
myGeomGUI->GetDesktop()->putInfo(tr("")); myGeomGUI->GetDesktop()->putInfo(tr(""));
if (mySimulationTopoDs.IsNull()) if (mySimulationTopoDs.IsNull())
return; return;
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
if(myOkBase && myOkAxis) if(myOkBase && myOkAxis)
@ -163,12 +163,12 @@ void GenerationGUI_RevolDlg::ClickOnApply()
//================================================================================= //=================================================================================
void GenerationGUI_RevolDlg::SelectionIntoArgument() void GenerationGUI_RevolDlg::SelectionIntoArgument()
{ {
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
QString aString = ""; /* name of selection */ QString aString = ""; /* name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
if(nbSel != 1) { if(nbSel != 1) {
if(myEditCurrentArgument == GroupPoints->LineEdit1) if(myEditCurrentArgument == GroupPoints->LineEdit1)
myOkBase = false; myOkBase = false;
@ -181,11 +181,11 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument()
TopoDS_Shape S; TopoDS_Shape S;
Standard_Boolean testResult; Standard_Boolean testResult;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) if(!myGeomBase->GetTopoFromSelection(mySelection, S))
return; return;
if(myEditCurrentArgument == GroupPoints->LineEdit1) { if(myEditCurrentArgument == GroupPoints->LineEdit1) {
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult); myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult);
if(!testResult) if(!testResult)
return; return;
TopAbs_ShapeEnum aType = S.ShapeType(); TopAbs_ShapeEnum aType = S.ShapeType();
@ -261,7 +261,7 @@ void GenerationGUI_RevolDlg::ActivateThisDialog()
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if(!mySimulationTopoDs.IsNull()) if(!mySimulationTopoDs.IsNull())
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
return; return;
} }
@ -312,7 +312,7 @@ void GenerationGUI_RevolDlg::ReverseAngle(int state)
//================================================================================= //=================================================================================
void GenerationGUI_RevolDlg::MakeRevolutionSimulationAndDisplay() void GenerationGUI_RevolDlg::MakeRevolutionSimulationAndDisplay()
{ {
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
TopAbs_ShapeEnum aType = myBase.ShapeType(); TopAbs_ShapeEnum aType = myBase.ShapeType();
@ -322,7 +322,7 @@ void GenerationGUI_RevolDlg::MakeRevolutionSimulationAndDisplay()
try { try {
gp_Ax1 AX(myLoc, myDir); gp_Ax1 AX(myLoc, myDir);
mySimulationTopoDs = BRepPrimAPI_MakeRevol(myBase, AX, myAngle*PI180); mySimulationTopoDs = BRepPrimAPI_MakeRevol(myBase, AX, myAngle*PI180);
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
} }
catch(Standard_Failure) { catch(Standard_Failure) {
MESSAGE("Exception catched in MakeRevolutionSimulationAndDisplay"); MESSAGE("Exception catched in MakeRevolutionSimulationAndDisplay");

View File

@ -34,6 +34,7 @@
#include "GenerationGUI.h" #include "GenerationGUI.h"
#include "GEOM_ShapeTypeFilter.hxx"
#include <gp_Dir.hxx> #include <gp_Dir.hxx>
//================================================================================= //=================================================================================

View File

@ -35,7 +35,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl
@COMMENCE@ @COMMENCE@
# header files # header files
EXPORT_HEADERS= GenerationGUI.h EXPORT_HEADERS=
# Libraries targets # Libraries targets
LIB = libGenerationGUI.la LIB = libGenerationGUI.la
@ -68,6 +68,6 @@ LIB_SERVER_IDL =
CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome 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 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@ @CONCLUDE@

View File

@ -35,7 +35,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl
@COMMENCE@ @COMMENCE@
# header files # header files
EXPORT_HEADERS= MeasureGUI.h EXPORT_HEADERS=
# Libraries targets # Libraries targets
LIB = libMeasureGUI.la LIB = libMeasureGUI.la
@ -76,6 +76,6 @@ LIB_SERVER_IDL =
CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome 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 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@ @CONCLUDE@

View File

@ -29,6 +29,8 @@
using namespace std; using namespace std;
#include "MeasureGUI.h" #include "MeasureGUI.h"
#include "SALOMEGUI_QtCatchCorbaException.hxx"
#include "MeasureGUI_PropertiesDlg.h" // Method PROPERTIES #include "MeasureGUI_PropertiesDlg.h" // Method PROPERTIES
#include "MeasureGUI_CenterMassDlg.h" // Method CENTER MASS #include "MeasureGUI_CenterMassDlg.h" // Method CENTER MASS
#include "MeasureGUI_InertiaDlg.h" // Method INERTIA #include "MeasureGUI_InertiaDlg.h" // Method INERTIA
@ -38,8 +40,6 @@ using namespace std;
#include "MeasureGUI_WhatisDlg.h" // Method WHATIS #include "MeasureGUI_WhatisDlg.h" // Method WHATIS
#include "MeasureGUI_CheckShape.h" // Method CHECKSHAPE #include "MeasureGUI_CheckShape.h" // Method CHECKSHAPE
static MeasureGUI* myMeasureGUI = 0;
//======================================================================= //=======================================================================
// function : MeasureGUI() // function : MeasureGUI()
// purpose : Constructor // purpose : Constructor
@ -47,9 +47,9 @@ static MeasureGUI* myMeasureGUI = 0;
MeasureGUI::MeasureGUI() : MeasureGUI::MeasureGUI() :
QObject() QObject()
{ {
myGeomGUI = GEOMBase_Context::GetGeomGUI(); myGeomBase = new GEOMBase();
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); myGeomGUI = GEOMContext::GetGeomGUI();
myGeom = GEOM::GEOM_Gen::_narrow(comp); myGeom = myGeomGUI->myComponentGeom;
} }
@ -62,25 +62,13 @@ MeasureGUI::~MeasureGUI()
} }
//=======================================================================
// function : GetOrCreateGUI()
// purpose : Gets or create an object 'GUI' with initialisations
// : Returns 'GUI' as a pointer
//=======================================================================
MeasureGUI* MeasureGUI::GetOrCreateGUI()
{
myMeasureGUI = new MeasureGUI();
return myMeasureGUI;
}
//======================================================================= //=======================================================================
// function : OnGUIEvent() // function : OnGUIEvent()
// purpose : // purpose :
//======================================================================= //=======================================================================
bool MeasureGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) bool MeasureGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
{ {
MeasureGUI::GetOrCreateGUI(); MeasureGUI* myMeasureGUI = new MeasureGUI();
myMeasureGUI->myGeomGUI->EmitSignalDeactivateDialog(); myMeasureGUI->myGeomGUI->EmitSignalDeactivateDialog();
SALOME_Selection* Sel = SALOME_Selection::Selection(myMeasureGUI->myGeomGUI->GetActiveStudy()->getSelection()); SALOME_Selection* Sel = SALOME_Selection::Selection(myMeasureGUI->myGeomGUI->GetActiveStudy()->getSelection());
@ -149,7 +137,7 @@ void MeasureGUI::MakeCDGAndDisplay(GEOM::GEOM_Shape_ptr Shape)
return; return;
} }
result->NameType(tr("GEOM_POINT")); result->NameType(tr("GEOM_POINT"));
if(myGeomGUI->Display(result)) if(myGeomBase->Display(result))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
} }
catch(const SALOME::SALOME_Exception& S_ex) { catch(const SALOME::SALOME_Exception& S_ex) {

View File

@ -29,7 +29,7 @@
#ifndef MEASUREGUI_H #ifndef MEASUREGUI_H
#define MEASUREGUI_H #define MEASUREGUI_H
#include "GEOMBase_Context.h" #include "GEOMBase.h"
//================================================================================= //=================================================================================
// class : MeasureGUI // class : MeasureGUI
@ -43,12 +43,12 @@ public :
MeasureGUI(); MeasureGUI();
~MeasureGUI(); ~MeasureGUI();
static MeasureGUI* GetOrCreateGUI();
static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
void MakeCDGAndDisplay(GEOM::GEOM_Shape_ptr Shape); void MakeCDGAndDisplay(GEOM::GEOM_Shape_ptr Shape);
GEOMBase_Context* myGeomGUI; GEOMBase* myGeomBase;
GEOMContext* myGeomGUI;
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
}; };

View File

@ -242,7 +242,8 @@ void MeasureGUI_BndBoxDlg::Init( SALOME_Selection* Sel )
Constructor1->setChecked( TRUE ); Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ; myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel; mySelection = Sel;
myGeomGUI = GEOMBase_Context::GetGeomGUI() ; myGeomBase = new GEOMBase() ;
myGeomGUI = GEOMContext::GetGeomGUI() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
// TODO : previous selection into argument ? // TODO : previous selection into argument ?
@ -265,7 +266,7 @@ void MeasureGUI_BndBoxDlg::Init( SALOME_Selection* Sel )
/* Move widget on the botton right corner of main widget */ /* Move widget on the botton right corner of main widget */
int x, y ; int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ; myGeomBase->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ; this->move( x, y ) ;
this->show() ; /* displays Dialog */ this->show() ; /* displays Dialog */
@ -290,7 +291,7 @@ void MeasureGUI_BndBoxDlg::ConstructorsClicked(int constructorId)
//================================================================================= //=================================================================================
void MeasureGUI_BndBoxDlg::ClickOnCancel() void MeasureGUI_BndBoxDlg::ClickOnCancel()
{ {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
disconnect( mySelection, 0, this, 0 ); disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ; myGeomGUI->ResetState() ;
@ -316,14 +317,14 @@ void MeasureGUI_BndBoxDlg::SelectionIntoArgument()
QString aString = ""; /* future the name of selection */ QString aString = ""; /* future the name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel != 1 ) { if ( nbSel != 1 ) {
return ; return ;
} }
/* nbSel == 1 */ /* nbSel == 1 */
TopoDS_Shape S; TopoDS_Shape S;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) if( !myGeomBase->GetTopoFromSelection(mySelection, S) )
return ; return ;
if( S.IsNull() ) { if( S.IsNull() ) {
@ -379,7 +380,7 @@ void MeasureGUI_BndBoxDlg::LineEditReturnPressed()
/* so SelectionIntoArgument() is automatically called. */ /* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ; const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ; QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { if( myGeomBase->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ; myEditCurrentArgument->setText( objectUserName ) ;
} }
@ -473,7 +474,7 @@ void MeasureGUI_BndBoxDlg::CalculateAndDisplayBndBox(const TopoDS_Shape& S)
mySimulationTopoDs = BRepPrimAPI_MakeBox( gp_Pnt(axmin,aymin,azmin), mySimulationTopoDs = BRepPrimAPI_MakeBox( gp_Pnt(axmin,aymin,azmin),
gp_Pnt(axmax,aymax,azmax) ).Shape(); gp_Pnt(axmax,aymax,azmax) ).Shape();
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
} }
catch(Standard_Failure) { catch(Standard_Failure) {
MESSAGE("Catch intercepted in CalculateAndDisplayBndBox()" << endl ) ; MESSAGE("Catch intercepted in CalculateAndDisplayBndBox()" << endl ) ;

View File

@ -64,7 +64,8 @@ private:
void CalculateAndDisplayBndBox(const TopoDS_Shape& S) ; void CalculateAndDisplayBndBox(const TopoDS_Shape& S) ;
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ 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 */ SALOME_Selection* mySelection ; /* User shape selection */
int myConstructorId ; /* Current constructor id = radio button id */ int myConstructorId ; /* Current constructor id = radio button id */
QLineEdit* myEditCurrentArgument; /* Current LineEdit */ QLineEdit* myEditCurrentArgument; /* Current LineEdit */

View File

@ -233,7 +233,8 @@ void MeasureGUI_CenterMassDlg::Init( SALOME_Selection* Sel )
Constructor1->setChecked( TRUE ); Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ; myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel; mySelection = Sel;
myGeomGUI = GEOMBase_Context::GetGeomGUI() ; myGeomBase = new GEOMBase() ;
myGeomGUI = GEOMContext::GetGeomGUI() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
myShape.Nullify() ; myShape.Nullify() ;
@ -259,7 +260,7 @@ void MeasureGUI_CenterMassDlg::Init( SALOME_Selection* Sel )
/* Move widget on the botton right corner of main widget */ /* Move widget on the botton right corner of main widget */
int x, y ; int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ; myGeomBase->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ; this->move( x, y ) ;
this->show() ; /* displays Dialog */ this->show() ; /* displays Dialog */
@ -284,7 +285,7 @@ void MeasureGUI_CenterMassDlg::ConstructorsClicked(int constructorId)
//================================================================================= //=================================================================================
void MeasureGUI_CenterMassDlg::ClickOnCancel() void MeasureGUI_CenterMassDlg::ClickOnCancel()
{ {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
disconnect( mySelection, 0, this, 0 ); disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ; myGeomGUI->ResetState() ;
@ -310,7 +311,7 @@ void MeasureGUI_CenterMassDlg::ClickOnOk()
//================================================================================= //=================================================================================
void MeasureGUI_CenterMassDlg::ClickOnApply() void MeasureGUI_CenterMassDlg::ClickOnApply()
{ {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
myGeomGUI->GetDesktop()->putInfo( tr("") ) ; myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
if( myOkCenterMass) { if( myOkCenterMass) {
@ -328,7 +329,7 @@ void MeasureGUI_CenterMassDlg::ClickOnApply()
//================================================================================= //=================================================================================
void MeasureGUI_CenterMassDlg::SelectionIntoArgument() void MeasureGUI_CenterMassDlg::SelectionIntoArgument()
{ {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
myEditCurrentArgument->setText("") ; myEditCurrentArgument->setText("") ;
myOkCenterMass = false ; myOkCenterMass = false ;
Standard_Boolean testResult ; Standard_Boolean testResult ;
@ -339,17 +340,17 @@ void MeasureGUI_CenterMassDlg::SelectionIntoArgument()
QString aString = ""; /* future the name of selection */ QString aString = ""; /* future the name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel != 1 ) { if ( nbSel != 1 ) {
return ; return ;
} }
/* nbSel == 1 */ /* nbSel == 1 */
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
if( !myGeomGUI->GetTopoFromSelection(mySelection, this->myShape) ) if( !myGeomBase->GetTopoFromSelection(mySelection, this->myShape) )
return ; return ;
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult) ;
if( !testResult ) if( !testResult )
return ; return ;
myEditCurrentArgument->setText(aString) ; myEditCurrentArgument->setText(aString) ;
@ -402,7 +403,7 @@ void MeasureGUI_CenterMassDlg::LineEditReturnPressed()
/* so SelectionIntoArgument() is automatically called. */ /* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ; const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ; QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { if( myGeomBase->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ; myEditCurrentArgument->setText( objectUserName ) ;
} }
return ; return ;
@ -416,7 +417,7 @@ void MeasureGUI_CenterMassDlg::LineEditReturnPressed()
void MeasureGUI_CenterMassDlg::DeactivateActiveDialog() void MeasureGUI_CenterMassDlg::DeactivateActiveDialog()
{ {
if ( GroupConstructors->isEnabled() ) { if ( GroupConstructors->isEnabled() ) {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
disconnect( mySelection, 0, this, 0 ); disconnect( mySelection, 0, this, 0 );
GroupConstructors->setEnabled(false) ; GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ; GroupC1->setEnabled(false) ;
@ -439,7 +440,7 @@ void MeasureGUI_CenterMassDlg::ActivateThisDialog()
GroupButtons->setEnabled(true) ; GroupButtons->setEnabled(true) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
if( !mySimulationTopoDs.IsNull() ) if( !mySimulationTopoDs.IsNull() )
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
return ; return ;
} }
@ -475,7 +476,7 @@ void MeasureGUI_CenterMassDlg::closeEvent( QCloseEvent* e )
//================================================================================= //=================================================================================
bool MeasureGUI_CenterMassDlg::CalculateAndDisplayCenterMass() bool MeasureGUI_CenterMassDlg::CalculateAndDisplayCenterMass()
{ {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
try { try {
@ -484,7 +485,7 @@ bool MeasureGUI_CenterMassDlg::CalculateAndDisplayCenterMass()
GProp_GProps System; GProp_GProps System;
if ( this->myShape.ShapeType() == TopAbs_VERTEX) { 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 ) { else if ( this->myShape.ShapeType() == TopAbs_EDGE || this->myShape.ShapeType() == TopAbs_WIRE ) {
BRepGProp::LinearProperties(this->myShape, System); BRepGProp::LinearProperties(this->myShape, System);
@ -513,7 +514,7 @@ bool MeasureGUI_CenterMassDlg::CalculateAndDisplayCenterMass()
if( !mySimulationTopoDs.IsNull() ) { if( !mySimulationTopoDs.IsNull() ) {
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
return true ; return true ;
} }
} }

View File

@ -67,7 +67,8 @@ private:
bool CalculateAndDisplayCenterMass() ; bool CalculateAndDisplayCenterMass() ;
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ 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 */ SALOME_Selection* mySelection ; /* User shape selection */
TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */ TopoDS_Shape mySimulationTopoDs; /* Shape used for simulation display */

View File

@ -178,7 +178,8 @@ void MeasureGUI_CheckShape::Init( SALOME_Selection* Sel )
Constructor1->setChecked( TRUE ); Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ; myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel; mySelection = Sel;
myGeomGUI = GEOMBase_Context::GetGeomGUI() ; myGeomBase = new GEOMBase() ;
myGeomGUI = GEOMContext::GetGeomGUI() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
// TODO : previous selection into argument ? // TODO : previous selection into argument ?
@ -203,7 +204,7 @@ void MeasureGUI_CheckShape::Init( SALOME_Selection* Sel )
/* Move widget on the botton right corner of main widget */ /* Move widget on the botton right corner of main widget */
int x, y ; int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ; myGeomBase->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ; this->move( x, y ) ;
this->show() ; /* displays Dialog */ this->show() ; /* displays Dialog */
@ -246,14 +247,14 @@ void MeasureGUI_CheckShape::SelectionIntoArgument()
SelectedName = ""; /* future the name of selection */ SelectedName = ""; /* future the name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, SelectedName) ; int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, SelectedName) ;
if ( nbSel != 1 ) { if ( nbSel != 1 ) {
return ; return ;
} }
/* nbSel == 1 */ /* nbSel == 1 */
TopoDS_Shape S; TopoDS_Shape S;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) if( !myGeomBase->GetTopoFromSelection(mySelection, S) )
return ; return ;
if( S.IsNull() ) { if( S.IsNull() ) {
@ -309,7 +310,7 @@ void MeasureGUI_CheckShape::LineEditReturnPressed()
/* so SelectionIntoArgument() is automatically called. */ /* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ; const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ; QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { if( myGeomBase->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ; myEditCurrentArgument->setText( objectUserName ) ;
} }
return ; return ;

View File

@ -65,7 +65,8 @@ private:
void Check(const TopoDS_Shape S) ; void Check(const TopoDS_Shape S) ;
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ 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 */ SALOME_Selection* mySelection ; /* User shape selection */
int myConstructorId ; /* Current constructor id = radio button id */ int myConstructorId ; /* Current constructor id = radio button id */

View File

@ -207,7 +207,8 @@ void MeasureGUI_DistanceDlg::Init( SALOME_Selection* Sel )
myShape2.Nullify() ; myShape2.Nullify() ;
myConstructorId = 0 ; myConstructorId = 0 ;
myGeomGUI = GEOMBase_Context::GetGeomGUI() ; myGeomGUI = GEOMContext::GetGeomGUI() ;
myGeomBase = new GEOMBase() ;
GroupConstructor1->show(); GroupConstructor1->show();
myConstructorId = 0 ; myConstructorId = 0 ;
@ -240,7 +241,7 @@ void MeasureGUI_DistanceDlg::Init( SALOME_Selection* Sel )
/* Move widget on the botton right corner of main widget */ /* Move widget on the botton right corner of main widget */
int x, y ; int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ; myGeomBase->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ; this->move( x, y ) ;
this->show() ; /* Displays Dialog */ this->show() ; /* Displays Dialog */
@ -256,7 +257,7 @@ void MeasureGUI_DistanceDlg::Init( SALOME_Selection* Sel )
void MeasureGUI_DistanceDlg::ConstructorsClicked(int constructorId) void MeasureGUI_DistanceDlg::ConstructorsClicked(int constructorId)
{ {
EraseDistance(); EraseDistance();
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
switch (constructorId) switch (constructorId)
{ {
@ -293,7 +294,7 @@ void MeasureGUI_DistanceDlg::ClickOnOk()
void MeasureGUI_DistanceDlg::ClickOnApply() void MeasureGUI_DistanceDlg::ClickOnApply()
{ {
EraseDistance() ; EraseDistance() ;
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
myGeomGUI->GetDesktop()->putInfo( tr("") ) ; myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
switch(myConstructorId) switch(myConstructorId)
@ -319,7 +320,7 @@ void MeasureGUI_DistanceDlg::ClickOnApply()
void MeasureGUI_DistanceDlg::ClickOnCancel() void MeasureGUI_DistanceDlg::ClickOnCancel()
{ {
EraseDistance() ; EraseDistance() ;
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
disconnect( mySelection, 0, this, 0 ); disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ; myGeomGUI->ResetState() ;
@ -335,14 +336,14 @@ void MeasureGUI_DistanceDlg::ClickOnCancel()
//================================================================================= //=================================================================================
void MeasureGUI_DistanceDlg::SelectionIntoArgument() void MeasureGUI_DistanceDlg::SelectionIntoArgument()
{ {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
LineEdit_Length->setText("") ; LineEdit_Length->setText("") ;
myEditCurrentArgument->setText("") ; /* by default */ myEditCurrentArgument->setText("") ; /* by default */
QString aString = ""; /* the name of selection */ QString aString = ""; /* the name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel != 1 ) { if ( nbSel != 1 ) {
switch (myConstructorId) switch (myConstructorId)
{ {
@ -365,11 +366,11 @@ void MeasureGUI_DistanceDlg::SelectionIntoArgument()
Standard_Boolean testResult ; Standard_Boolean testResult ;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) if( !myGeomBase->GetTopoFromSelection(mySelection, S) )
return ; return ;
if ( myEditCurrentArgument == LineEditC1A1Shape ) { if ( myEditCurrentArgument == LineEditC1A1Shape ) {
myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; myGeomShape1 = myGeomBase->ConvertIOinGEOMShape(IO, testResult) ;
if( !testResult ) if( !testResult )
return ; return ;
myShape1 = S ; myShape1 = S ;
@ -377,7 +378,7 @@ void MeasureGUI_DistanceDlg::SelectionIntoArgument()
myOkShape1 = true ; myOkShape1 = true ;
} }
else if ( myEditCurrentArgument == LineEditC1A2Shape ) { else if ( myEditCurrentArgument == LineEditC1A2Shape ) {
myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; myGeomShape2 = myGeomBase->ConvertIOinGEOMShape(IO, testResult) ;
if( !testResult ) if( !testResult )
return ; return ;
myShape2 = S ; myShape2 = S ;
@ -437,7 +438,7 @@ void MeasureGUI_DistanceDlg::LineEditReturnPressed()
/* so SelectionIntoArgument() is automatically called. */ /* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ; const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ; QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { if( myGeomBase->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ; myEditCurrentArgument->setText( objectUserName ) ;
} }
return ; return ;
@ -501,7 +502,7 @@ void MeasureGUI_DistanceDlg::ActivateThisDialog()
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
if( !mySimulationTopoDs.IsNull() ) if( !mySimulationTopoDs.IsNull() )
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
return ; return ;
} }
@ -516,7 +517,7 @@ void MeasureGUI_DistanceDlg::MakeDistanceSimulationAndDisplay(const TopoDS_Shape
{ {
LineEdit_Length->setText("") ; LineEdit_Length->setText("") ;
EraseDistance() ; EraseDistance() ;
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
BRepExtrema_DistShapeShape dst( S1, S2 ); BRepExtrema_DistShapeShape dst( S1, S2 );
if (dst.IsDone()) { if (dst.IsDone()) {
@ -530,7 +531,7 @@ void MeasureGUI_DistanceDlg::MakeDistanceSimulationAndDisplay(const TopoDS_Shape
if (Dist<=1.e-9) { if (Dist<=1.e-9) {
BRepBuilderAPI_MakeVertex MakeVertex(P1); BRepBuilderAPI_MakeVertex MakeVertex(P1);
mySimulationTopoDs = MakeVertex.Vertex(); mySimulationTopoDs = MakeVertex.Vertex();
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
LineEdit_Length->setText("0.0") ; LineEdit_Length->setText("0.0") ;
} else { } else {

View File

@ -70,7 +70,8 @@ private:
void EraseDistance() ; void EraseDistance() ;
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ 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 */ SALOME_Selection* mySelection ; /* User shape selection */
TopoDS_Shape myShape1 ; TopoDS_Shape myShape1 ;
TopoDS_Shape myShape2 ; TopoDS_Shape myShape2 ;

View File

@ -280,7 +280,8 @@ void MeasureGUI_InertiaDlg::Init( SALOME_Selection* Sel )
Constructor1->setChecked( TRUE ); Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ; myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel; mySelection = Sel;
myGeomGUI = GEOMBase_Context::GetGeomGUI() ; myGeomBase = new GEOMBase() ;
myGeomGUI = GEOMContext::GetGeomGUI() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
// TODO : previous selection into argument ? // TODO : previous selection into argument ?
@ -304,7 +305,7 @@ void MeasureGUI_InertiaDlg::Init( SALOME_Selection* Sel )
/* Move widget on the botton right corner of main widget */ /* Move widget on the botton right corner of main widget */
int x, y ; int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ; myGeomBase->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ; this->move( x, y ) ;
this->show() ; /* displays Dialog */ this->show() ; /* displays Dialog */
return ; return ;
@ -358,14 +359,14 @@ void MeasureGUI_InertiaDlg::SelectionIntoArgument()
myEditCurrentArgument->setText("") ; myEditCurrentArgument->setText("") ;
QString aString = ""; /* future the name of selection */ QString aString = ""; /* future the name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel != 1 ) { if ( nbSel != 1 ) {
return ; return ;
} }
/* nbSel == 1 */ /* nbSel == 1 */
TopoDS_Shape S; TopoDS_Shape S;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) || S.IsNull() ) if( !myGeomBase->GetTopoFromSelection(mySelection, S) || S.IsNull() )
return ; return ;
LineEditC1A1->setText(aString) ; LineEditC1A1->setText(aString) ;
@ -415,7 +416,7 @@ void MeasureGUI_InertiaDlg::LineEditReturnPressed()
/* so SelectionIntoArgument() is automatically called. */ /* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ; const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ; QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { if( myGeomBase->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ; myEditCurrentArgument->setText( objectUserName ) ;
} }
return ; return ;

View File

@ -67,7 +67,8 @@ public:
void CalculateAndDisplayInertia(const TopoDS_Shape& S) ; void CalculateAndDisplayInertia(const TopoDS_Shape& S) ;
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ 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 ; SALOME_Selection* mySelection ;
int myConstructorId ; /* Current constructor id = radio button id */ int myConstructorId ; /* Current constructor id = radio button id */

View File

@ -252,7 +252,8 @@ void MeasureGUI_MaxToleranceDlg::Init( SALOME_Selection* Sel )
Constructor1->setChecked( TRUE ); Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ; myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel; mySelection = Sel;
myGeomGUI = GEOMBase_Context::GetGeomGUI() ; myGeomGUI = GEOMContext::GetGeomGUI() ;
myGeomBase = new GEOMBase() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
// TODO : previous selection into argument ? // TODO : previous selection into argument ?
@ -275,7 +276,7 @@ void MeasureGUI_MaxToleranceDlg::Init( SALOME_Selection* Sel )
/* Move widget on the botton right corner of main widget */ /* Move widget on the botton right corner of main widget */
int x, y ; int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ; myGeomBase->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ; this->move( x, y ) ;
this->show() ; /* displays Dialog */ this->show() ; /* displays Dialog */
return ; return ;
@ -322,14 +323,14 @@ void MeasureGUI_MaxToleranceDlg::SelectionIntoArgument()
QString aString = ""; /* future the name of selection */ QString aString = ""; /* future the name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel != 1 ) { if ( nbSel != 1 ) {
return ; return ;
} }
/* nbSel == 1 */ /* nbSel == 1 */
TopoDS_Shape S; TopoDS_Shape S;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) if( !myGeomBase->GetTopoFromSelection(mySelection, S) )
return ; return ;
if( S.IsNull() ) { if( S.IsNull() ) {
@ -385,7 +386,7 @@ void MeasureGUI_MaxToleranceDlg::LineEditReturnPressed()
/* so SelectionIntoArgument() is automatically called. */ /* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ; const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ; QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { if( myGeomBase->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ; myEditCurrentArgument->setText( objectUserName ) ;
} }
return ; return ;

View File

@ -64,7 +64,8 @@ private:
void CalculateMaxTolerance(const TopoDS_Shape& S) ; void CalculateMaxTolerance(const TopoDS_Shape& S) ;
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ 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 */ SALOME_Selection* mySelection ; /* User shape selection */
int myConstructorId ; /* Current constructor id = radio button id */ int myConstructorId ; /* Current constructor id = radio button id */

View File

@ -195,7 +195,8 @@ void MeasureGUI_PropertiesDlg::Init( SALOME_Selection* Sel )
Constructor1->setChecked( TRUE ); Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ; myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel; mySelection = Sel;
myGeomGUI = GEOMBase_Context::GetGeomGUI() ; myGeomBase = new GEOMBase() ;
myGeomGUI = GEOMContext::GetGeomGUI() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
// TODO : previous selection into argument ? // TODO : previous selection into argument ?
@ -217,7 +218,7 @@ void MeasureGUI_PropertiesDlg::Init( SALOME_Selection* Sel )
/* Move widget on the botton right corner of main widget */ /* Move widget on the botton right corner of main widget */
int x, y ; int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ; myGeomBase->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ; this->move( x, y ) ;
this->show() ; /* displays Dialog */ this->show() ; /* displays Dialog */
return ; return ;
@ -241,9 +242,9 @@ void MeasureGUI_PropertiesDlg::ConstructorsClicked(int constructorId)
//================================================================================= //=================================================================================
void MeasureGUI_PropertiesDlg::ClickOnCancel() void MeasureGUI_PropertiesDlg::ClickOnCancel()
{ {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
disconnect( mySelection, 0, this, 0 ); disconnect( mySelection, 0, this, 0 );
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
myGeomGUI->ResetState() ; myGeomGUI->ResetState() ;
reject() ; reject() ;
return ; return ;
@ -256,7 +257,7 @@ void MeasureGUI_PropertiesDlg::ClickOnCancel()
//================================================================================= //=================================================================================
void MeasureGUI_PropertiesDlg::SelectionIntoArgument() void MeasureGUI_PropertiesDlg::SelectionIntoArgument()
{ {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
LineEdit_Length->setText("") ; LineEdit_Length->setText("") ;
@ -266,14 +267,14 @@ void MeasureGUI_PropertiesDlg::SelectionIntoArgument()
QString aString = ""; /* future the name of selection */ QString aString = ""; /* future the name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel != 1 ) { if ( nbSel != 1 ) {
return ; return ;
} }
/* nbSel == 1 */ /* nbSel == 1 */
TopoDS_Shape S; TopoDS_Shape S;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) if( !myGeomBase->GetTopoFromSelection(mySelection, S) )
return ; return ;
if( S.IsNull() || S.ShapeType() == TopAbs_VERTEX ) { if( S.IsNull() || S.ShapeType() == TopAbs_VERTEX ) {
@ -284,8 +285,8 @@ void MeasureGUI_PropertiesDlg::SelectionIntoArgument()
LineEditC1A1->setText(aString) ; LineEditC1A1->setText(aString) ;
/* Try to display of a cone simulation shape to show direction of a linear edge only in OCC viewer */ /* Try to display of a cone simulation shape to show direction of a linear edge only in OCC viewer */
if( myGeomGUI->CreateArrowForLinearEdge( S, mySimulationTopoDs ) ) { if( myGeomBase->CreateArrowForLinearEdge( S, mySimulationTopoDs ) ) {
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
} }
this->CalculateAndDisplayProperties(S) ; this->CalculateAndDisplayProperties(S) ;
@ -334,7 +335,7 @@ void MeasureGUI_PropertiesDlg::LineEditReturnPressed()
/* so SelectionIntoArgument() is automatically called. */ /* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ; const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ; QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { if( myGeomBase->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ; myEditCurrentArgument->setText( objectUserName ) ;
} }
return ; return ;
@ -351,7 +352,7 @@ void MeasureGUI_PropertiesDlg::DeactivateActiveDialog()
disconnect( mySelection, 0, this, 0 ); disconnect( mySelection, 0, this, 0 );
GroupConstructors->setEnabled(false) ; GroupConstructors->setEnabled(false) ;
GroupConstructor1->setEnabled(false) ; GroupConstructor1->setEnabled(false) ;
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
GroupButtons->setEnabled(false) ; GroupButtons->setEnabled(false) ;
} }
return ; return ;
@ -372,7 +373,7 @@ void MeasureGUI_PropertiesDlg::ActivateThisDialog()
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
if( !mySimulationTopoDs.IsNull() ) if( !mySimulationTopoDs.IsNull() )
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
return ; return ;
} }

View File

@ -68,7 +68,8 @@ private:
void CalculateAndDisplayProperties(const TopoDS_Shape& S) ; void CalculateAndDisplayProperties(const TopoDS_Shape& S) ;
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ 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 */ SALOME_Selection* mySelection ; /* User shape selection */
TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */ TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */

View File

@ -176,7 +176,8 @@ void MeasureGUI_WhatisDlg::Init( SALOME_Selection* Sel )
Constructor1->setChecked( TRUE ); Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ; myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel; mySelection = Sel;
myGeomGUI = GEOMBase_Context::GetGeomGUI() ; myGeomBase = new GEOMBase() ;
myGeomGUI = GEOMContext::GetGeomGUI() ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
// TODO : previous selection into argument ? // TODO : previous selection into argument ?
@ -201,7 +202,7 @@ void MeasureGUI_WhatisDlg::Init( SALOME_Selection* Sel )
/* Move widget on the botton right corner of main widget */ /* Move widget on the botton right corner of main widget */
int x, y ; int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ; myGeomBase->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ; this->move( x, y ) ;
this->show() ; /* displays Dialog */ this->show() ; /* displays Dialog */
@ -226,7 +227,7 @@ void MeasureGUI_WhatisDlg::ConstructorsClicked(int constructorId)
//================================================================================= //=================================================================================
void MeasureGUI_WhatisDlg::ClickOnCancel() void MeasureGUI_WhatisDlg::ClickOnCancel()
{ {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
disconnect( mySelection, 0, this, 0 ); disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ; myGeomGUI->ResetState() ;
reject() ; reject() ;
@ -240,7 +241,7 @@ void MeasureGUI_WhatisDlg::ClickOnCancel()
//================================================================================= //=================================================================================
void MeasureGUI_WhatisDlg::SelectionIntoArgument() void MeasureGUI_WhatisDlg::SelectionIntoArgument()
{ {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
Text->setText("") ; Text->setText("") ;
@ -248,14 +249,14 @@ void MeasureGUI_WhatisDlg::SelectionIntoArgument()
SelectedName = ""; /* future the name of selection */ SelectedName = ""; /* future the name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, SelectedName) ; int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, SelectedName) ;
if ( nbSel != 1 ) { if ( nbSel != 1 ) {
return ; return ;
} }
/* nbSel == 1 */ /* nbSel == 1 */
TopoDS_Shape S; TopoDS_Shape S;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) if( !myGeomBase->GetTopoFromSelection(mySelection, S) )
return ; return ;
if( S.IsNull() ) { if( S.IsNull() ) {
@ -264,8 +265,8 @@ void MeasureGUI_WhatisDlg::SelectionIntoArgument()
} }
/* Try to display of a cone simulation shape to show direction of a linear edge only in OCC viewer */ /* Try to display of a cone simulation shape to show direction of a linear edge only in OCC viewer */
if( myGeomGUI->CreateArrowForLinearEdge( S, mySimulationTopoDs ) ) { if( myGeomBase->CreateArrowForLinearEdge( S, mySimulationTopoDs ) ) {
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
} }
LineEditC1A1->setText(SelectedName) ; LineEditC1A1->setText(SelectedName) ;
this->CalculateWhatis(S) ; this->CalculateWhatis(S) ;
@ -315,7 +316,7 @@ void MeasureGUI_WhatisDlg::LineEditReturnPressed()
/* so SelectionIntoArgument() is automatically called. */ /* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ; const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ; QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { if( myGeomBase->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ; myEditCurrentArgument->setText( objectUserName ) ;
} }
return ; return ;
@ -332,7 +333,7 @@ void MeasureGUI_WhatisDlg::DeactivateActiveDialog()
disconnect( mySelection, 0, this, 0 ); disconnect( mySelection, 0, this, 0 );
GroupConstructors->setEnabled(false) ; GroupConstructors->setEnabled(false) ;
GroupConstructor1->setEnabled(false) ; GroupConstructor1->setEnabled(false) ;
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
GroupButtons->setEnabled(false) ; GroupButtons->setEnabled(false) ;
} }
return ; return ;
@ -352,7 +353,7 @@ void MeasureGUI_WhatisDlg::ActivateThisDialog()
GroupButtons->setEnabled(true) ; GroupButtons->setEnabled(true) ;
connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); connect( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
if( !mySimulationTopoDs.IsNull() ) if( !mySimulationTopoDs.IsNull() )
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
return ; return ;
} }

View File

@ -68,7 +68,8 @@ private:
void CalculateWhatis(const TopoDS_Shape& S) ; void CalculateWhatis(const TopoDS_Shape& S) ;
GEOM::GEOM_Gen_var myGeom ; /* Current GeomI object */ 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 */ SALOME_Selection* mySelection ; /* User shape selection */
TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */ TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */

View File

@ -35,7 +35,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl
@COMMENCE@ @COMMENCE@
# header files # header files
EXPORT_HEADERS= OperationGUI.h EXPORT_HEADERS=
# Libraries targets # Libraries targets
LIB = libOperationGUI.la LIB = libOperationGUI.la
@ -68,6 +68,6 @@ LIB_SERVER_IDL =
CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome 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 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@ @CONCLUDE@

View File

@ -29,19 +29,21 @@
using namespace std; using namespace std;
#include "OperationGUI.h" #include "OperationGUI.h"
#include "DisplayGUI.h"
#include "QAD_RightFrame.h" #include "QAD_RightFrame.h"
#include "OCCViewer_Viewer3d.h" #include "OCCViewer_Viewer3d.h"
#include "OCCViewer_ViewFrame.h" #include "OCCViewer_ViewFrame.h"
#include "SALOMEGUI_QtCatchCorbaException.hxx"
#include <TopExp_Explorer.hxx> #include <TopExp_Explorer.hxx>
#include <Precision.hxx>
#include "OperationGUI_PartitionDlg.h" // Method PARTITION #include "OperationGUI_PartitionDlg.h" // Method PARTITION
#include "OperationGUI_ArchimedeDlg.h" // Method ARCHIMEDE #include "OperationGUI_ArchimedeDlg.h" // Method ARCHIMEDE
#include "OperationGUI_FilletDlg.h" // Method FILLET #include "OperationGUI_FilletDlg.h" // Method FILLET
#include "OperationGUI_ChamferDlg.h" // Method CHAMFER #include "OperationGUI_ChamferDlg.h" // Method CHAMFER
static OperationGUI* myOperationGUI = 0;
//======================================================================= //=======================================================================
// function : OperationGUI() // function : OperationGUI()
// purpose : Constructor // purpose : Constructor
@ -49,9 +51,11 @@ static OperationGUI* myOperationGUI = 0;
OperationGUI::OperationGUI() : OperationGUI::OperationGUI() :
QObject() QObject()
{ {
myGeomGUI = GEOMBase_Context::GetGeomGUI(); myGeomBase = new GEOMBase();
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); myGeomGUI = GEOMContext::GetGeomGUI();
myGeom = GEOM::GEOM_Gen::_narrow(comp); // Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
// myGeom = GEOM::GEOM_Gen::_narrow(comp);
myGeom = myGeomGUI->myComponentGeom;
} }
@ -64,25 +68,13 @@ OperationGUI::~OperationGUI()
} }
//=======================================================================
// function : GetOrCreateGUI()
// purpose : Gets or create an object 'GUI' with initialisations
// : Returns 'GUI' as a pointer
//=======================================================================
OperationGUI* OperationGUI::GetOrCreateGUI()
{
myOperationGUI = new OperationGUI();
return myOperationGUI;
}
//======================================================================= //=======================================================================
// function : OnGUIEvent() // function : OnGUIEvent()
// purpose : // purpose :
//======================================================================= //=======================================================================
bool OperationGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) bool OperationGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
{ {
OperationGUI::GetOrCreateGUI(); OperationGUI* myOperationGUI = new OperationGUI();
myOperationGUI->myGeomGUI->EmitSignalDeactivateDialog(); myOperationGUI->myGeomGUI->EmitSignalDeactivateDialog();
SALOME_Selection* Sel = SALOME_Selection::Selection(myOperationGUI->myGeomGUI->GetActiveStudy()->getSelection()); SALOME_Selection* Sel = SALOME_Selection::Selection(myOperationGUI->myGeomGUI->GetActiveStudy()->getSelection());
@ -147,7 +139,7 @@ void OperationGUI::MakePartitionAndDisplay(const GEOM::GEOM_Gen::ListOfIOR& list
return; return;
} }
result->NameType(tr("GEOM_PARTITION")); result->NameType(tr("GEOM_PARTITION"));
if(myGeomGUI->Display(result)) if(myGeomBase->Display(result))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
return; return;
} }
@ -171,7 +163,7 @@ void OperationGUI::Archimede(const Handle(SALOME_InteractiveObject)& IO, const d
GEOM::GEOM_Shape_var Result = myGeom->Archimede(Shape, aWeight, aWaterDensity, aMeshingDeflection); GEOM::GEOM_Shape_var Result = myGeom->Archimede(Shape, aWeight, aWaterDensity, aMeshingDeflection);
Result->NameType(tr("GEOM_PLANE")); Result->NameType(tr("GEOM_PLANE"));
if(myGeomGUI->Display(Result)) { if(myGeomBase->Display(Result)) {
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
} }
return; return;
@ -187,7 +179,7 @@ void OperationGUI::Archimede(const Handle(SALOME_InteractiveObject)& IO, const d
GEOM::GEOM_Shape_var Shape = myGeom->GetIORFromString(anIOR->Value()); GEOM::GEOM_Shape_var Shape = myGeom->GetIORFromString(anIOR->Value());
GEOM::GEOM_Shape_var Result = myGeom->Archimede(Shape, aWeight, aWaterDensity, aMeshingDeflection); GEOM::GEOM_Shape_var Result = myGeom->Archimede(Shape, aWeight, aWaterDensity, aMeshingDeflection);
Result->NameType(tr("GEOM_PLANE")); Result->NameType(tr("GEOM_PLANE"));
if (myGeomGUI->Display(Result)) { if (myGeomBase->Display(Result)) {
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
} }
} }
@ -229,10 +221,10 @@ bool OperationGUI::OnFilletGetAll(const TopoDS_Shape& ShapeTopo, const double Ra
} }
TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result); TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result);
Standard_CString type; Standard_CString type;
myGeomGUI->GetShapeTypeString(S,type); myGeomBase->GetShapeTypeString(S,type);
result->NameType(type); result->NameType(type);
if(myGeomGUI->Display(result)) if(myGeomBase->Display(result))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
} }
catch (const SALOME::SALOME_Exception& S_ex) { catch (const SALOME::SALOME_Exception& S_ex) {
@ -276,7 +268,7 @@ bool OperationGUI::OnFilletGetSelected(const TopoDS_Shape& ShapeTopo, const char
while(Exp.More()) { while(Exp.More()) {
if(M.Add(Exp.Current())) { /* if a new edge : do not add doublons indices */ if(M.Add(Exp.Current())) { /* if a new edge : do not add doublons indices */
ListOfID->length(i + 1); 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++; i++;
} }
Exp.Next(); Exp.Next();
@ -284,7 +276,7 @@ bool OperationGUI::OnFilletGetSelected(const TopoDS_Shape& ShapeTopo, const char
} }
else { else {
ListOfID->length(i + 1); ListOfID->length(i + 1);
ListOfID[i] = myGeomGUI->GetIndex(ic->SelectedShape(), ShapeTopo, SubShapeType); ListOfID[i] = myGeomBase->GetIndex(ic->SelectedShape(), ShapeTopo, SubShapeType);
i++; i++;
} }
ic->NextSelected(); ic->NextSelected();
@ -301,10 +293,10 @@ bool OperationGUI::OnFilletGetSelected(const TopoDS_Shape& ShapeTopo, const char
TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, aResult); TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, aResult);
Standard_CString type; Standard_CString type;
myGeomGUI->GetShapeTypeString(S,type); myGeomBase->GetShapeTypeString(S,type);
aResult->NameType(type); aResult->NameType(type);
if(myGeomGUI->Display(aResult)) if(myGeomBase->Display(aResult))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
} }
catch(const SALOME::SALOME_Exception& S_ex) { catch(const SALOME::SALOME_Exception& S_ex) {
@ -317,7 +309,7 @@ bool OperationGUI::OnFilletGetSelected(const TopoDS_Shape& ShapeTopo, const char
myUseLocalContext = false; myUseLocalContext = false;
} }
GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); DisplayGUI* myDisplayGUI = new DisplayGUI();
myDisplayGUI->OnDisplayAll(true) ; myDisplayGUI->OnDisplayAll(true) ;
myGeomGUI->GetActiveStudy()->updateObjBrowser(); myGeomGUI->GetActiveStudy()->updateObjBrowser();
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_READY")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_READY"));
@ -357,10 +349,10 @@ bool OperationGUI::OnChamferGetAll(const TopoDS_Shape& ShapeTopo, const double D
TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result); TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result);
Standard_CString type; Standard_CString type;
myGeomGUI->GetShapeTypeString(S,type); myGeomBase->GetShapeTypeString(S,type);
result->NameType(type); result->NameType(type);
if(myGeomGUI->Display(result)) if(myGeomBase->Display(result))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
} }
catch (const SALOME::SALOME_Exception& S_ex) { catch (const SALOME::SALOME_Exception& S_ex) {
@ -404,7 +396,7 @@ bool OperationGUI::OnChamferGetSelected(const TopoDS_Shape& ShapeTopo, const cha
while(Exp.More()) { while(Exp.More()) {
if(M.Add(Exp.Current())) { /* if a new edge : do not add doublons indices */ if(M.Add(Exp.Current())) { /* if a new edge : do not add doublons indices */
ListOfID->length(i + 1); 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++; i++;
} }
Exp.Next(); Exp.Next();
@ -412,7 +404,7 @@ bool OperationGUI::OnChamferGetSelected(const TopoDS_Shape& ShapeTopo, const cha
} }
else { else {
ListOfID->length(i + 1); ListOfID->length(i + 1);
ListOfID[i] = myGeomGUI->GetIndex(ic->SelectedShape(), ShapeTopo, SubShapeType); ListOfID[i] = myGeomBase->GetIndex(ic->SelectedShape(), ShapeTopo, SubShapeType);
i++; i++;
} }
ic->NextSelected(); ic->NextSelected();
@ -429,10 +421,10 @@ bool OperationGUI::OnChamferGetSelected(const TopoDS_Shape& ShapeTopo, const cha
TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, aResult); TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, aResult);
Standard_CString type; Standard_CString type;
myGeomGUI->GetShapeTypeString(S,type); myGeomBase->GetShapeTypeString(S,type);
aResult->NameType(type); aResult->NameType(type);
if(myGeomGUI->Display(aResult)) if(myGeomBase->Display(aResult))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
} }
catch(const SALOME::SALOME_Exception& S_ex) { catch(const SALOME::SALOME_Exception& S_ex) {
@ -445,7 +437,7 @@ bool OperationGUI::OnChamferGetSelected(const TopoDS_Shape& ShapeTopo, const cha
myUseLocalContext = false; myUseLocalContext = false;
} }
GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); DisplayGUI* myDisplayGUI = new DisplayGUI();
myDisplayGUI->OnDisplayAll(true) ; myDisplayGUI->OnDisplayAll(true) ;
myGeomGUI->GetActiveStudy()->updateObjBrowser(); myGeomGUI->GetActiveStudy()->updateObjBrowser();
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_READY")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_READY"));

View File

@ -29,7 +29,7 @@
#ifndef OPERATIONGUI_H #ifndef OPERATIONGUI_H
#define OPERATIONGUI_H #define OPERATIONGUI_H
#include "GEOMBase_Display.h" #include "GEOMBase.h"
//================================================================================= //=================================================================================
// class : OperationGUI // class : OperationGUI
@ -43,7 +43,6 @@ public :
OperationGUI(); OperationGUI();
~OperationGUI(); ~OperationGUI();
static OperationGUI* GetOrCreateGUI();
static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
void MakePartitionAndDisplay(const GEOM::GEOM_Gen::ListOfIOR& listShapesIOR, void MakePartitionAndDisplay(const GEOM::GEOM_Gen::ListOfIOR& listShapesIOR,
@ -70,7 +69,8 @@ public :
Standard_Integer& aLocalContextId, Standard_Integer& aLocalContextId,
bool& myUseLocalContext); bool& myUseLocalContext);
GEOMBase_Context* myGeomGUI; GEOMBase* myGeomBase;
GEOMContext* myGeomGUI;
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
}; };

View File

@ -29,23 +29,7 @@
using namespace std; using namespace std;
#include "OperationGUI_ArchimedeDlg.h" #include "OperationGUI_ArchimedeDlg.h"
#include "QAD_Tools.h" #include "QAD_Config.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>
//================================================================================= //=================================================================================
// class : OperationGUI_ArchimedeDlg() // class : OperationGUI_ArchimedeDlg()
@ -54,143 +38,34 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
OperationGUI_ArchimedeDlg::OperationGUI_ArchimedeDlg( QWidget* parent, const char* name, OperationGUI* theOperationGUI, SALOME_Selection* Sel, bool modal, WFlags fl ) 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 ) :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 image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_ARCHIMEDE")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
if ( !name ) setCaption(tr("GEOM_ARCHIMEDE_TITLE"));
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->setTitle( tr( "GEOM_ARCHIMEDE" ) ); RadioButton1->setPixmap(image0);
GroupConstructors->setExclusive( TRUE ); RadioButton2->close(TRUE);
GroupConstructors->setColumnLayout(0, Qt::Vertical ); RadioButton3->close(TRUE);
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 );
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);
/***************************************************************/ /***************************************************************/
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" ); /* Initialisations */
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 );
/***************************************************************/
myOperationGUI = theOperationGUI; myOperationGUI = theOperationGUI;
Init(Sel) ; /* Initialisations */ Init();
/* Move widget on the botton right corner of main widget */
QAD_Tools::alignWidget(this, parent, AlignBottom | AlignRight);
/* Display Dialog */
this->show() ;
} }
@ -208,70 +83,51 @@ OperationGUI_ArchimedeDlg::~OperationGUI_ArchimedeDlg()
// function : Init() // function : Init()
// purpose : // purpose :
//================================================================================= //=================================================================================
void OperationGUI_ArchimedeDlg::Init( SALOME_Selection* Sel ) void OperationGUI_ArchimedeDlg::Init()
{ {
LineEditC1A2->setMaxLength( 10 ); /* init variables */
LineEditC1A3->setMaxLength( 10 ); myEditCurrentArgument = GroupPoints->LineEdit1;
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(); myWeight = 100.0;
myConstructorId = 0 ; myWaterDensity = 1.0;
Constructor1->setChecked( TRUE ); myMeshingDeflection = 0.01;
myEditCurrentArgument = LineEditC1A1 ; myOkIO = false;
mySelection = Sel;
this->myWeight = 100.0 ; /* Get setting of step value from file configuration */
LineEditC1A2->setText("100.0") ; QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep");
this->myWaterDensity = 1.0 ; step = St.toDouble();
LineEditC1A3->setText("1.0") ;
this->myMeshingDeflection = 0.01 ;
LineEditC1A4->setText("0.01") ;
myOkWeight = myOkWaterDensity = myOkMeshingDeflection = true ; /* min, max, step and decimals for spin boxes & initial values */
myOkIO = false ; 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);
myGeomGUI = GEOMBase_Context::GetGeomGUI() ; GroupPoints->SpinBox_DX->SetValue(myWeight);
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; GroupPoints->SpinBox_DY->SetValue(myWaterDensity);
GroupPoints->SpinBox_DZ->SetValue(myMeshingDeflection);
/* Filter definitions */
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
myGeom = GEOM::GEOM_Gen::_narrow(comp);
/* signals and slots connections */ /* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect( LineEditC1A2, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ; connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect( LineEditC1A3, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ; connect(GroupPoints->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect( LineEditC1A4, SIGNAL (textChanged(const QString&) ), this, SLOT( TextChangedInLineEdit(const QString&) ) ) ; connect(GroupPoints->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
connect( myGeomGUI, SIGNAL ( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) ) ; connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double)));
/* to close dialog if study change */ connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DY, SLOT(SetStep(double)));
connect( myGeomGUI, SIGNAL ( SignalCloseAllDialogs() ), this, SLOT( ClickOnCancel() ) ) ; connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DZ, SLOT(SetStep(double)));
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
return ; connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
}
/* displays Dialog */
GroupPoints->show();
this->show();
return;
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void OperationGUI_ArchimedeDlg::ConstructorsClicked(int constructorId)
{
return ;
} }
@ -281,10 +137,9 @@ void OperationGUI_ArchimedeDlg::ConstructorsClicked(int constructorId)
//================================================================================= //=================================================================================
void OperationGUI_ArchimedeDlg::ClickOnOk() void OperationGUI_ArchimedeDlg::ClickOnOk()
{ {
this->ClickOnApply() ; this->ClickOnApply();
this->ClickOnCancel() ; ClickOnCancel();
return;
return ;
} }
@ -294,30 +149,10 @@ void OperationGUI_ArchimedeDlg::ClickOnOk()
//================================================================================= //=================================================================================
void OperationGUI_ArchimedeDlg::ClickOnApply() void OperationGUI_ArchimedeDlg::ClickOnApply()
{ {
switch(myConstructorId) myGeomGUI->GetDesktop()->putInfo(tr(""));
{ if(myOkIO)
case 0 : myOperationGUI->Archimede(myIO, myWeight, myWaterDensity, myMeshingDeflection);
{ return;
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 ;
} }
@ -327,20 +162,37 @@ void OperationGUI_ArchimedeDlg::ClickOnCancel()
//================================================================================= //=================================================================================
void OperationGUI_ArchimedeDlg::SelectionIntoArgument() void OperationGUI_ArchimedeDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText("") ; myEditCurrentArgument->setText("");
QString aString = ""; QString aString = ""; /* name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
if ( nbSel != 1 ) { if (nbSel != 1) {
myEditCurrentArgument->setText("") ; myOkIO = false;
myOkIO = false ; return;
} }
else { else {
myEditCurrentArgument->setText(aString) ; myEditCurrentArgument->setText(aString);
myIO = mySelection->firstIObject(); myIO = mySelection->firstIObject();
myOkIO = true ; myOkIO = true;
} }
return ; return;
}
//=================================================================================
// function : LineEditReturnPressed()
// purpose :
//=================================================================================
void OperationGUI_ArchimedeDlg::LineEditReturnPressed()
{
QLineEdit* send = (QLineEdit*)sender();
if(send == GroupPoints->LineEdit1)
myEditCurrentArgument = GroupPoints->LineEdit1;
else
return;
GEOMBase_Skeleton::LineEditReturnPressed();
return;
} }
@ -351,76 +203,14 @@ void OperationGUI_ArchimedeDlg::SelectionIntoArgument()
void OperationGUI_ArchimedeDlg::SetEditCurrentArgument() void OperationGUI_ArchimedeDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
switch (myConstructorId)
{
case 0: /* default constructor */
{
if(send == SelectButtonC1A1) {
LineEditC1A1->setFocus() ;
myEditCurrentArgument = LineEditC1A1;
}
SelectionIntoArgument() ;
break;
}
}
return ;
}
if(send == GroupPoints->PushButton1) {
//================================================================================= GroupPoints->LineEdit1->setFocus();
// function : TextChangedInLineEdit() myEditCurrentArgument = GroupPoints->LineEdit1;
// purpose : this->SelectionIntoArgument();
//=================================================================================
void OperationGUI_ArchimedeDlg::TextChangedInLineEdit(const QString& newText)
{
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 ; return;
}
//=================================================================================
// function : DeactivateActiveDialog()
// purpose :
//=================================================================================
void OperationGUI_ArchimedeDlg::DeactivateActiveDialog()
{
if ( GroupConstructors->isEnabled() ) {
GroupConstructors->setEnabled(false) ;
GroupC1->setEnabled(false) ;
GroupButtons->setEnabled(false) ;
}
return ;
} }
@ -430,12 +220,9 @@ void OperationGUI_ArchimedeDlg::DeactivateActiveDialog()
//================================================================================= //=================================================================================
void OperationGUI_ArchimedeDlg::ActivateThisDialog() void OperationGUI_ArchimedeDlg::ActivateThisDialog()
{ {
/* Emit a signal to deactivate the active dialog */ GEOMBase_Skeleton::ActivateThisDialog();
myGeomGUI->EmitSignalDeactivateDialog() ; connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
GroupConstructors->setEnabled(true) ; return;
GroupC1->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
return ;
} }
@ -445,22 +232,27 @@ void OperationGUI_ArchimedeDlg::ActivateThisDialog()
//================================================================================= //=================================================================================
void OperationGUI_ArchimedeDlg::enterEvent(QEvent* e) void OperationGUI_ArchimedeDlg::enterEvent(QEvent* e)
{ {
if ( GroupConstructors->isEnabled() ) if(GroupConstructors->isEnabled())
return ; return;
ActivateThisDialog() ; this->ActivateThisDialog();
return ; return;
} }
//================================================================================= //=================================================================================
// function : closeEvent() // function : ValueChangedInSpinBox()
// purpose : // purpose :
//================================================================================= //=================================================================================
void OperationGUI_ArchimedeDlg::closeEvent( QCloseEvent* e ) void OperationGUI_ArchimedeDlg::ValueChangedInSpinBox(double newValue)
{ {
/* same than click on cancel button */ QObject* send = (QObject*)sender();
this->ClickOnCancel() ;
return ; if(send == GroupPoints->SpinBox_DX)
myWeight = newValue;
else if(send == GroupPoints->SpinBox_DY)
myWaterDensity = newValue;
else if(send == GroupPoints->SpinBox_DZ)
myMeshingDeflection = newValue;
return;
} }

View File

@ -29,97 +29,50 @@
#ifndef DIALOGBOX_ARCHIMEDE_H #ifndef DIALOGBOX_ARCHIMEDE_H
#define DIALOGBOX_ARCHIMEDE_H #define DIALOGBOX_ARCHIMEDE_H
#include "GEOMBase_Skeleton.h"
#include "DlgRef_1Sel3Spin.h"
#include "OperationGUI.h" #include "OperationGUI.h"
#include <qvariant.h> //#include "SALOME_InteractiveObject.hxx"
#include <qdialog.h>
#include <qvalidator.h>
class QVBoxLayout;
class QHBoxLayout;
class QGridLayout;
class QButtonGroup;
class QGroupBox;
class QLabel;
class QLineEdit;
class QPushButton;
class QRadioButton;
//================================================================================= //=================================================================================
// class : OperationGUI_ArchimedeDlg // class : OperationGUI_ArchimedeDlg
// purpose : // purpose :
//================================================================================= //=================================================================================
class OperationGUI_ArchimedeDlg : public QDialog class OperationGUI_ArchimedeDlg : public GEOMBase_Skeleton
{ {
Q_OBJECT Q_OBJECT
public: 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(); ~OperationGUI_ArchimedeDlg();
private: private:
void Init();
void enterEvent(QEvent* e);
double step;
OperationGUI* myOperationGUI; 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 */ Handle(SALOME_InteractiveObject) myIO;
GEOMBase_Context* myGeomGUI ; /* Current GeomGUI object */ Standard_Real myWeight;
SALOME_Selection* mySelection ; /* User shape selection */ Standard_Real myWaterDensity;
Standard_Real myMeshingDeflection;
bool myOkIO;
Handle(SALOME_InteractiveObject) myIO ; DlgRef_1Sel3Spin* GroupPoints;
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 */
QDoubleValidator *myVa ; /* Double validator for numeric input */
QDoubleValidator *myVb ; /* Double validator for numeric input */
QDoubleValidator *myVc ; /* Double validator for numeric input */
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;
private slots: private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk(); void ClickOnOk();
void ClickOnCancel();
void ClickOnApply(); void ClickOnApply();
void SetEditCurrentArgument() ; void ActivateThisDialog();
void TextChangedInLineEdit(const QString&) ; void LineEditReturnPressed();
void SelectionIntoArgument() ; void SelectionIntoArgument();
void DeactivateActiveDialog() ; void SetEditCurrentArgument();
void ActivateThisDialog() ; void ValueChangedInSpinBox(double newValue);
protected:
QGridLayout* OperationGUI_ArchimedeDlgLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupC1Layout;
}; };
#endif // DIALOGBOX_ARCHIMEDE_H #endif // DIALOGBOX_ARCHIMEDE_H

File diff suppressed because it is too large Load Diff

View File

@ -29,144 +29,67 @@
#ifndef DIALOGBOX_CHAMFER_H #ifndef DIALOGBOX_CHAMFER_H
#define DIALOGBOX_CHAMFER_H #define DIALOGBOX_CHAMFER_H
#include "GEOMBase_Skeleton.h"
#include "DlgRef_1Sel2Spin.h"
#include "OperationGUI.h" #include "OperationGUI.h"
#include "DlgRef_SpinBox.h"
// Qt Includes
#include <qvariant.h>
#include <qdialog.h>
#include <qvalidator.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;
//================================================================================= //=================================================================================
// class : OperationGUI_ChamferDlg // class : OperationGUI_ChamferDlg
// purpose : // purpose :
//================================================================================= //=================================================================================
class OperationGUI_ChamferDlg : public QDialog class OperationGUI_ChamferDlg : public GEOMBase_Skeleton
{ {
Q_OBJECT Q_OBJECT
public: public:
OperationGUI_ChamferDlg( QWidget* parent = 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);
const char* name = 0,
OperationGUI* theOperationGUI = 0,
SALOME_Selection* Sel = 0,
Handle (AIS_InteractiveContext) ic = 0,
bool modal = FALSE,
WFlags fl = 0 );
~OperationGUI_ChamferDlg(); ~OperationGUI_ChamferDlg();
private : private :
OperationGUI* myOperationGUI; void Init(Handle(AIS_InteractiveContext) ic);
void Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) ; void enterEvent(QEvent* e);
void closeEvent( QCloseEvent* e ) ; void closeEvent(QCloseEvent* e);
void enterEvent( QEvent* e); void MakeFilletSimulationAndDisplay();
void ResetStateOfDialog() ;
/* Interactive and local context management see also : bool myUseLocalContext() */ void ResetStateOfDialog();
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 MakePreview(); void MakePreview();
bool myOkD1 ; OperationGUI* myOperationGUI;
double myD1 ;
bool myOkD2 ;
double myD2 ;
QButtonGroup* GroupConstructors; double step;
int myConstructorId; /* Current constructor id = radio button id */
QRadioButton* Constructor1; /* Interactive and local context management see also : bool myUseLocalContext() */
QRadioButton* Constructor2; Handle(AIS_InteractiveContext) myIC; /* Interactive context */
QRadioButton* Constructor3; Standard_Integer myLocalContextId; /* identify a local context used by this method */
bool myUseLocalContext; /* true when this method as opened a local context */
QGroupBox* GroupButtons; TopoDS_Shape myShape;
QPushButton* buttonOk; bool myOkShape;
QPushButton* buttonCancel; char* myShapeIOR;
QPushButton* buttonApply; int myShapeType;
bool myOkD1;
double myD1;
bool myOkD2;
double myD2;
QGroupBox* GroupC1; DlgRef_1Sel2Spin* Group1;
QPushButton* SelectButtonC1A1; DlgRef_1Sel2Spin* Group2;
QLineEdit* LineEditC1A1; DlgRef_1Sel2Spin* Group3;
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;
private slots: private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk(); void ClickOnOk();
void ClickOnCancel();
void ClickOnApply(); void ClickOnApply();
void SetEditCurrentArgument() ; void ClickOnCancel();
void SelectionIntoArgument() ; void ActivateThisDialog();
void LineEditReturnPressed() ; void DeactivateActiveDialog();
void DeactivateActiveDialog() ; void LineEditReturnPressed();
void ActivateThisDialog() ; void SelectionIntoArgument();
void ValueChangedInSpinBox( double newValue ) ; void SetEditCurrentArgument();
void ValueChangedInSpinBox(double newValue);
void ConstructorsClicked(int constructorId);
protected:
QGridLayout* OperationGUI_ChamferDlgLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupC1Layout;
QGridLayout* GroupC2Layout;
QGridLayout* GroupC3Layout;
}; };
#endif // DIALOGBOX_CHAMFER_H #endif // DIALOGBOX_CHAMFER_H

File diff suppressed because it is too large Load Diff

View File

@ -29,134 +29,65 @@
#ifndef DIALOGBOX_FILLET_H #ifndef DIALOGBOX_FILLET_H
#define DIALOGBOX_FILLET_H #define DIALOGBOX_FILLET_H
#include "GEOMBase_Skeleton.h"
#include "DlgRef_1Sel1Spin.h"
#include "OperationGUI.h" #include "OperationGUI.h"
#include "DlgRef_SpinBox.h"
// Qt Includes
#include <qvariant.h>
#include <qdialog.h>
#include <qvalidator.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_FilletDlg // class : OperationGUI_FilletDlg
// purpose : // purpose :
//================================================================================= //=================================================================================
class OperationGUI_FilletDlg : public QDialog class OperationGUI_FilletDlg : public GEOMBase_Skeleton
{ {
Q_OBJECT Q_OBJECT
public: public:
OperationGUI_FilletDlg( QWidget* parent = 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);
const char* name = 0,
OperationGUI* theOperationGUI = 0,
SALOME_Selection* Sel = 0,
Handle (AIS_InteractiveContext) ic = 0,
bool modal = FALSE,
WFlags fl = 0 );
~OperationGUI_FilletDlg(); ~OperationGUI_FilletDlg();
private : private :
OperationGUI* myOperationGUI; void Init(Handle(AIS_InteractiveContext) ic);
void Init( SALOME_Selection* Sel, Handle (AIS_InteractiveContext) ic ) ; void enterEvent(QEvent* e);
void closeEvent( QCloseEvent* e ) ; void closeEvent(QCloseEvent* e);
void enterEvent( QEvent* e); void MakeFilletSimulationAndDisplay();
void ResetStateOfDialog() ;
/* Interactive and local context management see also : bool myUseLocalContext() */ void ResetStateOfDialog();
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 */
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 MakePreview(); void MakePreview();
TopoDS_Shape myShape ; OperationGUI* myOperationGUI;
bool myOkShape ;
char* myShapeIOR ;
QLineEdit* myEditCurrentArgument; /* Current LineEdit */ double step;
int myConstructorId ; /* Current constructor id = radio button id */ int myConstructorId; /* Current constructor id = radio button id */
int myShapeType ;
bool myOkRadius ; /* Interactive and local context management see also : bool myUseLocalContext() */
double myRadius ; 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 */
QButtonGroup* GroupConstructors; TopoDS_Shape myShape;
bool myOkShape;
char* myShapeIOR;
int myShapeType;
bool myOkRadius;
double myRadius;
QRadioButton* Constructor1; DlgRef_1Sel1Spin* Group1;
QRadioButton* Constructor2; DlgRef_1Sel1Spin* Group2;
QRadioButton* Constructor3; DlgRef_1Sel1Spin* Group3;
QGroupBox* GroupButtons;
QPushButton* buttonOk;
QPushButton* buttonCancel;
QPushButton* buttonApply;
QGroupBox* GroupC1;
QPushButton* SelectButtonC1A1;
QLineEdit* LineEditC1A1;
QLabel* TextLabelC1A1;
DlgRef_SpinBox* SpinBox_C1A2 ;
QLabel* TextLabelC1A2;
QGroupBox* GroupC2;
QPushButton* SelectButtonC2A1;
QLineEdit* LineEditC2A1;
QLabel* TextLabelC2A1;
DlgRef_SpinBox* SpinBox_C2A2 ;
QLabel* TextLabelC2A2;
QGroupBox* GroupC3;
QPushButton* SelectButtonC3A1;
QLineEdit* LineEditC3A1;
QLabel* TextLabelC3A1;
DlgRef_SpinBox* SpinBox_C3A2 ;
QLabel* TextLabelC3A2;
private slots: private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk(); void ClickOnOk();
void ClickOnCancel();
void ClickOnApply(); void ClickOnApply();
void SetEditCurrentArgument() ; void ClickOnCancel();
void SelectionIntoArgument() ; void ActivateThisDialog();
void DeactivateActiveDialog() ; void DeactivateActiveDialog();
void LineEditReturnPressed() ; void LineEditReturnPressed();
void ActivateThisDialog() ; void SelectionIntoArgument();
void ValueChangedInSpinBox( double newValue ) ; void SetEditCurrentArgument();
void ValueChangedInSpinBox(double newValue);
void ConstructorsClicked(int constructorId);
protected:
QGridLayout* OperationGUI_FilletDlgLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupC1Layout;
QGridLayout* GroupC2Layout;
QGridLayout* GroupC3Layout;
}; };
#endif // DIALOGBOX_FILLET_H #endif // DIALOGBOX_FILLET_H

View File

@ -222,7 +222,8 @@ void OperationGUI_PartitionDlg::Init( SALOME_Selection* Sel )
{ {
myEditCurrentArgument = LineEditC1A1 ; myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel; mySelection = Sel;
myGeomGUI = GEOMBase_Context::GetGeomGUI() ; myGeomBase = new GEOMBase() ;
myGeomGUI = GEOMContext::GetGeomGUI() ;
myOkListShapes = myOkListTools = myOkKeepShape = myOkRemoveShape = false ; myOkListShapes = myOkListTools = myOkKeepShape = myOkRemoveShape = false ;
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
@ -269,7 +270,7 @@ void OperationGUI_PartitionDlg::Init( SALOME_Selection* Sel )
/* Move widget on the botton right corner of main widget */ /* Move widget on the botton right corner of main widget */
int x, y ; int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ; myGeomBase->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ; this->move( x, y ) ;
this->show() ; /* displays Dialog */ this->show() ; /* displays Dialog */
@ -327,7 +328,7 @@ void OperationGUI_PartitionDlg::ClickOnApply()
//================================================================================= //=================================================================================
void OperationGUI_PartitionDlg::ClickOnCancel() void OperationGUI_PartitionDlg::ClickOnCancel()
{ {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
disconnect( mySelection, 0, this, 0 ); disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ; myGeomGUI->ResetState() ;
reject() ; reject() ;
@ -352,7 +353,7 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText("") ; myEditCurrentArgument->setText("") ;
QString aString = ""; /* name of selection */ QString aString = ""; /* name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel < 1 ) { if ( nbSel < 1 ) {
if ( myEditCurrentArgument == LineEditC1A1 ) { if ( myEditCurrentArgument == LineEditC1A1 ) {
@ -371,22 +372,22 @@ void OperationGUI_PartitionDlg::SelectionIntoArgument()
} }
if ( myEditCurrentArgument == LineEditC1A1 ) { if ( myEditCurrentArgument == LineEditC1A1 ) {
myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes) ; myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes) ;
myEditCurrentArgument->setText(aString) ; myEditCurrentArgument->setText(aString) ;
myOkListShapes = true ; myOkListShapes = true ;
} }
else if ( myEditCurrentArgument == LineEditC1A2 ) { else if ( myEditCurrentArgument == LineEditC1A2 ) {
myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListTools) ; myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListTools) ;
myEditCurrentArgument->setText(aString) ; myEditCurrentArgument->setText(aString) ;
myOkListTools = true ; myOkListTools = true ;
} }
else if ( myEditCurrentArgument == LineEditC2A1 ) { else if ( myEditCurrentArgument == LineEditC2A1 ) {
myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListRemoveInside) ; myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListRemoveInside) ;
myEditCurrentArgument->setText(aString) ; myEditCurrentArgument->setText(aString) ;
myOkKeepShape = true ; myOkKeepShape = true ;
} }
else if ( myEditCurrentArgument == LineEditC2A2 ) { else if ( myEditCurrentArgument == LineEditC2A2 ) {
myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListKeepInside) ; myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListKeepInside) ;
myEditCurrentArgument->setText(aString) ; myEditCurrentArgument->setText(aString) ;
myOkRemoveShape = true ; myOkRemoveShape = true ;
} }
@ -447,7 +448,7 @@ void OperationGUI_PartitionDlg::LineEditReturnPressed()
/* so SelectionIntoArgument() is automatically called. */ /* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ; const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ; QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { if( myGeomBase->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ; myEditCurrentArgument->setText( objectUserName ) ;
} }
return ; return ;

View File

@ -61,7 +61,8 @@ private:
void enterEvent ( QEvent * ) ; /* Mouse enter the QWidget */ void enterEvent ( QEvent * ) ; /* Mouse enter the QWidget */
GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ 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 */ SALOME_Selection* mySelection ; /* User shape selection */
GEOM::GEOM_Gen::ListOfIOR myListShapes ; GEOM::GEOM_Gen::ListOfIOR myListShapes ;

View File

@ -35,7 +35,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl
@COMMENCE@ @COMMENCE@
# header files # header files
EXPORT_HEADERS= PrimitiveGUI.h EXPORT_HEADERS=
# Libraries targets # Libraries targets
LIB = libPrimitiveGUI.la LIB = libPrimitiveGUI.la
@ -70,6 +70,6 @@ LIB_SERVER_IDL =
CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome 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 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@ @CONCLUDE@

View File

@ -29,14 +29,15 @@
using namespace std; using namespace std;
#include "PrimitiveGUI.h" #include "PrimitiveGUI.h"
#include "SALOMEGUI_QtCatchCorbaException.hxx"
#include <Precision.hxx>
#include "PrimitiveGUI_BoxDlg.h" // Method BOX #include "PrimitiveGUI_BoxDlg.h" // Method BOX
#include "PrimitiveGUI_CylinderDlg.h" // Method CYLINDER #include "PrimitiveGUI_CylinderDlg.h" // Method CYLINDER
#include "PrimitiveGUI_SphereDlg.h" // Method SPHERE #include "PrimitiveGUI_SphereDlg.h" // Method SPHERE
#include "PrimitiveGUI_TorusDlg.h" // Method TORUS #include "PrimitiveGUI_TorusDlg.h" // Method TORUS
#include "PrimitiveGUI_ConeDlg.h" // Method CONE #include "PrimitiveGUI_ConeDlg.h" // Method CONE
static PrimitiveGUI* myPrimitiveGUI = 0;
//======================================================================= //=======================================================================
// function : PrimitiveGUI() // function : PrimitiveGUI()
// purpose : Constructor // purpose : Constructor
@ -44,9 +45,9 @@ static PrimitiveGUI* myPrimitiveGUI = 0;
PrimitiveGUI::PrimitiveGUI() : PrimitiveGUI::PrimitiveGUI() :
QObject() QObject()
{ {
myGeomGUI = GEOMBase_Context::GetGeomGUI(); myGeomBase = new GEOMBase();
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); myGeomGUI = GEOMContext::GetGeomGUI();
myGeom = GEOM::GEOM_Gen::_narrow(comp); myGeom = myGeomGUI->myComponentGeom;
} }
@ -59,53 +60,40 @@ PrimitiveGUI::~PrimitiveGUI()
} }
//=======================================================================
// function : GetOrCreateGUI()
// purpose : Gets or create an object 'GUI' with initialisations
// : Returns 'GUI' as a pointer
//=======================================================================
PrimitiveGUI* PrimitiveGUI::GetOrCreateGUI()
{
myPrimitiveGUI = new PrimitiveGUI();
return myPrimitiveGUI;
}
//======================================================================= //=======================================================================
// function : OnGUIEvent() // function : OnGUIEvent()
// purpose : // purpose :
//======================================================================= //=======================================================================
bool PrimitiveGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) bool PrimitiveGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
{ {
PrimitiveGUI::GetOrCreateGUI(); PrimitiveGUI* aPrimitiveGUI = new PrimitiveGUI();
myPrimitiveGUI->myGeomGUI->EmitSignalDeactivateDialog(); aPrimitiveGUI->myGeomGUI->EmitSignalDeactivateDialog();
SALOME_Selection* Sel = SALOME_Selection::Selection(myPrimitiveGUI->myGeomGUI->GetActiveStudy()->getSelection()); SALOME_Selection* Sel = SALOME_Selection::Selection(aPrimitiveGUI->myGeomGUI->GetActiveStudy()->getSelection());
switch (theCommandID) switch (theCommandID)
{ {
case 4021: // BOX case 4021: // BOX
{ {
PrimitiveGUI_BoxDlg *aDlg = new PrimitiveGUI_BoxDlg(parent, "", myPrimitiveGUI, Sel); PrimitiveGUI_BoxDlg* aDlg = new PrimitiveGUI_BoxDlg(parent, "", aPrimitiveGUI, Sel);
break; break;
} }
case 4022: // CYLINDER case 4022: // CYLINDER
{ {
PrimitiveGUI_CylinderDlg *aDlg = new PrimitiveGUI_CylinderDlg(parent, "", myPrimitiveGUI, Sel); PrimitiveGUI_CylinderDlg* aDlg = new PrimitiveGUI_CylinderDlg(parent, "", aPrimitiveGUI, Sel);
break; break;
} }
case 4023: // SPHERE case 4023: // SPHERE
{ {
PrimitiveGUI_SphereDlg *aDlg = new PrimitiveGUI_SphereDlg(parent, "", myPrimitiveGUI, Sel); PrimitiveGUI_SphereDlg* aDlg = new PrimitiveGUI_SphereDlg(parent, "", aPrimitiveGUI, Sel);
break; break;
} }
case 4024: // TORUS case 4024: // TORUS
{ {
PrimitiveGUI_TorusDlg *aDlg = new PrimitiveGUI_TorusDlg(parent, "", myPrimitiveGUI, Sel); PrimitiveGUI_TorusDlg* aDlg = new PrimitiveGUI_TorusDlg(parent, "", aPrimitiveGUI, Sel);
break; break;
} }
case 4025: // CONE case 4025: // CONE
{ {
PrimitiveGUI_ConeDlg *aDlg = new PrimitiveGUI_ConeDlg(parent, "", myPrimitiveGUI, Sel); PrimitiveGUI_ConeDlg* aDlg = new PrimitiveGUI_ConeDlg(parent, "", aPrimitiveGUI, Sel);
break; break;
} }
default: default:
@ -127,7 +115,7 @@ void PrimitiveGUI::MakeBoxAndDisplay(const gp_Pnt P1, const gp_Pnt P2)
try { try {
GEOM::GEOM_Shape_var box = myGeom->MakeBox(P1.X(), P1.Y(), P1.Z(), P2.X(), P2.Y(), P2.Z()); GEOM::GEOM_Shape_var box = myGeom->MakeBox(P1.X(), P1.Y(), P1.Z(), P2.X(), P2.Y(), P2.Z());
box->NameType(tr("GEOM_BOX")); box->NameType(tr("GEOM_BOX"));
if(myGeomGUI->Display(box, "")) if(myGeomBase->Display(box))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
} }
catch(const SALOME::SALOME_Exception& S_ex) { catch(const SALOME::SALOME_Exception& S_ex) {
@ -157,7 +145,7 @@ void PrimitiveGUI::MakeCylinderAndDisplay(const gp_Pnt BasePoint, const gp_Dir a
return; return;
} }
result->NameType(tr("GEOM_CYLINDER")); result->NameType(tr("GEOM_CYLINDER"));
if(myGeomGUI->Display(result, "")) if(myGeomBase->Display(result))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
} }
catch(const SALOME::SALOME_Exception& S_ex) { catch(const SALOME::SALOME_Exception& S_ex) {
@ -179,7 +167,7 @@ void PrimitiveGUI::MakeSphereAndDisplay(const gp_Pnt aCenterPoint, const double
GEOM::GEOM_Shape_ptr result = myGeom->MakeSphere(aCenterPoint.X(),aCenterPoint.Y(),aCenterPoint.Z(), aRadius); GEOM::GEOM_Shape_ptr result = myGeom->MakeSphere(aCenterPoint.X(),aCenterPoint.Y(),aCenterPoint.Z(), aRadius);
result->NameType(tr("GEOM_SPHERE")); result->NameType(tr("GEOM_SPHERE"));
if (myGeomGUI->Display(result, "")) if (myGeomBase->Display(result))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
} }
catch (const SALOME::SALOME_Exception& S_ex) { catch (const SALOME::SALOME_Exception& S_ex) {
@ -210,7 +198,7 @@ void PrimitiveGUI::MakeTorusAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir
return; return;
} }
result->NameType(tr("GEOM_TORUS")); result->NameType(tr("GEOM_TORUS"));
if(myGeomGUI->Display(result, "")) if(myGeomBase->Display(result))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
} }
catch(const SALOME::SALOME_Exception& S_ex) { catch(const SALOME::SALOME_Exception& S_ex) {
@ -241,7 +229,7 @@ void PrimitiveGUI::MakeConeAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir,
return; return;
} }
result->NameType(tr("GEOM_CONE")); result->NameType(tr("GEOM_CONE"));
if(myGeomGUI->Display(result, "")) if(myGeomBase->Display(result))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
} }
catch(const SALOME::SALOME_Exception& S_ex) { catch(const SALOME::SALOME_Exception& S_ex) {

View File

@ -29,8 +29,7 @@
#ifndef PRIMITIVEGUI_H #ifndef PRIMITIVEGUI_H
#define PRIMITIVEGUI_H #define PRIMITIVEGUI_H
#include "GEOMBase_Display.h" #include "GEOMBase.h"
#include "QAD_Config.h"
//================================================================================= //=================================================================================
// class : PrimitiveGUI // class : PrimitiveGUI
@ -44,7 +43,6 @@ public :
PrimitiveGUI(); PrimitiveGUI();
~PrimitiveGUI(); ~PrimitiveGUI();
static PrimitiveGUI* GetOrCreateGUI();
static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
void MakeBoxAndDisplay(const gp_Pnt P1, const gp_Pnt P2); void MakeBoxAndDisplay(const gp_Pnt P1, const gp_Pnt P2);
@ -56,7 +54,8 @@ public :
void MakeConeAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir, void MakeConeAndDisplay(const gp_Pnt BasePoint, const gp_Dir aDir,
const double Radius1, const double Radius2, const double aHeight); const double Radius1, const double Radius2, const double aHeight);
GEOMBase_Context* myGeomGUI; GEOMBase* myGeomBase;
GEOMContext* myGeomGUI;
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
}; };

View File

@ -30,6 +30,8 @@ using namespace std;
#include "PrimitiveGUI_BoxDlg.h" #include "PrimitiveGUI_BoxDlg.h"
#include <BRepPrimAPI_MakeBox.hxx> #include <BRepPrimAPI_MakeBox.hxx>
#include <Precision.hxx>
#include "QAD_Config.h"
//================================================================================= //=================================================================================
// class : PrimitiveGUI_BoxDlg() // class : PrimitiveGUI_BoxDlg()
@ -156,7 +158,7 @@ void PrimitiveGUI_BoxDlg::ConstructorsClicked(int constructorId)
{ {
myConstructorId = constructorId; myConstructorId = constructorId;
mySelection->ClearFilters(); mySelection->ClearFilters();
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
disconnect(mySelection, 0, this, 0); disconnect(mySelection, 0, this, 0);
myOkPoint1 = myOkPoint2 = false; myOkPoint1 = myOkPoint2 = false;
@ -192,7 +194,7 @@ void PrimitiveGUI_BoxDlg::ConstructorsClicked(int constructorId)
myPoint2.SetCoord(initValue, initValue, initValue); myPoint2.SetCoord(initValue, initValue, initValue);
mySimulationTopoDs = BRepPrimAPI_MakeBox(myPoint1, myPoint2).Shape(); mySimulationTopoDs = BRepPrimAPI_MakeBox(myPoint1, myPoint2).Shape();
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
break; break;
} }
} }
@ -221,7 +223,7 @@ void PrimitiveGUI_BoxDlg::ClickOnApply()
myGeomGUI->GetDesktop()->putInfo(tr("")); myGeomGUI->GetDesktop()->putInfo(tr(""));
if (mySimulationTopoDs.IsNull()) if (mySimulationTopoDs.IsNull())
return; return;
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
switch(myConstructorId) switch(myConstructorId)
@ -254,11 +256,11 @@ void PrimitiveGUI_BoxDlg::ClickOnApply()
//================================================================================= //=================================================================================
void PrimitiveGUI_BoxDlg::SelectionIntoArgument() void PrimitiveGUI_BoxDlg::SelectionIntoArgument()
{ {
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
QString aString = ""; /* name of selection */ QString aString = ""; /* name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
if (nbSel != 1) { if (nbSel != 1) {
if (myEditCurrentArgument == GroupPoints->LineEdit1) if (myEditCurrentArgument == GroupPoints->LineEdit1)
myOkPoint1 = false; myOkPoint1 = false;
@ -269,21 +271,21 @@ void PrimitiveGUI_BoxDlg::SelectionIntoArgument()
// nbSel == 1 // nbSel == 1
TopoDS_Shape S; TopoDS_Shape S;
if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) if(!myGeomBase->GetTopoFromSelection(mySelection, S))
return; return;
if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) { if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) {
myEditCurrentArgument->setText(aString); myEditCurrentArgument->setText(aString);
myOkPoint1 = true; myOkPoint1 = true;
} }
else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomGUI->VertexToPoint(S, myPoint2)) { else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomBase->VertexToPoint(S, myPoint2)) {
myEditCurrentArgument->setText(aString); myEditCurrentArgument->setText(aString);
myOkPoint2 = true; myOkPoint2 = true;
} }
if(myOkPoint1 && myOkPoint2 && TestBoxDimensions(myPoint1, myPoint2)) { if(myOkPoint1 && myOkPoint2 && TestBoxDimensions(myPoint1, myPoint2)) {
mySimulationTopoDs = BRepPrimAPI_MakeBox(myPoint1, myPoint2).Shape(); mySimulationTopoDs = BRepPrimAPI_MakeBox(myPoint1, myPoint2).Shape();
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
} }
return; return;
} }
@ -343,7 +345,7 @@ void PrimitiveGUI_BoxDlg::ActivateThisDialog()
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if(!mySimulationTopoDs.IsNull()) if(!mySimulationTopoDs.IsNull())
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
return; return;
} }
@ -367,7 +369,7 @@ void PrimitiveGUI_BoxDlg::enterEvent(QEvent* e)
//================================================================================= //=================================================================================
void PrimitiveGUI_BoxDlg::ValueChangedInSpinBox(double newValue) void PrimitiveGUI_BoxDlg::ValueChangedInSpinBox(double newValue)
{ {
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
QObject* send = (QObject*)sender(); QObject* send = (QObject*)sender();
double vx, vy, vz; double vx, vy, vz;
@ -393,7 +395,7 @@ void PrimitiveGUI_BoxDlg::ValueChangedInSpinBox(double newValue)
if(TestBoxDimensions(myPoint1, myPoint2)) { if(TestBoxDimensions(myPoint1, myPoint2)) {
mySimulationTopoDs = BRepPrimAPI_MakeBox(myPoint1, myPoint2).Shape(); mySimulationTopoDs = BRepPrimAPI_MakeBox(myPoint1, myPoint2).Shape();
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
} }
return; return;
} }

View File

@ -35,6 +35,7 @@
#include "PrimitiveGUI.h" #include "PrimitiveGUI.h"
#include "GEOM_ShapeTypeFilter.hxx"
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
//================================================================================= //=================================================================================

View File

@ -32,6 +32,8 @@ using namespace std;
#include <BRepPrimAPI_MakeCone.hxx> #include <BRepPrimAPI_MakeCone.hxx>
#include <BRepPrimAPI_MakeCylinder.hxx> #include <BRepPrimAPI_MakeCylinder.hxx>
#include <BRepAdaptor_Curve.hxx> #include <BRepAdaptor_Curve.hxx>
#include <Precision.hxx>
#include "QAD_Config.h"
//================================================================================= //=================================================================================
// class : PrimitiveGUI_ConeDlg() // class : PrimitiveGUI_ConeDlg()
@ -175,7 +177,7 @@ void PrimitiveGUI_ConeDlg::ConstructorsClicked(int constructorId)
{ {
myConstructorId = constructorId; myConstructorId = constructorId;
mySelection->ClearFilters(); mySelection->ClearFilters();
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
disconnect(mySelection, 0, this, 0); disconnect(mySelection, 0, this, 0);
myOkHeight = myOkRadius1 = myOkRadius2 = true; myOkHeight = myOkRadius1 = myOkRadius2 = true;
myRadius1 = 100.0; myRadius1 = 100.0;
@ -247,7 +249,7 @@ void PrimitiveGUI_ConeDlg::ClickOnApply()
myGeomGUI->GetDesktop()->putInfo(tr("")); myGeomGUI->GetDesktop()->putInfo(tr(""));
if (mySimulationTopoDs.IsNull()) if (mySimulationTopoDs.IsNull())
return; return;
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight) { if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 && myOkHeight) {
@ -267,11 +269,11 @@ void PrimitiveGUI_ConeDlg::ClickOnApply()
//================================================================================= //=================================================================================
void PrimitiveGUI_ConeDlg::SelectionIntoArgument() void PrimitiveGUI_ConeDlg::SelectionIntoArgument()
{ {
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
QString aString = ""; /* name of selection */ QString aString = ""; /* name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
if(nbSel != 1) { if(nbSel != 1) {
if(myEditCurrentArgument == GroupPoints->LineEdit1) if(myEditCurrentArgument == GroupPoints->LineEdit1)
myOkPoint1 = false; myOkPoint1 = false;
@ -282,11 +284,11 @@ void PrimitiveGUI_ConeDlg::SelectionIntoArgument()
/* nbSel == 1 */ /* nbSel == 1 */
TopoDS_Shape S; TopoDS_Shape S;
if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) if(!myGeomBase->GetTopoFromSelection(mySelection, S))
return; return;
/* gp_Pnt : not used */ /* gp_Pnt : not used */
if (myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) { if (myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) {
GroupPoints->LineEdit1->setText(aString); GroupPoints->LineEdit1->setText(aString);
myOkPoint1 = true; myOkPoint1 = true;
} }
@ -359,7 +361,7 @@ void PrimitiveGUI_ConeDlg::ActivateThisDialog()
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if(!mySimulationTopoDs.IsNull()) if(!mySimulationTopoDs.IsNull())
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
return; return;
} }
@ -383,7 +385,7 @@ void PrimitiveGUI_ConeDlg::enterEvent(QEvent* e)
//================================================================================= //=================================================================================
void PrimitiveGUI_ConeDlg::ValueChangedInSpinBox(double newValue) void PrimitiveGUI_ConeDlg::ValueChangedInSpinBox(double newValue)
{ {
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
QObject* send = (QObject*)sender(); QObject* send = (QObject*)sender();
@ -412,7 +414,7 @@ void PrimitiveGUI_ConeDlg::ValueChangedInSpinBox(double newValue)
//================================================================================= //=================================================================================
void PrimitiveGUI_ConeDlg::MakeConeSimulationAndDisplay() void PrimitiveGUI_ConeDlg::MakeConeSimulationAndDisplay()
{ {
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
gp_Dir aDir = myDir; gp_Dir aDir = myDir;
@ -429,7 +431,7 @@ void PrimitiveGUI_ConeDlg::MakeConeSimulationAndDisplay()
if(fabs(myHeight) > Precision::Confusion()) if(fabs(myHeight) > Precision::Confusion())
mySimulationTopoDs = BRepPrimAPI_MakeCone(anAxis, myRadius1, myRadius2, fabs(myHeight)).Shape(); mySimulationTopoDs = BRepPrimAPI_MakeCone(anAxis, myRadius1, myRadius2, fabs(myHeight)).Shape();
} }
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
} }
catch(Standard_Failure) { catch(Standard_Failure) {
MESSAGE("Exception catched in MakeConeSimulationAndDisplay"); MESSAGE("Exception catched in MakeConeSimulationAndDisplay");

View File

@ -36,6 +36,7 @@
#include "PrimitiveGUI.h" #include "PrimitiveGUI.h"
#include "GEOM_EdgeFilter.hxx" #include "GEOM_EdgeFilter.hxx"
#include "GEOM_ShapeTypeFilter.hxx"
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
#include <gp_Dir.hxx> #include <gp_Dir.hxx>

View File

@ -31,6 +31,8 @@ using namespace std;
#include <BRepPrimAPI_MakeCylinder.hxx> #include <BRepPrimAPI_MakeCylinder.hxx>
#include <BRepAdaptor_Curve.hxx> #include <BRepAdaptor_Curve.hxx>
#include <Precision.hxx>
#include "QAD_Config.h"
//================================================================================= //=================================================================================
// class : PrimitiveGUI_CylinderDlg() // class : PrimitiveGUI_CylinderDlg()
@ -166,7 +168,7 @@ void PrimitiveGUI_CylinderDlg::ConstructorsClicked(int constructorId)
{ {
myConstructorId = constructorId; myConstructorId = constructorId;
mySelection->ClearFilters(); mySelection->ClearFilters();
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
disconnect(mySelection, 0, this, 0); disconnect(mySelection, 0, this, 0);
myOkHeight = myOkRadius = true; myOkHeight = myOkRadius = true;
myRadius = 100.0; myRadius = 100.0;
@ -234,7 +236,7 @@ void PrimitiveGUI_CylinderDlg::ClickOnApply()
myGeomGUI->GetDesktop()->putInfo(tr("")); myGeomGUI->GetDesktop()->putInfo(tr(""));
if (mySimulationTopoDs.IsNull()) if (mySimulationTopoDs.IsNull())
return; return;
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
if(myOkPoint1 && myOkDir && myOkRadius && myOkHeight) { if(myOkPoint1 && myOkDir && myOkRadius && myOkHeight) {
@ -254,11 +256,11 @@ void PrimitiveGUI_CylinderDlg::ClickOnApply()
//================================================================================= //=================================================================================
void PrimitiveGUI_CylinderDlg::SelectionIntoArgument() void PrimitiveGUI_CylinderDlg::SelectionIntoArgument()
{ {
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
QString aString = ""; /* name of selection */ QString aString = ""; /* name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
if(nbSel != 1) { if(nbSel != 1) {
if(myEditCurrentArgument == GroupPoints->LineEdit1) if(myEditCurrentArgument == GroupPoints->LineEdit1)
myOkPoint1 = false; myOkPoint1 = false;
@ -269,11 +271,11 @@ void PrimitiveGUI_CylinderDlg::SelectionIntoArgument()
/* nbSel == 1 */ /* nbSel == 1 */
TopoDS_Shape S; TopoDS_Shape S;
if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) if(!myGeomBase->GetTopoFromSelection(mySelection, S))
return; return;
/* gp_Pnt : not used */ /* gp_Pnt : not used */
if (myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) { if (myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) {
GroupPoints->LineEdit1->setText(aString); GroupPoints->LineEdit1->setText(aString);
myOkPoint1 = true; myOkPoint1 = true;
} }
@ -346,7 +348,7 @@ void PrimitiveGUI_CylinderDlg::ActivateThisDialog()
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if(!mySimulationTopoDs.IsNull()) if(!mySimulationTopoDs.IsNull())
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
return; return;
} }
@ -370,7 +372,7 @@ void PrimitiveGUI_CylinderDlg::enterEvent(QEvent* e)
//================================================================================= //=================================================================================
void PrimitiveGUI_CylinderDlg::ValueChangedInSpinBox( double newValue ) void PrimitiveGUI_CylinderDlg::ValueChangedInSpinBox( double newValue )
{ {
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
QObject* send = (QObject*)sender(); QObject* send = (QObject*)sender();
@ -396,7 +398,7 @@ void PrimitiveGUI_CylinderDlg::ValueChangedInSpinBox( double newValue )
//================================================================================= //=================================================================================
void PrimitiveGUI_CylinderDlg::MakeCylinderSimulationAndDisplay() void PrimitiveGUI_CylinderDlg::MakeCylinderSimulationAndDisplay()
{ {
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
gp_Dir aDir = this->myDir; gp_Dir aDir = this->myDir;
@ -408,7 +410,7 @@ void PrimitiveGUI_CylinderDlg::MakeCylinderSimulationAndDisplay()
gp_Ax2 anAxis(this->myPoint1, aDir); gp_Ax2 anAxis(this->myPoint1, aDir);
mySimulationTopoDs = BRepPrimAPI_MakeCylinder(anAxis, this->myRadius, fabs(myHeight)).Shape(); mySimulationTopoDs = BRepPrimAPI_MakeCylinder(anAxis, this->myRadius, fabs(myHeight)).Shape();
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
} }
catch(Standard_Failure) { catch(Standard_Failure) {
MESSAGE("Exception catched in MakeCylinderSimulationAndDisplay"); MESSAGE("Exception catched in MakeCylinderSimulationAndDisplay");

View File

@ -36,6 +36,7 @@
#include "PrimitiveGUI.h" #include "PrimitiveGUI.h"
#include "GEOM_EdgeFilter.hxx" #include "GEOM_EdgeFilter.hxx"
#include "GEOM_ShapeTypeFilter.hxx"
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
#include <gp_Dir.hxx> #include <gp_Dir.hxx>

View File

@ -30,6 +30,7 @@ using namespace std;
#include "PrimitiveGUI_SphereDlg.h" #include "PrimitiveGUI_SphereDlg.h"
#include <BRepPrimAPI_MakeSphere.hxx> #include <BRepPrimAPI_MakeSphere.hxx>
#include "QAD_Config.h"
//================================================================================= //=================================================================================
// class : PrimitiveGUI_SphereDlg() // class : PrimitiveGUI_SphereDlg()
@ -144,7 +145,7 @@ void PrimitiveGUI_SphereDlg::ConstructorsClicked(int constructorId)
{ {
myConstructorId = constructorId; myConstructorId = constructorId;
mySelection->ClearFilters(); mySelection->ClearFilters();
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
disconnect(mySelection, 0, this, 0); disconnect(mySelection, 0, this, 0);
myRadius = 100.0; myRadius = 100.0;
myOkRadius = true; myOkRadius = true;
@ -179,7 +180,7 @@ void PrimitiveGUI_SphereDlg::ConstructorsClicked(int constructorId)
myOkPoint1 = true; myOkPoint1 = true;
mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape(); mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape();
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
break; break;
} }
} }
@ -208,7 +209,7 @@ void PrimitiveGUI_SphereDlg::ClickOnApply()
myGeomGUI->GetDesktop()->putInfo(tr("")); myGeomGUI->GetDesktop()->putInfo(tr(""));
if(mySimulationTopoDs.IsNull()) if(mySimulationTopoDs.IsNull())
return; return;
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
if(myOkPoint1 && myOkRadius) if(myOkPoint1 && myOkRadius)
@ -223,11 +224,11 @@ void PrimitiveGUI_SphereDlg::ClickOnApply()
//================================================================================= //=================================================================================
void PrimitiveGUI_SphereDlg::SelectionIntoArgument() void PrimitiveGUI_SphereDlg::SelectionIntoArgument()
{ {
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
QString aString = ""; /* name of selection */ QString aString = ""; /* name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
if(nbSel != 1) { if(nbSel != 1) {
if(myEditCurrentArgument == GroupPoints->LineEdit1) { if(myEditCurrentArgument == GroupPoints->LineEdit1) {
GroupPoints->LineEdit1->setText(""); GroupPoints->LineEdit1->setText("");
@ -238,18 +239,18 @@ void PrimitiveGUI_SphereDlg::SelectionIntoArgument()
/* nbSel == 1 ! */ /* nbSel == 1 ! */
TopoDS_Shape S; TopoDS_Shape S;
if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) if(!myGeomBase->GetTopoFromSelection(mySelection, S))
return; return;
/* Constructor 1 treatment */ /* Constructor 1 treatment */
if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) { if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) {
GroupPoints->LineEdit1->setText(aString); GroupPoints->LineEdit1->setText(aString);
myOkPoint1 = true; myOkPoint1 = true;
} }
if(myOkPoint1 && myOkRadius) { if(myOkPoint1 && myOkRadius) {
mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape(); mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape();
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
} }
return ; return ;
} }
@ -302,7 +303,7 @@ void PrimitiveGUI_SphereDlg::ActivateThisDialog()
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if(!mySimulationTopoDs.IsNull()) if(!mySimulationTopoDs.IsNull())
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
return; return;
} }
@ -326,14 +327,14 @@ void PrimitiveGUI_SphereDlg::enterEvent(QEvent* e)
//================================================================================= //=================================================================================
void PrimitiveGUI_SphereDlg::ValueChangedInSpinBox(double newValue) void PrimitiveGUI_SphereDlg::ValueChangedInSpinBox(double newValue)
{ {
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
myRadius = newValue; myRadius = newValue;
myOkRadius = true; myOkRadius = true;
if(myOkPoint1 && myOkRadius) { if(myOkPoint1 && myOkRadius) {
mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape(); mySimulationTopoDs = BRepPrimAPI_MakeSphere(myPoint1, myRadius).Shape();
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
} }
return; return;
} }

View File

@ -35,6 +35,7 @@
#include "PrimitiveGUI.h" #include "PrimitiveGUI.h"
#include "GEOM_ShapeTypeFilter.hxx"
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
//================================================================================= //=================================================================================

View File

@ -31,6 +31,7 @@ using namespace std;
#include <BRepPrimAPI_MakeTorus.hxx> #include <BRepPrimAPI_MakeTorus.hxx>
#include <BRepAdaptor_Curve.hxx> #include <BRepAdaptor_Curve.hxx>
#include "QAD_Config.h"
//================================================================================= //=================================================================================
// class : PrimitiveGUI_TorusDlg() // class : PrimitiveGUI_TorusDlg()
@ -163,7 +164,7 @@ void PrimitiveGUI_TorusDlg::ConstructorsClicked(int constructorId)
{ {
myConstructorId = constructorId; myConstructorId = constructorId;
mySelection->ClearFilters(); mySelection->ClearFilters();
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
disconnect(mySelection, 0, this, 0); disconnect(mySelection, 0, this, 0);
myOkRadius1 = myOkRadius2 = true; myOkRadius1 = myOkRadius2 = true;
myRadius1 = 300.0; myRadius1 = 300.0;
@ -231,7 +232,7 @@ void PrimitiveGUI_TorusDlg::ClickOnApply()
myGeomGUI->GetDesktop()->putInfo(tr("")); myGeomGUI->GetDesktop()->putInfo(tr(""));
if (mySimulationTopoDs.IsNull()) if (mySimulationTopoDs.IsNull())
return; return;
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 ) if(myOkPoint1 && myOkDir && myOkRadius1 && myOkRadius2 )
@ -246,11 +247,11 @@ void PrimitiveGUI_TorusDlg::ClickOnApply()
//================================================================================= //=================================================================================
void PrimitiveGUI_TorusDlg::SelectionIntoArgument() void PrimitiveGUI_TorusDlg::SelectionIntoArgument()
{ {
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
QString aString = ""; /* name of selection */ QString aString = ""; /* name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
if(nbSel != 1) { if(nbSel != 1) {
if(myEditCurrentArgument == GroupPoints->LineEdit1) if(myEditCurrentArgument == GroupPoints->LineEdit1)
myOkPoint1 = false; myOkPoint1 = false;
@ -261,11 +262,11 @@ void PrimitiveGUI_TorusDlg::SelectionIntoArgument()
/* nbSel == 1 */ /* nbSel == 1 */
TopoDS_Shape S; TopoDS_Shape S;
if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) if(!myGeomBase->GetTopoFromSelection(mySelection, S))
return; return;
/* gp_Pnt : not used */ /* gp_Pnt : not used */
if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomGUI->VertexToPoint(S, myPoint1)) { if(myEditCurrentArgument == GroupPoints->LineEdit1 && myGeomBase->VertexToPoint(S, myPoint1)) {
GroupPoints->LineEdit1->setText(aString); GroupPoints->LineEdit1->setText(aString);
myOkPoint1 = true; myOkPoint1 = true;
} }
@ -338,7 +339,7 @@ void PrimitiveGUI_TorusDlg::ActivateThisDialog()
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if(!mySimulationTopoDs.IsNull()) if(!mySimulationTopoDs.IsNull())
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
return; return;
} }
@ -362,7 +363,7 @@ void PrimitiveGUI_TorusDlg::enterEvent(QEvent* e)
//================================================================================= //=================================================================================
void PrimitiveGUI_TorusDlg::ValueChangedInSpinBox(double newValue) void PrimitiveGUI_TorusDlg::ValueChangedInSpinBox(double newValue)
{ {
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
QObject* send = (QObject*)sender(); QObject* send = (QObject*)sender();
@ -387,13 +388,13 @@ void PrimitiveGUI_TorusDlg::ValueChangedInSpinBox(double newValue)
//================================================================================= //=================================================================================
void PrimitiveGUI_TorusDlg::MakeTorusSimulationAndDisplay() void PrimitiveGUI_TorusDlg::MakeTorusSimulationAndDisplay()
{ {
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
try { try {
gp_Ax2 anAxis(myPoint1, myDir); gp_Ax2 anAxis(myPoint1, myDir);
mySimulationTopoDs = BRepPrimAPI_MakeTorus(anAxis, myRadius1, myRadius2).Shape(); mySimulationTopoDs = BRepPrimAPI_MakeTorus(anAxis, myRadius1, myRadius2).Shape();
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
} }
catch(Standard_Failure) { catch(Standard_Failure) {
MESSAGE("Exception catched in MakeTorusSimulationAndDisplay"); MESSAGE("Exception catched in MakeTorusSimulationAndDisplay");

View File

@ -36,6 +36,7 @@
#include "PrimitiveGUI.h" #include "PrimitiveGUI.h"
#include "GEOM_EdgeFilter.hxx" #include "GEOM_EdgeFilter.hxx"
#include "GEOM_ShapeTypeFilter.hxx"
#include <gp_Pnt.hxx> #include <gp_Pnt.hxx>
#include <gp_Dir.hxx> #include <gp_Dir.hxx>

View File

@ -35,7 +35,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl
@COMMENCE@ @COMMENCE@
# header files # header files
EXPORT_HEADERS= RepairGUI.h EXPORT_HEADERS=
# Libraries targets # Libraries targets
LIB = libRepairGUI.la LIB = libRepairGUI.la
@ -68,6 +68,6 @@ LIB_SERVER_IDL =
CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome 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 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@ @CONCLUDE@

View File

@ -31,14 +31,13 @@ using namespace std;
#include "QAD_RightFrame.h" #include "QAD_RightFrame.h"
#include "OCCViewer_Viewer3d.h" #include "OCCViewer_Viewer3d.h"
#include "SALOMEGUI_QtCatchCorbaException.hxx"
#include "RepairGUI_SewingDlg.h" // Method SEWING #include "RepairGUI_SewingDlg.h" // Method SEWING
#include "RepairGUI_OrientationDlg.h" // Method ORIENTATION #include "RepairGUI_OrientationDlg.h" // Method ORIENTATION
#include "RepairGUI_SuppressFacesDlg.h" // Method SUPPRESS FACES #include "RepairGUI_SuppressFacesDlg.h" // Method SUPPRESS FACES
#include "RepairGUI_SuppressHoleDlg.h" // Method SUPPRESS HOLE #include "RepairGUI_SuppressHoleDlg.h" // Method SUPPRESS HOLE
static RepairGUI* myRepairGUI = 0;
//======================================================================= //=======================================================================
// function : RepairGUI() // function : RepairGUI()
// purpose : Constructor // purpose : Constructor
@ -46,9 +45,11 @@ static RepairGUI* myRepairGUI = 0;
RepairGUI::RepairGUI() : RepairGUI::RepairGUI() :
QObject() QObject()
{ {
myGeomGUI = GEOMBase_Context::GetGeomGUI(); myGeomBase = new GEOMBase();
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); myGeomGUI = GEOMContext::GetGeomGUI();
myGeom = GEOM::GEOM_Gen::_narrow(comp); // Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
// myGeom = GEOM::GEOM_Gen::_narrow(comp);
myGeom = myGeomGUI->myComponentGeom;
} }
@ -61,25 +62,13 @@ RepairGUI::~RepairGUI()
} }
//=======================================================================
// function : GetOrCreateGUI()
// purpose : Gets or create an object 'GUI' with initialisations
// : Returns 'GUI' as a pointer
//=======================================================================
RepairGUI* RepairGUI::GetOrCreateGUI()
{
myRepairGUI = new RepairGUI();
return myRepairGUI;
}
//======================================================================= //=======================================================================
// function : OnGUIEvent() // function : OnGUIEvent()
// purpose : // purpose :
//======================================================================= //=======================================================================
bool RepairGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) bool RepairGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
{ {
RepairGUI::GetOrCreateGUI(); RepairGUI* myRepairGUI = new RepairGUI();
myRepairGUI->myGeomGUI->EmitSignalDeactivateDialog(); myRepairGUI->myGeomGUI->EmitSignalDeactivateDialog();
SALOME_Selection* Sel = SALOME_Selection::Selection(myRepairGUI->myGeomGUI->GetActiveStudy()->getSelection()); SALOME_Selection* Sel = SALOME_Selection::Selection(myRepairGUI->myGeomGUI->GetActiveStudy()->getSelection());
@ -141,10 +130,10 @@ void RepairGUI::MakeSewingAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR,
TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result); TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, result);
Standard_CString type; Standard_CString type;
myGeomGUI->GetShapeTypeString(S,type); myGeomBase->GetShapeTypeString(S,type);
result->NameType(type); result->NameType(type);
if(myGeomGUI->Display(result)) if(myGeomBase->Display(result))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
return; return;
} }
@ -168,7 +157,7 @@ void RepairGUI::MakeOrientationChangeAndDisplay(GEOM::GEOM_Shape_ptr Shape)
return; return;
} }
result->NameType(Shape->NameType()); result->NameType(Shape->NameType());
if(myGeomGUI->Display(result)) if(myGeomBase->Display(result))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
return; return;
} }
@ -186,32 +175,31 @@ void RepairGUI::MakeOrientationChangeAndDisplay(GEOM::GEOM_Shape_ptr Shape)
// : This means that hole do not traverse ShapeTopo. // : This means that hole do not traverse ShapeTopo.
// : Warning : the hole to be suppressed must be defined by one or two single closed wires ! // : Warning : the hole to be suppressed must be defined by one or two single closed wires !
//===================================================================================== //=====================================================================================
bool RepairGUI::OnSuppressHole( const char* ShapeTopoIOR, bool RepairGUI::OnSuppressHole(const char* ShapeTopoIOR,
const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdFace, const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdFace,
const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdWire, const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdWire,
const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdEndFace ) const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdEndFace)
{ {
/* Test the type of viewer */ /* Test the type of viewer */
if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC )
return false; return false;
}
try { try {
GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString( ShapeTopoIOR ); GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(ShapeTopoIOR);
GEOM::GEOM_Shape_var aResult = myGeom->SuppressHole( aShape, ListOfIdFace, ListOfIdWire, ListOfIdEndFace ) ; GEOM::GEOM_Shape_var aResult = myGeom->SuppressHole(aShape, ListOfIdFace, ListOfIdWire, ListOfIdEndFace);
TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, aResult); TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, aResult);
Standard_CString type; Standard_CString type;
myGeomGUI->GetShapeTypeString(S,type); myGeomBase->GetShapeTypeString(S,type);
aResult->NameType( type ); aResult->NameType(type);
if ( myGeomGUI->Display( aResult) ) if(myGeomBase->Display(aResult))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
} }
catch (const SALOME::SALOME_Exception& S_ex) { catch(const SALOME::SALOME_Exception& S_ex) {
QtCatchCorbaException(S_ex); QtCatchCorbaException(S_ex);
} }
return true ; return true;
} }
@ -220,30 +208,29 @@ bool RepairGUI::OnSuppressHole( const char* ShapeTopoIOR,
// purpose : To suppress one or more holes on a face // purpose : To suppress one or more holes on a face
// : 'ListOfIdWires' contains indices or wires/holes. // : 'ListOfIdWires' contains indices or wires/holes.
//===================================================================================== //=====================================================================================
bool RepairGUI::OnSuppressHolesInFaceOrShell( const char* ShapeTopoIOR, bool RepairGUI::OnSuppressHolesInFaceOrShell(const char* ShapeTopoIOR,
const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdWires ) const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfIdWires)
{ {
/* Test the type of viewer */ /* Test the type of viewer */
if ( myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC ) { if(myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
return false; return false;
}
try { try {
GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString( ShapeTopoIOR ); GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(ShapeTopoIOR);
GEOM::GEOM_Shape_var aResult = myGeom->SuppressHolesInFaceOrShell( aShape, ListOfIdWires ) ; GEOM::GEOM_Shape_var aResult = myGeom->SuppressHolesInFaceOrShell(aShape, ListOfIdWires);
TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, aResult); TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, aResult);
Standard_CString type; Standard_CString type;
myGeomGUI->GetShapeTypeString(S,type); myGeomBase->GetShapeTypeString(S,type);
aResult->NameType( type ); aResult->NameType(type);
if ( myGeomGUI->Display( aResult) ) if(myGeomBase->Display(aResult))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
} }
catch (const SALOME::SALOME_Exception& S_ex) { catch(const SALOME::SALOME_Exception& S_ex) {
QtCatchCorbaException(S_ex); QtCatchCorbaException(S_ex);
} }
return true ; return true;
} }
@ -252,30 +239,27 @@ bool RepairGUI::OnSuppressHolesInFaceOrShell( const char* ShapeTopoIOR,
// purpose : To suppress faces from a shape // purpose : To suppress faces from a shape
// : The result is one or more shells/faces as main shapes ! // : The result is one or more shells/faces as main shapes !
//===================================================================================== //=====================================================================================
bool RepairGUI::OnSuppressFaces( const TopoDS_Shape& ShapeTopo, bool RepairGUI::OnSuppressFaces(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR,
const char* ShapeTopoIOR, const Standard_Integer& aLocalContextId, bool& myUseLocalContext)
const Standard_Integer& aLocalContextId,
bool& myUseLocalContext )
{ {
/* Test the type of viewer */ /* 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()) {
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY"));
return false; return false;
} }
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 ;
}
OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)myGeomGUI->GetActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer(); 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 */ /* local context is from DialogBox */
MESSAGE("Error : No local context opened for suppress faces method" << endl ) ; MESSAGE("Error : No local context opened for suppress faces method" << endl);
return false ; return false;
} }
GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID; GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID;
@ -285,66 +269,64 @@ bool RepairGUI::OnSuppressFaces( const TopoDS_Shape& ShapeTopo,
/* Create a list of indices of faces to be suppressed */ /* Create a list of indices of faces to be suppressed */
int i = 0; int i = 0;
const int SubShapeType = 4 ; /* GEOM::FACE type */ const int SubShapeType = 4; /* GEOM::FACE type */
ic->InitSelected(); /* to repositioning at beginning */ ic->InitSelected(); /* to repositioning at beginning */
while( ic->MoreSelected() ) { while(ic->MoreSelected()) {
int index = myGeomGUI->GetIndex( ic->SelectedShape(), ShapeTopo, SubShapeType ); int index = myGeomBase->GetIndex(ic->SelectedShape(), ShapeTopo, SubShapeType);
ListOfID[i] = index ; ListOfID[i] = index;
i++; i++;
ic->NextSelected(); ic->NextSelected();
} }
/* Close local context opened in DialogBox */ /* Close local context opened in DialogBox */
ic->CloseLocalContext(aLocalContextId) ; ic->CloseLocalContext(aLocalContextId);
myUseLocalContext = false ; myUseLocalContext = false;
/* Here is the main shape */ /* 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; 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 */ /* Call geom method that return a list of shells/faces as result of suppress */
try { 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); QtCatchCorbaException(S_ex);
} }
/* Test list of shells/faces */ /* Test list of shells/faces */
if( listGeomShapes->length() < 1 ) { if(listGeomShapes->length() < 1) {
return false ; return false;
} }
/* Loop on each object created */ /* 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] ; if(S.IsNull())
TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape( myGeom, aShellOrFace ); return false;
if( S.IsNull() ) {
return false ;
}
char* nameG = (char *)malloc(20); char* nameG = (char *)malloc(20);
Standard_CString Type; Standard_CString Type;
if ( myGeomGUI->GetShapeTypeString(S, Type) ) { if(myGeomBase->GetShapeTypeString(S, Type)) {
aShellOrFace->NameType( Type ); aShellOrFace->NameType(Type);
sprintf (nameG, "%s_%d", Type, myGeomGUI->GetNbGeom()++); sprintf (nameG, "%s_%d", Type, myGeomGUI->GetNbGeom()++);
} }
else { else {
aShellOrFace->NameType( tr("GEOM_SHAPE") ); aShellOrFace->NameType(tr("GEOM_SHAPE"));
sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->GetNbGeom()++ ); sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->GetNbGeom()++);
} }
/* Display with name */ /* Display with name */
if( !myGeomGUI->Display( aShellOrFace, nameG) ) { if(!myGeomBase->Display(aShellOrFace, nameG)) {
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_ABORT"));
return false ; return false;
} }
} }
myGeomGUI->GetDesktop()->putInfo (tr("GEOM_PRP_READY")); myGeomGUI->GetDesktop()->putInfo (tr("GEOM_PRP_READY"));
return true ; return true;
} }

View File

@ -29,7 +29,7 @@
#ifndef REPAIRGUI_H #ifndef REPAIRGUI_H
#define REPAIRGUI_H #define REPAIRGUI_H
#include "GEOMBase_Display.h" #include "GEOMBase.h"
//================================================================================= //=================================================================================
// class : RepairGUI // class : RepairGUI
@ -43,7 +43,6 @@ public :
RepairGUI(); RepairGUI();
~RepairGUI(); ~RepairGUI();
static RepairGUI* GetOrCreateGUI();
static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
void MakeSewingAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR, void MakeSewingAndDisplay(GEOM::GEOM_Gen::ListOfIOR& listShapesIOR,
@ -60,7 +59,8 @@ public :
const Standard_Integer& aLocalContextId, const Standard_Integer& aLocalContextId,
bool& myUseLocalContext); bool& myUseLocalContext);
GEOMBase_Context* myGeomGUI; GEOMBase* myGeomBase;
GEOMContext* myGeomGUI;
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
}; };

View File

@ -29,7 +29,7 @@
using namespace std; using namespace std;
#include "RepairGUI_OrientationDlg.h" #include "RepairGUI_OrientationDlg.h"
#include <Precision.hxx>
#include "QAD_Config.h" #include "QAD_Config.h"
#include <TopoDS_Compound.hxx> #include <TopoDS_Compound.hxx>
@ -200,7 +200,8 @@ void RepairGUI_OrientationDlg::Init( SALOME_Selection* Sel )
CheckBoxReverse->setChecked( FALSE ); CheckBoxReverse->setChecked( FALSE );
myEditCurrentArgument = LineEditC1A1 ; myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel; mySelection = Sel;
myGeomGUI = GEOMBase_Context::GetGeomGUI() ; myGeomBase = new GEOMBase() ;
myGeomGUI = GEOMContext::GetGeomGUI() ;
myLength = 25.0 ; myLength = 25.0 ;
myOkShape = false ; myOkShape = false ;
@ -233,7 +234,7 @@ void RepairGUI_OrientationDlg::Init( SALOME_Selection* Sel )
/* Move widget on the botton right corner of main widget */ /* Move widget on the botton right corner of main widget */
int x, y ; int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ; myGeomBase->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ; this->move( x, y ) ;
this->show() ; /* displays Dialog */ this->show() ; /* displays Dialog */
@ -293,7 +294,7 @@ void RepairGUI_OrientationDlg::ClickOnApply()
//================================================================================= //=================================================================================
void RepairGUI_OrientationDlg::ClickOnCancel() void RepairGUI_OrientationDlg::ClickOnCancel()
{ {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
disconnect( mySelection, 0, this, 0 ); disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ; myGeomGUI->ResetState() ;
@ -318,7 +319,7 @@ void RepairGUI_OrientationDlg::LineEditReturnPressed()
/* so SelectionIntoArgument() is automatically called. */ /* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ; const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ; QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { if( myGeomBase->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ; myEditCurrentArgument->setText( objectUserName ) ;
} }
return ; return ;
@ -332,13 +333,13 @@ void RepairGUI_OrientationDlg::LineEditReturnPressed()
//================================================================================= //=================================================================================
void RepairGUI_OrientationDlg::SelectionIntoArgument() void RepairGUI_OrientationDlg::SelectionIntoArgument()
{ {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
this->mySimulationTopoDs.Nullify() ; this->mySimulationTopoDs.Nullify() ;
/* Name of future selection */ /* Name of future selection */
QString aString = ""; QString aString = "";
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel != 1 ) { if ( nbSel != 1 ) {
if ( myEditCurrentArgument == LineEditC1A1 ) { if ( myEditCurrentArgument == LineEditC1A1 ) {
LineEditC1A1->setText("") ; LineEditC1A1->setText("") ;
@ -351,12 +352,12 @@ void RepairGUI_OrientationDlg::SelectionIntoArgument()
TopoDS_Shape S; TopoDS_Shape S;
Standard_Boolean testResult ; Standard_Boolean testResult ;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) if( !myGeomBase->GetTopoFromSelection(mySelection, S) )
return ; return ;
/* Constructor */ /* Constructor */
if ( myEditCurrentArgument == LineEditC1A1 ) { if ( myEditCurrentArgument == LineEditC1A1 ) {
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult) ;
if( !testResult ) if( !testResult )
return ; return ;
LineEditC1A1->setText(aString) ; LineEditC1A1->setText(aString) ;
@ -400,7 +401,7 @@ void RepairGUI_OrientationDlg::SetEditCurrentArgument()
//================================================================================= //=================================================================================
void RepairGUI_OrientationDlg::ValueChangedInSpinBox( double newValue ) void RepairGUI_OrientationDlg::ValueChangedInSpinBox( double newValue )
{ {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
QObject* send = (QObject*)sender() ; QObject* send = (QObject*)sender() ;
@ -427,7 +428,7 @@ void RepairGUI_OrientationDlg::DeactivateActiveDialog()
GroupButtons->setEnabled(false) ; GroupButtons->setEnabled(false) ;
GroupC1->setEnabled(false) ; GroupC1->setEnabled(false) ;
disconnect( mySelection, 0, this, 0 ); disconnect( mySelection, 0, this, 0 );
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
} }
return ; return ;
} }
@ -447,7 +448,7 @@ void RepairGUI_OrientationDlg::ActivateThisDialog()
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
if( !mySimulationTopoDs.IsNull() ) if( !mySimulationTopoDs.IsNull() )
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
return ; return ;
} }
@ -502,7 +503,7 @@ void RepairGUI_OrientationDlg::ReverseOrientation(int state)
//=========================================================================================== //===========================================================================================
void RepairGUI_OrientationDlg::MakeOrientationSimulationAndDisplay(const TopoDS_Shape& aTopoDS, Standard_Real length ) void RepairGUI_OrientationDlg::MakeOrientationSimulationAndDisplay(const TopoDS_Shape& aTopoDS, Standard_Real length )
{ {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
TopoDS_Compound aCompound1, aCompound2 ; TopoDS_Compound aCompound1, aCompound2 ;
@ -525,8 +526,8 @@ void RepairGUI_OrientationDlg::MakeOrientationSimulationAndDisplay(const TopoDS_
else else
tmpShape.Orientation(TopAbs_FORWARD) ; tmpShape.Orientation(TopAbs_FORWARD) ;
} }
if( myGeomGUI->CreateArrowForLinearEdge( tmpShape, mySimulationTopoDs ) ) { if( myGeomBase->CreateArrowForLinearEdge( tmpShape, mySimulationTopoDs ) ) {
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
} }
return ; return ;
} }
@ -599,7 +600,7 @@ void RepairGUI_OrientationDlg::MakeOrientationSimulationAndDisplay(const TopoDS_
mySimulationTopoDs = aCompound2 ; mySimulationTopoDs = aCompound2 ;
} }
if(!mySimulationTopoDs.IsNull() ) if(!mySimulationTopoDs.IsNull() )
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs) ; myGeomBase->DisplaySimulationShape(mySimulationTopoDs) ;
return ; return ;
} }

View File

@ -64,7 +64,8 @@ public:
private : private :
RepairGUI* myRepairGUI; RepairGUI* myRepairGUI;
GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ 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 */ TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */
SALOME_Selection* mySelection ; /* User shape selection */ SALOME_Selection* mySelection ; /* User shape selection */
GEOM::GEOM_Shape_var myGeomShape ; /* is myShape */ GEOM::GEOM_Shape_var myGeomShape ; /* is myShape */

View File

@ -29,21 +29,7 @@
using namespace std; using namespace std;
#include "RepairGUI_SewingDlg.h" #include "RepairGUI_SewingDlg.h"
#include <qbuttongroup.h> #include "QAD_Config.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>
//================================================================================= //=================================================================================
// class : RepairGUI_SewingDlg() // class : RepairGUI_SewingDlg()
@ -52,108 +38,32 @@ using namespace std;
// The dialog will by default be modeless, unless you set 'modal' to // The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog. // TRUE to construct a modal dialog.
//================================================================================= //=================================================================================
RepairGUI_SewingDlg::RepairGUI_SewingDlg( QWidget* parent, const char* name, RepairGUI* theRepairGUI, SALOME_Selection* Sel, bool modal, WFlags fl ) 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 ) :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 image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_SEWING")));
QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap( "GEOM",tr("ICON_SELECT"))); QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
if ( !name ) setCaption(tr("GEOM_SEWING_TITLE"));
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->setTitle( tr( "GEOM_SEWING" ) ); RadioButton1->setPixmap(image0);
GroupConstructors->setExclusive( TRUE ); RadioButton2->close(TRUE);
GroupConstructors->setColumnLayout(0, Qt::Vertical ); RadioButton3->close(TRUE);
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 );
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);
/***************************************************************/ /***************************************************************/
GroupButtons = new QGroupBox( this, "GroupButtons" );
GroupButtons->setGeometry( QRect( 10, 10, 281, 48 ) ); /* Initialisations */
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; myRepairGUI = theRepairGUI;
Init(Sel) ; /* Initialisations */ Init();
} }
@ -171,102 +81,63 @@ RepairGUI_SewingDlg::~RepairGUI_SewingDlg()
// function : Init() // function : Init()
// purpose : // purpose :
//================================================================================= //=================================================================================
void RepairGUI_SewingDlg::Init( SALOME_Selection* Sel ) void RepairGUI_SewingDlg::Init()
{ {
LineEditC1A1->setMaxLength( 10 ); /* init variables */
QDoubleValidator *Va = new QDoubleValidator( -0.000001, +10000.0, 3, LineEditC1A1 ) ; myEditCurrentArgument = GroupPoints->LineEdit1;
LineEditC1A1->setValidator( Va ) ;
GroupC1->show(); myOkListShapes = false;
myConstructorId = 0 ; myPrecision = 0.00001;
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 ? /* Get setting of step value from file configuration */
QString St = QAD_CONFIG->getSetting("Geometry:SettingsGeomStep");
step = St.toDouble();
/* Filter definitions */ /* min, max, step and decimals for spin boxes */
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); GroupPoints->SpinBox_DX->RangeStepAndValidator(0.00001, 999.99999, step, 5);
myGeom = GEOM::GEOM_Gen::_narrow(comp); GroupPoints->SpinBox_DX->SetValue(myPrecision);
/* signals and slots connections */ /* signals and slots connections */
connect( buttonOk, SIGNAL( clicked() ), this, SLOT( ClickOnOk() ) ); connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk()));
connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ) ; connect(buttonApply, SIGNAL(clicked()), this, SLOT(ClickOnApply()));
connect( buttonApply, SIGNAL( clicked() ), this, SLOT(ClickOnApply() ) );
connect( GroupConstructors, SIGNAL(clicked(int) ), SLOT( ConstructorsClicked(int) ) );
connect( SelectButtonC1A1, SIGNAL (clicked() ), this, SLOT( SetEditCurrentArgument() ) ) ; connect(GroupPoints->PushButton1, 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 */ connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double)));
int x, y ; connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), GroupPoints->SpinBox_DX, SLOT(SetStep(double)));
myGeomGUI->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ; connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
this->show() ; /* displays Dialog */
return ; /* displays Dialog */
GroupPoints->show();
this->show();
return;
} }
//=================================================================================
// function : ConstructorsClicked()
// purpose : Radio button management
//=================================================================================
void RepairGUI_SewingDlg::ConstructorsClicked(int constructorId)
{
return ;
}
//================================================================================= //=================================================================================
// function : ClickOnOk() // function : ClickOnOk()
// purpose : // purpose :
//================================================================================= //=================================================================================
void RepairGUI_SewingDlg::ClickOnOk() void RepairGUI_SewingDlg::ClickOnOk()
{ {
this->ClickOnApply() ; this->ClickOnApply();
this->ClickOnCancel() ; ClickOnCancel();
return;
return ;
} }
//================================================================================= //=================================================================================
// function : ClickOnApply() // function : ClickOnApply()
// purpose : // purpose :
//================================================================================= //=================================================================================
void RepairGUI_SewingDlg::ClickOnApply() void RepairGUI_SewingDlg::ClickOnApply()
{ {
switch(myConstructorId) myGeomGUI->GetDesktop()->putInfo(tr(""));
{ if(myOkListShapes)
case 0 : myRepairGUI->MakeSewingAndDisplay(myListShapes, myPrecision);
{ return;
if(myOkListShapes) {
myRepairGUI->MakeSewingAndDisplay( myListShapes, myPrecision ) ;
}
break ;
}
}
// accept();
return ;
}
//=================================================================================
// function : ClickOnCancel()
// purpose :
//=================================================================================
void RepairGUI_SewingDlg::ClickOnCancel()
{
myGeomGUI->ResetState() ;
reject() ;
return ;
} }
@ -276,27 +147,22 @@ void RepairGUI_SewingDlg::ClickOnCancel()
//================================================================================= //=================================================================================
void RepairGUI_SewingDlg::SelectionIntoArgument() void RepairGUI_SewingDlg::SelectionIntoArgument()
{ {
/* All this for first constructor */ myEditCurrentArgument->setText("");
// if(myEditCurrentArgument == LineEditC1A1 )
myOkListShapes = false;
myEditCurrentArgument->setText("") ;
QString aString = ""; /* name of selection */ QString aString = ""; /* name of selection */
myOkListShapes = false;
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
if ( nbSel < 2 ) { if(nbSel < 2)
return ; return;
}
myGeomGUI->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes) ; myGeomBase->ConvertListOfIOInListOfIOR(mySelection->StoredIObjects(), myListShapes);
myEditCurrentArgument->setText(aString) ; myEditCurrentArgument->setText(aString);
myOkListShapes = true ; myOkListShapes = true;
/* no simulation */ /* no simulation */
return ; return;
} }
//================================================================================= //=================================================================================
// function : SetEditCurrentArgument() // function : SetEditCurrentArgument()
// purpose : // purpose :
@ -304,46 +170,13 @@ void RepairGUI_SewingDlg::SelectionIntoArgument()
void RepairGUI_SewingDlg::SetEditCurrentArgument() void RepairGUI_SewingDlg::SetEditCurrentArgument()
{ {
QPushButton* send = (QPushButton*)sender(); QPushButton* send = (QPushButton*)sender();
switch (myConstructorId)
{ if(send == GroupPoints->PushButton1) {
case 0: /* default constructor */ GroupPoints->LineEdit1->setFocus();
{ myEditCurrentArgument = GroupPoints->LineEdit1;
if(send == SelectButtonC1A1) { this->SelectionIntoArgument();
LineEditC1A1->setFocus() ;
myEditCurrentArgument = LineEditC1A1;
} }
SelectionIntoArgument() ; return;
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) ;
}
return ;
} }
@ -353,12 +186,9 @@ void RepairGUI_SewingDlg::DeactivateActiveDialog()
//================================================================================= //=================================================================================
void RepairGUI_SewingDlg::ActivateThisDialog() void RepairGUI_SewingDlg::ActivateThisDialog()
{ {
/* Emit a signal to deactivate the active dialog */ GEOMBase_Skeleton::ActivateThisDialog();
myGeomGUI->EmitSignalDeactivateDialog() ; connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
GroupConstructors->setEnabled(true) ; return;
GroupC1->setEnabled(true) ;
GroupButtons->setEnabled(true) ;
return ;
} }
@ -368,21 +198,19 @@ void RepairGUI_SewingDlg::ActivateThisDialog()
//================================================================================= //=================================================================================
void RepairGUI_SewingDlg::enterEvent(QEvent* e) void RepairGUI_SewingDlg::enterEvent(QEvent* e)
{ {
if ( GroupConstructors->isEnabled() ) if(GroupConstructors->isEnabled())
return ; return;
ActivateThisDialog() ; this->ActivateThisDialog();
return ; return;
} }
//================================================================================= //=================================================================================
// function : closeEvent() // function : ValueChangedInSpinBox()
// purpose : // purpose :
//================================================================================= //=================================================================================
void RepairGUI_SewingDlg::closeEvent( QCloseEvent* e ) void RepairGUI_SewingDlg::ValueChangedInSpinBox(double newValue)
{ {
/* same than click on cancel button */ myPrecision = newValue;
this->ClickOnCancel() ; return;
return ;
} }

View File

@ -29,79 +29,45 @@
#ifndef DIALOGBOX_SEWING_H #ifndef DIALOGBOX_SEWING_H
#define DIALOGBOX_SEWING_H #define DIALOGBOX_SEWING_H
#include "GEOMBase_Skeleton.h"
#include "DlgRef_1Sel1Spin.h"
#include "RepairGUI.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;
//================================================================================= //=================================================================================
// class : RepairGUI_SewingDlg // class : RepairGUI_SewingDlg
// purpose : // purpose :
//================================================================================= //=================================================================================
class RepairGUI_SewingDlg : public QDialog class RepairGUI_SewingDlg : public GEOMBase_Skeleton
{ {
Q_OBJECT Q_OBJECT
public: 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(); ~RepairGUI_SewingDlg();
private: private:
void Init();
void enterEvent(QEvent* e);
RepairGUI* myRepairGUI; 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 */ double step;
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 */
QButtonGroup* GroupConstructors; GEOM::GEOM_Gen::ListOfIOR myListShapes;
QRadioButton* Constructor1; Standard_Real myPrecision;
QGroupBox* GroupButtons; bool myOkListShapes; /* to check when arguments is defined */
QPushButton* buttonApply;
QPushButton* buttonOk; DlgRef_1Sel1Spin* GroupPoints;
QPushButton* buttonCancel;
QGroupBox* GroupC1;
QLineEdit* LineEditC1A1;
QLineEdit* LineEditC1A2;
QPushButton* SelectButtonC1A1;
QLabel* TextLabelC1A1;
QLabel* TextLabelC1A2;
private slots: private slots:
void ConstructorsClicked(int constructorId);
void ClickOnOk(); void ClickOnOk();
void ClickOnCancel();
void ClickOnApply(); void ClickOnApply();
void SetEditCurrentArgument() ; void ActivateThisDialog();
void LineEditReturnPressed() ; void SelectionIntoArgument();
void SelectionIntoArgument() ; void SetEditCurrentArgument();
void DeactivateActiveDialog() ; void ValueChangedInSpinBox(double newValue);
void ActivateThisDialog() ;
protected:
QGridLayout* RepairGUI_SewingDlgLayout;
QGridLayout* GroupConstructorsLayout;
QGridLayout* GroupButtonsLayout;
QGridLayout* GroupC1Layout;
}; };
#endif // DIALOGBOX_SEWING_H #endif // DIALOGBOX_SEWING_H

View File

@ -29,6 +29,9 @@
using namespace std; using namespace std;
#include "RepairGUI_SuppressFacesDlg.h" #include "RepairGUI_SuppressFacesDlg.h"
#include "DisplayGUI.h"
#include <qbuttongroup.h> #include <qbuttongroup.h>
#include <qcheckbox.h> #include <qcheckbox.h>
#include <qgroupbox.h> #include <qgroupbox.h>
@ -194,7 +197,8 @@ void RepairGUI_SuppressFacesDlg::Init( SALOME_Selection* Sel, Handle (AIS_Intera
myIC = ic ; myIC = ic ;
myUseLocalContext = false ; myUseLocalContext = false ;
myOkShape = false ; myOkShape = false ;
myGeomGUI = GEOMBase_Context::GetGeomGUI() ; myGeomBase = new GEOMBase() ;
myGeomGUI = GEOMContext::GetGeomGUI() ;
/* Select sub shapes mode not checked */ /* Select sub shapes mode not checked */
CheckBox1->setChecked( FALSE ); CheckBox1->setChecked( FALSE );
@ -220,7 +224,7 @@ void RepairGUI_SuppressFacesDlg::Init( SALOME_Selection* Sel, Handle (AIS_Intera
/* Move widget on the botton right corner of main widget */ /* Move widget on the botton right corner of main widget */
int x, y ; int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ; myGeomBase->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ; this->move( x, y ) ;
this->show() ; /* display Dialog */ this->show() ; /* display Dialog */
return ; return ;
@ -293,7 +297,7 @@ void RepairGUI_SuppressFacesDlg::ClickOnClose()
if(myUseLocalContext) { if(myUseLocalContext) {
myIC->CloseLocalContext(myLocalContextId) ; myIC->CloseLocalContext(myLocalContextId) ;
this->myUseLocalContext = false ; this->myUseLocalContext = false ;
GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); DisplayGUI* myDisplayGUI = new DisplayGUI();
myDisplayGUI->OnDisplayAll(true) ; myDisplayGUI->OnDisplayAll(true) ;
} }
reject() ; reject() ;
@ -314,7 +318,7 @@ void RepairGUI_SuppressFacesDlg::SelectionIntoArgument()
QString aString = ""; /* name of selection */ QString aString = ""; /* name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel != 1 ) if ( nbSel != 1 )
return ; return ;
@ -322,7 +326,7 @@ void RepairGUI_SuppressFacesDlg::SelectionIntoArgument()
TopoDS_Shape S ; TopoDS_Shape S ;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) if( !myGeomBase->GetTopoFromSelection(mySelection, S) )
return ; return ;
if( !IO->hasEntry() ) { if( !IO->hasEntry() ) {
@ -413,7 +417,7 @@ void RepairGUI_SuppressFacesDlg::DeactivateActiveDialog()
GroupButtons->setEnabled(false) ; GroupButtons->setEnabled(false) ;
myGeomGUI->ResetState() ; myGeomGUI->ResetState() ;
myGeomGUI->SetActiveDialogBox(0) ; myGeomGUI->SetActiveDialogBox(0) ;
GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); DisplayGUI* myDisplayGUI = new DisplayGUI();
myDisplayGUI->OnDisplayAll(true) ; myDisplayGUI->OnDisplayAll(true) ;
} }
return ; return ;
@ -480,13 +484,14 @@ void RepairGUI_SuppressFacesDlg::ActivateUserSelection()
if( this->myUseLocalContext ) { if( this->myUseLocalContext ) {
myIC->CloseLocalContext(myLocalContextId) ; myIC->CloseLocalContext(myLocalContextId) ;
this->myUseLocalContext = false ; this->myUseLocalContext = false ;
GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); DisplayGUI* myDisplayGUI = new DisplayGUI();
myDisplayGUI->OnDisplayAll(true) ; myDisplayGUI->OnDisplayAll(true) ;
} }
if( myOkShape && myOkSelectSubMode ) { if( myOkShape && myOkSelectSubMode ) {
/* local context is defined into the method : 4 = FACES sub selection */ /* 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 ; myUseLocalContext = true ;
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_FACE")) ; myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_SELECT_FACE")) ;
} }
@ -516,7 +521,7 @@ void RepairGUI_SuppressFacesDlg::ResetStateOfDialog()
if( this->myUseLocalContext ) { if( this->myUseLocalContext ) {
myIC->CloseLocalContext(this->myLocalContextId) ; myIC->CloseLocalContext(this->myLocalContextId) ;
this->myUseLocalContext = false ; this->myUseLocalContext = false ;
GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); DisplayGUI* myDisplayGUI = new DisplayGUI();
myDisplayGUI->OnDisplayAll(true) ; myDisplayGUI->OnDisplayAll(true) ;
} }
return ; return ;

View File

@ -80,7 +80,8 @@ private :
bool myUseLocalContext ; /* true when this method as opened a local context */ bool myUseLocalContext ; /* true when this method as opened a local context */
GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ 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 */ SALOME_Selection* mySelection ; /* User shape selection */
TopoDS_Shape myShape ; TopoDS_Shape myShape ;

View File

@ -29,7 +29,7 @@
using namespace std; using namespace std;
#include "RepairGUI_SuppressHoleDlg.h" #include "RepairGUI_SuppressHoleDlg.h"
#include "DisplayGUI.h"
#include "TopExp_Explorer.hxx" #include "TopExp_Explorer.hxx"
@ -294,7 +294,8 @@ void RepairGUI_SuppressHoleDlg::Init( SALOME_Selection* Sel, Handle (AIS_Interac
myListOfIdWire->length(0) ; myListOfIdWire->length(0) ;
myListOfIdEndFace->length(0) ; myListOfIdEndFace->length(0) ;
myGeomGUI = GEOMBase_Context::GetGeomGUI() ; myGeomBase = new GEOMBase() ;
myGeomGUI = GEOMContext::GetGeomGUI() ;
/* Select sub modes not checked */ /* Select sub modes not checked */
CheckBox1->setChecked( FALSE ); /* sub mode GEOM::FACE */ CheckBox1->setChecked( FALSE ); /* sub mode GEOM::FACE */
@ -334,7 +335,7 @@ void RepairGUI_SuppressHoleDlg::Init( SALOME_Selection* Sel, Handle (AIS_Interac
/* Move widget on the botton right corner of main widget */ /* Move widget on the botton right corner of main widget */
int x, y ; int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ; myGeomBase->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ; this->move( x, y ) ;
this->show() ; /* display Dialog */ this->show() ; /* display Dialog */
return ; return ;
@ -417,9 +418,9 @@ void RepairGUI_SuppressHoleDlg::ClickOnApply()
if( !CheckBox3->isChecked() ) { if( !CheckBox3->isChecked() ) {
/* Call method to get sub shape selection of GEOM::WIRE */ /* 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 */ myDisplayGUI->OnDisplayAll(true) ;/* Display all objects so that next method using ic can memorize them */
if( !aTest || myListOfIdWire->length() != 1 ) { if( !aTest || myListOfIdWire->length() != 1 ) {
CheckBox2->setChecked(FALSE) ; CheckBox2->setChecked(FALSE) ;
@ -435,9 +436,9 @@ void RepairGUI_SuppressHoleDlg::ClickOnApply()
else { /* CheckBox3->isChecked() */ else { /* CheckBox3->isChecked() */
/* Call method to get sub shape selection of END GEOM::FACE */ /* 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 */ myDisplayGUI->OnDisplayAll(true) ; /* Display all objects so that next method using ic can memorize them */
if( !aTest || myListOfIdEndFace->length() != 1 ) { if( !aTest || myListOfIdEndFace->length() != 1 ) {
CheckBox3->setChecked(FALSE) ; CheckBox3->setChecked(FALSE) ;
@ -458,9 +459,9 @@ void RepairGUI_SuppressHoleDlg::ClickOnApply()
if( CheckBoxC2_1->isChecked() ) { if( CheckBoxC2_1->isChecked() ) {
/* Call method to get sub shape selection of one or more GEOM::WIRE(s) on a face or a shell */ /* 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 */ myDisplayGUI->OnDisplayAll(true) ; /* Display all objects so that next method using ic can memorize them */
if( !aTest || myListOfIdWire->length() < 1 ) { if( !aTest || myListOfIdWire->length() < 1 ) {
@ -505,7 +506,7 @@ void RepairGUI_SuppressHoleDlg::ClickOnClose()
if(myUseLocalContext) { if(myUseLocalContext) {
myIC->CloseLocalContext(myLocalContextId) ; myIC->CloseLocalContext(myLocalContextId) ;
this->myUseLocalContext = false ; this->myUseLocalContext = false ;
GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); DisplayGUI* myDisplayGUI = new DisplayGUI();
myDisplayGUI->OnDisplayAll(true) ; myDisplayGUI->OnDisplayAll(true) ;
} }
} }
@ -528,7 +529,7 @@ void RepairGUI_SuppressHoleDlg::SelectionIntoArgument()
QString aString = ""; /* Name of selection */ QString aString = ""; /* Name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ;
if ( nbSel != 1 ) if ( nbSel != 1 )
return ; return ;
@ -536,7 +537,7 @@ void RepairGUI_SuppressHoleDlg::SelectionIntoArgument()
TopoDS_Shape S ; TopoDS_Shape S ;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) if( !myGeomBase->GetTopoFromSelection(mySelection, S) )
return ; return ;
if ( S.IsNull() || S.ShapeType() == TopAbs_VERTEX || S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE ) { if ( S.IsNull() || S.ShapeType() == TopAbs_VERTEX || S.ShapeType() == TopAbs_EDGE || S.ShapeType() == TopAbs_WIRE ) {
@ -631,7 +632,7 @@ void RepairGUI_SuppressHoleDlg::LineEditReturnPressed()
/* so SelectionIntoArgument() is automatically called. */ /* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ; const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ; QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { if( myGeomBase->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ; myEditCurrentArgument->setText( objectUserName ) ;
} }
@ -657,7 +658,7 @@ void RepairGUI_SuppressHoleDlg::DeactivateActiveDialog()
myGeomGUI->ResetState() ; myGeomGUI->ResetState() ;
myGeomGUI->SetActiveDialogBox(0) ; myGeomGUI->SetActiveDialogBox(0) ;
GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); DisplayGUI* myDisplayGUI = new DisplayGUI();
myDisplayGUI->OnDisplayAll(true) ; myDisplayGUI->OnDisplayAll(true) ;
} }
return ; return ;
@ -732,7 +733,8 @@ void RepairGUI_SuppressHoleDlg::ActivateUserFaceSelection()
if( CheckBox1->isChecked() ) { if( CheckBox1->isChecked() ) {
/* local context is opened into the method : Prepare GEOM::FACE sub selection */ /* 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 ; myUseLocalContext = true ;
myGeomGUI->GetDesktop()->putInfo( tr("GEOM_SUPPRESSHOLE_SELECTFACE") ) ; myGeomGUI->GetDesktop()->putInfo( tr("GEOM_SUPPRESSHOLE_SELECTFACE") ) ;
} }
@ -768,9 +770,9 @@ void RepairGUI_SuppressHoleDlg::ActivateUserWireSelection()
if( CheckBox1->isChecked() ) { if( CheckBox1->isChecked() ) {
/* Get sub shape selection GEOM::FACE : local context is closed */ /* 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 */ myDisplayGUI->OnDisplayAll(true) ; /* Display all objects so that next method using ic can memorize them */
if( !aTest || myListOfIdFace->length() != 1 ) { if( !aTest || myListOfIdFace->length() != 1 ) {
CheckBox1->setChecked(FALSE) ; CheckBox1->setChecked(FALSE) ;
@ -792,7 +794,8 @@ void RepairGUI_SuppressHoleDlg::ActivateUserWireSelection()
/* Get the face selection */ /* Get the face selection */
this->myFace = FaceFromList(myShape, myListOfIdFace) ; this->myFace = FaceFromList(myShape, myListOfIdFace) ;
/* Local context is opened into the method : Prepare GEOM::WIRE sub selection into a face */ /* 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 ; myUseLocalContext = true ;
myGeomGUI->GetDesktop()->putInfo( tr("GEOM_SUPPRESSHOLE_SELECTWIRE") ) ; myGeomGUI->GetDesktop()->putInfo( tr("GEOM_SUPPRESSHOLE_SELECTWIRE") ) ;
} }
@ -829,9 +832,9 @@ void RepairGUI_SuppressHoleDlg::ActivateUserEndFaceSelection()
if( CheckBox2->isChecked() ) { if( CheckBox2->isChecked() ) {
/* Call method to get sub shape selection for the GEOM::WIRE into myFace : local context is closed */ /* 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 */ myDisplayGUI->OnDisplayAll(true) ; /* Display all objects so that next method using ic can memorize them */
if( !aTest || myListOfIdWire->length() != 1 ) { if( !aTest || myListOfIdWire->length() != 1 ) {
@ -849,7 +852,8 @@ void RepairGUI_SuppressHoleDlg::ActivateUserEndFaceSelection()
if( CheckBox3->isChecked() ) { if( CheckBox3->isChecked() ) {
/* Local context is opened into the method : prepare GEOM::FACE(end) into myShape sub selection */ /* 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 ; myUseLocalContext = true ;
myGeomGUI->GetDesktop()->putInfo( tr("GEOM_SUPPRESSHOLE_SELECTFACE_END") ) ; myGeomGUI->GetDesktop()->putInfo( tr("GEOM_SUPPRESSHOLE_SELECTFACE_END") ) ;
} }
@ -886,7 +890,8 @@ void RepairGUI_SuppressHoleDlg::ActivateUserWiresOnFaceShellSelection()
if( CheckBoxC2_1->isChecked() ) { if( CheckBoxC2_1->isChecked() ) {
/* Local context is opened to prepare GEOM::WIRE(S) selection into 'myShape' that is a (main) face */ /* 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 ; myUseLocalContext = true ;
myGeomGUI->GetDesktop()->putInfo( tr("GEOM_SUPPRESSHOLE_SELECT_HOLES_ON_FACE") ) ; myGeomGUI->GetDesktop()->putInfo( tr("GEOM_SUPPRESSHOLE_SELECT_HOLES_ON_FACE") ) ;
} }
@ -903,7 +908,7 @@ void RepairGUI_SuppressHoleDlg::ActivateUserWiresOnFaceShellSelection()
// purpose : Return the face (selected by user) that is a sub shape of 'aShape' // purpose : Return the face (selected by user) that is a sub shape of 'aShape'
// : and which unique index is in 'ListOfSub'. // : and which unique index is in 'ListOfSub'.
// : This allows opening a local context with this face loaded. // : 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, TopoDS_Shape RepairGUI_SuppressHoleDlg::FaceFromList( const TopoDS_Shape& aShape,
const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfSub ) const GEOM::GEOM_Shape::ListOfSubShapeID& ListOfSub )
@ -967,7 +972,7 @@ void RepairGUI_SuppressHoleDlg::ResetPartial()
if( this->myUseLocalContext ) { if( this->myUseLocalContext ) {
myIC->CloseLocalContext(this->myLocalContextId) ; myIC->CloseLocalContext(this->myLocalContextId) ;
this->myUseLocalContext = false ; this->myUseLocalContext = false ;
GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); DisplayGUI* myDisplayGUI = new DisplayGUI();
myDisplayGUI->OnDisplayAll(true) ; myDisplayGUI->OnDisplayAll(true) ;
} }
} }

View File

@ -85,7 +85,8 @@ private :
bool myUseLocalContext ; /* true when this method as opened a local context */ bool myUseLocalContext ; /* true when this method as opened a local context */
GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ 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 */ SALOME_Selection* mySelection ; /* User shape selection */
TopoDS_Shape myShape ; /* Main shape selected */ TopoDS_Shape myShape ; /* Main shape selected */

View File

@ -35,7 +35,7 @@ VPATH=.:@srcdir@:@top_srcdir@/idl
@COMMENCE@ @COMMENCE@
# header files # header files
EXPORT_HEADERS= TransformationGUI.h EXPORT_HEADERS=
# Libraries targets # Libraries targets
LIB = libTransformationGUI.la LIB = libTransformationGUI.la
@ -72,6 +72,6 @@ LIB_SERVER_IDL =
CPPFLAGS += $(QT_INCLUDES) $(VTK_INCLUDES) $(OGL_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome 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 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@ @CONCLUDE@

View File

@ -29,6 +29,8 @@
using namespace std; using namespace std;
#include "TransformationGUI.h" #include "TransformationGUI.h"
#include "SALOMEGUI_QtCatchCorbaException.hxx"
#include "TransformationGUI_TranslationDlg.h" // Method TRANSLATION #include "TransformationGUI_TranslationDlg.h" // Method TRANSLATION
#include "TransformationGUI_RotationDlg.h" // Method ROTATION #include "TransformationGUI_RotationDlg.h" // Method ROTATION
#include "TransformationGUI_MirrorDlg.h" // Method MIRROR #include "TransformationGUI_MirrorDlg.h" // Method MIRROR
@ -36,8 +38,6 @@ using namespace std;
#include "TransformationGUI_MultiTranslationDlg.h" // Method MULTI TRANSLATION #include "TransformationGUI_MultiTranslationDlg.h" // Method MULTI TRANSLATION
#include "TransformationGUI_MultiRotationDlg.h" // Method MULTI ROTATION #include "TransformationGUI_MultiRotationDlg.h" // Method MULTI ROTATION
static TransformationGUI* myTransformationGUI = 0;
//======================================================================= //=======================================================================
// function : TransformationGUI() // function : TransformationGUI()
// purpose : Constructor // purpose : Constructor
@ -45,9 +45,11 @@ static TransformationGUI* myTransformationGUI = 0;
TransformationGUI::TransformationGUI() : TransformationGUI::TransformationGUI() :
QObject() QObject()
{ {
myGeomGUI = GEOMBase_Context::GetGeomGUI(); myGeomBase = new GEOMBase();
Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM"); myGeomGUI = GEOMContext::GetGeomGUI();
myGeom = GEOM::GEOM_Gen::_narrow(comp); // Engines::Component_var comp = QAD_Application::getDesktop()->getEngine("FactoryServer", "GEOM");
// myGeom = GEOM::GEOM_Gen::_narrow(comp);
myGeom = myGeomGUI->myComponentGeom;
} }
@ -60,25 +62,13 @@ TransformationGUI::~TransformationGUI()
} }
//=======================================================================
// function : GetOrCreateGUI()
// purpose : Gets or create an object 'GUI' with initialisations
// : Returns 'GUI' as a pointer
//=======================================================================
TransformationGUI* TransformationGUI::GetOrCreateGUI()
{
myTransformationGUI = new TransformationGUI();
return myTransformationGUI;
}
//======================================================================= //=======================================================================
// function : OnGUIEvent() // function : OnGUIEvent()
// purpose : // purpose :
//======================================================================= //=======================================================================
bool TransformationGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent) bool TransformationGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
{ {
TransformationGUI::GetOrCreateGUI(); TransformationGUI* myTransformationGUI = new TransformationGUI();
myTransformationGUI->myGeomGUI->EmitSignalDeactivateDialog(); myTransformationGUI->myGeomGUI->EmitSignalDeactivateDialog();
SALOME_Selection* Sel = SALOME_Selection::Selection(myTransformationGUI->myGeomGUI->GetActiveStudy()->getSelection()); SALOME_Selection* Sel = SALOME_Selection::Selection(myTransformationGUI->myGeomGUI->GetActiveStudy()->getSelection());
@ -137,7 +127,7 @@ void TransformationGUI::MakeTranslationAndDisplay(GEOM::GEOM_Shape_ptr Shape, gp
return; return;
} }
result->NameType(Shape->NameType()); result->NameType(Shape->NameType());
if(myGeomGUI->Display(result)) if(myGeomBase->Display(result))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
} }
catch(const SALOME::SALOME_Exception& S_ex) { catch(const SALOME::SALOME_Exception& S_ex) {
@ -163,7 +153,7 @@ void TransformationGUI::MakeRotationAndDisplay(GEOM::GEOM_Shape_ptr Shape, const
return ; return ;
} }
result->NameType(Shape->NameType()); result->NameType(Shape->NameType());
if(myGeomGUI->Display(result)) if(myGeomBase->Display(result))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
} }
catch(const SALOME::SALOME_Exception& S_ex) { catch(const SALOME::SALOME_Exception& S_ex) {
@ -186,7 +176,7 @@ void TransformationGUI::MakeMirrorAndDisplay(GEOM::GEOM_Shape_ptr Shape1, GEOM::
return; return;
} }
result->NameType(Shape1->NameType()); result->NameType(Shape1->NameType());
if(myGeomGUI->Display(result)) if(myGeomBase->Display(result))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
} }
catch(const SALOME::SALOME_Exception& S_ex) { catch(const SALOME::SALOME_Exception& S_ex) {
@ -207,7 +197,7 @@ void TransformationGUI::MakeScaleAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp
GEOM::PointStruct P = myGeom->MakePointStruct(centralPoint.X(), centralPoint.Y(), centralPoint.Z()); GEOM::PointStruct P = myGeom->MakePointStruct(centralPoint.X(), centralPoint.Y(), centralPoint.Z());
GEOM::GEOM_Shape_var result = myGeom->MakeScaleTransform(Shape, P, factor); GEOM::GEOM_Shape_var result = myGeom->MakeScaleTransform(Shape, P, factor);
result->NameType(Shape->NameType()); result->NameType(Shape->NameType());
if(myGeomGUI->Display(result)) if(myGeomBase->Display(result))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
else else
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE"));
@ -236,7 +226,7 @@ void TransformationGUI::MakeMultiTranslation1DAndDisplay(GEOM::GEOM_Shape_ptr Sh
return; return;
} }
result->NameType(tr("GEOM_COMPOUND")); result->NameType(tr("GEOM_COMPOUND"));
if(myGeomGUI->Display(result)) if(myGeomBase->Display(result))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
} }
catch(const SALOME::SALOME_Exception& S_ex) { catch(const SALOME::SALOME_Exception& S_ex) {
@ -267,7 +257,7 @@ void TransformationGUI::MakeMultiTranslation2DAndDisplay(GEOM::GEOM_Shape_ptr Sh
return; return;
} }
result->NameType(tr("GEOM_COMPOUND")); result->NameType(tr("GEOM_COMPOUND"));
if(myGeomGUI->Display(result)) if(myGeomBase->Display(result))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
} }
catch(const SALOME::SALOME_Exception& S_ex) { catch(const SALOME::SALOME_Exception& S_ex) {
@ -295,7 +285,7 @@ void TransformationGUI::MakeMultiRotation1DAndDisplay(GEOM::GEOM_Shape_ptr Shape
return; return;
} }
result->NameType(tr("GEOM_COMPOUND")); result->NameType(tr("GEOM_COMPOUND"));
if(myGeomGUI->Display(result)) if(myGeomBase->Display(result))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
} }
catch(const SALOME::SALOME_Exception& S_ex) { catch(const SALOME::SALOME_Exception& S_ex) {
@ -325,7 +315,7 @@ void TransformationGUI::MakeMultiRotation2DAndDisplay(GEOM::GEOM_Shape_ptr Shape
return; return;
} }
result->NameType(tr("GEOM_COMPOUND")); result->NameType(tr("GEOM_COMPOUND"));
if(myGeomGUI->Display(result)) if(myGeomBase->Display(result))
myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE")); myGeomGUI->GetDesktop()->putInfo(tr("GEOM_PRP_DONE"));
} }
catch(const SALOME::SALOME_Exception& S_ex) { catch(const SALOME::SALOME_Exception& S_ex) {

View File

@ -29,8 +29,7 @@
#ifndef TRANSFORMATIONGUI_H #ifndef TRANSFORMATIONGUI_H
#define TRANSFORMATIONGUI_H #define TRANSFORMATIONGUI_H
#include "GEOMBase_Display.h" #include "GEOMBase.h"
#include "QAD_Config.h"
//================================================================================= //=================================================================================
// class : TransformationGUI // class : TransformationGUI
@ -44,7 +43,6 @@ public :
TransformationGUI(); TransformationGUI();
~TransformationGUI(); ~TransformationGUI();
static TransformationGUI* GetOrCreateGUI();
static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); static bool OnGUIEvent(int theCommandID, QAD_Desktop* parent);
void MakeTranslationAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Vec V); void MakeTranslationAndDisplay(GEOM::GEOM_Shape_ptr Shape, const gp_Vec V);
@ -64,7 +62,8 @@ public :
const gp_Dir Dir, const gp_Pnt Loc, const double Ang, const gp_Dir Dir, const gp_Pnt Loc, const double Ang,
const short NbTimes1, const double Step, const short NbTimes2); const short NbTimes1, const double Step, const short NbTimes2);
GEOMBase_Context* myGeomGUI; GEOMBase* myGeomBase;
GEOMContext* myGeomGUI;
GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */ GEOM::GEOM_Gen_var myGeom; /* Current Geom Component */
}; };

View File

@ -134,7 +134,7 @@ void TransformationGUI_MirrorDlg::ClickOnApply()
myGeomGUI->GetDesktop()->putInfo(tr("")); myGeomGUI->GetDesktop()->putInfo(tr(""));
if (mySimulationTopoDs.IsNull()) if (mySimulationTopoDs.IsNull())
return; return;
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
if(myOkShape1 && myOkShape2) if(myOkShape1 && myOkShape2)
@ -149,12 +149,12 @@ void TransformationGUI_MirrorDlg::ClickOnApply()
//================================================================================= //=================================================================================
void TransformationGUI_MirrorDlg::SelectionIntoArgument() void TransformationGUI_MirrorDlg::SelectionIntoArgument()
{ {
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
QString aString = ""; /* name of selection */ QString aString = ""; /* name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
if(nbSel != 1) { if(nbSel != 1) {
if(myEditCurrentArgument == GroupPoints->LineEdit1) if(myEditCurrentArgument == GroupPoints->LineEdit1)
myOkShape1 = false; myOkShape1 = false;
@ -167,11 +167,11 @@ void TransformationGUI_MirrorDlg::SelectionIntoArgument()
TopoDS_Shape S; TopoDS_Shape S;
Standard_Boolean testResult; Standard_Boolean testResult;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) if(!myGeomBase->GetTopoFromSelection(mySelection, S))
return; return;
if(myEditCurrentArgument == GroupPoints->LineEdit1) { if(myEditCurrentArgument == GroupPoints->LineEdit1) {
myGeomShape1 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult); myGeomShape1 = myGeomBase->ConvertIOinGEOMShape(IO, testResult);
if(!testResult) if(!testResult)
return; return;
myShape1 = S; myShape1 = S;
@ -179,7 +179,7 @@ void TransformationGUI_MirrorDlg::SelectionIntoArgument()
myOkShape1 = true; myOkShape1 = true;
} }
else if(myEditCurrentArgument == GroupPoints->LineEdit2) { else if(myEditCurrentArgument == GroupPoints->LineEdit2) {
myGeomShape2 = myGeomGUI->ConvertIOinGEOMShape(IO, testResult); myGeomShape2 = myGeomBase->ConvertIOinGEOMShape(IO, testResult);
if(!testResult) if(!testResult)
return ; return ;
myShape2 = S; myShape2 = S;
@ -258,7 +258,7 @@ void TransformationGUI_MirrorDlg::ActivateThisDialog()
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if(!mySimulationTopoDs.IsNull()) if(!mySimulationTopoDs.IsNull())
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
return; return;
} }
@ -269,7 +269,7 @@ void TransformationGUI_MirrorDlg::ActivateThisDialog()
//================================================================================= //=================================================================================
void TransformationGUI_MirrorDlg::MakeMirrorSimulationAndDisplay() void TransformationGUI_MirrorDlg::MakeMirrorSimulationAndDisplay()
{ {
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
try { try {
@ -289,7 +289,7 @@ void TransformationGUI_MirrorDlg::MakeMirrorSimulationAndDisplay()
if(mySimulationTopoDs.IsNull()) if(mySimulationTopoDs.IsNull())
return; return;
else else
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
} }
catch(Standard_Failure) { catch(Standard_Failure) {
MESSAGE("Exception catched in MakeMirrorSimulationAndDisplay"); MESSAGE("Exception catched in MakeMirrorSimulationAndDisplay");

View File

@ -29,7 +29,9 @@
using namespace std; using namespace std;
#include "TransformationGUI_MultiRotationDlg.h" #include "TransformationGUI_MultiRotationDlg.h"
#include "DisplayGUI.h"
#include "QAD_Config.h" #include "QAD_Config.h"
#include <Precision.hxx>
#include <BRepBuilderAPI_MakeVertex.hxx> #include <BRepBuilderAPI_MakeVertex.hxx>
#include <GeomAPI_ProjectPointOnCurve.hxx> #include <GeomAPI_ProjectPointOnCurve.hxx>
@ -362,7 +364,8 @@ void TransformationGUI_MultiRotationDlg::Init( SALOME_Selection* Sel )
Constructor1->setChecked( TRUE ); Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ; myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel; mySelection = Sel;
myGeomGUI = GEOMBase_Context::GetGeomGUI() ; myGeomBase = new GEOMBase() ;
myGeomGUI = GEOMContext::GetGeomGUI() ;
myOkBase = myOkDir = false ; myOkBase = myOkDir = false ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
@ -409,7 +412,7 @@ void TransformationGUI_MultiRotationDlg::Init( SALOME_Selection* Sel )
/* Move widget on the botton right corner of main widget */ /* Move widget on the botton right corner of main widget */
int x, y ; int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ; myGeomBase->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ; this->move( x, y ) ;
this->show() ; /* displays Dialog */ this->show() ; /* displays Dialog */
@ -428,7 +431,7 @@ void TransformationGUI_MultiRotationDlg::ReverseAngle(int state)
MakeMultiRotationSimulationAndDisplay() ; MakeMultiRotationSimulationAndDisplay() ;
} }
else { else {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
} }
return ; return ;
@ -442,7 +445,7 @@ void TransformationGUI_MultiRotationDlg::ReverseAngle(int state)
void TransformationGUI_MultiRotationDlg::ConstructorsClicked(int constructorId) void TransformationGUI_MultiRotationDlg::ConstructorsClicked(int constructorId)
{ {
myEditCurrentArgument->setText(tr("")) ; myEditCurrentArgument->setText(tr("")) ;
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
myAng = 45.0 ; myAng = 45.0 ;
@ -501,7 +504,7 @@ void TransformationGUI_MultiRotationDlg::ClickOnOk()
//================================================================================= //=================================================================================
void TransformationGUI_MultiRotationDlg::ClickOnApply() void TransformationGUI_MultiRotationDlg::ClickOnApply()
{ {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
myGeomGUI->GetDesktop()->putInfo( tr("") ) ; myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
switch(myConstructorId) switch(myConstructorId)
@ -532,7 +535,7 @@ void TransformationGUI_MultiRotationDlg::ClickOnApply()
void TransformationGUI_MultiRotationDlg::ClickOnCancel() void TransformationGUI_MultiRotationDlg::ClickOnCancel()
{ {
mySelection->ClearFilters() ; mySelection->ClearFilters() ;
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
disconnect( mySelection, 0, this, 0 ); disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ; myGeomGUI->ResetState() ;
@ -564,7 +567,7 @@ void TransformationGUI_MultiRotationDlg::LineEditReturnPressed()
/* so SelectionIntoArgument() is automatically called. */ /* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ; const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ; QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { if( myGeomBase->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ; myEditCurrentArgument->setText( objectUserName ) ;
} }
return ; return ;
@ -579,12 +582,12 @@ void TransformationGUI_MultiRotationDlg::LineEditReturnPressed()
void TransformationGUI_MultiRotationDlg::SelectionIntoArgument() void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText("") ; myEditCurrentArgument->setText("") ;
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
/* Name of future selection */ /* Name of future selection */
QString aString = ""; QString aString = "";
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ;
TopoDS_Shape S; TopoDS_Shape S;
Standard_Boolean testResult ; Standard_Boolean testResult ;
@ -606,11 +609,11 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
} }
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) if( !myGeomBase->GetTopoFromSelection(mySelection, S) )
return ; return ;
if ( myEditCurrentArgument == LineEditC1A1 ) { if ( myEditCurrentArgument == LineEditC1A1 ) {
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult) ;
if( !testResult ) if( !testResult )
return ; return ;
myEditCurrentArgument->setText(aString) ; myEditCurrentArgument->setText(aString) ;
@ -629,7 +632,7 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
MakeMultiRotationSimulationAndDisplay() ; MakeMultiRotationSimulationAndDisplay() ;
} }
else { else {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
} }
break; break;
@ -649,11 +652,11 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
} }
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) if( !myGeomBase->GetTopoFromSelection(mySelection, S) )
return ; return ;
if ( myEditCurrentArgument == LineEditC2A1 ) { if ( myEditCurrentArgument == LineEditC2A1 ) {
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult) ;
if( !testResult ) if( !testResult )
return ; return ;
myEditCurrentArgument->setText(aString) ; myEditCurrentArgument->setText(aString) ;
@ -672,7 +675,7 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
MakeMultiRotationSimulationAndDisplay() ; MakeMultiRotationSimulationAndDisplay() ;
} }
else { else {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
} }
break; break;
@ -752,7 +755,7 @@ void TransformationGUI_MultiRotationDlg::ValueChangedInt( int newIntValue )
MakeMultiRotationSimulationAndDisplay() ; MakeMultiRotationSimulationAndDisplay() ;
} }
else { else {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
} }
break; break;
@ -763,7 +766,7 @@ void TransformationGUI_MultiRotationDlg::ValueChangedInt( int newIntValue )
MakeMultiRotationSimulationAndDisplay() ; MakeMultiRotationSimulationAndDisplay() ;
} }
else { else {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
} }
break; break;
@ -796,7 +799,7 @@ void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox( double newValue
MakeMultiRotationSimulationAndDisplay() ; MakeMultiRotationSimulationAndDisplay() ;
} }
else { else {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
} }
break; break;
@ -807,7 +810,7 @@ void TransformationGUI_MultiRotationDlg::ValueChangedInSpinBox( double newValue
MakeMultiRotationSimulationAndDisplay() ; MakeMultiRotationSimulationAndDisplay() ;
} }
else { else {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
} }
break; break;
@ -829,11 +832,11 @@ void TransformationGUI_MultiRotationDlg::DeactivateActiveDialog()
GroupC2->setEnabled(false) ; GroupC2->setEnabled(false) ;
GroupButtons->setEnabled(false) ; GroupButtons->setEnabled(false) ;
disconnect( mySelection, 0, this, 0 ); disconnect( mySelection, 0, this, 0 );
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySelection->ClearFilters() ; mySelection->ClearFilters() ;
myGeomGUI->ResetState() ; myGeomGUI->ResetState() ;
myGeomGUI->SetActiveDialogBox(0) ; myGeomGUI->SetActiveDialogBox(0) ;
GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); DisplayGUI* myDisplayGUI = new DisplayGUI();
myDisplayGUI->OnDisplayAll(true) ; myDisplayGUI->OnDisplayAll(true) ;
} }
return ; return ;
@ -855,7 +858,7 @@ void TransformationGUI_MultiRotationDlg::ActivateThisDialog()
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
if( !mySimulationTopoDs.IsNull() ) if( !mySimulationTopoDs.IsNull() )
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
return ; return ;
} }
@ -892,7 +895,7 @@ void TransformationGUI_MultiRotationDlg::closeEvent( QCloseEvent* e )
//================================================================================= //=================================================================================
void TransformationGUI_MultiRotationDlg::MakeMultiRotationSimulationAndDisplay() void TransformationGUI_MultiRotationDlg::MakeMultiRotationSimulationAndDisplay()
{ {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
gp_Trsf theTransformation ; gp_Trsf theTransformation ;
gp_Trsf theTransformation1 ; gp_Trsf theTransformation1 ;
gp_Trsf theTransformation2 ; gp_Trsf theTransformation2 ;
@ -911,7 +914,7 @@ void TransformationGUI_MultiRotationDlg::MakeMultiRotationSimulationAndDisplay()
B.MakeCompound( compound ); B.MakeCompound( compound );
if ( myBase.ShapeType() == TopAbs_VERTEX) { if ( myBase.ShapeType() == TopAbs_VERTEX) {
myGeomGUI->VertexToPoint( myBase, myPoint ); myGeomBase->VertexToPoint( myBase, myPoint );
} }
else if ( myBase.ShapeType() == TopAbs_EDGE || myBase.ShapeType() == TopAbs_WIRE ) { else if ( myBase.ShapeType() == TopAbs_EDGE || myBase.ShapeType() == TopAbs_WIRE ) {
BRepGProp::LinearProperties(myBase, System); BRepGProp::LinearProperties(myBase, System);
@ -941,7 +944,7 @@ void TransformationGUI_MultiRotationDlg::MakeMultiRotationSimulationAndDisplay()
B.Add( compound, myBRepTransformation.Shape() ); B.Add( compound, myBRepTransformation.Shape() );
} }
mySimulationTopoDs = compound; mySimulationTopoDs = compound;
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
break; break;
} }
case 1 : case 1 :
@ -969,7 +972,7 @@ void TransformationGUI_MultiRotationDlg::MakeMultiRotationSimulationAndDisplay()
} }
} }
mySimulationTopoDs = compound ; mySimulationTopoDs = compound ;
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
break; break;
} }
} }

View File

@ -68,7 +68,8 @@ public:
private : private :
TransformationGUI* myTransformationGUI; TransformationGUI* myTransformationGUI;
GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ 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 */ TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */
SALOME_Selection* mySelection ; /* User shape selection */ SALOME_Selection* mySelection ; /* User shape selection */
TopoDS_Shape myBase ; TopoDS_Shape myBase ;

View File

@ -30,6 +30,7 @@ using namespace std;
#include "TransformationGUI_MultiTranslationDlg.h" #include "TransformationGUI_MultiTranslationDlg.h"
#include "QAD_Config.h" #include "QAD_Config.h"
#include "DisplayGUI.h"
#include <BRepBuilderAPI_MakeVertex.hxx> #include <BRepBuilderAPI_MakeVertex.hxx>
#include <BRepBuilderAPI_Transform.hxx> #include <BRepBuilderAPI_Transform.hxx>
@ -400,7 +401,8 @@ void TransformationGUI_MultiTranslationDlg::Init( SALOME_Selection* Sel )
Constructor1->setChecked( TRUE ); Constructor1->setChecked( TRUE );
myEditCurrentArgument = LineEditC1A1 ; myEditCurrentArgument = LineEditC1A1 ;
mySelection = Sel; mySelection = Sel;
myGeomGUI = GEOMBase_Context::GetGeomGUI() ; myGeomBase = new GEOMBase() ;
myGeomGUI = GEOMContext::GetGeomGUI() ;
myOkBase = myOkDir1 = myOkDir2 = false ; myOkBase = myOkDir1 = myOkDir2 = false ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
@ -453,7 +455,7 @@ void TransformationGUI_MultiTranslationDlg::Init( SALOME_Selection* Sel )
/* Move widget on the botton right corner of main widget */ /* Move widget on the botton right corner of main widget */
int x, y ; int x, y ;
myGeomGUI->DefineDlgPosition( this, x, y ) ; myGeomBase->DefineDlgPosition( this, x, y ) ;
this->move( x, y ) ; this->move( x, y ) ;
this->show() ; /* displays Dialog */ this->show() ; /* displays Dialog */
@ -473,7 +475,7 @@ void TransformationGUI_MultiTranslationDlg::ReverseAngle1(int state)
MakeMultiTranslationSimulationAndDisplay() ; MakeMultiTranslationSimulationAndDisplay() ;
} }
else { else {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
} }
return ; return ;
@ -492,7 +494,7 @@ void TransformationGUI_MultiTranslationDlg::ReverseAngle2(int state)
MakeMultiTranslationSimulationAndDisplay() ; MakeMultiTranslationSimulationAndDisplay() ;
} }
else { else {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
} }
return ; return ;
@ -506,7 +508,7 @@ void TransformationGUI_MultiTranslationDlg::ReverseAngle2(int state)
void TransformationGUI_MultiTranslationDlg::ConstructorsClicked(int constructorId) void TransformationGUI_MultiTranslationDlg::ConstructorsClicked(int constructorId)
{ {
myEditCurrentArgument->setText(tr("")) ; myEditCurrentArgument->setText(tr("")) ;
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
myStep1 = 50.0 ; myStep1 = 50.0 ;
@ -569,7 +571,7 @@ void TransformationGUI_MultiTranslationDlg::ClickOnOk()
//================================================================================= //=================================================================================
void TransformationGUI_MultiTranslationDlg::ClickOnApply() void TransformationGUI_MultiTranslationDlg::ClickOnApply()
{ {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
myGeomGUI->GetDesktop()->putInfo( tr("") ) ; myGeomGUI->GetDesktop()->putInfo( tr("") ) ;
switch(myConstructorId) switch(myConstructorId)
@ -600,7 +602,7 @@ void TransformationGUI_MultiTranslationDlg::ClickOnApply()
void TransformationGUI_MultiTranslationDlg::ClickOnCancel() void TransformationGUI_MultiTranslationDlg::ClickOnCancel()
{ {
mySelection->ClearFilters() ; mySelection->ClearFilters() ;
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
disconnect( mySelection, 0, this, 0 ); disconnect( mySelection, 0, this, 0 );
myGeomGUI->ResetState() ; myGeomGUI->ResetState() ;
@ -634,7 +636,7 @@ void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed()
/* so SelectionIntoArgument() is automatically called. */ /* so SelectionIntoArgument() is automatically called. */
const QString objectUserName = myEditCurrentArgument->text() ; const QString objectUserName = myEditCurrentArgument->text() ;
QWidget* thisWidget = (QWidget*)this ; QWidget* thisWidget = (QWidget*)this ;
if( myGeomGUI->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) { if( myGeomBase->SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) {
myEditCurrentArgument->setText( objectUserName ) ; myEditCurrentArgument->setText( objectUserName ) ;
} }
return ; return ;
@ -649,12 +651,12 @@ void TransformationGUI_MultiTranslationDlg::LineEditReturnPressed()
void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument() void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
{ {
myEditCurrentArgument->setText("") ; myEditCurrentArgument->setText("") ;
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
/* Future name of selection */ /* Future name of selection */
QString aString = ""; QString aString = "";
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString) ; int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString) ;
TopoDS_Shape S; TopoDS_Shape S;
Standard_Boolean testResult ; Standard_Boolean testResult ;
@ -676,11 +678,11 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
} }
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) if( !myGeomBase->GetTopoFromSelection(mySelection, S) )
return ; return ;
if ( myEditCurrentArgument == LineEditC1A1 ) { if ( myEditCurrentArgument == LineEditC1A1 ) {
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult) ;
if( !testResult ) if( !testResult )
return ; return ;
myEditCurrentArgument->setText(aString) ; myEditCurrentArgument->setText(aString) ;
@ -698,7 +700,7 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
MakeMultiTranslationSimulationAndDisplay() ; MakeMultiTranslationSimulationAndDisplay() ;
} }
else { else {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
} }
break; break;
@ -722,11 +724,11 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
} }
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ; Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject() ;
if( !myGeomGUI->GetTopoFromSelection(mySelection, S) ) if( !myGeomBase->GetTopoFromSelection(mySelection, S) )
return ; return ;
if ( myEditCurrentArgument == LineEditC2A1 ) { if ( myEditCurrentArgument == LineEditC2A1 ) {
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult) ; myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult) ;
if( !testResult ) if( !testResult )
return ; return ;
myEditCurrentArgument->setText(aString) ; myEditCurrentArgument->setText(aString) ;
@ -750,7 +752,7 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
MakeMultiTranslationSimulationAndDisplay() ; MakeMultiTranslationSimulationAndDisplay() ;
} }
else { else {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
} }
break; break;
@ -838,7 +840,7 @@ void TransformationGUI_MultiTranslationDlg::ValueChangedInt( int newIntValue )
MakeMultiTranslationSimulationAndDisplay() ; MakeMultiTranslationSimulationAndDisplay() ;
} }
else { else {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
} }
break; break;
@ -849,7 +851,7 @@ void TransformationGUI_MultiTranslationDlg::ValueChangedInt( int newIntValue )
MakeMultiTranslationSimulationAndDisplay() ; MakeMultiTranslationSimulationAndDisplay() ;
} }
else { else {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
} }
break; break;
@ -887,7 +889,7 @@ void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox( double newVal
MakeMultiTranslationSimulationAndDisplay() ; MakeMultiTranslationSimulationAndDisplay() ;
} }
else { else {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
} }
break; break;
@ -898,7 +900,7 @@ void TransformationGUI_MultiTranslationDlg::ValueChangedInSpinBox( double newVal
MakeMultiTranslationSimulationAndDisplay() ; MakeMultiTranslationSimulationAndDisplay() ;
} }
else { else {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
} }
break; break;
@ -920,11 +922,11 @@ void TransformationGUI_MultiTranslationDlg::DeactivateActiveDialog()
GroupC2->setEnabled(false) ; GroupC2->setEnabled(false) ;
GroupButtons->setEnabled(false) ; GroupButtons->setEnabled(false) ;
disconnect( mySelection, 0, this, 0 ); disconnect( mySelection, 0, this, 0 );
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
mySelection->ClearFilters() ; mySelection->ClearFilters() ;
myGeomGUI->ResetState() ; myGeomGUI->ResetState() ;
myGeomGUI->SetActiveDialogBox(0) ; myGeomGUI->SetActiveDialogBox(0) ;
GEOMBase_Display* myDisplayGUI = new GEOMBase_Display(); DisplayGUI* myDisplayGUI = new DisplayGUI();
myDisplayGUI->OnDisplayAll(true) ; myDisplayGUI->OnDisplayAll(true) ;
} }
return ; return ;
@ -946,7 +948,7 @@ void TransformationGUI_MultiTranslationDlg::ActivateThisDialog()
connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) ); connect ( mySelection, SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ; myGeomGUI->SetActiveDialogBox( (QDialog*)this ) ;
if( !mySimulationTopoDs.IsNull() ) if( !mySimulationTopoDs.IsNull() )
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
return ; return ;
} }
@ -983,7 +985,7 @@ void TransformationGUI_MultiTranslationDlg::closeEvent( QCloseEvent* e )
//================================================================================= //=================================================================================
void TransformationGUI_MultiTranslationDlg::MakeMultiTranslationSimulationAndDisplay() void TransformationGUI_MultiTranslationDlg::MakeMultiTranslationSimulationAndDisplay()
{ {
myGeomGUI->EraseSimulationShape() ; myGeomBase->EraseSimulationShape() ;
gp_Trsf theTransformation ; gp_Trsf theTransformation ;
mySimulationTopoDs.Nullify() ; mySimulationTopoDs.Nullify() ;
@ -1024,7 +1026,7 @@ void TransformationGUI_MultiTranslationDlg::MakeMultiTranslationSimulationAndDis
B.Add( compound, myBRepTransformation.Shape() ); B.Add( compound, myBRepTransformation.Shape() );
} }
mySimulationTopoDs = compound; mySimulationTopoDs = compound;
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
break; break;
} }
case 1 : case 1 :
@ -1047,7 +1049,7 @@ void TransformationGUI_MultiTranslationDlg::MakeMultiTranslationSimulationAndDis
} }
} }
mySimulationTopoDs = compound ; mySimulationTopoDs = compound ;
myGeomGUI->DisplaySimulationShape( mySimulationTopoDs ) ; myGeomBase->DisplaySimulationShape( mySimulationTopoDs ) ;
break; break;
} }
} }

View File

@ -68,7 +68,8 @@ public:
private : private :
TransformationGUI* myTransformationGUI; TransformationGUI* myTransformationGUI;
GEOM::GEOM_Gen_var myGeom ; /* Current Geom object */ 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 */ TopoDS_Shape mySimulationTopoDs ; /* Shape used for simulation display */
SALOME_Selection* mySelection ; /* User shape selection */ SALOME_Selection* mySelection ; /* User shape selection */
TopoDS_Shape myBase ; TopoDS_Shape myBase ;

View File

@ -30,7 +30,6 @@ using namespace std;
#include "TransformationGUI_RotationDlg.h" #include "TransformationGUI_RotationDlg.h"
#include "QAD_Config.h" #include "QAD_Config.h"
//#include <TopLoc_Location.hxx>
#include <BRepBuilderAPI_Transform.hxx> #include <BRepBuilderAPI_Transform.hxx>
#include <BRepAdaptor_Curve.hxx> #include <BRepAdaptor_Curve.hxx>
@ -116,7 +115,7 @@ void TransformationGUI_RotationDlg::Init()
connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed())); connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox(double))); 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())) ; connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())) ;
@ -149,7 +148,7 @@ void TransformationGUI_RotationDlg::ClickOnApply()
myGeomGUI->GetDesktop()->putInfo(tr("")); myGeomGUI->GetDesktop()->putInfo(tr(""));
if (mySimulationTopoDs.IsNull()) if (mySimulationTopoDs.IsNull())
return; return;
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
if(myOkBase && myOkAxis) if(myOkBase && myOkAxis)
@ -164,12 +163,12 @@ void TransformationGUI_RotationDlg::ClickOnApply()
//================================================================================= //=================================================================================
void TransformationGUI_RotationDlg::SelectionIntoArgument() void TransformationGUI_RotationDlg::SelectionIntoArgument()
{ {
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
QString aString = ""; /* name of selection */ QString aString = ""; /* name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
if(nbSel != 1) { if(nbSel != 1) {
if(myEditCurrentArgument == GroupPoints->LineEdit1) if(myEditCurrentArgument == GroupPoints->LineEdit1)
myOkBase = false; myOkBase = false;
@ -182,11 +181,11 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
TopoDS_Shape S; TopoDS_Shape S;
Standard_Boolean testResult; Standard_Boolean testResult;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) if(!myGeomBase->GetTopoFromSelection(mySelection, S))
return; return;
if(myEditCurrentArgument == GroupPoints->LineEdit1) { if(myEditCurrentArgument == GroupPoints->LineEdit1) {
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult); myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult);
if(!testResult) if(!testResult)
return; return;
myEditCurrentArgument->setText(aString); myEditCurrentArgument->setText(aString);
@ -259,7 +258,7 @@ void TransformationGUI_RotationDlg::ActivateThisDialog()
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if(!mySimulationTopoDs.IsNull()) if(!mySimulationTopoDs.IsNull())
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
return; return;
} }
@ -296,7 +295,7 @@ void TransformationGUI_RotationDlg::ValueChangedInSpinBox(double newValue)
//================================================================================= //=================================================================================
void TransformationGUI_RotationDlg::MakeRotationSimulationAndDisplay() void TransformationGUI_RotationDlg::MakeRotationSimulationAndDisplay()
{ {
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
try { try {
@ -305,7 +304,7 @@ void TransformationGUI_RotationDlg::MakeRotationSimulationAndDisplay()
theTransformation.SetRotation(AX, myAngle*PI180); theTransformation.SetRotation(AX, myAngle*PI180);
BRepBuilderAPI_Transform myBRepTransformation(myBase, theTransformation, Standard_False); BRepBuilderAPI_Transform myBRepTransformation(myBase, theTransformation, Standard_False);
this->mySimulationTopoDs = myBRepTransformation.Shape(); this->mySimulationTopoDs = myBRepTransformation.Shape();
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
} }
catch(Standard_Failure) { catch(Standard_Failure) {
MESSAGE("Exception catched in MakeRotationSimulationAndDisplay"); MESSAGE("Exception catched in MakeRotationSimulationAndDisplay");

View File

@ -34,6 +34,7 @@
#include "TransformationGUI.h" #include "TransformationGUI.h"
#include "GEOM_ShapeTypeFilter.hxx"
#include <gp_Dir.hxx> #include <gp_Dir.hxx>
//================================================================================= //=================================================================================

View File

@ -29,6 +29,7 @@
using namespace std; using namespace std;
#include "TransformationGUI_ScaleDlg.h" #include "TransformationGUI_ScaleDlg.h"
#include "QAD_Config.h"
#include <BRepBuilderAPI_Transform.hxx> #include <BRepBuilderAPI_Transform.hxx>
//================================================================================= //=================================================================================
@ -146,7 +147,7 @@ void TransformationGUI_ScaleDlg::ClickOnApply()
myGeomGUI->GetDesktop()->putInfo(tr("")); myGeomGUI->GetDesktop()->putInfo(tr(""));
if (mySimulationTopoDs.IsNull()) if (mySimulationTopoDs.IsNull())
return; return;
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
if(myOkBaseTopo && myOkPoint1) if(myOkBaseTopo && myOkPoint1)
@ -161,12 +162,12 @@ void TransformationGUI_ScaleDlg::ClickOnApply()
//================================================================================= //=================================================================================
void TransformationGUI_ScaleDlg::SelectionIntoArgument() void TransformationGUI_ScaleDlg::SelectionIntoArgument()
{ {
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
QString aString = ""; /* name of selection */ QString aString = ""; /* name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
if (nbSel != 1) { if (nbSel != 1) {
if(myEditCurrentArgument == GroupPoints->LineEdit1) if(myEditCurrentArgument == GroupPoints->LineEdit1)
myOkBaseTopo = false; myOkBaseTopo = false;
@ -179,19 +180,19 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument()
TopoDS_Shape S; TopoDS_Shape S;
Standard_Boolean testResult; Standard_Boolean testResult;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) if(!myGeomBase->GetTopoFromSelection(mySelection, S))
return; return;
/* gp_Pnt : not used */ /* gp_Pnt : not used */
if(myEditCurrentArgument == GroupPoints->LineEdit1) { if(myEditCurrentArgument == GroupPoints->LineEdit1) {
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult); myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult);
if(!testResult) if(!testResult)
return ; return ;
GroupPoints->LineEdit1->setText(aString); GroupPoints->LineEdit1->setText(aString);
myBaseTopo = S; myBaseTopo = S;
myOkBaseTopo = true; myOkBaseTopo = true;
} }
else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomGUI->VertexToPoint(S, myPoint1)) { else if(myEditCurrentArgument == GroupPoints->LineEdit2 && myGeomBase->VertexToPoint(S, myPoint1)) {
GroupPoints->LineEdit2->setText(aString); GroupPoints->LineEdit2->setText(aString);
myOkPoint1 = true; myOkPoint1 = true;
} }
@ -254,7 +255,7 @@ void TransformationGUI_ScaleDlg::ActivateThisDialog()
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if(!mySimulationTopoDs.IsNull()) if(!mySimulationTopoDs.IsNull())
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
return; return;
} }
@ -291,7 +292,7 @@ void TransformationGUI_ScaleDlg::ValueChangedInSpinBox(double newValue)
//================================================================================= //=================================================================================
void TransformationGUI_ScaleDlg::MakeScaleSimulationAndDisplay() void TransformationGUI_ScaleDlg::MakeScaleSimulationAndDisplay()
{ {
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
try { try {
@ -302,7 +303,7 @@ void TransformationGUI_ScaleDlg::MakeScaleSimulationAndDisplay()
if(mySimulationTopoDs.IsNull()) if(mySimulationTopoDs.IsNull())
return; return;
else else
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
} }
catch(Standard_Failure) { catch(Standard_Failure) {
MESSAGE("Exception catched in MakeScaleSimulationAndDisplay"); MESSAGE("Exception catched in MakeScaleSimulationAndDisplay");

View File

@ -34,6 +34,8 @@
#include "TransformationGUI.h" #include "TransformationGUI.h"
#include "GEOM_ShapeTypeFilter.hxx"
//================================================================================= //=================================================================================
// class : TransformationGUI_ScaleDlg // class : TransformationGUI_ScaleDlg
// purpose : // purpose :

View File

@ -30,6 +30,7 @@ using namespace std;
#include "TransformationGUI_TranslationDlg.h" #include "TransformationGUI_TranslationDlg.h"
#include <BRepBuilderAPI_Transform.hxx> #include <BRepBuilderAPI_Transform.hxx>
#include "QAD_Config.h"
//================================================================================= //=================================================================================
// class : TransformationGUI_TranslationDlg() // class : TransformationGUI_TranslationDlg()
@ -150,7 +151,7 @@ void TransformationGUI_TranslationDlg::ClickOnApply()
myGeomGUI->GetDesktop()->putInfo(tr("")); myGeomGUI->GetDesktop()->putInfo(tr(""));
if (mySimulationTopoDs.IsNull()) if (mySimulationTopoDs.IsNull())
return; return;
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
if(myOkBase) if(myOkBase)
@ -165,12 +166,12 @@ void TransformationGUI_TranslationDlg::ClickOnApply()
//================================================================================= //=================================================================================
void TransformationGUI_TranslationDlg::SelectionIntoArgument() void TransformationGUI_TranslationDlg::SelectionIntoArgument()
{ {
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
myEditCurrentArgument->setText(""); myEditCurrentArgument->setText("");
QString aString = ""; /* name of selection */ QString aString = ""; /* name of selection */
int nbSel = myGeomGUI->GetNameOfSelectedIObjects(mySelection, aString); int nbSel = myGeomBase->GetNameOfSelectedIObjects(mySelection, aString);
if (nbSel != 1) { if (nbSel != 1) {
if(myEditCurrentArgument == GroupPoints->LineEdit1) if(myEditCurrentArgument == GroupPoints->LineEdit1)
myOkBase = false; myOkBase = false;
@ -181,12 +182,12 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument()
TopoDS_Shape S; TopoDS_Shape S;
Standard_Boolean testResult; Standard_Boolean testResult;
Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject(); Handle(SALOME_InteractiveObject) IO = mySelection->firstIObject();
if(!myGeomGUI->GetTopoFromSelection(mySelection, S)) if(!myGeomBase->GetTopoFromSelection(mySelection, S))
return; return;
/* gp_Pnt : not used */ /* gp_Pnt : not used */
if(myEditCurrentArgument == GroupPoints->LineEdit1) { if(myEditCurrentArgument == GroupPoints->LineEdit1) {
myGeomShape = myGeomGUI->ConvertIOinGEOMShape(IO, testResult); myGeomShape = myGeomBase->ConvertIOinGEOMShape(IO, testResult);
if(!testResult) if(!testResult)
return ; return ;
GroupPoints->LineEdit1->setText(aString); GroupPoints->LineEdit1->setText(aString);
@ -244,7 +245,7 @@ void TransformationGUI_TranslationDlg::ActivateThisDialog()
GEOMBase_Skeleton::ActivateThisDialog(); GEOMBase_Skeleton::ActivateThisDialog();
connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
if(!mySimulationTopoDs.IsNull()) if(!mySimulationTopoDs.IsNull())
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
return; return;
} }
@ -300,7 +301,7 @@ void TransformationGUI_TranslationDlg::ValueChangedInSpinBox(double newValue)
//================================================================================= //=================================================================================
void TransformationGUI_TranslationDlg::MakeTranslationSimulationAndDisplay() void TransformationGUI_TranslationDlg::MakeTranslationSimulationAndDisplay()
{ {
myGeomGUI->EraseSimulationShape(); myGeomBase->EraseSimulationShape();
mySimulationTopoDs.Nullify(); mySimulationTopoDs.Nullify();
try { try {
@ -311,7 +312,7 @@ void TransformationGUI_TranslationDlg::MakeTranslationSimulationAndDisplay()
if(mySimulationTopoDs.IsNull()) if(mySimulationTopoDs.IsNull())
return; return;
else else
myGeomGUI->DisplaySimulationShape(mySimulationTopoDs); myGeomBase->DisplaySimulationShape(mySimulationTopoDs);
} }
catch(Standard_Failure) { catch(Standard_Failure) {
MESSAGE("Exception catched in MakeTranslationSimulationAndDisplay"); MESSAGE("Exception catched in MakeTranslationSimulationAndDisplay");