#include <vtkPolyDataMapper.h>
#include <vtkProperty.h>
#include <vtkOutlineSource.h>
+#include <vtkInteractorStyle.h>
#include <TColStd_MapOfInteger.hxx>
#include <TColStd_IndexedMapOfInteger.hxx>
return anEdgeId;
}
-
//----------------------------------------------------------------
bool
SALOME_Actor
::PreHighlight( SVTK_Selector* theSelector,
- vtkRenderer* theRenderer,
+ //vtkRenderer* theRenderer,
+ vtkInteractorStyle *theIS,
SVTK_SelectionEvent theSelectionEvent,
bool theIsHighlight )
{
+ vtkRenderer *aRenderer=theIS->GetCurrentRenderer();
+ //
myPreHighlightActor->SetVisibility( false );
bool anIsSelectionModeChanged = (theSelectionEvent.mySelectionMode != mySelectionMode);
bool anIsChanged = false;
if( !theIsHighlight )
{
- vtkActorCollection* theActors = theRenderer->GetActors();
+ vtkActorCollection* theActors = aRenderer->GetActors();
theActors->InitTraversal();
while( vtkActor *ac = theActors->GetNextActor() )
if( SALOME_Actor* anActor = SALOME_Actor::SafeDownCast( ac ) )
switch(mySelectionMode){
case NodeSelection:
{
- myPointPicker->Pick( x, y, z, theRenderer );
+ myPointPicker->Pick( x, y, z, aRenderer );
int aVtkId = myPointPicker->GetPointId();
if( aVtkId >= 0 && theSelector->IsValid( this, aVtkId, true ) && hasIO() )
}
case CellSelection:
{
- myCellPicker->Pick( x, y, z, theRenderer );
+ myCellPicker->Pick( x, y, z, aRenderer );
int aVtkId = myCellPicker->GetCellId();
if ( aVtkId >= 0 && theSelector->IsValid( this, aVtkId ) && hasIO() )
}
case EdgeOfCellSelection:
{
- myCellPicker->Pick( x, y, z, theRenderer );
+ myCellPicker->Pick( x, y, z, aRenderer );
int aVtkId = myCellPicker->GetCellId();
if ( aVtkId >= 0 && theSelector->IsValid( this, aVtkId ) && hasIO() )
if( hasIO() && !theSelector->IsSelected( myIO ) )
{
- vtkActorCollection* theActors = theRenderer->GetActors();
+ vtkActorCollection* theActors = aRenderer->GetActors();
theActors->InitTraversal();
while( vtkActor *ac = theActors->GetNextActor() )
{
return anIsChanged;
}
-
-
//----------------------------------------------------------------
bool
SALOME_Actor
::Highlight( SVTK_Selector* theSelector,
- vtkRenderer* theRenderer,
+ vtkInteractorStyle* theIS,
SVTK_SelectionEvent theSelectionEvent,
bool theIsHighlight )
{
+ vtkRenderer *aRenderer=theIS->GetCurrentRenderer();
+
+ //
int aSelectionMode = theSelectionEvent.mySelectionMode;
float x1 = theSelectionEvent.myX;
float y1 = theSelectionEvent.myY;
{
if( aSelectionMode == NodeSelection )
{
- myPointPicker->Pick( x1, y1, z1, theRenderer );
+ myPointPicker->Pick( x1, y1, z1, aRenderer );
int aVtkId = myPointPicker->GetPointId();
if( aVtkId >= 0 && hasIO() && theSelector->IsValid( this, aVtkId, true ) )
}
else if( aSelectionMode == CellSelection )
{
- myCellPicker->Pick( x1, y1, z1, theRenderer );
+ myCellPicker->Pick( x1, y1, z1, aRenderer );
int aVtkId = myCellPicker->GetCellId();
if( aVtkId >= 0 && hasIO() && theSelector->IsValid( this, aVtkId ) )
}
else if( aSelectionMode == EdgeOfCellSelection )
{
- myCellPicker->Pick( x1, y1, z1, theRenderer );
+ myCellPicker->Pick( x1, y1, z1, aRenderer );
int aVtkId = myCellPicker->GetCellId();
if( aVtkId >= 0 && hasIO() && theSelector->IsValid( this, aVtkId ) )
aDataSet->GetPoint( i, aPoint );
float aPnt[3];
- theRenderer->SetWorldPoint( aPoint[0], aPoint[1], aPoint[2], 1.0 );
- theRenderer->WorldToDisplay();
- theRenderer->GetDisplayPoint( aPnt );
+ aRenderer->SetWorldPoint( aPoint[0], aPoint[1], aPoint[2], 1.0 );
+ aRenderer->WorldToDisplay();
+ aRenderer->GetDisplayPoint( aPnt );
if( aPnt[0] > x2 && aPnt[0] < x1 && aPnt[1] > y1 && aPnt[1] < y2 )
{
float aDisp[3];
- theRenderer->SetWorldPoint( aPoint[0], aPoint[1], aPoint[2], 1.0 );
- theRenderer->WorldToDisplay();
- theRenderer->GetDisplayPoint( aDisp );
+ aRenderer->SetWorldPoint( aPoint[0], aPoint[1], aPoint[2], 1.0 );
+ aRenderer->WorldToDisplay();
+ aRenderer->GetDisplayPoint( aDisp );
- if( myPointPicker->Pick( aDisp[0], aDisp[1], 0.0, theRenderer ) )
+ if( myPointPicker->Pick( aDisp[0], aDisp[1], 0.0, aRenderer ) )
{
if( vtkActorCollection* anActorCollection = myPointPicker->GetActors() )
{
else if( aSelectionMode != ActorSelection && hasIO() )
{
myCellRectPicker->SetTolerance( 0.001 );
- myCellRectPicker->Pick( x2, y2, z2, x1, y1, z1, theRenderer );
+ myCellRectPicker->Pick( x2, y2, z2, x1, y1, z1, aRenderer );
VTKViewer_CellDataSet cellList = myCellRectPicker->GetCellData( this );
TColStd_MapOfInteger anIndexes;
return true;
}
+
SVTK_SelectionEvent aSelectionEvent = GetSelectionEvent();
aSelectionEvent.mySelectionMode = aSelectionMode;
aSelectionEvent.myIsRectangle = false;
- aSActor->Highlight( GetSelector(), GetCurrentRenderer(), aSelectionEvent, true );
- }else{
+ aSActor->Highlight( GetSelector(), this, aSelectionEvent, true );
+ }
+ else{
GetSelector()->ClearIObjects();
}
- } else {
+ }
+ else {
//processing rectangle selection
Interactor->StartPickCallback();
GetSelector()->StartPickCallback();
aListActors->InitTraversal();
while(vtkActor* aActor = aListActors->GetNextActor()){
if(SALOME_Actor* aSActor = SALOME_Actor::SafeDownCast(aActor)){
- aSActor->Highlight( GetSelector(), GetCurrentRenderer(), aSelectionEvent, true );
+ aSActor->Highlight( GetSelector(), this, aSelectionEvent, true );
}
}
}
myPicker->Pick(x, y, 0.0, GetCurrentRenderer());
if(SALOME_Actor* anActor = SALOME_Actor::SafeDownCast(myPicker->GetActor())){
- anIsChanged |= anActor->PreHighlight( GetSelector(), GetCurrentRenderer(), aSelectionEvent, true );
- if(aLastActor && aLastActor != anActor)
- aLastActor->PreHighlight( GetSelector(), GetCurrentRenderer(), aSelectionEvent, false );
+ anIsChanged |= anActor->PreHighlight( GetSelector(), this, aSelectionEvent, true );
+ if(aLastActor && aLastActor != anActor) {
+ aLastActor->PreHighlight( GetSelector(), this, aSelectionEvent, false );
+ }
}
if(anIsChanged)