]> SALOME platform Git repositories - modules/visu.git/commitdiff
Salome HOME
Picking preferences
authorouv <ouv@opencascade.com>
Tue, 4 Oct 2005 12:48:31 +0000 (12:48 +0000)
committerouv <ouv@opencascade.com>
Tue, 4 Oct 2005 12:48:31 +0000 (12:48 +0000)
src/OBJECT/VISU_GaussPtsAct.cxx
src/OBJECT/VISU_GaussPtsAct.h

index 3b1e226ca62238e919b7cd4f744f94c54d01b0d2..f8583ce573573c22b578214276e3936c77a38c44 100644 (file)
@@ -84,6 +84,7 @@ static int MYDEBUG2 = 0;
 
 //----------------------------------------------------------------
 vtkStandardNewMacro( VISU_OutsideCursorSettings );
+vtkStandardNewMacro( VISU_PickingSettings );
 
 //----------------------------------------------------------------
 VISU_OutsideCursorSettings::VISU_OutsideCursorSettings()
@@ -98,6 +99,18 @@ VISU_OutsideCursorSettings::~VISU_OutsideCursorSettings()
   this->SetTexture( NULL );
 }
 
+//----------------------------------------------------------------
+VISU_PickingSettings::VISU_PickingSettings()
+{
+  this->Initial = true;
+}
+
+VISU_PickingSettings::~VISU_PickingSettings()
+{
+}
+
+
+
 //============================================================================
 vtkStandardNewMacro(VISU_GaussPtsAct);
 
@@ -121,7 +134,8 @@ VISU_GaussPtsAct
   myCellSource(vtkUnstructuredGrid::New()),
   myCellActor(vtkActor::New()),
   myScalarBarCtrl(VISU_ScalarBarCtrl::New()),
-  myBarVisibility(true)
+  myBarVisibility(true),
+  myPickingSettings(NULL)
 {
   if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::VISU_GaussPtsAct - this = "<<this);
   
@@ -196,6 +210,7 @@ VISU_GaussPtsAct
   if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::~VISU_GaussPtsAct - this = "<<this);
   SetImplicitFunctionWidget(NULL);
   SetInteractor(NULL);
+  SetPickingSettings(NULL);
 }
 
 
@@ -839,6 +854,34 @@ VISU_GaussPtsAct
   return bRet;
 }
 
+//----------------------------------------------------------------
+void
+VISU_GaussPtsAct
+::SetPickingSettings(VISU_PickingSettings* thePickingSettings)
+{
+  if(myPickingSettings == thePickingSettings)
+    return;
+
+  if(myPickingSettings)
+    myPickingSettings->RemoveObserver(myEventCallbackCommand.GetPointer());
+
+  myPickingSettings = thePickingSettings;
+
+  if(thePickingSettings)
+    thePickingSettings->AddObserver(vtkCommand::ModifiedEvent, 
+                                   myEventCallbackCommand.GetPointer(), 
+                                   myPriority);
+}
+
+void
+VISU_GaussPtsAct
+::UpdatePickingSettings()
+{
+  // Update picking parameters using myPickingSettings object
+
+  Update();
+}
+
 //==============================================================================
 vtkStandardNewMacro(VISU_GaussPtsAct1);
 
@@ -1032,14 +1075,19 @@ void
 VISU_GaussPtsAct1
 ::UpdateOutsideCursorSettings()
 {
-  // update actor from myOutsideCursorSettings
   VISU_OpenGLPointSpriteMapper* aMapper = myOutsideDeviceActor->GetPSMapper();
-  aMapper->SetPointSpriteClamp(myOutsideCursorSettings->GetClamp());
+
   aMapper->SetImageData(myOutsideCursorSettings->GetTexture());
+
+  aMapper->SetPointSpriteResults(false);
+  aMapper->SetPointSpriteClamp(myOutsideCursorSettings->GetClamp());
   aMapper->SetPointSpriteAlphaThreshold(myOutsideCursorSettings->GetAlphaThreshold());
   aMapper->SetPointSpriteSize(myOutsideCursorSettings->GetSize());
-  aMapper->SetPointSpriteClamp(myOutsideCursorSettings->GetClamp());
+
   myOutsideDeviceActor->GetProperty()->SetColor(myOutsideCursorSettings->GetColor());
+
+  //cout << "UpdateOutsideCursorSettings " << aMapper << endl;
+  //cout << myOutsideCursorSettings->GetAlphaThreshold() << endl;
   
   Update();
 }
index 207f2ba0a38c7d4cfe9fea6cbf4b2668d0dc739c..8456a26f246ff47c3ad99c564e95a9814e76e4a1 100644 (file)
@@ -101,6 +101,51 @@ private:
 };
 
 
+//============================================================================
+class VISU_PickingSettings : public vtkObject
+{
+ public:
+  enum { BelowPoint = 0, TopLeftCorner };
+
+ public:
+  vtkTypeMacro( VISU_PickingSettings, vtkObject );
+
+  VISU_PickingSettings();
+  virtual ~VISU_PickingSettings();
+
+  static
+  VISU_PickingSettings*
+  New();
+
+  vtkSetMacro( Initial, bool );
+  vtkGetMacro( Initial, bool );
+
+  vtkSetMacro( PyramidHeight, float );
+  vtkGetMacro( PyramidHeight, float );
+
+  vtkSetMacro( InfoWindowTransparency, float );
+  vtkGetMacro( InfoWindowTransparency, float );
+
+  vtkSetMacro( InfoWindowPosition, int );
+  vtkGetMacro( InfoWindowPosition, int );
+
+  vtkSetMacro( ZoomFactor, float );
+  vtkGetMacro( ZoomFactor, float );
+
+  vtkSetMacro( StepNumber, int );
+  vtkGetMacro( StepNumber, int );
+
+private:
+  bool                Initial;
+
+  float               PyramidHeight;
+  float               InfoWindowTransparency;
+  int                 InfoWindowPosition;
+  float               ZoomFactor;
+  int                 StepNumber;
+};
+
+
 //============================================================================
 class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor
 {
@@ -208,6 +253,13 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor
            SVTK_SelectionEvent* theSelectionEvent,
            bool theIsHighlight);
 
+  //----------------------------------------------------------------------------
+  void
+  SetPickingSettings(VISU_PickingSettings* thePickingSettings);
+
+  void
+  UpdatePickingSettings();
+
  protected:
   //----------------------------------------------------------------------------
   VISU_GaussPtsAct();
@@ -263,6 +315,8 @@ class VTKOCC_EXPORT VISU_GaussPtsAct : public VISU_Actor
 
   bool myBarVisibility;
   vtkSmartPointer<VISU_ScalarBarCtrl> myScalarBarCtrl;
+
+  VISU_PickingSettings* myPickingSettings;
 };