1 // GEOM GEOMGUI : GUI for Geometry component
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : EntityGUI.cxx
25 // Author : Damien COQUERET
29 #include "EntityGUI.h"
30 #include "GeometryGUI.h"
31 #include "GEOM_AssemblyBuilder.h"
33 #include "SUIT_Desktop.h"
34 #include "SUIT_Session.h"
35 #include "SUIT_ViewWindow.h"
36 #include "OCCViewer_ViewModel.h"
37 #include "OCCViewer_ViewManager.h"
38 #include "VTKViewer_ViewModel.h"
39 #include "SalomeApp_Study.h"
40 #include "SalomeApp_Tools.h"
41 //#include "SALOMEGUI_ImportOperation.h"
43 #include <TopoDS_Compound.hxx>
44 #include <BRep_Builder.hxx>
45 #include <TopExp_Explorer.hxx>
47 #include "EntityGUI_SketcherDlg.h" // Sketcher
48 #include "EntityGUI_SubShapeDlg.h" // Method SUBSHAPE
50 #include "utilities.h"
52 using namespace boost;
55 EntityGUI* EntityGUI::myGUIObject = 0;
57 //=======================================================================
58 // function : GetEntityGUI()
59 // purpose : Get the only EntityGUI object [ static ]
60 //=======================================================================
61 EntityGUI* EntityGUI::GetEntityGUI( GeometryGUI* parent )
63 if ( myGUIObject == 0 ) {
64 // init EntityGUI only once
65 myGUIObject = new EntityGUI( parent );
70 //=======================================================================
71 // function : EntityGUI()
72 // purpose : Constructor
73 //=======================================================================
74 EntityGUI::EntityGUI( GeometryGUI* parent ) : GEOMGUI( parent )
76 myGeomBase = new GEOMBase();
77 myGeom = GEOM::GEOM_Gen::_duplicate( GeometryGUI::GetGeomGen() );
79 mySimulationShape1 = new AIS_Shape(TopoDS_Shape());
80 mySimulationShape2 = new AIS_Shape(TopoDS_Shape());
84 //=======================================================================
85 // function : ~EntityGUI()
86 // purpose : Destructor
87 //=======================================================================
88 EntityGUI::~EntityGUI()
93 //=======================================================================
94 // function : OnGUIEvent()
96 //=======================================================================
97 bool EntityGUI::OnGUIEvent(int theCommandID, SUIT_Desktop* parent)
99 getGeometryGUI()->EmitSignalDeactivateDialog();
100 QDialog* aDlg = NULL;
102 switch (theCommandID)
104 case 404: // SKETCHER
105 getGeometryGUI()->ActiveWorkingPlane();
106 aDlg = new EntityGUI_SketcherDlg(getGeometryGUI(), parent, "");
108 case 407: // EXPLODE : use ic
109 aDlg = new EntityGUI_SubShapeDlg(parent, "");
112 SUIT_Session::session()->activeApplication()->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
122 //=======================================================================
123 // function : OnSketchEnd()
125 //=======================================================================
126 void EntityGUI::OnSketchEnd(const char *Cmd)
128 /* QAD_Application::getDesktop()->putInfo("Create sketch functionality is NOT implemented in new GEOM kernel
129 (no such Corba interface method). Waiting for SRN to create it...");
132 GEOM::GEOM_Shape_var result = myGeom->MakeSketcher(Cmd);
133 if(result->_is_nil()) {
134 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE"));
137 result->NameType(tr("GEOM_WIRE"));
138 if(myGeomBase->Display(result))
139 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
141 catch(const SALOME::SALOME_Exception& S_ex) {
142 SalomeApp_Tools::QtCatchCorbaException(S_ex);
149 //=====================================================================================
150 // function : DisplaySimulationShape()
151 // purpose : Displays 'this->mySimulationShape' a pure graphical shape from a TopoDS_Shape
152 //=====================================================================================
153 void EntityGUI::DisplaySimulationShape(const TopoDS_Shape& S1, const TopoDS_Shape& S2)
155 //NRI DEBUG : 14/02/2002
156 if( SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()->getType()
157 != OCCViewer_Viewer::Type() )
160 OCCViewer_Viewer* v3d =
161 ((OCCViewer_ViewManager*)(SUIT_Session::session()->activeApplication()->desktop()->activeWindow()->getViewManager()))->getOCCViewer();
162 Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
165 /* erase any previous */
166 ic->Erase(mySimulationShape1, Standard_True, Standard_False);
167 ic->ClearPrs(mySimulationShape1);
169 mySimulationShape1 = new AIS_Shape(TopoDS_Shape());
170 mySimulationShape1->Set(S1);
171 mySimulationShape1->SetColor(Quantity_NOC_RED);
173 ic->Deactivate(mySimulationShape1);
174 ic->Display(mySimulationShape1, Standard_False);
175 mySimulationShape1->UnsetColor();
178 ic->Erase(mySimulationShape2, Standard_True, Standard_False);
179 ic->ClearPrs(mySimulationShape2);
181 mySimulationShape2 = new AIS_Shape(TopoDS_Shape());
182 mySimulationShape2->Set(S2);
183 mySimulationShape2->SetColor(Quantity_NOC_VIOLET);
185 ic->Deactivate(mySimulationShape2);
186 ic->Display(mySimulationShape2, Standard_False);
187 mySimulationShape2->UnsetColor();
189 ic->UpdateCurrentViewer();
191 catch(Standard_Failure) {
192 MESSAGE("Exception catched in EntityGUI::DisplaySimulationShape ");
198 //==================================================================================
199 // function : EraseSimulationShape()
200 // purpose : Clears the display of 'mySimulationShape' a pure graphical shape
201 //==================================================================================
202 void EntityGUI::EraseSimulationShape()
204 // get all view windows at the desktop
205 QPtrList<SUIT_ViewWindow> aWndLst = SUIT_Session::session()->activeApplication()->desktop()->windows();
206 //get all view windows, which belong to the active study
207 QPtrList<SUIT_ViewWindow> aWndLstAS;
209 for ( vw = aWndLst.first(); vw; vw = aWndLst.next() )
210 if ( vw->getViewManager()->study() == SUIT_Session::session()->activeApplication()->activeStudy() )
211 aWndLstAS.append( vw );
213 for ( vw = aWndLstAS.first(); vw; vw = aWndLstAS.next() ) {
214 if ( vw->getViewManager()->getType() == OCCViewer_Viewer::Type() ) {
215 OCCViewer_Viewer* v3d = ((OCCViewer_ViewManager*)(vw->getViewManager()))->getOCCViewer();
216 Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
217 ic->Erase(mySimulationShape1, Standard_True, Standard_False);
218 ic->ClearPrs(mySimulationShape1);
219 ic->Erase(mySimulationShape2, Standard_True, Standard_False);
220 ic->ClearPrs(mySimulationShape2);
221 ic->UpdateCurrentViewer();
226 //=====================================================================================
227 // function : SObjectExist()
229 //=====================================================================================
230 bool EntityGUI::SObjectExist(const _PTR(SObject)& theFatherObject, const char* IOR)
232 SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
233 if ( !appStudy ) return false;
234 _PTR(Study) aStudy = appStudy->studyDS();
235 _PTR(ChildIterator) it ( aStudy->NewChildIterator(theFatherObject) );
237 _PTR(GenericAttribute) anAttr;
238 for(; it->More();it->Next()) {
239 _PTR(SObject) SO ( it->Value() );
240 if(SO->FindAttribute(anAttr, "AttributeIOR")) {
241 _PTR(AttributeIOR) anIOR ( anAttr );
242 if(strcmp( anIOR->Value().c_str(), IOR ) == 0)
245 if(SO->ReferencedObject(RefSO)) {
246 if(RefSO->FindAttribute(anAttr, "AttributeIOR")) {
247 _PTR(AttributeIOR) anIOR ( anAttr );
248 if(strcmp(anIOR->Value().c_str(), IOR) == 0)
257 //=====================================================================================
258 // function : OnSubShapeGetAll()
259 // purpose : Explode a shape in all sub shapes with a SubShapeType
260 //=====================================================================================
261 bool EntityGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType)
263 SUIT_Session::session()->activeApplication()->putInfo("OnSubShapeGetAll method from EntityGUI should be reimplemented ...");
265 SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
266 SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(ShapeTopoIOR);
267 if(theObj->_is_nil()) {
268 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY"));
272 SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
273 SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry());
274 SALOMEDS::GenericAttribute_var anAttr;
275 SALOMEDS::AttributeName_var aName;
276 SALOMEDS::AttributeIOR_var anIOR;
277 SALOMEDS::AttributePixMap_var aPixmap;
279 // We create a sub object for each sub shape as attribute of the main object
280 // Each sub object contains list (length=1) containing its index in the main shape
281 GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(ShapeTopoIOR);
282 GEOM::GEOM_Gen::ListOfGeomShapes_var listGeomShapes = new GEOM::GEOM_Gen::ListOfGeomShapes;
283 GEOM::GEOM_Shape_var aResult;
286 listGeomShapes = myGeom->SubShapeAll(aShape, SubShapeType);
287 if(listGeomShapes->length() < 1) {
288 QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_ABORT"));
292 catch(const SALOME::SALOME_Exception& S_ex) {
293 SalomeApp_Tools::QtCatchCorbaException(S_ex);
297 QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy());
300 TopoDS_Shape mainTopo = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape);
301 TopoDS_Shape mainShape;
304 if(aShape->IsMainShape()) {
305 mainShape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape);
309 aShape = myGeom->GetIORFromString(aShape->MainName());
312 // Loop on each sub shape created
313 // int i = 1 ; index for the nameType
314 for(int j=0; j<listGeomShapes->length(); j++) {
315 // Get each sub shape extracted CORBA and OCC
316 aResult = listGeomShapes[j] ;
317 TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, aResult);
320 QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_ABORT"));
324 // Set the nameType of sub shape
325 char* nameG = (char *)malloc(20);
326 Standard_CString Type;
327 if(myGeomBase->GetShapeTypeString(S, Type)) {
328 aResult->NameType(Type);
329 sprintf(nameG, "%s_%d", Type, myGeomBase->GetIndex(S, mainShape, SubShapeType));
332 aResult->NameType(tr("GEOM_SHAPE"));
333 sprintf(nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->myNbGeom++);
335 SALOMEDS::SObject_var SO = aStudy->FindObjectIOR(aResult->Name());
337 bool allreadyexist = false;
339 if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
340 OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
341 Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
343 Handle(GEOM_AISShape) result = new GEOM_AISShape(S, nameG);
344 Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM");
346 MESSAGE ("SO->_is_nil() " << SO->_is_nil())
349 SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(theObj);
350 anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName");
351 aName = SALOMEDS::AttributeName::_narrow(anAttr);
352 aName->SetValue(nameG);
353 anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
354 anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
355 anIOR->SetValue(aResult->Name());
357 anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap");
358 aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
359 MESSAGE(" Type " << S.ShapeType())
360 if (S.ShapeType() == TopAbs_COMPOUND)
361 aPixmap->SetPixMap("ICON_OBJBROWSER_COMPOUND");
362 else if(S.ShapeType() == TopAbs_COMPSOLID)
363 aPixmap->SetPixMap("ICON_OBJBROWSER_COMPSOLID");
364 else if(S.ShapeType() == TopAbs_SOLID)
365 aPixmap->SetPixMap("ICON_OBJBROWSER_SOLID");
366 else if(S.ShapeType() == TopAbs_SHELL)
367 aPixmap->SetPixMap("ICON_OBJBROWSER_SHELL");
368 else if(S.ShapeType() == TopAbs_FACE)
369 aPixmap->SetPixMap("ICON_OBJBROWSER_FACE");
370 else if(S.ShapeType() == TopAbs_WIRE)
371 aPixmap->SetPixMap("ICON_OBJBROWSER_WIRE");
372 else if(S.ShapeType() == TopAbs_EDGE)
373 aPixmap->SetPixMap("ICON_OBJBROWSER_EDGE");
374 else if(S.ShapeType() == TopAbs_VERTEX)
375 aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX");
377 MESSAGE(" aPixmap->GetPixMap " << aPixmap->GetPixMap())
379 SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
380 aStudyBuilder->Addreference(newObj1, newObj);
381 IO->setEntry(newObj->GetID());
383 aResult->StudyShapeId(newObj->GetID());
386 allreadyexist = true;
387 if(!this->SObjectExist(theObj, aResult->Name())) {
388 SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj);
389 aStudyBuilder->Addreference(newObj1, SO);
390 IO->setEntry(SO->GetID());
391 aResult->StudyShapeId(SO->GetID());
396 result->setName(nameG);
401 else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
402 VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
404 int themode = myRenderInter->GetDisplayMode();
405 vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
406 vtkRenderWindow *renWin = theRenderer->GetRenderWindow();
408 Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM");
411 SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(theObj);
412 anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
413 anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
414 anIOR->SetValue(aResult->Name());
415 anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName");
416 aName = SALOMEDS::AttributeName::_narrow(anAttr);
417 aName->SetValue(nameG);
419 anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap");
420 aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
421 if(S.ShapeType() == TopAbs_COMPOUND)
422 aPixmap->SetPixMap("ICON_OBJBROWSER_COMPOUND");
423 else if(S.ShapeType() == TopAbs_COMPSOLID)
424 aPixmap->SetPixMap("ICON_OBJBROWSER_COMPSOLID");
425 else if(S.ShapeType() == TopAbs_SOLID)
426 aPixmap->SetPixMap("ICON_OBJBROWSER_SOLID");
427 else if(S.ShapeType() == TopAbs_SHELL)
428 aPixmap->SetPixMap("ICON_OBJBROWSER_SHELL");
429 else if(S.ShapeType() == TopAbs_FACE)
430 aPixmap->SetPixMap("ICON_OBJBROWSER_FACE");
431 else if(S.ShapeType() == TopAbs_WIRE)
432 aPixmap->SetPixMap("ICON_OBJBROWSER_WIRE");
433 else if(S.ShapeType() == TopAbs_EDGE)
434 aPixmap->SetPixMap("ICON_OBJBROWSER_EDGE");
435 else if(S.ShapeType() == TopAbs_VERTEX)
436 aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX");
438 SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
439 aStudyBuilder->Addreference(newObj1, newObj);
440 IO->setEntry(newObj->GetID());
443 allreadyexist = true;
444 if(!this->SObjectExist(theObj, aResult->Name())) {
445 SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj);
446 aStudyBuilder->Addreference(newObj1, SO);
447 IO->setEntry(SO->GetID());
452 vtkActorCollection* theActors = GEOM_AssemblyBuilder::BuildActors(S,0,themode,Standard_True);
453 theActors->InitTraversal();
454 vtkActor* anActor = (vtkActor*)theActors->GetNextActor();
455 while(!(anActor==NULL)) {
456 GEOM_Actor* GActor = GEOM_Actor::SafeDownCast(anActor);
458 GActor->setName(nameG);
459 theRenderer->AddActor(GActor);
461 anActor = (vtkActor*)theActors->GetNextActor();
467 // commit transaction
470 QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser();
471 QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_READY"));
477 //=====================================================================================
478 // function : OnSubShapeGetSelected()
480 //=====================================================================================
481 bool EntityGUI::OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType, Standard_Integer& aLocalContextId, bool& myUseLocalContext)
483 SUIT_Session::session()->activeApplication()->putInfo("OnSubShapeGetSelected method from EntityGUI should be reimplemented ...");
484 // //* Test the type of viewer */
485 // if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
488 // SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
489 // SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(ShapeTopoIOR);
490 // if(theObj->_is_nil()) {
491 // QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY"));
495 // OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
496 // Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
498 // if( myUseLocalContext == false ) {
499 // /* local context is from DialogBox */
500 // MESSAGE("Error : No local context opened for sub shapes method" << endl ) ;
504 // GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString( ShapeTopoIOR );
505 // TopoDS_Shape mainTopo = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape);
507 // TopoDS_Shape mainShape;
508 // bool main = false;
510 // if(aShape->IsMainShape()) {
511 // mainShape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape);
515 // aShape = myGeom->GetIORFromString(aShape->MainName());
518 // GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID;
519 // ic->InitSelected();
520 // int nbSelected = ic->NbSelected();
521 // ListOfID->length(nbSelected);
523 // TopoDS_Compound compound;
524 // ic->InitSelected(); /* to init again */
526 // B.MakeCompound(compound);
529 // /* We create a unique compound containing all the sub shapes selected by user as attribute of the main shape */
530 // /* the compound is homogenous by selection */
531 // while(ic->MoreSelected()) {
532 // int index = myGeomBase->GetIndex(ic->SelectedShape(), mainShape, SubShapeType);
533 // ListOfID[i] = index;
534 // B.Add(compound, ic->SelectedShape());
536 // ic->NextSelected();
539 // /* Test if user has selected sub shapes */
540 // if(ListOfID->length() < 1)
543 // GEOM::GEOM_Shape_var aResult;
545 // aResult = myGeom->SubShape(aShape, SubShapeType, ListOfID);
547 // catch (const SALOME::SALOME_Exception& S_ex) {
548 // SalomeApp_Tools::QtCatchCorbaException(S_ex);
551 // /* local context from DialogBox */
552 // ic->CloseLocalContext(aLocalContextId);
553 // myUseLocalContext = false ;
555 // char* nameG = (char *)malloc(20);
556 // Standard_CString Type;
558 // Handle(GEOM_AISShape) result;
559 // Handle(GEOM_InteractiveObject) IO;
561 // if(nbSelected == 1) {
562 // TopExp_Explorer Exp (compound, TopAbs_ShapeEnum(SubShapeType));
564 // if(myGeomBase->GetShapeTypeString(Exp.Current(),Type)) {
565 // aResult->NameType(Type);
566 // sprintf (nameG, "%s_%d", Type, myGeomBase->GetIndex( Exp.Current(), mainTopo, SubShapeType));
569 // aResult->NameType(tr("GEOM_SHAPE"));
570 // sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->myNbGeom++);
572 // result = new GEOM_AISShape(Exp.Current(), nameG);
573 // IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM");
577 // if ( myGeomBase->GetShapeTypeString(compound,Type)) {
578 // aResult->NameType(Type);
579 // sprintf (nameG, "%s_%d", Type, myGeomGUI->myNbGeom++);
581 // aResult->NameType(tr("GEOM_SHAPE"));
582 // sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->myNbGeom++);
584 // result = new GEOM_AISShape(compound, nameG);
585 // IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM");
588 // SALOMEDS::SObject_var SO = aStudy->FindObjectIOR(aResult->Name());
590 // /* open transaction */
591 // QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy());
594 // SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
595 // SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry());
596 // SALOMEDS::GenericAttribute_var anAttr;
597 // SALOMEDS::AttributeName_var aName;
598 // SALOMEDS::AttributeIOR_var anIOR;
599 // SALOMEDS::AttributePixMap_var aPixmap;
601 // bool allreadyexist = false;
603 // if(SO->_is_nil()) {
604 // SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(theObj);
605 // anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
606 // anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
607 // anIOR->SetValue(aResult->Name());
608 // anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName");
609 // aName = SALOMEDS::AttributeName::_narrow(anAttr);
610 // aName->SetValue(result->getName());
612 // anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap");
613 // aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
614 // if(result->Shape().ShapeType() == TopAbs_COMPOUND)
615 // aPixmap->SetPixMap("ICON_OBJBROWSER_COMPOUND");
616 // else if(result->Shape().ShapeType() == TopAbs_COMPSOLID)
617 // aPixmap->SetPixMap("ICON_OBJBROWSER_COMPSOLID");
618 // else if(result->Shape().ShapeType() == TopAbs_SOLID)
619 // aPixmap->SetPixMap("ICON_OBJBROWSER_SOLID");
620 // else if(result->Shape().ShapeType() == TopAbs_SHELL)
621 // aPixmap->SetPixMap("ICON_OBJBROWSER_SHELL");
622 // else if(result->Shape().ShapeType() == TopAbs_FACE)
623 // aPixmap->SetPixMap("ICON_OBJBROWSER_FACE");
624 // else if(result->Shape().ShapeType() == TopAbs_WIRE)
625 // aPixmap->SetPixMap("ICON_OBJBROWSER_WIRE");
626 // else if(result->Shape().ShapeType() == TopAbs_EDGE)
627 // aPixmap->SetPixMap("ICON_OBJBROWSER_EDGE");
628 // else if(result->Shape().ShapeType() == TopAbs_VERTEX)
629 // aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX");
631 // SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
632 // aStudyBuilder->Addreference(newObj1, newObj);
634 // IO->setEntry(newObj->GetID());
635 // aResult->StudyShapeId(newObj->GetID());
638 // allreadyexist = true;
639 // if(!this->SObjectExist(theObj, aResult->Name())) {
640 // SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj);
641 // aStudyBuilder->Addreference(newObj1, SO);
643 // IO->setEntry(SO->GetID());
644 // aResult->StudyShapeId(SO->GetID());
648 // /* commit transaction */
651 // result->setIO(IO);
652 // result->setName(nameG);
654 // if(!allreadyexist)
655 // ic->Display(result);
657 // DisplayGUI* myDisplayGUI = new DisplayGUI();
658 // myDisplayGUI->OnDisplayAll(true);
660 // QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser();
661 // QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_READY"));
666 //=====================================================================================
668 //=====================================================================================
672 __declspec( dllexport )
674 GEOMGUI* GetLibGUI( GeometryGUI* parent )
676 return EntityGUI::GetEntityGUI( parent );