Salome HOME
Merge from V6_main 01/04/2013
[modules/gui.git] / src / SOCC / SOCC_ViewModel.cxx
1 // Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #include "SOCC_ViewModel.h"
24
25 #include "SOCC_Prs.h"
26 #include "SOCC_ViewWindow.h"
27
28 #include "OCCViewer_Trihedron.h"
29
30 #include "SUIT_Session.h"
31 #include "SUIT_ResourceMgr.h"
32 //#include "SUIT_Application.h"
33
34 //#include "ToolsGUI.h"
35
36 // Temporarily commented to avoid awful dependecy on SALOMEDS
37 // TODO: better mechanism of storing display/erse status in a study
38 // should be provided...
39 //#include <SALOMEconfig.h>
40 //#include CORBA_CLIENT_HEADER(SALOMEDS)
41
42 #include <AIS_ListIteratorOfListOfInteractive.hxx>
43 #include <Visual3d_View.hxx>
44
45 #include <SALOME_AISShape.hxx>
46 #include <SALOME_AISObject.hxx>
47 #include <SALOME_InteractiveObject.hxx>
48 #include <SALOME_ListIO.hxx>
49
50 // Temporarily commented to avoid awful dependecy on SALOMEDS
51 // TODO: better mechanism of storing display/erse status in a study
52 // should be provided...
53 //#include <Utils_ORB_INIT.hxx>
54 //#include <Utils_SINGLETON.hxx>
55 //#include <SALOME_ModuleCatalog_impl.hxx>
56 //#include <SALOME_NamingService.hxx>
57
58 //#include "SALOMEDSClient.hxx"
59 //#include "SALOMEDS_StudyManager.hxx"
60 #include <Basics_OCCTVersion.hxx>
61
62 #include <AIS_TypeOfIso.hxx>
63 #include <Precision.hxx>
64
65 // in order NOT TO link with SalomeApp, here the code returns SALOMEDS_Study.
66 // SalomeApp_Study::studyDS() does it as well, but -- here it is retrieved from 
67 // SALOMEDS::StudyManager - no linkage with SalomeApp. 
68
69 // Temporarily commented to avoid awful dependecy on SALOMEDS
70 // TODO: better mechanism of storing display/erse status in a study
71 // should be provided...
72 //static _PTR(Study) getStudyDS() 
73 //{
74 //  SALOMEDSClient_Study* aStudy = NULL;
75 //  _PTR(StudyManager) aMgr( new SALOMEDS_StudyManager() );
76
77   // get id of SUIT_Study, if it's a SalomeApp_Study, it will return
78   //    id of its underlying SALOMEDS::Study
79 //  SUIT_Application* app = SUIT_Session::session()->activeApplication();
80 //  if ( !app )  return _PTR(Study)(aStudy);
81 //  SUIT_Study* stud = app->activeStudy();
82 //  if ( !stud ) return _PTR(Study)(aStudy);  
83 //  const int id = stud->id(); // virtual method, must return SALOMEDS_Study id
84   // get SALOMEDS_Study with this id from StudyMgr
85 //  return aMgr->GetStudyByID( id );
86 //}
87
88 /*!
89   Constructor
90   \param DisplayTrihedron - is trihedron displayed
91 */
92 SOCC_Viewer::SOCC_Viewer( bool DisplayTrihedron )
93 : OCCViewer_Viewer( DisplayTrihedron )
94 {
95 }
96
97 /*!
98   Destructor
99 */
100 SOCC_Viewer::~SOCC_Viewer()
101 {
102 }
103
104 /*!
105   Hilights/unhilights object in viewer
106   \param obj - object to be updated
107   \param hilight - if it is true, object will be hilighted, otherwise it will be unhilighted
108   \param update - update current viewer
109 */
110 bool SOCC_Viewer::highlight( const Handle(SALOME_InteractiveObject)& obj,
111                              bool hilight, bool upd )
112 {
113   bool isInLocal = getAISContext()->HasOpenedContext();
114   //SUIT_Study* ActiveStudy = SUIT_Application::getDesktop()->getActiveStudy();
115   //SALOME_Selection* Sel = SALOME_Selection::Selection( ActiveStudy->getSelection() );
116
117   AIS_ListOfInteractive List;
118   getAISContext()->DisplayedObjects(List);
119   
120   AIS_ListIteratorOfListOfInteractive ite(List);
121   for ( ; ite.More(); ite.Next() )
122   {
123     Handle(SALOME_InteractiveObject) anObj =
124       Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
125
126     if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( obj ) )
127     {
128       if ( !isInLocal )
129           OCCViewer_Viewer::highlight( ite.Value(), hilight, false );
130       // highlight sub-shapes only when local selection is active
131       else
132       {
133         /*if ( ite.Value()->IsKind( STANDARD_TYPE( SALOME_AISShape ) ) )
134         {
135           Handle(SALOME_AISShape) aSh = Handle(SALOME_AISShape)::DownCast( ite.Value() );
136           TColStd_IndexedMapOfInteger MapIndex;
137           Sel->GetIndex( IObject, MapIndex );
138           aSh->highlightSubShapes( MapIndex, highlight );
139         }*/
140       }
141       break;
142     }
143   }
144     
145   if( upd )
146     update();
147     
148   return false;
149 }
150
151 /*!
152   \return true if object is in viewer or in collector
153   \param obj - object to be checked
154   \param onlyInViewer - search object only in viewer (so object must be displayed)
155 */
156 bool SOCC_Viewer::isInViewer( const Handle(SALOME_InteractiveObject)& obj,
157                               bool onlyInViewer )
158 {
159   AIS_ListOfInteractive List;
160   getAISContext()->DisplayedObjects(List);
161
162   if( !onlyInViewer ) {
163     AIS_ListOfInteractive List1;
164     getAISContext()->ObjectsInCollector(List1);
165     List.Append(List1);
166   }
167
168   AIS_ListIteratorOfListOfInteractive ite(List);
169   for ( ; ite.More(); ite.Next() )
170   {
171     Handle(SALOME_InteractiveObject) anObj =
172         Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
173
174     if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( obj ) )
175       return true;
176   }
177   return false;
178 }
179
180 /*!
181   \return true if object is displayed in viewer
182   \param obj - object to be checked
183 */
184 bool SOCC_Viewer::isVisible( const Handle(SALOME_InteractiveObject)& obj )
185 {
186
187   std::map< std::string , std::vector<Handle(AIS_InteractiveObject)> >::iterator it=entry2aisobjects.find(obj->getEntry());
188   if(it != entry2aisobjects.end())
189     {
190       // get context
191       Handle (AIS_InteractiveContext) ic = getAISContext();
192       std::vector<Handle(AIS_InteractiveObject)>& List = it->second;
193       for( unsigned int ind = 0; ind < List.size(); ind++ )
194         {
195           Handle(AIS_InteractiveObject) anAIS=List[ind];
196           if(ic->IsDisplayed(anAIS))
197             return true;
198         }
199   }
200   
201   return false;
202 }
203
204 /*!
205   Sets color of object
206   \param obj - object to be updated
207   \param color - new color
208   \param update - update current viewer
209 */
210 void SOCC_Viewer::setColor( const Handle(SALOME_InteractiveObject)& obj,
211                             const QColor& color, bool update )
212 {
213   if(obj.IsNull() || !obj->hasEntry() )
214     return;
215
216   if(entry2aisobjects.count(obj->getEntry())>0)
217     {
218       // get context
219       Handle (AIS_InteractiveContext) ic = getAISContext();
220       std::vector<Handle(AIS_InteractiveObject)>& List = entry2aisobjects[obj->getEntry()];
221       for( unsigned int ind = 0; ind < List.size(); ind++ )
222         {
223           Handle(AIS_InteractiveObject) anAIS=List[ind];
224           if( !anAIS.IsNull() && ic->IsDisplayed(anAIS))
225             OCCViewer_Viewer::setColor( anAIS, color, update );
226         }
227     }
228 }
229
230 /*!
231   Changes display mode of object
232   \param obj - object to be processed
233   \param mode - new display mode
234   \param update - update current viewer
235 */
236 void SOCC_Viewer::switchRepresentation( const Handle(SALOME_InteractiveObject)& obj,
237                                         int mode, bool update )
238 {
239   if(obj.IsNull() || !obj->hasEntry() )
240     return;
241
242   if(entry2aisobjects.count(obj->getEntry())>0)
243     {
244       // get context
245       Handle (AIS_InteractiveContext) ic = getAISContext();
246       std::vector<Handle(AIS_InteractiveObject)>& List = entry2aisobjects[obj->getEntry()];
247       for( unsigned int ind = 0; ind < List.size(); ind++ )
248         {
249           Handle(AIS_InteractiveObject) anAIS=List[ind];
250           if( !anAIS.IsNull() && ic->IsDisplayed(anAIS))
251             OCCViewer_Viewer::switchRepresentation( anAIS, mode, update );
252         }
253     }
254 }
255
256 /*!
257   Changes transparency of object
258   \param obj - object to be processed
259   \param trans - new transparency
260   \param update - update current viewer
261 */
262 void SOCC_Viewer::setTransparency( const Handle(SALOME_InteractiveObject)& obj,
263                                    float trans, bool update )
264 {
265   if(obj.IsNull() || !obj->hasEntry() )
266     return;
267
268   if(entry2aisobjects.count(obj->getEntry())>0)
269     {
270       // get context
271       Handle (AIS_InteractiveContext) ic = getAISContext();
272       std::vector<Handle(AIS_InteractiveObject)>& List = entry2aisobjects[obj->getEntry()];
273       for( unsigned int ind = 0; ind < List.size(); ind++ )
274         {
275           Handle(AIS_InteractiveObject) anAIS=List[ind];
276           if( !anAIS.IsNull() && ic->IsDisplayed(anAIS))
277             OCCViewer_Viewer::setTransparency( anAIS, trans, update );
278         }
279     }
280 }
281
282 /*!
283   Changes name of object
284   \param obj - object to be renamed
285   \param name - new name
286 */
287 void SOCC_Viewer::rename( const Handle(SALOME_InteractiveObject)& obj,
288                           const QString& name )
289 {
290   AIS_ListOfInteractive List;
291   getAISContext()->DisplayedObjects(List);
292   
293   AIS_ListIteratorOfListOfInteractive ite(List);
294   while (ite.More())
295   {
296     if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISShape)))
297     {
298       Handle(SALOME_AISShape) aSh = Handle(SALOME_AISShape)::DownCast(ite.Value());
299       
300       if ( aSh->hasIO() )
301       {
302         Handle(SALOME_InteractiveObject) IO = aSh->getIO();
303         if ( IO->isSame( obj ) )
304         {
305           aSh->setName( name.toLatin1().data() );
306           break;
307         }
308       }
309     }
310     else if ( ite.Value()->IsKind( STANDARD_TYPE( SALOME_AISObject ) ) )
311     {
312       Handle(SALOME_AISObject) aSh = Handle(SALOME_AISObject)::DownCast( ite.Value() );
313
314       // Add code here, if someone create a MODULE_AISObject.
315     }
316     ite.Next();
317   }
318 }
319
320
321 /*!
322   Display presentation
323   \param prs - presentation
324 */
325 void SOCC_Viewer::Display( const SALOME_OCCPrs* prs )
326 {
327   // try do downcast object
328   const SOCC_Prs* anOCCPrs = dynamic_cast<const SOCC_Prs*>( prs );
329   if ( !anOCCPrs || anOCCPrs->IsNull() )
330     return;
331
332   // get SALOMEDS Study
333   // Temporarily commented to avoid awful dependecy on SALOMEDS
334   // TODO: better mechanism of storing display/erse status in a study
335   // should be provided...
336   //  _PTR(Study) study(getStudyDS());
337
338   // get context
339   Handle (AIS_InteractiveContext) ic = getAISContext();
340
341   // get objects to be displayed
342   AIS_ListOfInteractive anAISObjects;
343   anOCCPrs->GetObjects( anAISObjects );
344
345   AIS_ListIteratorOfListOfInteractive aIter( anAISObjects );
346   for ( ; aIter.More(); aIter.Next() )
347   {
348     Handle(AIS_InteractiveObject) anAIS = aIter.Value();
349     if ( !anAIS.IsNull() )
350     {
351       // try to find presentation in the viewer
352
353       // if the object is already displayed - nothing to do more
354       if(ic->IsDisplayed(anAIS))
355         {
356           // Deactivate object if necessary
357           if ( !anOCCPrs->ToActivate() )
358             ic->Deactivate( anAIS );
359           continue;
360         }
361
362       // then try to find presentation in the collector
363       if(ic->IsInCollector(anAIS))
364         {
365           ic->DisplayFromCollector( anAIS, false );
366           // Deactivate object if necessary
367           if ( !anOCCPrs->ToActivate() )
368             ic->Deactivate( anAIS );
369
370           // Set visibility flag
371           // Temporarily commented to avoid awful dependecy on SALOMEDS
372           // TODO: better mechanism of storing display/erse status in a study
373           // should be provided...
374           //Handle(SALOME_InteractiveObject) anObj =
375           //  Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );
376           //if ( !anObj.IsNull() && anObj->hasEntry() )
377           //{
378           //  if ( study )
379           //    ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this );
380           //}
381           continue;
382         }
383
384       // if object is not displayed and not found in the collector - display it
385       if ( anAIS->IsKind( STANDARD_TYPE(AIS_Trihedron) ) )
386       {
387         Handle(AIS_Trihedron) aTrh = Handle(AIS_Trihedron)::DownCast( anAIS );
388         double aNewSize = 100, aSize = 100;
389         computeTrihedronSize( aNewSize, aSize );
390         aTrh->SetSize( aTrh == getTrihedron() ? aNewSize : 0.5 * aNewSize );
391       }
392
393       ic->Display( anAIS, false );
394       
395 #if OCC_VERSION_LARGE > 0x06050200 
396       Handle(SALOME_AISShape) aSh = Handle(SALOME_AISShape)::DownCast(anAIS);
397       if ( !aSh.IsNull() ) {
398           bool top = (aSh->isTopLevel() && aSh->switchTopLevel());
399               ic->SetZLayer( aSh, top ? getTopLayerId() : 0 );
400                   if(!aSh->toActivate()) {
401                         ic->Deactivate( aSh );
402                   }
403       }
404 #endif
405       //Register anAIS (if it has an entry) in entry2aisobjects map
406       Handle(SALOME_InteractiveObject) anObj = Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );
407       if ( !anObj.IsNull() && anObj->hasEntry())
408         {
409           std::vector<Handle(AIS_InteractiveObject)>& List = entry2aisobjects[anObj->getEntry()];
410           int found=0;
411           for ( unsigned int ind = 0; ind < List.size(); ind++ )
412           {
413             if(List[ind] == anAIS)
414               {
415                 found=1;
416                 break;
417               }
418           }
419           if(!found)
420             {
421               List.push_back(anAIS);
422             }
423         }
424
425       // Set visibility flag
426       // Temporarily commented to avoid awful dependecy on SALOMEDS
427       // TODO: better mechanism of storing display/erse status in a study
428       // should be provided...
429       //Handle(SALOME_InteractiveObject) anObj =
430       //  Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );
431       //if ( !anObj.IsNull() && anObj->hasEntry() )
432       //{
433       //  if ( study  )
434       //    ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this );
435       //}
436
437       // Deactivate object if necessary
438       if ( !anOCCPrs->ToActivate() )
439         ic->Deactivate( anAIS );
440     }
441   }
442   updateTrihedron();
443 }
444
445
446 /*!
447   Erase presentation
448   \param prs - presentation
449   \param forced - removes object from context
450 */
451 void SOCC_Viewer::Erase( const SALOME_OCCPrs* prs, const bool forced )
452 {
453   // try do downcast object
454   const SOCC_Prs* anOCCPrs = dynamic_cast<const SOCC_Prs*>( prs );
455   if ( !anOCCPrs || anOCCPrs->IsNull() )
456     return;
457
458   // get SALOMEDS Study
459   // Temporarily commented to avoid awful dependecy on SALOMEDS
460   // TODO: better mechanism of storing display/erse status in a study
461   // should be provided...
462   //  _PTR(Study) study(getStudyDS());
463
464   // get context
465   Handle(AIS_InteractiveContext) ic = getAISContext();
466
467   // get objects to be erased
468   AIS_ListOfInteractive anAISObjects;
469   anOCCPrs->GetObjects( anAISObjects );
470
471   AIS_ListIteratorOfListOfInteractive aIter( anAISObjects );
472   for ( ; aIter.More(); aIter.Next() ) {
473     Handle(AIS_InteractiveObject) anAIS = aIter.Value();
474     if ( !anAIS.IsNull() ) {
475       // erase the object from context : move it to collector
476       ic->Erase( anAIS, false, forced ? false : true );
477
478       // Set visibility flag if necessary
479       // Temporarily commented to avoid awful dependecy on SALOMEDS
480       // TODO: better mechanism of storing display/erse status in a study
481       // should be provided...
482       //if ( !forced )
483       //{
484       //  Handle(SALOME_InteractiveObject) anObj =
485       //    Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );
486       //  if ( !anObj.IsNull() && anObj->hasEntry() )
487       //  {
488       //  if ( study )
489       //    ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this );
490       //  }
491       //}
492     }
493   }
494   updateTrihedron();
495 }
496
497
498 /*!
499   Erase all presentations
500   \param forced - removes all objects from context
501 */
502 void SOCC_Viewer::EraseAll( const bool forced )
503 {
504   // get SALOMEDS Study
505   // Temporarily commented to avoid awful dependecy on SALOMEDS
506   // TODO: better mechanism of storing display/erse status in a study
507   // should be provided...
508   //  _PTR(Study) study(getStudyDS());
509
510   // get context
511   Handle(AIS_InteractiveContext) ic = getAISContext();
512
513   // check if trihedron is displayed
514   Standard_Boolean isTrihedronDisplayed = ic->IsDisplayed( getTrihedron() );
515
516   // get objects to be erased (all currently displayed objects)
517   AIS_ListOfInteractive aList;
518   ic->DisplayedObjects( aList );
519   AIS_ListIteratorOfListOfInteractive anIter( aList );
520   for ( ; anIter.More(); anIter.Next() ) {
521     if ( (isTrihedronDisplayed && anIter.Value()->DynamicType() == STANDARD_TYPE( AIS_Trihedron )) ||
522          anIter.Value()->DynamicType() == STANDARD_TYPE( OCCViewer_Trihedron ))
523       continue;
524
525     // erase an object
526     Handle(AIS_InteractiveObject) anIO = anIter.Value();
527     ic->Erase( anIO, false, forced ? false : true );
528     
529     // Set visibility flag if necessary
530     // Temporarily commented to avoid awful dependecy on SALOMEDS
531     // TODO: better mechanism of storing display/erse status in a study
532     // should be provided...
533     //if ( !forced ) {
534     //  Handle(SALOME_InteractiveObject) anObj =
535     //  Handle(SALOME_InteractiveObject)::DownCast( anIO->GetOwner() );
536
537     //  if ( !anObj.IsNull() && anObj->hasEntry() ) {
538     //  if ( study )
539     //    ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this );
540     //  }
541     //}
542   }
543
544   Repaint();
545   updateTrihedron();
546 }
547
548 /*!
549   Create presentation corresponding to the entry
550   \param entry - entry
551 */
552 SALOME_Prs* SOCC_Viewer::CreatePrs( const char* entry )
553 {
554   SOCC_Prs* prs = new SOCC_Prs();
555   if ( entry )
556   {
557     if(entry2aisobjects.count(entry)>0)
558       {
559         //ais object exists
560         std::vector<Handle(AIS_InteractiveObject)> List = entry2aisobjects[entry];
561         // get context
562         Handle(AIS_InteractiveContext) ic = getAISContext();
563         //add all ais
564         for ( unsigned int ind = 0; ind < List.size(); ind++ )
565           {
566             Handle(AIS_InteractiveObject) anAIS=List[ind];
567             if(ic->IsDisplayed(anAIS)||ic->IsInCollector(anAIS))
568               {
569                 prs->AddObject( anAIS );
570               }
571           }
572       }
573   }
574   return prs;
575 }
576
577 /*!
578   Activates selection of sub-shapes
579 */
580 void SOCC_Viewer::LocalSelection( const SALOME_OCCPrs* thePrs, const int theMode )
581 {
582   Handle(AIS_InteractiveContext) ic = getAISContext();
583   
584   const SOCC_Prs* anOCCPrs = dynamic_cast<const SOCC_Prs*>( thePrs );
585   if ( ic.IsNull() )
586     return;
587   
588   // Open local context if there is no one
589   bool allObjects = thePrs == 0 || thePrs->IsNull();
590   if ( !ic->HasOpenedContext() ) {
591     ic->ClearCurrents( false );
592     ic->OpenLocalContext( allObjects, true, true );
593   }
594
595   AIS_ListOfInteractive anObjs;
596   // Get objects to be activated
597   if ( allObjects ) 
598     ic->DisplayedObjects( anObjs );
599   else
600     anOCCPrs->GetObjects( anObjs );
601
602   // Activate selection of objects from prs
603   AIS_ListIteratorOfListOfInteractive aIter( anObjs );
604   for ( ; aIter.More(); aIter.Next() ) {
605     Handle(AIS_InteractiveObject) anAIS = aIter.Value();
606     if ( !anAIS.IsNull() )
607     {
608       if ( anAIS->IsKind( STANDARD_TYPE( AIS_Shape ) ) )
609       {
610         ic->Load( anAIS, -1, false );
611         ic->Activate( anAIS, AIS_Shape::SelectionMode( (TopAbs_ShapeEnum)theMode ) );
612       }
613       else if ( anAIS->DynamicType() != STANDARD_TYPE(AIS_Trihedron) )
614       {
615         ic->Load( anAIS, -1, false );
616         ic->Activate( anAIS, theMode );
617       }
618     }
619   }
620 }
621
622 /*!
623   Deactivates selection of sub-shapes
624 */
625 void SOCC_Viewer::GlobalSelection( const bool update ) const
626 {
627   Handle(AIS_InteractiveContext) ic = getAISContext();
628   if ( !ic.IsNull() )
629   {
630     ic->CloseAllContexts( false );
631     if ( update )
632       ic->CurrentViewer()->Redraw();
633   }
634 }
635
636
637 /*!
638   \Collect objects visible in viewer
639   \param theList - visible objects collection
640 */
641 void SOCC_Viewer::GetVisible( SALOME_ListIO& theList )
642 {
643   AIS_ListOfInteractive List;
644   getAISContext()->DisplayedObjects(List);
645   
646   AIS_ListIteratorOfListOfInteractive ite(List);
647   for ( ; ite.More(); ite.Next() )
648   {
649     Handle(SALOME_InteractiveObject) anObj =
650         Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
651
652     if ( !anObj.IsNull() && anObj->hasEntry() )
653       theList.Append( anObj );
654   }
655 }
656
657 /*!
658   Updates current viewer
659 */
660 void SOCC_Viewer::Repaint()
661 {
662 //  onAdjustTrihedron();
663   getViewer3d()->Update();
664 }
665
666
667 /*!
668   create SOCC_ViewWindow
669 */
670 /*SUIT_ViewWindow* SOCC_Viewer::createView( SUIT_Desktop* theDesktop )
671 {
672   SOCC_ViewWindow* view = new SOCC_ViewWindow(theDesktop, this);
673   //initView( view );
674   initView( view->getView(OCCViewer_ViewFrame::MAIN_VIEW) );
675   return view;
676   }*/
677
678 /* 
679  * Returns a new OCCViewer_ViewWindow instance which will be placed as a sub window in ViewFrame
680  */
681 OCCViewer_ViewWindow* SOCC_Viewer::createSubWindow()
682 {
683   return new SOCC_ViewWindow( 0,  this);
684 }