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 "SVTK_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 SVTK_ViewFrame* vf = dynamic_cast<SVTK_ViewFrame*>( QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame() );
403 SVTK_RenderWindowInteractor* myRenderInter= vf ? vf->getRWInteractor() : 0;
405 int themode = myRenderInter->GetDisplayMode();
406 vtkRenderer *theRenderer = vf->getRenderer();
407 vtkRenderWindow *renWin = theRenderer->GetRenderWindow();
409 Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM");
412 SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(theObj);
413 anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
414 anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
415 anIOR->SetValue(aResult->Name());
416 anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName");
417 aName = SALOMEDS::AttributeName::_narrow(anAttr);
418 aName->SetValue(nameG);
420 anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap");
421 aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
422 if(S.ShapeType() == TopAbs_COMPOUND)
423 aPixmap->SetPixMap("ICON_OBJBROWSER_COMPOUND");
424 else if(S.ShapeType() == TopAbs_COMPSOLID)
425 aPixmap->SetPixMap("ICON_OBJBROWSER_COMPSOLID");
426 else if(S.ShapeType() == TopAbs_SOLID)
427 aPixmap->SetPixMap("ICON_OBJBROWSER_SOLID");
428 else if(S.ShapeType() == TopAbs_SHELL)
429 aPixmap->SetPixMap("ICON_OBJBROWSER_SHELL");
430 else if(S.ShapeType() == TopAbs_FACE)
431 aPixmap->SetPixMap("ICON_OBJBROWSER_FACE");
432 else if(S.ShapeType() == TopAbs_WIRE)
433 aPixmap->SetPixMap("ICON_OBJBROWSER_WIRE");
434 else if(S.ShapeType() == TopAbs_EDGE)
435 aPixmap->SetPixMap("ICON_OBJBROWSER_EDGE");
436 else if(S.ShapeType() == TopAbs_VERTEX)
437 aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX");
439 SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
440 aStudyBuilder->Addreference(newObj1, newObj);
441 IO->setEntry(newObj->GetID());
444 allreadyexist = true;
445 if(!this->SObjectExist(theObj, aResult->Name())) {
446 SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj);
447 aStudyBuilder->Addreference(newObj1, SO);
448 IO->setEntry(SO->GetID());
453 vtkActorCollection* theActors = GEOM_AssemblyBuilder::BuildActors(S,0,themode,Standard_True);
454 theActors->InitTraversal();
455 vtkActor* anActor = (vtkActor*)theActors->GetNextActor();
456 while(!(anActor==NULL)) {
457 GEOM_Actor* GActor = GEOM_Actor::SafeDownCast(anActor);
459 GActor->setName(nameG);
460 theRenderer->AddActor(GActor);
462 anActor = (vtkActor*)theActors->GetNextActor();
468 // commit transaction
471 QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser();
472 QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_READY"));
478 //=====================================================================================
479 // function : OnSubShapeGetSelected()
481 //=====================================================================================
482 bool EntityGUI::OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType, Standard_Integer& aLocalContextId, bool& myUseLocalContext)
484 SUIT_Session::session()->activeApplication()->putInfo("OnSubShapeGetSelected method from EntityGUI should be reimplemented ...");
485 // //* Test the type of viewer */
486 // if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
489 // SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
490 // SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(ShapeTopoIOR);
491 // if(theObj->_is_nil()) {
492 // QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY"));
496 // OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
497 // Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
499 // if( myUseLocalContext == false ) {
500 // /* local context is from DialogBox */
501 // MESSAGE("Error : No local context opened for sub shapes method" << endl ) ;
505 // GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString( ShapeTopoIOR );
506 // TopoDS_Shape mainTopo = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape);
508 // TopoDS_Shape mainShape;
509 // bool main = false;
511 // if(aShape->IsMainShape()) {
512 // mainShape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape);
516 // aShape = myGeom->GetIORFromString(aShape->MainName());
519 // GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID;
520 // ic->InitSelected();
521 // int nbSelected = ic->NbSelected();
522 // ListOfID->length(nbSelected);
524 // TopoDS_Compound compound;
525 // ic->InitSelected(); /* to init again */
527 // B.MakeCompound(compound);
530 // /* We create a unique compound containing all the sub shapes selected by user as attribute of the main shape */
531 // /* the compound is homogenous by selection */
532 // while(ic->MoreSelected()) {
533 // int index = myGeomBase->GetIndex(ic->SelectedShape(), mainShape, SubShapeType);
534 // ListOfID[i] = index;
535 // B.Add(compound, ic->SelectedShape());
537 // ic->NextSelected();
540 // /* Test if user has selected sub shapes */
541 // if(ListOfID->length() < 1)
544 // GEOM::GEOM_Shape_var aResult;
546 // aResult = myGeom->SubShape(aShape, SubShapeType, ListOfID);
548 // catch (const SALOME::SALOME_Exception& S_ex) {
549 // SalomeApp_Tools::QtCatchCorbaException(S_ex);
552 // /* local context from DialogBox */
553 // ic->CloseLocalContext(aLocalContextId);
554 // myUseLocalContext = false ;
556 // char* nameG = (char *)malloc(20);
557 // Standard_CString Type;
559 // Handle(GEOM_AISShape) result;
560 // Handle(GEOM_InteractiveObject) IO;
562 // if(nbSelected == 1) {
563 // TopExp_Explorer Exp (compound, TopAbs_ShapeEnum(SubShapeType));
565 // if(myGeomBase->GetShapeTypeString(Exp.Current(),Type)) {
566 // aResult->NameType(Type);
567 // sprintf (nameG, "%s_%d", Type, myGeomBase->GetIndex( Exp.Current(), mainTopo, SubShapeType));
570 // aResult->NameType(tr("GEOM_SHAPE"));
571 // sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->myNbGeom++);
573 // result = new GEOM_AISShape(Exp.Current(), nameG);
574 // IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM");
578 // if ( myGeomBase->GetShapeTypeString(compound,Type)) {
579 // aResult->NameType(Type);
580 // sprintf (nameG, "%s_%d", Type, myGeomGUI->myNbGeom++);
582 // aResult->NameType(tr("GEOM_SHAPE"));
583 // sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->myNbGeom++);
585 // result = new GEOM_AISShape(compound, nameG);
586 // IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM");
589 // SALOMEDS::SObject_var SO = aStudy->FindObjectIOR(aResult->Name());
591 // /* open transaction */
592 // QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy());
595 // SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
596 // SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry());
597 // SALOMEDS::GenericAttribute_var anAttr;
598 // SALOMEDS::AttributeName_var aName;
599 // SALOMEDS::AttributeIOR_var anIOR;
600 // SALOMEDS::AttributePixMap_var aPixmap;
602 // bool allreadyexist = false;
604 // if(SO->_is_nil()) {
605 // SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(theObj);
606 // anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
607 // anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
608 // anIOR->SetValue(aResult->Name());
609 // anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName");
610 // aName = SALOMEDS::AttributeName::_narrow(anAttr);
611 // aName->SetValue(result->getName());
613 // anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap");
614 // aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
615 // if(result->Shape().ShapeType() == TopAbs_COMPOUND)
616 // aPixmap->SetPixMap("ICON_OBJBROWSER_COMPOUND");
617 // else if(result->Shape().ShapeType() == TopAbs_COMPSOLID)
618 // aPixmap->SetPixMap("ICON_OBJBROWSER_COMPSOLID");
619 // else if(result->Shape().ShapeType() == TopAbs_SOLID)
620 // aPixmap->SetPixMap("ICON_OBJBROWSER_SOLID");
621 // else if(result->Shape().ShapeType() == TopAbs_SHELL)
622 // aPixmap->SetPixMap("ICON_OBJBROWSER_SHELL");
623 // else if(result->Shape().ShapeType() == TopAbs_FACE)
624 // aPixmap->SetPixMap("ICON_OBJBROWSER_FACE");
625 // else if(result->Shape().ShapeType() == TopAbs_WIRE)
626 // aPixmap->SetPixMap("ICON_OBJBROWSER_WIRE");
627 // else if(result->Shape().ShapeType() == TopAbs_EDGE)
628 // aPixmap->SetPixMap("ICON_OBJBROWSER_EDGE");
629 // else if(result->Shape().ShapeType() == TopAbs_VERTEX)
630 // aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX");
632 // SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
633 // aStudyBuilder->Addreference(newObj1, newObj);
635 // IO->setEntry(newObj->GetID());
636 // aResult->StudyShapeId(newObj->GetID());
639 // allreadyexist = true;
640 // if(!this->SObjectExist(theObj, aResult->Name())) {
641 // SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj);
642 // aStudyBuilder->Addreference(newObj1, SO);
644 // IO->setEntry(SO->GetID());
645 // aResult->StudyShapeId(SO->GetID());
649 // /* commit transaction */
652 // result->setIO(IO);
653 // result->setName(nameG);
655 // if(!allreadyexist)
656 // ic->Display(result);
658 // DisplayGUI* myDisplayGUI = new DisplayGUI();
659 // myDisplayGUI->OnDisplayAll(true);
661 // QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser();
662 // QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_READY"));
667 //=====================================================================================
669 //=====================================================================================
673 __declspec( dllexport )
675 GEOMGUI* GetLibGUI( GeometryGUI* parent )
677 return EntityGUI::GetEntityGUI( parent );