#include <vtkCamera.h>
#include <vtkRenderer.h>
#include <vtkPointPicker.h>
+#include <vtkMatrix4x4.h>
#include <vtkScalarBarWidget.h>
#include <vtkTextMapper.h>
#include <vtkTextProperty.h>
#include <vtkPolyDataMapper.h>
#include <vtkPolyData.h>
#include <vtkActor.h>
+#include <vtkTransform.h>
#include <vtkObjectFactory.h>
#include <vtkCallbackCommand.h>
myEventCallbackCommand->SetClientData(this);
myEventCallbackCommand->SetCallback(VISU_GaussPtsAct::ProcessEvents);
+ vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
+
myDeviceActor->SetProperty(GetProperty());
+ myDeviceActor->SetUserMatrix(aMatrix);
myDeviceActor->SetVisibility(true);
myDeviceActor->SetPickable(false);
myScalarBarCtrl->Delete();
myMapper->Delete();
+ aMatrix->Delete();
}
VISU_GaussPtsAct
VISU_GaussPtsAct
::RenderOpaqueGeometry(vtkViewport *viewport)
{
+ GetMatrix(myDeviceActor->GetUserMatrix());
return 1;
}
VISU_GaussPtsAct
::RenderTranslucentGeometry(vtkViewport *viewport)
{
+ GetMatrix(myDeviceActor->GetUserMatrix());
return 1;
}
if(myIsPreselected){
anIsChanged = (myLastPreHighlightObjID != anObjId);
if(anIsChanged){
- vtkFloatingPointType* aNodeCoord = GetNodeCoord(anObjId);
+ vtkFloatingPointType* aNodeCoord = GetNodeCoord(anObjId);
+ //Take into account translation
+ vtkFloatingPointType aLocalNodeCoord[3];
+ this->Transform->Push();
+ this->Transform->PostMultiply();
+ this->Transform->Identity();
+
+ this->Transform->Translate(this->Position[0],
+ this->Position[1],
+ this->Position[2]);
+ double aPosition[3];
+ this->Transform->GetPosition(aPosition);
+
+ aLocalNodeCoord[0] = aNodeCoord[0] + aPosition[0];
+ aLocalNodeCoord[1] = aNodeCoord[1] + aPosition[1];
+ aLocalNodeCoord[2] = aNodeCoord[2] + aPosition[2];
+
vtkDataSet* aDataSet = GetInput();
vtkPointData* aPointData = aDataSet->GetPointData();
if(vtkDataArray *aScalarArray = aPointData->GetScalars()){
GetRadius(anObjId,aVtkId,aScalarArray),
GetMagnification(anObjId),
GetClamp(anObjId),
- aNodeCoord,
+ aLocalNodeCoord,
aColor);
}
+
}
+ this->Transform->Pop();
myLastPreHighlightObjID = anObjId;
}
myCursorPyramid->SetVisibility(true);
return false;
}
+
+
+void VISU_GaussPtsAct::SetPosition(double _arg[3]){
+ Superclass::SetPosition(_arg);
+ Highlight(isHighlighted());
+}
+
//==================================================================
// function : Highlight
// purpose :
int anObjId = aMapIndex(1);
vtkFloatingPointType* aNodeCoord = GetNodeCoord(anObjId);
+ if ( !aNodeCoord )
+ return;
+ //Take into account translation
+ vtkFloatingPointType aLocalNodeCoord[3];
+ this->Transform->Push();
+ this->Transform->PostMultiply();
+ this->Transform->Identity();
+ this->Transform->Translate(this->Position[0],
+ this->Position[1],
+ this->Position[2]);
+ double aPosition[3];
+ this->Transform->GetPosition(aPosition);
+ aLocalNodeCoord[0] = aNodeCoord[0] + aPosition[0];
+ aLocalNodeCoord[1] = aNodeCoord[1] + aPosition[1];
+ aLocalNodeCoord[2] = aNodeCoord[2] + aPosition[2];
+ this->Transform->Pop();
+
vtkFloatingPointType aFocalPnt[3];
aCamera->GetFocalPoint(aFocalPnt);
- if ( !aNodeCoord || CheckIsSameVector( aNodeCoord, aFocalPnt, 3 ) )
+ if ( CheckIsSameVector(aLocalNodeCoord, aFocalPnt, 3 ) )
return;
// FlyTo
anInteractor->SetDolly(0.0);
anInteractor->SetNumberOfFlyFrames(myPickingSettings->GetStepNumber());
- anInteractor->FlyTo(aRenderer, aNodeCoord);
+ anInteractor->FlyTo(aRenderer, aLocalNodeCoord);
aRenderer->ResetCameraClippingRange();
anInteractor->SetDolly(aDollyWas);
anInteractor->SetNumberOfFlyFrames(aNumberOfFlyFramesWas);
- anInteractor->InvokeEvent(SVTK::ChangeRotationPoint, aNodeCoord);
+ anInteractor->InvokeEvent(SVTK::ChangeRotationPoint, aLocalNodeCoord);
//
std::ostringstream aStr;
// int anObjId = aMapIndex(1);
//
vtkIdType aVtkId = GetNodeVTKID(anObjId);
if(aVtkId >= 0){
- vtkFloatingPointType *aNodeCoord = GetNodeCoord(anObjId);
- vtkFloatingPointType aWorldCoord[4] = {aNodeCoord[0], aNodeCoord[1], aNodeCoord[2], 1.};
+ vtkFloatingPointType aWorldCoord[4] = {aLocalNodeCoord[0], aLocalNodeCoord[1], aLocalNodeCoord[2], 1.};
//
vtkDataSet* aDataSet = GetInput();
vtkPointData* aDataSetAttributes = aDataSet->GetPointData();
GetRadius(anObjId,aVtkId,aScalarArray),
GetMagnification(anObjId),
GetClamp(anObjId),
- aNodeCoord,
+ aLocalNodeCoord,
myHighlightActor->GetProperty()->GetColor());
myCursorPyramidSelected->SetVisibility(anIsVisible && theIsHighlight);
//
myEventCallbackCommand->SetCallback(VISU_GaussPtsAct1::ProcessEvents);
+ vtkMatrix4x4 *aMatrix = vtkMatrix4x4::New();
+
myInsideDeviceActor->SetVisibility(false);
myInsideDeviceActor->SetPickable(false);
+ myInsideDeviceActor->SetUserMatrix(aMatrix);
myInsideDeviceActor->Delete();
myOutsideDeviceActor->SetVisibility(false);
myOutsideDeviceActor->SetPickable(false);
+ myOutsideDeviceActor->SetUserMatrix(aMatrix);
myOutsideDeviceActor->Delete();
+ aMatrix->Delete();
}
VISU_GaussPtsAct1
}
+int
+VISU_GaussPtsAct1
+::RenderOpaqueGeometry(vtkViewport *viewport)
+{
+
+ Superclass::RenderOpaqueGeometry(viewport);
+ GetMatrix(myInsideDeviceActor->GetUserMatrix());
+ GetMatrix(myOutsideDeviceActor->GetUserMatrix());
+ return 1;
+}
+
+int
+VISU_GaussPtsAct1
+::RenderTranslucentGeometry(vtkViewport *viewport)
+{
+ Superclass::RenderTranslucentGeometry(viewport);
+ GetMatrix(myInsideDeviceActor->GetUserMatrix());
+ GetMatrix(myOutsideDeviceActor->GetUserMatrix());
+
+ return 1;
+}
+
//----------------------------------------------------------------------------
void
VISU_GaussPtsAct1
return aPipeLine->GetMagnification();
}
-
//----------------------------------------------------------------------------
vtkFloatingPointType
VISU_GaussPtsAct1
//----------------------------------------------------------------
+
+void
+VISU_GaussPtsAct1::SetPosition(double _arg[3]){
+ if(MYDEBUG1) MESSAGE("VISU_GaussPtsAct1::SetPosition - this = "<<this);
+ Superclass::SetPosition(_arg);
+ myUpdatePositionSignal(_arg);
+}
+
void
VISU_GaussPtsAct1
::Connect(VISU_GaussPtsAct2* theActor)
{
mySetVisibilitySignal.connect(boost::bind(&VISU_GaussPtsAct2::SetVisibility,theActor,_1));
+ myUpdatePositionSignal.connect(boost::bind(&VISU_GaussPtsAct2::SetPosition, theActor,_1));
}
void
Superclass::ShallowCopyPL(thePipeLine);
}
+//----------------------------------------------------------------------------
+void
+VISU_GaussPtsAct2::SetPosition(double _arg[3]){
+ if(MYDEBUG1) MESSAGE("VISU_GaussPtsAct2::SetPosition - this = "<<this);
+ Superclass::SetPosition(_arg);
+}
//----------------------------------------------------------------------------
void
{
if(MYDEBUG) MESSAGE("VisuGUI::OnTranslatePrs");
VisuGUI_OffsetDlg* aDlg = new VisuGUI_OffsetDlg (this);
-
- LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this);
- SALOME_ListIO aListIO;
- aSelectionMgr->selectedObjects(aListIO);
-
- SalomeApp_Study* aStudy = GetAppStudy(this);
- SALOME_ListIteratorOfListIO anIter(aListIO);
- for (; anIter.More(); anIter.Next()) {
- Handle(SALOME_InteractiveObject) anIO = anIter.Value();
- if (anIO->hasEntry()) {
- QString anEntry(anIO->getEntry());
- VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, anEntry);
- if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase))
- aDlg->addPresentation(aPrsObject);
- else if (VISU::PointMap3d_i* aPrs = dynamic_cast<VISU::PointMap3d_i*>(anObjectInfo.myBase)) {
- aDlg->addPointMapPresentation(aPrs);
- }
- }
- }
- if (aDlg->getPrsCount() > 0)
- aDlg->show();
- else
- delete aDlg;
+ aDlg->exec();
}
void
mgr->setRule( action( VISU_DISPLAY ), aDisplayRule, true );
mgr->setRule( action( VISU_DISPLAY_ONLY ), aDOnlyRule, true );
- aRule = "selcount>0 and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D'" + aPrsAll + "}";
+ aRule = "selcount>0 and $type in {'VISU::TMESH' 'VISU::TPOINTMAP3D' 'VISU::TGAUSSPOINTS'" + aPrsAll + "}";
mgr->setRule( action( VISU_TRANSLATE_PRS ), aRule, true );
aRule = "selcount>1 and $type in {'VISU::TMESH' " + aPrsAll + "}";
#include "VISU_Actor.h"
#include "LightApp_Application.h"
+#include "SALOME_ListIteratorOfListIO.hxx"
#include "SalomeApp_Application.h"
+#include "LightApp_SelectionMgr.h"
#include "SVTK_ViewWindow.h"
#include "SVTK_ViewModel.h"
#include "SUIT_Desktop.h"
VisuGUI_OffsetDlg::VisuGUI_OffsetDlg (VisuGUI* theModule)
: QDialog(VISU::GetDesktop(theModule), 0, false, WStyle_Customize |
WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose),
-myModule(theModule)
+ myModule(theModule),
+ mySelectionMgr(VISU::GetSelectionMgr(theModule))
{
myPrsList.setAutoDelete(false);
myPointMapList.setAutoDelete(false);
connect(buttonApply, SIGNAL(clicked()), this, SLOT(onApply()));
connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
connect(buttonHelp, SIGNAL(clicked()), this, SLOT(onHelp()));
+ connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged()));
+
+ onSelectionChanged();
+ show();
+}
+
+
+void VisuGUI_OffsetDlg::show(){
+ if(getPrsCount() > 0 )
+ QDialog::show();
+}
+
+void VisuGUI_OffsetDlg::onSelectionChanged(){
+ if(!mySelectionMgr)
+ return;
+
+ //Clear old selection
+ clearPresentations();
+
+ SALOME_ListIO aListIO;
+ mySelectionMgr->selectedObjects(aListIO);
+
+ SalomeApp_Study* aStudy = VISU::GetAppStudy(myModule);
+ SALOME_ListIteratorOfListIO anIter(aListIO);
+ for (; anIter.More(); anIter.Next()) {
+ Handle(SALOME_InteractiveObject) anIO = anIter.Value();
+ if (anIO->hasEntry()) {
+ QString anEntry(anIO->getEntry());
+ VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(aStudy, anEntry);
+ if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase))
+ addPresentation(aPrsObject);
+ else if (VISU::PointMap3d_i* aPrs = dynamic_cast<VISU::PointMap3d_i*>(anObjectInfo.myBase)) {
+ addPointMapPresentation(aPrs);
+ }
+ }
+ }
+}
+
+void VisuGUI_OffsetDlg::clearPresentations(){
+ myPrsList.clear();
+ myPointMapList.clear();
+ myOldOffsets.clear();
+ myOldPointMapOffsets.clear();
}
void VisuGUI_OffsetDlg::addPresentation (VISU::Prs3d_i* thePrs)
if (myPrsList.count() == 0)
return;
- if (isToSave())
+ if (isToSave()) {
thePrs->SetOffset(theOffset[0],theOffset[1],theOffset[2]);
+ thePrs->UpdateActors();
+ return;
+ }
ViewManagerList aViewManagerList;
SalomeApp_Application* anApp = myModule->getApp();
for (int i = 0, iEnd = aViews.size(); i < iEnd; i++) {
if (SUIT_ViewWindow* aViewWindow = aViews.at(i)) {
if (SVTK_ViewWindow* vw = dynamic_cast<SVTK_ViewWindow*>(aViewWindow)) {
- vw->onAdjustTrihedron();
if (VISU_Actor* anActor = VISU::FindActor(vw, thePrs)) {
- anActor->SetPosition(theOffset);
- vw->highlight(thePrs->GetIO(), 1);
+ anActor->SetPosition(theOffset);
+ vw->onAdjustTrihedron();
vw->getRenderer()->ResetCameraClippingRange();
vw->Repaint();
}
{
vtkFloatingPointType anOffset[3];
getOffset(anOffset);
+
for (int i = 0; i < myPrsList.count(); i++) {
updateOffset(myPrsList.at(i), anOffset);
}