#include <vtkCallbackCommand.h>
#include <vtkInteractorStyle.h>
#include <vtkRenderWindowInteractor.h>
+#include <vtkOutlineSource.h>
#include <sstream>
#include <boost/bind.hpp>
}
//----------------------------------------------------------------------------
-bool VISU_GaussPtsAct::PreHighlight(SVTK_Selector* theSelector,
- vtkInteractorStyle* theInteractorStyle,
+bool VISU_GaussPtsAct::PreHighlight(vtkInteractorStyle* theInteractorStyle,
SVTK_SelectionEvent* theSelectionEvent,
bool theIsHighlight)
{
+ myPreHighlightActor->SetVisibility(false);
+ myCursorPyramid->SetVisibility(false);
+
if (!myBarVisibility) {
return false;
}
- myCursorPyramid->SetVisibility(false);
if(theSelectionEvent->mySelectionMode == ActorSelection || !theIsHighlight)
- return Superclass::PreHighlight(theSelector,
- theInteractorStyle,
+ return Superclass::PreHighlight(theInteractorStyle,
theSelectionEvent,
theIsHighlight);
- myPreHighlightActor->SetVisibility(false);
bool anIsSelectionModeChanged = (theSelectionEvent->mySelectionMode != mySelectionMode);
if(!anIsSelectionModeChanged && mySelectionMode == ActorSelection)
return false;
vtkIdType aVtkId = myPointPicker->GetPointId();
- if(aVtkId >= 0 && theSelector->IsValid(this,aVtkId,true) && hasIO()){
+ if(aVtkId >= 0 && mySelector->IsValid(this,aVtkId,true) && hasIO()){
vtkIdType anObjId = GetNodeObjId( aVtkId );
if(myLastObjPointID != anObjId){
float* aNodeCoord = GetNodeCoord(anObjId);
return anIsChanged;
}
+
+
//----------------------------------------------------------------------------
-bool VISU_GaussPtsAct::Highlight(SVTK_Selector* theSelector,
- vtkInteractorStyle* theInteractorStyle,
+bool VISU_GaussPtsAct::Highlight(vtkInteractorStyle* theInteractorStyle,
SVTK_SelectionEvent* theSelectionEvent,
bool theIsHighlight)
{
if (!myBarVisibility) {
return false;
}
- vtkRenderer *aRenderer = theInteractorStyle->GetCurrentRenderer();
- vtkRenderWindowInteractor* anInteractor = theInteractorStyle->GetInteractor();
//
- Selection_Mode aSelectionMode=theSelectionEvent->mySelectionMode;
- mySelectionMode=aSelectionMode;
+ Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode;
//
- if(aSelectionMode==ActorSelection ){
- return Superclass::Highlight(theSelector,
- theInteractorStyle,
+ if(aSelectionMode == ActorSelection){
+ return Superclass::Highlight(theInteractorStyle,
theSelectionEvent,
theIsHighlight);
}
//
- bool bRet = false;
-
if(!theSelectionEvent->myIsRectangle){
+ vtkRenderer *aRenderer = theInteractorStyle->GetCurrentRenderer();
myPointPicker->Pick(theSelectionEvent->myX,
theSelectionEvent->myY,
0.0,
aRenderer);
if(myPointPicker->GetActor() != this) {
- theSelector->ClearIObjects();
- return bRet;
+ mySelector->ClearIObjects();
+ return true;
}
vtkIdType aVtkId = myPointPicker->GetPointId();
- if( aVtkId >= 0 && theSelector->IsValid( this, aVtkId, true ) && hasIO()) {
+ if( aVtkId >= 0 && mySelector->IsValid( this, aVtkId, true ) && hasIO()) {
vtkIdType anObjId = GetNodeObjId( aVtkId );
if(anObjId >= 0){
- bRet=!bRet;
- //
// Update the Selector
- if(theSelector->IsSelected(myIO))
- theSelector->AddOrRemoveIndex(myIO,anObjId,theSelectionEvent->myIsShift);
+ if(mySelector->IsSelected(myIO))
+ mySelector->AddOrRemoveIndex(myIO,anObjId,theSelectionEvent->myIsShift);
else{
if(!theSelectionEvent->myIsShift){
- theSelector->ClearIObjects();
+ mySelector->ClearIObjects();
}
- theSelector->AddOrRemoveIndex(myIO,anObjId,theSelectionEvent->myIsShift);
- theSelector->AddIObject(this);
+ mySelector->AddOrRemoveIndex(myIO,anObjId,theSelectionEvent->myIsShift);
+ mySelector->AddIObject(this);
}
//
float* aNodeCoord = GetNodeCoord(anObjId);
//
// FlyTo
+ vtkRenderWindowInteractor* anInteractor = theInteractorStyle->GetInteractor();
float aDollyWas = anInteractor->GetDolly();
- int aNumberOfFlyFramesWas=anInteractor->GetNumberOfFlyFrames();
+ int aNumberOfFlyFramesWas = anInteractor->GetNumberOfFlyFrames();
anInteractor->SetDolly(0.);
anInteractor->SetNumberOfFlyFrames(myPickingSettings->GetStepNumber());
anInteractor->SetDolly(aDollyWas);
anInteractor->SetNumberOfFlyFrames(aNumberOfFlyFramesWas);
- return bRet;
+ mySelectionMode = aSelectionMode;
+
+ return true;
//
}// if( anObjId >= 0 ) {
- }//if( aVtkId >= 0 && theSelector->IsValid( this, aVtkId, true ) && hasIO())
+ }//if( aVtkId >= 0 && mySelector->IsValid( this, aVtkId, true ) && hasIO())
}//if(!theSelectionEvent->myIsRectangle){
- return bRet;
+ return false;
}
//==================================================================
// purpose :
//==================================================================
void
-VISU_GaussPtsAct::highlight(bool theHighlight,
- Selection_Mode theSelectionMode)
+VISU_GaussPtsAct
+::highlight(bool theIsHighlight)
{
myTextActor->SetVisibility(0);
myCursorPyramidSelected->SetVisibility(0);
myCellActor->SetVisibility(0);
GetScalarBarCtrl()->SetIsMarked(false);
GetScalarBarCtrl()->Update();
-}
-//==================================================================
-// function : highlight
-// purpose :
-//==================================================================
-void VISU_GaussPtsAct::highlight(bool theHighlight,
- SVTK_Selector* theSelector)
-{
+
+ bool anIsVisible = GetVisibility();
+
+ if(mySelector->SelectionMode() == ActorSelection)
+ Superclass::highlight(theIsHighlight);
+
TColStd_IndexedMapOfInteger aMapIndex;
- //
- theSelector->GetIndex( getIO(), aMapIndex );
- int aNbOfParts = aMapIndex.Extent();
- //
- if(aNbOfParts!=1 || !myBarVisibility) {
+ mySelector->GetIndex( getIO(), aMapIndex );
+ if(aMapIndex.Extent() != 1 || !myBarVisibility) {
return;
}
//
aRadius,
aNodeCoord,
myHighlightActor->GetProperty()->GetColor());
- myCursorPyramidSelected->SetVisibility(1);
+ myCursorPyramidSelected->SetVisibility(anIsVisible && theIsHighlight);
//
const VISU::PGaussPtsIDMapper& aGaussPtsIDMapper =
myGaussPointsPL->GetGaussPtsIDMapper();
myTextActor->SetTransparency(myPickingSettings->GetInfoWindowTransparency());
myTextActor->SetWorldPoint(aWorldCoord);
myTextActor->SetText(aString.c_str());
- myTextActor->SetVisibility(1);
+ myTextActor->SetVisibility(anIsVisible && theIsHighlight);
//
// myCellActor
if(myPickingSettings->GetDisplayParentMesh()){
vtkCell* aCell = aParent->GetElemCell(aCellID);
myCellSource->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
myCellActor->GetProperty()->SetRepresentationToWireframe(); // VTK bug
- myCellActor->SetVisibility(1);
+ myCellActor->SetVisibility(anIsVisible && theIsHighlight);
}
}
+ myOutline->SetBounds( GetInput()->GetBounds() );
+ myOutlineActor->SetVisibility( anIsVisible && theIsHighlight );
}
+
+
//----------------------------------------------------------------
void
VISU_GaussPtsAct