#include "SUIT_Session.h"
#include "SUIT_Application.h"
#include <iostream>
-#include <set>
//#include "ToolsGUI.h"
#include <SALOME_AISShape.hxx>
#include <SALOME_AISObject.hxx>
-struct AISLessThan
-{
- bool operator()(const Handle(AIS_InteractiveObject)* theRightIO,
- const Handle(AIS_InteractiveObject)* theLeftIO) const
- {
- return (theLeftIO<theRightIO);
- }
-};
-
// Temporarily commented to avoid awful dependecy on SALOMEDS
// TODO: better mechanism of storing display/erse status in a study
// should be provided...
*/
void SOCC_Viewer::Display( const SALOME_OCCPrs* prs )
{
+ START_TIMING
// try do downcast object
const SOCC_Prs* anOCCPrs = dynamic_cast<const SOCC_Prs*>( prs );
if ( !anOCCPrs || anOCCPrs->IsNull() )
// get context
Handle (AIS_InteractiveContext) ic = getAISContext();
- // get all displayed objects
- AIS_ListOfInteractive List;
-//CCAR
-#if 0
-#else
- ic->DisplayedObjects( List );
-#endif
- // get objects in the collector
- AIS_ListOfInteractive ListCollector;
-//CCAR
-#if 0
-#else
- ic->ObjectsInCollector( ListCollector );
-#endif
-
-
- START_TIMING
// get objects to be displayed
AIS_ListOfInteractive anAISObjects;
anOCCPrs->GetObjects( anAISObjects );
AIS_ListIteratorOfListOfInteractive aIter( anAISObjects );
- AIS_ListIteratorOfListOfInteractive ite( List );
-
- std::set<Handle(AIS_InteractiveObject)*,AISLessThan> check;
- std::set<Handle(AIS_InteractiveObject)*,AISLessThan> checkCollector;
-
- for ( ; ite.More();ite.Next())
- {
- check.insert(&ite.Value());
- }
- ite.Initialize(ListCollector);
- for ( ; ite.More();ite.Next())
- {
- checkCollector.insert(&ite.Value());
- }
-
+ //~ START_TIMING
for ( ; aIter.More(); aIter.Next() )
{
Handle(AIS_InteractiveObject) anAIS = aIter.Value();
// try to find presentation in the viewer
bool bDisplayed = false;
// if insert.second is True object was not displayed before
- if ((check.insert(&anAIS)).second)
+ if (ic->IsDisplayed(anAIS))
+ {
// compare presentations by handles
// if the object is already displayed - nothing to do more
// Deactivate object if necessary
if ( !anOCCPrs->ToActivate() )
ic->Deactivate( anAIS );
bDisplayed = true;
-
+ }
+
// then try to find presentation in the collector
bDisplayed = false;
- if ((checkCollector.insert(&anAIS)).second)
+ if (ic->IsInCollector(anAIS))
{
// compare presentations by handles
// if the object is in collector - display it