#include "VISU_GaussPtsSettings.h"
#include "VISU_GaussPtsDeviceActor.h"
#include "VISU_WidgetCtrl.hxx"
+#include "VISU_SphereWidget.hxx"
#include "VISU_OpenGLPointSpriteMapper.hxx"
#include "VISU_ScalarBarCtrl.hxx"
#include "VISU_ScalarBarActor.hxx"
bool
VISU_GaussPtsAct
-::ChangeMagnification()
+::GetChangeMagnification()
{
return myChangeMagnification;
}
+void
+VISU_GaussPtsAct
+::ChangeMagnification( bool up )
+{
+ myEventCallbackCommand->SetAbortFlag(1);
+
+ float aMagnification = myInsideCursorSettings->GetMagnification();
+ float anIncrement = myInsideCursorSettings->GetIncrement();
+ float coefficient = up ? anIncrement : 1 / anIncrement;
+
+ myInsideCursorSettings->SetMagnification( aMagnification * coefficient );
+ myInsideCursorSettings->InvokeEvent(VISU::UpdateFromSettingsEvent,NULL);
+
+ Update();
+}
+
//----------------------------------------------------------------------------
namespace
{
switch(myInteractor->GetKeyCode()) {
case 'M' :
case 'm' :
+ {
+ if( myWidgetCtrl->GetEnabled() )
+ {
+ this->ChangeMagnification( myInteractor->GetShiftKey() );
+ return;
+ }
+
myChangeMagnification = myInteractor->GetShiftKey();
break;
+ }
+ case 'D' :
+ case 'd' :
+ {
+ if( myWidgetCtrl->GetEnabled() && myWidgetCtrl->IsSphereActive() )
+ {
+ VISU_SphereWidget* aSphereWidget = myWidgetCtrl->GetSphereWidget();
+ aSphereWidget->ChangeRadius( myInteractor->GetShiftKey() );
+ myWidgetCtrl->InvokeEvent(vtkCommand::EndInteractionEvent,NULL);
+ myWidgetCtrl->GetInteractor()->Render();
+ }
+ return;
+ }
default:
return;
}
aPipeline->SetAlphaThreshold( myOutsideCursorSettings->GetAlphaThreshold() );
aPipeline->SetResolution( myOutsideCursorSettings->GetResolution() );
aPipeline->SetSize( myOutsideCursorSettings->GetSize() );
+ aPipeline->SetMagnification( myOutsideCursorSettings->GetMagnification() );
+ aPipeline->SetMagnificationIncrement( myOutsideCursorSettings->GetIncrement() );
if( myOutsideCursorSettings->GetUniform() )
{
#include <vtkImageData.h>
//----------------------------------------------------------------
+vtkStandardNewMacro( VISU_GaussPtsSettings );
vtkStandardNewMacro( VISU_InsideCursorSettings );
vtkStandardNewMacro( VISU_OutsideCursorSettings );
vtkStandardNewMacro( VISU_PickingSettings );
//----------------------------------------------------------------
-VISU_InsideCursorSettings::VISU_InsideCursorSettings()
+VISU_GaussPtsSettings::VISU_GaussPtsSettings()
{
this->Initial = true;
this->Texture = NULL;
this->AlphaThreshold = -1;
this->Resolution = -1;
- this->MinSize = -1;
- this->MaxSize = -1;
this->Magnification = -1;
this->Increment = -1;
}
-VISU_InsideCursorSettings::~VISU_InsideCursorSettings()
+VISU_GaussPtsSettings::~VISU_GaussPtsSettings()
{
this->SetTexture( NULL );
}
//----------------------------------------------------------------
-VISU_OutsideCursorSettings::VISU_OutsideCursorSettings()
+VISU_InsideCursorSettings::VISU_InsideCursorSettings() :
+ VISU_GaussPtsSettings()
{
- this->Initial = true;
+ this->MinSize = -1;
+ this->MaxSize = -1;
+}
- this->PrimitiveType = -1;
- this->Clamp = -1;
- this->Texture = NULL;
- this->AlphaThreshold = -1;
- this->Resolution = -1;
+VISU_InsideCursorSettings::~VISU_InsideCursorSettings()
+{
+}
+
+//----------------------------------------------------------------
+VISU_OutsideCursorSettings::VISU_OutsideCursorSettings() :
+ VISU_GaussPtsSettings()
+{
this->Size = -1;
this->Uniform = false;
this->Color[0] = -1;
VISU_OutsideCursorSettings::~VISU_OutsideCursorSettings()
{
- this->SetTexture( NULL );
}
//----------------------------------------------------------------
//============================================================================
namespace VISU
{
- const vtkIdType UpdateInsideSettingsEvent = vtkCommand::UserEvent + 100;
- const vtkIdType UpdateOutsideSettingsEvent = vtkCommand::UserEvent + 200;
- const vtkIdType UpdatePickingSettingsEvent = vtkCommand::UserEvent + 300;
+ const vtkIdType UpdateFromSettingsEvent = vtkCommand::UserEvent + 100;
+ const vtkIdType UpdateInsideSettingsEvent = vtkCommand::UserEvent + 101;
+ const vtkIdType UpdateOutsideSettingsEvent = vtkCommand::UserEvent + 102;
+ const vtkIdType UpdatePickingSettingsEvent = vtkCommand::UserEvent + 103;
}
-//============================================================================
-class VISU_InsideCursorSettings : public vtkObject
+//! Base class of Gauss Points settings.
+class VISU_GaussPtsSettings : public vtkObject
{
public:
- vtkTypeMacro( VISU_InsideCursorSettings, vtkObject );
+ vtkTypeMacro( VISU_GaussPtsSettings, vtkObject );
- VISU_InsideCursorSettings();
- virtual ~VISU_InsideCursorSettings();
+ VISU_GaussPtsSettings();
+ virtual ~VISU_GaussPtsSettings();
static
- VISU_InsideCursorSettings*
+ VISU_GaussPtsSettings*
New();
vtkSetMacro( Initial, bool );
vtkSetMacro( Resolution, int );
vtkGetMacro( Resolution, int );
- vtkSetMacro( MinSize, float );
- vtkGetMacro( MinSize, float );
-
- vtkSetMacro( MaxSize, float );
- vtkGetMacro( MaxSize, float );
-
vtkSetMacro( Magnification, float );
vtkGetMacro( Magnification, float );
vtkSetMacro( Increment, float );
vtkGetMacro( Increment, float );
-
-private:
+ protected:
bool Initial;
int PrimitiveType;
vtkImageData* Texture;
float AlphaThreshold;
int Resolution;
- float MinSize;
- float MaxSize;
float Magnification;
float Increment;
};
-//============================================================================
-//! Class of Outside Cursor Gauss Points settings.
+//! Class of Inside Cursor Gauss Points settings.
/*!
* Contains information about the point sprite parameters:
* Clamp, Texture, Alpha threshold, Const size and Color.
* Used by Gauss Points Actor.
*/
-class VISU_OutsideCursorSettings : public vtkObject
+class VISU_InsideCursorSettings : public VISU_GaussPtsSettings
{
public:
- vtkTypeMacro( VISU_OutsideCursorSettings, vtkObject );
+ vtkTypeMacro( VISU_InsideCursorSettings, vtkObject );
- VISU_OutsideCursorSettings();
- virtual ~VISU_OutsideCursorSettings();
+ VISU_InsideCursorSettings();
+ virtual ~VISU_InsideCursorSettings();
static
- VISU_OutsideCursorSettings*
+ VISU_InsideCursorSettings*
New();
- vtkSetMacro( Initial, bool );
- vtkGetMacro( Initial, bool );
+ vtkSetMacro( MinSize, float );
+ vtkGetMacro( MinSize, float );
- vtkSetMacro( PrimitiveType, int );
- vtkGetMacro( PrimitiveType, int );
+ vtkSetMacro( MaxSize, float );
+ vtkGetMacro( MaxSize, float );
- vtkSetMacro( Clamp, float );
- vtkGetMacro( Clamp, float );
+ protected:
+ float MinSize;
+ float MaxSize;
+};
- vtkSetMacro( Texture, vtkImageData* );
- vtkGetMacro( Texture, vtkImageData* );
- vtkSetMacro( AlphaThreshold, float );
- vtkGetMacro( AlphaThreshold, float );
+//============================================================================
+//! Class of Outside Cursor Gauss Points settings.
+/*!
+ * Contains information about the point sprite parameters:
+ * Clamp, Texture, Alpha threshold, Const size and Color.
+ * Used by Gauss Points Actor.
+ */
+class VISU_OutsideCursorSettings : public VISU_GaussPtsSettings
+{
+ public:
+ vtkTypeMacro( VISU_OutsideCursorSettings, vtkObject );
- vtkSetMacro( Resolution, int );
- vtkGetMacro( Resolution, int );
+ VISU_OutsideCursorSettings();
+ virtual ~VISU_OutsideCursorSettings();
+
+ static
+ VISU_OutsideCursorSettings*
+ New();
vtkSetMacro( Size, float );
vtkGetMacro( Size, float );
vtkSetVector3Macro( Color, float );
vtkGetVector3Macro( Color, float );
-private:
- bool Initial;
-
- int PrimitiveType;
- float Clamp;
- vtkImageData* Texture;
- float AlphaThreshold;
- int Resolution;
+ protected:
float Size;
bool Uniform;
float Color[3];