Salome HOME
RNV: Porting SALOME GUI module to the new OCCT version.
[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 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       
399 #if OCC_VERSION_LARGE > 0x06050200 
400       Handle(SALOME_AISShape) aSh = Handle(SALOME_AISShape)::DownCast(anAIS);
401       if ( !aSh.IsNull() ) {
402           bool top = (aSh->isTopLevel() && aSh->switchTopLevel());
403               ic->SetZLayer( aSh, top ? getTopLayerId() : 0 );
404                   if(!aSh->toActivate()) {
405                         ic->Deactivate( aSh );
406                   }
407       }
408 #endif
409       //Register anAIS (if it has an entry) in entry2aisobjects map
410       Handle(SALOME_InteractiveObject) anObj = Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );
411       if ( !anObj.IsNull() && anObj->hasEntry())
412         {
413           std::vector<Handle(AIS_InteractiveObject)>& List = entry2aisobjects[anObj->getEntry()];
414           int found=0;
415           for ( unsigned int ind = 0; ind < List.size(); ind++ )
416           {
417             if(List[ind] == anAIS)
418               {
419                 found=1;
420                 break;
421               }
422           }
423           if(!found)
424             {
425               List.push_back(anAIS);
426             }
427         }
428
429       // Set visibility flag
430       // Temporarily commented to avoid awful dependecy on SALOMEDS
431       // TODO: better mechanism of storing display/erse status in a study
432       // should be provided...
433       //Handle(SALOME_InteractiveObject) anObj =
434       //  Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );
435       //if ( !anObj.IsNull() && anObj->hasEntry() )
436       //{
437       //  if ( study  )
438       //    ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this );
439       //}
440
441       // Deactivate object if necessary
442       if ( !anOCCPrs->ToActivate() )
443         ic->Deactivate( anAIS );
444     }
445   }
446   updateTrihedron();
447 }
448
449
450 /*!
451   Erase presentation
452   \param prs - presentation
453   \param forced - removes object from context
454 */
455 void SOCC_Viewer::Erase( const SALOME_OCCPrs* prs, const bool forced )
456 {
457   // try do downcast object
458   const SOCC_Prs* anOCCPrs = dynamic_cast<const SOCC_Prs*>( prs );
459   if ( !anOCCPrs || anOCCPrs->IsNull() )
460     return;
461
462   // get SALOMEDS Study
463   // Temporarily commented to avoid awful dependecy on SALOMEDS
464   // TODO: better mechanism of storing display/erse status in a study
465   // should be provided...
466   //  _PTR(Study) study(getStudyDS());
467
468   // get context
469   Handle(AIS_InteractiveContext) ic = getAISContext();
470
471   // get objects to be erased
472   AIS_ListOfInteractive anAISObjects;
473   anOCCPrs->GetObjects( anAISObjects );
474
475   AIS_ListIteratorOfListOfInteractive aIter( anAISObjects );
476   for ( ; aIter.More(); aIter.Next() ) {
477     Handle(AIS_InteractiveObject) anAIS = aIter.Value();
478     if ( !anAIS.IsNull() ) {
479       // erase the object from context : move it to collector
480 #if OCC_VERSION_LARGE <= 0x06060000
481       ic->Erase( anAIS, false, forced ? false : true );
482 #else
483       ic->Erase( anAIS, false );
484 #endif
485       // Set visibility flag if necessary
486       // Temporarily commented to avoid awful dependecy on SALOMEDS
487       // TODO: better mechanism of storing display/erse status in a study
488       // should be provided...
489       //if ( !forced )
490       //{
491       //  Handle(SALOME_InteractiveObject) anObj =
492       //    Handle(SALOME_InteractiveObject)::DownCast( anAIS->GetOwner() );
493       //  if ( !anObj.IsNull() && anObj->hasEntry() )
494       //  {
495       //  if ( study )
496       //    ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this );
497       //  }
498       //}
499     }
500   }
501   updateTrihedron();
502 }
503
504
505 /*!
506   Erase all presentations
507   \param forced - removes all objects from context
508 */
509 void SOCC_Viewer::EraseAll( const bool forced )
510 {
511   // get SALOMEDS Study
512   // Temporarily commented to avoid awful dependecy on SALOMEDS
513   // TODO: better mechanism of storing display/erse status in a study
514   // should be provided...
515   //  _PTR(Study) study(getStudyDS());
516
517   // get context
518   Handle(AIS_InteractiveContext) ic = getAISContext();
519
520   // check if trihedron is displayed
521   Standard_Boolean isTrihedronDisplayed = ic->IsDisplayed( getTrihedron() );
522
523   // get objects to be erased (all currently displayed objects)
524   AIS_ListOfInteractive aList;
525   ic->DisplayedObjects( aList );
526   AIS_ListIteratorOfListOfInteractive anIter( aList );
527   for ( ; anIter.More(); anIter.Next() ) {
528     if ( (isTrihedronDisplayed && anIter.Value()->DynamicType() == STANDARD_TYPE( AIS_Trihedron )) ||
529          anIter.Value()->DynamicType() == STANDARD_TYPE( OCCViewer_Trihedron ))
530       continue;
531
532     // erase an object
533     Handle(AIS_InteractiveObject) anIO = anIter.Value();
534 #if OCC_VERSION_LARGE <= 0x06060000
535     ic->Erase( anIO, false, forced ? false : true );
536 #else
537     ic->Erase( anIO, false );
538 #endif
539     
540     // Set visibility flag if necessary
541     // Temporarily commented to avoid awful dependecy on SALOMEDS
542     // TODO: better mechanism of storing display/erse status in a study
543     // should be provided...
544     //if ( !forced ) {
545     //  Handle(SALOME_InteractiveObject) anObj =
546     //  Handle(SALOME_InteractiveObject)::DownCast( anIO->GetOwner() );
547
548     //  if ( !anObj.IsNull() && anObj->hasEntry() ) {
549     //  if ( study )
550     //    ToolsGUI::SetVisibility( study, anObj->getEntry(), true, this );
551     //  }
552     //}
553   }
554
555   Repaint();
556   updateTrihedron();
557 }
558
559 /*!
560   Create presentation corresponding to the entry
561   \param entry - entry
562 */
563 SALOME_Prs* SOCC_Viewer::CreatePrs( const char* entry )
564 {
565   SOCC_Prs* prs = new SOCC_Prs();
566   if ( entry )
567   {
568     if(entry2aisobjects.count(entry)>0)
569       {
570         //ais object exists
571         std::vector<Handle(AIS_InteractiveObject)> List = entry2aisobjects[entry];
572         // get context
573         Handle(AIS_InteractiveContext) ic = getAISContext();
574         //add all ais
575         for ( unsigned int ind = 0; ind < List.size(); ind++ )
576           {
577             Handle(AIS_InteractiveObject) anAIS=List[ind];
578             if(ic->IsDisplayed(anAIS)
579 #if OCC_VERSION_LARGE <= 0x06060000
580                || ic->IsInCollector(anAIS)
581 #endif
582               )
583               {
584                 prs->AddObject( anAIS );
585               }
586           }
587       }
588   }
589   return prs;
590 }
591
592 /*!
593   Activates selection of sub-shapes
594 */
595 void SOCC_Viewer::LocalSelection( const SALOME_OCCPrs* thePrs, const int theMode )
596 {
597   Handle(AIS_InteractiveContext) ic = getAISContext();
598   
599   const SOCC_Prs* anOCCPrs = dynamic_cast<const SOCC_Prs*>( thePrs );
600   if ( ic.IsNull() )
601     return;
602   
603   // Open local context if there is no one
604   bool allObjects = thePrs == 0 || thePrs->IsNull();
605   if ( !ic->HasOpenedContext() ) {
606     ic->ClearCurrents( false );
607     ic->OpenLocalContext( allObjects, true, true );
608   }
609
610   AIS_ListOfInteractive anObjs;
611   // Get objects to be activated
612   if ( allObjects ) 
613     ic->DisplayedObjects( anObjs );
614   else
615     anOCCPrs->GetObjects( anObjs );
616
617   // Activate selection of objects from prs
618   AIS_ListIteratorOfListOfInteractive aIter( anObjs );
619   for ( ; aIter.More(); aIter.Next() ) {
620     Handle(AIS_InteractiveObject) anAIS = aIter.Value();
621     if ( !anAIS.IsNull() )
622     {
623       if ( anAIS->IsKind( STANDARD_TYPE( AIS_Shape ) ) )
624       {
625         ic->Load( anAIS, -1, false );
626         ic->Activate( anAIS, AIS_Shape::SelectionMode( (TopAbs_ShapeEnum)theMode ) );
627       }
628       else if ( anAIS->DynamicType() != STANDARD_TYPE(AIS_Trihedron) )
629       {
630         ic->Load( anAIS, -1, false );
631         ic->Activate( anAIS, theMode );
632       }
633     }
634   }
635 }
636
637 /*!
638   Deactivates selection of sub-shapes
639 */
640 void SOCC_Viewer::GlobalSelection( const bool update ) const
641 {
642   Handle(AIS_InteractiveContext) ic = getAISContext();
643   if ( !ic.IsNull() )
644   {
645     ic->CloseAllContexts( false );
646     if ( update )
647       ic->CurrentViewer()->Redraw();
648   }
649 }
650
651
652 /*!
653   \Collect objects visible in viewer
654   \param theList - visible objects collection
655 */
656 void SOCC_Viewer::GetVisible( SALOME_ListIO& theList )
657 {
658   AIS_ListOfInteractive List;
659   getAISContext()->DisplayedObjects(List);
660   
661   AIS_ListIteratorOfListOfInteractive ite(List);
662   for ( ; ite.More(); ite.Next() )
663   {
664     Handle(SALOME_InteractiveObject) anObj =
665         Handle(SALOME_InteractiveObject)::DownCast( ite.Value()->GetOwner() );
666
667     if ( !anObj.IsNull() && anObj->hasEntry() )
668       theList.Append( anObj );
669   }
670 }
671
672 /*!
673   Updates current viewer
674 */
675 void SOCC_Viewer::Repaint()
676 {
677 //  onAdjustTrihedron();
678   getViewer3d()->Update();
679 }
680
681
682 /*!
683   create SOCC_ViewWindow
684 */
685 /*SUIT_ViewWindow* SOCC_Viewer::createView( SUIT_Desktop* theDesktop )
686 {
687   SOCC_ViewWindow* view = new SOCC_ViewWindow(theDesktop, this);
688   //initView( view );
689   initView( view->getView(OCCViewer_ViewFrame::MAIN_VIEW) );
690   return view;
691   }*/
692
693 /* 
694  * Returns a new OCCViewer_ViewWindow instance which will be placed as a sub window in ViewFrame
695  */
696 OCCViewer_ViewWindow* SOCC_Viewer::createSubWindow()
697 {
698   return new SOCC_ViewWindow( 0,  this);
699 }