1 // VISU OBJECT : interactive object for VISU entities implementation
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
24 // File : VISU_MeshAct.hxx
25 // Author : Laurent CORNABE with the help of Nicolas REJNERI
29 #include "VISU_GaussPtsAct.h"
30 #include "VISU_GaussPointsPL.hxx"
31 #include "VISU_GaussPtsSettings.h"
32 #include "VISU_GaussPtsDeviceActor.h"
33 #include "VISU_WidgetCtrl.hxx"
34 #include "VISU_SphereWidget.hxx"
35 #include "VISU_OpenGLPointSpriteMapper.hxx"
36 #include "VISU_ScalarBarCtrl.hxx"
37 #include "VISU_ScalarBarActor.hxx"
39 #include "VISU_Event.h"
40 #include "SVTK_Actor.h"
42 #include <vtkCamera.h>
43 #include <vtkRenderer.h>
44 #include <vtkPointPicker.h>
45 #include <vtkScalarBarWidget.h>
46 #include <vtkTextMapper.h>
47 #include <vtkTextProperty.h>
49 #include <vtkPointData.h>
50 #include <vtkDataArray.h>
52 #include <vtkSphereSource.h>
53 #include <vtkPolyDataMapper.h>
54 #include <vtkPolyData.h>
57 #include <vtkObjectFactory.h>
58 #include <vtkCallbackCommand.h>
59 #include <vtkInteractorStyle.h>
60 #include <vtkRenderWindowInteractor.h>
61 #include <vtkOutlineSource.h>
64 #include <boost/bind.hpp>
66 #include <vtkUnstructuredGrid.h>
67 #include <vtkPolyDataMapper.h>
68 #include <vtkRenderWindow.h>
69 #include <vtkCellArray.h>
73 #include <vtkViewport.h>
75 #include "utilities.h"
78 static int MYDEBUG = 0;
79 static int MYDEBUG1 = 0;
80 static int MYDEBUG2 = 0;
82 static int MYDEBUG = 0;
83 static int MYDEBUG1 = 0;
84 static int MYDEBUG2 = 0;
91 CheckIsSameValue(vtkFloatingPointType theTarget,
92 vtkFloatingPointType theSource)
94 static vtkFloatingPointType TOL = 10.0 / VTK_LARGE_FLOAT;
95 return fabs(theTarget - theSource) < TOL;
99 CheckIsSameVector(vtkFloatingPointType* theTarget,
100 vtkFloatingPointType* theSource,
103 for ( size_t anId = 0; anId < theLength; anId++ ) {
104 if ( !CheckIsSameValue( theTarget[ anId ], theSource[ anId ] ) )
113 //============================================================================
114 vtkStandardNewMacro(VISU_GaussPtsAct);
116 //----------------------------------------------------------------------------
118 ::VISU_GaussPtsAct():
119 myEventCallbackCommand(vtkCallbackCommand::New()),
121 myDeviceActor(VISU_GaussPtsDeviceActor::New()),
123 myGaussPointsPL(NULL),
124 myLastPreHighlightObjID(-1),
125 myTextActor(VISU_FramedTextActor::New()),
126 myCursorPyramid(VISU_CursorPyramid::New()),
127 myCursorPyramidSelected(VISU_CursorPyramid::New()),
128 myCellSource(vtkUnstructuredGrid::New()),
129 myCellActor(SVTK_Actor::New()),
130 myScalarBarCtrl(VISU_ScalarBarCtrl::New()),
131 myBarVisibility(true),
132 myPickingSettings(NULL),
133 myInsideCursorSettings(NULL),
135 myMapper(vtkPolyDataMapper::New())
137 if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::VISU_GaussPtsAct - this = "<<this);
139 myEventCallbackCommand->Delete();
140 myDeviceActor->Delete();
141 myTextActor->Delete();
143 myCursorPyramid->Delete();
144 myCursorPyramid->SetPickable(0);
145 myCursorPyramid->SetVisibility(0);
147 myCursorPyramidSelected->Delete();
148 myCursorPyramidSelected->SetPickable(0);
149 myCursorPyramidSelected->SetVisibility(0);
151 myCellSource->Delete();
152 myCellActor->Delete();
154 myEventCallbackCommand->SetClientData(this);
155 myEventCallbackCommand->SetCallback(VISU_GaussPtsAct::ProcessEvents);
157 myDeviceActor->SetProperty(GetProperty());
158 myDeviceActor->SetVisibility(true);
159 myDeviceActor->SetPickable(false);
161 myTextActor->SetVisibility(false);
162 myTextActor->SetPickable(false);
164 myCellSource->Allocate();
165 myCellActor->Initialize();
166 myCellActor->SetRepresentation(VTK_WIREFRAME);
167 myCellActor->SetSource(myCellSource.GetPointer());
169 myCellActor->SetVisibility(0);
170 myCellActor->SetPickable(0);
171 myCellActor->GetProperty()->SetAmbient(1.0);
172 myCellActor->GetProperty()->SetDiffuse(0.0);
174 myScalarBarCtrl->Delete();
180 ::~VISU_GaussPtsAct()
182 if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::~VISU_GaussPtsAct - this = "<<this);
185 SetPickingSettings(NULL);
186 SetInsideCursorSettings(NULL);
190 //----------------------------------------------------------------------------
193 ::SetPipeLine(VISU_PipeLine* thePipeLine)
195 if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::SetPipeLine - this = "<<this);
197 myGaussPointsPL = dynamic_cast<VISU_GaussPointsPL*>(thePipeLine);
199 Superclass::SetPipeLine(thePipeLine);
206 return myGaussPointsPL.GetPointer();
209 //----------------------------------------------------------------------------
212 ::DeepCopy(VISU_Actor *theActor)
214 if(VISU_GaussPtsAct* anActor = dynamic_cast<VISU_GaussPtsAct*>(theActor)){
215 Superclass::DeepCopy(theActor);
216 SetBarVisibility(anActor->GetBarVisibility());
220 //----------------------------------------------------------------------------
223 ::ShallowCopyPL(VISU_PipeLine* thePipeLine)
225 if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::ShallowCopyPL - this = "<<this);
227 Superclass::ShallowCopyPL(thePipeLine);
229 UpdateInsideCursorSettings();
231 Highlight(isHighlighted());
235 //----------------------------------------------------------------------------
241 //vtkMapper* aMapper = myCurrentPL->GetPointSpriteMapper();
245 return myMapper.GetPointer();
248 vtkFloatingPointType*
252 return GetMapper()->GetBounds();
259 return GetMapper()->GetInput();
270 //----------------------------------------------------------------------------
275 vtkDataSet* aDataSet = myDeviceActor->GetMapper()->GetInput();
276 unsigned long int aSize = aDataSet->GetActualMemorySize() * 1024;
278 aSize += Superclass::GetMemorySize();
283 //----------------------------------------------------------------------------
286 ::AddToRender(vtkRenderer* theRenderer)
288 if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::AddToRender - this = "<<this);
290 Superclass::AddToRender(theRenderer);
292 myDeviceActor->AddToRender(theRenderer);
294 theRenderer->AddActor(myTextActor.GetPointer());
295 theRenderer->AddActor(myCellActor.GetPointer());
297 myCursorPyramid->AddToRender(theRenderer);
298 myCursorPyramidSelected->AddToRender(theRenderer);
299 myScalarBarCtrl->AddToRender(theRenderer);
304 ::RemoveFromRender(vtkRenderer* theRenderer)
306 if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::RemoveFromRender - this = "<<this);
308 myDeviceActor->RemoveFromRender(theRenderer);
310 theRenderer->RemoveActor(myTextActor.GetPointer());
311 theRenderer->RemoveActor(myCellActor.GetPointer());
313 myCursorPyramid->RemoveFromRender(theRenderer);
314 myCursorPyramidSelected->RemoveFromRender(theRenderer);
315 myScalarBarCtrl->RemoveFromRender(theRenderer);
317 Superclass::RemoveFromRender(theRenderer);
322 ::SetTransform(VTKViewer_Transform* theTransform)
324 Superclass::SetTransform(theTransform);
326 myDeviceActor->SetTransform(theTransform);
331 ::RenderOpaqueGeometry(vtkViewport *viewport)
338 ::RenderTranslucentGeometry(vtkViewport *viewport)
344 //----------------------------------------------------------------------------
347 ::SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl)
349 if(myWidgetCtrl == theWidgetCtrl)
353 MESSAGE("VISU_GaussPtsAct::SetWidgetCtrl - this = "<<this<<"; theWidget = "<<theWidgetCtrl);
356 myWidgetCtrl->RemoveObserver(myEventCallbackCommand.GetPointer());
359 theWidgetCtrl->AddObserver(vtkCommand::EnableEvent,
360 myEventCallbackCommand.GetPointer(),
362 theWidgetCtrl->AddObserver(vtkCommand::DisableEvent,
363 myEventCallbackCommand.GetPointer(),
365 theWidgetCtrl->AddObserver(vtkCommand::StartInteractionEvent,
366 myEventCallbackCommand.GetPointer(),
368 theWidgetCtrl->AddObserver(vtkCommand::EndInteractionEvent,
369 myEventCallbackCommand.GetPointer(),
373 myWidgetCtrl = theWidgetCtrl;
378 ::GetChangeMagnification()
380 return myChangeMagnification;
385 ::ChangeMagnification( bool up )
387 myEventCallbackCommand->SetAbortFlag(1);
389 vtkFloatingPointType aMagnification = myInsideCursorSettings->GetMagnification();
390 vtkFloatingPointType anIncrement = myInsideCursorSettings->GetIncrement();
391 vtkFloatingPointType coefficient = up ? anIncrement : 1 / anIncrement;
393 myInsideCursorSettings->SetMagnification( aMagnification * coefficient );
394 myInsideCursorSettings->InvokeEvent(VISU::UpdateFromSettingsEvent,NULL);
399 //----------------------------------------------------------------------------
403 CreatePipeLine(VISU_GaussPointsPL* thePipeLine)
405 VISU_GaussPointsPL* aPipeLine = VISU_GaussPointsPL::New();
406 aPipeLine->ShallowCopy(thePipeLine, true);
414 ::SetMapperInput(vtkDataSet* theDataSet)
416 if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::SetMapperInput - this = "<<this);
418 myDeviceActor->SetPipeLine(GetGaussPointsPL());
419 myCurrentPL = myDeviceActor->GetPipeLine();
421 //SetMapper(myCurrentPL->GetPointSpriteMapper());
423 myMapper->SetInput(myCurrentPL->GetPickableDataSet());
424 SetMapper(myMapper.GetPointer());
428 //----------------------------------------------------------------------------
433 GetRadius(vtkIdType theVTKID,
434 vtkDataArray *theScalarArray,
435 VISU_GaussPointsPL* theGaussPointsPL)
437 vtkFloatingPointType aRadius = 0.5;
438 if(theGaussPointsPL->GetPointSpriteMapper()->GetPointSpriteMode() == 1) // Geometry mode
439 aRadius *= theGaussPointsPL->GetSize() * theGaussPointsPL->GetAverageCellSize();
440 else if(theGaussPointsPL->GetBicolor()){
441 vtkFloatingPointType aVal = theScalarArray->GetTuple1(theVTKID);
443 aRadius *= theGaussPointsPL->GetMaxSize();
445 aRadius *= theGaussPointsPL->GetMinSize();
446 aRadius *= theGaussPointsPL->GetAverageCellSize();
448 aRadius *= theGaussPointsPL->GetPointSize(theVTKID,theScalarArray);
456 ::GetRadius(vtkIdType theObjID,
458 vtkDataArray *theScalarArray)
460 return ::GetRadius(theVTKID,theScalarArray,myDeviceActor->GetPipeLine());
463 //----------------------------------------------------------------------------
466 ::GetMagnification(vtkIdType theObjID)
468 return myDeviceActor->GetPipeLine()->GetMagnification();
472 //----------------------------------------------------------------------------
477 GetClamp(VISU_GaussPointsPL* theGaussPointsPL)
479 vtkFloatingPointType aClamp = theGaussPointsPL->GetClamp();
480 if(theGaussPointsPL->GetPrimitiveType() == VISU_OpenGLPointSpriteMapper::GeomSphere)
488 ::GetClamp(vtkIdType theObjID)
490 return ::GetClamp(myDeviceActor->GetPipeLine());
494 //----------------------------------------------------------------------------
497 ::SetFactory(VISU::TActorFactory* theActorFactory)
499 using namespace VISU;
500 myGaussPtsActorFactory = dynamic_cast<TGaussPtsActorFactory*>(theActorFactory);
501 myUpdatePrs3dSignal.connect(boost::bind(&TGaussPtsActorFactory::UpdateFromActor,
502 myGaussPtsActorFactory,
504 Superclass::SetFactory(theActorFactory);
507 VISU::TGaussPtsActorFactory*
509 ::GetGaussPtsFactory()
511 return myGaussPtsActorFactory;
515 //----------------------------------------------------------------------------
518 ::SetVisibility(int theMode)
520 Superclass::SetVisibility(theMode);
521 myScalarBarCtrl->SetVisibility(theMode);
522 Highlight(isHighlighted());
527 ::IsSegmentationEnabled()
529 return myWidgetCtrl && myWidgetCtrl->GetEnabled();
533 //----------------------------------------------------------------------------
536 ::SetBarVisibility(bool theMode)
538 myBarVisibility = theMode;
539 myScalarBarCtrl->SetCtrlVisibility(theMode);
540 myScalarBarCtrl->SetVisibility(GetVisibility());
547 return myBarVisibility;
554 return myScalarBarCtrl.GetPointer();
557 //----------------------------------------------------------------------------
560 ::SetInteractor(vtkRenderWindowInteractor* theInteractor)
562 if(theInteractor == myInteractor)
566 myInteractor->RemoveObserver(myEventCallbackCommand.GetPointer());
569 theInteractor->AddObserver(vtkCommand::CharEvent,
570 myEventCallbackCommand.GetPointer(),
572 theInteractor->AddObserver(VISU::SetSMDecreaseMagnificationEvent,
573 myEventCallbackCommand.GetPointer(),
575 theInteractor->AddObserver(VISU::SetSMIncreaseMagnificationEvent,
576 myEventCallbackCommand.GetPointer(),
579 Superclass::SetInteractor(theInteractor);
583 //-------------------------------------------------------------------------
586 ::ProcessEvents(vtkObject* vtkNotUsed(theObject),
587 unsigned long theEvent,
589 void* vtkNotUsed(theCallData))
591 if(vtkObject* anObject = reinterpret_cast<vtkObject*>(theClientData))
592 if(VISU_GaussPtsAct* self = dynamic_cast<VISU_GaussPtsAct*>(anObject)) {
593 if(theEvent == VISU::UpdateInsideSettingsEvent)
594 self->UpdateInsideCursorSettings();
596 self->OnInteractorEvent(theEvent);
600 //-------------------------------------------------------------------------
603 ::OnInteractorEvent(unsigned long theEvent)
606 case vtkCommand::CharEvent: {
607 switch(myInteractor->GetKeyCode()) {
611 if( IsSegmentationEnabled() )
613 this->ChangeMagnification( myInteractor->GetShiftKey() );
617 myChangeMagnification = myInteractor->GetShiftKey();
623 if( IsSegmentationEnabled() && myWidgetCtrl->IsSphereActive() )
625 VISU_SphereWidget* aSphereWidget = myWidgetCtrl->GetSphereWidget();
626 aSphereWidget->ChangeRadius( myInteractor->GetShiftKey() );
627 myWidgetCtrl->InvokeEvent(vtkCommand::EndInteractionEvent,NULL);
628 myWidgetCtrl->GetInteractor()->Render();
635 myUpdatePrs3dSignal(this);
638 case VISU::SetSMDecreaseMagnificationEvent:
639 case VISU::SetSMIncreaseMagnificationEvent:
640 myChangeMagnification = theEvent == VISU::SetSMIncreaseMagnificationEvent;
641 myUpdatePrs3dSignal(this);
643 case VISU::UpdatePickingSettingsEvent:
644 UpdatePickingSettings();
646 case vtkCommand::EndInteractionEvent:
647 case vtkCommand::EnableEvent:
648 case vtkCommand::DisableEvent:
649 myCurrentPL->GetMapper()->Update();
650 Highlight(isHighlighted());
657 //----------------------------------------------------------------------------
662 if(vtkMapper* aMapper = myDeviceActor->GetMapper()){
663 if(vtkDataSet* aDataSet= aMapper->GetInput()){
665 myIsInfinite = aDataSet->GetNumberOfCells() < 2;
671 //----------------------------------------------------------------------------
676 if(Superclass::GetPickable()){
677 if(vtkMapper* aMapper = GetMapper()){
678 if(vtkDataSet* aDataSet= aMapper->GetInput()){
680 return aDataSet->GetNumberOfCells() > 0;
688 //----------------------------------------------------------------------------
691 ::PreHighlight(vtkInteractorStyle* theInteractorStyle,
692 SVTK_SelectionEvent* theSelectionEvent,
695 if ( !GetPickable() )
698 myPreHighlightActor->SetVisibility(false);
699 myCursorPyramid->SetVisibility(false);
701 if (!myBarVisibility)
706 myLastPreHighlightObjID = -1;
708 Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode;
710 if(aSelectionMode == ActorSelection || !theIsHighlight)
711 return Superclass::PreHighlight(theInteractorStyle,
715 bool anIsChanged = (mySelectionMode != aSelectionMode);
716 bool anIsPreselected = myIsPreselected;
717 myIsPreselected = false;
719 if(aSelectionMode == GaussPointSelection && theIsHighlight){
720 myPointPicker->Pick(theSelectionEvent->myX,
721 theSelectionEvent->myY,
723 theInteractorStyle->GetCurrentRenderer());
725 if(myPointPicker->GetActor() != this)
726 return (anIsPreselected != myIsPreselected);
728 vtkIdType aVtkId = myPointPicker->GetPointId();
730 if(aVtkId >= 0 && mySelector->IsValid(this,aVtkId,true) && hasIO()){
731 vtkIdType anObjId = GetNodeObjId( aVtkId );
732 myIsPreselected = (anObjId >= 0);
734 anIsChanged = (myLastPreHighlightObjID != anObjId);
736 vtkFloatingPointType* aNodeCoord = GetNodeCoord(anObjId);
737 vtkDataSet* aDataSet = GetInput();
738 vtkPointData* aPointData = aDataSet->GetPointData();
739 if(vtkDataArray *aScalarArray = aPointData->GetScalars()){
740 vtkFloatingPointType aPyramidHeight = myPickingSettings->GetPyramidHeight();
741 aPyramidHeight = aPyramidHeight*myGaussPointsPL->GetMaxPointSize();
742 //vtkFloatingPointType aColor[3] = myPreHighlightActor->GetProperty()->GetColor();
743 vtkFloatingPointType aColor[3];
744 theInteractorStyle->GetCurrentRenderer()->GetBackground( aColor );
745 aColor[0] = 1. - aColor[0];
746 aColor[1] = 1. - aColor[1];
747 aColor[2] = 1. - aColor[2];
749 myCursorPyramid->Init(aPyramidHeight,
750 myPickingSettings->GetCursorSize(),
751 GetRadius(anObjId,aVtkId,aScalarArray),
752 GetMagnification(anObjId),
757 myLastPreHighlightObjID = anObjId;
759 myCursorPyramid->SetVisibility(true);
764 mySelectionMode = aSelectionMode;
765 anIsChanged |= (anIsPreselected != myIsPreselected);
771 //----------------------------------------------------------------------------
774 ChangeZoom(VISU_PickingSettings *thePickingSettings,
775 vtkRenderer* theRenderer,
776 vtkIdType theInitialHasIndex,
777 vtkIdType theCurrentHasIndex)
779 if(theInitialHasIndex + theCurrentHasIndex == 1){
780 vtkCamera *aCamera = theRenderer->GetActiveCamera();
782 vtkFloatingPointType aZoomFactor = thePickingSettings->GetZoomFactor();
783 double aScale = aCamera->GetParallelScale();
784 if ( !theInitialHasIndex && theCurrentHasIndex ) {
785 aCamera->SetParallelScale( aScale/aZoomFactor );
788 aCamera->SetParallelScale( aScale*aZoomFactor );
796 ::Highlight(vtkInteractorStyle* theInteractorStyle,
797 SVTK_SelectionEvent* theSelectionEvent,
800 if ( !GetPickable() )
803 // int anInitialHasIndex = myIsHighlighted && mySelectionMode == GaussPointSelection;
804 Handle(SALOME_InteractiveObject) anIO = getIO();
805 // myIsHighlighted = false;
807 Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode;
809 if(!theIsHighlight && aSelectionMode == GaussPointSelection){
810 mySelector->RemoveIObject(anIO);
812 /* ChangeZoom(myPickingSettings,
821 if (!myBarVisibility)
825 if(aSelectionMode == ActorSelection)
826 return Superclass::Highlight(theInteractorStyle,
830 if(aSelectionMode == GaussPointSelection && !theSelectionEvent->myIsRectangle){
832 vtkRenderer *aRenderer = theInteractorStyle->GetCurrentRenderer();
833 myPointPicker->Pick(theSelectionEvent->myX,
834 theSelectionEvent->myY,
838 if(myPointPicker->GetActor() != this) {
839 mySelector->ClearIObjects();
841 /* ChangeZoom(myPickingSettings,
850 vtkIdType aVtkId = myPointPicker->GetPointId();
851 if( aVtkId >= 0 && mySelector->IsValid( this, aVtkId, true ) && hasIO()) {
852 vtkIdType anObjId = GetNodeObjId( aVtkId );
854 // myIsHighlighted = true;
855 // Update the Selector
856 if(mySelector->IsSelected(myIO))
857 mySelector->AddOrRemoveIndex(myIO,anObjId,theSelectionEvent->myIsShift);
859 if(!theSelectionEvent->myIsShift){
860 mySelector->ClearIObjects();
862 mySelector->AddOrRemoveIndex(myIO,anObjId,theSelectionEvent->myIsShift);
863 mySelector->AddIObject(this);
866 vtkFloatingPointType* aNodeCoord = GetNodeCoord(anObjId);
869 vtkRenderWindowInteractor* anInteractor = theInteractorStyle->GetInteractor();
870 vtkFloatingPointType aDollyWas = anInteractor->GetDolly();
871 int aNumberOfFlyFramesWas = anInteractor->GetNumberOfFlyFrames();
873 anInteractor->SetDolly(0.);
874 anInteractor->SetNumberOfFlyFrames(myPickingSettings->GetStepNumber());
875 anInteractor->FlyTo(aRenderer,aNodeCoord);
876 aRenderer->ResetCameraClippingRange();
877 anInteractor->SetDolly(aDollyWas);
878 anInteractor->SetNumberOfFlyFrames(aNumberOfFlyFramesWas);
880 anInteractor->InvokeEvent(SVTK::ChangeRotationPoint, aNodeCoord);*/
882 mySelectionMode = aSelectionMode;
884 /* ChangeZoom(myPickingSettings,
891 }// if( anObjId >= 0 ) {
892 }//if( aVtkId >= 0 && mySelector->IsValid( this, aVtkId, true ) && hasIO())
893 }//if(!theSelectionEvent->myIsRectangle){
895 /* ChangeZoom(myPickingSettings,
904 //==================================================================
905 // function : Highlight
907 //==================================================================
910 ::Highlight(bool theIsHighlight)
912 if(!mySelector.GetPointer())
915 Selection_Mode aSelectionMode = mySelector->SelectionMode();
917 bool anInitialHasIndex = isHighlighted() && mySelectionMode == GaussPointSelection;
919 TColStd_IndexedMapOfInteger aMapIndex;
920 mySelector->GetIndex( getIO(), aMapIndex );
921 bool aCurrentHasIndex = aMapIndex.Extent() == 1;
922 bool anIsVisible = GetVisibility() && aCurrentHasIndex && theIsHighlight;
924 myOutlineActor->SetVisibility(false);
925 myCursorPyramid->SetVisibility(false);
927 myTextActor->SetVisibility(anIsVisible);
928 myCellActor->SetVisibility(anIsVisible);
929 GetScalarBarCtrl()->SetIsMarked(anIsVisible);
930 myCursorPyramidSelected->SetVisibility(anIsVisible);
931 //GetScalarBarCtrl()->Update();
933 myIsHighlighted = aCurrentHasIndex;
936 ChangeZoom(myPickingSettings,
944 if( aSelectionMode == ActorSelection ) {
945 Superclass::highlight(theIsHighlight);
949 if( aSelectionMode != GaussPointSelection )
952 if ( !aCurrentHasIndex || !myBarVisibility )
955 // TColStd_IndexedMapOfInteger aMapIndex;
956 mySelector->GetIndex( getIO(), aMapIndex );
957 if(aMapIndex.Extent() != 1 || !myBarVisibility) {
961 vtkRenderer *aRenderer = GetRenderer();
962 vtkCamera* aCamera = aRenderer->GetActiveCamera();
964 int anObjId = aMapIndex(1);
965 vtkFloatingPointType* aNodeCoord = GetNodeCoord(anObjId);
967 vtkFloatingPointType aFocalPnt[3];
968 aCamera->GetFocalPoint(aFocalPnt);
970 if ( CheckIsSameVector( aNodeCoord, aFocalPnt, 3 ) )
974 vtkRenderWindowInteractor* anInteractor = myInteractor;
975 vtkFloatingPointType aDollyWas = anInteractor->GetDolly();
976 int aNumberOfFlyFramesWas = anInteractor->GetNumberOfFlyFrames();
978 anInteractor->SetDolly(0.0);
979 anInteractor->SetNumberOfFlyFrames(myPickingSettings->GetStepNumber());
980 anInteractor->FlyTo(aRenderer, aNodeCoord);
981 aRenderer->ResetCameraClippingRange();
982 anInteractor->SetDolly(aDollyWas);
983 anInteractor->SetNumberOfFlyFrames(aNumberOfFlyFramesWas);
984 anInteractor->InvokeEvent(SVTK::ChangeRotationPoint, aNodeCoord);
986 std::ostringstream aStr;
987 // int anObjId = aMapIndex(1);
988 aStr<<"Global ID: "<<anObjId;
990 vtkIdType aVtkId = GetNodeVTKID(anObjId);
992 vtkFloatingPointType *aNodeCoord = GetNodeCoord(anObjId);
993 vtkFloatingPointType aWorldCoord[4] = {aNodeCoord[0], aNodeCoord[1], aNodeCoord[2], 1.};
995 vtkDataSet* aDataSet = GetInput();
996 vtkPointData* aDataSetAttributes = aDataSet->GetPointData();
998 if(vtkDataArray* aScalarArray = aDataSetAttributes->GetScalars()){
999 vtkFloatingPointType aVal = aScalarArray->GetTuple1(aVtkId);
1001 // GetScalarBarCtrl()->SetIsMarked(true);
1002 GetScalarBarCtrl()->SetMarkValue(aVal);
1003 GetScalarBarCtrl()->Update();
1005 vtkFloatingPointType aPyramidHeight = myPickingSettings->GetPyramidHeight();
1006 aPyramidHeight = aPyramidHeight*myGaussPointsPL->GetMaxPointSize();
1007 myCursorPyramidSelected->Init(aPyramidHeight,
1008 myPickingSettings->GetCursorSize(),
1009 GetRadius(anObjId,aVtkId,aScalarArray),
1010 GetMagnification(anObjId),
1013 myHighlightActor->GetProperty()->GetColor());
1014 myCursorPyramidSelected->SetVisibility(anIsVisible && theIsHighlight);
1016 const VISU::PGaussPtsIDMapper& aGaussPtsIDMapper =
1017 myGaussPointsPL->GetGaussPtsIDMapper();
1018 VISU::TNamedIDMapper* aParent = aGaussPtsIDMapper->GetParent();
1020 VISU::TGaussPointID aGaussPointID = myGaussPointsPL->GetObjID(anObjId);
1021 VISU::TCellID aCellID = aGaussPointID.first;
1022 VISU::TLocalPntID aLocalPntID = aGaussPointID.second;
1023 aStr<<"\nParentCellID: "<<aCellID;
1024 std::string aParentName = aParent->GetElemName(aCellID);
1025 if(aParentName != "") {
1026 aStr<<"\nParentCellName: '"<<aParentName<<"'";
1028 aStr<<"\nLocalPntID: "<<aLocalPntID;
1029 aStr<<"\nScalar: "<<aVal;
1032 if(vtkDataArray* aFieldArray = aDataSetAttributes->GetArray("VISU_FIELD")){
1033 int aNbComp = aFieldArray->GetNumberOfComponents();
1034 std::vector<vtkFloatingPointType> aTuple(aNbComp);
1035 aFieldArray->GetTuple(aVtkId, &aTuple[0]);
1039 while(anId < aNbComp){
1040 vtkFloatingPointType aComp = aTuple[anId++];
1049 std::string aString = aStr.str();
1050 myTextActor->SetModePosition(myPickingSettings->GetInfoWindowPosition());
1051 myTextActor->SetTransparency(myPickingSettings->GetInfoWindowTransparency());
1052 myTextActor->SetWorldPoint(aWorldCoord);
1053 myTextActor->SetText(aString.c_str());
1054 myTextActor->SetVisibility(anIsVisible && theIsHighlight);
1057 if(myPickingSettings->GetDisplayParentMesh()){
1058 const VISU::PGaussPtsIDMapper& aGaussPtsIDMapper =
1059 myGaussPointsPL->GetGaussPtsIDMapper();
1060 VISU::TNamedIDMapper* aParent = aGaussPtsIDMapper->GetParent();
1062 myCellSource->Reset();
1063 myCellSource->Modified(); // a VTK bug
1064 vtkUnstructuredGrid* aDataSet = aParent->GetUnstructuredGridOutput();
1065 myCellSource->SetPoints(aDataSet->GetPoints());
1067 VISU::TGaussPointID aGaussPointID = aGaussPtsIDMapper->GetObjID(anObjId);
1068 vtkIdType aCellID = aGaussPointID.first;
1069 vtkCell* aCell = aParent->GetElemCell(aCellID);
1070 myCellSource->InsertNextCell(aCell->GetCellType(),aCell->GetPointIds());
1071 myCellActor->SetVisibility(anIsVisible && theIsHighlight);
1072 myCellActor->SetRepresentation(VTK_WIREFRAME);
1078 //----------------------------------------------------------------
1081 ::SetPickingSettings(VISU_PickingSettings* thePickingSettings)
1083 if(myPickingSettings == thePickingSettings)
1086 if(myPickingSettings)
1087 myPickingSettings->RemoveObserver(myEventCallbackCommand.GetPointer());
1089 myPickingSettings = thePickingSettings;
1091 if(thePickingSettings)
1093 thePickingSettings->AddObserver(VISU::UpdatePickingSettingsEvent,
1094 myEventCallbackCommand.GetPointer(),
1096 this->UpdatePickingSettings();
1102 ::UpdatePickingSettings()
1104 if(!myPickingSettings || myPickingSettings->GetInitial())
1107 myTextActor->SetModePosition(myPickingSettings->GetInfoWindowPosition());
1108 myTextActor->SetTransparency(myPickingSettings->GetInfoWindowTransparency());
1110 vtkFloatingPointType aHeight = myGaussPointsPL->GetMaxPointSize()*myPickingSettings->GetPyramidHeight();
1111 vtkFloatingPointType aCursorSize = myPickingSettings->GetCursorSize();
1112 myCursorPyramid->SetPreferences(aHeight,aCursorSize);
1113 myCursorPyramidSelected->SetPreferences(aHeight,aCursorSize);
1115 myHighlightActor->GetProperty()->SetColor( myPickingSettings->GetColor() );
1116 myPointPicker->SetTolerance( myPickingSettings->GetPointTolerance() );
1118 Highlight(isHighlighted());
1123 //----------------------------------------------------------------
1126 ::SetInsideCursorSettings(VISU_InsideCursorSettings* theInsideCursorSettings)
1128 if(myInsideCursorSettings == theInsideCursorSettings)
1131 if(myInsideCursorSettings)
1132 myInsideCursorSettings->RemoveObserver(myEventCallbackCommand.GetPointer());
1134 myInsideCursorSettings = theInsideCursorSettings;
1136 if(theInsideCursorSettings){
1137 theInsideCursorSettings->AddObserver(VISU::UpdateInsideSettingsEvent,
1138 myEventCallbackCommand.GetPointer(),
1140 UpdateInsideCursorSettings();
1146 ::UpdateInsideCursorSettings()
1148 UpdateInsideCursorSettings( myDeviceActor );
1153 ::UpdateInsideCursorSettings( PDeviceActor theActor )
1155 if(!myInsideCursorSettings || myInsideCursorSettings->GetInitial())
1158 VISU_GaussPointsPL* aPipeline = theActor->GetPipeLine();
1160 vtkImplicitFunction* anImplicitFunction = aPipeline->GetImplicitFunction();
1162 aPipeline->ShallowCopy(GetGaussPointsPL(), true);
1164 aPipeline->SetImplicitFunction(anImplicitFunction); // To restore
1166 aPipeline->SetPrimitiveType( myInsideCursorSettings->GetPrimitiveType() );
1167 aPipeline->SetClamp( myInsideCursorSettings->GetClamp() );
1168 aPipeline->SetImageData( myInsideCursorSettings->GetTexture() );
1169 aPipeline->SetAlphaThreshold( myInsideCursorSettings->GetAlphaThreshold() );
1170 aPipeline->SetResolution( myInsideCursorSettings->GetResolution() );
1171 aPipeline->SetMinSize( myInsideCursorSettings->GetMinSize() );
1172 aPipeline->SetMaxSize( myInsideCursorSettings->GetMaxSize() );
1173 aPipeline->SetMagnification( myInsideCursorSettings->GetMagnification() );
1174 aPipeline->SetMagnificationIncrement( myInsideCursorSettings->GetIncrement() );
1176 if( myInsideCursorSettings->GetPrimitiveType() != VISU_OpenGLPointSpriteMapper::GeomSphere )
1177 theActor->GetProperty()->SetRepresentation( VTK_POINTS );
1179 theActor->GetProperty()->SetRepresentation( VTK_SURFACE );
1181 aPipeline->Update();
1183 Highlight(isHighlighted());
1188 //----------------------------------------------------------------------------
1193 unsigned long int aTime = Superclass::GetMTime();
1194 aTime = std::max(aTime, myGaussPointsPL->GetPointSpriteMapper()->GetMTime() );
1198 //==============================================================================
1199 vtkStandardNewMacro(VISU_GaussPtsAct1);
1202 //----------------------------------------------------------------------------
1204 ::VISU_GaussPtsAct1():
1205 myInsideDeviceActor(VISU_GaussPtsDeviceActor::New()),
1206 myOutsideDeviceActor(VISU_GaussPtsDeviceActor::New()),
1207 myOutsideCursorSettings(NULL)
1209 if(MYDEBUG1) MESSAGE("VISU_GaussPtsAct1::VISU_GaussPtsAct1 - this = "<<this);
1211 myEventCallbackCommand->SetCallback(VISU_GaussPtsAct1::ProcessEvents);
1213 myInsideDeviceActor->SetVisibility(false);
1214 myInsideDeviceActor->SetPickable(false);
1215 myInsideDeviceActor->Delete();
1217 myOutsideDeviceActor->SetVisibility(false);
1218 myOutsideDeviceActor->SetPickable(false);
1219 myOutsideDeviceActor->Delete();
1223 ::~VISU_GaussPtsAct1()
1225 if(MYDEBUG1) MESSAGE("VISU_GaussPtsAct1::~VISU_GaussPtsAct1 - this = "<<this);
1227 SetOutsideCursorSettings(NULL);
1231 //----------------------------------------------------------------------------
1234 ::ShallowCopyPL(VISU_PipeLine* thePipeLine)
1236 if(MYDEBUG1) MESSAGE("VISU_GaussPtsAct1::ShallowCopyPL - this = "<<this);
1238 Superclass::ShallowCopyPL(thePipeLine);
1240 UpdateOutsideCursorSettings();
1244 //----------------------------------------------------------------------------
1247 ::AddToRender(vtkRenderer* theRenderer)
1249 Superclass::AddToRender(theRenderer);
1251 myInsideDeviceActor->AddToRender(theRenderer);
1252 myOutsideDeviceActor->AddToRender(theRenderer);
1257 ::RemoveFromRender(vtkRenderer* theRenderer)
1259 myInsideDeviceActor->RemoveFromRender(theRenderer);
1260 myOutsideDeviceActor->RemoveFromRender(theRenderer);
1262 Superclass::RemoveFromRender(theRenderer);
1267 ::SetTransform(VTKViewer_Transform* theTransform)
1269 Superclass::SetTransform(theTransform);
1271 myInsideDeviceActor->SetTransform(theTransform);
1272 myOutsideDeviceActor->SetTransform(theTransform);
1276 //----------------------------------------------------------------------------
1279 ::SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl)
1281 if(MYDEBUG1) MESSAGE("VISU_GaussPtsAct1::SetWidgetCtrl - this = "<<this);
1283 if(myWidgetCtrl == theWidgetCtrl){
1288 myInsideDeviceActor->GetPipeLine()->SetImplicitFunction(NULL);
1289 myInsideDeviceActor->SetVisibility(false);
1291 myOutsideDeviceActor->GetPipeLine()->SetImplicitFunction(NULL);
1292 myOutsideDeviceActor->SetVisibility(false);
1295 Superclass::SetWidgetCtrl(theWidgetCtrl);
1298 myInsideDeviceActor->GetPipeLine()->SetImplicitFunction(theWidgetCtrl->ImplicitFunction());
1299 myInsideDeviceActor->SetVisibility(GetVisibility() && IsSegmentationEnabled());
1301 myOutsideDeviceActor->GetPipeLine()->SetImplicitFunction(theWidgetCtrl->ImplicitFunction());
1302 myOutsideDeviceActor->SetVisibility(GetVisibility() && IsSegmentationEnabled());
1307 //----------------------------------------------------------------------------
1310 ::SetMapperInput(vtkDataSet* theDataSet)
1312 if(MYDEBUG1) MESSAGE("VISU_GaussPtsAct1::SetMapperInput - this = "<<this);
1314 Superclass::SetMapperInput(theDataSet);
1316 if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
1317 myInsideDeviceActor->SetPipeLine(aPipeLine);
1318 aPipeLine->Delete();
1321 if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
1322 myOutsideDeviceActor->SetPipeLine(aPipeLine);
1323 aPipeLine->Delete();
1325 aPipeLine->SetExtractBoundaryCells(true);
1326 aPipeLine->SetExtractInside(true);
1331 //----------------------------------------------------------------------------
1332 vtkFloatingPointType
1334 ::GetRadius(vtkIdType theObjID,
1336 vtkDataArray *theScalarArray)
1338 VISU_GaussPointsPL* aPipeLine = myDeviceActor->GetPipeLine();
1339 if(IsSegmentationEnabled()){
1340 if(myInsideDeviceActor->GetPipeLine()->GetNodeVTKID(theObjID) < 0)
1341 aPipeLine = myOutsideDeviceActor->GetPipeLine();
1343 aPipeLine = myInsideDeviceActor->GetPipeLine();
1345 return ::GetRadius(theVTKID,theScalarArray,aPipeLine);
1349 //----------------------------------------------------------------------------
1350 vtkFloatingPointType
1352 ::GetMagnification(vtkIdType theObjID)
1354 VISU_GaussPointsPL* aPipeLine = myDeviceActor->GetPipeLine();
1355 if(IsSegmentationEnabled()){
1356 if(myInsideDeviceActor->GetPipeLine()->GetNodeVTKID(theObjID) < 0)
1357 aPipeLine = myOutsideDeviceActor->GetPipeLine();
1359 aPipeLine = myInsideDeviceActor->GetPipeLine();
1361 return aPipeLine->GetMagnification();
1365 //----------------------------------------------------------------------------
1366 vtkFloatingPointType
1368 ::GetClamp(vtkIdType theObjID)
1370 if(IsSegmentationEnabled()){
1371 if(myInsideDeviceActor->GetPipeLine()->GetNodeVTKID(theObjID) < 0)
1372 return ::GetClamp(myOutsideDeviceActor->GetPipeLine());
1374 return ::GetClamp(myInsideDeviceActor->GetPipeLine());
1376 return Superclass::GetClamp(theObjID);
1380 //----------------------------------------------------------------
1383 ::Connect(VISU_GaussPtsAct2* theActor)
1385 mySetVisibilitySignal.connect(boost::bind(&VISU_GaussPtsAct2::SetVisibility,theActor,_1));
1390 ::SetVisibility(int theMode)
1392 if(MYDEBUG1) MESSAGE("VISU_GaussPtsAct1::SetVisibility - this = "<<this);
1394 Superclass::SetVisibility(theMode);
1396 bool aVisisbility = GetVisibility();
1397 bool anIsSegementation = IsSegmentationEnabled();
1398 myDeviceActor->SetVisibility(aVisisbility && !anIsSegementation);
1399 myInsideDeviceActor->SetVisibility(aVisisbility && anIsSegementation);
1400 myOutsideDeviceActor->SetVisibility(aVisisbility && anIsSegementation);
1402 mySetVisibilitySignal(GetVisibility());
1405 //----------------------------------------------------------------
1408 ::UpdateInsideCursorSettings()
1410 Superclass::UpdateInsideCursorSettings( myInsideDeviceActor );
1413 //----------------------------------------------------------------
1416 ::SetOutsideCursorSettings(VISU_OutsideCursorSettings* theOutsideCursorSettings)
1418 if(myOutsideCursorSettings == theOutsideCursorSettings)
1421 if(myOutsideCursorSettings)
1422 myOutsideCursorSettings->RemoveObserver(myEventCallbackCommand.GetPointer());
1424 myOutsideCursorSettings = theOutsideCursorSettings;
1426 if(theOutsideCursorSettings)
1428 theOutsideCursorSettings->AddObserver(VISU::UpdateOutsideSettingsEvent,
1429 myEventCallbackCommand.GetPointer(),
1431 UpdateOutsideCursorSettings();
1437 ::UpdateOutsideCursorSettings()
1439 if(!myOutsideCursorSettings || myOutsideCursorSettings->GetInitial())
1442 VISU_GaussPointsPL* aPipeline = myOutsideDeviceActor->GetPipeLine();
1444 vtkImplicitFunction* anImplicitFunction = aPipeline->GetImplicitFunction();
1445 vtkFloatingPointType aMagnification = aPipeline->GetMagnification();
1447 aPipeline->ShallowCopy(GetGaussPointsPL(), true);
1449 aPipeline->SetImplicitFunction(anImplicitFunction); // To restore
1450 aPipeline->SetExtractBoundaryCells(true);
1451 aPipeline->SetExtractInside(true);
1452 aPipeline->SetMagnification( aMagnification );
1454 aPipeline->SetPrimitiveType( myOutsideCursorSettings->GetPrimitiveType() );
1456 if( myOutsideCursorSettings->GetPrimitiveType() != VISU_OpenGLPointSpriteMapper::GeomSphere )
1457 myOutsideDeviceActor->GetProperty()->SetRepresentation( VTK_POINTS );
1459 myOutsideDeviceActor->GetProperty()->SetRepresentation( VTK_SURFACE );
1461 aPipeline->SetClamp( myOutsideCursorSettings->GetClamp() );
1462 aPipeline->SetImageData( myOutsideCursorSettings->GetTexture() );
1463 aPipeline->SetAlphaThreshold( myOutsideCursorSettings->GetAlphaThreshold() );
1464 aPipeline->SetResolution( myOutsideCursorSettings->GetResolution() );
1465 aPipeline->SetSize( myOutsideCursorSettings->GetSize() );
1466 aPipeline->SetMagnification( myOutsideCursorSettings->GetMagnification() );
1467 aPipeline->SetMagnificationIncrement( myOutsideCursorSettings->GetIncrement() );
1469 if( myOutsideCursorSettings->GetUniform() )
1471 myOutsideDeviceActor->GetPointSpriteMapper()->ScalarVisibilityOff();
1472 myOutsideDeviceActor->GetPointSpriteMapper()->SetPointSpriteMode( 1 ); // Geometry mode
1473 myOutsideDeviceActor->GetProperty()->SetColor( myOutsideCursorSettings->GetColor() );
1477 myOutsideDeviceActor->GetPointSpriteMapper()->SetPointSpriteMode( 2 ); // Outside cursor mode
1478 myOutsideDeviceActor->GetPointSpriteMapper()->SetColorModeToMapScalars();
1479 myOutsideDeviceActor->GetPointSpriteMapper()->ScalarVisibilityOn();
1482 aPipeline->Update();
1484 Highlight(isHighlighted());
1490 //----------------------------------------------------------------
1493 ::ProcessEvents(vtkObject* theObject,
1494 unsigned long theEvent,
1495 void* theClientData,
1498 if(vtkObject* anObject = reinterpret_cast<vtkObject*>(theClientData))
1499 if(VISU_GaussPtsAct1* self = dynamic_cast<VISU_GaussPtsAct1*>(anObject))
1500 if(theEvent == VISU::UpdateOutsideSettingsEvent)
1501 self->UpdateOutsideCursorSettings();
1503 Superclass::ProcessEvents(theObject,theEvent,theClientData,theCallData);
1508 ::OnInteractorEvent(unsigned long theEvent)
1511 case vtkCommand::StartInteractionEvent:
1512 myDeviceActor->SetVisibility(GetVisibility());
1513 myInsideDeviceActor->SetVisibility(false);
1514 myOutsideDeviceActor->SetVisibility(false);
1516 case vtkCommand::EnableEvent:
1517 case vtkCommand::DisableEvent:
1518 case vtkCommand::EndInteractionEvent: {
1519 bool aVisisbility = GetVisibility();
1520 bool anIsSegementation = IsSegmentationEnabled();
1521 myDeviceActor->SetVisibility(aVisisbility && !anIsSegementation);
1522 myInsideDeviceActor->SetVisibility(aVisisbility && anIsSegementation);
1523 myOutsideDeviceActor->SetVisibility(aVisisbility && anIsSegementation);
1530 Superclass::OnInteractorEvent(theEvent);
1533 //----------------------------------------------------------------------------
1538 unsigned long int aSize = Superclass::GetMemorySize();
1539 if(IsSegmentationEnabled()){
1540 aSize += myInsideDeviceActor->GetMemorySize();
1541 aSize += myOutsideDeviceActor->GetMemorySize();
1548 //==============================================================================
1549 vtkStandardNewMacro(VISU_GaussPtsAct2);
1552 //----------------------------------------------------------------------------
1554 ::VISU_GaussPtsAct2()
1556 if(MYDEBUG2) MESSAGE("VISU_GaussPtsAct2::VISU_GaussPtsAct2 - this = "<<this);
1557 myDeviceActor->SetVisibility(false);
1561 ::~VISU_GaussPtsAct2()
1563 if(MYDEBUG2) MESSAGE("VISU_GaussPtsAct2::~VISU_GaussPtsAct2 - this = "<<this);
1567 //----------------------------------------------------------------------------
1570 ::ShallowCopyPL(VISU_PipeLine* thePipeLine)
1572 if(MYDEBUG2) MESSAGE("VISU_GaussPtsAct2::ShallowCopyPL - this = "<<this);
1574 Superclass::ShallowCopyPL(thePipeLine);
1578 //----------------------------------------------------------------------------
1581 ::SetMapperInput(vtkDataSet* theDataSet)
1583 if(MYDEBUG2) MESSAGE("VISU_GaussPtsAct2::SetMapperInput - this = "<<this);
1585 if(VISU_GaussPointsPL* aPipeLine = CreatePipeLine(GetGaussPointsPL())){
1586 myDeviceActor->SetPipeLine(aPipeLine);
1587 myCurrentPL = aPipeLine;
1588 aPipeLine->Delete();
1590 myMapper->SetInput(myCurrentPL->GetPickableDataSet());
1591 SetMapper(myMapper.GetPointer());
1595 //----------------------------------------------------------------------------
1598 ::SetWidgetCtrl(VISU_WidgetCtrl* theWidgetCtrl)
1600 if(MYDEBUG2) MESSAGE("VISU_GaussPtsAct2::SetWidgetCtrl - this = "<<this);
1602 if(myWidgetCtrl == theWidgetCtrl)
1606 theWidgetCtrl->RemoveObserver(myEventCallbackCommand.GetPointer());
1607 myDeviceActor->GetPipeLine()->SetImplicitFunction(NULL);
1608 myDeviceActor->SetVisibility(false);
1611 Superclass::SetWidgetCtrl(theWidgetCtrl);
1614 myDeviceActor->GetPipeLine()->SetImplicitFunction(theWidgetCtrl->ImplicitFunction());
1615 myDeviceActor->SetVisibility(GetVisibility() && IsSegmentationEnabled());
1620 //----------------------------------------------------------------------------
1625 if(IsSegmentationEnabled())
1626 return Superclass::GetMemorySize();
1631 //----------------------------------------------------------------------------
1634 ::SetVisibility(int theMode)
1636 if(MYDEBUG2) MESSAGE("VISU_GaussPtsAct2::SetVisibility - this = "<<this);
1638 Superclass::SetVisibility(theMode);
1640 myDeviceActor->SetVisibility(GetVisibility() && IsSegmentationEnabled());
1645 ::OnInteractorEvent(unsigned long theEvent)
1648 case vtkCommand::EnableEvent:
1649 case vtkCommand::DisableEvent:
1650 myDeviceActor->SetVisibility(GetVisibility() && IsSegmentationEnabled());
1651 if(theEvent == vtkCommand::EnableEvent)
1654 case vtkCommand::EndInteractionEvent:
1660 Superclass::OnInteractorEvent(theEvent);