#include <vtkDataSetMapper.h>
#include <vtkPolyDataMapper.h>
#include <vtkProperty.h>
+#include "vtkOutlineSource.h"
#include <TColStd_MapOfInteger.hxx>
#include <TColStd_IndexedMapOfInteger.hxx>
myHighlightActor = SVTK_Actor::New();
myHighlightActor->PickableOff();
myHighlightActor->SetProperty( myPointProperty );
+
+
+ myOutline = vtkOutlineSource::New();
+
+ myOutlineMapper = vtkPolyDataMapper::New();
+ myOutlineMapper->SetInput( myOutline->GetOutput() );
+
+ myOutlineActor = vtkActor::New();
+ myOutlineActor->PickableOff();
+ myOutlineActor->DragableOff();
+ myOutlineActor->SetMapper( myOutlineMapper );
+ myOutlineActor->GetProperty()->SetColor(0.0,1.0,0.0);
+ myOutlineActor->GetProperty()->SetAmbient(1.0);
+ myOutlineActor->GetProperty()->SetDiffuse(0.0);
+ myOutlineActor->SetVisibility( false );
}
myPointPicker->Delete();
myCellPicker->Delete();
myCellRectPicker->Delete();
- myHighlightActor->SetProperty( NULL );
+ myHighlightActor->Delete();
+
+ myOutline->Delete();
+ myOutlineMapper->Delete();
+ myOutlineActor->Delete();
}
// from VISU
theRenderer->AddActor( myPreHighlightActor );
theRenderer->AddActor( myHighlightActor );
+ theRenderer->AddActor( myOutlineActor );
}
void SALOME_Actor::RemoveFromRender(vtkRenderer* theRenderer){
// from VISU
theRenderer->RemoveActor( myPreHighlightActor );
theRenderer->RemoveActor( myHighlightActor );
+ theRenderer->RemoveActor( myOutlineActor );
}
// from VISU
//----------------------------------------------------------------
-void SALOME_Actor::highlight( bool theHighlight )
+void SALOME_Actor::highlight( bool theHighlight, Selection_Mode theMode )
{
//cout << "SALOME_Actor::highlight " << ( theHighlight ? "on" : "off" ) << endl;
- myHighlightActor->SetVisibility( theHighlight );
+ if( !GetVisibility() )
+ return;
+
+ myOutline->SetBounds( GetBounds() );
+ myOutlineActor->SetVisibility( theHighlight );
+
+ myHighlightActor->SetVisibility( theHighlight && theMode != ActorSelection );
}
//----------------------------------------------------------------
//cout << "SALOME_Actor::SetVisibility " << ( theVisibility ? "on" : "off" ) << endl;
vtkProp::SetVisibility( theVisibility );
+ myOutlineActor->SetVisibility( theVisibility && isHighlighted() );
myHighlightActor->SetVisibility( theVisibility && isHighlighted() );
}
cout << "IsHighlight : " << ( theIsHighlight ? "true" : "false" ) << endl;
*/
- if( GetVisibility() && theIsHighlight )
- theInteractorStyle->HighlightProp( this );
- else if( !theIsHighlight )
- theInteractorStyle->HighlightProp( NULL );
-
switch( aSelectionMode )
{
case NodeSelection:
myHighlightActor->SetProperty( myPointProperty );
myHighlightActor->MapPoints( this, aMapIndex );
- highlight( theIsHighlight );
break;
case EdgeOfCellSelection:
myHighlightActor->SetProperty( myEdgeProperty );
myHighlightActor->MapEdge( this, aMapIndex );
- highlight( theIsHighlight );
break;
case CellSelection:
case EdgeSelection:
case VolumeSelection:
myHighlightActor->SetProperty( myCellProperty );
myHighlightActor->MapCells( this, aMapIndex );
- highlight( theIsHighlight );
break;
case ActorSelection:
- highlight( false );
break;
}
+ highlight( theIsHighlight, aSelectionMode );
+
return true;
}
#include "Handle_SALOME_InteractiveObject.hxx"
#endif
-#include <vtkLODActor.h> // INCLUDES "stdio.h"
-#include <vtkProperty.h>
+//#include <vtkLODActor.h> // INCLUDES "stdio.h"
+//#include <vtkProperty.h>
// to overcome the conflict between std::ostream and io::ostream
// the following variable must be defined:
class vtkPolyData;
class vtkCamera;
class vtkProperty;
+class vtkPolyDataMapper;
+class vtkOutlineSource;
+class vtkRenderer;
class VTKViewer_Transform;
class VTKViewer_GeometryFilter;
#include <string>
-class vtkRenderer;
-
class SVTK_Actor;
class SVTK_InteractorStyle;
// From VISU
public:
- virtual void highlight( bool );
+ virtual void highlight( bool, Selection_Mode );
virtual void SetVisibility( int );
SVTK_Actor* myPreHighlightActor;
SVTK_Actor* myHighlightActor;
+
+ vtkActor* myOutlineActor;
+ vtkOutlineSource* myOutline;
+ vtkPolyDataMapper* myOutlineMapper;
};
#endif // SALOME_ACTOR_H
//----------------------------------------------------------------
struct THighlightAction{
bool myIsHighlight;
- THighlightAction( bool theIsHighlight ): myIsHighlight(theIsHighlight) {}
+ Selection_Mode myMode;
+ THighlightAction( bool theIsHighlight, Selection_Mode theMode = ActorSelection )
+ : myIsHighlight( theIsHighlight ),
+ myMode( theMode ) {}
void operator()( SALOME_Actor* theActor) {
if(theActor->GetMapper()){
- theActor->highlight( myIsHighlight );
+ theActor->highlight( myIsHighlight, myMode );
}
}
};
SVTK_View
::unHighlightAll()
{
- //cout << "--------------------------------------------------" << endl;
//cout << "SVTK_View::unHighlightAll" << endl;
using namespace VTK;
ForEach<SALOME_Actor>( getRenderer()->GetActors(),
THighlightAction( false ) );
- //myRenderWindow->update();
+ update();
}
//----------------------------------------------------------------
bool theIsHighlight,
bool theIsUpdate )
{
+ //cout << "SVTK_View::highlight" << endl;
using namespace VTK;
- ForEachIf<SALOME_Actor>(getRenderer()->GetActors(),
- TIsSameIObject<SALOME_Actor>(theIO),
- THighlightAction(theIsHighlight));
+ ForEachIf<SALOME_Actor>( getRenderer()->GetActors(),
+ TIsSameIObject<SALOME_Actor>( theIO ),
+ THighlightAction( theIsHighlight, mySelector->SelectionMode() ) );
- //myRenderWindow->update();
+ update();
}
#define INCREMENT_FOR_OP 10