Salome HOME
25fdb6547d146cb9301f7e8666a8154838f63033
[modules/gui.git] / src / SOCC / SOCC_ViewModel.cxx
1 // Copyright (C) 2007-2014  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, or (at your option) any later version.
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 OCC_VERSION_LARGE <= 0x06060000
163   if( !onlyInViewer ) {
164     AIS_ListOfInteractive List1;
165     getAISContext()->ObjectsInCollector(List1);
166     List.Append(List1);
167 }
168 #endif
169
170
171   AIS_ListIteratorOfListOfInteractive ite(List);
172   for ( ; ite.More(); ite.Next() )
173   {
174     Handle(SALOME_InteractiveObject) anObj =
175         Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
176
177     if ( !anObj.IsNull() && anObj->hasEntry() && anObj->isSame( obj ) )
178       return true;
179   }
180   return false;
181 }
182
183 /*!
184   \return true if object is displayed in viewer
185   \param obj - object to be checked
186 */
187 bool SOCC_Viewer::isVisible( const Handle(SALOME_InteractiveObject)& obj )
188 {
189
190   std::map< std::string , std::vector<Handle(AIS_InteractiveObject)> >::iterator it=entry2aisobjects.find(obj->getEntry());
191   if(it != entry2aisobjects.end())
192     {
193       // get context
194       Handle (AIS_InteractiveContext) ic = getAISContext();
195       std::vector<Handle(AIS_InteractiveObject)>& List = it->second;
196       for( unsigned int ind = 0; ind < List.size(); ind++ )
197         {
198           Handle(AIS_InteractiveObject) anAIS=List[ind];
199           if(ic->IsDisplayed(anAIS))
200             return true;
201         }
202   }
203   
204   return false;
205 }
206
207 /*!
208   Sets color of object
209   \param obj - object to be updated
210   \param color - new color
211   \param update - update current viewer
212 */
213 void SOCC_Viewer::setColor( const Handle(SALOME_InteractiveObject)& obj,
214                             const QColor& color, bool update )
215 {
216   if(obj.IsNull() || !obj->hasEntry() )
217     return;
218
219   if(entry2aisobjects.count(obj->getEntry())>0)
220     {
221       // get context
222       Handle (AIS_InteractiveContext) ic = getAISContext();
223       std::vector<Handle(AIS_InteractiveObject)>& List = entry2aisobjects[obj->getEntry()];
224       for( unsigned int ind = 0; ind < List.size(); ind++ )
225         {
226           Handle(AIS_InteractiveObject) anAIS=List[ind];
227           if( !anAIS.IsNull() && ic->IsDisplayed(anAIS))
228             OCCViewer_Viewer::setColor( anAIS, color, update );
229         }
230     }
231 }
232
233 /*!
234   Changes display mode of object
235   \param obj - object to be processed
236   \param mode - new display mode
237   \param update - update current viewer
238 */
239 void SOCC_Viewer::switchRepresentation( const Handle(SALOME_InteractiveObject)& obj,
240                                         int mode, bool update )
241 {
242   if(obj.IsNull() || !obj->hasEntry() )
243     return;
244
245   if(entry2aisobjects.count(obj->getEntry())>0)
246     {
247       // get context
248       Handle (AIS_InteractiveContext) ic = getAISContext();
249       std::vector<Handle(AIS_InteractiveObject)>& List = entry2aisobjects[obj->getEntry()];
250       for( unsigned int ind = 0; ind < List.size(); ind++ )
251         {
252           Handle(AIS_InteractiveObject) anAIS=List[ind];
253           if( !anAIS.IsNull() && ic->IsDisplayed(anAIS))
254             OCCViewer_Viewer::switchRepresentation( anAIS, mode, update );
255         }
256     }
257 }
258
259 /*!
260   Changes transparency of object
261   \param obj - object to be processed
262   \param trans - new transparency
263   \param update - update current viewer
264 */
265 void SOCC_Viewer::setTransparency( const Handle(SALOME_InteractiveObject)& obj,
266                                    float trans, bool update )
267 {
268   if(obj.IsNull() || !obj->hasEntry() )
269     return;
270
271   if(entry2aisobjects.count(obj->getEntry())>0)
272     {
273       // get context
274       Handle (AIS_InteractiveContext) ic = getAISContext();
275       std::vector<Handle(AIS_InteractiveObject)>& List = entry2aisobjects[obj->getEntry()];
276       for( unsigned int ind = 0; ind < List.size(); ind++ )
277         {
278           Handle(AIS_InteractiveObject) anAIS=List[ind];
279           if( !anAIS.IsNull() && ic->IsDisplayed(anAIS))
280             OCCViewer_Viewer::setTransparency( anAIS, trans, update );
281         }
282     }
283 }
284
285 /*!
286   Changes name of object
287   \param obj - object to be renamed
288   \param name - new name
289 */
290 void SOCC_Viewer::rename( const Handle(SALOME_InteractiveObject)& obj,
291                           const QString& name )
292 {
293   AIS_ListOfInteractive List;
294   getAISContext()->DisplayedObjects(List);
295   
296   AIS_ListIteratorOfListOfInteractive ite(List);
297   while (ite.More())
298   {
299     if (ite.Value()->IsKind(STANDARD_TYPE(SALOME_AISShape)))
300     {
301       Handle(SALOME_AISShape) aSh = Handle(SALOME_AISShape)::DownCast(ite.Value());
302       
303       if ( aSh->hasIO() )
304       {
305         Handle(SALOME_InteractiveObject) IO = aSh->getIO();
306         if ( IO->isSame( obj ) )
307         {
308           aSh->setName( name.toLatin1().data() );
309           break;
310         }
311       }
312     }
313     else if ( ite.Value()->IsKind( STANDARD_TYPE( SALOME_AISObject ) ) )
314     {
315       Handle(SALOME_AISObject) aSh = Handle(SALOME_AISObject)::DownCast( ite.Value() );
316
317       // Add code here, if someone create a MODULE_AISObject.
318     }
319     ite.Next();
320   }
321 }
322
323
324 /*!
325   Display presentation
326   \param prs - presentation
327 */
328 void SOCC_Viewer::Display( const SALOME_OCCPrs* prs )
329 {
330   // try do downcast object
331   const SOCC_Prs* anOCCPrs = dynamic_cast<const SOCC_Prs*>( prs );
332   if ( !anOCCPrs || anOCCPrs->IsNull() )
333     return;
334
335   // get SALOMEDS Study
336   // Temporarily commented to avoid awful dependecy on SALOMEDS
337   // TODO: better mechanism of storing display/erse status in a study
338   // should be provided...
339   //  _PTR(Study) study(getStudyDS());
340
341   // get context
342   Handle (AIS_InteractiveContext) ic = getAISContext();
343
344   // get objects to be displayed
345   AIS_ListOfInteractive anAISObjects;
346   anOCCPrs->GetObjects( anAISObjects );
347
348   AIS_ListIteratorOfListOfInteractive aIter( anAISObjects );
349   for ( ; aIter.More(); aIter.Next() )
350   {
351     Handle(AIS_InteractiveObject) anAIS = aIter.Value();
352     if ( !anAIS.IsNull() )
353     {
354       // try to find presentation in the viewer
355
356       // if the object is already displayed - nothing to do more
357       if(ic->IsDisplayed(anAIS))
358         {
359           // Deactivate object if necessary
360           if ( !anOCCPrs->ToActivate() )
361             ic->Deactivate( anAIS );
362           continue;
363         }
364
365 #if OCC_VERSION_LARGE <= 0x06060000
366       // then try to find presentation in the collector
367       if(ic->IsInCollector(anAIS))
368         {
369           ic->DisplayFromCollector( anAIS, false );
370           // Deactivate object if necessary
371           if ( !anOCCPrs->ToActivate() )
372             ic->Deactivate( anAIS );
373
374           // Set visibility flag
375           // Temporarily commented to avoid awful dependecy on SALOMEDS
376           // TODO: better mechanism of storing display/erse status in a study
377           // should be provided...
378           //Handle(SALOME_InteractiveObject) anObj =
379           //  Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );
380           //if ( !anObj.IsNull() && anObj->hasEntry() )
381           //{
382           //  if ( study )
383           //    ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this );
384           //}
385           continue;
386         }
387 #endif
388       // if object is not displayed and not found in the collector - display it
389       if ( anAIS->IsKind( STANDARD_TYPE(AIS_Trihedron) ) )
390       {
391         Handle(AIS_Trihedron) aTrh = Handle(AIS_Trihedron)::DownCast( anAIS );
392         double aNewSize = 100, aSize = 100;
393         computeTrihedronSize( aNewSize, aSize );
394         aTrh->SetSize( aTrh == getTrihedron() ? aNewSize : 0.5 * aNewSize );
395       }
396
397       ic->Display( anAIS, false );
398       Handle(SALOME_AISShape) aSh = Handle(SALOME_AISShape)::DownCast (anAIS);
399       if (!aSh.IsNull())
400       {
401         aSh->SetClippable (prs->IsClippable());
402         applyExistingClipPlanesToObject (anAIS);
403 #if OCC_VERSION_LARGE > 0x06050200
404         bool top = (aSh->isTopLevel() && aSh->switchTopLevel());
405               ic->SetZLayer( aSh, top ? getTopLayerId() : 0 );
406                     if(!aSh->toActivate())
407         {
408                             ic->Deactivate( aSh );
409                     }
410 #endif
411       }
412
413       //Register anAIS (if it has an entry) in entry2aisobjects map
414       Handle(SALOME_InteractiveObject) anObj = Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );
415       if ( !anObj.IsNull() && anObj->hasEntry())
416         {
417           std::vector<Handle(AIS_InteractiveObject)>& List = entry2aisobjects[anObj->getEntry()];
418           int found=0;
419           for ( unsigned int ind = 0; ind < List.size(); ind++ )
420           {
421             if(List[ind] == anAIS)
422               {
423                 found=1;
424                 break;
425               }
426           }
427           if(!found)
428             {
429               List.push_back(anAIS);
430             }
431         }
432
433       // Set visibility flag
434       // Temporarily commented to avoid awful dependecy on SALOMEDS
435       // TODO: better mechanism of storing display/erse status in a study
436       // should be provided...
437       //Handle(SALOME_InteractiveObject) anObj =
438       //  Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );
439       //if ( !anObj.IsNull() && anObj->hasEntry() )
440       //{
441       //  if ( study  )
442       //    ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this );
443       //}
444
445       // Deactivate object if necessary
446       if ( !anOCCPrs->ToActivate() )
447         ic->Deactivate( anAIS );
448     }
449   }
450   updateTrihedron();
451 }
452
453
454 /*!
455   Erase presentation
456   \param prs - presentation
457   \param forced - removes object from context
458 */
459 void SOCC_Viewer::Erase( const SALOME_OCCPrs* prs, const bool forced )
460 {
461   // try do downcast object
462   const SOCC_Prs* anOCCPrs = dynamic_cast<const SOCC_Prs*>( prs );
463   if ( !anOCCPrs || anOCCPrs->IsNull() )
464     return;
465
466   // get SALOMEDS Study
467   // Temporarily commented to avoid awful dependecy on SALOMEDS
468   // TODO: better mechanism of storing display/erse status in a study
469   // should be provided...
470   //  _PTR(Study) study(getStudyDS());
471
472   // get context
473   Handle(AIS_InteractiveContext) ic = getAISContext();
474
475   // get objects to be erased
476   AIS_ListOfInteractive anAISObjects;
477   anOCCPrs->GetObjects( anAISObjects );
478
479   AIS_ListIteratorOfListOfInteractive aIter( anAISObjects );
480   for ( ; aIter.More(); aIter.Next() ) {
481     Handle(AIS_InteractiveObject) anAIS = aIter.Value();
482     if ( !anAIS.IsNull() ) {
483       // erase the object from context : move it to collector
484 #if OCC_VERSION_LARGE <= 0x06060000
485       ic->Erase( anAIS, false, forced ? false : true );
486 #else
487       ic->Erase( anAIS, false );
488 #endif
489       // Set visibility flag if necessary
490       // Temporarily commented to avoid awful dependecy on SALOMEDS
491       // TODO: better mechanism of storing display/erse status in a study
492       // should be provided...
493       //if ( !forced )
494       //{
495       //  Handle(SALOME_InteractiveObject) anObj =
496       //    Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );
497       //  if ( !anObj.IsNull() && anObj->hasEntry() )
498       //  {
499       //  if ( study )
500       //    ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this );
501       //  }
502       //}
503     }
504   }
505   updateTrihedron();
506 }
507
508
509 /*!
510   Erase all presentations
511   \param forced - removes all objects from context
512 */
513 void SOCC_Viewer::EraseAll( const bool forced )
514 {
515   // get SALOMEDS Study
516   // Temporarily commented to avoid awful dependecy on SALOMEDS
517   // TODO: better mechanism of storing display/erse status in a study
518   // should be provided...
519   //  _PTR(Study) study(getStudyDS());
520
521   // get context
522   Handle(AIS_InteractiveContext) ic = getAISContext();
523
524   // check if trihedron is displayed
525   Standard_Boolean isTrihedronDisplayed = ic->IsDisplayed( getTrihedron() );
526
527   // get objects to be erased (all currently displayed objects)
528   AIS_ListOfInteractive aList;
529   ic->DisplayedObjects( aList );
530   AIS_ListIteratorOfListOfInteractive anIter( aList );
531   for ( ; anIter.More(); anIter.Next() ) {
532     if ( (isTrihedronDisplayed && anIter.Value()->DynamicType() == STANDARD_TYPE( AIS_Trihedron )) ||
533          anIter.Value()->DynamicType() == STANDARD_TYPE( OCCViewer_Trihedron ))
534       continue;
535
536     // erase an object
537     Handle(AIS_InteractiveObject) anIO = anIter.Value();
538 #if OCC_VERSION_LARGE <= 0x06060000
539     ic->Erase( anIO, false, forced ? false : true );
540 #else
541     ic->Erase( anIO, false );
542 #endif
543     
544     // Set visibility flag if necessary
545     // Temporarily commented to avoid awful dependecy on SALOMEDS
546     // TODO: better mechanism of storing display/erse status in a study
547     // should be provided...
548     //if ( !forced ) {
549     //  Handle(SALOME_InteractiveObject) anObj =
550     //  Handle(SALOME_InteractiveObject)::DownCast( anIO->GetOwner() );
551
552     //  if ( !anObj.IsNull() && anObj->hasEntry() ) {
553     //  if ( study )
554     //    ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this );
555     //  }
556     //}
557   }
558
559   Repaint();
560   updateTrihedron();
561 }
562
563 /*!
564   Create presentation corresponding to the entry
565   \param entry - entry
566 */
567 SALOME_Prs* SOCC_Viewer::CreatePrs( const char* entry )
568 {
569   SOCC_Prs* prs = new SOCC_Prs();
570   if ( entry )
571   {
572     if(entry2aisobjects.count(entry)>0)
573       {
574         //ais object exists
575         std::vector<Handle(AIS_InteractiveObject)> List = entry2aisobjects[entry];
576         // get context
577         Handle(AIS_InteractiveContext) ic = getAISContext();
578         //add all ais
579         for ( unsigned int ind = 0; ind < List.size(); ind++ )
580           {
581             Handle(AIS_InteractiveObject) anAIS=List[ind];
582             if(ic->IsDisplayed(anAIS)
583 #if OCC_VERSION_LARGE <= 0x06060000
584                || ic->IsInCollector(anAIS)
585 #endif
586               )
587               {
588                 prs->AddObject( anAIS );
589               }
590           }
591       }
592   }
593   return prs;
594 }
595
596 /*!
597   Activates selection of sub-shapes
598 */
599 void SOCC_Viewer::LocalSelection( const SALOME_OCCPrs* thePrs, const int theMode )
600 {
601   Handle(AIS_InteractiveContext) ic = getAISContext();
602   
603   const SOCC_Prs* anOCCPrs = dynamic_cast<const SOCC_Prs*>( thePrs );
604   if ( ic.IsNull() )
605     return;
606   
607   // Open local context if there is no one
608   bool allObjects = thePrs == 0 || thePrs->IsNull();
609   if ( !ic->HasOpenedContext() ) {
610     ic->ClearCurrents( false );
611     ic->OpenLocalContext( allObjects, true, true );
612   }
613
614   AIS_ListOfInteractive anObjs;
615   // Get objects to be activated
616   if ( allObjects ) 
617     ic->DisplayedObjects( anObjs );
618   else
619     anOCCPrs->GetObjects( anObjs );
620
621   // Activate selection of objects from prs
622   AIS_ListIteratorOfListOfInteractive aIter( anObjs );
623   for ( ; aIter.More(); aIter.Next() ) {
624     Handle(AIS_InteractiveObject) anAIS = aIter.Value();
625     if ( !anAIS.IsNull() )
626     {
627       if ( anAIS->IsKind( STANDARD_TYPE( AIS_Shape ) ) )
628       {
629         ic->Load( anAIS, -1, false );
630         ic->Activate( anAIS, AIS_Shape::SelectionMode( (TopAbs_ShapeEnum)theMode ) );
631       }
632       else if ( anAIS->DynamicType() != STANDARD_TYPE(AIS_Trihedron) )
633       {
634         ic->Load( anAIS, -1, false );
635         ic->Activate( anAIS, theMode );
636       }
637     }
638   }
639 }
640
641 /*!
642   Deactivates selection of sub-shapes
643 */
644 void SOCC_Viewer::GlobalSelection( const bool update ) const
645 {
646   Handle(AIS_InteractiveContext) ic = getAISContext();
647   if ( !ic.IsNull() )
648   {
649     ic->CloseAllContexts( false );
650     if ( update )
651       ic->CurrentViewer()->Redraw();
652   }
653 }
654
655
656 /*!
657   \Collect objects visible in viewer
658   \param theList - visible objects collection
659 */
660 void SOCC_Viewer::GetVisible( SALOME_ListIO& theList )
661 {
662   AIS_ListOfInteractive List;
663   getAISContext()->DisplayedObjects(List);
664   
665   AIS_ListIteratorOfListOfInteractive ite(List);
666   for ( ; ite.More(); ite.Next() )
667   {
668     Handle(SALOME_InteractiveObject) anObj =
669         Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
670
671     if ( !anObj.IsNull() && anObj->hasEntry() )
672       theList.Append( anObj );
673   }
674 }
675
676 /*!
677   Updates current viewer
678 */
679 void SOCC_Viewer::Repaint()
680 {
681 //  onAdjustTrihedron();
682   getViewer3d()->Update();
683 }
684
685
686 /*!
687   create SOCC_ViewWindow
688 */
689 /*SUIT_ViewWindow* SOCC_Viewer::createView( SUIT_Desktop* theDesktop )
690 {
691   SOCC_ViewWindow* view = new SOCC_ViewWindow(theDesktop, this);
692   //initView( view );
693   initView( view->getView(OCCViewer_ViewFrame::MAIN_VIEW) );
694   return view;
695   }*/
696
697 /* 
698  * Returns a new OCCViewer_ViewWindow instance which will be placed as a sub window in ViewFrame
699  */
700 OCCViewer_ViewWindow* SOCC_Viewer::createSubWindow()
701 {
702   return new SOCC_ViewWindow( 0,  this);
703 }