sprite_alpha.bmp \
sprite_texture.bmp \
Vertex_Program_ARB.txt \
+Visu_actor_selection.png \
Visu_add.png \
+Visu_apply.png \
Visu_anim.png \
+Visu_cell_selection.png \
+Visu_close.png \
VISU.config \
Visu_cutlines.png \
Visu_cutplanes.png \
VISU_en.xml \
Visu_eraseall.png \
VISU_fr.xml \
+Visu_gauss_point_selection.png \
Visu_gauss_points.png \
Visu_graduated_axes.png \
+Visu_help.png \
Visu_import_med.png \
Visu_isosurfaces.png \
Visu_load_texture.png \
+Visu_ok.png \
Visu_PlaneSegmentation.png \
Visu_plot2d.png \
Visu_plot3d.png \
+Visu_point_selection.png \
Visu_points.png \
Visu_recording_pause.png \
Visu_recording_play.png \
Visu_scalars.png \
Visu_scaling.png \
Visu_selectall.png \
+Visu_selection_panel.png \
Visu_selectionactor.png \
Visu_selectioncell.png \
Visu_selectionedge.png \
<parameter name="picking_pyramid_height" value="1.0"/>
<parameter name="picking_selection_color" value="255, 255, 0"/>
<parameter name="picking_point_tolerance" value="0.01"/>
+ <parameter name="picking_info_window" value="false" />
<parameter name="picking_transparency" value="50" />
<parameter name="picking_position" value="0" />
+ <parameter name="picking_camera_movement" value="false" />
<parameter name="picking_zoom_factor" value="1.5"/>
<parameter name="picking_step_number" value="10" />
<parameter name="picking_display_parent_mesh" value="false" />
salomeinclude_HEADERS = \
VISU_BoostSignals.h \
VISU_ActorFactory.h \
+ VISU_PickingSettings.h \
VISU_GaussPtsSettings.h \
VISU_GaussPtsActorFactory.h \
VISU_Event.h \
VISU_DataSetActor.cxx \
VISU_MeshAct.cxx \
VISU_ScalarMapAct.cxx \
+ VISU_PickingSettings.cxx \
VISU_GaussPtsDeviceActor.cxx \
VISU_GaussPtsSettings.cxx \
VISU_GaussPtsAct.cxx \
// $Header$
#include "VISU_Actor.h"
+
+#include "VISU_PickingSettings.h"
+#include "VISU_GaussPtsDeviceActor.h"
+
#include "VISU_PipeLine.hxx"
+
+#include "SVTK_Event.h"
+
#include "VTKViewer_ShrinkFilter.h"
#include "VTKViewer_GeometryFilter.h"
#include "SALOME_InteractiveObject.hxx"
#include <vtkGeometryFilter.h>
#include <vtkObjectFactory.h>
+#include <vtkCallbackCommand.h>
+#include <vtkCamera.h>
+#include <vtkRenderWindowInteractor.h>
+
#include <boost/bind.hpp>
#include "utilities.h"
//----------------------------------------------------------------------------
VISU_Actor
::VISU_Actor():
+ myEventCallbackCommand(vtkCallbackCommand::New()),
+ myPriority(0.0),
myIsVTKMapping(false),
myPrs3d(NULL),
myActorFactory(NULL),
myIsShrinkable(false),
myShrinkFilter(VTKViewer_ShrinkFilter::New()),
myAnnotationMapper(vtkTextMapper::New()),
- myAnnotationActor(vtkTextActor::New())
+ myAnnotationActor(vtkTextActor::New()),
+ myTextActor(VISU_FramedTextActor::New()),
+ myLastSelectionMode(ActorSelection),
+ myIsSubElementsHighlighted(false)
{
if(MYDEBUG) MESSAGE("VISU_Actor::VISU_Actor - this = "<<this);
myAnnotationActor->Delete();
myAnnotationActor->SetVisibility(0);
+
+ myTextActor->Delete();
+ myTextActor->SetVisibility(false);
+ myTextActor->SetPickable(false);
+
+ myEventCallbackCommand->Delete();
+ myEventCallbackCommand->SetClientData(this);
+ myEventCallbackCommand->SetCallback(VISU_Actor::ProcessEvents);
+
+ if( VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get() )
+ aPickingSettings->AddObserver(VISU::UpdatePickingSettingsEvent,
+ myEventCallbackCommand.GetPointer(),
+ myPriority);
}
//----------------------------------------------------------------------------
{
Superclass::AddToRender(theRenderer);
theRenderer->AddActor(myAnnotationActor.GetPointer());
+ theRenderer->AddActor(myTextActor.GetPointer());
}
//==================================================================
::RemoveFromRender(vtkRenderer* theRenderer)
{
theRenderer->RemoveActor(myAnnotationActor.GetPointer());
+ theRenderer->RemoveActor(myTextActor.GetPointer());
Superclass::RemoveFromRender(theRenderer);
myDestroySignal(this);
}
//----------------------------------------------------------------------------
bool
VISU_Actor
+::isSubElementsHighlighted()
+{
+ return myIsSubElementsHighlighted;
+}
+
+
+//----------------------------------------------------------------------------
+inline
+void
+ChangeZoom(vtkFloatingPointType theZoomFactor,
+ vtkRenderer* theRenderer,
+ vtkIdType theInitialHasIndex,
+ vtkIdType theCurrentHasIndex)
+{
+ //printf( "VISU_Actor::ChangeZoom( %d, %d )", theInitialHasIndex, theCurrentHasIndex );
+ if(theInitialHasIndex + theCurrentHasIndex == 1){
+ vtkCamera *aCamera = theRenderer->GetActiveCamera();
+
+ double aScale = aCamera->GetParallelScale();
+ if ( !theInitialHasIndex && theCurrentHasIndex ) {
+ //printf( " : +%f", theZoomFactor );
+ aCamera->SetParallelScale( aScale / theZoomFactor );
+ }
+ else {
+ //printf( " - +%f", theZoomFactor );
+ aCamera->SetParallelScale( aScale * theZoomFactor );
+ }
+ }
+ //printf( "\n" );
+}
+
+/*!
+ Updates visibility of the highlight devices
+*/
+void
+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();
+ if( theIsHighlight && mySelectionMode != myLastSelectionMode )
+ {
+ if( mySelectionMode == ActorSelection )
+ ResetTextActor();
+ else
+ aShowTextActor = false;
+ myLastSelectionMode = mySelectionMode;
+ }
+
+ myTextActor->SetVisibility( GetVisibility() && theIsHighlight && aShowTextActor );
+
+ bool anInitialHasIndex = isHighlighted();
+ bool aCurrentHasIndex = theIsHighlight;
+
+ vtkFloatingPointType aZoomFactor = aPickingSettings->GetZoomFactor();
+ if( !theIsHighlight && mySelectionMode == ActorSelection && isSubElementsHighlighted() )
+ {
+ aZoomFactor *= aZoomFactor;
+ myIsSubElementsHighlighted = false;
+ }
+
+ // Zoom
+ if( GetVisibility() && aPickingSettings->GetCameraMovementEnabled() )
+ {
+ ChangeZoom(aZoomFactor,
+ GetRenderer(),
+ anInitialHasIndex,
+ aCurrentHasIndex);
+ }
+
+ Superclass::highlight(theIsHighlight);
+}
+
+/*!
+ To process prehighlight (called from SVTK_InteractorStyle)
+*/
+bool
+VISU_Actor
::PreHighlight(vtkInteractorStyle* theInteractorStyle,
SVTK_SelectionEvent* theSelectionEvent,
bool theIsHighlight)
if(myCellPicker->GetActor() != this)
return false;
-
+
vtkIdType aVTKId = myCellPicker->GetCellId();
if(aVTKId >= 0 && mySelector->IsValid(this,aVTKId,true) && hasIO()){
vtkIdType anObjId = GetElemObjId(aVTKId);
theSelectionEvent->myY,
0.0,
aRenderer);
-
+
if(myPointPicker->GetActor() != this)
return false;
return aRet;
}
+
+//----------------------------------------------------------------------------
+template<class TData> std::string getScalar(TData* theData, int theId)
+{
+ std::ostringstream aStr;
+ if (vtkDataArray *aScalar = theData->GetScalars()){
+ vtkFloatingPointType aVal = aScalar->GetTuple1(theId);
+ aStr << "\nScalar: " << aVal;
+ }
+ return aStr.str();
+}
+
+template<class TData> std::string getVector(TData* theData, int theId)
+{
+ std::ostringstream aStr;
+ if (vtkDataArray *aVector = theData->GetVectors()) {
+ vtkFloatingPointType *aVal = aVector->GetTuple3(theId);
+ aStr << "\nVector: " << "{" << aVal[0] << "; " << aVal[1] << "; " << aVal[2] << "}";
+ }
+ return aStr.str();
+}
+
+/*!
+ To process highlight (called from SVTK_InteractorStyle)
+*/
+bool
+VISU_Actor
+::Highlight(vtkInteractorStyle* theInteractorStyle,
+ SVTK_SelectionEvent* theSelectionEvent,
+ bool theIsHighlight)
+{
+ //printf( "VISU_Actor::Highlight( %d )\n", (int)theIsHighlight );
+ bool aRet = Superclass::Highlight(theInteractorStyle,
+ theSelectionEvent,
+ theIsHighlight);
+
+ VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+
+ bool anInitialHasIndex = isSubElementsHighlighted() && mySelectionMode != ActorSelection;
+
+ TColStd_IndexedMapOfInteger aMapIndex;
+ mySelector->GetIndex( getIO(), aMapIndex );
+ bool aCurrentHasIndex = aMapIndex.Extent() == 1;
+
+ myIsSubElementsHighlighted = theIsHighlight ? aCurrentHasIndex : false;
+
+ vtkFloatingPointType aFlyToCoord[3] = { 0.0, 0.0, 0.0 };
+ vtkRenderer* aRenderer = theInteractorStyle->GetCurrentRenderer();
+
+ if(theIsHighlight){
+ vtkDataSet* aDataSet = GetMapper()->GetInput();
+ 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;
+
+ ResetTextActor();
+
+ aRet = true;
+ break;
+ }
+ case CellSelection:{
+ myCellPicker->Pick(theSelectionEvent->myX,
+ theSelectionEvent->myY,
+ 0.0,
+ aRenderer);
+
+ if(myCellPicker->GetActor() != this)
+ {
+ aRet = false;
+ break;
+ }
+
+ vtkCellData* aCellData = aDataSet->GetCellData();
+
+ vtkIdType aVTKId = myCellPicker->GetCellId();
+ if(aVTKId >= 0 && mySelector->IsValid(this,aVTKId,true) && hasIO()){
+ vtkIdType anObjId = GetElemObjId(aVTKId);
+ if(vtkCell* aCell = GetElemCell(anObjId)){
+ vtkPoints* aPts = aCell->GetPoints();
+ if(int aNbPts = aCell->GetNumberOfPoints()){
+ vtkFloatingPointType aCoord[3] = {0.0, 0.0, 0.0};
+ for(int i = 0; i < aNbPts; i++){
+ vtkFloatingPointType *aPntCoord = aPts->GetPoint(i);
+ aCoord[0] += aPntCoord[0];
+ aCoord[1] += aPntCoord[1];
+ aCoord[2] += aPntCoord[2];
+ }
+
+ aFlyToCoord[0] = aCoord[0] / aNbPts;
+ aFlyToCoord[1] = aCoord[1] / aNbPts;
+ aFlyToCoord[2] = aCoord[2] / aNbPts;
+
+ vtkFloatingPointType aWorldCoord[4] = {aCoord[0]/aNbPts, aCoord[1]/aNbPts, aCoord[2]/aNbPts, 1.0};
+ aRenderer->SetWorldPoint(aWorldCoord);
+ aRenderer->WorldToDisplay();
+ vtkFloatingPointType aSelectionPoint[3];
+ aRenderer->GetDisplayPoint(aSelectionPoint);
+ myTextActor->SetPosition(aSelectionPoint);
+ myTextActor->SetModePosition(aPickingSettings->GetInfoWindowPosition());
+ myTextActor->SetTransparency(aPickingSettings->GetInfoWindowTransparency());
+ myTextActor->SetWorldPoint(aWorldCoord);
+
+ std::ostringstream aStr;
+ aStr << "Cell ID: " << anObjId;
+
+ 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);
+ }
+ }
+
+ 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;
+ }
+
+ vtkPointData* aPntData = aDataSet->GetPointData();
+
+ vtkIdType aVtkId = myPointPicker->GetPointId();
+ if(aVtkId >= 0 && mySelector->IsValid(this,aVtkId,true) && hasIO()){
+ vtkIdType anObjId = GetNodeObjId( aVtkId );
+ if(vtkFloatingPointType* aCoord = GetNodeCoord(anObjId)){
+ aFlyToCoord[0] = aCoord[0];
+ aFlyToCoord[1] = aCoord[1];
+ aFlyToCoord[2] = aCoord[2];
+
+ vtkFloatingPointType aWorldCoord[4] = {aCoord[0], aCoord[1], aCoord[2], 1.0};
+ aRenderer->SetWorldPoint(aWorldCoord);
+ aRenderer->WorldToDisplay();
+ vtkFloatingPointType aSelectionPoint[3];
+ aRenderer->GetDisplayPoint(aSelectionPoint);
+ myTextActor->SetPosition(aSelectionPoint);
+ myTextActor->SetModePosition(aPickingSettings->GetInfoWindowPosition());
+ myTextActor->SetTransparency(aPickingSettings->GetInfoWindowTransparency());
+ myTextActor->SetWorldPoint(aWorldCoord);
+
+ std::ostringstream aStr;
+ aStr << "Point ID: " << anObjId;
+
+ int aVTKID = GetNodeVTKID(anObjId);
+ if(aVTKID >= 0) {
+ aStr << getScalar(aPntData, aVTKID);
+ aStr << getVector(aPntData, aVTKID);
+ }
+
+ const VISU::PIDMapper& aMapper = GetPipeLine()->GetIDMapper();
+ VISU::TIdTypeVector aVec = aMapper->GetIndexesOfNode(anObjId);
+
+ aStr << "\nCoordinates: " << "[";
+ aStr << aCoord[0];
+ if( aVec.size() > 0 )
+ aStr << " (" << aVec[0] << ")";
+ aStr << "; ";
+
+ aStr << aCoord[1];
+ if( aVec.size() > 1 )
+ aStr << " (" << aVec[1] << ")";
+ aStr << "; ";
+
+ aStr << aCoord[2];
+ if( aVec.size() > 2 )
+ aStr << " (" << aVec[2] << ")";
+ aStr << "]";
+
+ std::string aString = aStr.str();
+ myTextActor->SetText(aString.c_str());
+
+ aRet = true;
+ }
+ }
+ break;
+ }
+ case EdgeOfCellSelection:
+ break;
+ default:
+ break;
+ }
+ }
+
+ // Zoom
+ if( GetVisibility() && aPickingSettings->GetCameraMovementEnabled() )
+ {
+ vtkFloatingPointType aZoomFactor = aPickingSettings->GetZoomFactor();
+ ChangeZoom(aZoomFactor,
+ GetRenderer(),
+ anInitialHasIndex,
+ aCurrentHasIndex);
+ }
+
+ // FlyTo
+ if( GetVisibility() && aPickingSettings->GetCameraMovementEnabled() )
+ {
+ vtkRenderWindowInteractor* anInteractor = myInteractor;
+ vtkFloatingPointType aDollyWas = anInteractor->GetDolly();
+ int aNumberOfFlyFramesWas = anInteractor->GetNumberOfFlyFrames();
+
+ anInteractor->SetDolly(0.0);
+ anInteractor->SetNumberOfFlyFrames(aPickingSettings->GetStepNumber());
+ anInteractor->FlyTo(aRenderer, aFlyToCoord);
+ aRenderer->ResetCameraClippingRange();
+ anInteractor->SetDolly(aDollyWas);
+ anInteractor->SetNumberOfFlyFrames(aNumberOfFlyFramesWas);
+ anInteractor->InvokeEvent(SVTK::ChangeRotationPoint, aFlyToCoord);
+ }
+
+ return aRet;
+}
+
+//-------------------------------------------------------------------------
+void
+VISU_Actor
+::Highlight(bool theIsHighlight)
+{
+ Superclass::Highlight(theIsHighlight);
+}
+
+//-------------------------------------------------------------------------
+void
+VISU_Actor
+::ResetTextActor()
+{
+ VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+
+ vtkFloatingPointType aCoord[6];
+ GetBounds(aCoord);
+
+ vtkFloatingPointType aWorldCoord[4] = { ( aCoord[0] + aCoord[1] ) / 2,
+ ( aCoord[2] + aCoord[3] ) / 2,
+ ( aCoord[4] + aCoord[5] ) / 2, 1.0};
+ vtkRenderer* aRenderer = GetRenderer();
+ aRenderer->SetWorldPoint(aWorldCoord);
+ aRenderer->WorldToDisplay();
+ vtkFloatingPointType aSelectionPoint[3];
+ aRenderer->GetDisplayPoint(aSelectionPoint);
+ myTextActor->SetPosition(aSelectionPoint);
+ myTextActor->SetModePosition(aPickingSettings->GetInfoWindowPosition());
+ myTextActor->SetTransparency(aPickingSettings->GetInfoWindowTransparency());
+ myTextActor->SetWorldPoint(aWorldCoord);
+
+ std::ostringstream aStr;
+ /*
+ if( const char* aName = getName() )
+ aStr << aName << "\n";
+ */
+ aStr << "Position: " << "[" << aCoord[0] << "; " << aCoord[2] << "; " << aCoord[4] << "]";
+ aStr << "\nSize: " << "[" <<
+ fabs(aCoord[1]-aCoord[0]) << "; " <<
+ fabs(aCoord[3]-aCoord[2]) << "; " <<
+ fabs(aCoord[5]-aCoord[4]) << "]";
+
+ std::string aString = aStr.str();
+ myTextActor->SetText(aString.c_str());
+}
+
+//-------------------------------------------------------------------------
+void
+VISU_Actor
+::ProcessEvents(vtkObject* vtkNotUsed(theObject),
+ unsigned long theEvent,
+ void* theClientData,
+ void* vtkNotUsed(theCallData))
+{
+ if(vtkObject* anObject = reinterpret_cast<vtkObject*>(theClientData))
+ if(VISU_Actor* self = dynamic_cast<VISU_Actor*>(anObject)) {
+ if(theEvent == VISU::UpdatePickingSettingsEvent)
+ self->UpdatePickingSettings();
+ }
+}
+
+//----------------------------------------------------------------------------
+void
+VISU_Actor
+::UpdatePickingSettings()
+{
+ //printf( "VISU_Actor::UpdatePickingSettings()\n" );
+ VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+ if( !aPickingSettings )
+ return;
+
+ myTextActor->SetModePosition(aPickingSettings->GetInfoWindowPosition());
+ myTextActor->SetTransparency(aPickingSettings->GetInfoWindowTransparency());
+
+ highlight(isHighlighted());
+
+ Update();
+}
class vtkTextMapper;
class vtkTextActor;
class vtkInteractorStyle;
+class vtkCallbackCommand;
class VTKViewer_ShrinkFilter;
class VISU_PipeLine;
+class VISU_FramedTextActor;
+
#ifdef _WIN32
#define VTKOCC_EXPORT __declspec (dllexport)
#else
RemoveFromRender( vtkRenderer* );
//----------------------------------------------------------------------------
+ //! Just to update visibility of the highlight devices
+ virtual
+ void
+ highlight(bool theHighlight);
+
+ //! To process prehighlight (called from #SVTK_InteractorStyle)
virtual
bool
PreHighlight(vtkInteractorStyle* theInteractorStyle,
SVTK_SelectionEvent* theSelectionEvent,
bool theIsHighlight);
+ //! To process highlight (called from #SVTK_InteractorStyle)
+ virtual
+ bool
+ Highlight(vtkInteractorStyle* theInteractorStyle,
+ SVTK_SelectionEvent* theSelectionEvent,
+ bool theIsHighlight);
+
+ //! Internal highlight.
+ virtual
+ void
+ Highlight(bool theIsHighlight);
+
virtual
void
SetVTKMapping(bool theIsVTKMapping);
vtkCell*
GetElemCell(vtkIdType theObjID);
+ //----------------------------------------------------------------------------
+ //! Apply the picking settings on the actor.
+ void
+ UpdatePickingSettings();
+
//----------------------------------------------------------------------------
protected:
VISU_Actor();
GetCurrentPL();
//----------------------------------------------------------------------------
+ bool
+ isSubElementsHighlighted();
+
+ //----------------------------------------------------------------------------
+ vtkSmartPointer<vtkCallbackCommand> myEventCallbackCommand;
+
+ //! Main process VTK event method
+ static
+ void
+ ProcessEvents(vtkObject* theObject,
+ unsigned long theEvent,
+ void* theClientData,
+ void* theCallData);
+
+ //----------------------------------------------------------------------------
+ private:
+ void
+ ResetTextActor();
+
+ //----------------------------------------------------------------------------
+ protected:
+ vtkFloatingPointType myPriority;
bool myIsVTKMapping;
VISU::Prs3d_i* myPrs3d;
vtkSmartPointer<VISU_PipeLine> myPipeLine;
vtkSmartPointer<vtkTextMapper> myAnnotationMapper;
vtkSmartPointer<vtkTextActor> myAnnotationActor;
+
+ vtkSmartPointer<VISU_FramedTextActor> myTextActor;
+
+ Selection_Mode myLastSelectionMode;
+ bool myIsSubElementsHighlighted;
};
#endif //VISU_ACTOR_H
#include "VISU_GaussPointsPL.hxx"
#include "VISU_GaussPtsSettings.h"
#include "VISU_GaussPtsDeviceActor.h"
+#include "VISU_PickingSettings.h"
#include "VISU_WidgetCtrl.hxx"
#include "VISU_SphereWidget.hxx"
#include "VISU_OpenGLPointSpriteMapper.hxx"
myWidgetCtrl(NULL),
myGaussPointsPL(NULL),
myLastPreHighlightObjID(-1),
- myTextActor(VISU_FramedTextActor::New()),
myCursorPyramid(VISU_CursorPyramid::New()),
myCursorPyramidSelected(VISU_CursorPyramid::New()),
myCellSource(vtkUnstructuredGrid::New()),
myCellActor(SVTK_Actor::New()),
myScalarBarCtrl(VISU_ScalarBarCtrl::New()),
myBarVisibility(true),
- myPickingSettings(NULL),
myInsideCursorSettings(NULL),
myCurrentPL(NULL),
myMapper(vtkPolyDataMapper::New())
myEventCallbackCommand->Delete();
myDeviceActor->Delete();
- myTextActor->Delete();
myCursorPyramid->Delete();
myCursorPyramid->SetPickable(0);
myDeviceActor->SetVisibility(true);
myDeviceActor->SetPickable(false);
- myTextActor->SetVisibility(false);
- myTextActor->SetPickable(false);
-
myCellSource->Allocate();
myCellActor->Initialize();
myCellActor->SetRepresentation(VTK_WIREFRAME);
myScalarBarCtrl->Delete();
myMapper->Delete();
+
+ if( VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get() )
+ aPickingSettings->AddObserver(VISU::UpdatePickingSettingsEvent,
+ myEventCallbackCommand.GetPointer(),
+ myPriority);
}
VISU_GaussPtsAct
if(MYDEBUG) MESSAGE("VISU_GaussPtsAct::~VISU_GaussPtsAct - this = "<<this);
SetWidgetCtrl(NULL);
SetInteractor(NULL);
- SetPickingSettings(NULL);
SetInsideCursorSettings(NULL);
}
myDeviceActor->AddToRender(theRenderer);
- theRenderer->AddActor(myTextActor.GetPointer());
theRenderer->AddActor(myCellActor.GetPointer());
myCursorPyramid->AddToRender(theRenderer);
myCursorPyramidSelected->AddToRender(theRenderer);
myScalarBarCtrl->AddToRender(theRenderer);
-
- SetPickingSettings( VISU_PickingSettings::Get() );
}
void
myDeviceActor->RemoveFromRender(theRenderer);
- theRenderer->RemoveActor(myTextActor.GetPointer());
theRenderer->RemoveActor(myCellActor.GetPointer());
myCursorPyramid->RemoveFromRender(theRenderer);
bool anIsChanged = (mySelectionMode != aSelectionMode);
bool anIsPreselected = myIsPreselected;
myIsPreselected = false;
+
+ VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
if(aSelectionMode == GaussPointSelection && theIsHighlight){
myPointPicker->Pick(theSelectionEvent->myX,
vtkDataSet* aDataSet = GetInput();
vtkPointData* aPointData = aDataSet->GetPointData();
if(vtkDataArray *aScalarArray = aPointData->GetScalars()){
- vtkFloatingPointType aPyramidHeight = myPickingSettings->GetPyramidHeight();
+ vtkFloatingPointType aPyramidHeight = aPickingSettings->GetPyramidHeight();
aPyramidHeight = aPyramidHeight*myGaussPointsPL->GetMaxPointSize();
//vtkFloatingPointType aColor[3] = myPreHighlightActor->GetProperty()->GetColor();
vtkFloatingPointType aColor[3];
aColor[2] = 1. - aColor[2];
myCursorPyramid->Init(aPyramidHeight,
- myPickingSettings->GetCursorSize(),
+ aPickingSettings->GetCursorSize(),
GetRadius(anObjId,aVtkId,aScalarArray),
GetMagnification(anObjId),
GetClamp(anObjId),
SVTK_SelectionEvent* theSelectionEvent,
bool theIsHighlight)
{
+ //printf( "VISU_GaussPtsAct::Highlight( %d )\n", (int)theIsHighlight );
if ( !GetPickable() )
return false;
- // int anInitialHasIndex = myIsHighlighted && mySelectionMode == GaussPointSelection;
+ // int anInitialHasIndex = myIsSubElementsHighlighted && mySelectionMode == GaussPointSelection;
Handle(SALOME_InteractiveObject) anIO = getIO();
- // myIsHighlighted = false;
+ // myIsSubElementsHighlighted = false;
Selection_Mode aSelectionMode = theSelectionEvent->mySelectionMode;
Selection_Mode aSelectionMode = mySelector->SelectionMode();
- bool anInitialHasIndex = isHighlighted() && mySelectionMode == GaussPointSelection;
+ bool anInitialHasIndex = isSubElementsHighlighted() && mySelectionMode == GaussPointSelection;
TColStd_IndexedMapOfInteger aMapIndex;
mySelector->GetIndex( getIO(), aMapIndex );
myCursorPyramidSelected->SetVisibility(anIsVisible);
//GetScalarBarCtrl()->Update();
- myIsHighlighted = aCurrentHasIndex;
+ myIsSubElementsHighlighted = aCurrentHasIndex;
+
+ VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
// Zoom if necessary
- ChangeZoom(myPickingSettings,
+ ChangeZoom(aPickingSettings,
GetRenderer(),
anInitialHasIndex,
aCurrentHasIndex);
int aNumberOfFlyFramesWas = anInteractor->GetNumberOfFlyFrames();
anInteractor->SetDolly(0.0);
- anInteractor->SetNumberOfFlyFrames(myPickingSettings->GetStepNumber());
+ anInteractor->SetNumberOfFlyFrames(aPickingSettings->GetStepNumber());
anInteractor->FlyTo(aRenderer, aNodeCoord);
aRenderer->ResetCameraClippingRange();
anInteractor->SetDolly(aDollyWas);
GetScalarBarCtrl()->SetMarkValue(aVal);
GetScalarBarCtrl()->Update();
//
- vtkFloatingPointType aPyramidHeight = myPickingSettings->GetPyramidHeight();
+ vtkFloatingPointType aPyramidHeight = aPickingSettings->GetPyramidHeight();
aPyramidHeight = aPyramidHeight*myGaussPointsPL->GetMaxPointSize();
myCursorPyramidSelected->Init(aPyramidHeight,
- myPickingSettings->GetCursorSize(),
+ aPickingSettings->GetCursorSize(),
GetRadius(anObjId,aVtkId,aScalarArray),
GetMagnification(anObjId),
GetClamp(anObjId),
//
// myTextActor
std::string aString = aStr.str();
- myTextActor->SetModePosition(myPickingSettings->GetInfoWindowPosition());
- myTextActor->SetTransparency(myPickingSettings->GetInfoWindowTransparency());
+ myTextActor->SetModePosition(aPickingSettings->GetInfoWindowPosition());
+ myTextActor->SetTransparency(aPickingSettings->GetInfoWindowTransparency());
myTextActor->SetWorldPoint(aWorldCoord);
myTextActor->SetText(aString.c_str());
myTextActor->SetVisibility(anIsVisible && theIsHighlight);
//
// myCellActor
- if(myPickingSettings->GetDisplayParentMesh()){
+ if(aPickingSettings->GetDisplayParentMesh()){
const VISU::PGaussPtsIDMapper& aGaussPtsIDMapper =
myGaussPointsPL->GetGaussPtsIDMapper();
VISU::TNamedIDMapper* aParent = aGaussPtsIDMapper->GetParent();
}
}
-
-//----------------------------------------------------------------
-void
-VISU_GaussPtsAct
-::SetPickingSettings(VISU_PickingSettings* thePickingSettings)
-{
- if(myPickingSettings == thePickingSettings)
- return;
-
- if(myPickingSettings)
- myPickingSettings->RemoveObserver(myEventCallbackCommand.GetPointer());
-
- myPickingSettings = thePickingSettings;
-
- if(thePickingSettings)
- {
- thePickingSettings->AddObserver(VISU::UpdatePickingSettingsEvent,
- myEventCallbackCommand.GetPointer(),
- myPriority);
- this->UpdatePickingSettings();
- }
-}
-
void
VISU_GaussPtsAct
::UpdatePickingSettings()
{
- if(!myPickingSettings || myPickingSettings->GetInitial())
+ //printf( "VISU_GaussPtsAct::UpdatePickingSettings()\n" );
+ VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+ if(!aPickingSettings)
return;
- myTextActor->SetModePosition(myPickingSettings->GetInfoWindowPosition());
- myTextActor->SetTransparency(myPickingSettings->GetInfoWindowTransparency());
+ myTextActor->SetModePosition(aPickingSettings->GetInfoWindowPosition());
+ myTextActor->SetTransparency(aPickingSettings->GetInfoWindowTransparency());
- vtkFloatingPointType aHeight = myGaussPointsPL->GetMaxPointSize()*myPickingSettings->GetPyramidHeight();
- vtkFloatingPointType aCursorSize = myPickingSettings->GetCursorSize();
+ vtkFloatingPointType aHeight = myGaussPointsPL->GetMaxPointSize()*aPickingSettings->GetPyramidHeight();
+ vtkFloatingPointType aCursorSize = aPickingSettings->GetCursorSize();
myCursorPyramid->SetPreferences(aHeight,aCursorSize);
myCursorPyramidSelected->SetPreferences(aHeight,aCursorSize);
- myHighlightActor->GetProperty()->SetColor( myPickingSettings->GetColor() );
- myPointPicker->SetTolerance( myPickingSettings->GetPointTolerance() );
+ myHighlightActor->GetProperty()->SetColor( aPickingSettings->GetColor() );
+ myPointPicker->SetTolerance( aPickingSettings->GetPointTolerance() );
Highlight(isHighlighted());
class vtkCallbackCommand;
class VISU_ScalarBarCtrl;
-class VISU_PickingSettings;
class VISU_InsideCursorSettings;
class VISU_OutsideCursorSettings;
UpdateInsideCursorSettings( PDeviceActor );
//----------------------------------------------------------------------------
- void
- SetPickingSettings(VISU_PickingSettings* thePickingSettings);
-
//! Apply the picking settings on the actor.
void
UpdatePickingSettings();
vtkIdType myLastPreHighlightObjID;
- vtkSmartPointer<VISU_FramedTextActor> myTextActor;
-
vtkSmartPointer<VISU_CursorPyramid> myCursorPyramid;
vtkSmartPointer<VISU_CursorPyramid> myCursorPyramidSelected;
vtkSmartPointer<VISU_ScalarBarCtrl> myScalarBarCtrl;
VISU_InsideCursorSettings* myInsideCursorSettings;
- VISU_PickingSettings* myPickingSettings;
};
myTextProperty->SetFontFamilyToArial();
//
myTextMapper=vtkTextMapper::New();
- myTextMapper->SetInput("some text");
+ myTextMapper->SetInput("");
myTextMapper->GetTextProperty()->ShallowCopy(myTextProperty);
myTextActor=vtkActor2D::New();
myTextActor->SetMapper(myTextMapper);
#include "VISU_GaussPtsSettings.h"
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Session.h"
+
#include <vtkObjectFactory.h>
#include <vtkImageData.h>
vtkStandardNewMacro( VISU_GaussPtsSettings );
vtkStandardNewMacro( VISU_InsideCursorSettings );
vtkStandardNewMacro( VISU_OutsideCursorSettings );
-vtkStandardNewMacro( VISU_PickingSettings );
//----------------------------------------------------------------
VISU_GaussPtsSettings::VISU_GaussPtsSettings()
VISU_OutsideCursorSettings::~VISU_OutsideCursorSettings()
{
}
-
-//----------------------------------------------------------------
-VISU_PickingSettings* VISU_PickingSettings::Get()
-{
- static VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::New();
- return aPickingSettings;
-}
-
-VISU_PickingSettings::VISU_PickingSettings()
-{
- this->Initial = true;
-
- this->PyramidHeight = -1;
- this->CursorSize = -1;
- this->PointTolerance = -1;
- this->Color[0] = -1;
- this->Color[1] = -1;
- this->Color[2] = -1;
- this->InfoWindowTransparency = -1;
- this->InfoWindowPosition = -1;
- this->ZoomFactor = -1;
- this->StepNumber = -1;
- this->DisplayParentMesh = false;
-}
-
-VISU_PickingSettings::~VISU_PickingSettings()
-{
-}
const vtkIdType UpdateFromSettingsEvent = vtkCommand::UserEvent + 100;
const vtkIdType UpdateInsideSettingsEvent = vtkCommand::UserEvent + 101;
const vtkIdType UpdateOutsideSettingsEvent = vtkCommand::UserEvent + 102;
- const vtkIdType UpdatePickingSettingsEvent = vtkCommand::UserEvent + 103;
}
vtkFloatingPointType Color[3];
};
-
-//! Class of Picking settings.
-/*!
- * Contains information about the following parameters:
- * Cursor Pyramid height, Info Window transparency,
- * Info Window position, Zoom factor on first selected point,
- * Camera movement steps number and Display parent mesh.
- * Used by Gauss Points Actor.
- */
-class VTKOCC_EXPORT VISU_PickingSettings : public vtkObject
-{
- public:
- enum { BelowPoint = 0, TopLeftCorner };
-
- public:
- vtkTypeMacro( VISU_PickingSettings, vtkObject );
-
- static
- VISU_PickingSettings*
- Get();
-
- static
- VISU_PickingSettings*
- New();
-
- vtkSetMacro( Initial, bool );
- vtkGetMacro( Initial, bool );
-
- vtkSetMacro( PyramidHeight, vtkFloatingPointType );
- vtkGetMacro( PyramidHeight, vtkFloatingPointType );
-
- vtkSetMacro( CursorSize, vtkFloatingPointType );
- vtkGetMacro( CursorSize, vtkFloatingPointType );
-
- vtkSetVector3Macro( Color, vtkFloatingPointType );
- vtkGetVector3Macro( Color, vtkFloatingPointType );
-
- vtkSetMacro( PointTolerance, vtkFloatingPointType );
- vtkGetMacro( PointTolerance, vtkFloatingPointType );
-
- vtkSetMacro( InfoWindowTransparency, vtkFloatingPointType );
- vtkGetMacro( InfoWindowTransparency, vtkFloatingPointType );
-
- vtkSetMacro( InfoWindowPosition, int );
- vtkGetMacro( InfoWindowPosition, int );
-
- vtkSetMacro( ZoomFactor, vtkFloatingPointType );
- vtkGetMacro( ZoomFactor, vtkFloatingPointType );
-
- vtkSetMacro( StepNumber, int );
- vtkGetMacro( StepNumber, int );
-
- vtkSetMacro( DisplayParentMesh, bool );
- vtkGetMacro( DisplayParentMesh, bool );
-
-private:
- VISU_PickingSettings();
- virtual ~VISU_PickingSettings();
-
-private:
- bool Initial;
-
- vtkFloatingPointType PyramidHeight;
- vtkFloatingPointType CursorSize;
- vtkFloatingPointType PointTolerance;
- vtkFloatingPointType Color[3];
- vtkFloatingPointType InfoWindowTransparency;
- int InfoWindowPosition;
- vtkFloatingPointType ZoomFactor;
- int StepNumber;
- bool DisplayParentMesh;
-};
-
-
#endif
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File : VISU_PickingSettings.cxx
+// Author : Oleg UVAROV
+// Module : VISU
+
+#include "VISU_PickingSettings.h"
+
+#include "SUIT_ResourceMgr.h"
+#include "SUIT_Session.h"
+
+#include <vtkObjectFactory.h>
+
+vtkStandardNewMacro( VISU_PickingSettings );
+
+VISU_PickingSettings* VISU_PickingSettings::Get()
+{
+ static VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::New();
+
+ if( aPickingSettings->GetIsInitial() )
+ {
+ SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
+
+ aPickingSettings->SetCursorSize( aResourceMgr->doubleValue( "VISU", "picking_cursor_size", 0.5 ) );
+ aPickingSettings->SetPyramidHeight( aResourceMgr->doubleValue( "VISU", "picking_pyramid_height", 10.0 ) );
+ aPickingSettings->SetPointTolerance( aResourceMgr->doubleValue( "VISU", "picking_point_tolerance", 0.1 ) );
+ aPickingSettings->SetInfoWindowEnabled( aResourceMgr->booleanValue( "VISU", "picking_info_window", false ) );
+ aPickingSettings->SetInfoWindowTransparency( aResourceMgr->integerValue( "VISU", "picking_transparency", 50 ) / 100.0 );
+ aPickingSettings->SetInfoWindowPosition( aResourceMgr->integerValue( "VISU", "picking_position", VISU_PickingSettings::BelowPoint ) );
+ aPickingSettings->SetCameraMovementEnabled( aResourceMgr->booleanValue( "VISU", "picking_camera_movement", false ) );
+ aPickingSettings->SetZoomFactor( aResourceMgr->doubleValue( "VISU", "picking_zoom_factor", 1.5 ) );
+ aPickingSettings->SetStepNumber( aResourceMgr->integerValue( "VISU", "picking_step_number", 10 ) );
+ aPickingSettings->SetDisplayParentMesh( aResourceMgr->booleanValue( "VISU", "picking_display_parent_mesh", false ) );
+
+ QColor aSelectionColor = aResourceMgr->colorValue( "VISU", "picking_selection_color", Qt::yellow );
+ vtkFloatingPointType aColor[3];
+ aColor[0] = aSelectionColor.red() / 255.0;
+ aColor[1] = aSelectionColor.green() / 255.0;
+ aColor[2] = aSelectionColor.blue() / 255.0;
+ aPickingSettings->SetColor( aColor );
+
+ aPickingSettings->SetIsInitial( false );
+ }
+
+ return aPickingSettings;
+}
+
+VISU_PickingSettings::VISU_PickingSettings()
+{
+ this->IsInitial = true;
+
+ this->PyramidHeight = -1;
+ this->CursorSize = -1;
+ this->PointTolerance = -1;
+ this->Color[0] = -1;
+ this->Color[1] = -1;
+ this->Color[2] = -1;
+ this->InfoWindowEnabled = false;
+ this->InfoWindowTransparency = -1;
+ this->InfoWindowPosition = -1;
+ this->CameraMovementEnabled = false;
+ this->ZoomFactor = -1;
+ this->StepNumber = -1;
+ this->DisplayParentMesh = false;
+}
+
+VISU_PickingSettings::~VISU_PickingSettings()
+{
+}
--- /dev/null
+// VISU OBJECT : interactive object for VISU entities implementation
+//
+// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+//
+//
+// File : VISU_PickingSettings.cxx
+// Author : Oleg UVAROV
+// Module : VISU
+
+#ifndef VISU_PickingSettings_HeaderFile
+#define VISU_PickingSettings_HeaderFile
+
+#include <vtkObject.h>
+#include <vtkCommand.h>
+
+#include "VTKViewer.h"
+
+#include "VISU_Actor.h"
+
+//============================================================================
+namespace VISU
+{
+ const vtkIdType UpdatePickingSettingsEvent = vtkCommand::UserEvent + 103;
+}
+
+//! Class of Picking settings.
+/*!
+ * Contains information about the following parameters:
+ * Cursor Pyramid height, Info Window transparency,
+ * Info Window position, Zoom factor on first selected point,
+ * Camera movement steps number and Display parent mesh.
+ */
+class VTKOCC_EXPORT VISU_PickingSettings : public vtkObject
+{
+ public:
+ enum { BelowPoint = 0, TopLeftCorner };
+
+ public:
+ vtkTypeMacro( VISU_PickingSettings, vtkObject );
+
+ static
+ VISU_PickingSettings*
+ Get();
+
+ static
+ VISU_PickingSettings*
+ New();
+
+ vtkSetMacro( IsInitial, bool );
+ vtkGetMacro( IsInitial, bool );
+
+ vtkSetMacro( PyramidHeight, vtkFloatingPointType );
+ vtkGetMacro( PyramidHeight, vtkFloatingPointType );
+
+ vtkSetMacro( CursorSize, vtkFloatingPointType );
+ vtkGetMacro( CursorSize, vtkFloatingPointType );
+
+ vtkSetVector3Macro( Color, vtkFloatingPointType );
+ vtkGetVector3Macro( Color, vtkFloatingPointType );
+
+ vtkSetMacro( PointTolerance, vtkFloatingPointType );
+ vtkGetMacro( PointTolerance, vtkFloatingPointType );
+
+ vtkSetMacro( InfoWindowEnabled, bool );
+ vtkGetMacro( InfoWindowEnabled, bool );
+
+ vtkSetMacro( InfoWindowTransparency, vtkFloatingPointType );
+ vtkGetMacro( InfoWindowTransparency, vtkFloatingPointType );
+
+ vtkSetMacro( InfoWindowPosition, int );
+ vtkGetMacro( InfoWindowPosition, int );
+
+ vtkSetMacro( CameraMovementEnabled, bool );
+ vtkGetMacro( CameraMovementEnabled, bool );
+
+ vtkSetMacro( ZoomFactor, vtkFloatingPointType );
+ vtkGetMacro( ZoomFactor, vtkFloatingPointType );
+
+ vtkSetMacro( StepNumber, int );
+ vtkGetMacro( StepNumber, int );
+
+ vtkSetMacro( DisplayParentMesh, bool );
+ vtkGetMacro( DisplayParentMesh, bool );
+
+private:
+ VISU_PickingSettings();
+ virtual ~VISU_PickingSettings();
+
+private:
+ bool IsInitial;
+
+ vtkFloatingPointType PyramidHeight;
+ vtkFloatingPointType CursorSize;
+
+ vtkFloatingPointType PointTolerance;
+
+ vtkFloatingPointType Color[3];
+
+ bool InfoWindowEnabled;
+ vtkFloatingPointType InfoWindowTransparency;
+ int InfoWindowPosition;
+
+ bool CameraMovementEnabled;
+ vtkFloatingPointType ZoomFactor;
+ int StepNumber;
+
+ bool DisplayParentMesh;
+};
+
+#endif
<TS version="1.1" >
<context>
<name>@default</name>
+ <message>
+ <source>ICON_ACTOR_SELECTION</source>
+ <translation>Visu_actor_selection.png</translation>
+ </message>
<message>
<source>ICON_ADD</source>
<translation>Visu_add.png</translation>
</message>
+ <message>
+ <source>ICON_APPLY</source>
+ <translation>Visu_apply.png</translation>
+ </message>
+ <message>
+ <source>ICON_CELL_SELECTION</source>
+ <translation>Visu_cell_selection.png</translation>
+ </message>
+ <message>
+ <source>ICON_CLOSE</source>
+ <translation>Visu_close.png</translation>
+ </message>
<message>
<source>ICON_CUBE_AXES</source>
<translation>Visu_graduated_axes.png</translation>
<source>ICON_GAUSS_NEW_VIEWER</source>
<translation>Visu_points.png</translation>
</message>
+ <message>
+ <source>ICON_GAUSS_POINT_SELECTION</source>
+ <translation>Visu_gauss_point_selection.png</translation>
+ </message>
<message>
<source>ICON_GAUSS_POINTS</source>
<translation>Visu_gauss_points.png</translation>
<source>ICON_GLOBAL_SELECTION</source>
<translation>Visu_selectall.png</translation>
</message>
+ <message>
+ <source>ICON_HELP</source>
+ <translation>Visu_help.png</translation>
+ </message>
<message>
<source>ICON_HOLO_RENDER</source>
<translation>Visu_holo_render.png</translation>
<source>ICON_OBJBROWSER_Visu</source>
<translation>Visu_tree_visu.png</translation>
</message>
+ <message>
+ <source>ICON_OK</source>
+ <translation>Visu_ok.png</translation>
+ </message>
<message>
<source>ICON_PARTIAL_SELECTION</source>
<translation>Visu_selectonly.png</translation>
<source>ICON_PLOT_3D</source>
<translation>Visu_plot3d.png</translation>
</message>
+ <message>
+ <source>ICON_POINT_SELECTION</source>
+ <translation>Visu_point_selection.png</translation>
+ </message>
<message>
<source>ICON_POINTS</source>
<translation>Visu_points.png</translation>
<source>ICON_SCALING</source>
<translation>Visu_scaling.png</translation>
</message>
+ <message>
+ <source>ICON_SELECTION_PANEL</source>
+ <translation>Visu_selection_panel.png</translation>
+ </message>
<message>
<source>ICON_SLIDER_AVI</source>
<translation>Visu_slider_avi.png</translation>
<source>IMPORT_FROM_FILE</source>
<translation>Import from File</translation>
</message>
+ <message>
+ <source>MEN_ACTOR_SELECTION</source>
+ <translation>Actor Selection</translation>
+ </message>
<message>
<source>MEN_ARRANGE_ACTORS</source>
<translation>Arrange Actors</translation>
<source>MEN_CELL_COLOR</source>
<translation>Cell color</translation>
</message>
+ <message>
+ <source>MEN_CELL_SELECTION</source>
+ <translation>Cell Selection</translation>
+ </message>
<message>
<source>MEN_CLEAR_CONTAINER</source>
<translation>Clear</translation>
<source>MEN_FREE_SCALAR_BARS</source>
<translation>Use Field Range</translation>
</message>
+ <message>
+ <source>MEN_GAUSS_POINT_SELECTION</source>
+ <translation>Gauss Point Selection</translation>
+ </message>
<message>
<source>MEN_GLOBAL_SELECTION</source>
<translation>Global Selection</translation>
<source>MEN_PLOT_3D</source>
<translation>Plot3D</translation>
</message>
+ <message>
+ <source>MEN_POINT_SELECTION</source>
+ <translation>Point Selection</translation>
+ </message>
<message>
<source>MEN_POINTS</source>
<translation>Points</translation>
<source>TOOL_REPRESENTATION</source>
<translation>Representation Toolbar</translation>
</message>
+ <message>
+ <source>TOOL_SELECTION</source>
+ <translation>Selection Toolbar</translation>
+ </message>
<message>
<source>TOOL_VISUALISATION</source>
<translation>Visualization Toolbar</translation>
<name>VisuGUI_GaussPointsSelectionPane</name>
<message>
<source>BELOW_POINT</source>
- <translation>Centered below the point</translation>
+ <translation>Centered</translation>
</message>
<message>
<source>CAMERA_TITLE</source>
<translation>Selection cursor color :</translation>
</message>
<message>
- <source>STEP_NUMBER</source>
- <translation>Number of steps between two positions :</translation>
+ <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>
</message>
<message>
<source>TOLERANCE_TITLE</source>
</message>
<message>
<source>TOP_LEFT_CORNER</source>
- <translation>Top-left corner of the 3D view</translation>
+ <translation>Top-left corner</translation>
</message>
<message>
<source>TRANSPARENCY</source>
<translation>Transparency :</translation>
</message>
<message>
- <source>ZOOM_FACTOR</source>
- <translation>Zoom at first selected point (ratio) :</translation>
+ <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>
<name>VisuGUI_SelectionPanel</name>
<message>
<source>WINDOW_TITLE</source>
- <translation>Data on elements</translation>
+ <translation>Selection info</translation>
</message>
<message>
<source>MODE_TITLE</source>
<source>ACTOR_DATA_SIZE_TITLE</source>
<translation>Size</translation>
</message>
+ <message>
+ <source>BELOW_POINT</source>
+ <translation>Centered</translation>
+ </message>
+ <message>
+ <source>CAMERA_TITLE</source>
+ <translation>Movement of the camera</translation>
+ </message>
+ <message>
+ <source>INFO_WINDOW_TITLE</source>
+ <translation>Information window</translation>
+ </message>
+ <message>
+ <source>POSITION</source>
+ <translation>Position :</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>
+ </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>
</context>
<context>
<name>VisuGUI_BarPrefDlg</name>
{
if (GetActiveViewWindow<SVTK_ViewWindow>(this))
{
- if( !mySelectionPanel )
- mySelectionPanel = new VisuGUI_SelectionPanel( this );
inputPanel()->showPanel( mySelectionPanel );
}
else
tr("ERR_ACTIVATE_VIEW3D") );
}
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnToggleSelectionPanel()
+{
+ if (GetActiveViewWindow<SVTK_ViewWindow>(this))
+ {
+ VisuGUI_SelectionPanel* aSelectionPanel = selectionPanel();
+ VisuGUI_InputPanel* anInputPanel = inputPanel();
+ if( !anInputPanel->isShown( aSelectionPanel ) )
+ anInputPanel->showPanel( aSelectionPanel );
+ else
+ anInputPanel->hidePanel( aSelectionPanel );
+ }
+ else
+ SUIT_MessageBox::warning(GetDesktop(this),
+ tr("WRN_VISU"),
+ tr("ERR_ACTIVATE_VIEW3D") );
+}
+
+//----------------------------------------------------------------------------
+void
+VisuGUI
+::OnSwitchSelectionMode()
+{
+ QAction* anAction = dynamic_cast<QAction*>( sender() );
+ if( !anAction )
+ return;
+
+ for( int anId = VISU_ACTOR_SELECTION; anId <= VISU_GAUSS_POINT_SELECTION; anId++ )
+ {
+ QAction* aRefAction = action( anId );
+ if( anAction != aRefAction )
+ aRefAction->setChecked( false );
+ else
+ mySelectionPanel->setSelectionMode( anId - VISU_ACTOR_SELECTION );
+ }
+}
+
//----------------------------------------------------------------------------
void
VisuGUI
createMenus();
createToolBars();
createPopupMenus();
+
createInputPanel();
+ createSelectionPanel();
+
+ // tmp
+ action( VISU_ACTOR_SELECTION )->setChecked( true );
}
void
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,
+ this, SLOT(OnToggleSelectionPanel()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_ACTOR_SELECTION"));
+ createAction( VISU_ACTOR_SELECTION, tr("MEN_ACTOR_SELECTION"), QIcon(aPixmap),
+ tr("MEN_ACTOR_SELECTION"), "", 0, aParent, true,
+ this, SLOT(OnSwitchSelectionMode()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_CELL_SELECTION"));
+ createAction( VISU_CELL_SELECTION, tr("MEN_CELL_SELECTION"), QIcon(aPixmap),
+ tr("MEN_CELL_SELECTION"), "", 0, aParent, true,
+ this, SLOT(OnSwitchSelectionMode()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_POINT_SELECTION"));
+ createAction( VISU_POINT_SELECTION, tr("MEN_POINT_SELECTION"), QIcon(aPixmap),
+ tr("MEN_POINT_SELECTION"), "", 0, aParent, true,
+ this, SLOT(OnSwitchSelectionMode()));
+
+ aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_POINT_SELECTION"));
+ createAction( VISU_GAUSS_POINT_SELECTION, tr("MEN_GAUSS_POINT_SELECTION"), QIcon(aPixmap),
+ tr("MEN_GAUSS_POINT_SELECTION"), "", 0, aParent, true,
+ this, SLOT(OnSwitchSelectionMode()));
+
createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIcon(),
tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false,
this, SLOT(OnShowAnimation()));
createTool( VISU_ERASE_ALL, aToolId );
createTool( VISU_GLOBAL_SELECTION, aToolId );
createTool( VISU_PARTIAL_SELECTION, aToolId );
+
+ aToolId = createTool(tr("TOOL_SELECTION"));
+ createTool( VISU_SELECTION_PANEL, aToolId );
+ createTool( separator(), aToolId );
+ createTool( VISU_ACTOR_SELECTION, aToolId );
+ createTool( VISU_CELL_SELECTION, aToolId );
+ createTool( VISU_POINT_SELECTION, aToolId );
+ createTool( VISU_GAUSS_POINT_SELECTION, aToolId );
}
void
void VisuGUI::createInputPanel()
{
myInputPanel = new VisuGUI_InputPanel();
+ myInputPanel->hide();
//myInputPanel->resize( getApp()->objectBrowser()->width(), myInputPanel->height() );
GetDesktop(this)->addDockWidget( Qt::RightDockWidgetArea, myInputPanel );
}
+void VisuGUI::createSelectionPanel()
+{
+ mySelectionPanel = new VisuGUI_SelectionPanel( this );
+ mySelectionPanel->update();
+}
+
//***************************************************************************
void VisuGUI::contextMenuPopup( const QString& theClient, QMenu* theMenu, QString& theTitle )
{
getScalarBarsMap();
VisuGUI_InputPanel* inputPanel() const { return myInputPanel; }
+ VisuGUI_SelectionPanel* selectionPanel() const { return mySelectionPanel; }
signals:
void moduleDeactivated();
virtual void OnErasePrs();
// virtual void OnEraseAll();
+ void OnToggleSelectionPanel();
+ void OnSwitchSelectionMode();
+
void OnMakeSurfaceframe();
void OnMakeInsideframe();
void OnMakeWireframe();
void createMenus();
void createToolBars();
void createPopupMenus();
+
void createInputPanel();
+ void createSelectionPanel();
private:
VisuGUI_InputPanel* myInputPanel;
#define VISU_MULTIPR_LOW_RES 4097
#define VISU_MULTIPR_HIDE 4098
+#define VISU_SELECTION_PANEL 4100
+#define VISU_ACTOR_SELECTION 4101
+#define VISU_CELL_SELECTION 4102
+#define VISU_POINT_SELECTION 4103
+#define VISU_GAUSS_POINT_SELECTION 4104
+
#endif
// Author : Oleg Uvarov
// Module : VISU
-#include <VisuGUI_BasePanel.h>
+#include "VisuGUI_BasePanel.h"
+#include "VisuGUI_Tools.h"
+
+#include "SUIT_ResourceMgr.h"
#include <QScrollArea>
-#include <QPushButton>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QApplication>
+#include <QPushButton>
+//#include <QToolButton>
/*!
\class MainFrame
\brief Constructor.
\param theParent parent widget
*/
- MainFrame( QWidget* theParent )
+ MainFrame( QWidget* theParent = 0 )
: QFrame( theParent )
{
}
VisuGUI_BasePanel::VisuGUI_BasePanel( const QString& theName,
QWidget* theParent,
const int theBtns )
-: QGroupBox( theName, theParent )
+ : QGroupBox( theName, theParent ),
+ myOK( 0 ),
+ myApply( 0 ),
+ myClose( 0 ),
+ myHelp( 0 )
{
// Create scroll view
//myView = new QScrollArea( this );
- //myView->setFrameStyle( QFrame::NoFrame );
-
- //myView->setVerticalScrollBarPolicy( Qt::ScrollBarAsNeeded );
- //myView->viewport()->setBackgroundMode( Qt::PaletteButton );
- //myView->setResizePolicy( QScrollView::AutoOneFit );
// Create main frame
- myMainFrame = new MainFrame( this/*myView->viewport()*/ );
- //myView->setViewport( myMainFrame );
-
+ myMainFrame = new MainFrame( this/*myView*/ );
+ //myMainFrame->setFrameStyle( QFrame::Plain | QFrame::NoFrame );
+ /*
+ myView->setWidget( myMainFrame );
+ myView->setAlignment( Qt::AlignCenter );
+ myView->setWidgetResizable( true );
+ myView->setMinimumWidth( myMainFrame->sizeHint().width() + MARGIN_SIZE * 2 );
+ */
// Create buttons
QWidget* aBtnWg = new QWidget( this );
QHBoxLayout* aBtnWgLayout = new QHBoxLayout( aBtnWg );
if( theBtns & OKBtn )
{
+ //myOK = new QToolButton( aBtnWg );
+ //myOK->setIcon( VISU::GetResourceMgr()->loadPixmap("VISU", tr( "ICON_OK" ) ) );
myOK = new QPushButton( tr( "BUT_OK" ), aBtnWg );
aBtnWgLayout->addWidget( myOK );
connect( myOK, SIGNAL( clicked() ), SLOT( onOK() ) );
}
if( theBtns & ApplyBtn )
{
+ //myApply = new QToolButton( aBtnWg );
+ //myApply->setIcon( VISU::GetResourceMgr()->loadPixmap("VISU", tr( "ICON_APPLY" ) ) );
myApply = new QPushButton( tr( "BUT_APPLY" ), aBtnWg );
aBtnWgLayout->addWidget( myApply );
connect( myApply, SIGNAL( clicked() ), SLOT( onApply() ) );
}
if( theBtns & CloseBtn )
{
+ //myClose = new QToolButton( aBtnWg );
+ //myClose->setIcon( VISU::GetResourceMgr()->loadPixmap("VISU", tr( "ICON_CLOSE" ) ) );
myClose = new QPushButton( tr( "BUT_CLOSE" ), aBtnWg );
aBtnWgLayout->addWidget( myClose );
connect( myClose, SIGNAL( clicked() ), SLOT( onClose() ) );
}
if( theBtns & HelpBtn )
{
+ //myHelp = new QToolButton( aBtnWg );
+ //myHelp->setIcon( VISU::GetResourceMgr()->loadPixmap("VISU", tr( "ICON_HELP" ) ) );
myHelp = new QPushButton( tr( "BUT_HELP" ), aBtnWg );
aBtnWgLayout->addWidget( myHelp );
connect( myHelp, SIGNAL( clicked() ), SLOT( onHelp() ) );
QVBoxLayout* aLay = new QVBoxLayout( this );
aLay->setContentsMargins( 0, 0, 0, 0 );
aLay->setSpacing( 5 );
- aLay->addWidget( myMainFrame/*myView*/ );
+ aLay->addWidget( myMainFrame/*myView*/, 1 );
aLay->addWidget( aBtnWg );
}
QFrame* mainFrame();
protected:
- //QScrollArea* myView;
+ QScrollArea* myView;
QFrame* myMainFrame;
QPushButton* myOK;
#include "VISU_GaussPtsAct.h"
#include "VISU_GaussPtsSettings.h"
#include "VISU_GaussPointsPL.hxx"
+#include "VISU_PickingSettings.h"
#include "SUIT_MessageBox.h"
#include "SUIT_ResourceMgr.h"
myEventCallbackCommand->SetClientData(this);
myEventCallbackCommand->SetCallback(VisuGUI_GaussPointsSelectionPane::ProcessEvents);
- //setWindowTitle( tr( "PICKING_DLG_TITLE" ) );
- //setSizeGripEnabled(TRUE);
-
QVBoxLayout* TopLayout = new QVBoxLayout( this );
TopLayout->setSpacing(6);
TopLayout->setMargin(11);
BoxLayout->addWidget( CursorGroup );
+ connect( myCursorSizeSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( onApplyCursorSize( double ) ) );
+ connect( myPyramidHeightSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( onApplyPyramidHeight( double ) ) );
+ connect( mySelectionColorButton, SIGNAL( changed( QColor )), this, SLOT( onApplySelectionColor( QColor ) ) );
+
// Tolerance
QGroupBox* ToleranceGroup = new QGroupBox( tr( "TOLERANCE_TITLE" ), aBox );
QGridLayout* ToleranceGroupLayout = new QGridLayout (ToleranceGroup);
BoxLayout->addWidget( ToleranceGroup );
- // Information window
- QGroupBox* InfoWindowGroup = new QGroupBox( tr( "INFO_WINDOW_TITLE" ), aBox );
- QGridLayout* InfoWindowGroupLayout = new QGridLayout (InfoWindowGroup);
- InfoWindowGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
- InfoWindowGroupLayout->setSpacing(6);
- InfoWindowGroupLayout->setMargin(11);
-
- QLabel* TransparencyLabel = new QLabel( tr( "TRANSPARENCY" ), InfoWindowGroup );
- myTransparencySpinBox = new QtxIntSpinBox( 0, 100, 10, InfoWindowGroup );
- myTransparencySpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-
- InfoWindowGroupLayout->addWidget( TransparencyLabel, 0, 0 );
- InfoWindowGroupLayout->addWidget( myTransparencySpinBox, 0, 1 );
-
- QLabel* PositionLabel = new QLabel( tr( "POSITION" ), InfoWindowGroup );
- myPositionComboBox = new QComboBox( InfoWindowGroup );
- myPositionComboBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-
- myPositionComboBox->addItem( tr( "BELOW_POINT" ) );
- myPositionComboBox->addItem( tr( "TOP_LEFT_CORNER" ) );
-
- InfoWindowGroupLayout->addWidget( TransparencyLabel, 0, 0 );
- InfoWindowGroupLayout->addWidget( myTransparencySpinBox, 0, 1 );
- InfoWindowGroupLayout->addWidget( PositionLabel, 1, 0 );
- InfoWindowGroupLayout->addWidget( myPositionComboBox, 1, 1 );
-
- BoxLayout->addWidget( InfoWindowGroup );
-
- // Movement of the camera
- QGroupBox* CameraGroup = new QGroupBox( tr( "CAMERA_TITLE" ), aBox );
- QGridLayout* CameraGroupLayout = new QGridLayout (CameraGroup);
- CameraGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
- CameraGroupLayout->setSpacing(6);
- CameraGroupLayout->setMargin(11);
-
- QLabel* ZoomFactorLabel = new QLabel( tr( "ZOOM_FACTOR" ), CameraGroup );
- myZoomFactorSpinBox = new QtxDoubleSpinBox( 0.1, 10.0, 0.1, CameraGroup );
- myZoomFactorSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-
- QLabel* StepNumberLabel = new QLabel( tr( "STEP_NUMBER" ), CameraGroup );
- myStepNumberSpinBox = new QtxIntSpinBox( 1, 100, 1, CameraGroup );
- myStepNumberSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
-
- CameraGroupLayout->addWidget( ZoomFactorLabel, 0, 0 );
- CameraGroupLayout->addWidget( myZoomFactorSpinBox, 0, 1 );
- CameraGroupLayout->addWidget( StepNumberLabel, 1, 0 );
- CameraGroupLayout->addWidget( myStepNumberSpinBox, 1, 1 );
-
- BoxLayout->addWidget( CameraGroup );
+ connect( myPointToleranceSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( onApplyPointTolerance( double ) ) );
// Display parent mesh element
QGroupBox* PositionGroup = new QGroupBox( tr( "DATA_POSITION" ), aBox );
connect( myParentElementLineEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( onSelectionValidate() ) );
connect( myParentElementLineEdit, SIGNAL( returnPressed() ), this, SLOT( onSelectionApply() ) );
+ QToolButton* ParentElementBtn = new QToolButton( PositionGroup );
+ ParentElementBtn->setIcon( VISU::GetResourceMgr()->loadPixmap("VISU", tr( "ICON_OK" ) ) );
+ connect(ParentElementBtn, SIGNAL(clicked()), this, SLOT(onSelectionApply()));
+
QLabel* LocalPointLabel = new QLabel( tr( "LOCAL_POINT" ), PositionGroup );
myLocalPointLineEdit = new VisuGUI_ValidatedLineEdit( PositionGroup );
connect( myLocalPointLineEdit, SIGNAL( textChanged( const QString& ) ), this, SLOT( onSelectionValidate() ) );
connect( myLocalPointLineEdit, SIGNAL( returnPressed() ), this, SLOT( onSelectionApply() ) );
+ QToolButton* LocalPointBtn = new QToolButton( PositionGroup );
+ LocalPointBtn->setIcon( VISU::GetResourceMgr()->loadPixmap("VISU", tr( "ICON_OK" ) ) );
+ connect(LocalPointBtn, SIGNAL(clicked()), this, SLOT(onSelectionApply()));
+
myCellIDValidator = new GaussCellIDValidator( myLocalPointLineEdit, myModule, myParentElementLineEdit );
myParentElementLineEdit->setValidator( myCellIDValidator );
PositionGroupLayout->addWidget( ParentElementLabel, 0, 0, 1, 3 );
PositionGroupLayout->addWidget( myParentElementLineEdit, 0, 3 );
+ PositionGroupLayout->addWidget( ParentElementBtn, 0, 4 );
PositionGroupLayout->addWidget( LocalPointLabel, 1, 0, 1, 3 );
PositionGroupLayout->addWidget( myLocalPointLineEdit, 1, 3 );
- PositionGroupLayout->addWidget( myDisplayParentMeshCheckBox, 2, 0, 1, 4 );
+ PositionGroupLayout->addWidget( LocalPointBtn, 1, 4 );
+ PositionGroupLayout->addWidget( myDisplayParentMeshCheckBox, 2, 0, 1, 5 );
BoxLayout->addWidget( PositionGroup );
+ connect( myDisplayParentMeshCheckBox, SIGNAL(), this, SLOT( onApplyDisplayParentMesh( bool ) ) );
+
TopLayout->addWidget( aBox );
}
{
}
-void VisuGUI_GaussPointsSelectionPane::AddActor( VISU_GaussPtsAct* theActor )
-{
- theActor->SetPickingSettings( myPickingSettings.GetPointer() );
-}
-
-void VisuGUI_GaussPointsSelectionPane::RemoveActor( VISU_GaussPtsAct* theActor )
-{
- theActor->SetPickingSettings( NULL );
-}
-
void VisuGUI_GaussPointsSelectionPane::Update()
{
//printf( "VisuGUI_GaussPointsSelectionPane::Update()\n" );
- myPickingSettings = VISU_PickingSettings::Get();
-
- float aCursorSize = 0.5;
- float aPyramidHeight = 10.0;
- float aPointTolerance = 0.1;
- QColor aColor = Qt::yellow;
- int anInfoWindowTransparency = 50;
- int anInfoWindowPosition = VISU_PickingSettings::BelowPoint;
- float aZoomFactor = 1.5;
- int aStepNumber = 10;
- bool aDisplayParentMesh = false;
-
- if( !myPickingSettings->GetInitial() )
- {
- myCursorSizeSpinBox->setValue( myPickingSettings->GetCursorSize() );
- myPyramidHeightSpinBox->setValue( myPickingSettings->GetPyramidHeight() );
- myPointToleranceSpinBox->setValue( myPickingSettings->GetPointTolerance() );
- myTransparencySpinBox->setValue( int(myPickingSettings->GetInfoWindowTransparency() * 100.0) );
- myPositionComboBox->setCurrentIndex( myPickingSettings->GetInfoWindowPosition() );
- myZoomFactorSpinBox->setValue( myPickingSettings->GetZoomFactor() );
- myStepNumberSpinBox->setValue( myPickingSettings->GetStepNumber() );
- myDisplayParentMeshCheckBox->setChecked( myPickingSettings->GetDisplayParentMesh() );
-
- vtkFloatingPointType* aColor = myPickingSettings->GetColor();
- mySelectionColorButton->setColor(
- QColor( ( int )( aColor[0] * 255.0 ),
- ( int )( aColor[1] * 255.0 ),
- ( int )( aColor[2] * 255.0 ) ) );
-
- return;
- }
-
- SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr();
+ VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
- aCursorSize = aResourceMgr->doubleValue( "VISU", "picking_cursor_size", aCursorSize );
- myCursorSizeSpinBox->setValue( aCursorSize );
+ myCursorSizeSpinBox->setValue( aPickingSettings->GetCursorSize() );
+ myPyramidHeightSpinBox->setValue( aPickingSettings->GetPyramidHeight() );
+ myPointToleranceSpinBox->setValue( aPickingSettings->GetPointTolerance() );
+ myDisplayParentMeshCheckBox->setChecked( aPickingSettings->GetDisplayParentMesh() );
- aPyramidHeight = aResourceMgr->doubleValue( "VISU", "picking_pyramid_height", aPyramidHeight );
- myPyramidHeightSpinBox->setValue( aPyramidHeight );
-
- aPointTolerance = aResourceMgr->doubleValue( "VISU", "picking_point_tolerance", aPointTolerance );
- myPointToleranceSpinBox->setValue( aPointTolerance );
-
- aColor = aResourceMgr->colorValue( "VISU", "picking_selection_color", aColor );
- mySelectionColorButton->setColor( aColor );
-
- anInfoWindowTransparency = aResourceMgr->integerValue( "VISU", "picking_transparency", anInfoWindowTransparency );
- myTransparencySpinBox->setValue( anInfoWindowTransparency );
-
- anInfoWindowPosition = aResourceMgr->integerValue( "VISU", "picking_position", anInfoWindowPosition );
- myPositionComboBox->setCurrentIndex( anInfoWindowPosition );
-
- aZoomFactor = aResourceMgr->doubleValue( "VISU", "picking_zoom_factor", aZoomFactor );
- myZoomFactorSpinBox->setValue( aZoomFactor );
-
- aStepNumber = aResourceMgr->integerValue( "VISU", "picking_step_number", aStepNumber );
- myStepNumberSpinBox->setValue( aStepNumber );
-
- aDisplayParentMesh = aResourceMgr->booleanValue( "VISU", "picking_display_parent_mesh", aDisplayParentMesh );
- myDisplayParentMeshCheckBox->setChecked( aDisplayParentMesh );
-
- Apply();
-}
-
-VISU_PickingSettings*
-VisuGUI_GaussPointsSelectionPane
-::GetPickingSettings()
-{
- return myPickingSettings.GetPointer();
+ vtkFloatingPointType* aColor = aPickingSettings->GetColor();
+ mySelectionColorButton->setColor( QColor( ( int )( aColor[0] * 255.0 ),
+ ( int )( aColor[1] * 255.0 ),
+ ( int )( aColor[2] * 255.0 ) ) );
}
void VisuGUI_GaussPointsSelectionPane::SetInteractor( SVTK_RenderWindowInteractor* theInteractor )
{
//printf( "VisuGUI_GaussPointsSelectionPane::SetInteractor( %p )\n", theInteractor );
vtkGenericRenderWindowInteractor* aDevice = theInteractor->GetDevice();
- if( !aDevice->HasObserver(vtkCommand::KeyPressEvent) )
- {
- //printf( "AddObserver(vtkCommand::KeyPressEvent)\n" );
- aDevice->AddObserver(vtkCommand::KeyPressEvent,
- myEventCallbackCommand.GetPointer(),
- myPriority);
- }
+ if( aDevice->HasObserver(vtkCommand::KeyPressEvent) )
+ aDevice->RemoveObservers(vtkCommand::KeyPressEvent);
- if( !aDevice->HasObserver(vtkCommand::EndPickEvent) )
- {
- //printf( "AddObserver(vtkCommand::EndPickEvent)\n" );
- aDevice->AddObserver(vtkCommand::EndPickEvent,
- myEventCallbackCommand.GetPointer(),
- myPriority);
- }
+ //printf( "AddObserver(vtkCommand::KeyPressEvent)\n" );
+ aDevice->AddObserver(vtkCommand::KeyPressEvent,
+ myEventCallbackCommand.GetPointer(),
+ myPriority);
+
+ if( aDevice->HasObserver(vtkCommand::EndPickEvent) )
+ aDevice->RemoveObservers(vtkCommand::EndPickEvent);
+
+ //printf( "AddObserver(vtkCommand::EndPickEvent)\n" );
+ aDevice->AddObserver(vtkCommand::EndPickEvent,
+ myEventCallbackCommand.GetPointer(),
+ myPriority);
}
SVTK_RenderWindowInteractor* VisuGUI_GaussPointsSelectionPane::GetInteractor()
void VisuGUI_GaussPointsSelectionPane::KeyPressed()
{
+ //printf( "VisuGUI_GaussPointsSelectionPane::KeyPressed()\n" );
if( GetInteractor()->GetDevice()->GetKeyCode() == 'P' )
{
- bool aDisplayParentMesh = !myPickingSettings->GetDisplayParentMesh();
- myPickingSettings->SetDisplayParentMesh( aDisplayParentMesh );
+ VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+ bool aDisplayParentMesh = !aPickingSettings->GetDisplayParentMesh();
myDisplayParentMeshCheckBox->setChecked( aDisplayParentMesh );
- myPickingSettings->InvokeEvent(VISU::UpdatePickingSettingsEvent,NULL);
+ aPickingSettings->SetDisplayParentMesh( aDisplayParentMesh );
+ aPickingSettings->InvokeEvent(VISU::UpdatePickingSettingsEvent,NULL);
}
}
{
//printf( "VisuGUI_GaussPointsSelectionPane::SelectionEvent()\n" );
SelectorHelper aHelper( myModule );
- if ( !aHelper.get() )
- return;
-
- const TColStd_IndexedMapOfInteger& aMapIndex = aHelper.myMapIndex;
- if ( aMapIndex.Extent() != 1 )
- return;
-
- int anObjId = aHelper.myMapIndex(1);
-
- VISU::TGaussPointID aGaussPointID = aHelper.myPipeLine->GetObjID( anObjId );
-
- VISU::TCellID aCellId = aGaussPointID.first;
- myParentElementLineEdit->setText( QString::number( aCellId ) );
+ if( aHelper.get() )
+ {
+ const TColStd_IndexedMapOfInteger& aMapIndex = aHelper.myMapIndex;
+ if( aMapIndex.Extent() == 1 )
+ {
+ int anObjId = aHelper.myMapIndex(1);
+ VISU::TGaussPointID aGaussPointID = aHelper.myPipeLine->GetObjID( anObjId );
+ VISU::TCellID aCellID = aGaussPointID.first;
+ VISU::TLocalPntID aLocalPntID = aGaussPointID.second;
- VISU::TLocalPntID aLocalPntId = aGaussPointID.second;
- myLocalPointLineEdit->setText( QString::number( aLocalPntId ) );
+ myParentElementLineEdit->setText( QString::number( aCellID ) );
+ myLocalPointLineEdit->setText( QString::number( aLocalPntID ) );
- myPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
+ VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+ aPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
- SetSelected( aCellId, aLocalPntId );
+ SetSelected( aCellID, aLocalPntID );
+ return;
+ }
+ }
+ ClearIDControls();
}
void VisuGUI_GaussPointsSelectionPane::onSelectionValidate()
{
//printf( "VisuGUI_GaussPointsSelectionPane::SetSelected( %d, %d )\n", theCellId, theLocalPntId );
SelectorHelper aHelper( myModule );
- if ( !aHelper.get() )
+ if( !aHelper.get() )
return;
VISU::PGaussPtsIDMapper anIDMapper = aHelper.myPipeLine->GetGaussPtsIDMapper();
vtkIdType anObjVtkId = anIDMapper->GetVTKID( VISU::TGaussPointID( theCellId, theLocalPntId ) );
- if ( anObjVtkId < 0 )
+ if( anObjVtkId < 0 )
return;
aHelper.myMapIndex.Clear();
GetInteractor()->GetDevice()->CreateTimer( VTKI_TIMER_FIRST );
}
-void VisuGUI_GaussPointsSelectionPane::Apply()
+void VisuGUI_GaussPointsSelectionPane::ClearIDControls()
{
- myPickingSettings->SetInitial( false );
-
- myPickingSettings->SetCursorSize( myCursorSizeSpinBox->value() );
- myPickingSettings->SetPyramidHeight( myPyramidHeightSpinBox->value() );
- myPickingSettings->SetPointTolerance( myPointToleranceSpinBox->value() );
- myPickingSettings->SetInfoWindowTransparency( myTransparencySpinBox->value() / 100.0 );
- myPickingSettings->SetInfoWindowPosition( myPositionComboBox->currentIndex() );
- myPickingSettings->SetZoomFactor( myZoomFactorSpinBox->value() );
- myPickingSettings->SetStepNumber( myStepNumberSpinBox->value() );
- myPickingSettings->SetDisplayParentMesh( myDisplayParentMeshCheckBox->isChecked() );
-
- QColor aButtonColor = mySelectionColorButton->color();
- vtkFloatingPointType aColor[3];
- aColor[0] = aButtonColor.red() / 255.0;
- aColor[1] = aButtonColor.green() / 255.0;
- aColor[2] = aButtonColor.blue() / 255.0;
- myPickingSettings->SetColor( aColor );
-
- myPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
-
- onSelectionApply();
+ myParentElementLineEdit->setText( "" );
+ myLocalPointLineEdit->setText( "" );
}
-void VisuGUI_GaussPointsSelectionPane::Close()
+void VisuGUI_GaussPointsSelectionPane::UnselectAll()
{
- //printf( "VisuGUI_GaussPointsSelectionPane::Close()\n" );
+ //printf( "VisuGUI_GaussPointsSelectionPane::UnselectAll()\n" );
SelectorHelper aHelper( myModule );
if( aHelper.get() )
{
vtkIdType anObjVtkId = anIDMapper->GetVTKID( VISU::TGaussPointID( aCellID, aLocalPntID ) );
if( anObjVtkId >= 0 )
{
+ //printf( "anObjVtkId = %d\n", anObjVtkId );
aHelper.myActor->Highlight( false );
aHelper.myMapIndex.Clear();
}
}
}
+ ClearIDControls();
+}
+
+void VisuGUI_GaussPointsSelectionPane::Apply()
+{
+ /*
+ VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+ aPickingSettings->SetCursorSize( myCursorSizeSpinBox->value() );
+ aPickingSettings->SetPyramidHeight( myPyramidHeightSpinBox->value() );
+ aPickingSettings->SetPointTolerance( myPointToleranceSpinBox->value() );
+ aPickingSettings->SetDisplayParentMesh( myDisplayParentMeshCheckBox->isChecked() );
+
+ QColor aButtonColor = mySelectionColorButton->color();
+ vtkFloatingPointType aColor[3];
+ aColor[0] = aButtonColor.red() / 255.0;
+ aColor[1] = aButtonColor.green() / 255.0;
+ aColor[2] = aButtonColor.blue() / 255.0;
+ aPickingSettings->SetColor( aColor );
+
+ aPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
+ */
+ onSelectionApply();
+}
+
+void VisuGUI_GaussPointsSelectionPane::onApplyCursorSize( double theValue )
+{
+ VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+ aPickingSettings->SetCursorSize( theValue );
+ aPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
+ //onSelectionApply();
}
+
+void VisuGUI_GaussPointsSelectionPane::onApplyPyramidHeight( double theValue )
+{
+ VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+ aPickingSettings->SetPyramidHeight( theValue );
+ aPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
+}
+
+void VisuGUI_GaussPointsSelectionPane::onApplySelectionColor( QColor theValue )
+{
+ VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+ vtkFloatingPointType aColor[3];
+ aColor[0] = theValue.red() / 255.0;
+ aColor[1] = theValue.green() / 255.0;
+ aColor[2] = theValue.blue() / 255.0;
+ aPickingSettings->SetColor( aColor );
+ aPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
+}
+
+void VisuGUI_GaussPointsSelectionPane::onApplyPointTolerance( double theValue )
+{
+ VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+ aPickingSettings->SetPointTolerance( theValue );
+ aPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
+}
+
+void VisuGUI_GaussPointsSelectionPane::onApplyDisplayParentMesh( bool theValue )
+{
+ VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+ aPickingSettings->SetDisplayParentMesh( theValue );
+ aPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
+}
+
/*
void VisuGUI_GaussPointsSelectionPane::Help()
{
~VisuGUI_GaussPointsSelectionPane();
- //! Make an actor to listen the event of Update Picking Settings event.
- void AddActor( VISU_GaussPtsAct* );
- void RemoveActor( VISU_GaussPtsAct* );
-
//! Update dialog contents.
void Update();
- VISU_PickingSettings* GetPickingSettings();
-
void SetInteractor( SVTK_RenderWindowInteractor* );
+ void UnselectAll();
+
void Apply();
- void Close();
//void Help();
protected:
void onSelectionValidate();
void onSelectionApply();
+private slots:
+ void onApplyCursorSize( double );
+ void onApplyPyramidHeight( double );
+ void onApplySelectionColor( QColor );
+ void onApplyPointTolerance( double );
+ void onApplyDisplayParentMesh( bool );
+
private:
static void ProcessEvents(vtkObject* theObject,
unsigned long theEvent,
//void keyPressEvent( QKeyEvent* e );
void SetSelected( VISU::TCellID, VISU::TLocalPntID );
+ void ClearIDControls();
private:
const SalomeApp_Module* myModule;
QtxDoubleSpinBox* myPyramidHeightSpinBox;
QtxColorButton* mySelectionColorButton;
QtxDoubleSpinBox* myPointToleranceSpinBox;
- QtxIntSpinBox* myTransparencySpinBox;
- QComboBox* myPositionComboBox;
- QtxDoubleSpinBox* myZoomFactorSpinBox;
- QtxIntSpinBox* myStepNumberSpinBox;
QCheckBox* myDisplayParentMeshCheckBox;
QtxAction* myAction;
- vtkSmartPointer<VISU_PickingSettings> myPickingSettings;
VisuGUI_ValidatedLineEdit* myParentElementLineEdit;
VisuGUI_ValidatedLineEdit* myLocalPointLineEdit;
#include "VisuGUI_InputPanel.h"
#include "VisuGUI_BasePanel.h"
-#include "VisuGUI_Module.h"
-
-#include <SalomeApp_Application.h>
#include <QVBoxLayout>
-#include <SUIT_ResourceMgr.h>
-#include <SUIT_Session.h>
-
/*!
* \brief Constructor creates enmpty docable window with invisible QVBox
to be used as container of child widgets
myGrp->layout()->addWidget( thePanel );
connect( thePanel, SIGNAL( bpClose() ), this, SLOT( onClosePanel() ) );
}
-
+
+ if( isEmpty() )
+ show();
+
thePanel->show();
myCurrentPanel = thePanel;
+ myPanels[ thePanel ] = true;
setUpdatesEnabled( true );
repaint();
thePanel->hide();
myCurrentPanel = 0;
+ myPanels[ thePanel ] = false;
+
+ if( isEmpty() )
+ hide();
}
/*!
hidePanel( myCurrentPanel );
}
+/*!
+ \brief Returns true if no panels are shown
+*/
+bool VisuGUI_InputPanel::isEmpty() const
+{
+ QMap<VisuGUI_BasePanel*, bool>::const_iterator it = myPanels.begin(), itEnd = myPanels.end();
+ for( ; it != itEnd; ++it )
+ {
+ if( it.value() )
+ return false;
+ }
+ return true;
+}
+
+/*!
+ \brief Returns true if the panel is shown
+*/
+bool VisuGUI_InputPanel::isShown( VisuGUI_BasePanel* thePanel ) const
+{
+ return myPanels[ thePanel ];
+}
+
/*!
\brief Close panel which emits signal close().
*/
void hidePanel( VisuGUI_BasePanel* thePanel );
void clear();
- VisuGUI_BasePanel* getCurrentPanel() const;
+ bool isEmpty() const;
+ bool isShown( VisuGUI_BasePanel* thePanel ) const;
protected slots:
void onClosePanel();
private:
QWidget* myGrp;
- QMap< VisuGUI_BasePanel*, bool > myPanels;
+ QMap<VisuGUI_BasePanel*, bool> myPanels;
VisuGUI_BasePanel* myCurrentPanel;
};
#include "VISU_PrsObject_i.hh"
#include "VISU_Prs3d_i.hh"
#include "VISU_PipeLine.hxx"
+#include "VISU_GaussPointsPL.hxx"
+#include "VISU_GaussPtsSettings.h"
+#include "VISU_PickingSettings.h"
#include "SalomeApp_Study.h"
#include "SalomeApp_Application.h"
#include "SVTK_Selector.h"
#include "SVTK_RenderWindowInteractor.h"
+#include "QtxDoubleSpinBox.h"
+#include "QtxIntSpinBox.h"
+
#include "utilities.h"
// OCCT Includes
#include <QRadioButton>
#include <QValidator>
#include <QPushButton>
+#include <QToolButton>
#include <QGroupBox>
#include <QLineEdit>
#include <QValidator>
#include <QKeyEvent>
#include <QHeaderView>
#include <QTabWidget>
+#include <QScrollArea>
+#include <QComboBox>
// VTK Includes
#include <vtkDataSetMapper.h>
using namespace std;
+#define MARGIN_SIZE 11
+
VisuGUI_SelectionPanel::VisuGUI_SelectionPanel( const SalomeApp_Module* theModule, QWidget* theParent ) :
- VisuGUI_BasePanel( tr("WINDOW_TITLE" ), theParent, ApplyBtn | CloseBtn | HelpBtn ),
+ VisuGUI_BasePanel( tr("WINDOW_TITLE" ), theParent, /*ApplyBtn | */CloseBtn | HelpBtn ),
myModule( theModule ),
mySelectionMgr( 0 )
{
QVBoxLayout* TopLayout = new QVBoxLayout ( mainFrame() );
TopLayout->setSpacing(6);
- TopLayout->setMargin(11);
+ TopLayout->setMargin(MARGIN_SIZE);
QWidget* aNamePane = new QWidget (mainFrame());
QGridLayout* aNameLay = new QGridLayout (aNamePane);
myIDValLbl->setValidator(aIntValidator);
connect(myIDValLbl, SIGNAL(returnPressed()), this, SLOT(onPointIdEdit()));
+ QToolButton* anIDBtn = new QToolButton( aDataGrp );
+ anIDBtn->setIcon( VISU::GetResourceMgr()->loadPixmap("VISU", tr( "ICON_OK" ) ) );
+ aGridLay->addWidget( anIDBtn, 0, 2 );
+ connect(anIDBtn, SIGNAL(clicked()), this, SLOT(onPointIdEdit()));
+
myScalarValLbl = new QLabel ("", aDataGrp);
- aGridLay->addWidget( myScalarValLbl, 1, 1 );
+ aGridLay->addWidget( myScalarValLbl, 1, 1, 1, 2 );
myVectorValLbl = new QLabel ("", aDataGrp);
myVectorValLbl->setMinimumWidth(150);
- aGridLay->addWidget( myVectorValLbl, 2, 1 );
+ aGridLay->addWidget( myVectorValLbl, 2, 1, 1, 2 );
aVBoxLayout->addWidget( aDataGrp );
aGridLay->addWidget( myCellIDValLbl, 0, 1);
connect(myCellIDValLbl, SIGNAL(returnPressed()), this, SLOT(onCellIdEdit()));
+ QToolButton* aCellIDBtn = new QToolButton( aDataGrp );
+ aCellIDBtn->setIcon( VISU::GetResourceMgr()->loadPixmap("VISU", tr( "ICON_OK" ) ) );
+ aGridLay->addWidget( aCellIDBtn, 0, 2 );
+ connect(aCellIDBtn, SIGNAL(clicked()), this, SLOT(onCellIdEdit()));
+
aGridLay->addWidget( new QLabel (tr("DATA_SCALAR_LBL"), aCellGrp), 1, 0);
myCellScalarValLbl = new QLabel ("", aCellGrp);
- aGridLay->addWidget( myCellScalarValLbl, 1, 1);
+ aGridLay->addWidget( myCellScalarValLbl, 1, 1, 1, 2);
aGridLay->addWidget( new QLabel (tr("DATA_VECTOR_LBL"), aCellGrp), 2, 0);
myCellVectorValLbl = new QLabel ("", aCellGrp);
- aGridLay->addWidget(myCellVectorValLbl , 2, 1);
+ aGridLay->addWidget(myCellVectorValLbl , 2, 1, 1, 2);
aCellLayout->addWidget(aCellGrp, 0, 0);
aVBoxLayout->addStretch();
// Gauss Points Pane
- myGaussPointsPane = new VisuGUI_GaussPointsSelectionPane( myModule, mainFrame() );
+ QScrollArea* aGaussPointsScrollArea = new QScrollArea( mainFrame() );
+ myGaussPointsPane = new VisuGUI_GaussPointsSelectionPane( myModule, aGaussPointsScrollArea );
+
+ aGaussPointsScrollArea->setWidget( myGaussPointsPane );
+ aGaussPointsScrollArea->setAlignment( Qt::AlignCenter );
+ aGaussPointsScrollArea->setWidgetResizable( true );
+ aGaussPointsScrollArea->setMinimumWidth( myGaussPointsPane->sizeHint().width() + MARGIN_SIZE );
// Add panes to tab widget
myTabWidget->addTab(myActorsPane, tr("MODE_ACTOR"));
myTabWidget->addTab(myCellsPane, tr("MODE_CELL"));
myTabWidget->addTab(myPointsPane, tr("MODE_POINT"));
- myTabWidget->addTab(myGaussPointsPane, tr("MODE_GAUSS_POINT"));
+ myTabWidget->addTab(aGaussPointsScrollArea, tr("MODE_GAUSS_POINT"));
connect(myTabWidget, SIGNAL(currentChanged(int)), this, SLOT(onSelectionModeChanged(int)));
TopLayout->addWidget(myTabWidget);
+ // Information window
+ myInfoWindowGroup = new QGroupBox( tr( "INFO_WINDOW_TITLE" ), mainFrame() );
+ myInfoWindowGroup->setCheckable( true );
+
+ QGridLayout* InfoWindowGroupLayout = new QGridLayout (myInfoWindowGroup);
+ InfoWindowGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
+ InfoWindowGroupLayout->setSpacing(6);
+ InfoWindowGroupLayout->setMargin(11);
+
+ QLabel* TransparencyLabel = new QLabel( tr( "TRANSPARENCY" ), myInfoWindowGroup );
+ myTransparencySpinBox = new QtxIntSpinBox( 0, 100, 10, myInfoWindowGroup );
+ myTransparencySpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+ InfoWindowGroupLayout->addWidget( TransparencyLabel, 0, 0 );
+ InfoWindowGroupLayout->addWidget( myTransparencySpinBox, 0, 1 );
+
+ QLabel* PositionLabel = new QLabel( tr( "POSITION" ), myInfoWindowGroup );
+ myPositionComboBox = new QComboBox( myInfoWindowGroup );
+ myPositionComboBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+ myPositionComboBox->addItem( tr( "BELOW_POINT" ) );
+ myPositionComboBox->addItem( tr( "TOP_LEFT_CORNER" ) );
+
+ InfoWindowGroupLayout->addWidget( TransparencyLabel, 0, 0 );
+ InfoWindowGroupLayout->addWidget( myTransparencySpinBox, 0, 1 );
+ InfoWindowGroupLayout->addWidget( PositionLabel, 1, 0 );
+ InfoWindowGroupLayout->addWidget( myPositionComboBox, 1, 1 );
+
+ TopLayout->addWidget( myInfoWindowGroup );
+
+ connect( myInfoWindowGroup, SIGNAL( toggled( bool ) ), this, SLOT( onApplyInfoWindow( bool ) ) );
+ connect( myTransparencySpinBox, SIGNAL( valueChanged( int ) ), this, SLOT( onApplyTransparency( int ) ) );
+ connect( myPositionComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( onApplyPosition( int ) ) );
+
+ // Movement of the camera
+ myCameraGroup = new QGroupBox( tr( "CAMERA_TITLE" ), mainFrame() );
+ myCameraGroup->setCheckable( true );
+
+ QGridLayout* CameraGroupLayout = new QGridLayout (myCameraGroup);
+ CameraGroupLayout->setAlignment(Qt::AlignTop | Qt::AlignCenter);
+ CameraGroupLayout->setSpacing(6);
+ CameraGroupLayout->setMargin(11);
+
+ QLabel* ZoomFactorLabel = new QLabel( tr( "ZOOM_FACTOR_DSC" ), myCameraGroup );
+ ZoomFactorLabel->setToolTip( tr( "ZOOM_FACTOR_TIP" ) );
+ 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 );
+ StepNumberLabel->setToolTip( tr( "STEP_NUMBER_TIP" ) );
+ myStepNumberSpinBox = new QtxIntSpinBox( 1, 100, 1, myCameraGroup );
+ myStepNumberSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) );
+
+ CameraGroupLayout->addWidget( ZoomFactorLabel, 0, 0 );
+ CameraGroupLayout->addWidget( myZoomFactorSpinBox, 0, 1 );
+ CameraGroupLayout->addWidget( StepNumberLabel, 1, 0 );
+ CameraGroupLayout->addWidget( myStepNumberSpinBox, 1, 1 );
+
+ TopLayout->addWidget( myCameraGroup );
+
+ connect( myCameraGroup, SIGNAL( toggled( bool ) ), this, SLOT( onApplyCamera( bool ) ) );
+ connect( myZoomFactorSpinBox, SIGNAL( valueChanged( double ) ), this, SLOT( onApplyZoomFactor( double ) ) );
+ connect( myStepNumberSpinBox, SIGNAL( valueChanged( int ) ), this, SLOT( onApplyStepNumber( int ) ) );
+
+
SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>
(SUIT_Session::session()->activeApplication());
mySelectionMgr = anApp->selectionMgr();
{
}
-void VisuGUI_SelectionPanel::onSelectionModeChanged (int theId)
+void VisuGUI_SelectionPanel::update()
+{
+ VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+
+ myInfoWindowGroup->setChecked( aPickingSettings->GetInfoWindowEnabled() );
+ myTransparencySpinBox->setValue( int(aPickingSettings->GetInfoWindowTransparency() * 100.0) );
+ myPositionComboBox->setCurrentIndex( aPickingSettings->GetInfoWindowPosition() );
+ myCameraGroup->setChecked( aPickingSettings->GetCameraMovementEnabled() );
+ myZoomFactorSpinBox->setValue( aPickingSettings->GetZoomFactor() );
+ myStepNumberSpinBox->setValue( aPickingSettings->GetStepNumber() );
+}
+
+void VisuGUI_SelectionPanel::setSelectionMode( int theId )
+{
+ //printf( "VisuGUI_SelectionPanel::setSelectionMode( %d )\n", theId );
+ myTabWidget->setCurrentIndex( theId );
+}
+
+void VisuGUI_SelectionPanel::onSelectionModeChanged( int theId )
{
//printf( "VisuGUI_SelectionPanel::onSelectionModeChanged( %d )\n", theId );
SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myModule);
if (!aViewWindow) return;
- myGaussPointsPane->Close(); // unselect gauss points
+ myGaussPointsPane->UnselectAll(); // unselect gauss points
switch (theId) {
case 0: // Actor
}
}
-
-void VisuGUI_SelectionPanel::closeEvent (QCloseEvent* theEvent)
+void VisuGUI_SelectionPanel::showEvent( QShowEvent* theEvent )
{
- myTabWidget->setCurrentWidget(myActorsPane);
+ VisuGUI_BasePanel::showEvent(theEvent);
+}
+void VisuGUI_SelectionPanel::closeEvent( QCloseEvent* theEvent )
+{
+ onClose();
VisuGUI_BasePanel::closeEvent(theEvent);
}
}
}
-#define ABS(a) (a>=0)?a:-a
-
void VisuGUI_SelectionPanel::onSelectionEvent() {
SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow<SVTK_ViewWindow>(myModule);
if (!aViewWindow)
}
}
+ clearFields();
if (aPrs3d) {
QString aMeshName("NULL"), aFieldName("NULL");
myYPosLbl->setText(QString::number( aCoord[2] ));
myZPosLbl->setText(QString::number( aCoord[4] ));
- myDXLbl->setText(QString::number( ABS(aCoord[1]-aCoord[0]) ));
- myDYLbl->setText(QString::number( ABS(aCoord[3]-aCoord[2]) ));
- myDZLbl->setText(QString::number( ABS(aCoord[5]-aCoord[4]) ));
+ myDXLbl->setText(QString::number( fabs(aCoord[1]-aCoord[0]) ));
+ myDYLbl->setText(QString::number( fabs(aCoord[3]-aCoord[2]) ));
+ myDZLbl->setText(QString::number( fabs(aCoord[5]-aCoord[4]) ));
TColStd_IndexedMapOfInteger aMapIndex;
typedef std::vector<vtkFloatingPointType> TCoordArray;
vtkDataSet* aDataSet = anVISUActor->GetMapper()->GetInput();
vtkPointData* aPntData = aDataSet->GetPointData();
- for (int ind = 1; ind <= aMapIndex.Extent(); ind++) {
- int anID = aMapIndex(ind);
+ // controls are cleared in case of multi-selection of sub-elements
+ //for (int ind = 1; ind <= aMapIndex.Extent(); ind++) {
+ if( aMapIndex.Extent() == 1 ) {
+ int anID = aMapIndex(1);
switch (aType) {
case 2:
//for(int aColumnId = 0; aColumnId < 9; aColumnId++)
myListPoints->resizeColumnsToContents();
}
- } else {
- clearFields();
}
myFl = false;
}
-#undef ABS
-
void VisuGUI_SelectionPanel::clearFields() {
int aType = myTabWidget->currentIndex();
switch (aType) {
case 2:
+ myIDValLbl->setText( "" );
myXValLbl->setText( "" );
myYValLbl->setText( "" );
myZValLbl->setText( "" );
myVectorValLbl->setText("");
break;
case 1:
+ myCellIDValLbl->setText( "" );
myCellScalarValLbl->setText("");
myCellVectorValLbl->setText("");
myListPoints->setRowCount(0);
if (aPrs3d) {
int anObjId = theText.toInt();
VISU_PipeLine* aPipeLine = aPrs3d->GetPipeLine();
+
+ if( dynamic_cast<VISU_GaussPointsPL*>( aPipeLine ) )
+ return false;
+
int aVTKId = (aPipeLine->*theMethod)(anObjId);
if(aVTKId < 0)
return false;
aSelector->AddOrRemoveIndex(anIO, newIndices, false);
aViewWindow->highlight(anIO, true, true);
+ if( SVTK_MainWindow* aMainWindow = aViewWindow->getMainWindow() )
+ {
+ SVTK_RenderWindowInteractor* anInteractor = aMainWindow->GetInteractor();
+ VISU_Actor* anActor = SVTK::Find<VISU_Actor>(anInteractor->getRenderer()->GetActors(),
+ SVTK::TIsSameIObject<VISU_Actor>( anIO ));
+ //anActor->Highlight( anIO );
+ }
+
return true;
} else {
clearFields();
}
-void VisuGUI_SelectionPanel::onApply()
+void VisuGUI_SelectionPanel::onApplyInfoWindow( bool theValue )
{
- //printf( "VisuGUI_SelectionPanel::onApply()\n" );
- int aType = myTabWidget->currentIndex();
- switch( aType )
- {
- case 1: // Cells
- onCellIdEdit();
- break;
- case 2: // Points
- onPointIdEdit();
- break;
- case 3: // Gauss Points
- myGaussPointsPane->Apply();
- break;
- default:
- break;
- }
+ VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+ aPickingSettings->SetInfoWindowEnabled( theValue );
+ aPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
+}
+
+void VisuGUI_SelectionPanel::onApplyTransparency( int theValue )
+{
+ VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+ aPickingSettings->SetInfoWindowTransparency( theValue / 100.0 );
+ aPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
+}
+
+void VisuGUI_SelectionPanel::onApplyPosition( int theValue )
+{
+ VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+ aPickingSettings->SetInfoWindowPosition( theValue );
+ aPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
+}
+
+void VisuGUI_SelectionPanel::onApplyCamera( bool theValue )
+{
+ VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+ aPickingSettings->SetCameraMovementEnabled( theValue );
+ aPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
+}
+
+void VisuGUI_SelectionPanel::onApplyZoomFactor( double theValue )
+{
+ VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+ aPickingSettings->SetZoomFactor( theValue );
+ aPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
+}
+
+void VisuGUI_SelectionPanel::onApplyStepNumber( int theValue )
+{
+ VISU_PickingSettings* aPickingSettings = VISU_PickingSettings::Get();
+ aPickingSettings->SetStepNumber( theValue );
+ aPickingSettings->InvokeEvent( VISU::UpdatePickingSettingsEvent,NULL );
+}
+void VisuGUI_SelectionPanel::onApply()
+{
VisuGUI_BasePanel::onApply();
}
void VisuGUI_SelectionPanel::onClose()
{
- //printf( "VisuGUI_SelectionPanel::onClose()\n" );
close();
-
VisuGUI_BasePanel::onClose();
}
#include <VisuGUI_BasePanel.h>
+#include <vtkSmartPointer.h>
+
+class QComboBox;
+class QGroupBox;
class QLabel;
class QLineEdit;
class QTableWidget;
class QTabWidget;
+class QtxDoubleSpinBox;
+class QtxIntSpinBox;
+
class LightApp_SelectionMgr;
class SalomeApp_Application;
class SalomeApp_Module;
VisuGUI_SelectionPanel( const SalomeApp_Module* theModule, QWidget* theParent = 0 );
virtual ~VisuGUI_SelectionPanel ();
+public:
+ void update();
+
+ void setSelectionMode( int theId );
+
private:
void keyPressEvent( QKeyEvent* theEvent );
protected:
- void closeEvent( QCloseEvent* theEvent );
+ virtual void showEvent( QShowEvent* theEvent );
+ virtual void closeEvent( QCloseEvent* theEvent );
private slots:
virtual void onApply();
virtual void onClose();
virtual void onHelp();
+ void onApplyInfoWindow( bool );
+ void onApplyTransparency( int );
+ void onApplyPosition( int );
+ void onApplyCamera( bool );
+ void onApplyZoomFactor( double );
+ void onApplyStepNumber( int );
+
void onSelectionModeChanged( int theId );
void onSelectionEvent();
void onPointIdEdit();
VisuGUI_GaussPointsSelectionPane* myGaussPointsPane;
+ QGroupBox* myInfoWindowGroup;
+ QtxIntSpinBox* myTransparencySpinBox;
+ QComboBox* myPositionComboBox;
+
+ QGroupBox* myCameraGroup;
+ QtxDoubleSpinBox* myZoomFactorSpinBox;
+ QtxIntSpinBox* myStepNumberSpinBox;
+
const SalomeApp_Module* myModule;
LightApp_SelectionMgr* mySelectionMgr;
bool myFl;
#include "VVTK_PickingDlg.h"
#include "VISU_GaussPtsAct.h"
-#include "VISU_GaussPtsSettings.h"
+#include "VISU_PickingSettings.h"
#include "VISU_GaussPointsPL.hxx"
#include "SUIT_MessageBox.h"
void VVTK_PickingDlg::AddActor( VISU_GaussPtsAct* theActor )
{
- theActor->SetPickingSettings( myPickingSettings.GetPointer() );
+ //theActor->SetPickingSettings( myPickingSettings.GetPointer() );
}
void VVTK_PickingDlg::RemoveActor( VISU_GaussPtsAct* theActor )
{
- theActor->SetPickingSettings( NULL );
+ //theActor->SetPickingSettings( NULL );
}
void VVTK_PickingDlg::Update()
int aStepNumber = 10;
bool aDisplayParentMesh = false;
- if( !myPickingSettings->GetInitial() )
+ //if( !myPickingSettings->GetInitial() )
{
myCursorSizeSpinBox->setValue( myPickingSettings->GetCursorSize() );
myPyramidHeightSpinBox->setValue( myPickingSettings->GetPyramidHeight() );
void VVTK_PickingDlg::onClickApply()
{
- myPickingSettings->SetInitial( false );
+ //myPickingSettings->SetInitial( false );
myPickingSettings->SetCursorSize( myCursorSizeSpinBox->value() );
myPickingSettings->SetPyramidHeight( myPyramidHeightSpinBox->value() );
anActor->SetHighlightProperty(myGaussHighlightProperty.GetPointer());
anActor->SetInsideCursorSettings(myInsideCursorSettings);
- anActor->SetPickingSettings(myPickingSettings);
+ //anActor->SetPickingSettings(myPickingSettings);
}
}
anActor->SetHighlightProperty(NULL);
anActor->SetInsideCursorSettings(NULL);
- anActor->SetPickingSettings(NULL);
+ //anActor->SetPickingSettings(NULL);
}
}