aCamera->SetParallelScale( aScale / theZoomFactor );
}
else {
- //printf( " - +%f", theZoomFactor );
+ //printf( " : -%f", theZoomFactor );
aCamera->SetParallelScale( aScale * theZoomFactor );
}
}
VISU_Actor
::highlight(bool theIsHighlight)
{
- //printf( "VISU_Actor::highlight( %d )\n", (int)theIsHighlight );
VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
- bool aShowTextActor = /*aPickingSettings->GetIsActive() && */aPickingSettings->GetInfoWindowEnabled();
+ bool aShowTextActor = aPickingSettings->GetInfoWindowEnabled();
if( theIsHighlight && mySelectionMode != myLastSelectionMode )
{
if( mySelectionMode == ActorSelection )
SVTK_SelectionEvent* theSelectionEvent,
bool theIsHighlight)
{
- //printf( "VISU_Actor::Highlight( %d )\n", (int)theIsHighlight );
- bool aRet = Superclass::Highlight(theInteractorStyle,
- theSelectionEvent,
- theIsHighlight);
+ return Superclass::Highlight(theInteractorStyle,
+ theSelectionEvent,
+ theIsHighlight);
+}
+
+//-------------------------------------------------------------------------
+void
+VISU_Actor
+::Highlight(bool theIsHighlight)
+{
+ Superclass::Highlight(theIsHighlight);
VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
mySelector->GetIndex( getIO(), aMapIndex );
bool aCurrentHasIndex = aMapIndex.Extent() == 1;
- myIsSubElementsHighlighted = theIsHighlight ? aCurrentHasIndex : false;
+ myIsSubElementsHighlighted = aCurrentHasIndex;
+ bool aFlyTo = false;
vtkFloatingPointType aFlyToCoord[3] = { 0.0, 0.0, 0.0 };
- vtkRenderer* aRenderer = theInteractorStyle->GetCurrentRenderer();
+ vtkRenderer *aRenderer = GetRenderer();
- if(theIsHighlight){
+ if( theIsHighlight )
+ {
vtkDataSet* aDataSet = GetMapper()->GetInput();
- switch(mySelectionMode){
- case ActorSelection:{
- vtkFloatingPointType aCoord[6];
- GetBounds(aCoord);
+ switch(mySelectionMode)
+ {
+ case ActorSelection:
+ {
+ vtkFloatingPointType aCoord[6];
+ GetBounds(aCoord);
- aFlyToCoord[0] = ( aCoord[0] + aCoord[1] ) / 2;
- aFlyToCoord[1] = ( aCoord[2] + aCoord[3] ) / 2;
- aFlyToCoord[2] = ( aCoord[4] + aCoord[5] ) / 2;
+ aFlyTo = true;
+ aFlyToCoord[0] = ( aCoord[0] + aCoord[1] ) / 2;
+ aFlyToCoord[1] = ( aCoord[2] + aCoord[3] ) / 2;
+ aFlyToCoord[2] = ( aCoord[4] + aCoord[5] ) / 2;
- ResetTextActor();
+ ResetTextActor();
- aRet = true;
- break;
- }
- case CellSelection:{
- myCellPicker->Pick(theSelectionEvent->myX,
- theSelectionEvent->myY,
- 0.0,
- aRenderer);
-
- if(myCellPicker->GetActor() != this)
- {
- aRet = false;
break;
}
+ case CellSelection:
+ {
+ if( !aCurrentHasIndex )
+ {
+ myTextActor->SetVisibility(false);
+ break;
+ }
- vtkCellData* aCellData = aDataSet->GetCellData();
-
- vtkIdType aVTKId = myCellPicker->GetCellId();
- if(aVTKId >= 0 && mySelector->IsValid(this,aVTKId,true) && hasIO()){
- vtkIdType anObjId = GetElemObjId(aVTKId);
+ int anObjId = aMapIndex(1);
+ vtkCellData* aCellData = aDataSet->GetCellData();
if(vtkCell* aCell = GetElemCell(anObjId)){
vtkPoints* aPts = aCell->GetPoints();
if(int aNbPts = aCell->GetNumberOfPoints()){
aCoord[2] += aPntCoord[2];
}
+ aFlyTo = true;
aFlyToCoord[0] = aCoord[0] / aNbPts;
aFlyToCoord[1] = aCoord[1] / aNbPts;
aFlyToCoord[2] = aCoord[2] / aNbPts;
vtkCell* aCell = GetElemCell(anObjId);
int aVTKID = GetElemVTKID(anObjId);
- if (aCell) {
- int aNbOfPoints = aCell->GetNumberOfPoints();
- if ( aNbOfPoints > 0 ) {
- aStr << getScalar(aCellData, aVTKID);
- aStr << getVector(aCellData, aVTKID);
+ if (aCell) {
+ int aNbOfPoints = aCell->GetNumberOfPoints();
+ if ( aNbOfPoints > 0 ) {
+ aStr << getScalar(aCellData, aVTKID);
+ aStr << getVector(aCellData, aVTKID);
}
}
std::string aString = aStr.str();
myTextActor->SetText(aString.c_str());
-
- aRet = true;
}
}
- }
- break;
- }
- case NodeSelection:{
- myPointPicker->Pick(theSelectionEvent->myX,
- theSelectionEvent->myY,
- 0.0,
- aRenderer);
-
- if(myPointPicker->GetActor() != this)
- {
- aRet = false;
break;
}
+ case NodeSelection:
+ {
+ if( !aCurrentHasIndex )
+ {
+ myTextActor->SetVisibility(false);
+ break;
+ }
- vtkPointData* aPntData = aDataSet->GetPointData();
-
- vtkIdType aVtkId = myPointPicker->GetPointId();
- if(aVtkId >= 0 && mySelector->IsValid(this,aVtkId,true) && hasIO()){
- vtkIdType anObjId = GetNodeObjId( aVtkId );
+ int anObjId = aMapIndex(1);
+ vtkPointData* aPntData = aDataSet->GetPointData();
if(vtkFloatingPointType* aCoord = GetNodeCoord(anObjId)){
+ aFlyTo = true;
aFlyToCoord[0] = aCoord[0];
aFlyToCoord[1] = aCoord[1];
aFlyToCoord[2] = aCoord[2];
std::string aString = aStr.str();
myTextActor->SetText(aString.c_str());
-
- aRet = true;
}
+ break;
}
- break;
- }
- case EdgeOfCellSelection:
- break;
- default:
- break;
+ case EdgeOfCellSelection:
+ break;
+ default:
+ break;
}
}
}
// FlyTo
- if( GetVisibility() && aPickingSettings->GetCameraMovementEnabled() )
+ if( GetVisibility() && aPickingSettings->GetCameraMovementEnabled() && aFlyTo )
{
vtkRenderWindowInteractor* anInteractor = myInteractor;
vtkFloatingPointType aDollyWas = anInteractor->GetDolly();
anInteractor->SetNumberOfFlyFrames(aNumberOfFlyFramesWas);
anInteractor->InvokeEvent(SVTK::ChangeRotationPoint, aFlyToCoord);
}
-
- return aRet;
-}
-
-//-------------------------------------------------------------------------
-void
-VISU_Actor
-::Highlight(bool theIsHighlight)
-{
- Superclass::Highlight(theIsHighlight);
}
//-------------------------------------------------------------------------
myTextActor->SetModePosition(aPickingSettings->GetInfoWindowPosition());
myTextActor->SetTransparency(aPickingSettings->GetInfoWindowTransparency());
- highlight(isHighlighted());
+ Highlight(isHighlighted());
Update();
}
SVTK_SelectionEvent* theSelectionEvent,
bool theIsHighlight)
{
- //printf( "VISU_GaussPtsAct::Highlight( %d )\n", (int)theIsHighlight );
if ( !GetPickable() )
return false;
anInitialHasIndex,
aCurrentHasIndex);
- if(!theIsHighlight)
- return;
-
if( aSelectionMode == ActorSelection ) {
- Superclass::highlight(theIsHighlight);
+ Superclass::Highlight(theIsHighlight);
return;
}
+ if(!theIsHighlight)
+ return;
+
if( aSelectionMode != GaussPointSelection )
return;
<source>MEN_SELECTION_INFO</source>
<translation>Selection Info...</translation>
</message>
+ <message>
+ <source>MEN_SELECTION_PANEL</source>
+ <translation>Selection Panel</translation>
+ </message>
<message>
<source>MEN_SHADING</source>
<translation>Shading On</translation>
</context>
<context>
<name>VisuGUI_GaussPointsSelectionPane</name>
- <message>
- <source>BELOW_POINT</source>
- <translation>Centered</translation>
- </message>
- <message>
- <source>CAMERA_TITLE</source>
- <translation>Movement of the camera</translation>
- </message>
<message>
<source>CURSOR_SIZE</source>
- <translation>Size of the cursor :</translation>
+ <translation>Size of the cursor:</translation>
</message>
<message>
<source>CURSOR_TITLE</source>
<source>DISPLAY_PARENT_MESH</source>
<translation>Display parent mesh element</translation>
</message>
- <message>
- <source>INFO_WINDOW_TITLE</source>
- <translation>Information window</translation>
- </message>
<message>
<source>PARENT_MESH_TITLE</source>
<translation>Parent mesh element</translation>
</message>
<message>
<source>POINT_TOLERANCE</source>
- <translation>Point tolerance :</translation>
- </message>
- <message>
- <source>POSITION</source>
- <translation>Position :</translation>
+ <translation>Point tolerance:</translation>
</message>
<message>
<source>PYRAMID_HEIGHT</source>
- <translation>Height of the pyramids :</translation>
+ <translation>Height of the pyramids:</translation>
</message>
<message>
<source>SELECTION_COLOR</source>
- <translation>Selection cursor color :</translation>
- </message>
- <message>
- <source>STEP_NUMBER_DSC</source>
- <translation>Number of steps :</translation>
- </message>
- <message>
- <source>STEP_NUMBER_TIP</source>
- <translation>Number of steps between two positions</translation>
+ <translation>Selection cursor color:</translation>
</message>
<message>
<source>TOLERANCE_TITLE</source>
<translation>Tolerance</translation>
</message>
- <message>
- <source>TOP_LEFT_CORNER</source>
- <translation>Top-left corner</translation>
- </message>
- <message>
- <source>TRANSPARENCY</source>
- <translation>Transparency :</translation>
- </message>
- <message>
- <source>ZOOM_FACTOR_DSC</source>
- <translation>Zoom factor :</translation>
- </message>
- <message>
- <source>ZOOM_FACTOR_TIP</source>
- <translation>Zoom at first selected point (ratio)</translation>
- </message>
<message>
<source>DATA_POSITION</source>
<translation>Position</translation>
</message>
<message>
<source>PARENT_ELEMENT</source>
- <translation>Parent mesh element ID:</translation>
+ <translation>Parent ID:</translation>
+ </message>
+ <message>
+ <source>PARENT_ELEMENT_TIP</source>
+ <translation>Parent mesh element ID</translation>
</message>
<message>
<source>LOCAL_POINT</source>
- <translation>Local Gauss Point ID:</translation>
+ <translation>Local ID:</translation>
+ </message>
+ <message>
+ <source>LOCAL_POINT_TIP</source>
+ <translation>Local Gauss Point ID</translation>
</message>
</context>
<context>
<source>VISU_PICKING_PREF_CAMERA_GROUP_TTL</source>
<translation>Movement of the camera</translation>
</message>
+ <message>
+ <source>VISU_PICKING_PREF_CAMERA_MOVEMENT</source>
+ <translation>Enable movement of the camera</translation>
+ </message>
<message>
<source>VISU_PICKING_PREF_CURSOR_GROUP_TTL</source>
<translation>Cursor</translation>
<source>VISU_PICKING_PREF_DISPLAY_PARENT_MESH</source>
<translation>Display parent mesh element</translation>
</message>
+ <message>
+ <source>VISU_PICKING_PREF_INFO_WINDOW</source>
+ <translation>Enable information window</translation>
+ </message>
<message>
<source>VISU_PICKING_PREF_INFO_WINDOW_GROUP_TTL</source>
<translation>Information window</translation>
</message>
<message>
<source>POSITION</source>
- <translation>Position :</translation>
+ <translation>Position:</translation>
</message>
<message>
- <source>STEP_NUMBER_DSC</source>
- <translation>Number of steps :</translation>
+ <source>STEP_NUMBER</source>
+ <translation>Number of steps:</translation>
</message>
<message>
<source>STEP_NUMBER_TIP</source>
</message>
<message>
<source>TRANSPARENCY</source>
- <translation>Transparency :</translation>
+ <translation>Transparency:</translation>
</message>
<message>
- <source>ZOOM_FACTOR_DSC</source>
- <translation>Zoom factor :</translation>
- </message>
- <message>
- <source>ZOOM_FACTOR_TIP</source>
- <translation>Zoom at first selected point (ratio)</translation>
+ <source>ZOOM_FACTOR</source>
+ <translation>Zoom factor:</translation>
</message>
</context>
<context>
createAction( VISU_ERASE_ALL, tr("MEN_ERASE_ALL"), QIcon(aPixmap),
tr("MEN_ERASE_ALL"), "", 0, aParent, false,
this, SLOT(OnEraseAll()));
-
+ /*
aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GLOBAL_SELECTION"));
createAction( VISU_GLOBAL_SELECTION, tr("MEN_GLOBAL_SELECTION"), QIcon(aPixmap),
tr("MEN_GLOBAL_SELECTION"), "", 0, aParent, false,
createAction( VISU_PARTIAL_SELECTION, tr("MEN_PARTIAL_SELECTION"), QIcon(aPixmap),
tr("MEN_PARTIAL_SELECTION"), "", 0, aParent, false,
this);
-
+ */
aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_SELECTION_PANEL"));
createAction( VISU_SELECTION_PANEL, tr("MEN_SELECTION_PANEL"), QIcon(aPixmap),
tr("MEN_SELECTION_PANEL"), "", 0, aParent, false,
createMenu( VISU_WIREFRAME, parentId, 10 ); // wireframe
createMenu( VISU_SURFACE, parentId, 10 ); // surface
createMenu( VISU_ERASE_ALL, aMenuId, 10 ); // erase all
- createMenu( VISU_GLOBAL_SELECTION, aMenuId, 10 ); // global selection
- createMenu( VISU_PARTIAL_SELECTION, aMenuId, 10 ); // partial selection
+ //createMenu( VISU_GLOBAL_SELECTION, aMenuId, 10 ); // global selection
+ //createMenu( VISU_PARTIAL_SELECTION, aMenuId, 10 ); // partial selection
}
void
createTool( VISU_WIREFRAME, aToolId );
createTool( VISU_SURFACE, aToolId );
createTool( VISU_ERASE_ALL, aToolId );
- createTool( VISU_GLOBAL_SELECTION, aToolId );
- createTool( VISU_PARTIAL_SELECTION, aToolId );
+ //createTool( VISU_GLOBAL_SELECTION, aToolId );
+ //createTool( VISU_PARTIAL_SELECTION, aToolId );
aToolId = createTool(tr("TOOL_SELECTION"));
createTool( VISU_SELECTION_PANEL, aToolId );
setMenuShown( true );
setToolShown( true );
- myInputPanel->show();
-
// Reset actions accelerator keys
QList<QKeySequence> shortcuts;
shortcuts.append( QKeySequence(Qt::CTRL + Qt::Key_I) );
PositionGroupLayout->setMargin(11);
QLabel* ParentElementLabel = new QLabel( tr( "PARENT_ELEMENT" ), PositionGroup );
+ ParentElementLabel->setToolTip( tr( "PARENT_ELEMENT_TIP" ) );
myParentElementLineEdit = new VisuGUI_ValidatedLineEdit( PositionGroup );
connect( myParentElementLineEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( onSelectionValidate() ) );
connect( myParentElementLineEdit, SIGNAL( returnPressed() ), this, SLOT( onSelectionApply() ) );
connect(ParentElementBtn, SIGNAL(clicked()), this, SLOT(onSelectionApply()));
QLabel* LocalPointLabel = new QLabel( tr( "LOCAL_POINT" ), PositionGroup );
+ LocalPointLabel->setToolTip( tr( "LOCAL_POINT_TIP" ) );
myLocalPointLineEdit = new VisuGUI_ValidatedLineEdit( PositionGroup );
connect( myLocalPointLineEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( onSelectionValidate() ) );
connect( myLocalPointLineEdit, SIGNAL( returnPressed() ), this, SLOT( onSelectionApply() ) );
if ( myCurrentPanel )
myCurrentPanel->hide();
+ if( isEmpty() )
+ show();
+
if ( !myPanels.contains( thePanel ) )
{
myPanels.insert( thePanel, true );
connect( thePanel, SIGNAL( bpClose() ), this, SLOT( onClosePanel() ) );
}
- if( isEmpty() )
- show();
-
thePanel->show();
myCurrentPanel = thePanel;
myPanels[ thePanel ] = true;
int infoWindowGr = addPreference( tr( "VISU_PICKING_PREF_INFO_WINDOW_GROUP_TTL" ), pickingTab );
setPreferenceProperty( infoWindowGr, "columns", 2 );
+ int infoWindowPref = addPreference( tr( "VISU_PICKING_PREF_INFO_WINDOW" ), infoWindowGr,
+ LightApp_Preferences::Bool, "VISU", "picking_info_window" );
+ setPreferenceProperty( infoWindowPref, "columns", 2 );
+
int transparencyPref = addPreference( tr( "VISU_PICKING_PREF_TRANSPARENCY" ), infoWindowGr,
LightApp_Preferences::IntSpin, "VISU", "picking_transparency" );
setPreferenceProperty( transparencyPref, "min", 0 );
int cameraGr = addPreference( tr( "VISU_PICKING_PREF_CAMERA_GROUP_TTL" ), pickingTab );
setPreferenceProperty( cameraGr, "columns", 2 );
+ int cameraPref = addPreference( tr( "VISU_PICKING_PREF_CAMERA_MOVEMENT" ), cameraGr,
+ LightApp_Preferences::Bool, "VISU", "picking_camera_movement" );
+ setPreferenceProperty( cameraPref, "columns", 2 );
+
int zoomFactorPref = addPreference( tr( "VISU_PICKING_PREF_ZOOM_FACTOR" ), cameraGr,
LightApp_Preferences::DblSpin, "VISU", "picking_zoom_factor" );
setPreferenceProperty( zoomFactorPref, "min", 0.1 );
CameraGroupLayout->setSpacing(6);
CameraGroupLayout->setMargin(11);
- QLabel* ZoomFactorLabel = new QLabel( tr( "ZOOM_FACTOR_DSC" ), myCameraGroup );
- ZoomFactorLabel->setToolTip( tr( "ZOOM_FACTOR_TIP" ) );
+ QLabel* ZoomFactorLabel = new QLabel( tr( "ZOOM_FACTOR" ), myCameraGroup );
myZoomFactorSpinBox = new QtxDoubleSpinBox( 0.1, 10.0, 0.1, myCameraGroup );
myZoomFactorSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
- QLabel* StepNumberLabel = new QLabel( tr( "STEP_NUMBER_DSC" ), myCameraGroup );
+ QLabel* StepNumberLabel = new QLabel( tr( "STEP_NUMBER" ), myCameraGroup );
StepNumberLabel->setToolTip( tr( "STEP_NUMBER_TIP" ) );
myStepNumberSpinBox = new QtxIntSpinBox( 1, 100, 1, myCameraGroup );
myStepNumberSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor();
VISU_Actor* anActor = SVTK::Find<VISU_Actor>(anInteractor->getRenderer()->GetActors(),
SVTK::TIsSameIObject<VISU_Actor>( anIO ));
- //anActor->Highlight( anIO );
+ anActor->Highlight( anIO );
}
return true;