From: vsr Date: Mon, 21 Mar 2011 16:03:00 +0000 (+0000) Subject: Merge from BR_WIN_INDUS_514 branch 21/03/2011 (Windows industrialization) X-Git-Tag: V6_main_20110322 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=e06b3be4e520297f03ab80652819d4ecf0037978;p=modules%2Fvisu.git Merge from BR_WIN_INDUS_514 branch 21/03/2011 (Windows industrialization) --- diff --git a/doc/salome/gui/VISU/images/viewing13.png b/doc/salome/gui/VISU/images/viewing13.png index 76bd8d54..934a7a0e 100755 Binary files a/doc/salome/gui/VISU/images/viewing13.png and b/doc/salome/gui/VISU/images/viewing13.png differ diff --git a/doc/salome/gui/VISU/input/table_3d.doc b/doc/salome/gui/VISU/input/table_3d.doc index 7a02dd46..38cf54b6 100644 --- a/doc/salome/gui/VISU/input/table_3d.doc +++ b/doc/salome/gui/VISU/input/table_3d.doc @@ -43,7 +43,7 @@ bar displayed with this presentation (\ref scalar_map_page "see also"). It is also possible to choose \b Wireframe or \b Shading \b Representation type, change -such properties as \b Opacity and Line Width and Translate the presentation using the context menu. +such properties as \b Transparency and Line Width and Translate the presentation using the context menu.
See Also a sample TUI Script of \ref tui_table_3d_page "Table 3D presentation creation". diff --git a/doc/salome/gui/VISU/input/viewing_3d_presentations.doc b/doc/salome/gui/VISU/input/viewing_3d_presentations.doc index d5a679da..771a121e 100644 --- a/doc/salome/gui/VISU/input/viewing_3d_presentations.doc +++ b/doc/salome/gui/VISU/input/viewing_3d_presentations.doc @@ -83,16 +83,16 @@ are visualized: as straight lines or as arcs of circle. \image html quadratic.png - \b Properties - - \b Opacity - allows to set the value of opacity of the - presentation between 0 (transparent) and 100 (opaque). + - \b Transparency - allows to set the value of transparency of the + presentation between 0 (opaque) and 100 (transparent). \note For a \ref gauss_points_presentations_page "Gauss Points" presentation, displayed using Point Sprites or OpenGL Points \ref primitive_types_page "primitives", this property only allows switching between transparent and opaque modes. The - textures are drawn in the opaque mode if the opacity is equal to - 100% and in the transparent mode if the opacity is lower that 100% - (note that they become invisible when the opacity is equal to - 0%).\n\n \image html viewing13.png + textures are drawn in the opaque mode if the transparency is equal to + 0% and in the transparent mode if the transparency is > 0% + (note that they become invisible when the transparency is equal to + 100%).\n\n \image html viewing13.png - Line Width - allows to set the width of lines representing edges of the presentation between 1 (thin) and 100 (thick).\n\n \image html line_width.png diff --git a/src/OBJECT/VISU_ActorBase.cxx b/src/OBJECT/VISU_ActorBase.cxx index fbb889e3..9598883c 100644 --- a/src/OBJECT/VISU_ActorBase.cxx +++ b/src/OBJECT/VISU_ActorBase.cxx @@ -194,3 +194,8 @@ void VISU_ActorBase::ConnectToFactory(boost::signal0& theUpdateActorSignal myUpdateActorsConnection = theUpdateActorSignal.connect(boost::bind(&VISU_ActorBase::UpdateFromFactory,this)); myRemoveFromRendererConnection = theRemoveFromRendererSignal.connect(boost::bind(&VISU_ActorBase::RemoveFromRender,this)); } + +//-------------------------------------------------------------------------------------- +vtkDataSet* VISU_ActorBase::GetHighlightedDataSet() { + return myPassFilter.back()->GetOutput(); +} diff --git a/src/OBJECT/VISU_ActorBase.h b/src/OBJECT/VISU_ActorBase.h index b4e2da39..8651efda 100644 --- a/src/OBJECT/VISU_ActorBase.h +++ b/src/OBJECT/VISU_ActorBase.h @@ -75,6 +75,12 @@ class VISU_OBJECT_EXPORT VISU_ActorBase: public SALOME_Actor, virtual void ConnectToFactory(boost::signal0& , boost::signal0&); + //---------------------------------------------------------------------------- + //! Return pointer to the dataset, which used to calculation of the bounding box of the actor + //! Redefined from VTKViewer_Actor + virtual vtkDataSet* GetHighlightedDataSet(); + + protected: VISU_ActorBase(); virtual ~VISU_ActorBase(); diff --git a/src/OBJECT/VISU_VectorsAct.cxx b/src/OBJECT/VISU_VectorsAct.cxx index a2e866ba..9b2ee148 100644 --- a/src/OBJECT/VISU_VectorsAct.cxx +++ b/src/OBJECT/VISU_VectorsAct.cxx @@ -143,3 +143,8 @@ VISU_VectorsAct return Superclass::GetValLabelsInput(); } + +//-------------------------------------------------------------------------------------- +vtkDataSet* VISU_VectorsAct::GetHighlightedDataSet() { + return myPassFilter[3]->GetOutput(); +} diff --git a/src/OBJECT/VISU_VectorsAct.h b/src/OBJECT/VISU_VectorsAct.h index 2729a683..b6e533e1 100644 --- a/src/OBJECT/VISU_VectorsAct.h +++ b/src/OBJECT/VISU_VectorsAct.h @@ -69,6 +69,12 @@ class VISU_OBJECT_EXPORT VISU_VectorsAct : public VISU_ScalarMapAct virtual vtkDataSet* GetValLabelsInput(); + + //---------------------------------------------------------------------------- + //! Return pointer to the dataset, which used to calculation of the bounding box of the actor + //! Redefined from VTKViewer_Actor + virtual vtkDataSet* GetHighlightedDataSet(); + protected: VISU_VectorsAct(); diff --git a/src/PIPELINE/VISU_PipeLine.cxx b/src/PIPELINE/VISU_PipeLine.cxx index d9809ae5..58820209 100644 --- a/src/PIPELINE/VISU_PipeLine.cxx +++ b/src/PIPELINE/VISU_PipeLine.cxx @@ -52,6 +52,8 @@ VISU_PipeLine myIsFeatureEdgesAllowed(true) { if(MYDEBUG) MESSAGE("VISU_PipeLine::VISU_PipeLine - "<ShallowCopy(thePipeLine->GetMapperHolder(), theIsCopyInput); + for( int i =0 ; i < 6 ; i++) + myVisibleBounds[i] = thePipeLine->myVisibleBounds[i]; + + myVisibleComputeTime = thePipeLine->myVisibleComputeTime; } @@ -394,7 +400,10 @@ VISU_PipeLine thePlane->SetNormal(theDir); vtkFloatingPointType anOrigin[3]; - VISU::DistanceToPosition(GetInput(), + + //Make sure that bounds are calculated + ComputeVisibleBounds(); + VISU::DistanceToPosition(myVisibleBounds, theDir, theDist, anOrigin); @@ -411,14 +420,16 @@ VISU_PipeLine vtkPlane* thePlane) { thePlane->GetNormal(theDir); - + vtkFloatingPointType anOrigin[3]; thePlane->GetOrigin(anOrigin); - - VISU::PositionToDistance(GetInput(), - theDir, - anOrigin, - theDist); + + //Make sure that bounds are calculated + ComputeVisibleBounds(); + VISU::PositionToDistance(myVisibleBounds, + theDir, + anOrigin, + theDist); } @@ -465,4 +476,22 @@ VISU_PipeLine } +//---------------------------------------------------------------------------- +// Re-compute visible bounds if need +void VISU_PipeLine::ComputeVisibleBounds() { + if(GetMTime() > myVisibleComputeTime) { + VISU::ComputeVisibleBounds(GetMapperHolder()->GetOutput(), myVisibleBounds); + myVisibleComputeTime.Modified(); + } +} + +//---------------------------------------------------------------------------- +void VISU_PipeLine::GetVisibleBounds(vtkFloatingPointType theBounds[6]) { + // Compute or get cached bounds + ComputeVisibleBounds(); + for (int i=0; i<6; i++) { + theBounds[i] = myVisibleBounds[i]; + } +} + //---------------------------------------------------------------------------- diff --git a/src/PIPELINE/VISU_PipeLine.hxx b/src/PIPELINE/VISU_PipeLine.hxx index d2bf38a5..c712e05c 100644 --- a/src/PIPELINE/VISU_PipeLine.hxx +++ b/src/PIPELINE/VISU_PipeLine.hxx @@ -40,6 +40,7 @@ class vtkMapper; class vtkDataSet; class vtkPointSet; class vtkImplicitFunction; +class vtkTimeStamp; class VISU_MapperHolder; @@ -179,6 +180,9 @@ public: vtkFloatingPointType& theDist, vtkPlane* thePlane); + void + GetVisibleBounds(vtkFloatingPointType theBounds[6]); + //---------------------------------------------------------------------------- static size_t @@ -209,6 +213,10 @@ protected: void DoShallowCopy(VISU_PipeLine *thePipeLine, bool theIsCopyInput); + + virtual + void + ComputeVisibleBounds(); //---------------------------------------------------------------------------- vtkDataSet* @@ -219,6 +227,10 @@ protected: void SetIsFeatureEdgesAllowed(bool theIsFeatureEdgesAllowed); + + //Visible bounds xmin, xmax, ymin, ymax, zmin, zmax + vtkFloatingPointType myVisibleBounds[6]; + vtkTimeStamp myVisibleComputeTime; // Time at which visible bounds computed private: //---------------------------------------------------------------------------- diff --git a/src/PIPELINE/VISU_PipeLineUtils.cxx b/src/PIPELINE/VISU_PipeLineUtils.cxx index b048a04c..0219054d 100644 --- a/src/PIPELINE/VISU_PipeLineUtils.cxx +++ b/src/PIPELINE/VISU_PipeLineUtils.cxx @@ -162,14 +162,15 @@ namespace VISU //---------------------------------------------------------------------------- void - ComputeBoundsParam(vtkDataSet* theDataSet, + ComputeBoundsParam(vtkFloatingPointType theBounds[6], vtkFloatingPointType theDirection[3], vtkFloatingPointType theMinPnt[3], vtkFloatingPointType& theMaxBoundPrj, vtkFloatingPointType& theMinBoundPrj) { vtkFloatingPointType aBounds[6]; - theDataSet->GetBounds(aBounds); + for(int i = 0; i < 6; i++) + aBounds[i] = theBounds[i]; //Enlarge bounds in order to avoid conflicts of precision for(int i = 0; i < 6; i += 2){ @@ -211,13 +212,13 @@ namespace VISU //---------------------------------------------------------------------------- void - DistanceToPosition(vtkDataSet* theDataSet, + DistanceToPosition(vtkFloatingPointType theBounds[6], vtkFloatingPointType theDirection[3], vtkFloatingPointType theDist, vtkFloatingPointType thePos[3]) { vtkFloatingPointType aMaxBoundPrj, aMinBoundPrj, aMinPnt[3]; - ComputeBoundsParam(theDataSet, + ComputeBoundsParam(theBounds, theDirection, aMinPnt, aMaxBoundPrj, @@ -231,13 +232,13 @@ namespace VISU //---------------------------------------------------------------------------- void - PositionToDistance(vtkDataSet* theDataSet, + PositionToDistance(vtkFloatingPointType theBounds[6], vtkFloatingPointType theDirection[3], vtkFloatingPointType thePos[3], vtkFloatingPointType& theDist) { vtkFloatingPointType aMaxBoundPrj, aMinBoundPrj, aMinPnt[3]; - ComputeBoundsParam(theDataSet, + ComputeBoundsParam(theBounds, theDirection, aMinPnt, aMaxBoundPrj, @@ -245,8 +246,7 @@ namespace VISU vtkFloatingPointType aPrj = vtkMath::Dot(theDirection,thePos); theDist = (aPrj-aMinBoundPrj)/(aMaxBoundPrj-aMinBoundPrj); } - - + //---------------------------------------------------------------------------- bool IsQuadraticData(vtkDataSet* theDataSet) @@ -258,6 +258,53 @@ namespace VISU return false; } - //---------------------------------------------------------------------------- + //Compute bounds of the visible part of the dataset + void + ComputeVisibleBounds(vtkDataSet* theDataSet, vtkFloatingPointType theBounds[6]) { + int nbCells, i, j, minIdx, maxIdx; + vtkFloatingPointType cellBounds[6]; + + if( theDataSet && (nbCells = theDataSet->GetNumberOfCells()) ) { + theDataSet->GetCellBounds(0,theBounds); + for ( i = 1; i < nbCells; i++ ) { + theDataSet->GetCellBounds(i, cellBounds); + for ( j = 0; j < 3; j++ ) { + minIdx = 2*j; + maxIdx = 2*j+1; + if ( cellBounds[minIdx] < theBounds[minIdx] ) { + theBounds[minIdx] = cellBounds[minIdx]; + } + if ( cellBounds[maxIdx] > theBounds[maxIdx] ) { + theBounds[maxIdx] = cellBounds[maxIdx]; + } + } + } + } else { + vtkMath::UninitializeBounds(theBounds); + } + } + + //---------------------------------------------------------------------------- + //Compute center of the box, box defined as xmin, xmax, ymin, ymax, zmin, zmax + void + ComputeBoxCenter(vtkFloatingPointType theBounds[6], vtkFloatingPointType theCenter[3]) { + for (int i=0; i<3; i++) { + theCenter[i] = (theBounds[2*i+1] + theBounds[2*i]) / 2.0; + } + } + + //---------------------------------------------------------------------------- + //Compute length of the box diagonal, box defined as xmin, xmax, ymin, ymax, zmin, zmax + double + ComputeBoxDiagonal(vtkFloatingPointType theBounds[6]) { + double diff, len=0.0; + int i; + for (i=0; i<3; i++) { + diff = (double)(theBounds[2*i+1]) - (double)(theBounds[2*i]); + len += diff * diff; + } + diff = sqrt(len); + return diff; + } } diff --git a/src/PIPELINE/VISU_PipeLineUtils.hxx b/src/PIPELINE/VISU_PipeLineUtils.hxx index ca2e2d54..a77dd31d 100644 --- a/src/PIPELINE/VISU_PipeLineUtils.hxx +++ b/src/PIPELINE/VISU_PipeLineUtils.hxx @@ -126,7 +126,7 @@ namespace VISU //---------------------------------------------------------------------------- void VISU_PIPELINE_EXPORT - ComputeBoundsParam(vtkDataSet* theDataSet, + ComputeBoundsParam(vtkFloatingPointType theBounds[6], vtkFloatingPointType theDirection[3], vtkFloatingPointType theMinPnt[3], vtkFloatingPointType& theMaxBoundPrj, @@ -135,7 +135,7 @@ namespace VISU //---------------------------------------------------------------------------- void VISU_PIPELINE_EXPORT - DistanceToPosition(vtkDataSet* theDataSet, + DistanceToPosition(vtkFloatingPointType theBounds[6], vtkFloatingPointType theDirection[3], vtkFloatingPointType theDist, vtkFloatingPointType thePos[3]); @@ -143,7 +143,7 @@ namespace VISU //---------------------------------------------------------------------------- void VISU_PIPELINE_EXPORT - PositionToDistance(vtkDataSet* theDataSet, + PositionToDistance(vtkFloatingPointType theBounds[6], vtkFloatingPointType theDirection[3], vtkFloatingPointType thePos[3], vtkFloatingPointType& theDist); @@ -152,6 +152,20 @@ namespace VISU //---------------------------------------------------------------------------- bool VISU_PIPELINE_EXPORT IsQuadraticData(vtkDataSet* theDataSet); + + //---------------------------------------------------------------------------- + void VISU_PIPELINE_EXPORT + ComputeVisibleBounds(vtkDataSet* theDataSet, + vtkFloatingPointType theBounds[6]); + + //---------------------------------------------------------------------------- + void VISU_PIPELINE_EXPORT + ComputeBoxCenter(vtkFloatingPointType theBounds[6], vtkFloatingPointType theCenter[3]); + + //---------------------------------------------------------------------------- + double VISU_PIPELINE_EXPORT + ComputeBoxDiagonal(vtkFloatingPointType theBounds[6]); + } #endif diff --git a/src/VISUGUI/VISU_msg_en.ts b/src/VISUGUI/VISU_msg_en.ts index b67b34b7..af51cd21 100644 --- a/src/VISUGUI/VISU_msg_en.ts +++ b/src/VISUGUI/VISU_msg_en.ts @@ -900,8 +900,8 @@ Input value precision can be adjusted using Shading Off - MEN_OPACITY - Opacity + MEN_TRANSPARENCY + Transparency MEN_PARALLEL_ANIMATION @@ -3214,7 +3214,7 @@ Please, refer to the QT documentation. TRANSPARENCY_TITLE - Change Transparency + Transparency TRANSPARENCY_TRANSPARENT diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 0377e286..bd549708 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -2796,8 +2796,8 @@ VisuGUI tr("MEN_EDGE_COLOR"), "", 0, aParent, false, this, SLOT(OnChangeWireframeColor())); - createAction( VISU_OPACITY, tr("MEN_OPACITY"), QIcon(), - tr("MEN_OPACITY"), "", 0, aParent, false, + createAction( VISU_OPACITY, tr("MEN_TRANSPARENCY"), QIcon(), + tr("MEN_TRANSPARENCY"), "", 0, aParent, false, this, SLOT(OnChangeOpacity())); createAction( VISU_LINE_WIDTH, tr("MEN_LINE_WIDTH"), QIcon(), @@ -3693,7 +3693,7 @@ VisuGUI action(VISU_RENAME )->setEnabled(true); // Rename: Key_F2 ((VisuGUI_ClippingPanel*) myPanels[ClippingPlanesPanelId])->init(); - + GetVisuGen( this )->GetClippingPlaneMgr().SetStudy(GetCStudy(dynamic_cast(theStudy)),true); emit moduleActivated(); return aResult; diff --git a/src/VISUGUI/VisuGUI_ClippingDlg.cxx b/src/VISUGUI/VisuGUI_ClippingDlg.cxx index 0f9bea8d..458a8058 100644 --- a/src/VISUGUI/VisuGUI_ClippingDlg.cxx +++ b/src/VISUGUI/VisuGUI_ClippingDlg.cxx @@ -31,6 +31,7 @@ #include "VISU_ColoredPrs3dHolder_i.hh" #include "VISU_PipeLine.hxx" +#include "VISU_PipeLineUtils.hxx" #include "VISU_DataSetActor.h" #include @@ -948,16 +949,23 @@ void VisuGUI_ClippingDlg::SetCurrentPlaneParam() myPrs3d->SetPlaneParam(aNormal, 1. - getDistance(), aPlane); - vtkDataSet* aDataSet = myPrs3d->GetInput(); - vtkFloatingPointType *aPnt = aDataSet->GetCenter(); + //Get bounds of the visible part of the dataset + vtkFloatingPointType aBounds[6]; + myPrs3d->GetPipeLine()->GetVisibleBounds(aBounds); - vtkFloatingPointType* anOrigin = aPlane->GetOrigin(); - vtkFloatingPointType aDel = aDataSet->GetLength()/2.0; + //Get center + vtkFloatingPointType aPnt[3]; + VISU::ComputeBoxCenter(aBounds,aPnt); + vtkFloatingPointType* anOrigin = aPlane->GetOrigin(); + + //Get Length of the diagonal + vtkFloatingPointType aDel = VISU::ComputeBoxDiagonal(aBounds)/2.0; + vtkFloatingPointType aDelta[2][3] = {{aDir[0][0]*aDel, aDir[0][1]*aDel, aDir[0][2]*aDel}, {aDir[1][0]*aDel, aDir[1][1]*aDel, aDir[1][2]*aDel}}; vtkFloatingPointType aParam, aPnt0[3], aPnt1[3], aPnt2[3]; - + vtkFloatingPointType aPnt01[3] = {aPnt[0] - aDelta[0][0] - aDelta[1][0], aPnt[1] - aDelta[0][1] - aDelta[1][1], aPnt[2] - aDelta[0][2] - aDelta[1][2]}; @@ -1014,7 +1022,7 @@ void VisuGUI_ClippingDlg::onTabChanged(QWidget* newTab) // purpose : set non structured parameters by IJK parameters //================================================================================= void VisuGUI_ClippingDlg::SetCurrentPlaneIJKParam() -{ +{ if (myPlanes.empty() || myIsSelectPlane || !WidgetIJKTab->isEnabled()) return; @@ -1139,11 +1147,11 @@ void VisuGUI_ClippingDlg::setIJKByNonStructured() // find index value double v = SpinBoxDistance->value(); // reverse value? -// bool reverse = (normal * axDir < 0); // normal and axis are opposite -// if (gridDir * axDir < 0) // grid dir and axis are opposite -// reverse = !reverse; -// if (reverse) -// v = 1. - v; + bool reverse = (normal * axDir < 0); // normal and axis are opposite + if (gridDir * axDir < 0) // grid dir and axis are opposite + reverse = !reverse; + if (reverse) + v = 1. - v; for (i = 0; i < values->size(); ++i) if ((*values)[ i ] > v) break; @@ -1153,11 +1161,11 @@ void VisuGUI_ClippingDlg::setIJKByNonStructured() --i; // set control values + onIJKAxisChanged(gridAxId); // first of all update label and range of index myIsSelectPlane = true; CheckBoxIJKPlaneReverse->setChecked(normal * axDir < 0); SpinBoxIJKIndex->setValue(i); ButtonGroupIJKAxis->button(gridAxId)->setChecked( true ); - onIJKAxisChanged(gridAxId); // update label and range of index myIsSelectPlane = false; SetCurrentPlaneIJKParam(); diff --git a/src/VISUGUI/VisuGUI_ClippingDlg.h b/src/VISUGUI/VisuGUI_ClippingDlg.h index a40cd1c0..18daf564 100644 --- a/src/VISUGUI/VisuGUI_ClippingDlg.h +++ b/src/VISUGUI/VisuGUI_ClippingDlg.h @@ -213,6 +213,6 @@ public slots: void ClickOnHelp(); }; -#endif // DIALOGBOX_TRANSPARENCYDLG_H +#endif // DIALOGBOX_CLIPPING_H diff --git a/src/VISUGUI/VisuGUI_TransparencyDlg.cxx b/src/VISUGUI/VisuGUI_TransparencyDlg.cxx index f14baab8..6ea3a861 100644 --- a/src/VISUGUI/VisuGUI_TransparencyDlg.cxx +++ b/src/VISUGUI/VisuGUI_TransparencyDlg.cxx @@ -92,8 +92,8 @@ VisuGUI_TransparencyDlg::VisuGUI_TransparencyDlg( VisuGUI* theModule, GroupC1Layout->setMargin(11); TextLabelTransparent = new QLabel(tr("TRANSPARENCY_TRANSPARENT" ), GroupC1); - TextLabelTransparent->setAlignment(Qt::AlignLeft); - GroupC1Layout->addWidget(TextLabelTransparent, 0, 0); + TextLabelTransparent->setAlignment(Qt::AlignRight); + GroupC1Layout->addWidget(TextLabelTransparent, 0, 2); ValueLab = new QLabel(GroupC1); ValueLab->setAlignment(Qt::AlignCenter); @@ -102,8 +102,8 @@ VisuGUI_TransparencyDlg::VisuGUI_TransparencyDlg( VisuGUI* theModule, GroupC1Layout->addWidget(ValueLab, 0, 1); TextLabelOpaque = new QLabel(tr("TRANSPARENCY_OPAQUE" ), GroupC1); - TextLabelOpaque->setAlignment(Qt::AlignRight); - GroupC1Layout->addWidget(TextLabelOpaque, 0, 2); + TextLabelOpaque->setAlignment(Qt::AlignLeft); + GroupC1Layout->addWidget(TextLabelOpaque, 0, 1); Slider1 = new QSlider( Qt::Horizontal, GroupC1 ); Slider1->setMinimum( 0 ); @@ -207,7 +207,7 @@ void VisuGUI_TransparencyDlg::SetTransparency() { if( myViewWindow ) { SUIT_OverrideCursor wc; - float opacity = this->Slider1->value() / 100.; + float opacity = (100 - this->Slider1->value() ) / 100.; SALOME_ListIO aList; mySelectionMgr->selectedObjects(aList); @@ -274,7 +274,7 @@ void VisuGUI_TransparencyDlg::onSelectionChanged() } } } - Slider1->setValue( opacity == UNDEF_OPACITY ? DEFAULT_OPACITY : opacity ); + Slider1->setValue( 100 - ( opacity == UNDEF_OPACITY ? DEFAULT_OPACITY : opacity ) ); } ValueHasChanged(); } diff --git a/src/VISU_I/VISU_ClippingPlaneMgr.cxx b/src/VISU_I/VISU_ClippingPlaneMgr.cxx index 7a169cca..50f63e7a 100644 --- a/src/VISU_I/VISU_ClippingPlaneMgr.cxx +++ b/src/VISU_I/VISU_ClippingPlaneMgr.cxx @@ -49,9 +49,9 @@ VISU_ClippingPlaneMgr::~VISU_ClippingPlaneMgr() } //************************************************************* -void VISU_ClippingPlaneMgr::SetStudy(_PTR(Study) theStudy) +void VISU_ClippingPlaneMgr::SetStudy(_PTR(Study) theStudy, bool reinitStudy) { - if (myStudy == theStudy) return; + if (myStudy == theStudy && !reinitStudy) return; myStudy = theStudy; myPlanes->RemoveAllItems(); if (!myStudy) return; @@ -79,7 +79,8 @@ void VISU_ClippingPlaneMgr::SetStudy(_PTR(Study) theStudy) aPlane->setAuto(false); applyPlaneToAll(aPlane); - myPlanes->AddItem(aPlane); + + myPlanes->AddItem(aPlane); } } } diff --git a/src/VISU_I/VISU_ClippingPlaneMgr.hxx b/src/VISU_I/VISU_ClippingPlaneMgr.hxx index 7841a1a0..9357547b 100644 --- a/src/VISU_I/VISU_ClippingPlaneMgr.hxx +++ b/src/VISU_I/VISU_ClippingPlaneMgr.hxx @@ -76,7 +76,7 @@ public: VISU_ClippingPlaneMgr(); ~VISU_ClippingPlaneMgr(); - void SetStudy(_PTR(Study) theStudy); + void SetStudy(_PTR(Study) theStudy, bool reinitStudy = false); long CreateClippingPlane(double X,double Y, double Z, diff --git a/src/VISU_I/VISU_PointMap3d_i.cc b/src/VISU_I/VISU_PointMap3d_i.cc index 97391826..f151528b 100644 --- a/src/VISU_I/VISU_PointMap3d_i.cc +++ b/src/VISU_I/VISU_PointMap3d_i.cc @@ -712,6 +712,7 @@ void VISU::PointMap3d_i::RemoveFromStudy() //---------------------------------------------------------------- void VISU::PointMap3d_i::SetOffset(CORBA::Float theDx, CORBA::Float theDy, CORBA::Float theDz) { + VISU::TSetModified aModified(this); myOffset[0] = theDx; myOffset[1] = theDy; myOffset[2] = theDz; diff --git a/src/VISU_I/VISU_Prs3dUtils.cc b/src/VISU_I/VISU_Prs3dUtils.cc index 60781b56..77675648 100644 --- a/src/VISU_I/VISU_Prs3dUtils.cc +++ b/src/VISU_I/VISU_Prs3dUtils.cc @@ -23,6 +23,8 @@ // Module : VISU // #include "VISU_Prs3dUtils.hh" +#include "VISU_Prs3d_i.hh" +#include "VISU_PointMap3d_i.hh" #include "SalomeApp_Study.h" #include "SALOME_Event.h" @@ -31,8 +33,8 @@ namespace VISU { //---------------------------------------------------------------------------- TSetModified - ::TSetModified(VISU::Prs3d_i* thePrs3d): - myPrs3d(thePrs3d) + ::TSetModified(VISU::PrsObject_i* thePrsObject): + myPrsObject(thePrsObject) { this->Modified(); } @@ -53,17 +55,29 @@ namespace VISU void Execute() { - VISU::Prs3d_i* aPrs3d = mySetModified->myPrs3d; - - if(!aPrs3d || aPrs3d->GetActorEntry() == "") - return; + VISU::PrsObject_i* aPrsObject = mySetModified->myPrsObject; + if(!aPrsObject) + return; + + VISU::Prs3d_i* aPrs3d; + VISU::PointMap3d_i* aPntMap; + SalomeApp_Study* aStudy; + unsigned long int time; + if( (aPrs3d = dynamic_cast(aPrsObject)) && aPrs3d->GetActorEntry() != "" ) { + aStudy = aPrs3d->GetGUIStudy(); + time = aPrs3d->GetMTime(); + } else if ( aPntMap = dynamic_cast(aPrsObject) ) { + aStudy = aPntMap->GetGUIStudy(); + time = aPntMap->GetMTime(); + } else + return; - if(aPrs3d->GetMTime() > mySetModified->GetMTime()){ - if(SalomeApp_Study* aStudy = aPrs3d->GetGUIStudy()) + if(time > mySetModified->GetMTime()){ + if(aStudy) aStudy->Modified(); } - } - }; + } + }; ProcessVoidEvent(new TEvent(this)); } diff --git a/src/VISU_I/VISU_Prs3dUtils.hh b/src/VISU_I/VISU_Prs3dUtils.hh index 13d3abb1..51d32575 100644 --- a/src/VISU_I/VISU_Prs3dUtils.hh +++ b/src/VISU_I/VISU_Prs3dUtils.hh @@ -25,7 +25,7 @@ #ifndef __VISU_PRS3D_UTILS_H__ #define __VISU_PRS3D_UTILS_H__ -#include "VISU_Prs3d_i.hh" +#include "VISU_PrsObject_i.hh" #include @@ -34,16 +34,16 @@ namespace VISU //---------------------------------------------------------------------------- struct TSetModified: vtkTimeStamp { - VISU::Prs3d_i* myPrs3d; + VISU::PrsObject_i* myPrsObject; - TSetModified(VISU::Prs3d_i* thePrs3d); + TSetModified(VISU::PrsObject_i* thePrsObject); ~TSetModified(); }; - - Standard_EXPORT std::string ToFormat( const int thePrec ); - Standard_EXPORT int ToPrecision( const char* theFormat ); - + + VISU_I_EXPORT std::string ToFormat( const int thePrec ); + VISU_I_EXPORT int ToPrecision( const char* theFormat ); + //---------------------------------------------------------------------------- } diff --git a/src/VISU_I/VISU_Prs3d_i.cc b/src/VISU_I/VISU_Prs3d_i.cc index 2ad74b32..b66b023e 100644 --- a/src/VISU_I/VISU_Prs3d_i.cc +++ b/src/VISU_I/VISU_Prs3d_i.cc @@ -675,6 +675,7 @@ void VISU::Prs3d_i ::SetOffset(const CORBA::Float* theOffsets) { + VISU::TSetModified aModified(this); myOffset[0] = theOffsets[0]; myOffset[1] = theOffsets[1]; myOffset[2] = theOffsets[2]; @@ -688,6 +689,7 @@ VISU::Prs3d_i CORBA::Float theDy, CORBA::Float theDz) { + VISU::TSetModified aModified(this); myOffset[0] = theDx; myOffset[1] = theDy; myOffset[2] = theDz; diff --git a/src/VISU_I/VISU_TimeAnimation.cxx b/src/VISU_I/VISU_TimeAnimation.cxx index 24d6ffae..497166a3 100644 --- a/src/VISU_I/VISU_TimeAnimation.cxx +++ b/src/VISU_I/VISU_TimeAnimation.cxx @@ -1500,24 +1500,31 @@ void VISU_TimeAnimation::run() // add missing files if (anIndexList.count() > 1) { - QString aFFile = aDirPath + QDir::separator() + aBaseName; + QString aFFile = aDirPath + "/" + aBaseName; aFFile += QString("_%1.jpeg"); int aStartIndex = anIndexList[0], anEndIndex; for (int i = 1; i < anIndexList.count(); i++) { anEndIndex = anIndexList[i]; QString aCurFile = aFFile.arg(QString::number(aStartIndex).rightJustified(8, '0')); QStringList aCommands; + QString aSeparator; for (int j = aStartIndex+1; j < anEndIndex; j++) { QString aFile = aFFile.arg(QString::number(j).rightJustified(8, '0')); +#ifndef WIN32 aCommands.append(QString("ln -s %1 %2").arg(aCurFile).arg(aFile)); + aSeparator = QString(" ; \\\n"); +#else + aCommands.append(QString("COPY /Y %1 %2 > NUL").arg(QString(aCurFile).replace("/","\\\\")).arg(QString(aFile).replace("/","\\\\"))); + aSeparator = QString(" & "); +#endif } - system(aCommands.join(" ; \\\n").toLatin1().data()); + system(aCommands.join(aSeparator).toLatin1().data()); aStartIndex = anEndIndex; } } // make AVI file - QString aPattern = aDirPath + QDir::separator() + aBaseName; + QString aPattern = aDirPath + "/" + aBaseName; aPattern += "_\%08d.jpeg"; QString aCmd = myAVIMaker; @@ -1526,18 +1533,29 @@ void VISU_TimeAnimation::run() aCmd += QString(" -f %1").arg(aFPS); // aCmd += QString(" -n %1").arg(aNbFiles); aCmd += QString(" -n %1").arg(myFileIndex+1); - aCmd += QString(" -j %1").arg(aPattern); + aCmd += QString(" -j \"%1\"").arg(aPattern); aCmd += " | yuv2lav"; - aCmd += QString(" -o %1").arg(myDumpPath); + aCmd += QString(" -o \"%1\"").arg(myDumpPath); + #ifdef WIN32 + aCmd += " -f aA"; + #endif system(aCmd.toLatin1().data()); // remove temporary jpeg files +#ifndef WIN32 aCmd = "( "; aCmd += QString("cd %1").arg(aDirPath); aCmd += "; ls"; aCmd += QString(" | egrep '%1_[0-9]*.jpeg'").arg(aBaseName); aCmd += " | xargs rm"; aCmd += " )"; +#else + QString tmpFile = QString("_") + aBaseName + "_tempfile"; + QString diskName = aDirPath.split("/")[0]; + aCmd = diskName + " && (cd " + aDirPath.replace("/","\\\\") + + " && ((dir /b | findstr " + aBaseName + "_[0-9]*.jpeg > " + tmpFile + + ") & (for /f %i in (" + tmpFile + ") do (del \"%i\")) & (del " + tmpFile + "))) > NUL"; +#endif system(aCmd.toLatin1().data()); } @@ -1683,9 +1701,12 @@ bool VISU_TimeAnimation::checkAVIMaker() const aDumpFormats.indexOf("jpeg") < 0) return false; - QString aCmd("which "); - aCmd += myAVIMaker; - aCmd += " 2> /dev/null"; + QString aCmd; +#ifndef WIN32 + aCmd = "which " + myAVIMaker + " 2> /dev/null"; +#else + aCmd = "setlocal & set P2=.;%PATH% & (for %e in (%PATHEXT%) do @for %i in (" + myAVIMaker + "%e) do @if NOT \"%~$P2:i\"==\"\" exit /b 0) & exit /b 1"; +#endif int iErr = system(aCmd.toLatin1().data()); return (iErr == 0); }