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"
32 #include "QAD_RightFrame.h"
33 #include "QAD_Desktop.h"
34 #include "OCCViewer_Viewer3d.h"
35 #include "OCCViewer_ViewFrame.h"
36 #include "VTKViewer_ViewFrame.h"
37 #include "GEOM_AssemblyBuilder.h"
38 #include "SALOMEGUI_ImportOperation.h"
39 #include "SALOMEGUI_QtCatchCorbaException.hxx"
41 #include <TopoDS_Compound.hxx>
42 #include <BRep_Builder.hxx>
43 #include <TopExp_Explorer.hxx>
45 #include "EntityGUI_SketcherDlg.h" // Sketcher
46 #include "EntityGUI_SubShapeDlg.h" // Method SUBSHAPE
48 #include "utilities.h"
52 EntityGUI* EntityGUI::myGUIObject = 0;
54 //=======================================================================
55 // function : GetEntityGUI()
56 // purpose : Get the only EntityGUI object [ static ]
57 //=======================================================================
58 EntityGUI* EntityGUI::GetEntityGUI()
60 if ( myGUIObject == 0 ) {
61 // init EntityGUI only once
62 myGUIObject = new EntityGUI();
67 //=======================================================================
68 // function : EntityGUI()
69 // purpose : Constructor
70 //=======================================================================
71 EntityGUI::EntityGUI() : GEOMGUI()
73 myGeomBase = new GEOMBase();
74 myGeom = GEOM::GEOM_Gen::_duplicate( GeometryGUI::GetGeomGUI()->GetGeomGen() );
76 mySimulationShape1 = new AIS_Shape(TopoDS_Shape());
77 mySimulationShape2 = new AIS_Shape(TopoDS_Shape());
81 //=======================================================================
82 // function : ~EntityGUI()
83 // purpose : Destructor
84 //=======================================================================
85 EntityGUI::~EntityGUI()
90 //=======================================================================
91 // function : OnGUIEvent()
93 //=======================================================================
94 bool EntityGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
96 GeometryGUI::GetGeomGUI()->EmitSignalDeactivateDialog();
97 SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection());
100 switch (theCommandID)
102 case 404: // SKETCHER
103 GeometryGUI::GetGeomGUI()->ActiveWorkingPlane();
104 aDlg = new EntityGUI_SketcherDlg(parent, "", Sel);
106 case 407: // EXPLODE : use ic
107 aDlg = new EntityGUI_SubShapeDlg(parent, "", Sel);
110 parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
120 //=======================================================================
121 // function : OnSketchEnd()
123 //=======================================================================
124 void EntityGUI::OnSketchEnd(const char *Cmd)
126 /* QAD_Application::getDesktop()->putInfo("Create sketch functionality is NOT implemented in new GEOM kernel
127 (no such Corba interface method). Waiting for SRN to create it...");
130 GEOM::GEOM_Shape_var result = myGeom->MakeSketcher(Cmd);
131 if(result->_is_nil()) {
132 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE"));
135 result->NameType(tr("GEOM_WIRE"));
136 if(myGeomBase->Display(result))
137 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
139 catch(const SALOME::SALOME_Exception& S_ex) {
140 QtCatchCorbaException(S_ex);
147 //=====================================================================================
148 // function : DisplaySimulationShape()
149 // purpose : Displays 'this->mySimulationShape' a pure graphical shape from a TopoDS_Shape
150 //=====================================================================================
151 void EntityGUI::DisplaySimulationShape(const TopoDS_Shape& S1, const TopoDS_Shape& S2)
153 //NRI DEBUG : 14/02/2002
154 if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
157 OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
158 Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
161 /* erase any previous */
162 ic->Erase(mySimulationShape1, Standard_True, Standard_False);
163 ic->ClearPrs(mySimulationShape1);
165 mySimulationShape1 = new AIS_Shape(TopoDS_Shape());
166 mySimulationShape1->Set(S1);
167 mySimulationShape1->SetColor(Quantity_NOC_RED);
169 ic->Deactivate(mySimulationShape1);
170 ic->Display(mySimulationShape1, Standard_False);
171 mySimulationShape1->UnsetColor();
174 ic->Erase(mySimulationShape2, Standard_True, Standard_False);
175 ic->ClearPrs(mySimulationShape2);
177 mySimulationShape2 = new AIS_Shape(TopoDS_Shape());
178 mySimulationShape2->Set(S2);
179 mySimulationShape2->SetColor(Quantity_NOC_VIOLET);
181 ic->Deactivate(mySimulationShape2);
182 ic->Display(mySimulationShape2, Standard_False);
183 mySimulationShape2->UnsetColor();
185 ic->UpdateCurrentViewer();
187 catch(Standard_Failure) {
188 MESSAGE("Exception catched in EntityGUI::DisplaySimulationShape ");
194 //==================================================================================
195 // function : EraseSimulationShape()
196 // purpose : Clears the display of 'mySimulationShape' a pure graphical shape
197 //==================================================================================
198 void EntityGUI::EraseSimulationShape()
200 int count = QAD_Application::getDesktop()->getActiveStudy()->getStudyFramesCount();
201 for(int i = 0; i < count; i++) {
202 if(QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i)->getTypeView() == VIEW_OCC) {
203 OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i)->getRightFrame()->getViewFrame())->getViewer();
204 Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
205 ic->Erase(mySimulationShape1, Standard_True, Standard_False);
206 ic->ClearPrs(mySimulationShape1);
207 ic->Erase(mySimulationShape2, Standard_True, Standard_False);
208 ic->ClearPrs(mySimulationShape2);
209 ic->UpdateCurrentViewer();
214 //=====================================================================================
215 // function : SObjectExist()
217 //=====================================================================================
218 bool EntityGUI::SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* IOR)
220 SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
221 SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(theFatherObject);
222 SALOMEDS::SObject_var RefSO;
223 SALOMEDS::GenericAttribute_var anAttr;
224 SALOMEDS::AttributeIOR_var anIOR;
225 for(; it->More();it->Next()) {
226 SALOMEDS::SObject_var SO= it->Value();
227 if(SO->FindAttribute(anAttr, "AttributeIOR")) {
228 anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
229 if(strcmp( anIOR->Value(), IOR ) == 0)
232 if(SO->ReferencedObject(RefSO)) {
233 if(RefSO->FindAttribute(anAttr, "AttributeIOR")) {
234 anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
235 if(strcmp(anIOR->Value(), IOR) == 0)
244 //=====================================================================================
245 // function : OnSubShapeGetAll()
246 // purpose : Explode a shape in all sub shapes with a SubShapeType
247 //=====================================================================================
248 bool EntityGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType)
250 QAD_Application::getDesktop()->putInfo("OnSubShapeGetAll method from EntityGUI should be reimplemented ...");
252 SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
253 SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(ShapeTopoIOR);
254 if(theObj->_is_nil()) {
255 QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY"));
259 SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
260 SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry());
261 SALOMEDS::GenericAttribute_var anAttr;
262 SALOMEDS::AttributeName_var aName;
263 SALOMEDS::AttributeIOR_var anIOR;
264 SALOMEDS::AttributePixMap_var aPixmap;
266 // We create a sub object for each sub shape as attribute of the main object
267 // Each sub object contains list (length=1) containing its index in the main shape
268 GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(ShapeTopoIOR);
269 GEOM::GEOM_Gen::ListOfGeomShapes_var listGeomShapes = new GEOM::GEOM_Gen::ListOfGeomShapes;
270 GEOM::GEOM_Shape_var aResult;
273 listGeomShapes = myGeom->SubShapeAll(aShape, SubShapeType);
274 if(listGeomShapes->length() < 1) {
275 QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_ABORT"));
279 catch(const SALOME::SALOME_Exception& S_ex) {
280 QtCatchCorbaException(S_ex);
284 QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy());
287 TopoDS_Shape mainTopo = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape);
288 TopoDS_Shape mainShape;
291 if(aShape->IsMainShape()) {
292 mainShape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape);
296 aShape = myGeom->GetIORFromString(aShape->MainName());
299 // Loop on each sub shape created
300 // int i = 1 ; index for the nameType
301 for(int j=0; j<listGeomShapes->length(); j++) {
302 // Get each sub shape extracted CORBA and OCC
303 aResult = listGeomShapes[j] ;
304 TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, aResult);
307 QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_ABORT"));
311 // Set the nameType of sub shape
312 char* nameG = (char *)malloc(20);
313 Standard_CString Type;
314 if(myGeomBase->GetShapeTypeString(S, Type)) {
315 aResult->NameType(Type);
316 sprintf(nameG, "%s_%d", Type, myGeomBase->GetIndex(S, mainShape, SubShapeType));
319 aResult->NameType(tr("GEOM_SHAPE"));
320 sprintf(nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->myNbGeom++);
322 SALOMEDS::SObject_var SO = aStudy->FindObjectIOR(aResult->Name());
324 bool allreadyexist = false;
326 if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
327 OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
328 Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
330 Handle(GEOM_AISShape) result = new GEOM_AISShape(S, nameG);
331 Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM");
333 MESSAGE ("SO->_is_nil() " << SO->_is_nil())
336 SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(theObj);
337 anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName");
338 aName = SALOMEDS::AttributeName::_narrow(anAttr);
339 aName->SetValue(nameG);
340 anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
341 anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
342 anIOR->SetValue(aResult->Name());
344 anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap");
345 aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
346 MESSAGE(" Type " << S.ShapeType())
347 if (S.ShapeType() == TopAbs_COMPOUND)
348 aPixmap->SetPixMap("ICON_OBJBROWSER_COMPOUND");
349 else if(S.ShapeType() == TopAbs_COMPSOLID)
350 aPixmap->SetPixMap("ICON_OBJBROWSER_COMPSOLID");
351 else if(S.ShapeType() == TopAbs_SOLID)
352 aPixmap->SetPixMap("ICON_OBJBROWSER_SOLID");
353 else if(S.ShapeType() == TopAbs_SHELL)
354 aPixmap->SetPixMap("ICON_OBJBROWSER_SHELL");
355 else if(S.ShapeType() == TopAbs_FACE)
356 aPixmap->SetPixMap("ICON_OBJBROWSER_FACE");
357 else if(S.ShapeType() == TopAbs_WIRE)
358 aPixmap->SetPixMap("ICON_OBJBROWSER_WIRE");
359 else if(S.ShapeType() == TopAbs_EDGE)
360 aPixmap->SetPixMap("ICON_OBJBROWSER_EDGE");
361 else if(S.ShapeType() == TopAbs_VERTEX)
362 aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX");
364 MESSAGE(" aPixmap->GetPixMap " << aPixmap->GetPixMap())
366 SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
367 aStudyBuilder->Addreference(newObj1, newObj);
368 IO->setEntry(newObj->GetID());
370 aResult->StudyShapeId(newObj->GetID());
373 allreadyexist = true;
374 if(!this->SObjectExist(theObj, aResult->Name())) {
375 SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj);
376 aStudyBuilder->Addreference(newObj1, SO);
377 IO->setEntry(SO->GetID());
378 aResult->StudyShapeId(SO->GetID());
383 result->setName(nameG);
388 else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
389 VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
391 int themode = myRenderInter->GetDisplayMode();
392 vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
393 vtkRenderWindow *renWin = theRenderer->GetRenderWindow();
395 Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM");
398 SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(theObj);
399 anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
400 anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
401 anIOR->SetValue(aResult->Name());
402 anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName");
403 aName = SALOMEDS::AttributeName::_narrow(anAttr);
404 aName->SetValue(nameG);
406 anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap");
407 aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
408 if(S.ShapeType() == TopAbs_COMPOUND)
409 aPixmap->SetPixMap("ICON_OBJBROWSER_COMPOUND");
410 else if(S.ShapeType() == TopAbs_COMPSOLID)
411 aPixmap->SetPixMap("ICON_OBJBROWSER_COMPSOLID");
412 else if(S.ShapeType() == TopAbs_SOLID)
413 aPixmap->SetPixMap("ICON_OBJBROWSER_SOLID");
414 else if(S.ShapeType() == TopAbs_SHELL)
415 aPixmap->SetPixMap("ICON_OBJBROWSER_SHELL");
416 else if(S.ShapeType() == TopAbs_FACE)
417 aPixmap->SetPixMap("ICON_OBJBROWSER_FACE");
418 else if(S.ShapeType() == TopAbs_WIRE)
419 aPixmap->SetPixMap("ICON_OBJBROWSER_WIRE");
420 else if(S.ShapeType() == TopAbs_EDGE)
421 aPixmap->SetPixMap("ICON_OBJBROWSER_EDGE");
422 else if(S.ShapeType() == TopAbs_VERTEX)
423 aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX");
425 SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
426 aStudyBuilder->Addreference(newObj1, newObj);
427 IO->setEntry(newObj->GetID());
430 allreadyexist = true;
431 if(!this->SObjectExist(theObj, aResult->Name())) {
432 SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj);
433 aStudyBuilder->Addreference(newObj1, SO);
434 IO->setEntry(SO->GetID());
439 vtkActorCollection* theActors = GEOM_AssemblyBuilder::BuildActors(S,0,themode,Standard_True);
440 theActors->InitTraversal();
441 vtkActor* anActor = (vtkActor*)theActors->GetNextActor();
442 while(!(anActor==NULL)) {
443 GEOM_Actor* GActor = GEOM_Actor::SafeDownCast(anActor);
445 GActor->setName(nameG);
446 theRenderer->AddActor(GActor);
448 anActor = (vtkActor*)theActors->GetNextActor();
454 // commit transaction
457 QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser();
458 QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_READY"));
464 //=====================================================================================
465 // function : OnSubShapeGetSelected()
467 //=====================================================================================
468 bool EntityGUI::OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType, Standard_Integer& aLocalContextId, bool& myUseLocalContext)
470 QAD_Application::getDesktop()->putInfo("OnSubShapeGetSelected method from EntityGUI should be reimplemented ...");
471 // //* Test the type of viewer */
472 // if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
475 // SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
476 // SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(ShapeTopoIOR);
477 // if(theObj->_is_nil()) {
478 // QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY"));
482 // OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
483 // Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
485 // if( myUseLocalContext == false ) {
486 // /* local context is from DialogBox */
487 // MESSAGE("Error : No local context opened for sub shapes method" << endl ) ;
491 // GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString( ShapeTopoIOR );
492 // TopoDS_Shape mainTopo = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape);
494 // TopoDS_Shape mainShape;
495 // bool main = false;
497 // if(aShape->IsMainShape()) {
498 // mainShape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape);
502 // aShape = myGeom->GetIORFromString(aShape->MainName());
505 // GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID;
506 // ic->InitSelected();
507 // int nbSelected = ic->NbSelected();
508 // ListOfID->length(nbSelected);
510 // TopoDS_Compound compound;
511 // ic->InitSelected(); /* to init again */
513 // B.MakeCompound(compound);
516 // /* We create a unique compound containing all the sub shapes selected by user as attribute of the main shape */
517 // /* the compound is homogenous by selection */
518 // while(ic->MoreSelected()) {
519 // int index = myGeomBase->GetIndex(ic->SelectedShape(), mainShape, SubShapeType);
520 // ListOfID[i] = index;
521 // B.Add(compound, ic->SelectedShape());
523 // ic->NextSelected();
526 // /* Test if user has selected sub shapes */
527 // if(ListOfID->length() < 1)
530 // GEOM::GEOM_Shape_var aResult;
532 // aResult = myGeom->SubShape(aShape, SubShapeType, ListOfID);
534 // catch (const SALOME::SALOME_Exception& S_ex) {
535 // QtCatchCorbaException(S_ex);
538 // /* local context from DialogBox */
539 // ic->CloseLocalContext(aLocalContextId);
540 // myUseLocalContext = false ;
542 // char* nameG = (char *)malloc(20);
543 // Standard_CString Type;
545 // Handle(GEOM_AISShape) result;
546 // Handle(GEOM_InteractiveObject) IO;
548 // if(nbSelected == 1) {
549 // TopExp_Explorer Exp (compound, TopAbs_ShapeEnum(SubShapeType));
551 // if(myGeomBase->GetShapeTypeString(Exp.Current(),Type)) {
552 // aResult->NameType(Type);
553 // sprintf (nameG, "%s_%d", Type, myGeomBase->GetIndex( Exp.Current(), mainTopo, SubShapeType));
556 // aResult->NameType(tr("GEOM_SHAPE"));
557 // sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->myNbGeom++);
559 // result = new GEOM_AISShape(Exp.Current(), nameG);
560 // IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM");
564 // if ( myGeomBase->GetShapeTypeString(compound,Type)) {
565 // aResult->NameType(Type);
566 // sprintf (nameG, "%s_%d", Type, myGeomGUI->myNbGeom++);
568 // aResult->NameType(tr("GEOM_SHAPE"));
569 // sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->myNbGeom++);
571 // result = new GEOM_AISShape(compound, nameG);
572 // IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM");
575 // SALOMEDS::SObject_var SO = aStudy->FindObjectIOR(aResult->Name());
577 // /* open transaction */
578 // QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy());
581 // SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
582 // SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry());
583 // SALOMEDS::GenericAttribute_var anAttr;
584 // SALOMEDS::AttributeName_var aName;
585 // SALOMEDS::AttributeIOR_var anIOR;
586 // SALOMEDS::AttributePixMap_var aPixmap;
588 // bool allreadyexist = false;
590 // if(SO->_is_nil()) {
591 // SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(theObj);
592 // anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
593 // anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
594 // anIOR->SetValue(aResult->Name());
595 // anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName");
596 // aName = SALOMEDS::AttributeName::_narrow(anAttr);
597 // aName->SetValue(result->getName());
599 // anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap");
600 // aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
601 // if(result->Shape().ShapeType() == TopAbs_COMPOUND)
602 // aPixmap->SetPixMap("ICON_OBJBROWSER_COMPOUND");
603 // else if(result->Shape().ShapeType() == TopAbs_COMPSOLID)
604 // aPixmap->SetPixMap("ICON_OBJBROWSER_COMPSOLID");
605 // else if(result->Shape().ShapeType() == TopAbs_SOLID)
606 // aPixmap->SetPixMap("ICON_OBJBROWSER_SOLID");
607 // else if(result->Shape().ShapeType() == TopAbs_SHELL)
608 // aPixmap->SetPixMap("ICON_OBJBROWSER_SHELL");
609 // else if(result->Shape().ShapeType() == TopAbs_FACE)
610 // aPixmap->SetPixMap("ICON_OBJBROWSER_FACE");
611 // else if(result->Shape().ShapeType() == TopAbs_WIRE)
612 // aPixmap->SetPixMap("ICON_OBJBROWSER_WIRE");
613 // else if(result->Shape().ShapeType() == TopAbs_EDGE)
614 // aPixmap->SetPixMap("ICON_OBJBROWSER_EDGE");
615 // else if(result->Shape().ShapeType() == TopAbs_VERTEX)
616 // aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX");
618 // SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
619 // aStudyBuilder->Addreference(newObj1, newObj);
621 // IO->setEntry(newObj->GetID());
622 // aResult->StudyShapeId(newObj->GetID());
625 // allreadyexist = true;
626 // if(!this->SObjectExist(theObj, aResult->Name())) {
627 // SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj);
628 // aStudyBuilder->Addreference(newObj1, SO);
630 // IO->setEntry(SO->GetID());
631 // aResult->StudyShapeId(SO->GetID());
635 // /* commit transaction */
638 // result->setIO(IO);
639 // result->setName(nameG);
641 // if(!allreadyexist)
642 // ic->Display(result);
644 // DisplayGUI* myDisplayGUI = new DisplayGUI();
645 // myDisplayGUI->OnDisplayAll(true);
647 // QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser();
648 // QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_READY"));
653 //=====================================================================================
655 //=====================================================================================
660 return EntityGUI::GetEntityGUI();