#include "HYDROGUI_Module.h"
#include "HYDROGUI_Prs.h"
#include "HYDROGUI_PrsImageDriver.h"
+#include "HYDROGUI_PrsPolylineDriver.h"
#include "HYDROGUI_Tool.h"
#include <GraphicsView_Viewer.h>
if( !aViewPort )
return;
- GraphicsView_ObjectListIterator anIter( aViewPort->getObjects() );
+ GraphicsView_ObjectListIterator anIter( HYDROGUI_Tool::GetPrsList( aViewPort ) );
while( anIter.hasNext() )
{
if( GraphicsView_Object* anObject = anIter.next() )
{
aViewPort->removeItem( anObject );
- //delete anObject; // ouv: to do
+ delete anObject;
}
}
}
void HYDROGUI_Displayer::DisplayAll( const int theViewerId,
const bool theIsForced )
{
- HYDROGUI_DataModel* aModel = (HYDROGUI_DataModel*)myModule->dataModel();
- if( aModel )
- {
- HYDROData_SequenceOfObjects aSeq;
- HYDROGUI_Tool::GetPrsSubObjects( aModel, theViewerId, aSeq );
- Update( aSeq, theViewerId, theIsForced );
- }
+ HYDROData_SequenceOfObjects aSeq;
+ HYDROGUI_Tool::GetPrsSubObjects( myModule, aSeq );
+ Update( aSeq, theViewerId, theIsForced );
}
void HYDROGUI_Displayer::Update( const HYDROData_SequenceOfObjects& theObjs,
HYDROGUI_DataModel* aModel = (HYDROGUI_DataModel*)myModule->dataModel();
if( aModel )
{
- GraphicsView_ObjectList anObjectList = aViewPort->getObjects();
+ GraphicsView_ObjectList anObjectList = HYDROGUI_Tool::GetPrsList( aViewPort );
for( int i = 1, n = theObjs.Length(); i <= n; i++ )
{
// the object may be null or dead
if( HYDROGUI_Prs* aPrs = HYDROGUI_Tool::GetPresentation( anObj, anObjectList ) )
{
aViewPort->removeItem( aPrs );
- //delete aPrs; // ouv: to do
+ delete aPrs;
}
}
}
if( aPrs )
{
- bool isVisible = true; // anObj->IsVisible()
- aPrs->setVisible( true );
+ bool anIsVisible = anObj->IsVisible( (size_t)aViewer );
+ aPrs->setVisible( anIsVisible );
}
}
if( !aViewPort )
return;
- GraphicsView_ObjectListIterator anIter( aViewPort->getObjects() );
+ GraphicsView_ObjectListIterator anIter( HYDROGUI_Tool::GetPrsList( aViewPort ) );
while( anIter.hasNext() )
{
- GraphicsView_Object* tmp = anIter.next();
- if( HYDROGUI_Prs* aPrs = dynamic_cast<HYDROGUI_Prs*>( tmp ) )
+ if( HYDROGUI_Prs* aPrs = dynamic_cast<HYDROGUI_Prs*>( anIter.next() ) )
{
Handle(HYDROData_Object) anObject = aPrs->getObject();
- if( anObject.IsNull() )
+ if( !anObject.IsNull() && anObject->IsRemoved() )
{
aViewPort->removeItem( aPrs );
- //delete aPrs; // ouv: to do
+ delete aPrs;
}
}
}
aDriver = new HYDROGUI_PrsImageDriver();
myPrsDriversMap[ aKind ] = aDriver;
break;
+ case KIND_POLYLINE:
+ aDriver = new HYDROGUI_PrsPolylineDriver();
+ myPrsDriversMap[ aKind ] = aDriver;
+ break;
default:
break;
}