myTextActor->SetVisibility(1);
//
// myCellActor
- if(mySelectionMode==CellSelection){
+ if(myPickingSettings->GetDisplayParentMesh()){
const VISU::PGaussPtsIDMapper& aGaussPtsIDMapper =
myGaussPointsPL->GetGaussPtsIDMapper();
VISU::TNamedIDMapper* aParent = aGaussPtsIDMapper->GetParent();
this->InfoWindowPosition = -1;
this->ZoomFactor = -1;
this->StepNumber = -1;
+ this->DisplayParentMesh = false;
}
VISU_PickingSettings::~VISU_PickingSettings()
vtkSetMacro( StepNumber, int );
vtkGetMacro( StepNumber, int );
+ vtkSetMacro( DisplayParentMesh, bool );
+ vtkGetMacro( DisplayParentMesh, bool );
+
private:
bool Initial;
int InfoWindowPosition;
float ZoomFactor;
int StepNumber;
+ bool DisplayParentMesh;
};
msgid "VisuGUI_Module::VISU_PICKING_PREF_TRANSPARENCY"
msgstr "Transparency"
-msgid "VisuGUI_Module::VISU_GAUSS_PREF_POSITION"
+msgid "VisuGUI_Module::VISU_PICKING_PREF_POSITION"
msgstr "Position"
-msgid "VisuGUI_Module::VISU_GAUSS_PREF_BELOW_POINT"
+msgid "VisuGUI_Module::VISU_PICKING_PREF_BELOW_POINT"
msgstr "Centered below the point"
-msgid "VisuGUI_Module::VISU_GAUSS_PREF_TOP_LEFT_CORNER"
+msgid "VisuGUI_Module::VISU_PICKING_PREF_TOP_LEFT_CORNER"
msgstr "Top-left corner of the 3D view"
msgid "VisuGUI_Module::VISU_PICKING_PREF_CAMERA_GROUP_TTL"
msgid "VisuGUI_Module::VISU_PICKING_PREF_STEP_NUMBER"
msgstr "Number of steps between two positions"
+msgid "VisuGUI_Module::VISU_PICKING_PREF_PARENT_MESH_TTL"
+msgstr "Parent mesh element"
+
+msgid "VisuGUI_Module::VISU_PICKING_PREF_DISPLAY_PARENT_MESH"
+msgstr "Display parent mesh element"
+
msgid "VisuGUI_Module::VISU_MOUSE_PREF_TAB_TLT"
msgstr "Spacemouse"
msgid "VVTK_PickingDlg::STEP_NUMBER"
msgstr "Number of steps between two positions :"
+msgid "VVTK_PickingDlg::PARENT_MESH_TITLE"
+msgstr "Parent mesh element"
+
+msgid "VVTK_PickingDlg::DISPLAY_PARENT_MESH"
+msgstr "Display parent mesh element"
\ No newline at end of file
setPreferenceProperty( transparencyPref, "max", 100 );
setPreferenceProperty( transparencyPref, "step", 10 );
- int positionPref = addPreference( tr( "VISU_GAUSS_PREF_POSITION" ), infoWindowGr,
+ int positionPref = addPreference( tr( "VISU_PICKING_PREF_POSITION" ), infoWindowGr,
SalomeApp_Preferences::Selector, "VISU", "picking_position" );
QStringList values;
- values.append( tr( "VISU_GAUSS_PREF_BELOW_POINT" ) );
- values.append( tr( "VISU_GAUSS_PREF_TOP_LEFT_CORNER" ) );
+ values.append( tr( "VISU_PICKING_PREF_BELOW_POINT" ) );
+ values.append( tr( "VISU_PICKING_PREF_TOP_LEFT_CORNER" ) );
QValueList<QVariant> indices;
indices.append( 0 );
indices.append( 1 );
SalomeApp_Preferences::IntSpin, "VISU", "picking_step_number" );
setPreferenceProperty( stepNumberPref, "min", 1 );
setPreferenceProperty( stepNumberPref, "max", 100 );
+
+ int parentMeshGr = addPreference( tr( "VISU_PICKING_PREF_PARENT_MESH_TTL" ), pickingTab );
+ setPreferenceProperty( parentMeshGr, "columns", 1 );
+
+ addPreference( tr( "VISU_PICKING_PREF_DISPLAY_PARENT_MESH" ), parentMeshGr,
+ SalomeApp_Preferences::Bool, "VISU", "picking_display_parent_mesh" );
}
VVTK_InteractorStyle
::OnKeyDown()
{
- SVTK_Selector* pSelector = GetSelector();
-
- if( pSelector->SelectionMode() != NodeSelection )
+ if( GetSelector()->SelectionMode() != NodeSelection )
return;
char key = Interactor->GetKeyCode();
- if ( key == 'S' || key == 'P') {
- int aSMWas, x, y;
- //
- aSMWas=pSelector->SelectionMode();
- //
- pSelector->SetSelectionMode(NodeSelection);
- if (key == 'P'){
- pSelector->SetSelectionMode(CellSelection);
- }
+ if ( key == 'S' ) {
// current mouse position (from last mouse move event or any other event)
+ int x, y;
Interactor->GetEventPosition( x, y );
FindPokedRenderer( x, y ); // calls SetCurrentRenderer
startOperation(VTK_INTERACTOR_STYLE_CAMERA_SELECT);
onFinishOperation();
startOperation(VTK_INTERACTOR_STYLE_CAMERA_NONE);
- //
- pSelector->SetSelectionMode(aSMWas);
}
}
{
myRenderer = theRenderer;
VVTK_MainWindow::Initialize(theInteractor);
+
mySegmentationCursorDlg->SetWidget( theRenderer->GetImplicitFunctionWidget() );
+ myPickingDlg->SetInteractor( GetInteractor() );
}
VVTK_MainWindow1
#include "SUIT_ResourceMgr.h"
#include "SUIT_Session.h"
+#include "SVTK_RenderWindowInteractor.h"
+
#include <vtkActorCollection.h>
#include <vtkCallbackCommand.h>
#include <vtkObjectFactory.h>
#include <vtkRenderer.h>
-#include <vtkRenderWindowInteractor.h>
+#include <vtkGenericRenderWindowInteractor.h>
#include <vtkSmartPointer.h>
#include "utilities.h"
+#include <qcheckbox.h>
#include <qcombobox.h>
#include <qgroupbox.h>
#include <qlabel.h>
VVTK_PickingDlg::VVTK_PickingDlg( QWidget* parent, const char* name )
:QDialog( parent, name, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ),
+ myEventCallbackCommand( vtkCallbackCommand::New() ),
myPickingSettings( VISU_PickingSettings::New() )
{
+ myPriority = 0.0;
+ myEventCallbackCommand->Delete();
+ myEventCallbackCommand->SetClientData(this);
+ myEventCallbackCommand->SetCallback(VVTK_PickingDlg::ProcessEvents);
+
SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
setCaption( tr( "PICKING_DLG_TITLE" ) );
CameraGroupLayout->addWidget( StepNumberLabel, 1, 0 );
CameraGroupLayout->addWidget( myStepNumberSpinBox, 1, 1 );
+ // Display parent mesh element
+ QGroupBox* ParentMeshGroup = new QGroupBox( tr( "PARENT_MESH_TITLE" ), aBox, "ParentMeshGroup" );
+ ParentMeshGroup->setColumnLayout(0, Qt::Vertical );
+ ParentMeshGroup->layout()->setSpacing( 0 );
+ ParentMeshGroup->layout()->setMargin( 0 );
+
+ QGridLayout* ParentMeshGroupLayout = new QGridLayout (ParentMeshGroup->layout());
+ ParentMeshGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignLeft);
+ ParentMeshGroupLayout->setSpacing(6);
+ ParentMeshGroupLayout->setMargin(11);
+
+ myDisplayParentMeshCheckBox = new QCheckBox( tr( "DISPLAY_PARENT_MESH" ), ParentMeshGroup );
+ ParentMeshGroupLayout->addWidget( myDisplayParentMeshCheckBox, 0, 0 );
// Common buttons ===========================================================
QGroupBox* GroupButtons = new QGroupBox( this, "GroupButtons" );
int anInfoWindowPosition = VISU_PickingSettings::BelowPoint;
float aZoomFactor = 1.5;
int aStepNumber = 10;
+ bool aDisplayParentMesh = false;
if( !myPickingSettings->GetInitial() )
{
myPositionComboBox->setCurrentItem( myPickingSettings->GetInfoWindowPosition() );
myZoomFactorSpinBox->setValue( myPickingSettings->GetZoomFactor() );
myStepNumberSpinBox->setValue( myPickingSettings->GetStepNumber() );
+ myDisplayParentMeshCheckBox->setChecked( myPickingSettings->GetDisplayParentMesh() );
return;
}
aStepNumber = aResourceMgr->integerValue( "VISU", "picking_step_number", aStepNumber );
myStepNumberSpinBox->setValue( aStepNumber );
+ aDisplayParentMesh = aResourceMgr->booleanValue( "VISU", "picking_display_parent_mesh", aDisplayParentMesh );
+ myDisplayParentMeshCheckBox->setChecked( aDisplayParentMesh );
+
onClickApply();
}
return myPickingSettings.GetPointer();
}
+void VVTK_PickingDlg::SetInteractor( SVTK_RenderWindowInteractor* theInteractor )
+{
+ myInteractor = theInteractor;
+
+ theInteractor->GetDevice()->AddObserver(vtkCommand::KeyPressEvent,
+ myEventCallbackCommand.GetPointer(),
+ myPriority);
+}
+
+
+void VVTK_PickingDlg::ProcessEvents(vtkObject* vtkNotUsed(theObject),
+ unsigned long theEvent,
+ void* theClientData,
+ void* vtkNotUsed(theCallData))
+{
+ VVTK_PickingDlg* self = reinterpret_cast<VVTK_PickingDlg*>(theClientData);
+
+ switch(theEvent){
+ case vtkCommand::KeyPressEvent:
+ self->KeyPressed();
+ break;
+ }
+}
+
+void VVTK_PickingDlg::KeyPressed()
+{
+ if( myInteractor->GetDevice()->GetKeyCode() == 'P' )
+ {
+ bool aDisplayParentMesh = !myPickingSettings->GetDisplayParentMesh();
+ myPickingSettings->SetDisplayParentMesh( aDisplayParentMesh );
+
+ myDisplayParentMeshCheckBox->setChecked( aDisplayParentMesh );
+
+ myPickingSettings->InvokeEvent(VISU::UpdatePickingSettingsEvent,NULL);
+ }
+}
+
void VVTK_PickingDlg::onClickApply()
{
myPickingSettings->SetInitial( false );
myPickingSettings->SetInfoWindowPosition( myPositionComboBox->currentItem() );
myPickingSettings->SetZoomFactor( myZoomFactorSpinBox->value() );
myPickingSettings->SetStepNumber( myStepNumberSpinBox->value() );
+ myPickingSettings->SetDisplayParentMesh( myDisplayParentMeshCheckBox->isChecked() );
myPickingSettings->InvokeEvent(VISU::UpdatePickingSettingsEvent,NULL);
}
class QLabel;
class QComboBox;
+class QCheckBox;
class QtxAction;
class QtxDblSpinBox;
class VISU_GaussPtsAct;
class VISU_PickingSettings;
+class SVTK_RenderWindowInteractor;
+
class VVTK_PickingDlg : public QDialog
{
Q_OBJECT
VISU_PickingSettings* GetPickingSettings();
+ void SetInteractor( SVTK_RenderWindowInteractor* );
+
protected slots:
virtual void done( int );
void onClickApply();
void onClickClose();
+private:
+ static void ProcessEvents(vtkObject* theObject,
+ unsigned long theEvent,
+ void* theClientData,
+ void* theCallData);
+
+ void KeyPressed();
+
private:
QtxDblSpinBox* myPyramidHeightSpinBox;
QtxIntSpinBox* myTransparencySpinBox;
QComboBox* myPositionComboBox;
QtxDblSpinBox* myZoomFactorSpinBox;
QtxIntSpinBox* myStepNumberSpinBox;
+ QCheckBox* myDisplayParentMeshCheckBox;
QtxAction* myAction;
vtkSmartPointer<VISU_PickingSettings> myPickingSettings;
+
+ SVTK_RenderWindowInteractor* myInteractor;
+
+ float myPriority;
+ vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
};
#endif