From: ouv Date: Mon, 19 Jun 2006 10:23:07 +0000 (+0000) Subject: Merging from BR_DEBUG_3_2_0b1 X-Git-Tag: mergefrom_HEAD_06Jun06~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4f85823a59c6349daef840de471e2b5687d3f0a0;p=modules%2Fvisu.git Merging from BR_DEBUG_3_2_0b1 --- diff --git a/src/PIPELINE/VISU_GaussPointsPL.cxx b/src/PIPELINE/VISU_GaussPointsPL.cxx index 9ef8be91..3ffc7564 100644 --- a/src/PIPELINE/VISU_GaussPointsPL.cxx +++ b/src/PIPELINE/VISU_GaussPointsPL.cxx @@ -196,7 +196,6 @@ VISU_GaussPointsPL Superclass::Init(); vtkDataSet* aDataSet = GetParentMesh(); - vtkFloatingPointType aScaleFactor = VISU_DeformedShapePL::GetScaleFactor( aDataSet ); vtkFloatingPointType* aScalarRange = GetScalarRange(); diff --git a/src/PIPELINE/VISU_ImplicitFunctionWidget.hxx b/src/PIPELINE/VISU_ImplicitFunctionWidget.hxx index 9302f044..55632fd5 100644 --- a/src/PIPELINE/VISU_ImplicitFunctionWidget.hxx +++ b/src/PIPELINE/VISU_ImplicitFunctionWidget.hxx @@ -33,6 +33,8 @@ #include "VISUPipeline.hxx" +#include "VTKViewer.h" + class VISU_UnScaledActor: public vtkFollower { diff --git a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx index 4bd9a959..9e4f8d8e 100755 --- a/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx +++ b/src/PIPELINE/VISU_OpenGLPointSpriteMapper.cxx @@ -767,7 +767,7 @@ void VISU_OpenGLPointSpriteMapper::DrawPoints(vtkPoints *thePoints, aVertex.vy = aCoords[1]; aVertex.vz = aCoords[2]; - int aRed, aGreen, aBlue; + int aRed = 0, aGreen = 0, aBlue = 0; if( theColors && this->PointSpriteMode != 1 ) { unsigned char *col = theColors->GetPointer(pts[0] << 2); diff --git a/src/PIPELINE/VISU_PipeLineUtils.hxx b/src/PIPELINE/VISU_PipeLineUtils.hxx index dcf331ec..4f87eaea 100644 --- a/src/PIPELINE/VISU_PipeLineUtils.hxx +++ b/src/PIPELINE/VISU_PipeLineUtils.hxx @@ -56,9 +56,17 @@ #endif -namespace VISU{ - VISU_PIPELINE_EXPORT void Mul(const float A[3], float b, float C[3]); // C = A * b - VISU_PIPELINE_EXPORT void Sub(const float A[3], const float B[3], float C[3]); // C = A - B +namespace VISU +{ + void + Mul(const vtkFloatingPointType A[3], + vtkFloatingPointType b, + vtkFloatingPointType C[3]); // C = A * b + + void + Sub(const vtkFloatingPointType A[3], + const vtkFloatingPointType B[3], + vtkFloatingPointType C[3]); // C = A - B template void diff --git a/src/PIPELINE/VISU_Plot3DPL.cxx b/src/PIPELINE/VISU_Plot3DPL.cxx index 164d9a7a..2b87e56f 100644 --- a/src/PIPELINE/VISU_Plot3DPL.cxx +++ b/src/PIPELINE/VISU_Plot3DPL.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File: VISU_PipeLine.cxx @@ -86,9 +86,9 @@ GetOrientation(vtkDataSet* theDataSet) { theDataSet->Update(); - float aBounds[6]; + vtkFloatingPointType aBounds[6]; theDataSet->GetBounds(aBounds); - float aDelta[3] = {aBounds[1] - aBounds[0], aBounds[3] - aBounds[2], aBounds[5] - aBounds[4]}; + vtkFloatingPointType aDelta[3] = {aBounds[1] - aBounds[0], aBounds[3] - aBounds[2], aBounds[5] - aBounds[4]}; if(aDelta[0] >= aDelta[1] && aDelta[0] >= aDelta[2]) if(aDelta[1] >= aDelta[2]) @@ -111,18 +111,18 @@ GetOrientation(vtkDataSet* theDataSet) return VISU_CutPlanesPL::XY; } -float +vtkFloatingPointType VISU_Plot3DPL:: GetScaleFactor(vtkDataSet* theDataSet) { theDataSet->Update(); - float aLength = theDataSet->GetLength(); // diagonal length + vtkFloatingPointType aLength = theDataSet->GetLength(); // diagonal length - float aScalarRange[2]; + vtkFloatingPointType aScalarRange[2]; GetSourceRange(aScalarRange); - static float EPS = 0.3; - float aRange = aScalarRange[1]; + static vtkFloatingPointType EPS = 0.3; + vtkFloatingPointType aRange = aScalarRange[1]; if(aRange > 0.0) return aLength / aRange * EPS; @@ -150,8 +150,8 @@ void VISU_Plot3DPL:: Update() { - float aPlaneNormal[3]; - float anOrigin[3]; + vtkFloatingPointType aPlaneNormal[3]; + vtkFloatingPointType anOrigin[3]; GetBasePlane( anOrigin, aPlaneNormal ); vtkPolyData* aPolyData = 0; @@ -198,7 +198,7 @@ Update() }else myContourFilter->SetInput(aPolyData); - float aScalarRange[2]; + vtkFloatingPointType aScalarRange[2]; GetSourceRange(aScalarRange); myContourFilter->GenerateValues(GetNumberOfContours(),aScalarRange); @@ -232,13 +232,13 @@ GetNumberOfContours() const void VISU_Plot3DPL:: -SetScaleFactor(float theScaleFactor) +SetScaleFactor(vtkFloatingPointType theScaleFactor) { myScaleFactor = theScaleFactor; myWarpScalar->SetScaleFactor(theScaleFactor); } -float +vtkFloatingPointType VISU_Plot3DPL:: GetScaleFactor() const { @@ -247,7 +247,7 @@ GetScaleFactor() const void VISU_Plot3DPL:: -SetPlanePosition(float thePosition, +SetPlanePosition(vtkFloatingPointType thePosition, bool theIsRelative) { myIsRelative = theIsRelative; @@ -269,7 +269,7 @@ GetPlaneOrientation() const } -float +vtkFloatingPointType VISU_Plot3DPL:: GetRotateX() { @@ -281,7 +281,7 @@ GetRotateX() return 0; } -float +vtkFloatingPointType VISU_Plot3DPL:: GetRotateY(){ switch(myOrientation){ @@ -295,8 +295,8 @@ GetRotateY(){ void VISU_Plot3DPL:: SetOrientation(VISU_CutPlanesPL::PlaneOrientation theOrientation, - float theXAngle, - float theYAngle) + vtkFloatingPointType theXAngle, + vtkFloatingPointType theYAngle) { switch(theOrientation){ case VISU_CutPlanesPL::XY: myAngle[0] = theXAngle; break; @@ -311,7 +311,7 @@ SetOrientation(VISU_CutPlanesPL::PlaneOrientation theOrientation, myOrientation = theOrientation; } -float +vtkFloatingPointType VISU_Plot3DPL:: GetPlanePosition() const { @@ -323,14 +323,14 @@ GetPlanePosition() const //purpose : //======================================================================= -void VISU_Plot3DPL::GetBasePlane(float theOrigin[3], - float theNormal[3], +void VISU_Plot3DPL::GetBasePlane(vtkFloatingPointType theOrigin[3], + vtkFloatingPointType theNormal[3], bool theCenterOrigine ) const { VISU_CutPlanesPL::GetDir(theNormal,myAngle,myOrientation); - float aPosition = myPosition; - float aBounds[6], aBoundPrj[3]; + vtkFloatingPointType aPosition = myPosition; + vtkFloatingPointType aBounds[6], aBoundPrj[3]; if ( myIsRelative ) { GetInput()->GetBounds(aBounds); @@ -342,7 +342,7 @@ void VISU_Plot3DPL::GetBasePlane(float theOrigin[3], if ( theCenterOrigine ) { // move theOrigin to the center of aBounds projections to the plane GetInput2()->GetBounds(aBounds); - float boundPoints[8][3] = { + vtkFloatingPointType boundPoints[8][3] = { {aBounds[0],aBounds[2],aBounds[4]}, {aBounds[1],aBounds[2],aBounds[4]}, {aBounds[0],aBounds[3],aBounds[4]}, @@ -351,9 +351,9 @@ void VISU_Plot3DPL::GetBasePlane(float theOrigin[3], {aBounds[1],aBounds[2],aBounds[5]}, {aBounds[0],aBounds[3],aBounds[5]}, {aBounds[1],aBounds[3],aBounds[5]}}; - float newOrigin[3] = { 0,0,0 }; + vtkFloatingPointType newOrigin[3] = { 0,0,0 }; for(int i = 0; i < 8; i++) { - float proj[3]; + vtkFloatingPointType proj[3]; vtkPlane::ProjectPoint( boundPoints[i], theOrigin, theNormal, proj ); newOrigin[0] += proj[0]; newOrigin[1] += proj[1]; @@ -370,9 +370,10 @@ void VISU_Plot3DPL::GetBasePlane(float theOrigin[3], //purpose : return absolute position range //======================================================================= -void VISU_Plot3DPL::GetMinMaxPosition( float& minPos, float& maxPos ) const +void VISU_Plot3DPL::GetMinMaxPosition( vtkFloatingPointType& minPos, + vtkFloatingPointType& maxPos ) const { - float aBounds[6], aBoundPrj[3], aNormal[3]; + vtkFloatingPointType aBounds[6], aBoundPrj[3], aNormal[3]; VISU_CutPlanesPL::GetDir(aNormal,myAngle,myOrientation); GetInput()->GetBounds(aBounds); VISU_CutPlanesPL::GetBoundProject(aBoundPrj,aBounds,aNormal); @@ -385,14 +386,14 @@ void VISU_Plot3DPL::GetMinMaxPosition( float& minPos, float& maxPos ) const //purpose : //======================================================================= -void VISU_Plot3DPL::SetMapScale(float theMapScale) +void VISU_Plot3DPL::SetMapScale(vtkFloatingPointType theMapScale) { VISU_ScalarMapPL::SetMapScale(theMapScale); if ( myIsContour ) { - float aRange[2]; + vtkFloatingPointType aRange[2]; GetSourceRange(aRange); - float aNewRange[] = { aRange[1] - theMapScale*(aRange[1]-aRange[0]), aRange[1] }; + vtkFloatingPointType aNewRange[] = { aRange[1] - theMapScale*(aRange[1]-aRange[0]), aRange[1] }; myContourFilter->GenerateValues(GetNumberOfContours(),aNewRange); } myWarpScalar->SetScaleFactor(myScaleFactor*theMapScale); diff --git a/src/PIPELINE/VISU_Plot3DPL.hxx b/src/PIPELINE/VISU_Plot3DPL.hxx index 0f620c38..d98d7b38 100644 --- a/src/PIPELINE/VISU_Plot3DPL.hxx +++ b/src/PIPELINE/VISU_Plot3DPL.hxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File: VISU_CutPlanesPL.hxx @@ -53,31 +53,31 @@ public: VISU_CutPlanesPL::PlaneOrientation GetPlaneOrientation() const; - float + vtkFloatingPointType GetRotateX(); - float + vtkFloatingPointType GetRotateY(); void SetOrientation(VISU_CutPlanesPL::PlaneOrientation theOrientation, - float theXAngle = 0.0, - float theYAngle = 0.0); + vtkFloatingPointType theXAngle = 0.0, + vtkFloatingPointType theYAngle = 0.0); - float + vtkFloatingPointType GetPlanePosition() const; bool IsPositionRelative() const; void - SetPlanePosition(float thePosition, + SetPlanePosition(vtkFloatingPointType thePosition, bool theIsRelative); void - SetScaleFactor(float theScaleFactor); + SetScaleFactor(vtkFloatingPointType theScaleFactor); - float + vtkFloatingPointType GetScaleFactor() const; void @@ -92,11 +92,12 @@ public: int GetNumberOfContours() const; - void GetBasePlane (float theOrigin[3], - float theNormal[3], + void GetBasePlane (vtkFloatingPointType theOrigin[3], + vtkFloatingPointType theNormal[3], bool theCenterOrigine = false ) const; - void GetMinMaxPosition( float& minPos, float& maxPos ) const; + void GetMinMaxPosition( vtkFloatingPointType& minPos, + vtkFloatingPointType& maxPos ) const; public: virtual void Init(); @@ -106,17 +107,17 @@ public: VISU_CutPlanesPL::PlaneOrientation GetOrientation(vtkDataSet* theDataSet); - float + vtkFloatingPointType GetScaleFactor(vtkDataSet* theDataSet); - void SetMapScale(float theMapScale); + void SetMapScale(vtkFloatingPointType theMapScale); protected: virtual THook* DoHook(); - float myAngle[3]; + vtkFloatingPointType myAngle[3]; bool myIsRelative, myIsContour; - float myPosition, myScaleFactor; + vtkFloatingPointType myPosition, myScaleFactor; VISU_CutPlanesPL::PlaneOrientation myOrientation; TVTKSmartPtr myCellDataToPointData; diff --git a/src/PIPELINE/VISU_ScalarBarActor.cxx b/src/PIPELINE/VISU_ScalarBarActor.cxx index 9c503ace..058f3025 100644 --- a/src/PIPELINE/VISU_ScalarBarActor.cxx +++ b/src/PIPELINE/VISU_ScalarBarActor.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File: VISU_PipeLine.hxx @@ -258,7 +258,7 @@ int VISU_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport) // we hard code how many steps to display int numColors = this->MaximumNumberOfColors; - float *range = lut->GetRange(); + vtkFloatingPointType *range = lut->GetRange(); int numPts = 2*(numColors + 1); vtkPoints *pts = vtkPoints::New(); @@ -315,13 +315,13 @@ int VISU_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport) this->NumberOfLabelsBuilt = this->NumberOfLabels; // generate points - float x[3]; x[2] = 0.0; - float delta, val; + vtkFloatingPointType x[3]; x[2] = 0.0; + vtkFloatingPointType delta, val; if ( this->Orientation == VTK_ORIENT_VERTICAL ) { barWidth = size[0] - 4 - labelSize[0]; barHeight = (int)(0.86*size[1]); - delta=(float)barHeight/numColors; + delta=(vtkFloatingPointType)barHeight/numColors; for (i=0; iInsertNextCell(4,ptIds); if ( isLogTable ){ //SALOME specific - float rgbval = log10(range[0]) + + vtkFloatingPointType rgbval = log10(range[0]) + i*(log10(range[1])-log10(range[0]))/(numColors -1); rgba = lut->MapValue(rgbval); }else{ rgba = lut->MapValue(range[0] + (range[1] - range[0])* - ((float)i /(numColors-1.0))); + ((vtkFloatingPointType)i /(numColors-1.0))); } rgb = colors->GetPointer(3*i); //write into array directly @@ -383,7 +383,7 @@ int VISU_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport) for (i=0; i < this->NumberOfLabels; i++) { - val = (float)i/(this->NumberOfLabels-1) *barHeight; + val = (vtkFloatingPointType)i/(this->NumberOfLabels-1) *barHeight; this->TextMappers[i]->GetSize(viewport,sizeTextData); this->TextMappers[i]->GetTextProperty()->SetJustificationToLeft(); this->TextActors[i]->SetPosition(barWidth+3, @@ -397,7 +397,7 @@ int VISU_ScalarBarActor::RenderOpaqueGeometry(vtkViewport *viewport) for (i=0; i < this->NumberOfLabels; i++) { this->TextMappers[i]->GetTextProperty()->SetJustificationToCentered(); - val = (float)i/(this->NumberOfLabels-1) * barWidth; + val = (vtkFloatingPointType)i/(this->NumberOfLabels-1) * barWidth; this->TextActors[i]->SetPosition(val, barHeight + 0.05*size[1]); } } @@ -503,7 +503,7 @@ void VISU_ScalarBarActor::ShallowCopy(vtkProp *prop) void VISU_ScalarBarActor::AllocateAndSizeLabels(int *labelSize, int *size, vtkViewport *viewport, - float *range) + vtkFloatingPointType *range) { labelSize[0] = labelSize[1] = 0; @@ -512,7 +512,7 @@ void VISU_ScalarBarActor::AllocateAndSizeLabels(int *labelSize, int *size, char string[512]; - float val; + vtkFloatingPointType val; int i; // TODO: this should be optimized, maybe by keeping a list of @@ -529,11 +529,11 @@ void VISU_ScalarBarActor::AllocateAndSizeLabels(int *labelSize, int *size, this->TextMappers[i] = vtkTextMapper::New(); if(isLogTable && 0 < i && i < this->NumberOfLabels - 1){ // SALOME specific - float lval = log10(range[0]) + (float)i/(this->NumberOfLabels-1) * + vtkFloatingPointType lval = log10(range[0]) + (vtkFloatingPointType)i/(this->NumberOfLabels-1) * (log10(range[1])-log10(range[0])); val = pow((double)10,(double)lval); }else{ - val = range[0] + (float)i/(this->NumberOfLabels-1) * (range[1]-range[0]); + val = range[0] + (vtkFloatingPointType)i/(this->NumberOfLabels-1) * (range[1]-range[0]); } sprintf(string, this->LabelFormat, val); this->TextMappers[i]->SetInput(string); diff --git a/src/PIPELINE/VISU_ScalarBarActor.hxx b/src/PIPELINE/VISU_ScalarBarActor.hxx index dfaaf137..598f70ae 100644 --- a/src/PIPELINE/VISU_ScalarBarActor.hxx +++ b/src/PIPELINE/VISU_ScalarBarActor.hxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File: VISU_PipeLine.hxx @@ -139,7 +139,7 @@ protected: vtkTextMapper **TextMappers; virtual void AllocateAndSizeLabels(int *labelSize, int *size, - vtkViewport *viewport, float *range); + vtkViewport *viewport, vtkFloatingPointType *range); private: vtkTextMapper *TitleMapper; diff --git a/src/PIPELINE/VISU_ScalarBarCtrl.cxx b/src/PIPELINE/VISU_ScalarBarCtrl.cxx index 561b2432..624159f5 100644 --- a/src/PIPELINE/VISU_ScalarBarCtrl.cxx +++ b/src/PIPELINE/VISU_ScalarBarCtrl.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File: VISU_ScalarBarCtrl.cxx @@ -45,7 +45,7 @@ namespace inline void MarkValueByColor(vtkLookupTable* theTable, - float theValue, + vtkFloatingPointType theValue, unsigned char* theColor) { vtkIdType anIndex = theTable->GetIndex(theValue); @@ -81,12 +81,12 @@ namespace unsigned char aRedPtr[3] = {255, 0, 0}; unsigned char aBluePtr[3] = {0, 0, 255}; - float aRange[2]; + vtkFloatingPointType aRange[2]; theTable->GetTableRange(aRange); vtkIdType aNbColors = theTable->GetNumberOfColors(); - float aDelta = (aRange[1]-aRange[0])/aNbColors; - float aValue = aRange[0]+0.5*aDelta; + vtkFloatingPointType aDelta = (aRange[1]-aRange[0])/aNbColors; + vtkFloatingPointType aValue = aRange[0]+0.5*aDelta; for(int i = 0; i < aNbColors; i++){ vtkIdType anIndex = theTable->GetIndex(aValue); unsigned char* aTablePtr = theTable->GetPointer(anIndex); @@ -206,15 +206,15 @@ VISU_ScalarBarCtrl //---------------------------------------------------------------------------- void VISU_ScalarBarCtrl -::SetRangeLocal(float *theRange) +::SetRangeLocal(vtkFloatingPointType *theRange) { myLocalLookupTable->SetTableRange(theRange); } void VISU_ScalarBarCtrl -::SetRangeLocal(float theMin, - float theMax) +::SetRangeLocal(vtkFloatingPointType theMin, + vtkFloatingPointType theMax) { myLocalLookupTable->SetTableRange(theMin,theMax); } @@ -223,15 +223,15 @@ VISU_ScalarBarCtrl //---------------------------------------------------------------------------- void VISU_ScalarBarCtrl -::SetRangeGlobal(float *theRange) +::SetRangeGlobal(vtkFloatingPointType *theRange) { myGlobalLookupTable->SetTableRange(theRange); } void VISU_ScalarBarCtrl -::SetRangeGlobal(float theMin, - float theMax) +::SetRangeGlobal(vtkFloatingPointType theMin, + vtkFloatingPointType theMax) { myGlobalLookupTable->SetTableRange(theMin,theMax); } @@ -298,13 +298,13 @@ VISU_ScalarBarCtrl //---------------------------------------------------------------------------- void VISU_ScalarBarCtrl -::SetWidth(float theWidth) +::SetWidth(vtkFloatingPointType theWidth) { myGlobalScalarBar->SetWidth(theWidth); myLocalScalarBar->SetWidth(theWidth); } -float +vtkFloatingPointType VISU_ScalarBarCtrl ::GetWidth() const { @@ -315,14 +315,14 @@ VISU_ScalarBarCtrl //---------------------------------------------------------------------------- void VISU_ScalarBarCtrl -::SetHeight(float theHeight) +::SetHeight(vtkFloatingPointType theHeight) { myGlobalScalarBar->SetHeight(theHeight); myLocalScalarBar->SetHeight(theHeight); } -float +vtkFloatingPointType VISU_ScalarBarCtrl ::GetHeight() const { @@ -333,13 +333,13 @@ VISU_ScalarBarCtrl //---------------------------------------------------------------------------- void VISU_ScalarBarCtrl -::SetPosition(const float* thePosition) +::SetPosition(const vtkFloatingPointType* thePosition) { myPosition[0] = thePosition[0]; myPosition[1] = thePosition[1]; } -const float* +const vtkFloatingPointType* VISU_ScalarBarCtrl::GetPosition() const { return myPosition; @@ -349,12 +349,12 @@ VISU_ScalarBarCtrl::GetPosition() const //---------------------------------------------------------------------------- void VISU_ScalarBarCtrl -::SetSpacing(const float theSpacing) +::SetSpacing(const vtkFloatingPointType theSpacing) { myDistance = theSpacing; } -float +vtkFloatingPointType VISU_ScalarBarCtrl ::GetSpacing() const { @@ -381,12 +381,12 @@ VISU_ScalarBarCtrl //---------------------------------------------------------------------------- void VISU_ScalarBarCtrl -::SetMarkValue(const float theValue) +::SetMarkValue(const vtkFloatingPointType theValue) { myMarkedValue = theValue; } -float +vtkFloatingPointType VISU_ScalarBarCtrl ::GetMarkValue() const { @@ -441,7 +441,7 @@ VISU_ScalarBarCtrl } } if(myGlobalRangeIsDefined){ - float aLocalRange[2]; + vtkFloatingPointType aLocalRange[2]; myLocalLookupTable->GetTableRange(aLocalRange); MarkValueByColor(myGlobalLookupTable, aLocalRange[0], myBlack); MarkValueByColor(myGlobalLookupTable, aLocalRange[1], myBlack); @@ -459,10 +459,10 @@ VISU_ScalarBarCtrl vtkCoordinate * aCoordinate = theScalarBarActor->GetPositionCoordinate(); aCoordinate->SetCoordinateSystemToNormalizedViewport(); if(theScalarBarActor->GetOrientation() == VTK_ORIENT_VERTICAL){ - float aWidth = theScalarBarActor->GetWidth(); + vtkFloatingPointType aWidth = theScalarBarActor->GetWidth(); aCoordinate->SetValue(myPosition[0]+theId*(aWidth+myDistance), myPosition[1]); }else{ - float aHeight = theScalarBarActor->GetHeight(); + vtkFloatingPointType aHeight = theScalarBarActor->GetHeight(); aCoordinate->SetValue(myPosition[0], myPosition[1]+theId*(aHeight+myDistance)); } // Initialize Lookup Tables and Scalar Bars diff --git a/src/PIPELINE/VISU_ScalarBarCtrl.hxx b/src/PIPELINE/VISU_ScalarBarCtrl.hxx index 2d8387bf..17f75414 100644 --- a/src/PIPELINE/VISU_ScalarBarCtrl.hxx +++ b/src/PIPELINE/VISU_ScalarBarCtrl.hxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File: VISU_ScalarBarCtrl.hxx @@ -31,6 +31,8 @@ #include +#include "VTKViewer.h" + class vtkRenderer; class vtkLookupTable; class vtkScalarBarActor; @@ -39,88 +41,147 @@ class VISU_PIPELINE_EXPORT VISU_ScalarBarCtrl : public vtkObject { public: vtkTypeMacro(VISU_ScalarBarCtrl, vtkObject); - static VISU_ScalarBarCtrl* New(); + static + VISU_ScalarBarCtrl* + New(); enum EMode {eSimple, eGlobal, eLocal}; // Mode - void SetMode(EMode theMode); - EMode GetMode() const; + void + SetMode(EMode theMode); + + EMode + GetMode() const; // Ranges - void SetRangeGlobal(float theMin, - float theMax); - void SetRangeGlobal(float *theRange); + void + SetRangeGlobal(vtkFloatingPointType theMin, + vtkFloatingPointType theMax); + void + SetRangeGlobal(vtkFloatingPointType *theRange); - void SetGlobalRangeIsDefined(bool theIsDefined); + void + SetGlobalRangeIsDefined(bool theIsDefined); - void SetRangeLocal(float theMin, - float theMax); - void SetRangeLocal(float *theRange); + void + SetRangeLocal(vtkFloatingPointType theMin, + vtkFloatingPointType theMax); + void + SetRangeLocal(vtkFloatingPointType *theRange); // Selectors - vtkScalarBarActor* GetLocalBar(); - vtkLookupTable* GetLocalTable(); + vtkScalarBarActor* + GetLocalBar(); + + vtkLookupTable* + GetLocalTable(); + + vtkScalarBarActor* + GetGlobalBar(); - vtkScalarBarActor* GetGlobalBar(); - vtkLookupTable* GetGlobalTable(); + vtkLookupTable* + GetGlobalTable(); // // Renderer - void AddToRender(vtkRenderer* theRenderer); - void RemoveFromRender(vtkRenderer* theRenderer); + void + AddToRender(vtkRenderer* theRenderer); + + void + RemoveFromRender(vtkRenderer* theRenderer); // // Visibility - void SetVisibility(int theFlag); - int GetVisibility() const; - // + void + SetVisibility(int theFlag); + + int + GetVisibility() const; + // Visibility - void SetCtrlVisibility(int theFlag); - int GetCtrlVisibility() const; - // + void + SetCtrlVisibility(int theFlag); + + int + GetCtrlVisibility() const; + // Build void Update(); - // + // Position - void SetWidth(const float theWidth); - float GetWidth()const; - void SetHeight(const float theHeight); - float GetHeight()const; - void SetPosition(const float* thePosition); - const float* GetPosition()const; + void + SetWidth(const vtkFloatingPointType theWidth); + + vtkFloatingPointType + GetWidth() const; + + void + SetHeight(const vtkFloatingPointType theHeight); + + vtkFloatingPointType + GetHeight() const; + + void + SetPosition(const vtkFloatingPointType* thePosition); + + const vtkFloatingPointType* + GetPosition() const; // // Spacing - void SetSpacing(const float theSpacing); - float GetSpacing()const; + void + SetSpacing(const vtkFloatingPointType theSpacing); + + vtkFloatingPointType + GetSpacing() const; // // Rainbow/bicolor - bool GetBicolor() const; - void SetBicolor(const bool theBicolor); + bool + GetBicolor() const; + + void + SetBicolor(const bool theBicolor); // // Misc - void SetMarkValue (const float theValue); - float GetMarkValue ()const; - void SetIsMarked(const bool theFlag); - bool GetIsMarked()const; + void + SetMarkValue(const vtkFloatingPointType theValue); + + vtkFloatingPointType + GetMarkValue() const; + + void + SetIsMarked(const bool theFlag); + + bool + GetIsMarked()const; // protected: VISU_ScalarBarCtrl(); - virtual ~VISU_ScalarBarCtrl(); + + virtual + ~VISU_ScalarBarCtrl(); - void UpdateForBicolor(); - void UpdateForColor(); - void UpdateMarkValue(); - void PrepareTables(); + void + UpdateForBicolor(); + + void + UpdateForColor(); + + void + UpdateMarkValue(); + + void + PrepareTables(); - void PrepareTables(vtkScalarBarActor* theScalarBarActor, - vtkLookupTable *theLookupTable, - vtkIdType theId); + void + PrepareTables(vtkScalarBarActor* theScalarBarActor, + vtkLookupTable *theLookupTable, + vtkIdType theId); protected: EMode myMode; bool myGlobalRangeIsDefined; - float myDistance; - float myPosition[2]; + vtkFloatingPointType myDistance; + vtkFloatingPointType myPosition[2]; bool myBicolor; int myCtrlVisibility; @@ -128,7 +189,7 @@ protected: unsigned char myGrey[3]; // bool myMarked; - float myMarkedValue; + vtkFloatingPointType myMarkedValue; // vtkScalarBarActor *myGlobalScalarBar; vtkLookupTable *myGlobalLookupTable; diff --git a/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx b/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx index 0d0ccad5..14412af8 100644 --- a/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx +++ b/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File: VISU_ScalarMapOnDeformedShapePL.cxx @@ -48,7 +48,9 @@ vtkStandardNewMacro(VISU_ScalarMapOnDeformedShapePL) * Merge filter which unify the deformation and scalars * \li myScalars is vtk shared pointer to vtkUnstructuredGrid - scalars data */ -VISU_ScalarMapOnDeformedShapePL::VISU_ScalarMapOnDeformedShapePL(){ +VISU_ScalarMapOnDeformedShapePL +::VISU_ScalarMapOnDeformedShapePL() +{ myDeformVectors = vtkWarpVector::New(); myMergeFilter = vtkMergeFilter::New(); myExtractorScalars = VISU_Extractor::New(); @@ -59,7 +61,9 @@ VISU_ScalarMapOnDeformedShapePL::VISU_ScalarMapOnDeformedShapePL(){ * Destructor. * Delete all fields. */ -VISU_ScalarMapOnDeformedShapePL::~VISU_ScalarMapOnDeformedShapePL(){ +VISU_ScalarMapOnDeformedShapePL +::~VISU_ScalarMapOnDeformedShapePL() +{ myDeformVectors->UnRegisterAllOutputs(); myDeformVectors->Delete(); @@ -76,13 +80,15 @@ VISU_ScalarMapOnDeformedShapePL::~VISU_ScalarMapOnDeformedShapePL(){ /*! * Initial method */ -void VISU_ScalarMapOnDeformedShapePL::Init(){ - +void +VISU_ScalarMapOnDeformedShapePL +::Init() +{ if (GetScalars() == NULL) SetScalars(GetInput2()); Superclass::Init(); - float aScalarRange[2]; + vtkFloatingPointType aScalarRange[2]; GetSourceRange(aScalarRange); static double EPS = 1.0 / VTK_LARGE_FLOAT; if(aScalarRange[1] > EPS) @@ -102,7 +108,9 @@ void VISU_ScalarMapOnDeformedShapePL::Init(){ * Build method * Building of deformation and puts result to merge filter. */ -void VISU_ScalarMapOnDeformedShapePL::Build() +void +VISU_ScalarMapOnDeformedShapePL +::Build() { // Set input for extractor myExtractor->SetInput(GetInput2()); @@ -119,12 +127,15 @@ void VISU_ScalarMapOnDeformedShapePL::Build() /*! * Update method */ -void VISU_ScalarMapOnDeformedShapePL::Update(){ +void +VISU_ScalarMapOnDeformedShapePL +::Update() +{ this->UpdateScalars(); - float aRange[2]; + vtkFloatingPointType aRange[2]; GetSourceRange(aRange); - float aScalarRange[2] = {aRange[0], aRange[1]}; + vtkFloatingPointType aScalarRange[2] = {aRange[0], aRange[1]}; if(myBarTable->GetScale() == VTK_SCALE_LOG10) VISU_LookupTable::ComputeLogRange(aRange,aScalarRange); @@ -143,7 +154,10 @@ void VISU_ScalarMapOnDeformedShapePL::Update(){ * Update scalars method. * Put scalars to merge filter. */ -void VISU_ScalarMapOnDeformedShapePL::UpdateScalars(){ +void +VISU_ScalarMapOnDeformedShapePL +::UpdateScalars() +{ if(myScalars->GetCellData()->GetVectors() != NULL || myScalars->GetPointData()->GetVectors() != NULL) myMergeFilter->SetScalars(myExtractorScalars->GetOutput()); @@ -155,12 +169,15 @@ void VISU_ScalarMapOnDeformedShapePL::UpdateScalars(){ * Copy information about pipline. * Copy scale and scalars. */ -void VISU_ScalarMapOnDeformedShapePL::ShallowCopy(VISU_PipeLine *thePipeLine){ +void +VISU_ScalarMapOnDeformedShapePL +::ShallowCopy(VISU_PipeLine *thePipeLine) +{ VISU_ScalarMapOnDeformedShapePL *aPipeLine = dynamic_cast(thePipeLine); if(aPipeLine){ SetScale(aPipeLine->GetScale()); SetScalars(aPipeLine->GetScalars()); - float aRange[2]; + vtkFloatingPointType aRange[2]; aPipeLine->GetSourceRange(aRange); SetScalarRange(aRange); } @@ -171,7 +188,10 @@ void VISU_ScalarMapOnDeformedShapePL::ShallowCopy(VISU_PipeLine *thePipeLine){ * Set scalars. * Sets vtkDataSet with scalars values to VISU_Extractor filter for scalars extraction. */ -void VISU_ScalarMapOnDeformedShapePL::SetScalars(vtkDataSet *theScalars){ +void +VISU_ScalarMapOnDeformedShapePL +::SetScalars(vtkDataSet *theScalars) +{ myScalars = theScalars; vtkUnstructuredGrid* aScalars = GetScalars(); myExtractorScalars->SetInput(aScalars); @@ -181,14 +201,20 @@ void VISU_ScalarMapOnDeformedShapePL::SetScalars(vtkDataSet *theScalars){ /*! * Get pointer to input scalars. */ -vtkUnstructuredGrid* VISU_ScalarMapOnDeformedShapePL::GetScalars(){ +vtkUnstructuredGrid* +VISU_ScalarMapOnDeformedShapePL +::GetScalars() +{ return myScalars.GetPointer(); } /*! * Sets scale for deformed shape */ -void VISU_ScalarMapOnDeformedShapePL::SetScale(float theScale) { +void +VISU_ScalarMapOnDeformedShapePL +::SetScale(vtkFloatingPointType theScale) +{ if(myScaleFactor == theScale) return; myScaleFactor = theScale; myDeformVectors->SetScaleFactor(myScaleFactor); @@ -198,15 +224,21 @@ void VISU_ScalarMapOnDeformedShapePL::SetScale(float theScale) { /*! * Gets scale of deformed shape. */ -float VISU_ScalarMapOnDeformedShapePL::GetScale() { - float aScale=myDeformVectors->GetScaleFactor(); +vtkFloatingPointType +VISU_ScalarMapOnDeformedShapePL +::GetScale() +{ + vtkFloatingPointType aScale=myDeformVectors->GetScaleFactor(); return aScale; } /*! * Set scale factor of deformation. */ -void VISU_ScalarMapOnDeformedShapePL::SetMapScale(float theMapScale){ +void +VISU_ScalarMapOnDeformedShapePL +::SetMapScale(vtkFloatingPointType theMapScale) +{ myDeformVectors->SetScaleFactor(myScaleFactor*theMapScale); Modified(); } @@ -214,7 +246,10 @@ void VISU_ScalarMapOnDeformedShapePL::SetMapScale(float theMapScale){ /*! * Gets scalar mode. */ -int VISU_ScalarMapOnDeformedShapePL::GetScalarMode(){ +int +VISU_ScalarMapOnDeformedShapePL +::GetScalarMode() +{ int aMode=myExtractorScalars->GetScalarMode(); return aMode; } @@ -222,7 +257,10 @@ int VISU_ScalarMapOnDeformedShapePL::GetScalarMode(){ /*! * Sets scalar mode. */ -void VISU_ScalarMapOnDeformedShapePL::SetScalarMode(int theScalarMode){ +void +VISU_ScalarMapOnDeformedShapePL +::SetScalarMode(int theScalarMode) +{ myExtractorScalars->SetScalarMode(theScalarMode); Modified(); } @@ -233,7 +271,10 @@ void VISU_ScalarMapOnDeformedShapePL::SetScalarMode(int theScalarMode){ * \li theRange[0] - minimum value * \li theRange[1] - maximum value */ -void VISU_ScalarMapOnDeformedShapePL::GetSourceRange(float theRange[2]){ +void +VISU_ScalarMapOnDeformedShapePL +::GetSourceRange(vtkFloatingPointType theRange[2]) +{ myExtractorScalars->Update(); myExtractorScalars->GetUnstructuredGridOutput()->GetScalarRange(theRange); } diff --git a/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx b/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx index 69ecbe0c..797c91d8 100644 --- a/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx +++ b/src/PIPELINE/VISU_ScalarMapOnDeformedShapePL.hxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File: VISU_ScalarMapOnDeformedShapePL.hxx @@ -51,13 +51,13 @@ public: virtual void ShallowCopy(VISU_PipeLine *thePipeLine); - virtual void SetScale(float theScale); - virtual float GetScale(); + virtual void SetScale(vtkFloatingPointType theScale); + virtual vtkFloatingPointType GetScale(); virtual int GetScalarMode(); virtual void SetScalarMode(int theScalarMode = 0); - virtual void GetSourceRange(float theRange[2]); + virtual void GetSourceRange(vtkFloatingPointType theRange[2]); virtual void SetScalars(vtkDataSet *theScalars); virtual vtkUnstructuredGrid* GetScalars(); @@ -82,10 +82,10 @@ public: void UpdateScalars(); - virtual void SetMapScale(float theMapScale = 1.0); + virtual void SetMapScale(vtkFloatingPointType theMapScale = 1.0); protected: - float myScaleFactor; + vtkFloatingPointType myScaleFactor; vtkWarpVector *myDeformVectors; vtkMergeFilter *myMergeFilter; vtkSmartPointer myScalars; diff --git a/src/PIPELINE/VISU_ScalarMapPL.cxx b/src/PIPELINE/VISU_ScalarMapPL.cxx index daaa24e6..0c6b9903 100644 --- a/src/PIPELINE/VISU_ScalarMapPL.cxx +++ b/src/PIPELINE/VISU_ScalarMapPL.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -142,7 +142,7 @@ VISU_ScalarMapPL //---------------------------------------------------------------------------- -float* +vtkFloatingPointType* VISU_ScalarMapPL ::GetScalarRange() { @@ -151,7 +151,7 @@ VISU_ScalarMapPL void VISU_ScalarMapPL -::SetScalarRange(float theRange[2]) +::SetScalarRange(vtkFloatingPointType theRange[2]) { myFieldTransform->SetScalarRange(theRange); myBarTable->SetRange(theRange); @@ -160,17 +160,17 @@ VISU_ScalarMapPL void VISU_ScalarMapPL -::SetScalarMin(float theValue) +::SetScalarMin(vtkFloatingPointType theValue) { - float aScalarRange[2] = {theValue, GetScalarRange()[1]}; + vtkFloatingPointType aScalarRange[2] = {theValue, GetScalarRange()[1]}; SetScalarRange(aScalarRange); } void VISU_ScalarMapPL -::SetScalarMax(float theValue) +::SetScalarMax(vtkFloatingPointType theValue) { - float aScalarRange[2] = {GetScalarRange()[0], theValue}; + vtkFloatingPointType aScalarRange[2] = {GetScalarRange()[0], theValue}; SetScalarRange(aScalarRange); } @@ -224,8 +224,8 @@ void VISU_ScalarMapPL ::Update() { - float *aRange = myFieldTransform->GetScalarRange(); - float aScalarRange[2] = {aRange[0], aRange[1]}; + vtkFloatingPointType *aRange = myFieldTransform->GetScalarRange(); + vtkFloatingPointType aScalarRange[2] = {aRange[0], aRange[1]}; if(myBarTable->GetScale() == VTK_SCALE_LOG10) VISU_LookupTable::ComputeLogRange(aRange,aScalarRange); myMapperTable->SetRange(aScalarRange); @@ -259,13 +259,13 @@ VISU_ScalarMapPL //---------------------------------------------------------------------------- void VISU_ScalarMapPL -::SetMapScale(float theMapScale) +::SetMapScale(vtkFloatingPointType theMapScale) { myMapperTable->SetMapScale(theMapScale); myMapperTable->Build(); } -float +vtkFloatingPointType VISU_ScalarMapPL::GetMapScale() { return myMapperTable->GetMapScale(); @@ -275,7 +275,7 @@ VISU_ScalarMapPL::GetMapScale() //---------------------------------------------------------------------------- void VISU_ScalarMapPL -::GetSourceRange(float theRange[2]) +::GetSourceRange(vtkFloatingPointType theRange[2]) { myExtractor->Update(); myExtractor->GetOutput()->GetScalarRange(theRange); @@ -285,7 +285,7 @@ void VISU_ScalarMapPL ::SetSourceRange() { - float aRange[2]; + vtkFloatingPointType aRange[2]; GetSourceRange(aRange); SetScalarRange(aRange); } diff --git a/src/PIPELINE/VISU_ScalarMapPL.hxx b/src/PIPELINE/VISU_ScalarMapPL.hxx index 0672dbd5..b1b328a1 100644 --- a/src/PIPELINE/VISU_ScalarMapPL.hxx +++ b/src/PIPELINE/VISU_ScalarMapPL.hxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -77,20 +77,20 @@ public: SetScaling(int theScaling = VTK_SCALE_LINEAR); virtual - float* + vtkFloatingPointType* GetScalarRange(); virtual void - SetScalarRange(float theRange[2]); + SetScalarRange(vtkFloatingPointType theRange[2]); virtual void - SetScalarMin(float theValue); + SetScalarMin(vtkFloatingPointType theValue); virtual void - SetScalarMax(float theValue); + SetScalarMax(vtkFloatingPointType theValue); virtual void @@ -124,15 +124,15 @@ public: virtual void - SetMapScale(float theMapScale = 1.0); + SetMapScale(vtkFloatingPointType theMapScale = 1.0); virtual - float + vtkFloatingPointType GetMapScale(); virtual void - GetSourceRange(float theRange[2]); + GetSourceRange(vtkFloatingPointType theRange[2]); virtual void diff --git a/src/PIPELINE/VISU_SphereWidget.cxx b/src/PIPELINE/VISU_SphereWidget.cxx index 2134aeb7..3ae4c7b5 100755 --- a/src/PIPELINE/VISU_SphereWidget.cxx +++ b/src/PIPELINE/VISU_SphereWidget.cxx @@ -1,3 +1,22 @@ +// Copyright (C) 2005 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 +// #include "VISU_SphereWidget.hxx" #include @@ -43,7 +62,7 @@ VISU_SphereWidget::VISU_SphereWidget() mySphereActor->SetMapper(mySphereMapper); // // Define the point coordinates - float bounds[6]; + vtkFloatingPointType bounds[6]; for(int i = 0; i < 6; i += 2){ bounds[i]=-.5; bounds[i+1]=-bounds[i]; @@ -126,7 +145,7 @@ int VISU_SphereWidget::GetPhiResolution() // function: SetRadius // purpose : //==================================================================== -void VISU_SphereWidget::SetRadius(float theRadius) +void VISU_SphereWidget::SetRadius(vtkFloatingPointType theRadius) { if ( theRadius <= myRmin ) { theRadius = myRmin; @@ -138,7 +157,7 @@ void VISU_SphereWidget::SetRadius(float theRadius) // function: GetRadius // purpose : //==================================================================== -float VISU_SphereWidget::GetRadius() +vtkFloatingPointType VISU_SphereWidget::GetRadius() { return mySphereSource->GetRadius(); } @@ -146,7 +165,7 @@ float VISU_SphereWidget::GetRadius() // function: SetCenter // purpose : //==================================================================== -void VISU_SphereWidget::SetCenter(float theCenter[3]) +void VISU_SphereWidget::SetCenter(vtkFloatingPointType theCenter[3]) { mySphereSource->SetCenter(theCenter); mySphere->SetCenter(theCenter); @@ -155,9 +174,9 @@ void VISU_SphereWidget::SetCenter(float theCenter[3]) // function: SetCenter // purpose : //==================================================================== -void VISU_SphereWidget::SetCenter(float theX, float theY, float theZ) +void VISU_SphereWidget::SetCenter(vtkFloatingPointType theX, vtkFloatingPointType theY, vtkFloatingPointType theZ) { - float aCenter[3] = {theX, theY, theZ}; + vtkFloatingPointType aCenter[3] = {theX, theY, theZ}; SetCenter(aCenter); } @@ -165,7 +184,7 @@ void VISU_SphereWidget::SetCenter(float theX, float theY, float theZ) // function: GetCenter // purpose : //==================================================================== -float* VISU_SphereWidget::GetCenter() +vtkFloatingPointType* VISU_SphereWidget::GetCenter() { return mySphereSource->GetCenter(); } @@ -173,7 +192,7 @@ float* VISU_SphereWidget::GetCenter() // function: GetCenter // purpose : //==================================================================== -void VISU_SphereWidget::GetCenter(float theCenter[3]) +void VISU_SphereWidget::GetCenter(vtkFloatingPointType theCenter[3]) { mySphereSource->GetCenter(theCenter); } @@ -469,7 +488,7 @@ void VISU_SphereWidget::OnMiddleButtonUp() //==================================================================== void VISU_SphereWidget::Translate(double *p1, double *p2) { - float v[3], aC[3], aC1[3]; + vtkFloatingPointType v[3], aC[3], aC1[3]; // v[0] = p2[0] - p1[0]; v[1] = p2[1] - p1[1]; @@ -495,7 +514,7 @@ void VISU_SphereWidget::Scale(double *p1, double *p2, v[1] = p2[1] - p1[1]; v[2] = p2[2] - p1[2]; // - float aC[3], aR, sf, aR1; + vtkFloatingPointType aC[3], aR, sf, aR1; aR=mySphereSource->GetRadius(); mySphereSource->GetCenter(aC); sf=vtkMath::Norm(v)/aR; @@ -561,12 +580,12 @@ void VISU_SphereWidget::CreateDefaultProperties() // function:PlaceWidget // purpose: //==================================================================== -void VISU_SphereWidget::PlaceWidget(float bds[6]) +void VISU_SphereWidget::PlaceWidget(vtkFloatingPointType bds[6]) { - float bounds[6], center[3], radius; + vtkFloatingPointType bounds[6], center[3], radius; this->AdjustBounds(bds, bounds, center); - float dX, dY, dZ; + vtkFloatingPointType dX, dY, dZ; // dX=bounds[1]-bounds[0]; dY=bounds[3]-bounds[2]; @@ -591,7 +610,7 @@ void VISU_SphereWidget::PlaceWidget(float bds[6]) (bounds[3]-bounds[2])*(bounds[3]-bounds[2]) + (bounds[5]-bounds[4])*(bounds[5]-bounds[4])); - static float EPS = 1.0E-1; + static vtkFloatingPointType EPS = 1.0E-1; myRmin = EPS*InitialLength; } diff --git a/src/PIPELINE/VISU_SphereWidget.hxx b/src/PIPELINE/VISU_SphereWidget.hxx index 6efadaff..1248d273 100755 --- a/src/PIPELINE/VISU_SphereWidget.hxx +++ b/src/PIPELINE/VISU_SphereWidget.hxx @@ -1,3 +1,22 @@ +// Copyright (C) 2005 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 +// #ifndef __VISU_SphereWidget_h #define __VISU_SphereWidget_h @@ -34,7 +53,7 @@ public: virtual void SetEnabled(int); // //PlaceWidget - virtual void PlaceWidget(float bounds[6]); + virtual void PlaceWidget(vtkFloatingPointType bounds[6]); // // Description: // Set/Get the resolution of the sphere in the Theta direction. @@ -47,22 +66,24 @@ public: // Description: // Set/Get the radius of sphere. Default is .5. - void SetRadius(float r); - float GetRadius(); + void SetRadius(vtkFloatingPointType r); + vtkFloatingPointType GetRadius(); // Description: // Set/Get the center of the sphere. - void SetCenter(float x, float y, float z); - void SetCenter(float x[3]); + void SetCenter(vtkFloatingPointType x, + vtkFloatingPointType y, + vtkFloatingPointType z); + void SetCenter(vtkFloatingPointType x[3]); - float* GetCenter(); - void GetCenter(float xyz[3]); + vtkFloatingPointType* GetCenter(); + void GetCenter(vtkFloatingPointType xyz[3]); // Description: // Set the ratio of the radius changing. - void SetRatio(float r) { myRatio = r; } - float GetRatio() { return myRatio; } + void SetRatio(vtkFloatingPointType r) { myRatio = r; } + vtkFloatingPointType GetRatio() { return myRatio; } void ChangeRadius(bool up); @@ -123,10 +144,10 @@ protected: // the manipulator in general. vtkProperty *mySphereProperty; vtkProperty *mySelectedSphereProperty; - float myRmin; + vtkFloatingPointType myRmin; vtkSphere *mySphere; vtkImplicitSum* myImplicitSum; - float myRatio; + vtkFloatingPointType myRatio; private: VISU_SphereWidget(const VISU_SphereWidget&); //Not implemented void operator=(const VISU_SphereWidget&); //Not implemented diff --git a/src/PIPELINE/VISU_StreamLinesPL.cxx b/src/PIPELINE/VISU_StreamLinesPL.cxx index 89e3f71b..b5a16a3d 100644 --- a/src/PIPELINE/VISU_StreamLinesPL.cxx +++ b/src/PIPELINE/VISU_StreamLinesPL.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File: VISU_PipeLine.cxx @@ -42,10 +42,10 @@ static int MYDEBUG = 0; static int MYDEBUG = 0; #endif -static float EPS = 1.0e-7; -static float aMinNbOfSteps = 1.0E+2; -//static float aMaxNbOfSteps = 1.0E+3; -static float aCoeffOfIntStep = 1.0E+1; +static vtkFloatingPointType EPS = 1.0e-7; +static vtkFloatingPointType aMinNbOfSteps = 1.0E+2; +//static vtkFloatingPointType aMaxNbOfSteps = 1.0E+3; +static vtkFloatingPointType aCoeffOfIntStep = 1.0E+1; vtkStandardNewMacro(VISU_StreamLinesPL); @@ -86,49 +86,57 @@ void VISU_StreamLinesPL::ShallowCopy(VISU_PipeLine *thePipeLine){ } -float VISU_StreamLinesPL::GetNecasseryMemorySize(vtkIdType theNbOfPoints, float theStepLength, - float thePropogationTime, float thePercents) +vtkFloatingPointType +VISU_StreamLinesPL +::GetNecasseryMemorySize(vtkIdType theNbOfPoints, + vtkFloatingPointType theStepLength, + vtkFloatingPointType thePropogationTime, + vtkFloatingPointType thePercents) { - static float aStreamPointSize = sizeof(float)*15 + sizeof(vtkIdType)*2; - static float aStreamArraySize = aStreamPointSize*1024; // == 69632 + static vtkFloatingPointType aStreamPointSize = sizeof(vtkFloatingPointType)*15 + sizeof(vtkIdType)*2; + static vtkFloatingPointType aStreamArraySize = aStreamPointSize*1024; // == 69632 - float aNbCells = thePercents*theNbOfPoints*2.0; - float aNbPointsPerCell = thePropogationTime/theStepLength; - float aCellsSize = aNbCells*(1+aNbPointsPerCell); - float aPointsSize = aCellsSize*3.0*sizeof(float); + vtkFloatingPointType aNbCells = thePercents*theNbOfPoints*2.0; + vtkFloatingPointType aNbPointsPerCell = thePropogationTime/theStepLength; + vtkFloatingPointType aCellsSize = aNbCells*(1+aNbPointsPerCell); + vtkFloatingPointType aPointsSize = aCellsSize*3.0*sizeof(vtkFloatingPointType); - float aConnectivitySize = aCellsSize*sizeof(vtkIdType); - float aTypesSize = aNbCells*sizeof(char); - float aLocationsSize = aNbCells*sizeof(int); - //float aNbCellsPerPoint = aCellsSize / aNbCells - 1; - float aMeshSize = aPointsSize + aConnectivitySize + aTypesSize + aLocationsSize; + vtkFloatingPointType aConnectivitySize = aCellsSize*sizeof(vtkIdType); + vtkFloatingPointType aTypesSize = aNbCells*sizeof(char); + vtkFloatingPointType aLocationsSize = aNbCells*sizeof(int); + //vtkFloatingPointType aNbCellsPerPoint = aCellsSize / aNbCells - 1; + vtkFloatingPointType aMeshSize = aPointsSize + aConnectivitySize + aTypesSize + aLocationsSize; - float anAssignedDataSize = aCellsSize*4.0*sizeof(float); - float anOutputDataSetSize = aMeshSize + anAssignedDataSize; + vtkFloatingPointType anAssignedDataSize = aCellsSize*4.0*sizeof(vtkFloatingPointType); + vtkFloatingPointType anOutputDataSetSize = aMeshSize + anAssignedDataSize; - float aResult = aStreamArraySize*aNbCells + anOutputDataSetSize; + vtkFloatingPointType aResult = aStreamArraySize*aNbCells + anOutputDataSetSize; return aResult; } -int VISU_StreamLinesPL::FindPossibleParams(vtkPointSet* theDataSet, float& theStepLength, - float& thePropogationTime, float& thePercents) +int +VISU_StreamLinesPL +::FindPossibleParams(vtkPointSet* theDataSet, + vtkFloatingPointType& theStepLength, + vtkFloatingPointType& thePropogationTime, + vtkFloatingPointType& thePercents) { - static float aPercentsDecrease = 3.0, aStepLengthIncrease = 9.0; + static vtkFloatingPointType aPercentsDecrease = 3.0, aStepLengthIncrease = 9.0; vtkIdType aNbOfPoints = theDataSet->GetNumberOfPoints(); - float aSize = GetNecasseryMemorySize(aNbOfPoints,theStepLength,thePropogationTime,thePercents); + vtkFloatingPointType aSize = GetNecasseryMemorySize(aNbOfPoints,theStepLength,thePropogationTime,thePercents); int isPoss = CheckAvailableMemory(aSize); if(!isPoss){ - float aMaxStepLength = max(GetMaxStepLength(theDataSet),thePropogationTime); - float aMinStepLength = GetMinStepLength(theDataSet); - float aDeltaStepLength = (aMaxStepLength - aMinStepLength)/aStepLengthIncrease; + vtkFloatingPointType aMaxStepLength = max(GetMaxStepLength(theDataSet),thePropogationTime); + vtkFloatingPointType aMinStepLength = GetMinStepLength(theDataSet); + vtkFloatingPointType aDeltaStepLength = (aMaxStepLength - aMinStepLength)/aStepLengthIncrease; for(int i = 2, aStepChanged = 1, aPerecentsChanged = 1; aStepChanged || aPerecentsChanged; i++){ - float aStepLength = theStepLength + aDeltaStepLength; + vtkFloatingPointType aStepLength = theStepLength + aDeltaStepLength; if(aStepLength < aMaxStepLength) theStepLength = aStepLength; else if(aStepChanged){ aStepLength = aMaxStepLength; aStepChanged = 0; } - float aPercents = thePercents /= aPercentsDecrease; + vtkFloatingPointType aPercents = thePercents /= aPercentsDecrease; if(aPercents*aNbOfPoints > 1) thePercents = aPercents; else if(aPerecentsChanged) { thePercents = 1.1 / aNbOfPoints; @@ -146,13 +154,15 @@ int VISU_StreamLinesPL::FindPossibleParams(vtkPointSet* theDataSet, float& theSt } -int VISU_StreamLinesPL::SetParams(float theIntStep, - float thePropogationTime, - float theStepLength, - vtkPointSet* theSource, - float thePercents, - int theDirection, - int isOnlyTry) +int +VISU_StreamLinesPL +::SetParams(vtkFloatingPointType theIntStep, + vtkFloatingPointType thePropogationTime, + vtkFloatingPointType theStepLength, + vtkPointSet* theSource, + vtkFloatingPointType thePercents, + int theDirection, + int isOnlyTry) { vtkPointSet* aDataSet = theSource? theSource: myFieldTransform->GetUnstructuredGridOutput(); aDataSet->Update(); @@ -187,31 +197,50 @@ int VISU_StreamLinesPL::SetParams(float theIntStep, } -vtkPointSet* VISU_StreamLinesPL::GetSource() { +vtkPointSet* +VISU_StreamLinesPL +::GetSource() +{ return mySource; } -float VISU_StreamLinesPL::GetUsedPoints() { +vtkFloatingPointType +VISU_StreamLinesPL +::GetUsedPoints() +{ return myPercents; } -vtkDataSet* VISU_StreamLinesPL::GetStreamerSource(){ +vtkDataSet* +VISU_StreamLinesPL +::GetStreamerSource() +{ return myStream->GetSource(); } -float VISU_StreamLinesPL::GetVelocityCoeff(){ +vtkFloatingPointType +VISU_StreamLinesPL +::GetVelocityCoeff() +{ return GetVelocityCoeff(myExtractor->GetOutput()); } -float VISU_StreamLinesPL::GetVelocityCoeff(vtkPointSet* theDataSet){ - float* aScalarRange = theDataSet->GetScalarRange(); +vtkFloatingPointType +VISU_StreamLinesPL +::GetVelocityCoeff(vtkPointSet* theDataSet) +{ + vtkFloatingPointType* aScalarRange = theDataSet->GetScalarRange(); return (fabs(aScalarRange[1]) + fabs(aScalarRange[0]))/2.0; } -int VISU_StreamLinesPL::IsPossible(vtkPointSet* theDataSet, float thePercents){ - float aStepLength = GetBaseStepLength(theDataSet); - float aBasePropTime = GetBasePropagationTime(theDataSet); +int +VISU_StreamLinesPL +::IsPossible(vtkPointSet* theDataSet, + vtkFloatingPointType thePercents) +{ + vtkFloatingPointType aStepLength = GetBaseStepLength(theDataSet); + vtkFloatingPointType aBasePropTime = GetBasePropagationTime(theDataSet); VISU_UsedPointsFilter *aPointsFilter = VISU_UsedPointsFilter::New(); aPointsFilter->SetInput(theDataSet); vtkPointSet* aDataSet = aPointsFilter->GetOutput(); @@ -223,71 +252,105 @@ int VISU_StreamLinesPL::IsPossible(vtkPointSet* theDataSet, float thePercents){ } -float VISU_StreamLinesPL::GetIntegrationStep(){ +vtkFloatingPointType +VISU_StreamLinesPL +::GetIntegrationStep() +{ return myStream->GetIntegrationStepLength(); } -float VISU_StreamLinesPL::GetStepLength() { + +vtkFloatingPointType +VISU_StreamLinesPL +::GetStepLength() +{ return myStream->GetStepLength(); } -float VISU_StreamLinesPL::GetPropagationTime() { + +vtkFloatingPointType +VISU_StreamLinesPL +::GetPropagationTime() +{ return myStream->GetMaximumPropagationTime(); } -int VISU_StreamLinesPL::GetDirection(){ + +int +VISU_StreamLinesPL +::GetDirection() +{ return myStream->GetIntegrationDirection(); } -float VISU_StreamLinesPL::GetMinIntegrationStep(vtkPointSet* theDataSet, float thePercents) { +vtkFloatingPointType +VISU_StreamLinesPL +::GetMinIntegrationStep(vtkPointSet* theDataSet, + vtkFloatingPointType thePercents) +{ if(!theDataSet) return -1.0; - float aVolume = 1.0; + vtkFloatingPointType aVolume = 1.0; int degree = 0; theDataSet->Update(); - float* aBounds = theDataSet->GetBounds(); + vtkFloatingPointType* aBounds = theDataSet->GetBounds(); for(int i = 0, j = 0; i < 3; ++i, j = 2*i){ - float tmp = aBounds[j+1] - aBounds[j]; + vtkFloatingPointType tmp = aBounds[j+1] - aBounds[j]; if (tmp > EPS ) { aVolume *= tmp; degree += 1; } } if (degree < 1) return 0.0; // absolutely empty object - float anStepLength = GetMaxIntegrationStep(theDataSet)/aCoeffOfIntStep; - float aBasePropTime = GetBasePropagationTime(theDataSet)/GetVelocityCoeff(theDataSet); + vtkFloatingPointType anStepLength = GetMaxIntegrationStep(theDataSet)/aCoeffOfIntStep; + vtkFloatingPointType aBasePropTime = GetBasePropagationTime(theDataSet)/GetVelocityCoeff(theDataSet); thePercents = 1.0; vtkIdType aNbOfPoints = theDataSet->GetNumberOfPoints(); - float aSize = GetNecasseryMemorySize(aNbOfPoints,anStepLength,aBasePropTime,thePercents); - float aRealSize = GetAvailableMemory(aSize); - float anAverageVolume = aVolume / aRealSize; - float aStep = pow(double(anAverageVolume), double(1.0/double(degree))); + vtkFloatingPointType aSize = GetNecasseryMemorySize(aNbOfPoints,anStepLength,aBasePropTime,thePercents); + vtkFloatingPointType aRealSize = GetAvailableMemory(aSize); + vtkFloatingPointType anAverageVolume = aVolume / aRealSize; + vtkFloatingPointType aStep = pow(double(anAverageVolume), double(1.0/double(degree))); return aStep; } -float VISU_StreamLinesPL::GetMinIntegrationStep(){ + +vtkFloatingPointType +VISU_StreamLinesPL +::GetMinIntegrationStep() +{ return GetMinIntegrationStep(myExtractor->GetOutput(),GetUsedPoints()); } -float VISU_StreamLinesPL::GetMaxIntegrationStep(vtkPointSet* theDataSet) { +vtkFloatingPointType +VISU_StreamLinesPL +::GetMaxIntegrationStep(vtkPointSet* theDataSet) +{ if(!theDataSet) return -1.0; theDataSet->Update(); - float aLength = theDataSet->GetLength(); - float* aBounds = theDataSet->GetBounds(); - float aMaxSizeY = (aBounds[3]-aBounds[2])/aLength; - float aMaxSizeZ = (aBounds[5]-aBounds[4])/aLength; - float aMinMax = (aBounds[1] - aBounds[0])/aLength; + vtkFloatingPointType aLength = theDataSet->GetLength(); + vtkFloatingPointType* aBounds = theDataSet->GetBounds(); + vtkFloatingPointType aMaxSizeY = (aBounds[3]-aBounds[2])/aLength; + vtkFloatingPointType aMaxSizeZ = (aBounds[5]-aBounds[4])/aLength; + vtkFloatingPointType aMinMax = (aBounds[1] - aBounds[0])/aLength; if (aMinMax < EPS || (aMaxSizeY < aMinMax && aMaxSizeY > EPS)) aMinMax = aMaxSizeY; if (aMinMax < EPS || (aMaxSizeZ < aMinMax && aMaxSizeZ > EPS)) aMinMax = aMaxSizeZ; return aMinMax*aLength/2.0; } -float VISU_StreamLinesPL::GetMaxIntegrationStep(){ + +vtkFloatingPointType +VISU_StreamLinesPL +::GetMaxIntegrationStep() +{ return GetMaxIntegrationStep(myExtractor->GetOutput()); } -float VISU_StreamLinesPL::GetBaseIntegrationStep(vtkPointSet* theDataSet, float thePercents){ +vtkFloatingPointType +VISU_StreamLinesPL +::GetBaseIntegrationStep(vtkPointSet* theDataSet, + vtkFloatingPointType thePercents) +{ theDataSet->Update(); - float aMinIntegrationStep = GetMinIntegrationStep(theDataSet,thePercents); - float aMaxIntegrationStep = GetMaxIntegrationStep(theDataSet); - float anIntegrationStep = aMaxIntegrationStep / aCoeffOfIntStep; - float aMinMax = theDataSet->GetLength()/theDataSet->GetNumberOfPoints(); + vtkFloatingPointType aMinIntegrationStep = GetMinIntegrationStep(theDataSet,thePercents); + vtkFloatingPointType aMaxIntegrationStep = GetMaxIntegrationStep(theDataSet); + vtkFloatingPointType anIntegrationStep = aMaxIntegrationStep / aCoeffOfIntStep; + vtkFloatingPointType aMinMax = theDataSet->GetLength()/theDataSet->GetNumberOfPoints(); if(aMinMax > anIntegrationStep) anIntegrationStep = (anIntegrationStep*aCoeffOfIntStep*0.9+aMinMax)/aCoeffOfIntStep; if(aMinIntegrationStep > anIntegrationStep) @@ -295,10 +358,15 @@ float VISU_StreamLinesPL::GetBaseIntegrationStep(vtkPointSet* theDataSet, float return anIntegrationStep; } -float VISU_StreamLinesPL::CorrectIntegrationStep(float theStep, vtkPointSet* theDataSet, float thePercents){ +vtkFloatingPointType +VISU_StreamLinesPL +::CorrectIntegrationStep(vtkFloatingPointType theStep, + vtkPointSet* theDataSet, + vtkFloatingPointType thePercents) +{ theDataSet->Update(); - float aMinIntegrationStep = GetMinIntegrationStep(theDataSet,thePercents); - float aMaxIntegrationStep = GetMaxIntegrationStep(theDataSet); + vtkFloatingPointType aMinIntegrationStep = GetMinIntegrationStep(theDataSet,thePercents); + vtkFloatingPointType aMaxIntegrationStep = GetMaxIntegrationStep(theDataSet); if(aMinIntegrationStep > theStep) theStep = aMinIntegrationStep; if(aMaxIntegrationStep < theStep) @@ -307,99 +375,156 @@ float VISU_StreamLinesPL::CorrectIntegrationStep(float theStep, vtkPointSet* the } -float VISU_StreamLinesPL::GetMinPropagationTime(vtkPointSet* theDataSet){ +vtkFloatingPointType +VISU_StreamLinesPL +::GetMinPropagationTime(vtkPointSet* theDataSet) +{ if(!theDataSet) return -1.0; return GetMinStepLength(theDataSet); } -float VISU_StreamLinesPL::GetMinPropagationTime(){ + +vtkFloatingPointType +VISU_StreamLinesPL +::GetMinPropagationTime() +{ return GetMinPropagationTime(myExtractor->GetOutput()); } -float VISU_StreamLinesPL::GetMaxPropagationTime(vtkPointSet* theDataSet){ +vtkFloatingPointType +VISU_StreamLinesPL +::GetMaxPropagationTime(vtkPointSet* theDataSet) +{ if(!theDataSet) return -1.0; return GetBasePropagationTime(theDataSet)*aMinNbOfSteps; } -float VISU_StreamLinesPL::GetMaxPropagationTime(){ + +vtkFloatingPointType VISU_StreamLinesPL::GetMaxPropagationTime(){ return GetMaxPropagationTime(myExtractor->GetOutput()); } -float VISU_StreamLinesPL::CorrectPropagationTime(float thePropagationTime, vtkPointSet* theDataSet){ - float aMinPropagationTime = GetMinPropagationTime(theDataSet); - float aMaxPropagationTime = GetMaxPropagationTime(theDataSet); +vtkFloatingPointType +VISU_StreamLinesPL +::CorrectPropagationTime(vtkFloatingPointType thePropagationTime, + vtkPointSet* theDataSet) +{ + vtkFloatingPointType aMinPropagationTime = GetMinPropagationTime(theDataSet); + vtkFloatingPointType aMaxPropagationTime = GetMaxPropagationTime(theDataSet); if(aMinPropagationTime > thePropagationTime) thePropagationTime = aMinPropagationTime; if(aMaxPropagationTime < thePropagationTime) thePropagationTime = aMaxPropagationTime; return thePropagationTime; } -float VISU_StreamLinesPL::GetBasePropagationTime(vtkPointSet* theDataSet){ + +vtkFloatingPointType +VISU_StreamLinesPL +::GetBasePropagationTime(vtkPointSet* theDataSet) +{ if(!theDataSet) return -1.0; theDataSet->Update(); - float aPropagationTime = theDataSet->GetLength()/GetVelocityCoeff(theDataSet); + vtkFloatingPointType aPropagationTime = theDataSet->GetLength()/GetVelocityCoeff(theDataSet); return aPropagationTime; } -float VISU_StreamLinesPL::GetBasePropagationTime(){ + +vtkFloatingPointType +VISU_StreamLinesPL +::GetBasePropagationTime() +{ return GetBasePropagationTime(myExtractor->GetOutput()); } -float VISU_StreamLinesPL::GetMinStepLength(vtkPointSet* theDataSet){ - static float aNbOfStepsOfIntStep = 1.0E+1; - float anIntStep = GetMinIntegrationStep(theDataSet); - float aStepLength = anIntStep*aNbOfStepsOfIntStep/GetVelocityCoeff(theDataSet); +vtkFloatingPointType +VISU_StreamLinesPL +::GetMinStepLength(vtkPointSet* theDataSet) +{ + static vtkFloatingPointType aNbOfStepsOfIntStep = 1.0E+1; + vtkFloatingPointType anIntStep = GetMinIntegrationStep(theDataSet); + vtkFloatingPointType aStepLength = anIntStep*aNbOfStepsOfIntStep/GetVelocityCoeff(theDataSet); return aStepLength; } -float VISU_StreamLinesPL::GetMinStepLength(){ + +vtkFloatingPointType +VISU_StreamLinesPL +::GetMinStepLength() +{ return GetMinStepLength(myExtractor->GetOutput()); } -float VISU_StreamLinesPL::GetMaxStepLength(vtkPointSet* theDataSet){ - float aStepLength = GetBasePropagationTime(theDataSet); +vtkFloatingPointType +VISU_StreamLinesPL +::GetMaxStepLength(vtkPointSet* theDataSet) +{ + vtkFloatingPointType aStepLength = GetBasePropagationTime(theDataSet); return aStepLength; } -float VISU_StreamLinesPL::GetMaxStepLength(){ + +vtkFloatingPointType +VISU_StreamLinesPL +::GetMaxStepLength() +{ return GetMaxStepLength(myExtractor->GetOutput()); } -float VISU_StreamLinesPL::CorrectStepLength(float theStep, vtkPointSet* theDataSet){ - float aMinStep = GetMinStepLength(theDataSet); +vtkFloatingPointType +VISU_StreamLinesPL +::CorrectStepLength(vtkFloatingPointType theStep, + vtkPointSet* theDataSet) +{ + vtkFloatingPointType aMinStep = GetMinStepLength(theDataSet); if(theStep < aMinStep) theStep = aMinStep; - float aMaxStep = GetMaxStepLength(theDataSet); + vtkFloatingPointType aMaxStep = GetMaxStepLength(theDataSet); if(theStep > aMaxStep) theStep = aMaxStep; return theStep; } -float VISU_StreamLinesPL::GetBaseStepLength(vtkPointSet* theDataSet){ - static float anAvgNbOfSteps = 1.0E+2; - float aPropagationTime = GetBasePropagationTime(theDataSet); - float aStepLength = aPropagationTime/anAvgNbOfSteps; + +vtkFloatingPointType +VISU_StreamLinesPL +::GetBaseStepLength(vtkPointSet* theDataSet) +{ + static vtkFloatingPointType anAvgNbOfSteps = 1.0E+2; + vtkFloatingPointType aPropagationTime = GetBasePropagationTime(theDataSet); + vtkFloatingPointType aStepLength = aPropagationTime/anAvgNbOfSteps; aStepLength = CorrectStepLength(aStepLength,theDataSet); return aStepLength; } -void VISU_StreamLinesPL::Init(){ +void +VISU_StreamLinesPL +::Init() +{ VISU_ScalarMapPL::Init(); vtkPointSet* aDataSet = myExtractor->GetOutput(); - float anIntStep = GetBaseIntegrationStep(aDataSet); - float aPropagationTime = GetBasePropagationTime(aDataSet); - float aStepLength = GetBaseStepLength(aDataSet); + vtkFloatingPointType anIntStep = GetBaseIntegrationStep(aDataSet); + vtkFloatingPointType aPropagationTime = GetBasePropagationTime(aDataSet); + vtkFloatingPointType aStepLength = GetBaseStepLength(aDataSet); SetParams(anIntStep,aPropagationTime,aStepLength); } -VISU_ScalarMapPL::THook* VISU_StreamLinesPL::DoHook(){ +VISU_ScalarMapPL::THook* +VISU_StreamLinesPL +::DoHook() +{ GetInput2()->Update(); VISU::CellDataToPoint(myStream,myCellDataToPointData,GetInput2(),myFieldTransform); - float *aBounds = GetInput2()->GetBounds(); + vtkFloatingPointType *aBounds = GetInput2()->GetBounds(); myGeomFilter->SetExtent(aBounds); myGeomFilter->ExtentClippingOn(); myGeomFilter->SetInput(myStream->GetOutput()); return myGeomFilter->GetOutput(); } -void VISU_StreamLinesPL::Update(){ +void +VISU_StreamLinesPL +::Update() +{ VISU_ScalarMapPL::Update(); } -void VISU_StreamLinesPL::SetMapScale(float theMapScale){ +void +VISU_StreamLinesPL +::SetMapScale(vtkFloatingPointType theMapScale) +{ VISU_ScalarMapPL::SetMapScale(theMapScale); } diff --git a/src/PIPELINE/VISU_StreamLinesPL.hxx b/src/PIPELINE/VISU_StreamLinesPL.hxx index 05976293..bcee487f 100644 --- a/src/PIPELINE/VISU_StreamLinesPL.hxx +++ b/src/PIPELINE/VISU_StreamLinesPL.hxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File: VISU_PipeLine.hxx @@ -42,78 +42,192 @@ class VISU_PIPELINE_EXPORT VISU_StreamLinesPL : public VISU_DeformedShapePL{ protected: VISU_StreamLinesPL(); VISU_StreamLinesPL(const VISU_StreamLinesPL&); + + virtual + ~VISU_StreamLinesPL(); + public: vtkTypeMacro(VISU_StreamLinesPL,VISU_DeformedShapePL); - static VISU_StreamLinesPL* New(); - virtual ~VISU_StreamLinesPL(); - virtual void ShallowCopy(VISU_PipeLine *thePipeLine); - - virtual int SetParams(float theIntStep, - float thePropogationTime, - float theStepLength, - vtkPointSet* theSource = NULL, - float thePercents = 0.3, - int theDirection = VTK_INTEGRATE_BOTH_DIRECTIONS, - int isOnlyTry = false); - virtual vtkPointSet* GetSource(); - virtual float GetUsedPoints(); - virtual float GetIntegrationStep(); - virtual float GetPropagationTime(); - virtual float GetStepLength(); - virtual int GetDirection(); - - virtual vtkDataSet* GetStreamerSource(); - virtual float GetVelocityCoeff(); - - virtual float GetMaxIntegrationStep(); - virtual float GetMinIntegrationStep(); - - virtual float GetMinStepLength(); - virtual float GetMaxStepLength(); - - virtual float GetMinPropagationTime(); - virtual float GetMaxPropagationTime(); - virtual float GetBasePropagationTime(); + + static + VISU_StreamLinesPL* + New(); + + virtual + void + ShallowCopy(VISU_PipeLine *thePipeLine); + + virtual + int + SetParams(vtkFloatingPointType theIntStep, + vtkFloatingPointType thePropogationTime, + vtkFloatingPointType theStepLength, + vtkPointSet* theSource = NULL, + vtkFloatingPointType thePercents = 0.3, + int theDirection = VTK_INTEGRATE_BOTH_DIRECTIONS, + int isOnlyTry = false); + + virtual + vtkPointSet* + GetSource(); + + virtual + vtkFloatingPointType + GetUsedPoints(); + + virtual + vtkFloatingPointType + GetIntegrationStep(); + + virtual + vtkFloatingPointType + GetPropagationTime(); + + virtual + vtkFloatingPointType + GetStepLength(); + + virtual + int + GetDirection(); + + virtual + vtkDataSet* + GetStreamerSource(); + + virtual + vtkFloatingPointType + GetVelocityCoeff(); + + virtual + vtkFloatingPointType + GetMaxIntegrationStep(); + + virtual + vtkFloatingPointType + GetMinIntegrationStep(); + + virtual + vtkFloatingPointType + GetMinStepLength(); + + virtual + vtkFloatingPointType + GetMaxStepLength(); + + virtual + vtkFloatingPointType + GetMinPropagationTime(); + + virtual + vtkFloatingPointType + GetMaxPropagationTime(); + + virtual + vtkFloatingPointType + GetBasePropagationTime(); public: - virtual THook* DoHook(); - virtual void Init(); - virtual void Update(); - virtual void SetMapScale(float theMapScale = 1.0); + virtual + THook* + DoHook(); + + virtual + void + Init(); + + virtual + void + Update(); + + virtual + void + SetMapScale(vtkFloatingPointType theMapScale = 1.0); public: - static float GetMaxIntegrationStep(vtkPointSet* theDataSet); - static float GetMinIntegrationStep(vtkPointSet* theDataSet, float thePercents = 0.3); - static float GetBaseIntegrationStep(vtkPointSet* theDataSet, float thePercents = 0.3); + static + vtkFloatingPointType + GetMaxIntegrationStep(vtkPointSet* theDataSet); + + static + vtkFloatingPointType + GetMinIntegrationStep(vtkPointSet* theDataSet, + vtkFloatingPointType thePercents = 0.3); + static + vtkFloatingPointType + GetBaseIntegrationStep(vtkPointSet* theDataSet, + vtkFloatingPointType thePercents = 0.3); - static float GetMinPropagationTime(vtkPointSet* theDataSet); - static float GetMaxPropagationTime(vtkPointSet* theDataSet); - static float GetBasePropagationTime(vtkPointSet* theDataSet); + static + vtkFloatingPointType + GetMinPropagationTime(vtkPointSet* theDataSet); + + static + vtkFloatingPointType + GetMaxPropagationTime(vtkPointSet* theDataSet); + + static + vtkFloatingPointType + GetBasePropagationTime(vtkPointSet* theDataSet); + + static + vtkFloatingPointType + GetMinStepLength(vtkPointSet* theDataSet); + + static + vtkFloatingPointType + GetMaxStepLength(vtkPointSet* theDataSet); - static float GetMinStepLength(vtkPointSet* theDataSet); - static float GetMaxStepLength(vtkPointSet* theDataSet); - static float GetBaseStepLength(vtkPointSet* theDataSet); + static + vtkFloatingPointType + GetBaseStepLength(vtkPointSet* theDataSet); - static float GetVelocityCoeff(vtkPointSet* theDataSet); + static + vtkFloatingPointType + GetVelocityCoeff(vtkPointSet* theDataSet); - static int IsPossible(vtkPointSet* theDataSet, float thePercents = 0.3); + static + int + IsPossible(vtkPointSet* theDataSet, + vtkFloatingPointType thePercents = 0.3); protected: - static float GetNecasseryMemorySize(vtkIdType theNbOfPoints, float theStepLength, - float thePropogationTime, float thePercents = 0.3); - static int FindPossibleParams(vtkPointSet* theDataSet, float& theStepLength, - float& thePropogationTime, float& thePercents); + static + vtkFloatingPointType + GetNecasseryMemorySize(vtkIdType theNbOfPoints, + vtkFloatingPointType theStepLength, + vtkFloatingPointType thePropogationTime, + vtkFloatingPointType thePercents = 0.3); + + static + int + FindPossibleParams(vtkPointSet* theDataSet, + vtkFloatingPointType& theStepLength, + vtkFloatingPointType& thePropogationTime, + vtkFloatingPointType& thePercents); - static float CorrectIntegrationStep(float theStep, vtkPointSet* theDataSet, float thePercents = 0.3); - static float CorrectPropagationTime(float thePropagationTime, vtkPointSet* theDataSet); - static float CorrectStepLength(float theStep, vtkPointSet* theDataSet); + static + vtkFloatingPointType + CorrectIntegrationStep(vtkFloatingPointType theStep, + vtkPointSet* theDataSet, + vtkFloatingPointType thePercents = 0.3); + + static + vtkFloatingPointType + CorrectPropagationTime(vtkFloatingPointType thePropagationTime, + vtkPointSet* theDataSet); + + static + vtkFloatingPointType + CorrectStepLength(vtkFloatingPointType theStep, + vtkPointSet* theDataSet); vtkStreamLine* myStream; vtkPointSet* mySource; vtkCellCenters* myCenters; VTKViewer_GeometryFilter *myGeomFilter; VISU_UsedPointsFilter *myPointsFilter; - float myPercents; + vtkFloatingPointType myPercents; }; diff --git a/src/PIPELINE/VISU_UsedPointsFilter.cxx b/src/PIPELINE/VISU_UsedPointsFilter.cxx index 311248cf..9c49ea25 100644 --- a/src/PIPELINE/VISU_UsedPointsFilter.cxx +++ b/src/PIPELINE/VISU_UsedPointsFilter.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File: VISU_StreamLinesPL.cxx diff --git a/src/PIPELINE/VISU_UsedPointsFilter.hxx b/src/PIPELINE/VISU_UsedPointsFilter.hxx index 273ab3d2..dd20877a 100644 --- a/src/PIPELINE/VISU_UsedPointsFilter.hxx +++ b/src/PIPELINE/VISU_UsedPointsFilter.hxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File: VISU_UsedPointsFilter.hxx diff --git a/src/PIPELINE/VISU_VectorsPL.cxx b/src/PIPELINE/VISU_VectorsPL.cxx index 92a5e575..3fa4bd66 100644 --- a/src/PIPELINE/VISU_VectorsPL.cxx +++ b/src/PIPELINE/VISU_VectorsPL.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File: VISU_PipeLine.cxx @@ -101,7 +101,7 @@ VISU_VectorsPL void VISU_VectorsPL -::SetScale(float theScale) +::SetScale(vtkFloatingPointType theScale) { if(myScaleFactor == theScale) return; @@ -114,7 +114,7 @@ VISU_VectorsPL Modified(); } -float +vtkFloatingPointType VISU_VectorsPL ::GetScale() { @@ -219,7 +219,7 @@ VISU_VectorsPL void VISU_VectorsPL -::SetMapScale(float theMapScale) +::SetMapScale(vtkFloatingPointType theMapScale) { VISU_ScalarMapPL::SetMapScale(theMapScale); diff --git a/src/PIPELINE/VISU_VectorsPL.hxx b/src/PIPELINE/VISU_VectorsPL.hxx index 7f849663..6b5add7c 100644 --- a/src/PIPELINE/VISU_VectorsPL.hxx +++ b/src/PIPELINE/VISU_VectorsPL.hxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File: VISU_PipeLine.hxx @@ -44,37 +44,89 @@ class VISU_PIPELINE_EXPORT VISU_VectorsPL : public VISU_DeformedShapePL{ protected: VISU_VectorsPL(); VISU_VectorsPL(const VISU_VectorsPL&); + + virtual + ~VISU_VectorsPL(); + public: vtkTypeMacro(VISU_VectorsPL,VISU_DeformedShapePL); - static VISU_VectorsPL* New(); - virtual ~VISU_VectorsPL(); - virtual void ShallowCopy(VISU_PipeLine *thePipeLine); - virtual void SetScale(float theScale); - virtual float GetScale(); + static + VISU_VectorsPL* + New(); + + virtual + void + ShallowCopy(VISU_PipeLine *thePipeLine); + + virtual + void + SetScale(vtkFloatingPointType theScale); + + virtual + vtkFloatingPointType + GetScale(); enum GlyphType{ ARROW, CONE2, CONE6, NONE}; - virtual void SetGlyphType(GlyphType theType) { myTypeGlyph = theType;} - virtual GlyphType GetGlyphType() { return myTypeGlyph;} + + virtual + void + SetGlyphType(GlyphType theType) + { + myTypeGlyph = theType; + } + + virtual + GlyphType + GetGlyphType() + { + return myTypeGlyph; + } enum GlyphPos{ CENTER, TAIL,HEAD}; - virtual void SetGlyphPos(GlyphPos thePos) { myPosGlyph = thePos;} - virtual GlyphPos GetGlyphPos() { return myPosGlyph;} + + virtual + void + SetGlyphPos(GlyphPos thePos) + { + myPosGlyph = thePos; + } + + virtual + GlyphPos + GetGlyphPos() + { + return myPosGlyph; + } public: - virtual void Init(); - virtual void Update(); + virtual + void + Init(); + + virtual + void + Update(); vtkDataSet* GetOutput(); - virtual void SetTransform(VTKViewer_Transform* theTransform); - virtual VTKViewer_Transform* GetTransform(); + virtual + void + SetTransform(VTKViewer_Transform* theTransform); + + virtual + VTKViewer_Transform* + GetTransform(); - virtual void SetMapScale(float theMapScale = 1.0); + virtual + void + SetMapScale(vtkFloatingPointType theMapScale = 1.0); protected: - virtual THook* DoHook(); + virtual + THook* + DoHook(); GlyphType myTypeGlyph; GlyphPos myPosGlyph; diff --git a/src/PIPELINE/VISU_WidgetCtrl.cxx b/src/PIPELINE/VISU_WidgetCtrl.cxx index bb62dc63..452b8e93 100644 --- a/src/PIPELINE/VISU_WidgetCtrl.cxx +++ b/src/PIPELINE/VISU_WidgetCtrl.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -268,7 +268,7 @@ VISU_SphereWidget* VISU_WidgetCtrl::GetSphereWidget() // function: PlaceWidget // purpose : //================================================================== -void VISU_WidgetCtrl::PlaceWidget(float theBounds[6]) +void VISU_WidgetCtrl::PlaceWidget(vtkFloatingPointType theBounds[6]) { for (int i=0; iPlaceWidget(theBounds); @@ -298,7 +298,7 @@ vtkRenderWindowInteractor* VISU_WidgetCtrl::GetInteractor() // function: SetPlaceFactor // purpose : //================================================================== -void VISU_WidgetCtrl::SetPlaceFactor(float theFactor) +void VISU_WidgetCtrl::SetPlaceFactor(vtkFloatingPointType theFactor) { for (int i=0; iSetPlaceFactor(theFactor); @@ -310,7 +310,7 @@ void VISU_WidgetCtrl::SetPlaceFactor(float theFactor) // function: GetPlaceFactor // purpose : //================================================================== -float VISU_WidgetCtrl::GetPlaceFactor() +vtkFloatingPointType VISU_WidgetCtrl::GetPlaceFactor() { return myWidgets[0]->GetPlaceFactor(); } @@ -324,9 +324,9 @@ vtkImplicitFunction* VISU_WidgetCtrl::ImplicitFunction() } //================================================================== -float +vtkFloatingPointType VISU_WidgetCtrl -::EvaluateFunction(float theX[3]) +::EvaluateFunction(vtkFloatingPointType theX[3]) { if(VISU_ImplicitFunctionWidget* aWidget = GetActiveWidget()){ if(vtkImplicitFunction* aFunction = aWidget->ImplicitFunction()) @@ -338,7 +338,8 @@ VISU_WidgetCtrl //================================================================== void VISU_WidgetCtrl -::EvaluateGradient(float theX[3], float theG[3]) +::EvaluateGradient(vtkFloatingPointType theX[3], + vtkFloatingPointType theG[3]) { theG[0] = theG[1] = theG[2] = 0.0; if(VISU_ImplicitFunctionWidget* aWidget = GetActiveWidget()){ diff --git a/src/PIPELINE/VISU_WidgetCtrl.hxx b/src/PIPELINE/VISU_WidgetCtrl.hxx index 17425276..78c283d8 100644 --- a/src/PIPELINE/VISU_WidgetCtrl.hxx +++ b/src/PIPELINE/VISU_WidgetCtrl.hxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -30,9 +30,10 @@ #define __VISU_WidgetCtrl_hxx #include "VISUPipeline.hxx" - #include +#include "VTKViewer.h" + class vtkImplicitFunction; class vtkObject; class vtkRenderWindowInteractor; @@ -52,18 +53,19 @@ public: vtkImplicitFunction* ImplicitFunction(); virtual - float - EvaluateFunction(float theX[3]); + vtkFloatingPointType + EvaluateFunction(vtkFloatingPointType theX[3]); virtual void - EvaluateGradient(float theX[3], float theG[3]); + EvaluateGradient(vtkFloatingPointType theX[3], + vtkFloatingPointType theG[3]); virtual unsigned long GetMTime(); - void PlaceWidget(float theBounds[6]); + void PlaceWidget(vtkFloatingPointType theBounds[6]); void SetEnabled(int theFlag); int GetEnabled(); void On() {SetEnabled(1);} @@ -72,8 +74,11 @@ public: void SetInteractor(vtkRenderWindowInteractor* theRWI); vtkRenderWindowInteractor* GetInteractor(); // - void SetPlaceFactor(float theFactor); - float GetPlaceFactor(); + void + SetPlaceFactor(vtkFloatingPointType theFactor); + + vtkFloatingPointType + GetPlaceFactor(); // void SetActiveIndex(const int theFlag); int GetActiveIndex()const; @@ -106,7 +111,7 @@ protected: int myActiveIndex; int myCounter; int myDisableAll; - float myPriority; + vtkFloatingPointType myPriority; VISU_ImplicitFunctionWidget *myWidgets[2]; VISU_ImplicitFunctionWidget *myDummyWidget; VISU_PlanesWidget *myPlanesWidget; diff --git a/src/PIPELINE/VISU_img2vti.cxx b/src/PIPELINE/VISU_img2vti.cxx index 8cc0a475..bba49bfc 100644 --- a/src/PIPELINE/VISU_img2vti.cxx +++ b/src/PIPELINE/VISU_img2vti.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File: VISU_img2vti.cxx diff --git a/src/VISUGUI/Makefile.in b/src/VISUGUI/Makefile.in index 1c2f20f1..b3eaeb69 100644 --- a/src/VISUGUI/Makefile.in +++ b/src/VISUGUI/Makefile.in @@ -17,7 +17,7 @@ # 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # # # @@ -39,7 +39,7 @@ EXPORT_HEADERS= \ # .po files to transform in .qm PO_FILES = \ - VISU_msg_en.po VISU_images.po VISUM_msg_en.po VISUM_images.po + VISU_msg_en.po VISU_images.po # Libraries targets LIB = libVISU.la @@ -119,17 +119,17 @@ LIB_SERVER_IDL = CPPFLAGS += -ftemplate-depth-32 $(QT_INCLUDES) $(VTK_INCLUDES) $(OCC_INCLUDES) \ $(PYTHON_INCLUDES) $(HDF5_INCLUDES) $(QWT_INCLUDES) \ - -I${KERNEL_ROOT_DIR}/include/salome \ - -I${MED_ROOT_DIR}/include/salome \ + $(KERNEL_CXXFLAGS) \ + $(MED_CXXFLAGS) \ $(BOOST_CPPFLAGS) CXXFLAGS += -ftemplate-depth-32 $(OCC_CXXFLAGS) \ - -I${KERNEL_ROOT_DIR}/include/salome \ - -I${GUI_ROOT_DIR}/include/salome + $(KERNEL_CXXFLAGS) \ + $(GUI_CXXFLAGS) LDFLAGS += $(QWT_LIBS) -lSalomeNS \ -lSVTK -lVVTK -lSPlot2d -lVisuObject -lVISUEngineImpl -lVISUGUITOOLS \ - -L${KERNEL_ROOT_DIR}/lib/salome \ - -L${GUI_ROOT_DIR}/lib/salome + $(KERNEL_LDFLAGS) \ + $(GUI_LDFLAGS) @CONCLUDE@ diff --git a/src/VISUGUI/VISU_images.po b/src/VISUGUI/VISU_images.po index 7357d06a..afee2ba5 100644 --- a/src/VISUGUI/VISU_images.po +++ b/src/VISUGUI/VISU_images.po @@ -17,7 +17,7 @@ # 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # # # @@ -32,6 +32,8 @@ msgstr "" "Last-Translator: FULLNAME \n" "Content-Type: text/plain; charset=iso-8859-1\n" +msgid "ICON_IMPORT_MED" +msgstr "Visu_import_med.png" msgid "ICON_OBJBROWSER_Visu" msgstr "Visu_tree_visu.png" @@ -86,8 +88,6 @@ msgstr "Visu_selectonly.png" msgid "ICON_SCALING" msgstr "Visu_scaling.png" -# - msgid "ICON_TIMEANIMATION" msgstr "Visu_anim.png" @@ -99,3 +99,36 @@ msgstr "Visu_plot3d.png" msgid "ICON_CUBE_AXES" msgstr "Visu_graduated_axes.png" + +msgid "ICON_GAUSS_NEW_VIEWER" +msgstr "Visu_points.png" + +msgid "ICON_GAUSS_POINTS" +msgstr "Visu_gauss_points.png" + +msgid "ICON_VVTK_INTERACTOR_STYLE_SWITCH" +msgstr "Visu_vvtk_switch.png" + +msgid "ICON_VVTK_SELECTION_MODE_SWITCH" +msgstr "Visu_points.png" + +msgid "ICON_VVTK_PLANE_SEGMENTATION_SWITCH" +msgstr "Visu_PlaneSegmentation.png" + +msgid "ICON_VVTK_SPHERE_SEGMENTATION_SWITCH" +msgstr "Visu_SphereSegmentation.png" + +msgid "ICON_VVTK_RECORDING_START" +msgstr "Visu_recording_start.png" + +msgid "ICON_VVTK_RECORDING_PLAY" +msgstr "Visu_recording_play.png" + +msgid "ICON_VVTK_RECORDING_PAUSE" +msgstr "Visu_recording_pause.png" + +msgid "ICON_VVTK_RECORDING_STOP" +msgstr "Visu_recording_stop.png" + +msgid "ICON_LOAD_TEXTURE" +msgstr "Visu_load_texture.png" diff --git a/src/VISUGUI/VISU_msg_en.po b/src/VISUGUI/VISU_msg_en.po index eb50916f..c5683bd1 100644 --- a/src/VISUGUI/VISU_msg_en.po +++ b/src/VISUGUI/VISU_msg_en.po @@ -1,3 +1,22 @@ +# Copyright (C) 2005 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 +# msgid "" msgstr "" "Project-Id-Version: PROJECT VERSION\n" @@ -6,18 +25,6 @@ msgstr "" "Last-Translator: FULLNAME \n" "Content-Type: text/plain; charset=iso-8859-1\n" -msgid "BUT_OK" -msgstr "OK" - -msgid "BUT_APPLY" -msgstr "Apply" - -msgid "BUT_CLOSE" -msgstr "Close" - -msgid "BUT_CANCEL" -msgstr "Cancel" - msgid "WRN_VISU" msgstr "Post-Pro Warning" @@ -155,22 +162,31 @@ msgstr "MED files import" msgid "VISU_PREF_MED_FULL_LOAD" msgstr "Full MED loading" -msgid "VISU_PREF_REPRESENT_PROPS" +msgid "VISU_REPRESENT_PROPS" msgstr "Representation properties" -msgid "VISU_PREF_SHADING" +msgid "VISU_USE_SHADING" msgstr "Use Shading" +msgid "VISU_SHRINK" +msgstr "Shrink" + #: VisuGUI.cxx +msgid "VisuGUI::MEN_IMPORT" +msgstr "Import" + msgid "VisuGUI::MEN_IMPORT_FROM_FILE" +msgstr "MED file" + +msgid "VisuGUI::IMPORT_FROM_FILE" msgstr "Import from File" -msgid "VisuGUI::MEN_EXPLORE_MED_FILE" -msgstr "Explore MED File" +msgid "VisuGUI::USE_BUILD_PROGRESS" +msgstr "Use build progress" msgid "VisuGUI::MEN_IMPORT_TABLE" -msgstr "Import table from File" +msgstr "Table from file" msgid "VisuGUI::MEN_SCALAR_MAP" msgstr "Scalar Map" @@ -184,6 +200,9 @@ msgstr "Scalar Map on Deformed Shape" msgid "VisuGUI::MEN_VISUALIZATION" msgstr "Visualization" +msgid "VisuGUI::TOOL_IMPORT" +msgstr "Import Toolbar" + msgid "VisuGUI::TOOL_VISUALISATION" msgstr "Visualization Toolbar" @@ -379,9 +398,9 @@ msgstr "Use Field Range" msgid "VisuGUI::MEN_ARRANGE_ACTORS" msgstr "Arrange Actors" +msgid "VisuGUI::MEN_PLOT3D_FROM_CUTPLANE" +msgstr "Plot3d" -msgid "VisuGUI::ERR_ERROR_IN_THE_FILE" -msgstr "Error in the file" msgid "VisuGUI::ERR_ERROR_DURING_EXPORT" msgstr "Error has been occured during exporting to file" @@ -1275,3 +1294,806 @@ msgstr "Yes" msgid "VisuGUI_SetupPlot2dDlg::QUE_WANT_SAME_UNITS" msgstr "Do you want to choose all items with the same units for vertical axis?" +msgid "INF_VISU" +msgstr "Post-Pro Info" + +msgid "IMPORT_DONE" +msgstr "Importing is done" + +msgid "VisuGUI_Module::MEN_VISUALISATION" +msgstr "Visualization" + +msgid "VisuGUI_Module::TOOL_IMPORT" +msgstr "Import Toolbar" + +msgid "VisuGUI_Module::TOOL_VISUALISATION" +msgstr "Visualization Toolbar" + +msgid "VisuGUI_Module::MEN_SAVE_CONFIGURATION" +msgstr "Store current configuration" + +msgid "VisuGUI_Module::MEN_OVERWRITE_CONFIGURATION" +msgstr "Overwrite current configuration" + +msgid "VisuGUI_Module::MEN_RESTORE_CONFIGURATION" +msgstr "Restore current configuration" + +msgid "VisuGUI_Module::MEN_GAUSS" +msgstr "Gauss" + +msgid "VisuGUI_Module::MEN_GAUSS_NEW_VIEWER" +msgstr "Points view" + +msgid "VisuGUI_Module::MEN_GAUSS_CREATE_PRS" +msgstr "Gauss Points" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_TAB_TTL" +msgstr "Gauss Points" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" +msgstr "Primitive" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_PRIMITIVE_TYPE" +msgstr "Primitive Type" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_POINTSPRITE" +msgstr "Point sprite" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_OPENGLPOINT" +msgstr "OpenGL point" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_GEOMSPHERE" +msgstr "Geometrical sphere" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_CLAMP" +msgstr "Maximum Size (Clamp)" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_MAIN_TEXTURE" +msgstr "Main Texture (16x16)" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_ALPHA_TEXTURE" +msgstr "Alpha Channel Texture (16x16)" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_ALPHA_THRESHOLD" +msgstr "Alpha Channel Threshold" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_RESOLUTION" +msgstr "Geometrical sphere resolution" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_FACE_LIMIT" +msgstr "Notify when number of faces exceeds" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_SIZE_GROUP_TTL" +msgstr "Size" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_MIN_SIZE" +msgstr "Range value for min size (%)" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_MAX_SIZE" +msgstr "Range value for max size (%)" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_MAGNIFICATION" +msgstr "Magnification (%)" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_INCREMENT" +msgstr "+/- Ratio" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_GEOM_GROUP_TTL" +msgstr "Geometry" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_SIZE" +msgstr "Size of points (%)" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_COLOR" +msgstr "Color" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_DEFORMED_SHAPE_GROUP_TTL" +msgstr "Deformed Shape" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_SCALE_FACTOR" +msgstr "Scale factor" + +msgid "VisuGUI_Module::VISU_GAUSS_SCALAR_BAR_PREF_TAB_TTL" +msgstr "Gauss Points Scalar Bar" + +msgid "VisuGUI_Module::VISU_GAUSS_SCALAR_BAR_PREF_GROUP_TTL" +msgstr "Gauss Points Scalar Bar" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_ACTIVE_BAR" +msgstr "Active bar" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_LOCAL" +msgstr "Local" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_GLOBAL" +msgstr "Global" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_DISPLAY_GLOBAL" +msgstr "Display global bar" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_SCALAR_BAR_MODE" +msgstr "Scalar bar mode" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_BICOLOR" +msgstr "Bicolor" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_RAINBOW" +msgstr "Rainbow" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_SPACING" +msgstr "Spacing" + +msgid "VisuGUI_Module::VISU_GAUSS_INSIDE_CURSOR_PREF_TAB_TTL" +msgstr "Inside Cursor" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_MAGNIFICATION_GROUP_TTL" +msgstr "Magnification (Inside and Outside)" + +msgid "VisuGUI_Module::VISU_GAUSS_OUTSIDE_CURSOR_PREF_TAB_TTL" +msgstr "Outside Cursor" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_UNIFORM_COLOR" +msgstr "Uniform Color" + +msgid "VisuGUI_Module::VISU_GAUSS_PREF_COLOR_GROUP_TTL" +msgstr "Color" + +msgid "VisuGUI_Module::VISU_PICKING_PREF_TAB_TTL" +msgstr "Picking" + +msgid "VisuGUI_Module::VISU_PICKING_PREF_CURSOR_GROUP_TTL" +msgstr "Cursor" + +msgid "VisuGUI_Module::VISU_PICKING_PREF_CURSOR_SIZE" +msgstr "Size of the cursor" + +msgid "VisuGUI_Module::VISU_PICKING_PREF_PYRAMID_HEIGHT" +msgstr "Height of the pyramids" + +msgid "VisuGUI_Module::VISU_PICKING_PREF_SELECTION_COLOR" +msgstr "Selection cursor color" + +msgid "VisuGUI_Module::VISU_PICKING_PREF_TOLERANCE_GROUP_TTL" +msgstr "Tolerance" + +msgid "VisuGUI_Module::VISU_PICKING_PREF_POINT_SELECTION_TOLERANCE" +msgstr "Point selection tolerance" + +msgid "VisuGUI_Module::VISU_PICKING_PREF_INFO_WINDOW_GROUP_TTL" +msgstr "Information window" + +msgid "VisuGUI_Module::VISU_PICKING_PREF_TRANSPARENCY" +msgstr "Transparency" + +msgid "VisuGUI_Module::VISU_PICKING_PREF_POSITION" +msgstr "Position" + +msgid "VisuGUI_Module::VISU_PICKING_PREF_BELOW_POINT" +msgstr "Centered below the point" + +msgid "VisuGUI_Module::VISU_PICKING_PREF_TOP_LEFT_CORNER" +msgstr "Top-left corner of the 3D view" + +msgid "VisuGUI_Module::VISU_PICKING_PREF_CAMERA_GROUP_TTL" +msgstr "Movement of the camera" + +msgid "VisuGUI_Module::VISU_PICKING_PREF_ZOOM_FACTOR" +msgstr "Zoom at first selected point (ratio)" + +msgid "VisuGUI_Module::VISU_PICKING_PREF_STEP_NUMBER" +msgstr "Number of steps between two positions" + +msgid "VisuGUI_Module::VISU_PICKING_PREF_PARENT_MESH_TTL" +msgstr "Parent mesh element" + +msgid "VisuGUI_Module::VISU_PICKING_PREF_DISPLAY_PARENT_MESH" +msgstr "Display parent mesh element" + +msgid "VisuGUI_Module::VISU_MOUSE_PREF_TAB_TLT" +msgstr "Navigation" + +msgid "VisuGUI_Module::VISU_MOUSE_PREF_GROUP_TLT" +msgstr "Mouse" + +msgid "VisuGUI_Module::VISU_MOUSE_PREF" +msgstr "Mouse behaviour" + +msgid "VisuGUI_Module::VISU_MOUSE_PREF_STANDARD" +msgstr "Salome standard controls" + +msgid "VisuGUI_Module::VISU_MOUSE_PREF_KEYBOARD_FREE" +msgstr "Keyboard free" + +msgid "VisuGUI_Module::VISU_KEYBOARD_PREF_GROUP_TTL" +msgstr "Keyboard" + +msgid "VisuGUI_Module::VISU_KEYBOARD_PREF" +msgstr "[+]/[-] Speed increment" + +msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF" +msgstr "Spacemouse" + +msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_1" +msgstr "Decrease speed increment" + +msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_2" +msgstr "Increase speed increment" + +msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_3" +msgstr "Decrease Gauss points magnification" + +msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_4" +msgstr "Increase Gauss points magnification" + +msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_5" +msgstr "Dominant / combined switch" + +msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_BTN_1" +msgstr "Button 1" + +msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_BTN_2" +msgstr "Button 2" + +msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_BTN_3" +msgstr "Button 3" + +msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_BTN_4" +msgstr "Button 4" + +msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_BTN_5" +msgstr "Button 5" + +msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_BTN_6" +msgstr "Button 6" + +msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_BTN_7" +msgstr "Button 7" + +msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_BTN_8" +msgstr "Button 8" + +msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_BTN_10" +msgstr "Button 10" + +msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_BTN_11" +msgstr "Button 11" + +msgid "VisuGUI_Module::VISU_SPACEMOUSE_PREF_BTN_*" +msgstr "Button *" + +msgid "VisuGUI_Module::VISU_CAMERA_PREF_GROUP_TTL" +msgstr "Camera movements" + +msgid "VisuGUI_Module::VISU_CAMERA_MOVE_PREF" +msgstr "Number of steps between two positions" + +msgid "VisuGUI_Module::VISU_RECORDER_PREF_TAB_TTL" +msgstr "Recorder" + +msgid "VisuGUI_Module::VISU_RECORDER_PREF_GROUP_TTL" +msgstr "Settings" + +msgid "VisuGUI_Module::VISU_RECORDER_PREF_RECORDING_MODE" +msgstr "Mode" + +msgid "VisuGUI_Module::VISU_RECORDER_PREF_SKIPPED_FRAMES" +msgstr "Recording at a given FPS" + +msgid "VisuGUI_Module::VISU_RECORDER_PREF_ALL_DISLPAYED_FRAMES" +msgstr "Recording all displayed frames" + +msgid "VisuGUI_Module::VISU_RECORDER_PREF_FPS" +msgstr "FPS" + +msgid "VisuGUI_Module::VISU_RECORDER_PREF_QUALITY" +msgstr "Quality" + +msgid "VisuGUI_Module::VISU_RECORDER_PREF_PROGRESSIVE" +msgstr "Progressive" + +msgid "VisuGUI_GaussPointsDlg::DLG_PREF_TITLE" +msgstr "Gauss Points Preferences" + +msgid "VisuGUI_GaussPointsDlg::DLG_PROP_TITLE" +msgstr "Gauss Points Properties" + +msgid "VisuGUI_BuildProgressDlg::DLG_BUILD_PROGRESS_TITLE" +msgstr "Build progress" + +msgid "VisuGUI_BuildProgressDlg::IMPORT_SETTINGS" +msgstr "Settings" + +msgid "VisuGUI_BuildProgressDlg::FILE_NAME" +msgstr "Import file : " + +msgid "VisuGUI_BuildProgressDlg::BUILD_AT_ONCE" +msgstr "Build at once" + +msgid "VisuGUI_BuildProgressDlg::BUILD_ALL" +msgstr "Build all" + +msgid "VisuGUI_BuildProgressDlg::IMPORT_PROGRESS" +msgstr "Import progress" + +msgid "VisuGUI_BuildProgressDlg::BUILD_ENTITIES" +msgstr "Build entities" + +msgid "VisuGUI_BuildProgressDlg::BUILD_FIELDS" +msgstr "Build fields" + +msgid "VisuGUI_BuildProgressDlg::BUILD_GROUPS" +msgstr "Build groups" + +msgid "VisuGUI_BuildProgressDlg::BUILD_MINMAX" +msgstr "Build min/max" + +msgid "VisuGUI_BuildProgressDlg::IMPORT_TIME" +msgstr "Time" + +msgid "VisuGUI_BuildProgressDlg::TIME" +msgstr "Elapsed time : " + +msgid "VisuGUI_BuildProgressDlg::IMPORT_FROM_FILE" +msgstr "Import from File" + +msgid "VisuGUI_BuildProgressDlg::FLT_ALL_FILES" +msgstr "All Files (*.*)" + +msgid "VisuGUI_BuildProgressDlg::FLT_MED_FILES" +msgstr "MED Files (*.med)" + +msgid "VisuGUI_BuildProgressDlg::CLOSE_AT_FINISH" +msgstr "Close dialog at finish" + +msgid "VisuGUI_BuildProgressDlg::START" +msgstr "Start" + +msgid "VisuGUI_BuildProgressDlg::CLOSE" +msgstr "Close" + +msgid "VisuGUI_BuildProgressDlg::HELP" +msgstr "Help" + +msgid "VisuGUI_BuildProgressDlg::ERR_ERROR_IN_THE_FILE" +msgstr "Error in the file" + +msgid "VVTK_RecorderDlg::DLG_RECORDER_TITLE" +msgstr "Recorder" + +msgid "VVTK_RecorderDlg::SETTINGS" +msgstr "Settings" + +msgid "VVTK_RecorderDlg::FILE_NAME" +msgstr "Save to file : " + +msgid "VVTK_RecorderDlg::FLT_ALL_FILES" +msgstr "All Files (*.*)" + +msgid "VVTK_RecorderDlg::FLT_AVI_FILES" +msgstr "AVI Files (*.avi)" + +msgid "VVTK_RecorderDlg::RECORDING_MODE" +msgstr "Mode : " + +msgid "VVTK_RecorderDlg::SKIPPED_FRAMES" +msgstr "Recording at a given FPS" + +msgid "VVTK_RecorderDlg::ALL_DISLPAYED_FRAMES" +msgstr "Recording all displayed frames" + +msgid "VVTK_RecorderDlg::FPS" +msgstr "FPS : " + +msgid "VVTK_RecorderDlg::QUALITY" +msgstr "Quality : " + +msgid "VVTK_RecorderDlg::PROGRESSIVE" +msgstr "Progressive" + +msgid "VVTK_RecorderDlg::START" +msgstr "Start" + +msgid "VVTK_RecorderDlg::CLOSE" +msgstr "Close" + +msgid "VisuGUI_TransparencyDlg::TRANSPARENCY_TITLE" +msgstr "Change Transparency" + +msgid "VisuGUI_TransparencyDlg::TRANSPARENCY_TRANSPARENT" +msgstr "Transparent" + +msgid "VisuGUI_TransparencyDlg::TRANSPARENCY_OPAQUE" +msgstr "Opaque" + +msgid "VisuGUI_TransparencyDlg::BUT_CLOSE" +msgstr "Close" + +msgid "VVTK_ViewManager::VTK_VIEW_TITLE" +msgstr "Gauss scene:%1 - viewer:%2" + +msgid "VVTK_MainWindow::LBL_TOOLBAR_RECORD_LABEL" +msgstr "Recording Operations" + +msgid "VVTK_MainWindow::MNU_VVTK_RECORDING_START" +msgstr "Start recording" + +msgid "VVTK_MainWindow::DSC_VVTK_RECORDING_START" +msgstr "Start recording" + +msgid "VVTK_MainWindow::MNU_VVTK_RECORDING_PLAY" +msgstr "Play recording" + +msgid "VVTK_MainWindow::DSC_VVTK_RECORDING_PLAY" +msgstr "Play recording" + +msgid "VVTK_MainWindow::MNU_VVTK_RECORDING_PAUSE" +msgstr "Pause recording" + +msgid "VVTK_MainWindow::DSC_VVTK_RECORDING_PAUSE" +msgstr "Pause recording" + +msgid "VVTK_MainWindow::MNU_VVTK_RECORDING_STOP" +msgstr "Stop recording" + +msgid "VVTK_MainWindow::DSC_VVTK_RECORDING_STOP" +msgstr "Stop recording" + +msgid "VVTK_MainWindow1::LBL_TOOLBAR_GAUSS_LABEL" +msgstr "Gauss Viewer Tools" + +msgid "VVTK_MainWindow1::MNU_VVTK_INTERACTOR_STYLE_SWITCH" +msgstr "Interaction Style Switch" + +msgid "VVTK_MainWindow1::DSC_VVTK_INTERACTOR_STYLE_SWITCH" +msgstr "Interaction Style Switch" + +msgid "VVTK_MainWindow1::MNU_VVTK_SELECTION_MODE_SWITCH" +msgstr "Selection Mode Switch" + +msgid "VVTK_MainWindow1::DSC_VVTK_SELECTION_MODE_SWITCH" +msgstr "Selection Mode Switch" + +msgid "VVTK_MainWindow1::MNU_VVTK_PLANE_SEGMENTATION_SWITCH" +msgstr "Plane Segmentation" + +msgid "VVTK_MainWindow1::DSC_VVTK_PLANE_SEGMENTATION_SWITCH" +msgstr "Plane Segmentation" + +msgid "VVTK_MainWindow1::MNU_VVTK_SPHERE_SEGMENTATION_SWITCH" +msgstr "Sphere Segmentation" + +msgid "VVTK_MainWindow1::DSC_VVTK_SPHERE_SEGMENTATION_SWITCH" +msgstr "Sphere Segmentation" + +msgid "VVTK_PrimitiveBox::PRIMITIVE_TITLE" +msgstr "Primitive" + +msgid "VVTK_PrimitiveBox::POINT_SPRITE" +msgstr "Point Sprite" + +msgid "VVTK_PrimitiveBox::OPENGL_POINT" +msgstr "OpenGL Point" + +msgid "VVTK_PrimitiveBox::GEOMETRICAL_SPHERE" +msgstr "Geometrical Sphere" + +msgid "VVTK_PrimitiveBox::CLAMP" +msgstr "Maximum Size (Clamp) : " + +msgid "VVTK_PrimitiveBox::MAIN_TEXTURE" +msgstr "Main Texture (16x16) : " + +msgid "VVTK_PrimitiveBox::ALPHA_TEXTURE" +msgstr "Alpha Channel Texture (16x16) : " + +msgid "VVTK_PrimitiveBox::ALPHA_THRESHOLD" +msgstr "Alpha Channel Threshold : " + +msgid "VVTK_PrimitiveBox::RESOLUTION" +msgstr "Resolution : " + +msgid "VVTK_PrimitiveBox::FACE_NUMBER" +msgstr "Number of faces : " + +msgid "VVTK_PrimitiveBox::FACE_LIMIT" +msgstr "Notify when number of faces exceeds : " + +msgid "VVTK_SizeBox::SIZE_TITLE" +msgstr "Size" + +msgid "VVTK_SizeBox::OUTSIDE_SIZE" +msgstr "Percentage of normal size(%) : " + +msgid "VVTK_SizeBox::GEOM_SIZE" +msgstr "Size of points (%) : " + +msgid "VVTK_SizeBox::MIN_SIZE" +msgstr "Range values for min size (%) : " + +msgid "VVTK_SizeBox::MAX_SIZE" +msgstr "max size (%) : " + +msgid "VVTK_SizeBox::MAGNIFICATION" +msgstr "Magnification (%) : " + +msgid "VVTK_SizeBox::INCREMENT" +msgstr "+/- Ratio : " + +msgid "VVTK_SizeBox::COLOR_TITLE" +msgstr "Color" + +msgid "VVTK_SizeBox::UNIFORM_COLOR" +msgstr "Uniform Color" + +msgid "VVTK_SizeBox::COLOR" +msgstr "Color : " + +msgid "VisuGUI_GaussPointsDlg::&Cancel" +msgstr "" + +msgid "VisuGUI_GaussPointsDlg::&OK" +msgstr "" + +msgid "VisuGUI_GaussPointsDlg::WARNING" +msgstr "Warning" + +msgid "VisuGUI_GaussPointsDlg::DLG_TITLE" +msgstr "Gauss Points" + +msgid "VisuGUI_GaussPointsDlg::GAUSS_POINTS_TAB" +msgstr "Gauss Points" + +msgid "VisuGUI_GaussPointsDlg::SCALAR_BAR_TAB" +msgstr "Scalar Bar" + +msgid "VisuGUI_GaussPointsDlg::PRS_TITLE" +msgstr "Presentation" + +msgid "VisuGUI_GaussPointsDlg::RESULTS" +msgstr "Results" + +msgid "VisuGUI_GaussPointsDlg::GEOMETRY" +msgstr "Geometry" + +msgid "VisuGUI_GaussPointsDlg::DEFORMED_SHAPE" +msgstr "Deformed Shape" + +msgid "VisuGUI_GaussPointsDlg::DEFORMED_SHAPE_TITLE" +msgstr "Deformed Shape" + +msgid "VisuGUI_GaussPointsDlg::SCALE_FACTOR" +msgstr "Scale Factor :" + +msgid "VisuGUI_GaussScalarBarPane::ACTIVE_BAR_GRP" +msgstr "Active bar" + +msgid "VisuGUI_GaussScalarBarPane::LOCAL" +msgstr "Local" + +msgid "VisuGUI_GaussScalarBarPane::GLOBAL" +msgstr "Global" + +msgid "VisuGUI_GaussScalarBarPane::DISPLAYED" +msgstr "Displayed" + +msgid "VisuGUI_GaussScalarBarPane::SCALAR_RANGE_GRP" +msgstr "Scalar range" + +msgid "VisuGUI_GaussScalarBarPane::LOGARITHMIC_SCALING" +msgstr "Logarithmic scaling" + +msgid "VisuGUI_GaussScalarBarPane::FIELD_RANGE_BTN" +msgstr "Use field range" + +msgid "VisuGUI_GaussScalarBarPane::IMPOSED_RANGE_BTN" +msgstr "Use imposed range" + +msgid "VisuGUI_GaussScalarBarPane::LBL_MIN" +msgstr "Min:" + +msgid "VisuGUI_GaussScalarBarPane::LBL_MAX" +msgstr "Max:" + +msgid "VisuGUI_GaussScalarBarPane::COLORS_LABELS_GRP" +msgstr "Colors and labels" + +msgid "VisuGUI_GaussScalarBarPane::BICOLOR" +msgstr "Bicolor" + +msgid "VisuGUI_GaussScalarBarPane::RAINBOW" +msgstr "Rainbow" + +msgid "VisuGUI_GaussScalarBarPane::LBL_NB_COLORS" +msgstr "Nb. of colors:" + +msgid "VisuGUI_GaussScalarBarPane::LBL_NB_LABELS" +msgstr "Nb. of labels:" + +msgid "VisuGUI_GaussScalarBarPane::ORIENTATION_GRP" +msgstr "Orientation" + +msgid "VisuGUI_GaussScalarBarPane::VERTICAL_BTN" +msgstr "Vertical" + +msgid "VisuGUI_GaussScalarBarPane::HORIZONTAL_BTN" +msgstr "Horizontal" + +msgid "VisuGUI_GaussScalarBarPane::ORIGIN_GRP" +msgstr "Origin" + +msgid "VisuGUI_GaussScalarBarPane::LBL_X" +msgstr "X:" + +msgid "VisuGUI_GaussScalarBarPane::LBL_Y" +msgstr "Y:" + +msgid "VisuGUI_GaussScalarBarPane::DIMENSIONS_GRP" +msgstr "Dimensions" + +msgid "VisuGUI_GaussScalarBarPane::LBL_WIDTH" +msgstr "Width:" + +msgid "VisuGUI_GaussScalarBarPane::LBL_HEIGHT" +msgstr "Height:" + +msgid "VisuGUI_GaussScalarBarPane::LBL_SPACING" +msgstr "Spacing:" + +msgid "VisuGUI_GaussScalarBarPane::SAVE_DEFAULT_CHK" +msgstr "Save as default values" + +msgid "VVTK_ViewWindow::LBL_TOOLBAR_LABEL" +msgstr "GAUSS viewer tools" + +msgid "VVTK_SegmentationCursorDlg::SEGMENTATION_CURSOR_DLG_TITLE" +msgstr "Segmentation Cursor" + +msgid "VVTK_SegmentationCursorDlg::ORIGIN_TITLE" +msgstr "Origin" + +msgid "VVTK_SegmentationCursorDlg::ORIGIN_X" +msgstr "X: " + +msgid "VVTK_SegmentationCursorDlg::ORIGIN_Y" +msgstr "Y: " + +msgid "VVTK_SegmentationCursorDlg::ORIGIN_Z" +msgstr "Z: " + +msgid "VVTK_SegmentationCursorDlg::DIRECTION_TITLE" +msgstr "Direction" + +msgid "VVTK_SegmentationCursorDlg::DIRECTION_DX" +msgstr "DX: " + +msgid "VVTK_SegmentationCursorDlg::DIRECTION_DY" +msgstr "DY: " + +msgid "VVTK_SegmentationCursorDlg::DIRECTION_DZ" +msgstr "DZ: " + +msgid "VVTK_SegmentationCursorDlg::DEPTH_TITLE" +msgstr "Depth" + +msgid "VVTK_SegmentationCursorDlg::DEPTH" +msgstr "Depth of the cursor: " + +msgid "VVTK_SegmentationCursorDlg::RADIUS_TITLE" +msgstr "Radius" + +msgid "VVTK_SegmentationCursorDlg::RADIUS" +msgstr "Radius of the cursor :" + +msgid "VVTK_SegmentationCursorDlg::RATIO" +msgstr "+/- Ratio :" + +msgid "VVTK_SegmentationCursorDlg::SEGMENTATION_CURSOR_TAB" +msgstr "Segmentation Cursor" + +msgid "VVTK_SegmentationCursorDlg::GAUSS_POINTS_TAB" +msgstr "Gauss Points" + +msgid "VVTK_SegmentationCursorDlg::INSIDE_GAUSS_POINTS" +msgstr "Inside Cursor Gauss Points Presentation" + +msgid "VVTK_SegmentationCursorDlg::OUTSIDE_GAUSS_POINTS" +msgstr "Outside Cursor Gauss Points Presentation" + +msgid "VVTK_SegmentationCursorDlg::MAGNIFICATION_TITLE" +msgstr "Magnification" + +msgid "VVTK_SegmentationCursorDlg::MAGNIFICATION" +msgstr "Magnification (%) : " + +msgid "VVTK_SegmentationCursorDlg::INCREMENT" +msgstr "+/- Ratio : " + +msgid "VVTK_PickingDlg::PICKING_DLG_TITLE" +msgstr "Picking" + +msgid "VVTK_PickingDlg::CURSOR_TITLE" +msgstr "Cursor" + +msgid "VVTK_PickingDlg::CURSOR_SIZE" +msgstr "Size of the cursor :" + +msgid "VVTK_PickingDlg::PYRAMID_HEIGHT" +msgstr "Height of the pyramids :" + +msgid "VVTK_PickingDlg::SELECTION_COLOR" +msgstr "Selection cursor color :" + +msgid "VVTK_PickingDlg::TOLERANCE_TITLE" +msgstr "Tolerance" + +msgid "VVTK_PickingDlg::POINT_TOLERANCE" +msgstr "Point tolerance :" + +msgid "VVTK_PickingDlg::INFO_WINDOW_TITLE" +msgstr "Information window" + +msgid "VVTK_PickingDlg::TRANSPARENCY" +msgstr "Transparency :" + +msgid "VVTK_PickingDlg::POSITION" +msgstr "Position :" + +msgid "VVTK_PickingDlg::BELOW_POINT" +msgstr "Centered below the point" + +msgid "VVTK_PickingDlg::TOP_LEFT_CORNER" +msgstr "Top-left corner of the 3D view" + +msgid "VVTK_PickingDlg::CAMERA_TITLE" +msgstr "Movement of the camera" + +msgid "VVTK_PickingDlg::ZOOM_FACTOR" +msgstr "Zoom at first selected point (ratio) :" + +msgid "VVTK_PickingDlg::STEP_NUMBER" +msgstr "Number of steps between two positions :" + +msgid "VVTK_PickingDlg::PARENT_MESH_TITLE" +msgstr "Parent mesh element" + +msgid "VVTK_PickingDlg::DISPLAY_PARENT_MESH" +msgstr "Display parent mesh element" + +msgid "VisuGUI_Module::TOT_DESK_FILE_SAVE_GUI_STATE" +msgstr "Save VISU state" + +msgid "VisuGUI_Module::MEN_DESK_FILE_SAVE_GUI_STATE" +msgstr "Save VISU state" + +msgid "VisuGUI_Module::PRP_DESK_FILE_SAVE_GUI_STATE" +msgstr "Saves current state of viewers, displayed objects, etc." + +msgid "VISU_MESH" +msgstr "Mesh" + +msgid "VISU_SCALAR_MAP" +msgstr "Scalar Map" + +msgid "VISU_ISO_SURFACES" +msgstr "Iso Surfaces" + +msgid "VISU_CUT_PLANES" +msgstr "Cut Planes" + +msgid "VISU_CUT_LINES" +msgstr "Cut Lines" + +msgid "VISU_DEFORMED_SHAPE" +msgstr "Deformed Shape" + +msgid "VISU_VECTORS" +msgstr "Vectors" + +msgid "VISU_STREAM_LINES" +msgstr "Stream Lines" + +msgid "VISU_PLOT3D" +msgstr "Plot3D" + +msgid "VISU_SCALAR_MAP_ON_DEFORMED_SHAPE" +msgstr "Scalar Map on Def. Shape" \ No newline at end of file diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index 3aa0b6a6..9ef0a4ab 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -73,6 +73,7 @@ #include "SalomeApp_Application.h" #include "SalomeApp_DataModel.h" #include "SalomeApp_Study.h" +#include "SalomeApp_CheckFileDlg.h" #include "LightApp_SelectionMgr.h" #include "LightApp_Selection.h" #include "LightApp_Preferences.h" @@ -95,7 +96,6 @@ #include "VisuGUI_PopupTools.h" #include "VisuGUI_NameDlg.h" -#include "VisuGUI_FileDlg.h" #include "VisuGUI_CursorDlg.h" #include "VisuGUI_Selection.h" #include "VisuGUI_TimeAnimation.h" @@ -142,6 +142,8 @@ #include "VisuGUI_Timer.h" +#include "VVTK_ViewModel.h" + using namespace VISU; #ifdef _DEBUG_ @@ -176,55 +178,68 @@ OnImportFromFile() if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()"); if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) ) return; + + SUIT_ResourceMgr* aResourceMgr = GetResourceMgr(); - VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) ); - aBuildProgressDlg->setGenerator( GetVisuGen(this) ); - aBuildProgressDlg->show(); -} - - -void -VisuGUI:: -OnExploreMEDFile() -{ - if(MYDEBUG) MESSAGE("VisuGUI::OnExploreMEDFile()"); - _PTR(Study) aStudy = GetCStudy(GetAppStudy(this)); - if ( CheckLock(aStudy,GetDesktop(this)) ) - return; - - SALOME_MED::MED_Gen_var aGen = GetMEDEngine(); - + // Get file name QStringList aFilter; - aFilter.append( tr("FLT_MED_FILES") ); - aFilter.append( tr("FLT_ALL_FILES") ); - - QFileInfo aFileInfo = - SUIT_FileDlg::getFileName(GetDesktop(this), - "", - aFilter, - tr("MEN_EXPLORE_MED_FILE"), - true); - if(aFileInfo.exists()){ - application()->putInfo( tr("MEN_EXPLORE_MED_FILE") + " " + aFileInfo.filePath() + "..." ); - std::string aStudyName = aStudy->Name(); - try + aFilter.append( tr( "FLT_MED_FILES" ) ); + aFilter.append( tr( "FLT_ALL_FILES" ) ); + + bool toUseBuildProgress = aResourceMgr->booleanValue("VISU", "use_build_progress", false); + + SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg( GetDesktop(this), true, tr("USE_BUILD_PROGRESS") ); + fd->setCaption( tr( "IMPORT_FROM_FILE" ) ); + fd->setFilters( aFilter ); + fd->SetChecked( toUseBuildProgress ); + fd->exec(); + QFileInfo aFileInfo( fd->selectedFile() ); + toUseBuildProgress = fd->IsChecked(); + delete fd; + + // Check the file name + if ( !aFileInfo.exists() ) + return; + + if ( !toUseBuildProgress ) { - aGen->readStructFileWithFieldType(aFileInfo.filePath(),aStudyName.c_str()); + bool toBuildFields = aResourceMgr->booleanValue( "VISU", "build_fields", true ); + bool toBuildMinMax = aResourceMgr->booleanValue( "VISU", "build_min_max", true ); + bool toBuildGroups = aResourceMgr->booleanValue( "VISU", "build_groups", true ); + bool toBuildAll = aResourceMgr->booleanValue( "VISU", "full_med_loading", false ); + bool toBuildAtOnce = aResourceMgr->booleanValue( "VISU", "build_at_once", false ); + + QString anInfo("Importing From File " + aFileInfo.filePath() + "..." ); + application()->putInfo( anInfo ); + + QApplication::setOverrideCursor(Qt::waitCursor); + VISU::Result_var aResult = GetVisuGen(this)->CreateResult( aFileInfo.filePath() ); + + if (CORBA::is_nil(aResult.in())) { + SUIT_MessageBox::warn1(GetDesktop(this), + tr("WRN_VISU"), + VisuGUI_BuildProgressDlg::tr("ERR_ERROR_IN_THE_FILE"), + tr("BUT_OK")); + QApplication::restoreOverrideCursor(); + }else{ + aResult->SetBuildFields( toBuildFields, toBuildMinMax ); + aResult->SetBuildGroups( toBuildGroups ); + aResult->Build( toBuildAll, toBuildAtOnce ); + + UpdateObjBrowser(this); + application()->putInfo( anInfo + tr("INF_DONE")); + QApplication::restoreOverrideCursor(); + } } - catch(...) + else { - SUIT_MessageBox::warn1(GetDesktop(this), - tr("WRN_VISU"), - tr("ERR_ERROR_IN_THE_FILE"), - tr("BUT_OK")); + VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) ); + aBuildProgressDlg->setFileName( aFileInfo.filePath() ); + aBuildProgressDlg->setGenerator( GetVisuGen(this) ); + aBuildProgressDlg->show(); } - application()->putInfo(aFileInfo.filePath()+tr("INF_DONE")); - getApp()->updateObjectBrowser(true); // as need to update MED tree - getApp()->updateActions(); - } } - void VisuGUI:: OnImportTableFromFile() @@ -426,11 +441,33 @@ CreateCurves( SalomeApp_Module* theModule, _PTR(ChildIterator) aIter = aStudy->NewChildIterator(aSObject); for (; aIter->More(); aIter->Next()) { _PTR(SObject) aTblObj = aIter->Value(); - if ( aTblObj ) { + if( aTblObj ) { _PTR(GenericAttribute) anAttr; if (aTblObj->FindAttribute( anAttr, "AttributeName" ) ) { + + _PTR(ChildIterator) aChildIter = aStudy->NewChildIterator( aTblObj ); + SalomeApp_Study* salome_study = GetAppStudy( theModule ); + for( aChildIter->InitEx( false ); aChildIter->More(); aChildIter->Next() ){ + salome_study->deleteReferencesTo( aChildIter->Value() ); + _PTR(SObject) aSO = aChildIter->Value(); + if(aSO){ + if (getValue(aSO, "myComment") == QString("CURVE")) { + CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSO); + if(!CORBA::is_nil(aCORBAObject)){ + PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject); + VISU::Curve_i* pCrv = dynamic_cast(aServant.in()); + if(pCrv){ + PlotRemoveCurve(theModule,pCrv); + } + } + } + } + + } + aBuilder->RemoveObjectWithChildren( aTblObj ); // We should have only one child - UpdateObjBrowser(theModule,true,aTblObj); + + //UpdateObjBrowser(theModule,true,aTblObj); break; } } @@ -476,9 +513,10 @@ OnCreateMesh() return; // create a VTK view window if it does not exist - GetViewWindow( this, /*create=*/true ); + SVTK_ViewWindow* aViewWindow = GetViewWindow(this); - CreateMesh(this, anIO); + // create mesh presentation and display it in aViewWindow + CreateMesh(this, anIO, aViewWindow); } void @@ -490,7 +528,7 @@ OnCreateManyMesh() return; // create a VTK view window if it does not exist - GetViewWindow( this, /*create=*/true ); + SVTK_ViewWindow* aViewWindow = GetViewWindow(this); // Get selected SObject LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this); @@ -502,7 +540,8 @@ OnCreateManyMesh() if (anIO.IsNull() || !anIO->hasEntry()) return; - CreateMesh(this, anIO); + // create mesh presentation and display it in aViewWindow + CreateMesh(this, anIO, aViewWindow); } } @@ -585,62 +624,65 @@ OnDisplayPrs() { if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs"); + LightApp_SelectionMgr* mgr = GetSelectionMgr(this); + if (!mgr) return; + QApplication::setOverrideCursor(Qt::waitCursor); + + SVTK_ViewWindow* vw = GetActiveViewWindow(this); + SALOME_ListIO aSel, aList; - LightApp_SelectionMgr* mgr = GetSelectionMgr(this); - mgr->selectedObjects( aSel ); + mgr->selectedObjects(aSel); + extractContainers(aSel, aList); - extractContainers( aSel, aList ); + for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) { + Handle(SALOME_InteractiveObject) anIO = it.Value(); + CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this), anIO->getEntry()); - Handle(SALOME_InteractiveObject) anIO; - for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) { - anIO = it.Value(); - CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() ); - if ( !CORBA::is_nil( anObject ) ) { + if (!CORBA::is_nil(anObject)) { // is it Prs3d object ? VISU::Prs3d_i* aPrsObject = dynamic_cast(VISU::GetServant(anObject).in()); - if(aPrsObject){ + if (aPrsObject) { if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Prs3d object"); //UpdateViewer( this, aPrsObject ); - SVTK_ViewWindow* vw = GetViewWindow( this, /*create=*/true ); - if ( vw ) - { - displayer()->Display( anIO->getEntry() ); + if (vw) { + displayer()->Display(anIO->getEntry()); vw->highlight(anIO, 1); } continue; } // is it Curve ? VISU::Curve_i* aCurve = dynamic_cast(VISU::GetServant(anObject).in()); - if(aCurve){ + if (aCurve) { if(MYDEBUG) MESSAGE("VisuGUI::OnDisplayPrs : Curve object"); //PlotCurve( this, aCurve, VISU::eDisplay ); - displayer()->Display( anIO->getEntry() ); + displayer()->Display(anIO->getEntry()); continue; } // is it Container ? VISU::Container_i* aContainer = dynamic_cast(VISU::GetServant(anObject).in()); - if(aContainer){ + if (aContainer) { if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Container object"); //PlotContainer( this, aContainer, VISU::eDisplay ); - displayer()->Display( anIO->getEntry() ); + displayer()->Display(anIO->getEntry()); continue; } // is it Table ? VISU::Table_i* aTable = dynamic_cast(VISU::GetServant(anObject).in()); - if(aTable){ + if (aTable) { if(MYDEBUG) MESSAGE("VisuGUI::DisplayPrs : Table object"); //PlotTable( this, aTable, VISU::eDisplay ); - displayer()->Display( anIO->getEntry() ); + displayer()->Display(anIO->getEntry()); continue; } } } - SVTK_ViewWindow* vw = GetViewWindow( this ); - if ( vw ) { + + if (vw) { vw->getRenderer()->ResetCameraClippingRange(); vw->Repaint(); } + QApplication::restoreOverrideCursor(); } @@ -660,27 +702,24 @@ OnErasePrs() QApplication::setOverrideCursor(Qt::waitCursor); - SVTK_ViewWindow* vw = GetViewWindow( this ); - if (vw) - vw->unHighlightAll(); + //SVTK_ViewWindow* vw = GetActiveViewWindow(this); + //if (vw) + // vw->unHighlightAll(); SALOME_ListIO aList, aSel; LightApp_SelectionMgr* mgr = GetSelectionMgr(this); - mgr->selectedObjects( aSel ); + mgr->selectedObjects(aSel); + extractContainers(aSel, aList); - extractContainers( aSel, aList ); - - Handle(SALOME_InteractiveObject) anIO; - for ( SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next() ) { - anIO = it.Value(); - CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() ); - if (!CORBA::is_nil(anObject)) - RemoveScalarBarPosition(this,anObject); - ErasePrs( this, anObject, false ); + for (SALOME_ListIteratorOfListIO it (aList); it.More(); it.Next()) { + Handle(SALOME_InteractiveObject) anIO = it.Value(); + CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this), anIO->getEntry()); + //ErasePrs(this, anObject, /*repaint_view_window = */false); + ErasePrs(this, anObject, /*repaint_view_window = */true); } - if (vw) - vw->Repaint(); + //if (vw) + // vw->Repaint(); QApplication::restoreOverrideCursor(); } @@ -690,7 +729,7 @@ VisuGUI:: OnEraseAll() { startOperation( myEraseAll ); - if (SVTK_ViewWindow* vw = GetViewWindow(this)) { + if (SVTK_ViewWindow* vw = GetActiveViewWindow(this)) { vw->unHighlightAll(); if (vtkRenderer *aRen = vw->getRenderer()) { vtkActor *anActor; @@ -698,7 +737,7 @@ OnEraseAll() for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) { if (anActor->GetVisibility() > 0) if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) { - RemoveScalarBarPosition(this,anVISUActor->GetPrs3d()); + RemoveScalarBarPosition(this, vw, anVISUActor->GetPrs3d()); anVISUActor->VisibilityOff(); } } @@ -715,26 +754,17 @@ VisuGUI:: OnEditScalarMap() { Handle(SALOME_InteractiveObject) anIO; - if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){ - EditPrs3d(this, aPrs3d); - if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){ - aViewWindow->highlight(anIO, 1); - } - } + if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO)) + EditPrs3d(this, anIO, aPrs3d); } - void VisuGUI:: OnEditDeformedShape() { Handle(SALOME_InteractiveObject) anIO; - if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){ - EditPrs3d(this, aPrs3d); - if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){ - aViewWindow->highlight(anIO, 1); - } - } + if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO)) + EditPrs3d(this, anIO, aPrs3d); } void @@ -742,12 +772,8 @@ VisuGUI:: OnEditScalarMapOnDeformedShape() { Handle(SALOME_InteractiveObject) anIO; - if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){ - EditPrs3d(this, aPrs3d); - if(SVTK_ViewWindow* aViewWindow = GetViewWindow()){ - aViewWindow->highlight(anIO, 1); - } - } + if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO)) + EditPrs3d(this, anIO, aPrs3d); } void @@ -755,82 +781,53 @@ VisuGUI:: OnEditCutPlanes() { Handle(SALOME_InteractiveObject) anIO; - if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){ - EditPrs3d(this, aPrs3d); - if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){ - aViewWindow->highlight(anIO, 1); - } - } + if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO)) + EditPrs3d(this, anIO, aPrs3d); } - void VisuGUI:: OnEditCutLines() { Handle(SALOME_InteractiveObject) anIO; - if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){ - EditPrs3d(this, aPrs3d); - if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){ - aViewWindow->highlight(anIO, 1); - } - } + if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO)) + EditPrs3d(this, anIO, aPrs3d); } - void VisuGUI:: OnEditIsoSurfaces() { Handle(SALOME_InteractiveObject) anIO; - if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){ - EditPrs3d(this, aPrs3d); - if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){ - aViewWindow->highlight(anIO, 1); - } - } + if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO)) + EditPrs3d(this, anIO, aPrs3d); } - void VisuGUI:: OnEditVectors() { Handle(SALOME_InteractiveObject) anIO; - if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){ - EditPrs3d(this, aPrs3d); - if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){ - aViewWindow->highlight(anIO, 1); - } - } + if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO)) + EditPrs3d(this, anIO, aPrs3d); } - void VisuGUI:: OnEditStreamLines() { Handle(SALOME_InteractiveObject) anIO; - if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){ - EditPrs3d(this, aPrs3d); - if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){ - aViewWindow->highlight(anIO, 1); - } - } + if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO)) + EditPrs3d(this, anIO, aPrs3d); } - void VisuGUI:: OnEditPlot3D() { Handle(SALOME_InteractiveObject) anIO; - if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){ - EditPrs3d(this, aPrs3d); - if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this)){ - aViewWindow->highlight(anIO, 1); - } - } + if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO)) + EditPrs3d(this, anIO, aPrs3d); } @@ -903,7 +900,7 @@ OnChangeColor() VISU::Prs3d_i* aPrs3d = dynamic_cast(aServant.in()); if (!aPrs3d) return; - SVTK_ViewWindow* vw = GetViewWindow(this); + SVTK_ViewWindow* vw = GetActiveViewWindow(this); if (!vw) return; VISU_Actor* anActor = GetActor(aPrs3d, vw); @@ -975,7 +972,7 @@ OnChangeWireframeColor() VISU::Prs3d_i* aPrs3d = dynamic_cast(aServant.in()); if (!aPrs3d) return; - SVTK_ViewWindow* vw = GetViewWindow(this); + SVTK_ViewWindow* vw = GetActiveViewWindow(this); if (!vw) return; VISU_Actor* anActor = GetActor(aPrs3d, vw); @@ -1010,7 +1007,7 @@ OnChangeOpacity() VISU::Prs3d_i* aPrsObject = dynamic_cast(aServant.in()); if (!aPrsObject) return; - SVTK_ViewWindow* vw = GetViewWindow(this); + SVTK_ViewWindow* vw = GetActiveViewWindow(this); if (!vw) return; VISU_Actor* anActor = GetActor(aPrsObject, vw); @@ -1033,7 +1030,7 @@ OnChangeLines() VISU::Prs3d_i* aPrsObject = dynamic_cast(aServant.in()); if (!aPrsObject) return; - SVTK_ViewWindow* vw = GetViewWindow(this); + SVTK_ViewWindow* vw = GetActiveViewWindow(this); if (!vw) return; VISU_Actor* anActor = GetActor(aPrsObject, vw); @@ -1114,7 +1111,8 @@ void VisuGUI:: OnDeleteObjects() { - _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this)); + SalomeApp_Study* anAppStudy = GetAppStudy(this); + _PTR(Study) aCStudy = GetCStudy(anAppStudy); if (CheckLock(aCStudy,GetDesktop(this))) return; @@ -1141,8 +1139,44 @@ OnDeleteObjects() for (i = 0; i < nbSelected; i++) { _PTR(SObject) aSObject = aCStudy->FindObjectID(entries[i]); if (aSObject) { - DeleteSObject(this, aCStudy, aSObject); - UpdateObjBrowser(this, true, aSObject); + _PTR(SObject) aRefObj; + if (aSObject->ReferencedObject(aRefObj)) { + // It can be a reference on curve, published under a container. + // In this case the curve should be removed from the container. + // See bug 10441. + CORBA::Object_var aCorbaObj = VISU::GetSelectedObj(anAppStudy, aRefObj->GetID().c_str()); + if (!CORBA::is_nil(aCorbaObj)) { + VISU::Base_var aVisuObj = VISU::Base::_narrow(aCorbaObj); + if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TMESH) + { + DeleteSObject(this, aCStudy, aRefObj); + UpdateObjBrowser(this, true, aRefObj); + } + else if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCURVE) { + VISU::Curve_ptr aCurve = VISU::Curve::_narrow(aVisuObj); + _PTR(SObject) aParentSO = aSObject->GetFather(); + aCorbaObj = VISU::GetSelectedObj(anAppStudy, aParentSO->GetID().c_str()); + if (!CORBA::is_nil(aCorbaObj) && !CORBA::is_nil(aCurve)) { + aVisuObj = VISU::Base::_narrow(aCorbaObj); + if (!CORBA::is_nil(aVisuObj) && aVisuObj->GetType() == VISU::TCONTAINER) { + // Container object + CORBA::Object_ptr aCnt = VISU::Container::_narrow(aVisuObj); + if (!CORBA::is_nil(aCnt)) { + VISU::Container_i* aContainer = + dynamic_cast(VISU::GetServant(aCnt).in()); + if (aContainer && aContainer->GetNbCurves() > 0) { + aContainer->RemoveCurve(aCurve); + UpdateObjBrowser(this, true, aParentSO); + } + } + } + } + } + } + } else { + DeleteSObject(this, aCStudy, aSObject); + UpdateObjBrowser(this, true, aSObject); + } } } @@ -1150,6 +1184,7 @@ OnDeleteObjects() // Finish transaction aStudyBuilder->CommitCommand(); + mgr->clearSelected(); } void @@ -1443,7 +1478,8 @@ OnRestoreViewParams() //jfa tmp:VISU::View3D_i::RestoreViewParams(aViewMgr, anIO->getName()); _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this));//jfa tmp _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry());//jfa tmp - VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp + if ( aSObj ) + VISU::View3D_i::RestoreViewParams(aViewMgr, aSObj->GetName().c_str());//jfa tmp } void @@ -1559,7 +1595,7 @@ OnSweep() VISU::ScalarMap_i* aPrsObject = dynamic_cast(aServant.in()); if (!aPrsObject) return; - SVTK_ViewWindow* vw = GetViewWindow(this); + SVTK_ViewWindow* vw = GetActiveViewWindow(this); if (!vw) return; VISU_Actor* aActor = GetActor(aPrsObject, vw); @@ -1602,7 +1638,7 @@ void VisuGUI:: OnTimeAnimation() { - if(!VISU::GetViewWindow(this)) + if (!VISU::GetActiveViewWindow(this)) return; _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this)); @@ -1641,7 +1677,7 @@ void VisuGUI:: OnShowAnimation() { - if(!VISU::GetViewWindow(this)) + if (!VISU::GetActiveViewWindow(this)) return; LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this); @@ -1699,7 +1735,6 @@ OnCopyPresentation() VISU::Mesh_i* aMeshPrs = dynamic_cast(aPrsObject); VISU::Mesh_i* aSameMesh = new VISU::Mesh_i(aMeshPrs->GetResult()); aSameMesh->SameAs(aMeshPrs); - UpdateViewer(this, aSameMesh); } break; case VISU::TSCALARMAP: @@ -1707,7 +1742,6 @@ OnCopyPresentation() VISU::ScalarMap_i* aScalarPrs = dynamic_cast(aPrsObject); VISU::ScalarMap_i* aSameScalar = new VISU::ScalarMap_i(aScalarPrs->GetResult(),true); aSameScalar->SameAs(aScalarPrs); - UpdateViewer(this, aSameScalar); } break; case VISU::TDEFORMEDSHAPE: @@ -1715,15 +1749,15 @@ OnCopyPresentation() VISU::DeformedShape_i* aDefPrs = dynamic_cast(aPrsObject); VISU::DeformedShape_i* aSameDeformed = new VISU::DeformedShape_i(aDefPrs->GetResult(),true); aSameDeformed->SameAs(aDefPrs); - UpdateViewer(this, aSameDeformed); } break; case VISU::TSCALARMAPONDEFORMEDSHAPE: { - VISU::ScalarMapOnDeformedShape_i* aDefPrs = dynamic_cast(aPrsObject); - VISU::ScalarMapOnDeformedShape_i* aSameScalarMapOnDeformed = new VISU::ScalarMapOnDeformedShape_i(aDefPrs->GetResult(),true); + VISU::ScalarMapOnDeformedShape_i* aDefPrs = + dynamic_cast(aPrsObject); + VISU::ScalarMapOnDeformedShape_i* aSameScalarMapOnDeformed = + new VISU::ScalarMapOnDeformedShape_i(aDefPrs->GetResult(),true); aSameScalarMapOnDeformed->SameAs(aDefPrs); - UpdateViewer(this, aSameScalarMapOnDeformed); } break; case VISU::TCUTPLANES: @@ -1731,7 +1765,6 @@ OnCopyPresentation() VISU::CutPlanes_i* aCutPrs = dynamic_cast(aPrsObject); VISU::CutPlanes_i* aSameCut = new VISU::CutPlanes_i(aCutPrs->GetResult(),true); aSameCut->SameAs(aCutPrs); - UpdateViewer(this, aSameCut); } break; case VISU::TCUTLINES: @@ -1739,7 +1772,6 @@ OnCopyPresentation() VISU::CutLines_i* aCutPrs = dynamic_cast(aPrsObject); VISU::CutLines_i* aSameCut = new VISU::CutLines_i(aCutPrs->GetResult(),true); aSameCut->SameAs(aCutPrs); - UpdateViewer(this, aSameCut); } break; case VISU::TISOSURFACE: @@ -1747,7 +1779,6 @@ OnCopyPresentation() VISU::IsoSurfaces_i* aIsoPrs = dynamic_cast(aPrsObject); VISU::IsoSurfaces_i* aSameIso = new VISU::IsoSurfaces_i(aIsoPrs->GetResult(),true); aSameIso->SameAs(aIsoPrs); - UpdateViewer(this, aSameIso); } break; case VISU::TSTREAMLINES: @@ -1755,7 +1786,6 @@ OnCopyPresentation() VISU::StreamLines_i* aLinesPrs = dynamic_cast(aPrsObject); VISU::StreamLines_i* aSameLines = new VISU::StreamLines_i(aLinesPrs->GetResult(),true); aSameLines->SameAs(aLinesPrs); - UpdateViewer(this, aSameLines); } break; case VISU::TVECTORS: @@ -1763,7 +1793,6 @@ OnCopyPresentation() VISU::Vectors_i* aVectorsPrs = dynamic_cast(aPrsObject); VISU::Vectors_i* aSameVectors = new VISU::Vectors_i(aVectorsPrs->GetResult(),true); aSameVectors->SameAs(aVectorsPrs); - UpdateViewer(this, aSameVectors); } break; case VISU::TPLOT3D: @@ -1771,7 +1800,6 @@ OnCopyPresentation() VISU::Plot3D_i* aPlot3DPrs = dynamic_cast(aPrsObject); VISU::Plot3D_i* aSamePlot3D = new VISU::Plot3D_i(aPlot3DPrs->GetResult()); aSamePlot3D->SameAs(aPlot3DPrs); - UpdateViewer(this, aSamePlot3D); } break; } @@ -1782,7 +1810,7 @@ void VisuGUI:: OnSelectionInfo() { - if (GetViewWindow(this)) + if (GetActiveViewWindow(this)) (new VisuGUI_SelectionDlg(this))->show(); else SUIT_MessageBox::warn1(GetDesktop(this), @@ -1845,11 +1873,9 @@ OnMergeScalarBars() } } if (update) { - if (SVTK_ViewWindow* vw = GetViewWindow(this)) { -//if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) { - vw->getRenderer()->ResetCameraClippingRange(); - vw->Repaint(); -//} + if (SVTK_ViewWindow* vw = GetActiveViewWindow(this)) { + vw->getRenderer()->ResetCameraClippingRange(); + vw->Repaint(); } } } @@ -1884,11 +1910,9 @@ OnFreeScalarBars() } } if (update) { - if (SVTK_ViewWindow* vw = GetViewWindow(this)) { -//if (vw->getRenderer()->GetActors()->GetNumberOfItems() > 0) { - vw->getRenderer()->ResetCameraClippingRange(); - vw->Repaint(); -//} + if (SVTK_ViewWindow* vw = GetActiveViewWindow(this)) { + vw->getRenderer()->ResetCameraClippingRange(); + vw->Repaint(); } } } @@ -1932,7 +1956,7 @@ void VisuGUI:: OnArrangeActors() { - SVTK_ViewWindow* vw = GetViewWindow(this); + SVTK_ViewWindow* vw = GetActiveViewWindow(this); if (vw) { ArrangeDlg* aDlg = new ArrangeDlg (GetDesktop(this), vw); aDlg->exec(); @@ -1962,14 +1986,15 @@ createActions() SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); // Create actions - createAction( VISU_IMPORT_FROM_FILE, "", QIconSet(), + //createAction( VISU_IMPORT_FROM_FILE, "", QIconSet(), + // tr("MEN_IMPORT_FROM_FILE"), "", (CTRL + Key_I), aParent, false, + // this, SLOT(OnImportFromFile())); + + aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_IMPORT_MED")); + createAction( VISU_IMPORT_FROM_FILE, tr("IMPORT_FROM_FILE"), QIconSet(aPixmap), tr("MEN_IMPORT_FROM_FILE"), "", (CTRL + Key_I), aParent, false, this, SLOT(OnImportFromFile())); - createAction( VISU_EXPLORE_MED, "", QIconSet(), - tr("MEN_EXPLORE_MED_FILE"), "", (CTRL + Key_M), aParent, false, - this, SLOT(OnExploreMEDFile())); - createAction( VISU_IMPORT_TABLE, "", QIconSet(), tr("MEN_IMPORT_TABLE"), "", 0, aParent, false, this, SLOT(OnImportTableFromFile())); @@ -2249,18 +2274,21 @@ createActions() aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GLOBAL_SELECTION")); createAction( VISU_GLOBAL_SELECTION, tr("MEN_GLOBAL_SELECTION"), QIconSet(aPixmap), tr("MEN_GLOBAL_SELECTION"), "", 0, aParent, false, - //this, SLOT(OnEraseAll())); this); aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PARTIAL_SELECTION")); createAction( VISU_PARTIAL_SELECTION, tr("MEN_PARTIAL_SELECTION"), QIconSet(aPixmap), tr("MEN_PARTIAL_SELECTION"), "", 0, aParent, false, - //this, SLOT(OnEraseAll())); this); createAction( VISU_SHOW_ANIMATION, tr("MEN_SHOW_ANIMATION"), QIconSet(), tr("MEN_SHOW_ANIMATION"), "", 0, aParent, false, this, SLOT(OnShowAnimation())); + + aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_PLOT_3D")); + createAction( VISU_PLOT3D_FROM_CUTPLANE, tr("MEN_PLOT3D_FROM_CUTPLANE"), QIconSet(aPixmap), + tr("MEN_PLOT3D_FROM_CUTPLANE"), "", 0, aParent, false, + this, SLOT(OnPlot3dFromCutPlane())); } void @@ -2271,9 +2299,10 @@ createMenus() int aMenuId; aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 ); createMenu( separator(), aMenuId, -1, 10 ); - createMenu( VISU_IMPORT_FROM_FILE, aMenuId, 10 ); // import from file - createMenu( VISU_EXPLORE_MED, aMenuId, 10 ); // explore MED file - createMenu( VISU_IMPORT_TABLE, aMenuId, 10 ); // import table + + int anImportId = createMenu( tr( "MEN_IMPORT" ), aMenuId, -1, 10 ); + createMenu( VISU_IMPORT_FROM_FILE, anImportId ); // import from file + createMenu( VISU_IMPORT_TABLE, anImportId ); // import table aMenuId = createMenu( tr( "MEN_VISUALIZATION" ), -1, -1, 30 ); createMenu( VISU_SCALAR_MAP, aMenuId, 10 ); // scalar map @@ -2304,7 +2333,10 @@ void VisuGUI:: createToolBars() { - int aToolId = createTool(tr("TOOL_VISUALISATION")); + int aToolId = createTool( tr("TOOL_IMPORT") ); + createTool( VISU_IMPORT_FROM_FILE, aToolId ); + + aToolId = createTool(tr("TOOL_VISUALISATION")); createTool( VISU_SCALAR_MAP, aToolId ); createTool( VISU_DEFORMED_SHAPE, aToolId ); createTool( VISU_VECTORS, aToolId ); @@ -2464,7 +2496,7 @@ createPopupMenus() QString orCurveInvisible = "or (type='VISU::TCURVE'" + andInvisible + ")"; QString aPrsVisible = "(($type in {'VISU::TMESH' " + aPrsAll + "}) and isVisible)"; QString aPrsInvisible = "(($type in {'VISU::TMESH' " + aPrsAll + "})" + andInvisible + ")"; - QString aComponent = "( selcount=1 and canBeDisplayed and isComponent )"; + QString aComponent = "( selcount=1 and canBeDisplayed and isVisuComponent )"; QString anEraseRule = "( selcount>0 and ({true} in $canBeDisplayed) and (" + aPrsVisible + " or (client='ObjectBrowser' and (" + aTableOrCont + orCurveVisible + "))) ) or " + aComponent; @@ -2499,7 +2531,9 @@ createPopupMenus() // 3D presentations commands QString aPrsType = " and $type in {'VISU::TMESH' " + aPrsAll + "}"; QString aInsideType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TDEFORMEDSHAPE'}"; - QString aSurfType = " and $type in {'VISU::TMESH'}"; + QString aSurfFrameType = " and $type in {'VISU::TMESH'}"; + QString aSurfType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' " + " 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}"; QString aShrinkType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' " "'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' 'VISU::TCUTLINES' 'VISU::TPLOT3D' 'VISU::TSCALARMAPONDEFORMEDSHAPE'}"; QString aLineType = " and $type in {'VISU::TMESH' 'VISU::TSCALARMAP' 'VISU::TISOSURFACE' 'VISU::TDEFORMEDSHAPE' " @@ -2517,9 +2551,9 @@ createPopupMenus() mgr->setRule( action( VISU_POINTS ) , aRule + aPrsType + aNotPoints, true ); mgr->setRule( action( VISU_WIREFRAME ) , aRule + aPrsType + aNotWirefr, true ); - mgr->setRule( action( VISU_SURFACE ) , aRule + aPrsType + aNotSurfac, true ); + mgr->setRule( action( VISU_SURFACE ) , aRule + aSurfType + aNotSurfac, true ); mgr->setRule( action( VISU_INSIDEFRAME ) , aRule + aInsideType + aNotInside, true ); - mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfType + aNotSurffr, true ); + mgr->setRule( action( VISU_SURFACEFRAME ), aRule + aSurfFrameType + aNotSurffr, true ); mgr->setRule( action( VISU_SHRINK ) , aRule + aShrinkType + " and isShrunk=0", true ); mgr->setRule( action( VISU_UNSHRINK ), aRule + aShrinkType + " and isShrunk=1", true ); @@ -2622,6 +2656,8 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q if (!anIO.IsNull() && anIO->hasEntry()) { _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry()); + if ( !aSObject ) + continue; CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject); if (CORBA::is_nil(aCORBAObject)) { _PTR(GenericAttribute) anAttr; @@ -2647,28 +2683,23 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q } } } - if (nbPrs > 1) { theMenu->insertSeparator(); action( VISU_MERGE_SCALAR_BARS )->addTo(theMenu); action( VISU_FREE_SCALAR_BARS )->addTo(theMenu); } - theMenu->insertSeparator(); - - // Check if some (nb > 0) removable objects selected - if (isOBClient && IsRemovableSelected(this)) { - action( VISU_DELETE_OBJS )->addTo(theMenu); - } - // Check if some curves selected (for bug PAL10611) bool isCurves = false; + bool isOneCutPlane = false; SALOME_ListIteratorOfListIO It1 (aListIO); for (; It1.More() && !isCurves; It1.Next()) { Handle(SALOME_InteractiveObject)& anIO = It1.Value(); if (!anIO.IsNull() && anIO->hasEntry()) { _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry()); + if ( !aSObject ) + continue; _PTR(GenericAttribute) anAttr; if (aSObject->FindAttribute(anAttr, "AttributeComment")) { _PTR(AttributeComment) aComment (anAttr); @@ -2678,12 +2709,35 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q VISU::Storable::StrToMap(strIn, pMap); bool isExist; VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(pMap,"myType",&isExist).toInt(); - if (isExist && aType == VISU::TCURVE) { + if (isExist && aType == VISU::TCURVE) { isCurves = true; - } + } else { + CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this), anIO->getEntry()); + if (!CORBA::is_nil(anObject)) { + VISU::Prs3d_i* aPrsObject = dynamic_cast(VISU::GetServant(anObject).in()); + if (aPrsObject) { + if (aPrsObject->GetType() == VISU::TCUTPLANES) { + VISU::CutPlanes_i* aCutPrs = dynamic_cast(aPrsObject); + if (aCutPrs) { + isOneCutPlane = aCutPrs->GetNbPlanes() == 1; + } + } + } + } + } } } } + + if (isOneCutPlane) + action( VISU_PLOT3D_FROM_CUTPLANE )->addTo(theMenu); + + theMenu->insertSeparator(); + + // Check if some (nb > 0) removable objects selected + if (isOBClient && IsRemovableSelected(this)) { + action( VISU_DELETE_OBJS )->addTo(theMenu); + } if (isCurves) { action( myDisplay )->removeFrom(theMenu); action( myErase )->removeFrom(theMenu); @@ -2699,6 +2753,8 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q CORBA::Object_var anObject = GetSelectedObj( this, &anIO, &aMap); _PTR(SObject) SO = aCStudy->FindObjectID(anIO->getEntry()); + if ( !SO ) + return; bool isExist; VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt(); @@ -2757,7 +2813,12 @@ VisuGUI:: viewManagers( QStringList& theList ) const { theList.clear(); - theList.append( SVTK_Viewer::Type() ); + // append SVTK viewer only if there is no opened VVTK + SUIT_ViewManager* vm = getApp()->getViewManager( VVTK_Viewer::Type(), false ); + if( vm && vm->getViewsCount()>0 ) + theList.append( VVTK_Viewer::Type() ); + else + theList.append( SVTK_Viewer::Type() ); } @@ -2778,6 +2839,10 @@ activateModule( SUIT_Study* theStudy ) studyActivated(); setMenuShown( true ); setToolShown( true ); + + // Reset actions accelerator keys + action(VISU_IMPORT_FROM_FILE)->setAccel(QKeySequence(CTRL + Key_I)); + return true; } @@ -2789,6 +2854,9 @@ deactivateModule( SUIT_Study* theStudy ) setMenuShown( false ); setToolShown( false ); + // Unset actions accelerator keys + action(VISU_IMPORT_FROM_FILE)->setAccel(QKeySequence()); + SalomeApp_Module::deactivateModule( theStudy ); return true; } @@ -2980,6 +3048,7 @@ void VisuGUI::createPreferences() // group: "MED files import" int importGr = addPreference( tr( "MED files import" ), srangeTab ); setPreferenceProperty( importGr, "columns", 1 ); + addPreference( tr( "Use build progress" ), importGr, LightApp_Preferences::Bool, "VISU", "use_build_progress" ); addPreference( tr( "Full MED loading" ), importGr, LightApp_Preferences::Bool, "VISU", "full_med_loading" ); addPreference( tr( "Build at once" ), importGr, LightApp_Preferences::Bool, "VISU", "build_at_once" ); addPreference( tr( "Build fields" ), importGr, LightApp_Preferences::Bool, "VISU", "build_fields" ); @@ -2987,9 +3056,91 @@ void VisuGUI::createPreferences() addPreference( tr( "Build groups" ), importGr, LightApp_Preferences::Bool, "VISU", "build_groups" ); addPreference( tr( "Close dialog at finish" ), importGr, LightApp_Preferences::Bool, "VISU", "close_at_finish" ); - // group: "Representation properties" - int representGr = addPreference( tr( "VISU_PREF_REPRESENT_PROPS" ), srangeTab ); - addPreference( tr( "VISU_PREF_SHADING" ), representGr, + // TAB: Representation ; group: "Representation properties" + int representationTab = addPreference( tr( "Representation" ) ); + + int representGr = addPreference( tr( "VISU_REPRESENT_PROPS" ), representationTab ); + + QStringList mesh_modes; + mesh_modes.append( "Points" ); + mesh_modes.append( "Wireframe" ); + mesh_modes.append( "Insideframe" ); + mesh_modes.append( "Surfaceframe" ); + mesh_modes.append( "Surface" ); + QValueList mesh_indices; + mesh_indices.append( 0 ); + mesh_indices.append( 1 ); + mesh_indices.append( 3 ); + mesh_indices.append( 4 ); + mesh_indices.append( 2 ); + + QStringList modes1 = mesh_modes; + modes1.remove( "Surfaceframe" ); + QValueList indices1 = mesh_indices; + indices1.remove( 4 ); + + QStringList modes2 = modes1; + modes2.remove( "Insideframe" ); + QValueList indices2 = indices1; + indices2.remove( 3 ); + + QStringList modes3 = modes2; + modes3.remove( "Surface" ); + QValueList indices3 = indices2; + indices3.remove( 2 ); + + + int mesh_represent = addPreference( tr( "VISU_MESH" ), representGr, LightApp_Preferences::Selector, "VISU", "mesh_represent" ); + setPreferenceProperty( mesh_represent, "strings", mesh_modes ); + setPreferenceProperty( mesh_represent, "indexes", mesh_indices ); + addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "mesh_shrink" ); + + int scalar_map_represent = addPreference( tr( "VISU_SCALAR_MAP" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_map_represent" ); + setPreferenceProperty( scalar_map_represent, "strings", modes1 ); + setPreferenceProperty( scalar_map_represent, "indexes", indices1 ); + addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_map_shrink" ); + + int iso_surfaces_represent = addPreference( tr( "VISU_ISO_SURFACES" ), representGr, LightApp_Preferences::Selector, "VISU", "iso_surfaces_represent" ); + setPreferenceProperty( iso_surfaces_represent, "strings", modes2 ); + setPreferenceProperty( iso_surfaces_represent, "indexes", indices2 ); + addPreference( "", representGr, LightApp_Preferences::Space ); + + int cut_planes_represent = addPreference( tr( "VISU_CUT_PLANES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_planes_represent" ); + setPreferenceProperty( cut_planes_represent, "strings", modes2 ); + setPreferenceProperty( cut_planes_represent, "indexes", indices2 ); + addPreference( "", representGr, LightApp_Preferences::Space ); + + int cut_lines_represent = addPreference( tr( "VISU_CUT_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "cut_lines_represent" ); + setPreferenceProperty( cut_lines_represent, "strings", modes3 ); + setPreferenceProperty( cut_lines_represent, "indexes", indices3 ); + addPreference( "", representGr, LightApp_Preferences::Space ); + + int deformed_shape_represent = addPreference( tr( "VISU_DEFORMED_SHAPE" ), representGr, LightApp_Preferences::Selector, "VISU", "deformed_shape_represent" ); + setPreferenceProperty( deformed_shape_represent, "strings", modes1 ); + setPreferenceProperty( deformed_shape_represent, "indexes", indices1 ); + addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "deformed_shape_shrink" ); + + int vectors_represent = addPreference( tr( "VISU_VECTORS" ), representGr, LightApp_Preferences::Selector, "VISU", "vectors_represent" ); + setPreferenceProperty( vectors_represent, "strings", modes3 ); + setPreferenceProperty( vectors_represent, "indexes", indices3 ); + addPreference( "", representGr, LightApp_Preferences::Space ); + + int stream_lines_represent = addPreference( tr( "VISU_STREAM_LINES" ), representGr, LightApp_Preferences::Selector, "VISU", "stream_lines_represent" ); + setPreferenceProperty( stream_lines_represent, "strings", modes3 ); + setPreferenceProperty( stream_lines_represent, "indexes", indices3 ); + addPreference( "", representGr, LightApp_Preferences::Space ); + + int plot3d_represent = addPreference( tr( "VISU_PLOT3D" ), representGr, LightApp_Preferences::Selector, "VISU", "plot3d_represent" ); + setPreferenceProperty( plot3d_represent, "strings", modes2 ); + setPreferenceProperty( plot3d_represent, "indexes", indices2 ); + addPreference( "", representGr, LightApp_Preferences::Space ); + + int scalar_def_represent = addPreference( tr( "VISU_SCALAR_MAP_ON_DEFORMED_SHAPE" ), representGr, LightApp_Preferences::Selector, "VISU", "scalar_def_represent" ); + setPreferenceProperty( scalar_def_represent, "strings", modes2 ); + setPreferenceProperty( scalar_def_represent, "indexes", indices2 ); + addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_def_shrink" ); + + addPreference( tr( "VISU_USE_SHADING" ), representGr, LightApp_Preferences::Bool, "VISU", "represent_shading" ); } @@ -2999,11 +3150,12 @@ void VisuGUI::preferencesChanged( const QString& a, const QString& b) if (b == QString("scalar_bar_orientation")) return; SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); float sbX1,sbY1,sbW,sbH; + float aTol = 1.00000009999999; std::string aWarning; if(b == QString("scalar_bar_vertical_x") || b == QString("scalar_bar_vertical_width")){ sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_x", sbX1); sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_width", sbW); - if(sbX1+sbW > 1.0){ + if(sbX1+sbW > aTol){ aWarning = "Origin and Size Vertical: X+Width > 1\n"; sbX1=0.01; sbW=0.05; @@ -3014,7 +3166,7 @@ void VisuGUI::preferencesChanged( const QString& a, const QString& b) else if(b == QString("scalar_bar_vertical_y") || b == QString("scalar_bar_vertical_height")){ sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_y", sbY1); sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_vertical_height",sbH); - if(sbY1+sbH > 1.0){ + if(sbY1+sbH > aTol){ aWarning = "Origin and Size Vertical: Y+Height > 1\n"; sbY1=0.01; sbH=0.5; @@ -3025,7 +3177,7 @@ void VisuGUI::preferencesChanged( const QString& a, const QString& b) else if(b == QString("scalar_bar_horizontal_x") || b == QString("scalar_bar_horizontal_width")){ sbX1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_x", sbX1); sbW = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_width", sbW); - if(sbX1+sbW > 1.0){ + if(sbX1+sbW > aTol){ aWarning = "Origin and Size Horizontal: X+Width > 1\n"; sbX1=0.2; sbW=0.6; @@ -3036,7 +3188,7 @@ void VisuGUI::preferencesChanged( const QString& a, const QString& b) else if(b == QString("scalar_bar_horizontal_y") || b == QString("scalar_bar_horizontal_height")){ sbY1 = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_y", sbY1); sbH = aResourceMgr->doubleValue("VISU", "scalar_bar_horizontal_height",sbH); - if(sbY1+sbH > 1.0){ + if(sbY1+sbH > aTol){ aWarning = "Origin and Size Horizontal: Y+Height > 1\n"; sbY1=0.01; sbH=0.12; @@ -3068,3 +3220,103 @@ LightApp_Displayer* VisuGUI::displayer() return myDisplayer; } + + +void VisuGUI::OnPlot3dFromCutPlane() +{ + _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this)); + if (CheckLock(aCStudy, GetDesktop(this))) + return; + + LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this); + SALOME_ListIO aListIO; + aSelectionMgr->selectedObjects(aListIO); + + if (aListIO.Extent() < 1) return; + + + VISU::CutPlanes_i* aCutPrs = 0; + Handle(SALOME_InteractiveObject) anIO; + _PTR(SObject) aSObject; + SALOME_ListIteratorOfListIO It (aListIO); + for (; It.More(); It.Next()) { + anIO = It.Value(); + + if (!anIO.IsNull() && anIO->hasEntry()) { + aSObject = aCStudy->FindObjectID(anIO->getEntry()); + if ( !aSObject ) + continue; + CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this), anIO->getEntry()); + if (!CORBA::is_nil(anObject)) { + VISU::Prs3d_i* aPrsObject = dynamic_cast(VISU::GetServant(anObject).in()); + if (aPrsObject->GetType() == VISU::TCUTPLANES) { + aCutPrs = dynamic_cast(aPrsObject); + if (aCutPrs) + break; + } + } + } + } + + if (aCutPrs) { + _PTR(SObject) aTimeStampSObj = aSObject->GetFather(); + if (SUIT_ViewManager* aViewManager = getApp()->activeViewManager()) { + QString aType = aViewManager->getType(); + bool isVVTK = aType == VVTK_Viewer::Type(); + + Storable::TRestoringMap aMap = getMapOfValue(aTimeStampSObj); + bool isExist; + aType = Storable::FindValue(aMap,"myType",&isExist); + if (!isExist || aType.toInt() != TTIMESTAMP ) + return; + + QString aMeshName = Storable::FindValue(aMap,"myMeshName",&isExist).latin1(); + QString anEntity = Storable::FindValue(aMap,"myEntityId",&isExist).latin1(); + QString aFieldName = Storable::FindValue(aMap,"myFieldName",&isExist).latin1(); + QString aTimeStampId = Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1(); + + int aPos; + SUIT_ViewWindow* aViewWindow = 0; + if (isVVTK) { + aViewWindow = GetViewWindow(this); + aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast(aViewWindow)); + } else { + aViewWindow = GetViewWindow(this); + aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast(GetViewWindow(this))); + } + GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos); + + VISU::Plot3D_i* aPrs3d = CreatePrs3d(this, aTimeStampSObj, aMeshName.latin1(), (Entity)anEntity.toInt(), + aFieldName.latin1(), aTimeStampId.toInt()); + if (aPrs3d) { + SUIT_ResourceMgr* aResourceMgr = GetResourceMgr(); + int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0); + if (!aValue) { + VisuGUI_Plot3DDlg* aDlg = new VisuGUI_Plot3DDlg(this); + aDlg->initFromPrsObject(aPrs3d); + int aOrient = aCutPrs->GetOrientationType(); // Plot3d has the same orientation type + double aRotX = aCutPrs->GetRotateX(); + double aRotY = aCutPrs->GetRotateY(); + double aPlanePos = aCutPrs->GetPlanePosition(0); + aDlg->setPlane(aOrient, aRotX, aRotY, aPlanePos); + + if (!(runAndWait(aDlg, 0) && (aDlg->storeToPrsObject(aPrs3d)))) { + DeletePrs3d(this, aPrs3d, anIO); + delete aDlg; + return; + } + delete aDlg; + UpdateObjBrowser(this, true, aTimeStampSObj); + } + SVTK_ViewWindow* aSVtkWindow = dynamic_cast(aViewWindow); + if ( aSVtkWindow ) { + PublishInView(this, aPrs3d, aSVtkWindow, /*highlight = */true); + aSVtkWindow->onFitAll(); + + AddScalarBarPosition(this, aSVtkWindow, aPrs3d, aPos); + } + } + } + application()->putInfo(QObject::tr("INF_DONE")); + } +} diff --git a/src/VISUGUI/VisuGUI.h b/src/VISUGUI/VisuGUI.h index 3e74e246..806b7306 100644 --- a/src/VISUGUI/VisuGUI.h +++ b/src/VISUGUI/VisuGUI.h @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -81,7 +81,6 @@ public slots: protected slots: void OnImportFromFile(); - void OnExploreMEDFile(); void OnImportTableFromFile(); void OnExportTableToFile(); void OnImportMedField(); @@ -155,6 +154,7 @@ protected slots: void OnTranslatePrs(); void OnArrangeActors(); + void OnPlot3dFromCutPlane(); protected: virtual LightApp_Selection* createSelection() const; diff --git a/src/VISUGUI/VisuGUI_ActionsDef.h b/src/VISUGUI/VisuGUI_ActionsDef.h index 1fe7a7b2..0eaa8676 100644 --- a/src/VISUGUI/VisuGUI_ActionsDef.h +++ b/src/VISUGUI/VisuGUI_ActionsDef.h @@ -15,21 +15,19 @@ // 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/ +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #ifndef VISUGUI_ACTIONSDEF #define VISUGUI_ACTIONSDEF //#define VISU_IMPORT_FROM_FILE 112 -//#define VISU_EXPLORE_MED 113 //#define VISU_IMPORT_MED 114 //#define VISU_IMPORT_TABLE 199 #define VISU_IMPORT_FROM_FILE 4002 -#define VISU_EXPLORE_MED 4003 -#define VISU_IMPORT_TABLE 4004 -#define VISU_IMPORT_MED_STRUCTURE 4005 -#define VISU_IMPORT_MED_TIMESTAMP 4006 -#define VISU_IMPORT_MED_FIELD 4007 +#define VISU_IMPORT_TABLE 4003 +#define VISU_IMPORT_MED_STRUCTURE 4004 +#define VISU_IMPORT_MED_TIMESTAMP 4005 +#define VISU_IMPORT_MED_FIELD 4006 #define VISU_SCALAR_MAP 4011 #define VISU_DEFORMED_SHAPE 4012 @@ -114,4 +112,6 @@ #define VISU_FREE_SCALAR_BARS 4081 #define VISU_SHOW_ANIMATION 4082 +#define VISU_PLOT3D_FROM_CUTPLANE 4085 + #endif diff --git a/src/VISUGUI/VisuGUI_BuildProgressDlg.cxx b/src/VISUGUI/VisuGUI_BuildProgressDlg.cxx index 7705f32d..88db6399 100644 --- a/src/VISUGUI/VisuGUI_BuildProgressDlg.cxx +++ b/src/VISUGUI/VisuGUI_BuildProgressDlg.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -27,12 +27,16 @@ #include "VisuGUI_BuildProgressDlg.h" +#include "VisuGUI.h" #include "VisuGUI_Tools.h" #include "SUIT_FileDlg.h" +#include "SUIT_Session.h" #include "SUIT_MessageBox.h" #include "SUIT_ResourceMgr.h" +#include "LightApp_Application.h" + #include #include @@ -48,7 +52,10 @@ * Constructor */ VisuGUI_BuildProgressDlg::VisuGUI_BuildProgressDlg( QWidget* theParent ): - QDialog( theParent, "VisuGUI_BuildProgressBar", false ), + QDialog( theParent, + "VisuGUI_BuildProgressBar", + false, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose), myIsRaiseColor( false ) { setCaption( tr( "DLG_BUILD_PROGRESS_TITLE" ) ); @@ -108,14 +115,11 @@ VisuGUI_BuildProgressDlg::VisuGUI_BuildProgressDlg( QWidget* theParent ): aProgressLayout->setSpacing( 6 ); aProgressLayout->setMargin( 11 ); - myBuildEntitiesCheckBox = new QCheckBox( tr( "BUILD_ENTITIES" ), myProgressBox ); - myBuildEntitiesCheckBox->setChecked( true ); - myBuildEntitiesCheckBox->setEnabled( false ); + QLabel* aBuildEntitiesLabel = new QLabel( tr( "BUILD_ENTITIES" ), myProgressBox ); myBuildEntitiesButton = new QPushButton( myProgressBox ); myBuildEntitiesButton->setEnabled( false ); myBuildEntitiesButton->setFixedSize( 30, 30 ); myBuildEntitiesButton->setPaletteBackgroundColor( Qt::red ); - connect( myBuildEntitiesCheckBox, SIGNAL( clicked() ), this, SLOT( onBuildCheckBoxClicked() ) ); myBuildFieldsCheckBox = new QCheckBox( tr( "BUILD_FIELDS" ), myProgressBox ); myBuildFieldsCheckBox->setChecked( aResourceMgr->booleanValue( "VISU", "build_fields", true ) ); @@ -141,7 +145,7 @@ VisuGUI_BuildProgressDlg::VisuGUI_BuildProgressDlg( QWidget* theParent ): myBuildGroupsButton->setPaletteBackgroundColor( Qt::red ); connect( myBuildGroupsCheckBox, SIGNAL( clicked() ), this, SLOT( onBuildCheckBoxClicked() ) ); - aProgressLayout->addWidget( myBuildEntitiesCheckBox, 0, 0 ); + aProgressLayout->addWidget( aBuildEntitiesLabel, 0, 0 ); aProgressLayout->addWidget( myBuildEntitiesButton, 0, 1 ); aProgressLayout->addWidget( myBuildFieldsCheckBox, 1, 0 ); aProgressLayout->addWidget( myBuildFieldsButton, 1, 1 ); @@ -192,8 +196,13 @@ VisuGUI_BuildProgressDlg::VisuGUI_BuildProgressDlg( QWidget* theParent ): aCloseButton->setAutoDefault( true ); CommonGroupLayout->addWidget( aCloseButton, 0, 2 ); + QPushButton* aHelpButton = new QPushButton( tr( "HELP" ), CommonGroup ); + aHelpButton->setAutoDefault( true ); + CommonGroupLayout->addWidget( aHelpButton, 0, 3 ); + connect( myStartButton, SIGNAL( clicked() ), this, SLOT( onStart() ) ); connect( aCloseButton, SIGNAL( clicked() ), this, SLOT( onClose() ) ); + connect( aHelpButton, SIGNAL( clicked() ), this, SLOT( onHelp() ) ); myTimer = new QTimer( this ); connect( myTimer, SIGNAL( timeout() ), this, SLOT( onTimer() ) ); @@ -205,7 +214,7 @@ VisuGUI_BuildProgressDlg::~VisuGUI_BuildProgressDlg() void VisuGUI_BuildProgressDlg::show() { - if( onBrowseFile() ) + if( !myFileName.isNull() || onBrowseFile() ) QWidget::show(); } @@ -214,37 +223,35 @@ void VisuGUI_BuildProgressDlg::onStart() if( myFileName.isNull() ) return; - bool aBuildAll = myBuildAllCheckBox->isChecked(); - bool aBuildAtOnce = myBuildAtOnceCheckBox->isChecked(); - myResult = myGenerator->CreateResult( myFileName ); - myResult->SetBuildFields( myBuildFieldsCheckBox->isChecked(), myBuildMinMaxCheckBox->isChecked() ); - myResult->SetBuildGroups( myBuildGroupsCheckBox->isChecked() ); - - //setModal( false ); - myFileNameLineEdit->setReadOnly( true ); - /* - myBuildAllCheckBox->setNoChange(); - myBuildAtOnceCheckBox->setNoChange(); - myBuildEntitiesCheckBox->setNoChange(); - myBuildFieldsCheckBox->setNoChange(); - myBuildMinMaxCheckBox->setNoChange(); - myBuildGroupsCheckBox->setNoChange(); - */ - - myStartButton->setEnabled( false ); + if (CORBA::is_nil(myResult.in())) { + SUIT_MessageBox::warn1(this, + tr("WRN_VISU"), + tr("ERR_ERROR_IN_THE_FILE"), + tr("BUT_OK")); + onClose(); + }else{ + myResult->SetBuildFields( myBuildFieldsCheckBox->isChecked(), myBuildMinMaxCheckBox->isChecked() ); + myResult->SetBuildGroups( myBuildGroupsCheckBox->isChecked() ); + + //setModal( false ); + myFileNameLineEdit->setReadOnly( true ); + myStartButton->setEnabled( false ); + + bool aBuildAtOnce = myBuildAtOnceCheckBox->isChecked(); + if( aBuildAtOnce ) + { + QApplication::setOverrideCursor( Qt::waitCursor ); + myCurrentTime = vtkTimerLog::GetCurrentTime(); + } - if( aBuildAtOnce ) - { - QApplication::setOverrideCursor( Qt::waitCursor ); - myCurrentTime = vtkTimerLog::GetCurrentTime(); + myTime.setHMS( 0, 0, 0 ); + myTimer->start( 100 ); + + bool aBuildAll = myBuildAllCheckBox->isChecked(); + myResult->Build( aBuildAll, aBuildAtOnce ); } - - myTime.setHMS( 0, 0, 0 ); - myTimer->start( 100 ); - - myResult->Build( aBuildAll, aBuildAtOnce ); } void VisuGUI_BuildProgressDlg::onClose() @@ -252,6 +259,22 @@ void VisuGUI_BuildProgressDlg::onClose() done( 0 ); } +void VisuGUI_BuildProgressDlg::onHelp() +{ + QString aHelpFileName = "/files/importing_med_objects.htm"; // ? + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) { + VisuGUI* aVisuGUI = dynamic_cast( app->activeModule() ); + app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName); + } + else { + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + QObject::tr("BUT_OK")); + } +} + bool VisuGUI_BuildProgressDlg::onBrowseFile() { QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ); @@ -390,3 +413,12 @@ void VisuGUI_BuildProgressDlg::onBuildCheckBoxClicked() myBuildGroupsButton->setPaletteBackgroundColor( aColor ); } + +void VisuGUI_BuildProgressDlg::setFileName( const QString& theFileName ) +{ + if ( !theFileName.isNull() ) + { + myFileName = theFileName; + myFileNameLineEdit->setText( myFileName.section( '/', -1 ) ); + } +} diff --git a/src/VISUGUI/VisuGUI_BuildProgressDlg.h b/src/VISUGUI/VisuGUI_BuildProgressDlg.h index 4d880596..0d56a0dc 100644 --- a/src/VISUGUI/VisuGUI_BuildProgressDlg.h +++ b/src/VISUGUI/VisuGUI_BuildProgressDlg.h @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -54,12 +54,14 @@ public: virtual void show(); QString fileName() const { return myFileName; } + void setFileName( const QString& theFileName ); protected slots: void done( int ); void onStart(); void onClose(); + void onHelp(); bool onBrowseFile(); void onTimer(); @@ -85,7 +87,6 @@ private: QGroupBox* myProgressBox; - QCheckBox* myBuildEntitiesCheckBox; QPushButton* myBuildEntitiesButton; QCheckBox* myBuildFieldsCheckBox; diff --git a/src/VISUGUI/VisuGUI_ClippingDlg.cxx b/src/VISUGUI/VisuGUI_ClippingDlg.cxx index 2c9f7f1b..f9889dd0 100644 --- a/src/VISUGUI/VisuGUI_ClippingDlg.cxx +++ b/src/VISUGUI/VisuGUI_ClippingDlg.cxx @@ -15,13 +15,14 @@ // 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/ +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #include "VisuGUI_ClippingDlg.h" #include "VisuGUI.h" #include "VisuGUI_Tools.h" +#include "VisuGUI_ViewTools.h" #include "VISU_Prs3d_i.hh" #include "VISU_Result_i.hh" @@ -29,6 +30,7 @@ #include "VISU_PipeLine.hxx" #include "LightApp_SelectionMgr.h" +#include "LightApp_Application.h" #include "SVTK_ViewWindow.h" @@ -101,128 +103,124 @@ namespace VISU { //class : OrientedPlane //purpose : //================================================================================= -class OrientedPlane: public vtkPlane +OrientedPlane* OrientedPlane::New() { - SVTK_ViewWindow* myViewWindow; - - vtkDataSetMapper* myMapper; - -public: - static OrientedPlane * New() { - return new OrientedPlane(); - } - static OrientedPlane * New (SVTK_ViewWindow* vw) { - return new OrientedPlane(vw); - } - vtkTypeMacro(OrientedPlane, vtkPlane); - - - VISU::Orientation myOrientation; - float myDistance; - double myAngle[2]; - - vtkPlaneSource* myPlaneSource; - SALOME_Actor *myActor; - - void SetOrientation(VISU::Orientation theOrientation) {myOrientation = theOrientation;} - VISU::Orientation GetOrientation() {return myOrientation;} - - void SetDistance(float theDistance) {myDistance = theDistance;} - float GetDistance() {return myDistance;} - - void ShallowCopy(OrientedPlane* theOrientedPlane){ - SetNormal(theOrientedPlane->GetNormal()); - SetOrigin(theOrientedPlane->GetOrigin()); - - myOrientation = theOrientedPlane->GetOrientation(); - myDistance = theOrientedPlane->GetDistance(); - - myAngle[0] = theOrientedPlane->myAngle[0]; - myAngle[1] = theOrientedPlane->myAngle[1]; - - myPlaneSource->SetNormal(theOrientedPlane->myPlaneSource->GetNormal()); - myPlaneSource->SetOrigin(theOrientedPlane->myPlaneSource->GetOrigin()); - myPlaneSource->SetPoint1(theOrientedPlane->myPlaneSource->GetPoint1()); - myPlaneSource->SetPoint2(theOrientedPlane->myPlaneSource->GetPoint2()); - } - -protected: - OrientedPlane(SVTK_ViewWindow* vw): - myOrientation(VISU::XY), - myDistance(0.5), - myViewWindow(vw) - { - Init(); - myViewWindow->AddActor(myActor); - } - - OrientedPlane(): - myOrientation(VISU::XY), - myDistance(0.5), - myViewWindow(NULL) - { - Init(); - } + return new OrientedPlane(); +} - void Init(){ - myPlaneSource = vtkPlaneSource::New(); +OrientedPlane* OrientedPlane::New (SVTK_ViewWindow* vw) +{ + return new OrientedPlane(vw); +} - myAngle[0] = myAngle[1] = 0.0; +void OrientedPlane::SetOrientation(VISU::Orientation theOrientation) +{ + myOrientation = theOrientation; +} - // Create and display actor - myMapper = vtkDataSetMapper::New(); - myMapper->SetInput(myPlaneSource->GetOutput()); +VISU::Orientation OrientedPlane::GetOrientation() +{ + return myOrientation; +} - myActor = SALOME_Actor::New(); - myActor->VisibilityOff(); - myActor->PickableOff(); - myActor->SetInfinitive(true); - myActor->SetMapper(myMapper); +void OrientedPlane::SetDistance(float theDistance) +{ + myDistance = theDistance; +} - vtkProperty* aProp = vtkProperty::New(); - float anRGB[3]; +float OrientedPlane::GetDistance() +{ + return myDistance; +} - SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); +void OrientedPlane::ShallowCopy(OrientedPlane* theOrientedPlane) +{ + SetNormal(theOrientedPlane->GetNormal()); + SetOrigin(theOrientedPlane->GetOrigin()); + + myOrientation = theOrientedPlane->GetOrientation(); + myDistance = theOrientedPlane->GetDistance(); + + myAngle[0] = theOrientedPlane->myAngle[0]; + myAngle[1] = theOrientedPlane->myAngle[1]; + + myPlaneSource->SetNormal(theOrientedPlane->myPlaneSource->GetNormal()); + myPlaneSource->SetOrigin(theOrientedPlane->myPlaneSource->GetOrigin()); + myPlaneSource->SetPoint1(theOrientedPlane->myPlaneSource->GetPoint1()); + myPlaneSource->SetPoint2(theOrientedPlane->myPlaneSource->GetPoint2()); +} - QColor aFillColor = aResourceMgr->colorValue("SMESH", "fill_color", QColor(0, 170, 255)); - anRGB[0] = aFillColor.red()/255.; - anRGB[1] = aFillColor.green()/255.; - anRGB[2] = aFillColor.blue()/255.; - aProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); - aProp->SetOpacity(0.75); - myActor->SetProperty(aProp); - aProp->Delete(); - - vtkProperty* aBackProp = vtkProperty::New(); - QColor aBackFaceColor = aResourceMgr->colorValue("SMESH", "backface_color", QColor(0, 0, 255));//@ - anRGB[0] = aBackFaceColor.red()/255.; - anRGB[1] = aBackFaceColor.green()/255.; - anRGB[2] = aBackFaceColor.blue()/255.; - aBackProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); - aBackProp->SetOpacity(0.75); - myActor->SetBackfaceProperty(aBackProp); - aBackProp->Delete(); - } +OrientedPlane::OrientedPlane(SVTK_ViewWindow* vw): + myOrientation(VISU::XY), + myDistance(0.5), + myViewWindow(vw) +{ + Init(); + myViewWindow->AddActor(myActor); +} - ~OrientedPlane() - { - if (myViewWindow) - myViewWindow->RemoveActor(myActor); +OrientedPlane::OrientedPlane(): + myOrientation(VISU::XY), + myDistance(0.5), + myViewWindow(NULL) +{ + Init(); +} - myActor->Delete(); +void OrientedPlane::Init() +{ + myPlaneSource = vtkPlaneSource::New(); + + myAngle[0] = myAngle[1] = 0.0; + + // Create and display actor + myMapper = vtkDataSetMapper::New(); + myMapper->SetInput(myPlaneSource->GetOutput()); + + myActor = SALOME_Actor::New(); + myActor->VisibilityOff(); + myActor->PickableOff(); + myActor->SetInfinitive(true); + myActor->SetMapper(myMapper); + + vtkProperty* aProp = vtkProperty::New(); + float anRGB[3]; + + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + + QColor aFillColor = aResourceMgr->colorValue("SMESH", "fill_color", QColor(0, 170, 255)); + anRGB[0] = aFillColor.red()/255.; + anRGB[1] = aFillColor.green()/255.; + anRGB[2] = aFillColor.blue()/255.; + aProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); + aProp->SetOpacity(0.75); + myActor->SetProperty(aProp); + aProp->Delete(); + + vtkProperty* aBackProp = vtkProperty::New(); + QColor aBackFaceColor = aResourceMgr->colorValue("SMESH", "backface_color", QColor(0, 0, 255));//@ + anRGB[0] = aBackFaceColor.red()/255.; + anRGB[1] = aBackFaceColor.green()/255.; + anRGB[2] = aBackFaceColor.blue()/255.; + aBackProp->SetColor(anRGB[0],anRGB[1],anRGB[2]); + aBackProp->SetOpacity(0.75); + myActor->SetBackfaceProperty(aBackProp); + aBackProp->Delete(); +} - myMapper->RemoveAllInputs(); - myMapper->Delete(); +OrientedPlane::~OrientedPlane() +{ + if (myViewWindow) + myViewWindow->RemoveActor(myActor); - myPlaneSource->UnRegisterAllOutputs(); - myPlaneSource->Delete(); - }; + myActor->Delete(); -private: - // Not implemented. - OrientedPlane(const OrientedPlane&); - void operator=(const OrientedPlane&); -}; + myMapper->RemoveAllInputs(); + myMapper->Delete(); + + myPlaneSource->UnRegisterAllOutputs(); + myPlaneSource->Delete(); +} struct TSetVisiblity { TSetVisiblity(int theIsVisible): myIsVisible(theIsVisible){} @@ -319,6 +317,10 @@ VisuGUI_ClippingDlg::VisuGUI_ClippingDlg (VisuGUI* theModule, GroupButtonsLayout->setAlignment(Qt::AlignTop); GroupButtonsLayout->setSpacing(6); GroupButtonsLayout->setMargin(11); + buttonHelp = new QPushButton (GroupButtons, "buttonHelp"); + buttonHelp->setText(tr("BUT_HELP")); + buttonHelp->setAutoDefault(TRUE); + GroupButtonsLayout->addWidget(buttonHelp, 0, 4); buttonCancel = new QPushButton (GroupButtons, "buttonCancel"); buttonCancel->setText(tr("BUT_CLOSE")); buttonCancel->setAutoDefault(TRUE); @@ -375,6 +377,7 @@ VisuGUI_ClippingDlg::VisuGUI_ClippingDlg (VisuGUI* theModule, connect(buttonOk , SIGNAL(clicked()), this, SLOT(ClickOnOk())); connect(buttonApply , SIGNAL(clicked()), this, SLOT(ClickOnApply())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel())); + connect(buttonHelp , SIGNAL(clicked()), this, SLOT(ClickOnHelp())); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged())); @@ -389,7 +392,7 @@ VisuGUI_ClippingDlg::~VisuGUI_ClippingDlg() { // no need to delete child widgets, Qt does it all for us std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(false)); - VISU::RenderViewWindow(VISU::GetViewWindow(myVisuGUI)); + VISU::RenderViewWindow(VISU::GetActiveViewWindow(myVisuGUI)); } //================================================================================= @@ -481,9 +484,13 @@ void VisuGUI_ClippingDlg::ClickOnApply() if (!myPrs3d) return; - if (SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myVisuGUI)) { + if (SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow(myVisuGUI)) { SUIT_OverrideCursor wc; + QWidget *aCurrWid = this->focusWidget(); + aCurrWid->clearFocus(); + aCurrWid->setFocus(); + // Save clipping planes, currently applied to the presentation // to enable restoring this state in case of failure. // Refer to bugs IPAL8849, IPAL8850 for more information. @@ -559,13 +566,31 @@ void VisuGUI_ClippingDlg::ClickOnCancel() close(); } +//================================================================================= +// function : ClickOnHelp() +// purpose : +//================================================================================= +void VisuGUI_ClippingDlg::ClickOnHelp() +{ + QString aHelpFileName = "clipping.htm"; + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) + app->onHelpContextModule(myVisuGUI ? app->moduleName(myVisuGUI->moduleName()) : QString(""), aHelpFileName); + else { + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + QObject::tr("BUT_OK")); + } +} + //================================================================================= // function : onSelectionChanged() // purpose : Called when selection is changed //================================================================================= void VisuGUI_ClippingDlg::onSelectionChanged() { - if (SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myVisuGUI)) { + if (SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow(myVisuGUI)) { Handle(SALOME_InteractiveObject) anIO; CORBA::Object_var anObject = VISU::GetSelectedObj(myVisuGUI, &anIO); myIO = anIO; @@ -578,8 +603,8 @@ void VisuGUI_ClippingDlg::onSelectionChanged() std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(false)); myPlanes.clear(); - float anOffset [3]; - myPrs3d->GetOffset(anOffset); + CORBA::Float anOffset[3]; + myPrs3d->GetOffset(anOffset[0],anOffset[1],anOffset[2]); vtkIdType anId = 0, anEnd = myPrs3d->GetNumberOfClippingPlanes(); for (; anId < anEnd; anId++) { @@ -589,7 +614,7 @@ void VisuGUI_ClippingDlg::onSelectionChanged() VISU::TVTKPlane aTVTKPlane(anOrientedPlane); anOrientedPlane->Delete(); aTVTKPlane->ShallowCopy(aPlane); - aTVTKPlane->myActor->SetPosition(anOffset); + aTVTKPlane->myActor->SetPosition(anOffset[0],anOffset[1],anOffset[2]); myPlanes.push_back(aTVTKPlane); } } @@ -650,17 +675,20 @@ void VisuGUI_ClippingDlg::onSelectPlane(int theIndex) //================================================================================= void VisuGUI_ClippingDlg::ClickOnNew() { + if(!AutoApplyCheckBox->isChecked()) + ClickOnApply(); + if (!myPrs3d) return; - if (SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myVisuGUI)) { + if (SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow(myVisuGUI)) { OrientedPlane* aPlane = OrientedPlane::New(aViewWindow); VISU::TVTKPlane aTVTKPlane(aPlane); myPlanes.push_back(aTVTKPlane); - float anOffset [3]; - myPrs3d->GetOffset(anOffset); - aTVTKPlane->myActor->SetPosition(anOffset); + CORBA::Float anOffset[3]; + myPrs3d->GetOffset(anOffset[0],anOffset[1],anOffset[2]); + aTVTKPlane->myActor->SetPosition(anOffset[0],anOffset[1],anOffset[2]); if (PreviewCheckBox->isChecked()) aTVTKPlane->myActor->VisibilityOn(); @@ -689,7 +717,7 @@ void VisuGUI_ClippingDlg::ClickOnDelete() ClickOnApply(); Sinchronize(); - if (SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myVisuGUI)) + if (SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow(myVisuGUI)) VISU::RenderViewWindow(aViewWindow); } @@ -785,18 +813,18 @@ void VisuGUI_ClippingDlg::SetCurrentPlaneParam() OrientedPlane* aPlane = myPlanes[aCurPlaneIndex].GetPointer(); - float aNormal[3]; + vtkFloatingPointType aNormal[3]; VISU::Orientation anOrientation; - float aDir[3][3] = {{0, 0, 0}, {0, 0, 0}}; + vtkFloatingPointType aDir[3][3] = {{0, 0, 0}, {0, 0, 0}}; { static double aCoeff = vtkMath::Pi()/180.0; - float aRot[2] = {getRotation1(), getRotation2()}; + vtkFloatingPointType aRot[2] = {getRotation1(), getRotation2()}; aPlane->myAngle[0] = aRot[0]; aPlane->myAngle[1] = aRot[1]; - float anU[2] = {cos(aCoeff*aRot[0]), cos(aCoeff*aRot[1])}; - float aV[2] = {sqrt(1.0-anU[0]*anU[0]), sqrt(1.0-anU[1]*anU[1])}; + vtkFloatingPointType anU[2] = {cos(aCoeff*aRot[0]), cos(aCoeff*aRot[1])}; + vtkFloatingPointType aV[2] = {sqrt(1.0-anU[0]*anU[0]), sqrt(1.0-anU[1]*anU[1])}; aV[0] = aRot[0] > 0? aV[0]: -aV[0]; aV[1] = aRot[1] > 0? aV[1]: -aV[1]; @@ -844,37 +872,37 @@ void VisuGUI_ClippingDlg::SetCurrentPlaneParam() myPrs3d->SetPlaneParam(aNormal, 1. - getDistance(), aPlane); vtkDataSet* aDataSet = myPrs3d->GetInput(); - float *aPnt = aDataSet->GetCenter(); + vtkFloatingPointType *aPnt = aDataSet->GetCenter(); - float* anOrigin = aPlane->GetOrigin(); - float aDel = aDataSet->GetLength()/2.0; + vtkFloatingPointType* anOrigin = aPlane->GetOrigin(); + vtkFloatingPointType aDel = aDataSet->GetLength()/2.0; - float 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}}; - float aParam, aPnt0[3], aPnt1[3], aPnt2[3]; + 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]; - float 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]}; - float aPnt02[3] = {aPnt01[0] + aNormal[0], - aPnt01[1] + aNormal[1], - aPnt01[2] + aNormal[2]}; + 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]}; + vtkFloatingPointType aPnt02[3] = {aPnt01[0] + aNormal[0], + aPnt01[1] + aNormal[1], + aPnt01[2] + aNormal[2]}; vtkPlane::IntersectWithLine(aPnt01,aPnt02,aNormal,anOrigin,aParam,aPnt0); - float aPnt11[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]}; - float aPnt12[3] = {aPnt11[0] + aNormal[0], - aPnt11[1] + aNormal[1], - aPnt11[2] + aNormal[2]}; + vtkFloatingPointType aPnt11[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]}; + vtkFloatingPointType aPnt12[3] = {aPnt11[0] + aNormal[0], + aPnt11[1] + aNormal[1], + aPnt11[2] + aNormal[2]}; vtkPlane::IntersectWithLine(aPnt11,aPnt12,aNormal,anOrigin,aParam,aPnt1); - float aPnt21[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]}; - float aPnt22[3] = {aPnt21[0] + aNormal[0], - aPnt21[1] + aNormal[1], - aPnt21[2] + aNormal[2]}; + vtkFloatingPointType aPnt21[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]}; + vtkFloatingPointType aPnt22[3] = {aPnt21[0] + aNormal[0], + aPnt21[1] + aNormal[1], + aPnt21[2] + aNormal[2]}; vtkPlane::IntersectWithLine(aPnt21,aPnt22,aNormal,anOrigin,aParam,aPnt2); vtkPlaneSource* aPlaneSource = aPlane->myPlaneSource; @@ -886,7 +914,7 @@ void VisuGUI_ClippingDlg::SetCurrentPlaneParam() if (AutoApplyCheckBox->isChecked()) ClickOnApply(); - if (SVTK_ViewWindow* vw = VISU::GetViewWindow(myVisuGUI)) + if (SVTK_ViewWindow* vw = VISU::GetActiveViewWindow(myVisuGUI)) VISU::RenderViewWindow(vw); } @@ -921,14 +949,14 @@ void VisuGUI_ClippingDlg::SetCurrentPlaneIJKParam() int i, axId = ButtonGroupIJKAxis->id (ButtonGroupIJKAxis->selected()); VISU::Result_i::TAxis axis = (VISU::Result_i::TAxis) axId; gp_Dir dir; - const vector * values = + const vector * values = result->GetAxisInfo(myPrs3d->GetMeshName(), axis, dir); if (!values) return; // find distance; int index = SpinBoxIJKIndex->value(); - float distance = 0; + vtkFloatingPointType distance = 0; if (index < values->size()) distance = (*values)[ index ]; @@ -945,14 +973,14 @@ void VisuGUI_ClippingDlg::SetCurrentPlaneIJKParam() } } // find rotation angles - float angle[2]; + vtkFloatingPointType angle[2]; int rotId[2] = { (axId == 0) ? 2 : axId - 1, (axId == 2) ? 0 : axId + 1 }; static double aCoeff = 180.0/vtkMath::Pi(); for (i = 0; i < 2; ++i) { - float cosin = cos[ rotId[ i ]]; + vtkFloatingPointType cosin = cos[ rotId[ i ]]; if (maxCos < 0) cosin = -cosin; angle[ i ] = asin(cosin) * aCoeff; @@ -989,7 +1017,7 @@ void VisuGUI_ClippingDlg::setIJKByNonStructured() int planeIndex = ComboBoxPlanes->currentItem(); OrientedPlane* plane = myPlanes[ planeIndex ].GetPointer(); vtkPlaneSource* planeSource = plane->myPlaneSource; - float * planeNormal = planeSource->GetNormal(); + vtkFloatingPointType * planeNormal = planeSource->GetNormal(); gp_Dir normal(planeNormal[0], planeNormal[1], planeNormal[2]); // find a grid axis most co-directed with plane normal @@ -997,7 +1025,7 @@ void VisuGUI_ClippingDlg::setIJKByNonStructured() int i, maxAx = 0, gridAxId = 0; gp_Dir dir, gridDir; double maxDot = 0; - const vector *curValues, *values = 0; + const vector *curValues, *values = 0; VISU::Result_i* result = myPrs3d->GetResult(); for (i = 0; i < 3; ++i) { VISU::Result_i::TAxis axis = (VISU::Result_i::TAxis) i; @@ -1072,8 +1100,8 @@ void VisuGUI_ClippingDlg::onIJKAxisChanged(int axisId) if (result) { VISU::Result_i::TAxis axis = (VISU::Result_i::TAxis) axisId; gp_Dir dir; - const vector * indices = result->GetAxisInfo(myPrs3d->GetMeshName(), - axis, dir); + const vector * indices = result->GetAxisInfo(myPrs3d->GetMeshName(), + axis, dir); if (indices) maxIndex = indices->size() - 1; } @@ -1094,6 +1122,6 @@ void VisuGUI_ClippingDlg::onIJKAxisChanged(int axisId) void VisuGUI_ClippingDlg::OnPreviewToggle (bool theIsToggled) { std::for_each(myPlanes.begin(),myPlanes.end(),TSetVisiblity(theIsToggled)); - if (SVTK_ViewWindow* vw = VISU::GetViewWindow(myVisuGUI)) + if (SVTK_ViewWindow* vw = VISU::GetActiveViewWindow(myVisuGUI)) VISU::RenderViewWindow(vw); } diff --git a/src/VISUGUI/VisuGUI_ClippingDlg.h b/src/VISUGUI/VisuGUI_ClippingDlg.h index 0a2b61b6..c649dd93 100644 --- a/src/VISUGUI/VisuGUI_ClippingDlg.h +++ b/src/VISUGUI/VisuGUI_ClippingDlg.h @@ -15,7 +15,7 @@ // 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/ +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #ifndef DIALOGBOX_CLIPPING_H @@ -45,12 +45,19 @@ class QHButtonGroup; class QSpinBox; class QTabWidget; +class SALOME_Actor; + class QtxDblSpinBox; +class SVTK_ViewWindow; + class LightApp_SelectionMgr; class VisuGUI; +class vtkPlaneSource; +class vtkDataSetMapper; + class OrientedPlane; namespace VISU { @@ -61,6 +68,47 @@ namespace VISU { enum Orientation {XY, YZ, ZX}; }; +//================================================================================= +//class : OrientedPlane +//purpose : +//================================================================================= +class OrientedPlane: public vtkPlane +{ + SVTK_ViewWindow* myViewWindow; + vtkDataSetMapper* myMapper; + +public: + static OrientedPlane* New(); + static OrientedPlane* New (SVTK_ViewWindow* vw); + + vtkTypeMacro(OrientedPlane, vtkPlane); + + VISU::Orientation myOrientation; + float myDistance; + double myAngle[2]; + + vtkPlaneSource* myPlaneSource; + SALOME_Actor* myActor; + + void SetOrientation(VISU::Orientation theOrientation); + VISU::Orientation GetOrientation(); + + void SetDistance(float theDistance); + float GetDistance(); + + void ShallowCopy(OrientedPlane* theOrientedPlane); + +protected: + OrientedPlane(); + OrientedPlane(SVTK_ViewWindow* vw); + ~OrientedPlane(); + + void Init(); + +private: + OrientedPlane(const OrientedPlane&); + void operator=(const OrientedPlane&); +}; //================================================================================= // class : VisuGUI_ClippingDlg @@ -122,6 +170,7 @@ private: QPushButton* buttonOk; QPushButton* buttonCancel; QPushButton* buttonApply; + QPushButton* buttonHelp; bool myIsSelectPlane; @@ -146,6 +195,7 @@ public slots: void ClickOnOk(); void ClickOnCancel(); void ClickOnApply(); + void ClickOnHelp(); }; #endif // DIALOGBOX_TRANSPARENCYDLG_H diff --git a/src/VISUGUI/VisuGUI_CursorDlg.cxx b/src/VISUGUI/VisuGUI_CursorDlg.cxx index 87100741..5091a490 100644 --- a/src/VISUGUI/VisuGUI_CursorDlg.cxx +++ b/src/VISUGUI/VisuGUI_CursorDlg.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -28,7 +28,16 @@ #include using namespace std; + +#include "VisuGUI.h" #include "VisuGUI_CursorDlg.h" + +#include "SUIT_Session.h" +#include "SUIT_MessageBox.h" +#include "SUIT_ResourceMgr.h" + +#include "LightApp_Application.h" + #include /*! @@ -94,12 +103,17 @@ VisuGUI_CursorDlg::VisuGUI_CursorDlg( QWidget* parent, const char* name, bool m buttonCancel->setAutoDefault(TRUE); GroupButtonsLayout->addWidget(buttonCancel, 0, 2); + buttonHelp = new QPushButton(tr("&Help") , GroupButtons, "buttonHelp"); + buttonHelp->setAutoDefault(TRUE); + GroupButtonsLayout->addWidget(buttonHelp, 0, 3); + TopLayout->addWidget(TopGroupBox, 0, 0); TopLayout->addWidget(GroupButtons, 1, 0); // signals and slots connections connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); + connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( onHelp() ) ); } /*! @@ -108,3 +122,23 @@ VisuGUI_CursorDlg::VisuGUI_CursorDlg( QWidget* parent, const char* name, bool m VisuGUI_CursorDlg::~VisuGUI_CursorDlg() { } + +/*! + function : onHelp() + purpose : +*/ +void VisuGUI_CursorDlg::onHelp() +{ + QString aHelpFileName = "/files/changing_visualization_parameters_of_the_presenetation.htm#Width"; + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) { + VisuGUI* aVisuGUI = dynamic_cast( app->activeModule() ); + app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName); + } + else { + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + QObject::tr("BUT_OK")); + } +} diff --git a/src/VISUGUI/VisuGUI_CursorDlg.h b/src/VISUGUI/VisuGUI_CursorDlg.h index 018709cf..82a910d8 100644 --- a/src/VISUGUI/VisuGUI_CursorDlg.h +++ b/src/VISUGUI/VisuGUI_CursorDlg.h @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -50,6 +50,11 @@ public: QGroupBox* GroupButtons; QPushButton* buttonOk; QPushButton* buttonCancel; + QPushButton* buttonHelp; + +private slots: + void onHelp(); + }; #endif // VISUGUI_CURSORDLG_H diff --git a/src/VISUGUI/VisuGUI_CutLinesDlg.cxx b/src/VISUGUI/VisuGUI_CutLinesDlg.cxx index a9983bf3..0a5172ad 100644 --- a/src/VISUGUI/VisuGUI_CutLinesDlg.cxx +++ b/src/VISUGUI/VisuGUI_CutLinesDlg.cxx @@ -1,8 +1,21 @@ -// VISU VISUGUI : GUI of VISU component -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// +// 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 : VisuGUI_CutLinesDlg.cxx // Author : VSV @@ -12,6 +25,7 @@ #include "VisuGUI.h" #include "VisuGUI_Tools.h" +#include "VisuGUI_ViewTools.h" #include "VISU_Gen_i.hh" #include "VISU_CutLines_i.hh" @@ -22,10 +36,13 @@ #include "SVTK_ViewWindow.h" -#include "SalomeApp_Application.h" +#include "LightApp_Application.h" #include "SalomeApp_Study.h" #include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SUIT_MessageBox.h" +#include "SUIT_ResourceMgr.h" #include "OB_Browser.h" @@ -105,7 +122,7 @@ VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (SalomeApp_Module* theModule) QHBox* aPosBox = new QHBox (aPlanePane); aPosBox->setSpacing(5); - QLabel* aPosLbl = new QLabel (tr("LBL_POS"), aPosBox); + new QLabel (tr("LBL_POS"), aPosBox); myPosSpn = new QtxDblSpinBox (0, 1, 0.1, aPosBox); myPosSpn->setValue(0.5); aPlaneLayout->addWidget(aPosBox); @@ -166,7 +183,7 @@ VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (SalomeApp_Module* theModule) QHBox* aNbBox = new QHBox(aLinesPane); aNbBox->setSpacing(5); - QLabel* aNbLbl = new QLabel( tr( "LBL_NB_PLANS" ), aNbBox ); + new QLabel( tr( "LBL_NB_PLANS" ), aNbBox ); myNbSpn = new QtxDblSpinBox( 1, 100, 1, aNbBox ); myNbSpn->setValue( 10 ); @@ -186,7 +203,7 @@ VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (SalomeApp_Module* theModule) QHBox* aPosBox2 = new QHBox(aLinesPane); aPosBox2->setSpacing(5); - QLabel* aPosLbl2 = new QLabel( tr( "LBL_POS" ), aPosBox2 ); + new QLabel( tr( "LBL_POS" ), aPosBox2 ); myPosSpn2 = new QtxDblSpinBox( 0, 1, 0.1, aPosBox2 ); myPosSpn2->setValue( 0.5 ); aLinesLayout->addWidget( aPosBox2 ); @@ -219,6 +236,9 @@ VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (SalomeApp_Module* theModule) QPushButton* aCloseBtn = new QPushButton(tr("BUT_CANCEL"), aBtnBox); aBtnLayout->addWidget(aCloseBtn); + QPushButton* aHelpBtn = new QPushButton(tr("BUT_HELP"), aBtnBox); + aBtnLayout->addWidget(aHelpBtn); + aMainLayout->addWidget(aBtnBox); myCutLines = NULL; @@ -243,6 +263,7 @@ VisuGUI_CutLinesDlg::VisuGUI_CutLinesDlg (SalomeApp_Module* theModule) connect(aOkBtn, SIGNAL(clicked()), this, SLOT(accept())); connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(reject())); + connect(aHelpBtn, SIGNAL(clicked()), this, SLOT(onHelp())); //connect(myMgr, SIGNAL(closeAllViews()), this, SLOT(reject())); //connect(VisuGUI::application()->desktop(), // SIGNAL(windowActivated(SUIT_ViewWindow*)), @@ -258,7 +279,7 @@ VisuGUI_CutLinesDlg::~VisuGUI_CutLinesDlg() deletePlanes(); if (myCutLines) //delete myCutLines; myCutLines->Destroy(); - if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) + if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow()) vf->Repaint(); } @@ -327,7 +348,7 @@ int VisuGUI_CutLinesDlg::storeToPrsObject (VISU::CutLines_i* thePrs) //------------------------------------------------------------------------------ void VisuGUI_CutLinesDlg::createPlanes() { - SVTK_ViewWindow* aView = VISU::GetViewWindow(); + SVTK_ViewWindow* aView = VISU::GetActiveViewWindow(); if (aView == NULL) return; if (myCutLines == NULL) return; if (myPreviewActor != 0) return; @@ -339,7 +360,7 @@ void VisuGUI_CutLinesDlg::createPlanes() aPlaneMapper->SetInput(aPolyData->GetOutput()); aPlaneMapper->ScalarVisibilityOff(); - myPreviewActorGlyphs = myPreviewActorGlyphs = SALOME_Actor::New(); + myPreviewActorGlyphs = SALOME_Actor::New(); myPreviewActorGlyphs->PickableOff(); updateGlyphs(false); @@ -357,10 +378,23 @@ void VisuGUI_CutLinesDlg::createPlanes() void VisuGUI_CutLinesDlg::deletePlanes() { if (myPreviewActor == 0) return; - if (SVTK_ViewWindow* aView = VISU::GetViewWindow()){ - aView->RemoveActor(myPreviewActor); - aView->RemoveActor(myPreviewActorGlyphs); - } + SVTK_ViewWindow* aView; + vtkRenderer* aRend = myPreviewActor->GetRenderer(); + vtkRenderer* aRendGlyphs = myPreviewActorGlyphs->GetRenderer(); + + vtkRenderWindow* aWnd1 = aRend->GetRenderWindow(); + vtkRenderWindow* aWnd2 = aRendGlyphs->GetRenderWindow(); + if(aRend && aWnd1) + myPreviewActor->RemoveFromRender(aRend); + if(aRendGlyphs && aWnd2) + myPreviewActorGlyphs->RemoveFromRender(aRendGlyphs); + +// Bug IPAL11962: preview is still in the viewer, if viewer not active. +// if (aView = VISU::GetActiveViewWindow()){ +// aView->RemoveActor(myPreviewActor); +// aView->RemoveActor(myPreviewActorGlyphs); +// } + myPreviewActor->Delete(); myPreviewActorGlyphs->Delete(); myPreviewActor = 0; @@ -414,7 +448,7 @@ void VisuGUI_CutLinesDlg::onCutSelect (int theId, bool theUpdate) myRotXLbl2->setText( tr("LBL_ROT_Z")); myRotYLbl2->setText( tr("LBL_ROT_X")); } - SVTK_ViewWindow* aView = VISU::GetViewWindow(); + SVTK_ViewWindow* aView = VISU::GetActiveViewWindow(); if (aView) { if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) { /*myCutLines->SetOrientation2(getOrientaion(false), @@ -443,7 +477,7 @@ void VisuGUI_CutLinesDlg::setBaseDefault (bool theUpdate) /* float aPos = myCutLines->GetBasePlanePosition(); myBasePlanePos->setText( QString::number(aPos) ); myBasePlanePos->setEnabled(false);*/ - SVTK_ViewWindow* aView = VISU::GetViewWindow(); + SVTK_ViewWindow* aView = VISU::GetActiveViewWindow(); if (aView) { if (theUpdate && myPreviewCheck->isChecked() && (myCutLines != NULL)) { //myCutLines->SetBasePlanePosition(aPos); @@ -453,7 +487,7 @@ void VisuGUI_CutLinesDlg::setBaseDefault (bool theUpdate) //aView->Repaint(); } } - float aPos = myCutLines->GetBasePlanePosition(); + vtkFloatingPointType aPos = myCutLines->GetBasePlanePosition(); myBasePlanePos->setText( QString::number(aPos) ); myBasePlanePos->setEnabled(false); } else { @@ -515,7 +549,7 @@ void VisuGUI_CutLinesDlg::DrawTable() vh->setLabel( i, str.arg(i+1) ); } // Update preview - SVTK_ViewWindow* aView = VISU::GetViewWindow(); + SVTK_ViewWindow* aView = VISU::GetActiveViewWindow(); if (aView) { if (myPreviewCheck->isChecked()) { // myCutLines->GetPL()->Update(); @@ -528,26 +562,26 @@ void VisuGUI_CutLinesDlg::DrawTable() void VisuGUI_CutLinesDlg::updateGlyphs(bool update){ if (myPreviewActorGlyphs == 0 ) return; - const float *aDirLn = myCutLines->GetCutLinesPL()->GetDirLn(); - const float *aBasePnt = myCutLines->GetCutLinesPL()->GetBasePnt(); - float aSecondPnt[3]; - float aBoundCenter[3]; + const vtkFloatingPointType *aDirLn = myCutLines->GetCutLinesPL()->GetRealDirLn(); + const vtkFloatingPointType *aBasePnt = myCutLines->GetCutLinesPL()->GetBasePnt(); + vtkFloatingPointType aSecondPnt[3]; + vtkFloatingPointType aBoundCenter[3]; vtkAppendPolyData* aPolyData = myCutLines->GetCutLinesPL()->GetAppendPolyData(); vtkDataSetMapper* aPlaneMapper = vtkDataSetMapper::New(); aPlaneMapper->SetInput(aPolyData->GetOutput()); - float bounds[6]; + vtkFloatingPointType bounds[6]; aPlaneMapper->GetBounds(bounds); for(int i=0; i<3; i++) aBoundCenter[i] = (bounds[i*2] + bounds[i*2+1])/2.0; for(int i=0; i<3; i++){ if (!myAllCurvesInvertedCheck->isChecked()) - aSecondPnt[i] = aBasePnt[i] + aDirLn[i]; + aSecondPnt[i] = aDirLn[i]; else - aSecondPnt[i] = -aBasePnt[i] - aDirLn[i]; + aSecondPnt[i] = - aDirLn[i]; } - float max_bound = 0; + vtkFloatingPointType max_bound = 0; max_bound < bounds[1]-bounds[0] ? max_bound = bounds[1] - bounds[0] : max_bound = max_bound; max_bound < bounds[3]-bounds[2] ? max_bound = bounds[3] - bounds[2] : max_bound = max_bound; max_bound < bounds[5]-bounds[4] ? max_bound = bounds[5] - bounds[4] : max_bound = max_bound; @@ -559,10 +593,9 @@ void VisuGUI_CutLinesDlg::updateGlyphs(bool update){ vtkGlyphSource2D* source = vtkGlyphSource2D::New(); source->FilledOn(); - source->SetCenter(aBoundCenter); source->SetGlyphTypeToArrow(); - aPoints->InsertNextPoint(aBasePnt); + aPoints->InsertNextPoint(aBoundCenter); profile->SetPoints(aPoints); aFloatArray->SetNumberOfComponents(3); @@ -593,7 +626,7 @@ void VisuGUI_CutLinesDlg::updateGlyphs(bool update){ source->Delete(); aPlaneMapper->Delete(); - if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) + if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow()) if (update) vf->Repaint(); } @@ -684,7 +717,7 @@ void VisuGUI_CutLinesDlg::onValueChanged (int theRow, int theCol) QString aTxt = myPosTable->text(theRow, 0); bool isChanged = !aTxt.isEmpty(); ((QCheckTableItem*)myPosTable->item(theRow, 1))->setChecked(!isChanged); - SVTK_ViewWindow* aView = VISU::GetViewWindow(); + SVTK_ViewWindow* aView = VISU::GetActiveViewWindow(); if (aView) { if (myPreviewCheck->isChecked()) { //Update Preview @@ -700,7 +733,7 @@ void VisuGUI_CutLinesDlg::onValueChanged (int theRow, int theCol) if (isDefault) { //myCutLines->SetDefaultPosition(theRow); // myPosTable->setText(theRow, 0, QString::number(myCutLines->GetLinePosition(theRow))); - SVTK_ViewWindow* aView = VISU::GetViewWindow(); + SVTK_ViewWindow* aView = VISU::GetActiveViewWindow(); if (aView) { if (myPreviewCheck->isChecked()) { //Update Preview @@ -820,7 +853,7 @@ void VisuGUI_CutLinesDlg::reject() void VisuGUI_CutLinesDlg::onPreviewCheck (bool thePreview) { - if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) { + if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow()) { if (thePreview) { //storeToPrsObject(myCutLines); // myCutLines->GetPL()->Update(); @@ -851,7 +884,7 @@ void VisuGUI_CutLinesDlg::onAllCurvesInvertedCheck(bool theInvert) void VisuGUI_CutLinesDlg::onRotation (double theValue) { if (myCutLines == NULL) return; - SVTK_ViewWindow* aView = VISU::GetViewWindow(); + SVTK_ViewWindow* aView = VISU::GetActiveViewWindow(); if (aView) { if (myPreviewCheck->isChecked()) { @@ -872,7 +905,7 @@ void VisuGUI_CutLinesDlg::onRotation (double theValue) void VisuGUI_CutLinesDlg::onPlanePos (const QString& theValue) { if (myCutLines == NULL) return; - SVTK_ViewWindow* aView = VISU::GetViewWindow(); + SVTK_ViewWindow* aView = VISU::GetActiveViewWindow(); if (aView) { if (myPreviewCheck->isChecked()) { //myCutLines->SetBasePlanePosition(theValue.toDouble()); @@ -884,6 +917,22 @@ void VisuGUI_CutLinesDlg::onPlanePos (const QString& theValue) } } +void VisuGUI_CutLinesDlg::onHelp() +{ + QString aHelpFileName = "/files/cut_lines_presentation.htm"; + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) { + VisuGUI* aVisuGUI = dynamic_cast( app->activeModule() ); + app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName); + } + else { + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + QObject::tr("BUT_OK")); + } +} + //jfa tmp:void VisuGUI_CutLinesDlg::onWindowActivated (SUIT_ViewWindow* theWnd) //jfa tmp:{ //jfa tmp: if (theWnd != myStudyWnd) diff --git a/src/VISUGUI/VisuGUI_CutLinesDlg.h b/src/VISUGUI/VisuGUI_CutLinesDlg.h index f196660e..596798bd 100644 --- a/src/VISUGUI/VisuGUI_CutLinesDlg.h +++ b/src/VISUGUI/VisuGUI_CutLinesDlg.h @@ -1,8 +1,21 @@ -// VISU VISUGUI : GUI of VISU component -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// +// 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 : VisuGUI_CutLinesDlg.h // Author : VSV @@ -52,6 +65,7 @@ private slots: void onAllCurvesInvertedCheck(bool theInvert); void onRotation (double theValue); void onPlanePos (const QString& theValue); + void onHelp(); //jfa tmp:void onWindowActivated (SUIT_ViewWindow*); private: diff --git a/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx b/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx index c4072907..53647c48 100644 --- a/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx +++ b/src/VISUGUI/VisuGUI_CutPlanesDlg.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -30,6 +30,7 @@ #include "VisuGUI.h" #include "VisuGUI_Tools.h" +#include "VisuGUI_ViewTools.h" #include "VISU_CutPlanes_i.hh" #include "VISU_CutPlanesPL.hxx" @@ -38,12 +39,15 @@ #include "SVTK_ViewWindow.h" -#include "SalomeApp_Application.h" +#include "LightApp_Application.h" #include "SUIT_Application.h" #include "SUIT_Desktop.h" #include "SUIT_ViewWindow.h" #include "SUIT_ViewManager.h" +#include "SUIT_Session.h" +#include "SUIT_MessageBox.h" +#include "SUIT_ResourceMgr.h" #include #include @@ -166,11 +170,10 @@ VisuGUI_CutPlanesPane::VisuGUI_CutPlanesPane (QWidget* theParent) VisuGUI_CutPlanesPane::~VisuGUI_CutPlanesPane() { - cout<<"### VisuGUI_CutPlanesPane::~VisuGUI_CutPlanesPane"<Destroy(); - if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) + if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow()) vf->Repaint(); } @@ -194,7 +197,7 @@ void VisuGUI_CutPlanesPane::initFromPrsObject (VISU::CutPlanes_i* thePrs) void VisuGUI_CutPlanesPane::createPlanes() { - if (VISU::GetViewWindow() == NULL) return; + if (VISU::GetActiveViewWindow() == NULL) return; if (myCutPlanes == NULL) return; if (myPreviewActor != 0) return; @@ -211,7 +214,7 @@ void VisuGUI_CutPlanesPane::createPlanes() myPreviewActor->PickableOff(); myPreviewActor->SetMapper(aPlaneMapper); aPlaneMapper->Delete(); - VISU::GetViewWindow()->AddActor(myPreviewActor); + VISU::GetActiveViewWindow()->AddActor(myPreviewActor); } int VisuGUI_CutPlanesPane::storeToPrsObject (VISU::CutPlanes_i* thePrs) @@ -349,7 +352,7 @@ void VisuGUI_CutPlanesPane::DrawTable() // Update preview if (myPreviewCheck->isChecked()) { - if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) { + if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow()) { myCutPlanes->GetPL()->Update(); deletePlanes(); createPlanes(); @@ -386,7 +389,7 @@ void VisuGUI_CutPlanesPane::onValueChanged (int theRow, int theCol) if (myPreviewCheck->isChecked()) { //Update Preview - if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) { + if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow()) { myCutPlanes->SetPlanePosition( theRow, aTxt.toDouble()); myCutPlanes->GetPL()->Update(); deletePlanes(); @@ -401,7 +404,7 @@ void VisuGUI_CutPlanesPane::onValueChanged (int theRow, int theCol) myPosTable->setText(theRow, 0, QString::number(myCutPlanes->GetPlanePosition(theRow))); if (myPreviewCheck->isChecked()) { - if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) { + if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow()) { //Update Preview myCutPlanes->GetPL()->Update(); deletePlanes(); @@ -417,8 +420,12 @@ void VisuGUI_CutPlanesPane::onValueChanged (int theRow, int theCol) void VisuGUI_CutPlanesPane::deletePlanes() { if (myPreviewActor == 0) return; - if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) - vf->RemoveActor(myPreviewActor); + vtkRenderer* aRend = myPreviewActor->GetRenderer(); + if(aRend) + myPreviewActor->RemoveFromRender(aRend); +// Bug IPAL11962: preview is still in the viewer, if viewer not active. +// if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow()) +// vf->RemoveActor(myPreviewActor); myPreviewActor->Delete(); myPreviewActor = 0; } @@ -427,7 +434,7 @@ void VisuGUI_CutPlanesPane::onRotation (double theValue) { if (myCutPlanes == NULL) return; if (myPreviewCheck->isChecked()) { - if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) { + if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow()) { myCutPlanes->SetOrientation(getOrientaion(),getRotation1()*PI/180.,getRotation2()*PI/180.); myCutPlanes->GetPL()->Update(); deletePlanes(); @@ -439,7 +446,7 @@ void VisuGUI_CutPlanesPane::onRotation (double theValue) void VisuGUI_CutPlanesPane::onPreviewCheck (bool thePreview) { - if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) { + if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow()) { if (thePreview) { storeToPrsObject(myCutPlanes); myCutPlanes->GetPL()->Update(); @@ -500,10 +507,15 @@ VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg (SalomeApp_Module* theModule) buttonCancel->setAutoDefault(TRUE); GroupButtonsLayout->addWidget(buttonCancel, 0, 2); + QPushButton* buttonHelp = new QPushButton(tr("&Help"), GroupButtons, "buttonHelp"); + buttonHelp->setAutoDefault(TRUE); + GroupButtonsLayout->addWidget(buttonHelp, 0, 3); + TopLayout->addWidget(GroupButtons); connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); + connect(buttonHelp, SIGNAL(clicked()), this, SLOT(onHelp())); //connect(myMgr, SIGNAL(closeAllViews()), this, SLOT(reject())); //connect(VisuGUI::application()->desktop(), // SIGNAL(windowActivated(SUIT_ViewWindow*)), @@ -541,6 +553,22 @@ void VisuGUI_CutPlanesDlg::reject() { QDialog::reject(); } +void VisuGUI_CutPlanesDlg::onHelp() +{ + QString aHelpFileName = "/files/cut_lines_resentation.htm"; + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) { + VisuGUI* aVisuGUI = dynamic_cast( app->activeModule() ); + app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName); + } + else { + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + QObject::tr("BUT_OK")); + } +} + //void VisuGUI_CutPlanesDlg::onWindowActivated (SUIT_ViewWindow* theWnd) //{ // if (theWnd != myStudyWnd) diff --git a/src/VISUGUI/VisuGUI_CutPlanesDlg.h b/src/VISUGUI/VisuGUI_CutPlanesDlg.h index e79e18cd..e1726ecc 100644 --- a/src/VISUGUI/VisuGUI_CutPlanesDlg.h +++ b/src/VISUGUI/VisuGUI_CutPlanesDlg.h @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -90,7 +90,7 @@ private: SALOME_Actor* myPreviewActor; private slots: - //void editScalarBar(); +//VSR: 08/06/06: void editScalarBar(); void orientationChanged( int ); void DrawTable(); void setDefault( int all = -1); @@ -114,7 +114,8 @@ public: protected slots: void accept(); void reject(); - //void onWindowActivated (SUIT_ViewWindow*); +//VSR: 08/06/06: void onWindowActivated (SUIT_ViewWindow*); + void onHelp(); private: VisuGUI_CutPlanesPane* myCutPane; diff --git a/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx b/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx index da99973c..0ab09694 100644 --- a/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx +++ b/src/VISUGUI/VisuGUI_DeformedShapeDlg.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -28,12 +28,17 @@ #include "VisuGUI_DeformedShapeDlg.h" +#include "VisuGUI.h" #include "VisuGUI_Tools.h" #include "VISU_DeformedShape_i.hh" #include "SalomeApp_Module.h" +#include "LightApp_Application.h" #include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SUIT_MessageBox.h" +#include "SUIT_ResourceMgr.h" #include #include @@ -113,6 +118,10 @@ VisuGUI_DeformedShapeDlg::VisuGUI_DeformedShapeDlg (SalomeApp_Module* theModule) buttonCancel->setAutoDefault(TRUE); GroupButtonsLayout->addWidget(buttonCancel, 0, 2); + QPushButton* buttonHelp = new QPushButton (tr("&Help") , GroupButtons, "buttonHelp"); + buttonHelp->setAutoDefault(TRUE); + GroupButtonsLayout->addWidget(buttonHelp, 0, 3); + // Add Tab box and Buttons to the top layout TopLayout->addWidget(aTabBox); TopLayout->addWidget(GroupButtons); @@ -120,6 +129,7 @@ VisuGUI_DeformedShapeDlg::VisuGUI_DeformedShapeDlg (SalomeApp_Module* theModule) // signals and slots connections connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); + connect(buttonHelp, SIGNAL(clicked()), this, SLOT(onHelp())); } void VisuGUI_DeformedShapeDlg::initFromPrsObject (VISU::DeformedShape_i* thePrs) @@ -149,3 +159,19 @@ void VisuGUI_DeformedShapeDlg::reject() myScalarPane->deletePreview(); QDialog::reject(); } + +void VisuGUI_DeformedShapeDlg::onHelp() +{ + QString aHelpFileName = "/files/deformed_shape_presentation.htm"; + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) { + VisuGUI* aVisuGUI = dynamic_cast( app->activeModule() ); + app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName); + } + else { + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + QObject::tr("BUT_OK")); + } +} diff --git a/src/VISUGUI/VisuGUI_DeformedShapeDlg.h b/src/VISUGUI/VisuGUI_DeformedShapeDlg.h index 573c439a..a5e870b1 100644 --- a/src/VISUGUI/VisuGUI_DeformedShapeDlg.h +++ b/src/VISUGUI/VisuGUI_DeformedShapeDlg.h @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -67,6 +67,7 @@ public: protected slots: void accept(); void reject(); + void onHelp(); private: QtxDblSpinBox* ScalFact; diff --git a/src/VISUGUI/VisuGUI_DialogRunner.cxx b/src/VISUGUI/VisuGUI_DialogRunner.cxx index ad3b1bd1..872fd687 100644 --- a/src/VISUGUI/VisuGUI_DialogRunner.cxx +++ b/src/VISUGUI/VisuGUI_DialogRunner.cxx @@ -15,7 +15,7 @@ // 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/ +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // File: VisuGUI_DialogRunner.cxx // Created: Thu Oct 6 10:17:39 2005 diff --git a/src/VISUGUI/VisuGUI_DialogRunner.h b/src/VISUGUI/VisuGUI_DialogRunner.h index 9f89cf7e..6911fe0a 100644 --- a/src/VISUGUI/VisuGUI_DialogRunner.h +++ b/src/VISUGUI/VisuGUI_DialogRunner.h @@ -15,7 +15,7 @@ // 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/ +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // diff --git a/src/VISUGUI/VisuGUI_Displayer.cxx b/src/VISUGUI/VisuGUI_Displayer.cxx index 1fa6f098..46fd0922 100644 --- a/src/VISUGUI/VisuGUI_Displayer.cxx +++ b/src/VISUGUI/VisuGUI_Displayer.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -27,10 +27,13 @@ // $Header: /home/server/cvs/VISU/VISU_SRC/src/VISUGUI/VisuGUI_Displayer.cxx #include "VisuGUI_Displayer.h" -#include "VVTK_ViewModel.h" + #include "VisuGUI_Tools.h" +#include "VISU_ViewManager_i.hh" #include "VISU_Actor.h" +#include "VVTK_ViewModel.h" + #include #include @@ -41,7 +44,7 @@ #include #include -#include "VISU_ViewManager_i.hh" +#include VisuGUI_Displayer::VisuGUI_Displayer( SalomeApp_Application* app ) : LightApp_Displayer(), @@ -67,7 +70,9 @@ SALOME_Prs* VisuGUI_Displayer::buildPresentation( const QString& entry, SALOME_V if( CORBA::is_nil( anObj ) ) return 0; - SVTK_Viewer* vtk_viewer = dynamic_cast( aViewFrame ); + SVTK_Viewer* vtk_viewer = dynamic_cast( aViewFrame ); + if (!vtk_viewer) + vtk_viewer = dynamic_cast( aViewFrame ); if( vtk_viewer ) { SVTK_ViewWindow* wnd = @@ -116,14 +121,22 @@ SALOME_Prs* VisuGUI_Displayer::buildPresentation( const QString& entry, SALOME_V void VisuGUI_Displayer::buildPrs3d( SVTK_ViewWindow* wnd, VISU::Prs3d_i* thePrs ) const { - VISU_Actor* newAct = VISU::FindActor( wnd, thePrs ); - if( !newAct ) - { - newAct = thePrs->CreateActor(); + VISU_Actor* newAct = VISU::FindActor(wnd, thePrs); + if (!newAct) { + try { + newAct = thePrs->CreateActor(); + } catch (std::runtime_error& exc) { + thePrs->RemoveActors(); + + INFOS(exc.what()); + SUIT_MessageBox::warn1 + (myApp->desktop(), QObject::tr("WRN_VISU"), + QObject::tr("ERR_CANT_BUILD_PRESENTATION") + ": " + QObject::tr(exc.what()), + QObject::tr("BUT_OK")); + } } - if( newAct ) - { - wnd->AddActor( newAct ); + if (newAct) { + wnd->AddActor(newAct); wnd->Repaint(); } } diff --git a/src/VISUGUI/VisuGUI_Displayer.h b/src/VISUGUI/VisuGUI_Displayer.h index f762ba0a..fdb729b5 100644 --- a/src/VISUGUI/VisuGUI_Displayer.h +++ b/src/VISUGUI/VisuGUI_Displayer.h @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // diff --git a/src/VISUGUI/VisuGUI_EditContainerDlg.cxx b/src/VISUGUI/VisuGUI_EditContainerDlg.cxx index eed32a53..b79e65d9 100644 --- a/src/VISUGUI/VisuGUI_EditContainerDlg.cxx +++ b/src/VISUGUI/VisuGUI_EditContainerDlg.cxx @@ -1,8 +1,21 @@ -// VISU VISUGUI : GUI of VISU component -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// +// 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 : VisuGUI_EditContainerDlg.cxx // Author : VSV @@ -18,6 +31,9 @@ #include "SalomeApp_Application.h" #include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SUIT_MessageBox.h" +#include "SUIT_ResourceMgr.h" #include #include @@ -280,10 +296,15 @@ VisuGUI_EditContainerDlg::VisuGUI_EditContainerDlg (VisuGUI* theModule, bool the buttonCancel->setAutoDefault(TRUE); GroupButtonsLayout->addWidget(buttonCancel, 0, 2); + QPushButton* buttonHelp = new QPushButton(tr("&Help") , GroupButtons, "buttonHelp"); + buttonHelp->setAutoDefault(TRUE); + GroupButtonsLayout->addWidget(buttonHelp, 0, 3); + TopLayout->addWidget(GroupButtons); connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); + connect(buttonHelp, SIGNAL(clicked()), this, SLOT(onHelp())); } void VisuGUI_EditContainerDlg::initFromPrsObject (VISU::Container_i* theContainer) @@ -427,3 +448,17 @@ void VisuGUI_EditContainerDlg::onRightSelected() } myLeftBtn->setEnabled(isSelected); } + +void VisuGUI_EditContainerDlg::onHelp() +{ + QString aHelpFileName = "/files/creating_xy_plot.htm"; + SalomeApp_Application* app = (SalomeApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) + app->onHelpContextModule(myVisuGUI ? app->moduleName(myVisuGUI->moduleName()) : QString(""), aHelpFileName); + else { + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + QObject::tr("BUT_OK")); + } +} diff --git a/src/VISUGUI/VisuGUI_EditContainerDlg.h b/src/VISUGUI/VisuGUI_EditContainerDlg.h index 8493d0ff..ced26561 100644 --- a/src/VISUGUI/VisuGUI_EditContainerDlg.h +++ b/src/VISUGUI/VisuGUI_EditContainerDlg.h @@ -1,8 +1,21 @@ -// VISU VISUGUI : GUI of VISU component -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// +// 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 : VisuGUI_EditContainerDlg.h // Author : VSV @@ -48,6 +61,7 @@ class VisuGUI_EditContainerDlg: public QDialog void onRightClicked(); void onLeftSelected(); void onRightSelected(); + void onHelp(); private: QString getSObjectName (_PTR(SObject) theSObject); diff --git a/src/VISUGUI/VisuGUI_Factory.cxx b/src/VISUGUI/VisuGUI_Factory.cxx index 55cb6d5b..5ef7af88 100644 --- a/src/VISUGUI/VisuGUI_Factory.cxx +++ b/src/VISUGUI/VisuGUI_Factory.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // diff --git a/src/VISUGUI/VisuGUI_FileDlg.cxx b/src/VISUGUI/VisuGUI_FileDlg.cxx index 1e788c46..5bf734b2 100644 --- a/src/VISUGUI/VisuGUI_FileDlg.cxx +++ b/src/VISUGUI/VisuGUI_FileDlg.cxx @@ -1,8 +1,21 @@ -// SALOME SALOMEGUI : GUI of VISU module -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// +// 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 : VisuGUI_FileDlg.cxx // Author : diff --git a/src/VISUGUI/VisuGUI_FileDlg.h b/src/VISUGUI/VisuGUI_FileDlg.h index ec3b219f..e1589832 100644 --- a/src/VISUGUI/VisuGUI_FileDlg.h +++ b/src/VISUGUI/VisuGUI_FileDlg.h @@ -1,8 +1,21 @@ -// SALOME SALOMEGUI : GUI of VISU module -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// +// 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 : VisuGUI_FileDlg.h // Author : diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx index 7492c7f5..a5f7df0c 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -39,7 +39,7 @@ #include "VVTK_PrimitiveBox.h" #include "VVTK_SizeBox.h" -#include "SalomeApp_Application.h" +#include "LightApp_Application.h" #include "SalomeApp_Module.h" #include "SUIT_Desktop.h" #include "SUIT_ResourceMgr.h" @@ -314,13 +314,13 @@ void VisuGUI_GaussScalarBarPane::initFromPrsObject(VISU::GaussPoints_i* thePrs) const VISU::TNames& aCompNames = aField->myCompNames; const VISU::TNames& aUnitNames = aField->myUnitNames; for(int i = 0; i < aNbComp; i++){ - QString aComponent = QString(aCompNames[i]).simplifyWhiteSpace(); + QString aComponent = QString(aCompNames[i].c_str()).simplifyWhiteSpace(); if(aComponent.isNull() || aComponent == "") aComponent = "Component " + QString::number(i+1); else aComponent = "[" + QString::number(i+1) + "] " + aComponent; - QString anUnit = QString(aUnitNames[i]).simplifyWhiteSpace(); + QString anUnit = QString(aUnitNames[i].c_str()).simplifyWhiteSpace(); if(anUnit.isNull() || anUnit == "") anUnit = "-"; @@ -340,7 +340,7 @@ void VisuGUI_GaussScalarBarPane::initFromPrsObject(VISU::GaussPoints_i* thePrs) // "Title" myTextDlg->setTitleText(QString(thePrs->GetTitle())); - float R, G, B; + vtkFloatingPointType R, G, B; thePrs->GetTitleColor(&R, &G, &B); myTextDlg->myTitleFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)), @@ -594,12 +594,17 @@ VisuGUI_GaussPointsDlg::VisuGUI_GaussPointsDlg(SalomeApp_Module* theModule, bool buttonCancel->setAutoDefault( TRUE ); GroupButtonsLayout->addWidget( buttonCancel, 0, 2 ); + QPushButton* buttonHelp = new QPushButton( tr( "&Help" ) , GroupButtons, "buttonHelp" ); + buttonHelp->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonHelp, 0, 3 ); + TopLayout->addWidget( PrsGroup ); TopLayout->addWidget( aTabBox ); TopLayout->addWidget( GroupButtons ); connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); + connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( onHelp() ) ); } void VisuGUI_GaussPointsDlg::initFromPrsObject( VISU::GaussPoints_i* thePrs ) @@ -731,3 +736,17 @@ void VisuGUI_GaussPointsDlg::accept() //if( myScalarPane->check() ) QDialog::accept(); } + +void VisuGUI_GaussPointsDlg::onHelp() +{ + QString aHelpFileName = "types_of_gauss_points_presentations.htm"; + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) + app->onHelpContextModule(app->activeModule() ? app->moduleName(app->activeModule()->moduleName()) : QString(""), aHelpFileName); + else { + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + QObject::tr("BUT_OK")); + } +} diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.h b/src/VISUGUI/VisuGUI_GaussPointsDlg.h index 89bf6fec..9617d640 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.h +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.h @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -114,7 +114,7 @@ class VisuGUI_GaussScalarBarPane : public QVBox private slots: void changeDefaults( int ); - //void changeRange( int ); +//VSR: 08/06/06: void changeRange( int ); void XYChanged( double ); void onTextPref(); void onSetDisplayGlobal(); @@ -141,6 +141,7 @@ public: protected slots: void onToggleDefShape( bool ); + void onHelp(); void accept(); diff --git a/src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx b/src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx index 34d170b9..4e370fb9 100644 --- a/src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx +++ b/src/VISUGUI/VisuGUI_IsoSurfacesDlg.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -31,10 +31,12 @@ #include "VisuGUI.h" #include "VisuGUI_Tools.h" -#include "SalomeApp_Application.h" +#include "LightApp_Application.h" #include "SUIT_Desktop.h" +#include "SUIT_Session.h" #include "SUIT_MessageBox.h" +#include "SUIT_ResourceMgr.h" #include @@ -201,12 +203,16 @@ VisuGUI_IsoSurfacesDlg::VisuGUI_IsoSurfacesDlg (SalomeApp_Module* theModule) QPushButton* buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" ); buttonCancel->setAutoDefault( TRUE ); GroupButtonsLayout->addWidget( buttonCancel, 0, 2 ); + QPushButton* buttonHelp = new QPushButton( tr( "&Help" ) , GroupButtons, "buttonHelp" ); + buttonHelp->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonHelp, 0, 3 ); TopLayout->addWidget(GroupButtons); // signals and slots connections connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); + connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( onHelp() ) ); } void VisuGUI_IsoSurfacesDlg::accept() @@ -223,3 +229,19 @@ void VisuGUI_IsoSurfacesDlg::reject() myScalarPane->deletePreview(); QDialog::reject(); } + +void VisuGUI_IsoSurfacesDlg::onHelp() +{ + QString aHelpFileName = "/files/iso_surfaces_presentation.htm"; + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) { + VisuGUI* aVisuGUI = dynamic_cast( app->activeModule() ); + app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName); + } + else { + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + QObject::tr("BUT_OK")); + } +} diff --git a/src/VISUGUI/VisuGUI_IsoSurfacesDlg.h b/src/VISUGUI/VisuGUI_IsoSurfacesDlg.h index dc0547f1..5e3b1c51 100644 --- a/src/VISUGUI/VisuGUI_IsoSurfacesDlg.h +++ b/src/VISUGUI/VisuGUI_IsoSurfacesDlg.h @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -86,6 +86,7 @@ class VisuGUI_IsoSurfacesDlg : public QDialog protected slots: void accept(); void reject(); + void onHelp(); private: VisuGUI_IsoSurfPane* myIsoPane; diff --git a/src/VISUGUI/VisuGUI_Module.cxx b/src/VISUGUI/VisuGUI_Module.cxx index f496c5dc..3cab58e2 100644 --- a/src/VISUGUI/VisuGUI_Module.cxx +++ b/src/VISUGUI/VisuGUI_Module.cxx @@ -1,4 +1,4 @@ - +// VISU VISUGUI : GUI of VISU component // // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -43,6 +43,10 @@ #include "LightApp_SelectionMgr.h" #include "LightApp_VTKSelector.h" #include "LightApp_Preferences.h" +#include "LightApp_Displayer.h" + +#include "SALOMEDSClient_ClientFactory.hxx" +#include "SALOMEDSClient_IParameters.hxx" #include "VVTK_ViewManager.h" #include "VVTK_ViewWindow.h" @@ -55,6 +59,7 @@ #include "VISU_Event.h" #include "VisuGUI_Prs3dTools.h" +#include "VisuGUI_ClippingDlg.h" #include "VISU_GaussPoints_i.hh" #include "VISU_GaussPtsAct.h" @@ -65,6 +70,7 @@ #include "VISU_CutLines_i.hh" #include "VISU_Actor.h" +#include "VISU_ScalarMapAct.h" #include "VisuGUI_Tools.h" #include "VisuGUI_ActionsDef.h" @@ -76,11 +82,44 @@ #include "VVTK_MainWindow.h" #include "VISU_View_i.hh" +#ifndef DISABLE_VTKVIEWER +#ifndef DISABLE_SALOMEOBJECT + #include + #include +#else + #include +#endif + #include +#endif +#ifndef DISABLE_OCCVIEWER + #include + #include +#ifndef DISABLE_SALOMEOBJECT + #include +#else + #include +#endif +#endif +#ifndef DISABLE_GLVIEWER + #include + #include +#endif +#ifndef DISABLE_PLOT2DVIEWER + #include + #include +#ifndef DISABLE_SALOMEOBJECT + #include +#else + #include +#endif +#endif + #include #include #include #include +#include #include @@ -90,6 +129,8 @@ static int MYDEBUG = 0; static int MYDEBUG = 0; #endif +#define SAVE_VISU_STATE 5090 + #define GAUSS_NEW_VIEWER 5100 #define GAUSS_CREATE_PRS 5200 #define GAUSS_RENAME 5210 @@ -114,87 +155,60 @@ using namespace VISU; namespace VISU { - //--------------------------------------------------------------- - class Viewer - { - VVTK_ViewManager* myViewManager; - LightApp_VTKSelector* mySelector; - public: - - Viewer(VisuGUI_Module* theModule, TViewerMap& theViewerMap) - { - SalomeApp_Application* anApp = theModule->getApp(); - myViewManager = new VVTK_ViewManager( anApp->activeStudy(), anApp->desktop() ); - VVTK_Viewer* aViewer = (VVTK_Viewer*)myViewManager->getViewModel(); - mySelector = new LightApp_VTKSelector( aViewer, anApp->selectionMgr() ); - anApp->addViewManager( myViewManager ); - - theViewerMap.insert(TViewerMap::value_type(myViewManager,PViewer(this))); - QObject::connect( myViewManager, SIGNAL( lastViewClosed( SUIT_ViewManager* ) ), - theModule, SLOT( onLastViewClosed( SUIT_ViewManager* ) ) ); - - //aViewer->setBackgroundColor( Qt::darkGreen ); - myViewManager->createViewWindow(); - } - - VVTK_ViewManager* getViewManager() - { - return myViewManager; - } - - virtual - ~Viewer() - { - } - }; - - //--------------------------------------------------------------- typedef void (SUIT_ViewWindow::* TViewVisibility)(); void - SetViewVisibility(const TViewerMap& theViewerMap, + SetViewVisibility(SalomeApp_Application* app, TViewVisibility theViewVisibility) { - TViewerMap::const_iterator anIter = theViewerMap.begin(); - for(; anIter != theViewerMap.end(); anIter++){ - if(SUIT_ViewManager* aViewManager = anIter->first){ + ViewManagerList l; + app->viewManagers( VVTK_Viewer::Type(), l ); + ViewManagerList::const_iterator anIt = l.begin(), aLast = l.end(); + for( ; anIt!=aLast; anIt++ ) + if( SUIT_ViewManager* aViewManager = *anIt ) + { QPtrVector aViews = aViewManager->getViews(); int aSize = aViews.size(); - for(int anId = 0; anId < aSize; anId++){ - if(SUIT_ViewWindow* aView = aViews[anId]){ + for(int anId = 0; anId < aSize; anId++) + { + if(SUIT_ViewWindow* aView = aViews[anId]) (aView->* theViewVisibility)(); - } } } - } } - } //--------------------------------------------------------------- -VisuGUI_Module -::VisuGUI_Module() : +VisuGUI_Module:: +VisuGUI_Module() : VisuGUI() { } //--------------------------------------------------------------- -VisuGUI_Module -::~VisuGUI_Module() +VisuGUI_Module:: +~VisuGUI_Module() { } //--------------------------------------------------------------- void -VisuGUI_Module -::initialize( CAM_Application* theApp ) +VisuGUI_Module:: +initialize( CAM_Application* theApp ) { VisuGUI::initialize( theApp ); SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); + // "Save VISU State" command is moved from SalomeApp_Applicaiton + createAction( SAVE_VISU_STATE, tr( "TOT_DESK_FILE_SAVE_GUI_STATE" ), QIconSet(), + tr( "MEN_DESK_FILE_SAVE_GUI_STATE" ), tr( "PRP_DESK_FILE_SAVE_GUI_STATE" ), + 0, getApp()->desktop(), false, getApp(), SLOT( onSaveGUIState() ) ); + int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1 ); + createMenu( SAVE_VISU_STATE, fileMenu, 9, -1 ); + QPixmap aPixmap; aPixmap = aResourceMgr->loadPixmap("VISU",tr("ICON_GAUSS_NEW_VIEWER")); createAction( GAUSS_NEW_VIEWER, @@ -210,7 +224,7 @@ VisuGUI_Module int windowMenu = createMenu( tr( "MEN_DESK_WINDOW" ), -1, 100 ); int newWinMenu = createMenu( tr( "MEN_DESK_NEWWINDOW" ), windowMenu, -1, 0 ); createMenu( action( GAUSS_NEW_VIEWER ), newWinMenu, -1 ); - + // Add actions to menus createMenu( tr( "MEN_GAUSS" ), -1, -1, 30 ); //createMenu( GAUSS_CREATE_PRS, aMenuId, 10 ); @@ -230,7 +244,8 @@ VisuGUI_Module accel->setActionKey( SVTK::PlusSpeedIncrementEvent, Key_Plus, aViewerType ); accel->setActionKey( SVTK::MinusSpeedIncrementEvent, Key_Minus, aViewerType ); - connect( getApp(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ), this, SLOT( OnViewManagerAdded (SUIT_ViewManager*) ) ); + connect( getApp(), SIGNAL( viewManagerAdded( SUIT_ViewManager* ) ), + this, SLOT( OnViewManagerAdded (SUIT_ViewManager*) ) ); // Prepare popup menus QtxPopupMgr* mgr = popupMgr(); @@ -276,6 +291,41 @@ VisuGUI_Module true ); action( GAUSS_COPY_PRS )->setEnabled(false); + QStringList viewers; + +#ifndef DISABLE_OCCVIEWER +#ifndef DISABLE_SALOMEOBJECT + viewers.append( SOCC_Viewer::Type() ); +#else + viewers.append( OCCViewer_Viewer::Type() ); +#endif +#endif +#ifndef DISABLE_VTKVIEWER +#ifndef DISABLE_SALOMEOBJECT + viewers.append( SVTK_Viewer::Type() ); + viewers.append( VVTK_Viewer::Type() ); +#else + viewers.append( VTKViewer_Viewer::Type() ); +#endif +#endif +#ifndef DISABLE_PLOT2DVIEWER +#ifndef DISABLE_SALOMEOBJECT + viewers.append( SPlot2d_Viewer::Type() ); +#else + viewers.append( Plot2d_Viewer::Type() ); +#endif +#endif + + if( !viewers.isEmpty() ) + { + QString strViewers = "{ ", temp = "'%1' "; + QStringList::const_iterator anIt = viewers.begin(), aLast = viewers.end(); + for( ; anIt!=aLast; anIt++ ) + strViewers+=temp.arg( *anIt ); + strViewers+="}"; + mgr->setRule( action(myEraseAll), QString( "client in %1" ).arg( strViewers ), true ); + } + aRule = "(selcount>0 and type='VISU::TGAUSSPOINTS')"; createAction( GAUSS_ERASE_PRS, VisuGUI::tr("MEN_ERASE"), QIconSet(), @@ -283,21 +333,21 @@ VisuGUI_Module this, SLOT(OnErasePrs())); mgr->insert( action( GAUSS_ERASE_PRS ), -1, -1, -1 ); // erase mgr->setRule( action( GAUSS_ERASE_PRS ), - aRule + " and (isVisible=true)", true ); + aRule + " and ({true} in $canBeDisplayed) and (isVisible=true)", true ); createAction( GAUSS_DISPLAY_PRS, VisuGUI::tr("MEN_DISPLAY"), QIconSet(), VisuGUI::tr("MEN_DISPLAY"), "", 0, this, false, this, SLOT(OnDisplayPrs())); mgr->insert( action( GAUSS_DISPLAY_PRS ), -1, -1, -1 ); // display mgr->setRule( action( GAUSS_DISPLAY_PRS ), - aRule + " and (isVisible=false)", true ); + aRule + " and ({true} in $canBeDisplayed) and (isVisible=false)", true ); createAction( GAUSS_DISPLAY_ONLY_PRS, VisuGUI::tr("MEN_DISPLAY_ONLY"), QIconSet(), VisuGUI::tr("MEN_DISPLAY_ONLY"), "", 0, this, false, this, SLOT(OnDisplayOnlyPrs())); mgr->insert( action( GAUSS_DISPLAY_ONLY_PRS ), -1, -1, -1 ); // display only mgr->setRule( action( GAUSS_DISPLAY_ONLY_PRS ), - aRule, true ); + aRule + " and ({true} in $canBeDisplayed)", true ); createAction( GAUSS_RENAME_CONFIGURATION, VisuGUI::tr("MEN_RENAME"), QIconSet(), VisuGUI::tr("MEN_RENAME"), "", 0, this, false, @@ -309,7 +359,8 @@ VisuGUI_Module tr("MEN_SAVE_CONFIGURATION"), "", 0, this, false, this, SLOT(OnSaveConfiguration())); mgr->insert( action( GAUSS_SAVE_CONFIGURATION ), -1, -1, -1 ); - mgr->setRule( action( GAUSS_SAVE_CONFIGURATION ), "selcount>=0 and client='VVTK' and activeView='VVTK'", true ); + mgr->setRule( action( GAUSS_SAVE_CONFIGURATION ), + "selcount>=0 and client='VVTK' and activeView='VVTK'", true ); createAction( GAUSS_OVERWRITE_CONFIGURATION, tr("MEN_OVERWRITE_CONFIGURATION"), QIconSet(), tr("MEN_OVERWRITE_CONFIGURATION"), "", 0, this, false, @@ -328,12 +379,12 @@ VisuGUI_Module //--------------------------------------------------------------- bool -VisuGUI_Module -::activateModule( SUIT_Study* theStudy ) +VisuGUI_Module:: +activateModule( SUIT_Study* theStudy ) { VisuGUI::activateModule( theStudy ); - SetViewVisibility(myViewerMap,&SUIT_ViewWindow::show); + SetViewVisibility(getApp(),&SUIT_ViewWindow::show); return true; } @@ -341,12 +392,12 @@ VisuGUI_Module //--------------------------------------------------------------- bool -VisuGUI_Module -::deactivateModule( SUIT_Study* theStudy ) +VisuGUI_Module:: +deactivateModule( SUIT_Study* theStudy ) { VisuGUI::deactivateModule( theStudy ); - SetViewVisibility(myViewerMap,&SUIT_ViewWindow::hide); + SetViewVisibility(getApp(),&SUIT_ViewWindow::hide); return true; } @@ -354,27 +405,29 @@ VisuGUI_Module //--------------------------------------------------------------- SUIT_ViewManager* -VisuGUI_Module -::onCreateViewManager() +VisuGUI_Module:: +onCreateViewManager() { - Viewer* aViewer = new Viewer( this, myViewerMap ); - return aViewer->getViewManager(); -} - + SalomeApp_Application* anApp = getApp(); + SUIT_ResourceMgr* aResourceMgr = anApp->resourceMgr(); + VVTK_ViewManager* aViewManager = new VVTK_ViewManager( anApp->activeStudy(), anApp->desktop() ); + VVTK_Viewer* aViewer = (VVTK_Viewer*)aViewManager->getViewModel(); + aViewer->setBackgroundColor( aResourceMgr->colorValue( "VTKViewer", "background", aViewer->backgroundColor() ) ); + aViewer->setTrihedronSize( aResourceMgr->integerValue( "VTKViewer", "trihedron_size", aViewer->trihedronSize() ), + aResourceMgr->booleanValue( "VTKViewer", "relative_size", aViewer->trihedronRelative() ) ); + new LightApp_VTKSelector( aViewer, anApp->selectionMgr() ); + anApp->addViewManager( aViewManager ); + + aViewManager->createViewWindow(); -//--------------------------------------------------------------- -void -VisuGUI_Module -::onLastViewClosed(SUIT_ViewManager* theViewManager) -{ - myViewerMap.erase(theViewManager); + return aViewer->getViewManager(); } //--------------------------------------------------------------- void -VisuGUI_Module -::createPreferences() +VisuGUI_Module:: +createPreferences() { VisuGUI::createPreferences(); @@ -389,15 +442,16 @@ VisuGUI_Module //--------------------------------------------------------------- void -VisuGUI_Module -::createGaussPointsPreferences() +VisuGUI_Module:: +createGaussPointsPreferences() { int gaussTab = addPreference( tr( "VISU_GAUSS_PREF_TAB_TTL" ) ); int primitiveGr = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_GROUP_TTL" ), gaussTab ); setPreferenceProperty( primitiveGr, "columns", 1 ); int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr, - LightApp_Preferences::Selector, "VISU", "point_sprite_primitive_type" ); + LightApp_Preferences::Selector, "VISU", + "point_sprite_primitive_type" ); QStringList values; values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) ); @@ -422,7 +476,8 @@ VisuGUI_Module LightApp_Preferences::File, "VISU", "point_sprite_alpha_texture" ); int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr, - LightApp_Preferences::DblSpin, "VISU", "point_sprite_alpha_threshold" ); + LightApp_Preferences::DblSpin, "VISU", + "point_sprite_alpha_threshold" ); setPreferenceProperty( alphaThresholdPref, "min", 0.0 ); setPreferenceProperty( alphaThresholdPref, "max", 1.0 ); setPreferenceProperty( alphaThresholdPref, "step", 0.1 ); @@ -451,7 +506,8 @@ VisuGUI_Module setPreferenceProperty( maxSizePref, "max", 100 ); int magnificationPref = addPreference( tr( "VISU_GAUSS_PREF_MAGNIFICATION" ), sizeGr, - LightApp_Preferences::IntSpin, "VISU", "point_sprite_magnification" ); + LightApp_Preferences::IntSpin, "VISU", + "point_sprite_magnification" ); setPreferenceProperty( magnificationPref, "min", 10 ); setPreferenceProperty( magnificationPref, "max", 1000 ); @@ -513,8 +569,8 @@ VisuGUI_Module //--------------------------------------------------------------- void -VisuGUI_Module -::createInsideCursorPreferences() +VisuGUI_Module:: +createInsideCursorPreferences() { int insideCursorTab = addPreference( tr( "VISU_GAUSS_INSIDE_CURSOR_PREF_TAB_TTL" ) ); @@ -522,7 +578,8 @@ VisuGUI_Module setPreferenceProperty( primitiveGr, "columns", 1 ); int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr, - LightApp_Preferences::Selector, "VISU", "inside_point_sprite_primitive_type" ); + LightApp_Preferences::Selector, "VISU", + "inside_point_sprite_primitive_type" ); QStringList values; values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) ); @@ -547,18 +604,21 @@ VisuGUI_Module LightApp_Preferences::File, "VISU", "inside_point_sprite_alpha_texture" ); int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr, - LightApp_Preferences::DblSpin, "VISU", "inside_point_sprite_alpha_threshold" ); + LightApp_Preferences::DblSpin, "VISU", + "inside_point_sprite_alpha_threshold" ); setPreferenceProperty( alphaThresholdPref, "min", 0.0 ); setPreferenceProperty( alphaThresholdPref, "max", 1.0 ); setPreferenceProperty( alphaThresholdPref, "step", 0.1 ); int resolutionPref = addPreference( tr( "VISU_GAUSS_PREF_RESOLUTION" ), primitiveGr, - LightApp_Preferences::IntSpin, "VISU", "inside_geom_sphere_resolution" ); + LightApp_Preferences::IntSpin, "VISU", + "inside_geom_sphere_resolution" ); setPreferenceProperty( resolutionPref, "min", 3 ); setPreferenceProperty( resolutionPref, "max", 100 ); int faceLimitPref = addPreference( tr( "VISU_GAUSS_PREF_FACE_LIMIT" ), primitiveGr, - LightApp_Preferences::IntSpin, "VISU", "inside_geom_sphere_face_limit" ); + LightApp_Preferences::IntSpin, "VISU", + "inside_geom_sphere_face_limit" ); setPreferenceProperty( faceLimitPref, "min", 10 ); setPreferenceProperty( faceLimitPref, "max", 1000000 ); @@ -566,12 +626,14 @@ VisuGUI_Module setPreferenceProperty( sizeGr, "columns", 2 ); int minSizePref = addPreference( tr( "VISU_GAUSS_PREF_MIN_SIZE" ), sizeGr, - LightApp_Preferences::IntSpin, "VISU", "inside_point_sprite_min_size" ); + LightApp_Preferences::IntSpin, "VISU", + "inside_point_sprite_min_size" ); setPreferenceProperty( minSizePref, "min", 1 ); setPreferenceProperty( minSizePref, "max", 100 ); int maxSizePref = addPreference( tr( "VISU_GAUSS_PREF_MAX_SIZE" ), sizeGr, - LightApp_Preferences::IntSpin, "VISU", "inside_point_sprite_max_size" ); + LightApp_Preferences::IntSpin, "VISU", + "inside_point_sprite_max_size" ); setPreferenceProperty( maxSizePref, "min", 1 ); setPreferenceProperty( maxSizePref, "max", 100 ); @@ -579,23 +641,24 @@ VisuGUI_Module setPreferenceProperty( magnificationGr, "columns", 2 ); int magnificationPref = addPreference( tr( "VISU_GAUSS_PREF_MAGNIFICATION" ), magnificationGr, - LightApp_Preferences::IntSpin, "VISU", "inside_point_sprite_magnification" ); + LightApp_Preferences::IntSpin, "VISU", + "inside_point_sprite_magnification" ); setPreferenceProperty( magnificationPref, "min", 10 ); setPreferenceProperty( magnificationPref, "max", 1000 ); int incrementPref = addPreference( tr( "VISU_GAUSS_PREF_INCREMENT" ), magnificationGr, - LightApp_Preferences::DblSpin, "VISU", "inside_point_sprite_increment" ); + LightApp_Preferences::DblSpin, "VISU", + "inside_point_sprite_increment" ); setPreferenceProperty( incrementPref, "min", 0.01 ); setPreferenceProperty( incrementPref, "max", 10 ); setPreferenceProperty( incrementPref, "step", 0.1 ); - } //--------------------------------------------------------------- void -VisuGUI_Module -::createOutsideCursorPreferences() +VisuGUI_Module:: +createOutsideCursorPreferences() { int outsideCursorTab = addPreference( tr( "VISU_GAUSS_OUTSIDE_CURSOR_PREF_TAB_TTL" ) ); @@ -603,7 +666,8 @@ VisuGUI_Module setPreferenceProperty( primitiveGr, "columns", 1 ); int primitiveTypePref = addPreference( tr( "VISU_GAUSS_PREF_PRIMITIVE_TYPE" ), primitiveGr, - LightApp_Preferences::Selector, "VISU", "outside_point_sprite_primitive_type" ); + LightApp_Preferences::Selector, "VISU", + "outside_point_sprite_primitive_type" ); QStringList values; values.append( tr( "VISU_GAUSS_PREF_POINTSPRITE" ) ); @@ -628,18 +692,21 @@ VisuGUI_Module LightApp_Preferences::File, "VISU", "outside_point_sprite_alpha_texture" ); int alphaThresholdPref = addPreference( tr( "VISU_GAUSS_PREF_ALPHA_THRESHOLD" ), primitiveGr, - LightApp_Preferences::DblSpin, "VISU", "outside_point_sprite_alpha_threshold" ); + LightApp_Preferences::DblSpin, "VISU", + "outside_point_sprite_alpha_threshold" ); setPreferenceProperty( alphaThresholdPref, "min", 0.0 ); setPreferenceProperty( alphaThresholdPref, "max", 1.0 ); setPreferenceProperty( alphaThresholdPref, "step", 0.1 ); int resolutionPref = addPreference( tr( "VISU_GAUSS_PREF_RESOLUTION" ), primitiveGr, - LightApp_Preferences::IntSpin, "VISU", "outside_geom_sphere_resolution" ); + LightApp_Preferences::IntSpin, "VISU", + "outside_geom_sphere_resolution" ); setPreferenceProperty( resolutionPref, "min", 3 ); setPreferenceProperty( resolutionPref, "max", 100 ); int faceLimitPref = addPreference( tr( "VISU_GAUSS_PREF_FACE_LIMIT" ), primitiveGr, - LightApp_Preferences::IntSpin, "VISU", "outside_geom_sphere_face_limit" ); + LightApp_Preferences::IntSpin, "VISU", + "outside_geom_sphere_face_limit" ); setPreferenceProperty( faceLimitPref, "min", 10 ); setPreferenceProperty( faceLimitPref, "max", 1000000 ); @@ -663,8 +730,8 @@ VisuGUI_Module //--------------------------------------------------------------- void -VisuGUI_Module -::createPickingPreferences() +VisuGUI_Module:: +createPickingPreferences() { int pickingTab = addPreference( tr( "VISU_PICKING_PREF_TAB_TTL" ) ); @@ -673,7 +740,7 @@ VisuGUI_Module setPreferenceProperty( cursorGr, "columns", 1 ); int cursorSizePref = addPreference( tr( "VISU_PICKING_PREF_CURSOR_SIZE" ), cursorGr, - LightApp_Preferences::DblSpin, "VISU", "picking_cursor_size" ); + LightApp_Preferences::DblSpin, "VISU", "picking_cursor_size" ); setPreferenceProperty( cursorSizePref, "min", 0 ); setPreferenceProperty( cursorSizePref, "max", 1.0 ); setPreferenceProperty( cursorSizePref, "step", 0.1 ); @@ -683,14 +750,15 @@ VisuGUI_Module setPreferenceProperty( pyramidHeightPref, "min", 1 ); setPreferenceProperty( pyramidHeightPref, "max", 100 ); - int selectionColorPref = addPreference( tr( "VISU_PICKING_PREF_SELECTION_COLOR" ), cursorGr, - LightApp_Preferences::Color, "VISU", "picking_selection_color" ); + /*int selectionColorPref = */ + addPreference( tr( "VISU_PICKING_PREF_SELECTION_COLOR" ), cursorGr, + LightApp_Preferences::Color, "VISU", "picking_selection_color" ); // Tolerance int toleranceGr = addPreference( tr( "VISU_PICKING_PREF_TOLERANCE_GROUP_TTL" ), pickingTab ); int pointTolerancePref = addPreference( tr( "VISU_PICKING_PREF_POINT_SELECTION_TOLERANCE" ), toleranceGr, - LightApp_Preferences::DblSpin, "VISU", "picking_point_tolerance" ); + LightApp_Preferences::DblSpin, "VISU", "picking_point_tolerance" ); setPreferenceProperty( pointTolerancePref, "min", 0.001 ); setPreferenceProperty( pointTolerancePref, "max", 10 ); setPreferenceProperty( pointTolerancePref, "step", 0.01 ); @@ -742,13 +810,14 @@ VisuGUI_Module //--------------------------------------------------------------- void -VisuGUI_Module -::createSpaceMousePreferences() +VisuGUI_Module:: +createSpaceMousePreferences() { int mouseTab = addPreference( tr( "VISU_MOUSE_PREF_TAB_TLT" ) ); int mouseGr = addPreference( tr( "VISU_MOUSE_PREF_GROUP_TLT" ), mouseTab ); - int mousePref = addPreference( tr( "VISU_MOUSE_PREF" ), mouseGr, LightApp_Preferences::Selector, "VISU", "mouse_behaviour" ); + int mousePref = addPreference( tr( "VISU_MOUSE_PREF" ), mouseGr, + LightApp_Preferences::Selector, "VISU", "mouse_behaviour" ); QStringList values; values.append( tr( "VISU_MOUSE_PREF_STANDARD" ) ); values.append( tr( "VISU_MOUSE_PREF_KEYBOARD_FREE" ) ); @@ -759,16 +828,27 @@ VisuGUI_Module setPreferenceProperty( mousePref, "indexes", indices ); int keybrdGr = addPreference( tr( "VISU_KEYBOARD_PREF_GROUP_TTL" ), mouseTab ); - int keybrdPref = addPreference( tr( "VISU_KEYBOARD_PREF" ), keybrdGr, LightApp_Preferences::IntSpin, "VISU", "speed_increment" ); + int keybrdPref = addPreference( tr( "VISU_KEYBOARD_PREF" ), keybrdGr, + LightApp_Preferences::IntSpin, "VISU", "speed_increment" ); setPreferenceProperty( keybrdPref, "max", 1000 ); int spacemouseGr = addPreference( tr( "VISU_SPACEMOUSE_PREF" ), mouseTab ); setPreferenceProperty( spacemouseGr, "columns", 1 ); - int spacemousePref1 = addPreference( tr( "VISU_SPACEMOUSE_PREF_1" ), spacemouseGr, LightApp_Preferences::Selector, "VISU", "spacemouse_func1_btn" ); //decrease_speed_increment - int spacemousePref2 = addPreference( tr( "VISU_SPACEMOUSE_PREF_2" ), spacemouseGr, LightApp_Preferences::Selector, "VISU", "spacemouse_func2_btn" ); //increase_speed_increment - int spacemousePref3 = addPreference( tr( "VISU_SPACEMOUSE_PREF_3" ), spacemouseGr, LightApp_Preferences::Selector, "VISU", "spacemouse_func3_btn" ); //decrease_gauss_point_magnification - int spacemousePref4 = addPreference( tr( "VISU_SPACEMOUSE_PREF_4" ), spacemouseGr, LightApp_Preferences::Selector, "VISU", "spacemouse_func4_btn" ); //increase_gauss_point_magnification - int spacemousePref5 = addPreference( tr( "VISU_SPACEMOUSE_PREF_5" ), spacemouseGr, LightApp_Preferences::Selector, "VISU", "spacemouse_func5_btn" ); //dominant_combined_switch + int spacemousePref1 = addPreference( tr( "VISU_SPACEMOUSE_PREF_1" ), spacemouseGr, + LightApp_Preferences::Selector, "VISU", + "spacemouse_func1_btn" ); //decrease_speed_increment + int spacemousePref2 = addPreference( tr( "VISU_SPACEMOUSE_PREF_2" ), spacemouseGr, + LightApp_Preferences::Selector, "VISU", + "spacemouse_func2_btn" ); //increase_speed_increment + int spacemousePref3 = addPreference( tr( "VISU_SPACEMOUSE_PREF_3" ), spacemouseGr, + LightApp_Preferences::Selector, "VISU", + "spacemouse_func3_btn" ); //decrease_gauss_point_magnification + int spacemousePref4 = addPreference( tr( "VISU_SPACEMOUSE_PREF_4" ), spacemouseGr, + LightApp_Preferences::Selector, "VISU", + "spacemouse_func4_btn" ); //increase_gauss_point_magnification + int spacemousePref5 = addPreference( tr( "VISU_SPACEMOUSE_PREF_5" ), spacemouseGr, + LightApp_Preferences::Selector, "VISU", + "spacemouse_func5_btn" ); //dominant_combined_switch values.clear(); values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_1" ) ); values.append( tr( "VISU_SPACEMOUSE_PREF_BTN_2" ) ); @@ -808,8 +888,8 @@ VisuGUI_Module //--------------------------------------------------------------- void -VisuGUI_Module -::createRecorderPreferences() +VisuGUI_Module:: +createRecorderPreferences() { int recorderTab = addPreference( tr( "VISU_RECORDER_PREF_TAB_TTL" ) ); @@ -844,27 +924,28 @@ VisuGUI_Module //--------------------------------------------------------------- void -VisuGUI_Module -::OnCreateGaussPoints() +VisuGUI_Module:: +OnCreateGaussPoints() { double initialTime = vtkTimerLog::GetCPUTime(); - CreatePrs3d(this,true); + CreatePrs3d(this); INFOS( "VisuGUI_Module::OnCreateGaussPoints() : Gauss Points created in " << vtkTimerLog::GetCPUTime() - initialTime << " seconds" ); } void -VisuGUI_Module -::OnViewManagerAdded(SUIT_ViewManager* viewMgr) +VisuGUI_Module:: +OnViewManagerAdded(SUIT_ViewManager* viewMgr) { QString type = viewMgr->getViewModel()->getType(); if ( type == VVTK_Viewer::Type() ) - connect( viewMgr, SIGNAL( viewCreated( SUIT_ViewWindow* ) ), this, SLOT( OnViewCreated( SUIT_ViewWindow* ) ) ); + connect( viewMgr, SIGNAL( viewCreated( SUIT_ViewWindow* ) ), + this, SLOT( OnViewCreated( SUIT_ViewWindow* ) ) ); } void -VisuGUI_Module -::OnViewCreated(SUIT_ViewWindow* view) +VisuGUI_Module:: +OnViewCreated(SUIT_ViewWindow* view) { SVTK_ViewWindow* viewWindow = dynamic_cast( view ); if ( viewWindow ) { @@ -878,8 +959,8 @@ VisuGUI_Module } void -VisuGUI_Module -::setProperty( SVTK_ViewWindow* viewWindow, const QString& pref ) +VisuGUI_Module:: +setProperty( SVTK_ViewWindow* viewWindow, const QString& pref ) { if ( !viewWindow ) return; @@ -914,8 +995,8 @@ VisuGUI_Module } void -VisuGUI_Module -::setProperty( SVTK_ViewManager* vm, const QString& prop ) +VisuGUI_Module:: +setProperty( SVTK_ViewManager* vm, const QString& prop ) { if ( !vm ) return; @@ -926,8 +1007,8 @@ VisuGUI_Module } void -VisuGUI_Module -::preferencesChanged( const QString& group, const QString& pref ) +VisuGUI_Module:: +preferencesChanged( const QString& group, const QString& pref ) { VisuGUI::preferencesChanged(group,pref); @@ -945,14 +1026,14 @@ VisuGUI_Module //--------------------------------------------------------------- SUIT_ViewManager* -VisuGUI_Module -::getViewManager(const QString& theType, - const bool theIsCreate) +VisuGUI_Module:: +getViewManager(const QString& theType, + const bool theIsCreate) { - if(SUIT_ViewManager* aViewManager = VisuGUI::getViewManager(theType,theIsCreate)) + if (SUIT_ViewManager* aViewManager = VisuGUI::getViewManager(theType,theIsCreate)) return aViewManager; - if(theIsCreate && VVTK_Viewer::Type() == theType) + if (theIsCreate && theType == VVTK_Viewer::Type()) return onCreateViewManager(); return NULL; @@ -960,134 +1041,19 @@ VisuGUI_Module //--------------------------------------------------------------- void -VisuGUI_Module -::OnEditGaussPoints() +VisuGUI_Module:: +OnEditGaussPoints() { Handle(SALOME_InteractiveObject) anIO; - if(VISU::Prs3d_i* aPrs3d = GetPrsToModify(this,&anIO)){ - EditPrs3d(this, aPrs3d); - if(SVTK_ViewWindow* aViewWindow = GetViewWindow(this,true)){ - aViewWindow->highlight(anIO,1); + if (VISU::Prs3d_i* aPrs3d = GetPrsToModify(this, &anIO)) { + // Create VVTK_ViewWindow, if it does not exist + if (VVTK_ViewWindow* aViewWindow = GetViewWindow(this)) { + EditPrs3d(this, anIO, aPrs3d, aViewWindow); } } } -//--------------------------------------------------------------- -void -VisuGUI_Module -::OnDisplayPrs() -{ - if(MYDEBUG) MESSAGE("VisuGUI_Module::OnDisplayPrs"); - - QApplication::setOverrideCursor(Qt::waitCursor); - - if(LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this)){ - SALOME_ListIO aSel, aList; - aSelectionMgr->selectedObjects(aSel); - extractContainers(aSel, aList); - - for(SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next()){ - Handle(SALOME_InteractiveObject) anIO = it.Value(); - CORBA::Object_var anObject = GetSelectedObj( GetAppStudy(this), anIO->getEntry() ); - - // is it a Prs3d object ? - if(!CORBA::is_nil(anObject)){ - if(VISU::Prs3d_i* aPrs3d = dynamic_cast(VISU::GetServant(anObject).in())){ - if(MYDEBUG) MESSAGE("VisuGUI_Module::OnDisplayPrs : Prs3d object"); - if(aPrs3d->GetType() == VISU::TGAUSSPOINTS) - VISU::UpdateViewer(this,aPrs3d,false,true,true); - else if(SUIT_ViewManager* aViewManager = getApp()->activeViewManager()){ - QString aType = aViewManager->getType(); - if(aType == SVTK_Viewer::Type()) - VISU::UpdateViewer(this,aPrs3d,false,true,true); - else if(aType == VVTK_Viewer::Type()) - VISU::UpdateViewer(this,aPrs3d,false,true,true); - } - continue; - } - } - - // is it Curve ? - if(VISU::Curve_i* aCurve = dynamic_cast(VISU::GetServant(anObject).in())){ - if(MYDEBUG) MESSAGE("VisuGUI_Module::OnDisplayPrs : Curve object"); - PlotCurve( this, aCurve, VISU::eDisplay ); - continue; - } - - // is it Container ? - if(VISU::Container_i* aContainer = dynamic_cast(VISU::GetServant(anObject).in())){ - if(MYDEBUG) MESSAGE("VisuGUI_Module::DisplayPrs : Container object"); - PlotContainer( this, aContainer, VISU::eDisplay ); - continue; - } - - // is it Table ? - if(VISU::Table_i* aTable = dynamic_cast(VISU::GetServant(anObject).in())){ - if(MYDEBUG) MESSAGE("VisuGUI_Module::DisplayPrs : Table object"); - PlotTable( this, aTable, VISU::eDisplay ); - continue; - } - } - } - - QApplication::restoreOverrideCursor(); -} - - -//--------------------------------------------------------------- -void -VisuGUI_Module -::OnEraseAll() -{ - if(SUIT_ViewManager* aViewManager = getApp()->activeViewManager()){ - QString aType = aViewManager->getType(); - if(aType == SVTK_Viewer::Type()) - VISU::OnEraseAll(this); - else if(aType == VVTK_Viewer::Type()) - VISU::OnEraseAll(this); - else if(aType == SPlot2d_Viewer::Type()) - VISU::OnEraseAll(this); - } -} - - -//--------------------------------------------------------------- -void -VisuGUI_Module -::OnDisplayOnlyPrs() -{ - OnEraseAll(); - OnDisplayPrs(); -} - - -//--------------------------------------------------------------- -void -VisuGUI_Module -::OnErasePrs() -{ - QApplication::setOverrideCursor(Qt::waitCursor); - - LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this); - SALOME_ListIO aSel, aList; - aSelectionMgr->selectedObjects(aSel); - extractContainers(aSel, aList); - - for(SALOME_ListIteratorOfListIO it( aList ); it.More(); it.Next()){ - Handle(SALOME_InteractiveObject) anIO = it.Value(); - CORBA::Object_var anObject = GetSelectedObj(GetAppStudy(this),anIO->getEntry()); - if(!CORBA::is_nil(anObject)){ - VISU::Base_var aBase = VISU::Base::_narrow(anObject); - if(!CORBA::is_nil(aBase)) - VISU::ErasePrs(this,aBase,true); - } - } - - QApplication::restoreOverrideCursor(); -} - - //--------------------------------------------------------------- namespace { @@ -1096,40 +1062,40 @@ namespace const char* theSuffix, std::ostringstream& theStr) { - float aColor[3]; + vtkFloatingPointType aColor[3]; vtkRenderer* aRenderer = theViewWindow->getRenderer(); aRenderer->GetBackground(aColor); - Storable::DataToStream(theStr,std::string("myColor") + theSuffix + ".R",aColor[0]); - Storable::DataToStream(theStr,std::string("myColor") + theSuffix + ".G",aColor[1]); - Storable::DataToStream(theStr,std::string("myColor") + theSuffix + ".B",aColor[2]); + Storable::DataToStream(theStr,(std::string("myColor") + theSuffix + ".R").c_str(),aColor[0]); + Storable::DataToStream(theStr,(std::string("myColor") + theSuffix + ".G").c_str(),aColor[1]); + Storable::DataToStream(theStr,(std::string("myColor") + theSuffix + ".B").c_str(),aColor[2]); double aPosition[3]; vtkCamera* aCamera = aRenderer->GetActiveCamera(); aCamera->GetPosition(aPosition); - Storable::DataToStream(theStr,std::string("myPosition") + theSuffix + "[0]",aPosition[0]); - Storable::DataToStream(theStr,std::string("myPosition") + theSuffix + "[1]",aPosition[1]); - Storable::DataToStream(theStr,std::string("myPosition") + theSuffix + "[2]",aPosition[2]); + Storable::DataToStream(theStr,(std::string("myPosition") + theSuffix + "[0]").c_str(),aPosition[0]); + Storable::DataToStream(theStr,(std::string("myPosition") + theSuffix + "[1]").c_str(),aPosition[1]); + Storable::DataToStream(theStr,(std::string("myPosition") + theSuffix + "[2]").c_str(),aPosition[2]); double aFocalPnt[3]; aCamera->GetFocalPoint(aFocalPnt); - Storable::DataToStream(theStr,std::string("myFocalPnt") + theSuffix + "[0]",aFocalPnt[0]); - Storable::DataToStream(theStr,std::string("myFocalPnt") + theSuffix + "[1]",aFocalPnt[1]); - Storable::DataToStream(theStr,std::string("myFocalPnt") + theSuffix + "[2]",aFocalPnt[2]); + Storable::DataToStream(theStr,(std::string("myFocalPnt") + theSuffix + "[0]").c_str(),aFocalPnt[0]); + Storable::DataToStream(theStr,(std::string("myFocalPnt") + theSuffix + "[1]").c_str(),aFocalPnt[1]); + Storable::DataToStream(theStr,(std::string("myFocalPnt") + theSuffix + "[2]").c_str(),aFocalPnt[2]); double aViewUp[3]; aCamera->GetViewUp(aViewUp); - Storable::DataToStream(theStr,std::string("myViewUp") + theSuffix + "[0]",aViewUp[0]); - Storable::DataToStream(theStr,std::string("myViewUp") + theSuffix + "[1]",aViewUp[1]); - Storable::DataToStream(theStr,std::string("myViewUp") + theSuffix + "[2]",aViewUp[2]); + Storable::DataToStream(theStr,(std::string("myViewUp") + theSuffix + "[0]").c_str(),aViewUp[0]); + Storable::DataToStream(theStr,(std::string("myViewUp") + theSuffix + "[1]").c_str(),aViewUp[1]); + Storable::DataToStream(theStr,(std::string("myViewUp") + theSuffix + "[2]").c_str(),aViewUp[2]); - float aParallelScale = aCamera->GetParallelScale(); - Storable::DataToStream(theStr,std::string("myParallelScale") + theSuffix,aParallelScale); + vtkFloatingPointType aParallelScale = aCamera->GetParallelScale(); + Storable::DataToStream(theStr,(std::string("myParallelScale") + theSuffix).c_str(),aParallelScale); double aScaleFactor[3]; theViewWindow->GetScale(aScaleFactor); - Storable::DataToStream(theStr,std::string("myScaleFactor") + theSuffix + "[0]",aScaleFactor[0]); - Storable::DataToStream(theStr,std::string("myScaleFactor") + theSuffix + "[1]",aScaleFactor[1]); - Storable::DataToStream(theStr,std::string("myScaleFactor") + theSuffix + "[2]",aScaleFactor[2]); + Storable::DataToStream(theStr,(std::string("myScaleFactor") + theSuffix + "[0]").c_str(),aScaleFactor[0]); + Storable::DataToStream(theStr,(std::string("myScaleFactor") + theSuffix + "[1]").c_str(),aScaleFactor[1]); + Storable::DataToStream(theStr,(std::string("myScaleFactor") + theSuffix + "[2]").c_str(),aScaleFactor[2]); } //--------------------------------------------------------------- @@ -1138,7 +1104,7 @@ namespace const char* theSuffix, const Storable::TRestoringMap& theMap) { - float aColor[3]; + vtkFloatingPointType aColor[3]; aColor[0] = Storable::FindValue(theMap,std::string("myColor") + theSuffix + ".R").toDouble(); aColor[1] = Storable::FindValue(theMap,std::string("myColor") + theSuffix + ".G").toDouble(); aColor[2] = Storable::FindValue(theMap,std::string("myColor") + theSuffix + ".B").toDouble(); @@ -1164,7 +1130,7 @@ namespace aViewUp[2] = Storable::FindValue(theMap,std::string("myViewUp") + theSuffix + "[2]").toDouble(); aCamera->SetViewUp(aViewUp); - float aParallelScale = Storable::FindValue(theMap,std::string("myParallelScale") + theSuffix).toDouble(); + vtkFloatingPointType aParallelScale = Storable::FindValue(theMap,std::string("myParallelScale") + theSuffix).toDouble(); aCamera->SetParallelScale(aParallelScale); double aScaleFactor[3]; @@ -1186,37 +1152,37 @@ namespace std::string aSegmentationMode; if(aWidgetCtrl->IsPlanesActive()){ VISU_PlanesWidget *aPlanesWidget = aWidgetCtrl->GetPlanesWidget(); - float anOrigin[3]; + vtkFloatingPointType anOrigin[3]; aPlanesWidget->GetOrigin(anOrigin); Storable::DataToStream(theStr,"myCursorOrigin[0]",anOrigin[0]); Storable::DataToStream(theStr,"myCursorOrigin[1]",anOrigin[1]); Storable::DataToStream(theStr,"myCursorOrigin[2]",anOrigin[2]); - float aNormal[3]; + vtkFloatingPointType aNormal[3]; aPlanesWidget->GetNormal(aNormal); Storable::DataToStream(theStr,"myCursorNormal[0]",aNormal[0]); Storable::DataToStream(theStr,"myCursorNormal[1]",aNormal[1]); Storable::DataToStream(theStr,"myCursorNormal[2]",aNormal[2]); - float aDepth = aPlanesWidget->Distance(); + vtkFloatingPointType aDepth = aPlanesWidget->Distance(); Storable::DataToStream(theStr,"myCursorDepth",aDepth); aSegmentationMode = "Planes"; }else if(aWidgetCtrl->IsSphereActive()){ VISU_SphereWidget *aSphereWidget = aWidgetCtrl->GetSphereWidget(); - float aCenter[3]; + vtkFloatingPointType aCenter[3]; aSphereWidget->GetCenter(aCenter); Storable::DataToStream(theStr,"mySphereCursorCenter[0]",aCenter[0]); Storable::DataToStream(theStr,"mySphereCursorCenter[1]",aCenter[1]); Storable::DataToStream(theStr,"mySphereCursorCenter[2]",aCenter[2]); - float aRadius = aSphereWidget->GetRadius(); + vtkFloatingPointType aRadius = aSphereWidget->GetRadius(); Storable::DataToStream(theStr,"mySphereCursorRaduis",aRadius); aSegmentationMode = "Sphere"; } - Storable::DataToStream(theStr,"mySegmentationMode",aSegmentationMode); + Storable::DataToStream(theStr,"mySegmentationMode",aSegmentationMode.c_str()); } } @@ -1375,7 +1341,7 @@ namespace PortableServer::ServantBase_var aServant = VISU::GetServant(anObject); if(VISU::Prs3d_i* aPrs3d = dynamic_cast(aServant.in())){ // To set visiblity - VISU::UpdateViewer(theModule,aPrs3d,anIsFirst,false,false); + VISU::UpdateViewer(theModule, aPrs3d, /*disp_only = */anIsFirst, /*highlight = */false); anIsFirst = false; // To update selection @@ -1578,31 +1544,31 @@ OnRestoreConfiguration() if(aSegmentationMode == "Planes"){ VISU_PlanesWidget *aPlanesWidget = aWidgetCtrl->GetPlanesWidget(); - float anOrigin[3]; + vtkFloatingPointType anOrigin[3]; anOrigin[0] = Storable::FindValue(aMap,"myCursorOrigin[0]").toDouble(); anOrigin[1] = Storable::FindValue(aMap,"myCursorOrigin[1]").toDouble(); anOrigin[2] = Storable::FindValue(aMap,"myCursorOrigin[2]").toDouble(); aPlanesWidget->SetOrigin(anOrigin); - float aNormal[3]; + vtkFloatingPointType aNormal[3]; aNormal[0] = Storable::FindValue(aMap,"myCursorNormal[0]").toDouble(); aNormal[1] = Storable::FindValue(aMap,"myCursorNormal[1]").toDouble(); aNormal[2] = Storable::FindValue(aMap,"myCursorNormal[2]").toDouble(); aPlanesWidget->SetNormal(aNormal); - float aDepth = Storable::FindValue(aMap,"myCursorDepth").toDouble(); + vtkFloatingPointType aDepth = Storable::FindValue(aMap,"myCursorDepth").toDouble(); aPlanesWidget->SetDistance(aDepth); aMainWindow->SetPlanesSegementation(true); }else if(aSegmentationMode == "Sphere"){ VISU_SphereWidget *aSphereWidget = aWidgetCtrl->GetSphereWidget(); - float aCenter[3]; + vtkFloatingPointType aCenter[3]; aCenter[0] = Storable::FindValue(aMap,"mySphereCursorCenter[0]").toDouble(); aCenter[1] = Storable::FindValue(aMap,"mySphereCursorCenter[1]").toDouble(); aCenter[2] = Storable::FindValue(aMap,"mySphereCursorCenter[2]").toDouble(); aSphereWidget->SetCenter(aCenter); - float aRadius = Storable::FindValue(aMap,"mySphereCursorRaduis").toDouble(); + vtkFloatingPointType aRadius = Storable::FindValue(aMap,"mySphereCursorRaduis").toDouble(); aSphereWidget->SetRadius(aRadius); aMainWindow->SetSphereSegementation(true); @@ -1661,3 +1627,447 @@ eventFilter( QObject * theWatched, QEvent * theEvent ) } return aRet; } + + +const char gSeparator = '_'; // character used to separate parameter names +const char gDigitsSep = ':'; // character used to separate numeric parameter values (color = r:g:b) +/*! + * \brief Virtual public + * + * This method is called just before the study document is saved, so the module has a possibility + * to store visual parameters in AttributeParameter attribue(s) + */ +void VisuGUI_Module::storeVisualParameters(int savePoint) +{ + SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if( !study || !study->studyDS() ) + return; + _PTR(Study) studyDS = study->studyDS(); + _PTR(AttributeParameter) ap = studyDS->GetModuleParameters("Interface Applicative", moduleName().latin1(), savePoint); + _PTR(IParameters) ip = ClientFactory::getIParameters(ap); + + // viewers counters are used for storing view_numbers in IParameters + int svtkViewers( 0 ), vvtkViewers( 0 ), plotViewers( 0 ); + + // componentName is used for encoding of entries when storing them in IParameters + _PTR(SComponent) visuEng = ClientFindOrCreateVisuComponent( studyDS ); + std::string componentName = visuEng->ComponentDataType(); + + QPtrList lst; + + // saving VVTK viewer parameters. VVTK (Gauss Viewers) are NOT created by SalomeApp since + // VVTK is declared in VISU, so here we store VVTK view window parameters. + // VisuGUI_Module::restoreVisualParameters() creates VVTK_Views and restores its parameters. + ip->setProperty( "ActiveGaussViewer", "-1" ); + getApp()->viewManagers( VVTK_Viewer::Type(), lst ); + for ( QPtrListIterator it( lst ); it.current(); ++it ) { + SUIT_ViewManager* vman = it.current(); + if ( SUIT_ViewWindow* vwin = vman->getActiveView() ) { + // using predefined string "GaussViewer" as "entry".. it's a hardcoded "workaround". + // gauss viewer parameters are retrieved using this "entry" string. + // name of parameter = caption of gauss ViewWindow + // value of parameter = ViewWindow's visual parameters + ip->setParameter( "GaussViewer", vwin->caption().latin1(), vwin->getVisualParameters().latin1() ); + + if ( application()->desktop()->activeWindow() == vwin ) + ip->setProperty( "ActiveGaussViewer", QString::number( vvtkViewers ).latin1() ); + vvtkViewers++; + } + } + + // VISU module opens one SVTK viewer in activateModule(). This causes a bug in save-restore visual + // parameters: it no SVTK view was saved, we need NOT any SVTK on restore. Here we store if any is open.. + /* + lst.clear(); + getApp()->viewManagers( SVTK_Viewer::Type(), lst ); + ip->setProperty( "VtkViewersCount", QString::number( lst.count() ).latin1() ); + */ + + // main cycle to store parameters of displayed objects + lst.clear(); + getApp()->viewManagers( lst ); + vvtkViewers = svtkViewers = plotViewers = 0; + for ( QPtrListIterator it( lst ); it.current(); ++it ) { + SUIT_ViewManager* vman = it.current(); + QString vType = vman->getType(); + int* viewsCounter = vType == SVTK_Viewer::Type() ? &svtkViewers : + vType == VVTK_Viewer::Type() ? &vvtkViewers : + vType == SPlot2d_Viewer::Type() ? &plotViewers : 0; + + // saving VTK actors' properties + if ( vType == SVTK_Viewer::Type() || // processing SVTK and VVTK viewers in the same + vType == VVTK_Viewer::Type() ) { // way (VVTK_ViewWindow inherits SVTK_ViewWindow) + + QPtrVector views = vman->getViews(); + for ( int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++ ) { + if ( SVTK_ViewWindow* vtkView = dynamic_cast( views[i] ) ) { + vtkActorCollection* allActors = vtkView->getRenderer()->GetActors(); + allActors->InitTraversal(); + while ( vtkActor* actor = allActors->GetNextActor() ) { + if ( actor->GetVisibility() ) { // store only visible actors + if ( VISU_Actor* vActor = VISU_Actor::SafeDownCast( actor ) ) { + if ( vActor->hasIO() ) { // actor corresponds to existing obj + + Handle(SALOME_InteractiveObject) io = vActor->getIO(); + // entry is "ecoded" = it does NOT contain component adress, since it is a + // subject to change on next component loading + std::string entry = ip->encodeEntry( io->getEntry(), componentName ); + + std::string param, vtkParam = vType.latin1(); vtkParam += gSeparator; + vtkParam += QString::number( *viewsCounter ).latin1(); vtkParam += gSeparator; + + param = vtkParam + "Visibility"; + ip->setParameter( entry, param, "On" ); + param = vtkParam + "Name"; + ip->setParameter( entry, param, vActor->getName() ); + param = vtkParam + "RepresentationMode"; + ip->setParameter( entry, param, QString::number( vActor->GetRepresentation() ).latin1() ); + param = vtkParam + "Opacity"; + ip->setParameter( entry, param, QString::number( vActor->GetOpacity() ).latin1() ); + vtkFloatingPointType r, g, b; + vActor->GetColor(r, g, b); + QString colorStr = QString::number( r ); colorStr += gDigitsSep; + colorStr += QString::number( g ); colorStr += gDigitsSep; + colorStr += QString::number( b ); + param = vtkParam + "Color"; + ip->setParameter( entry, param, colorStr.latin1() ); + param = vtkParam + "LineWidth"; + ip->setParameter( entry, param, QString::number( vActor->GetLineWidth() ).latin1() ); + if ( vActor->IsShrunkable() && vActor->IsShrunk() ) { + param = vtkParam + "ShrinkMode"; + ip->setParameter( entry, param, "On" ); + param = vtkParam + "ShrinkFactor"; + ip->setParameter( entry, param, QString::number( vActor->GetShrinkFactor() ).latin1() ); + } + VISU_ScalarMapAct* scalarMapActor = dynamic_cast( vActor ); + if ( scalarMapActor && scalarMapActor->IsShading() ) { + param = vtkParam + "Shading"; + ip->setParameter( entry, param, "On" ); + } + if ( const VISU::Prs3d_i* vPrs = vActor->GetPrs3d() ) { + param = vtkParam + "ClippingPlane"; + int nPlanes = vPrs->GetNumberOfClippingPlanes(); + if ( !nPlanes ) + ip->setParameter( entry, param, "Off" ); + for ( int p = 0; p < nPlanes; p++ ) { + vtkPlane* plane = vPrs->GetClippingPlane( p ); + vtkFloatingPointType normal[3], origin[3]; + plane->GetNormal( normal ); + plane->GetOrigin( origin ); + std::string planeValue = QString::number( normal[0] ).latin1(); planeValue += gDigitsSep; + planeValue += QString::number( normal[1] ).latin1(); planeValue += gDigitsSep; + planeValue += QString::number( normal[2] ).latin1(); planeValue += gDigitsSep; + planeValue += QString::number( origin[0] ).latin1(); planeValue += gDigitsSep; + planeValue += QString::number( origin[1] ).latin1(); planeValue += gDigitsSep; + planeValue += QString::number( origin[2] ).latin1(); + param = QString( "%1ClippingPlane_%2" ).arg( vtkParam.c_str() ).arg( p+1 ).latin1(); + ip->setParameter( entry, param, planeValue ); + } + } + + } // hasIO + } // salome_actor successfull downcast + } // isVisible + } // end of ..while.. actors traversal + } // if ( vtkView ) + } // for ( views ) + (*viewsCounter)++; + } // if ( SVTK view model ) + else if ( vType == SPlot2d_Viewer::Type() ) { // processing Plot2d viewers + QPtrVector views = vman->getViews(); + for ( int i = 0, iEnd = vman->getViewsCount(); i < iEnd; i++ ) { + if ( Plot2d_ViewWindow* plotView = dynamic_cast( views[i] ) ) { + Plot2d_ViewFrame* plotVF = plotView->getViewFrame(); + QPtrList curves; + plotVF->getCurves( curves ); + + Plot2d_Curve* curve; + for ( curve = curves.first(); curve; curve = curves.next() ) { + if ( SPlot2d_Curve* sCurve = dynamic_cast( curve ) ) { + if ( sCurve->hasIO() ) { + + Handle(SALOME_InteractiveObject) io = sCurve->getIO(); + // entry is "ecoded" = it does NOT contain component adress, since it is a + // subject to change on next component loading + std::string entry = ip->encodeEntry( io->getEntry(), componentName ); + + std::string param, plotParam = vType.latin1(); plotParam += gSeparator; + plotParam += QString::number( *viewsCounter ).latin1(); plotParam += gSeparator; + + param = plotParam + "Visibility"; + ip->setParameter( entry, param, "On" ); + } + } + } // for curves + } // if ( plotView ) + } // for ( views ) + (*viewsCounter)++; + } // if ( SPlot2d view model ) + } +} + +// returns VISU_Actor with IO with given entry +VISU_Actor* getActor( const QString& entry, SVTK_ViewWindow* vtkView ) +{ + if ( vtkView && !entry.isEmpty() ) { + vtkActorCollection* allActors = vtkView->getRenderer()->GetActors(); + allActors->InitTraversal(); + while ( vtkActor* actor = allActors->GetNextActor() ) { + if ( VISU_Actor* vActor = VISU_Actor::SafeDownCast( actor ) ) { + if ( vActor->hasIO() ) { // actor corresponds to existing obj + Handle(SALOME_InteractiveObject) io = vActor->getIO(); + if ( entry == io->getEntry() ) + return vActor; + } + } + } + } + return 0; +} + +const int ViewerType = 0; +const int ViewIndex = 1; +const int ParamName = 2; +// visual parameters are stored in strings as follows: +// ViewerType_ViewNumber_ParamName. '_' is used as separator and should not be used in +// viewer type or parameter names + +// return viewer type substring from parameter name +std::string getParam( const std::string& paramName, const int index ) +{ + QStringList lst = QStringList::split( gSeparator, QString( paramName.c_str() ) ); + if ( !lst.isEmpty() && index < lst.size() ) + return lst[index].latin1(); + return ""; +} + + +/*! + * \brief Virtual public + * + * This method is called after the study document is opened, so the module has a possibility to restore + * visual parameters + */ +void VisuGUI_Module::restoreVisualParameters(int savePoint) +{ + SalomeApp_Study* study = dynamic_cast( SUIT_Session::session()->activeApplication()->activeStudy() ); + if( !study || !study->studyDS() ) + return; + _PTR(Study) studyDS = study->studyDS(); + _PTR(AttributeParameter) ap = studyDS->GetModuleParameters("Interface Applicative", moduleName().latin1(), savePoint); + _PTR(IParameters) ip = ClientFactory::getIParameters(ap); + + // actors are stored in a map after displaying of them for quicker access in future + QMap > vtkActors; // map: entry to map: ViewType_ to actor (SVTK/VVTK) + + std::vector entries = ip->getEntries(); + + for ( std::vector::iterator entIt = entries.begin(); entIt != entries.end(); ++entIt ) { + + std::vector paramNames = ip->getAllParameterNames( *entIt ); + std::vector paramValues = ip->getAllParameterValues( *entIt ); + std::vector::iterator namesIt = paramNames.begin(); + std::vector::iterator valuesIt = paramValues.begin(); + + if ( *entIt == "GaussViewer" ) { + // parameter names are view window's captions, values - visual parameters. + for ( ; namesIt != paramNames.end(); ++namesIt, ++valuesIt ) { + SUIT_ViewManager* vman = onCreateViewManager(); + SUIT_ViewWindow* vwin = vman->getActiveView(); + vwin->setCaption( (*namesIt).c_str() ); + + // wait untill the window is really shown. This step fixes MANY bugs.. + while ( !vwin->isVisible() ) + qApp->processEvents(); + + vwin->setVisualParameters( (*valuesIt).c_str() ); + } + continue; // skip to next entry + } + + // entry is a normal entry - it should be "decoded" (setting base adress of component) + QString entry( ip->decodeEntry( *entIt ).c_str() ); + + //SRN: Added a check that the entry corresponds to Standard_Real object in the Study + // as the object may be deleted or modified after the visual state is saved. + _PTR(SObject) so = studyDS->FindObjectID(entry.latin1()); + if(!so) continue; //Skip the not existent entry + + for ( ; namesIt != paramNames.end(); ++namesIt, ++valuesIt ) { + std::string viewerType = ::getParam( *namesIt, ViewerType ); + + std::string paramName = ::getParam( *namesIt, ParamName ); + bool ok; + std::string viewIndexStr = ::getParam( *namesIt, ViewIndex ); + int viewIndex = QString( viewIndexStr.c_str() ).toUInt( &ok ); + if ( !ok ) // bad conversion of view index to integer + continue; + + // cout << " -- " << viewerType << ": entry = " << entry.latin1() << ", paramName = " << paramName << endl; + + if ( viewerType == SVTK_Viewer::Type().latin1() || + viewerType == VVTK_Viewer::Type().latin1() ) { + + // used as inner map key for locating the actor. + QString viewerTypeIndex = QString( viewerType.c_str() ) + QString::number( viewIndex ); + + if ( paramName == "Visibility" && displayer() ) { + // if VVTK, then we must create viewer first, because + + QPtrList lst; + getApp()->viewManagers( viewerType.c_str(), lst ); + + // SVTK/VVTK ViewManager always has 1 ViewWindow, so view index is index of view manager + if ( viewIndex >= 0 && viewIndex < lst.count() ) { + SUIT_ViewManager* vman = lst.at( viewIndex ); + SUIT_ViewModel* vmodel = vman->getViewModel(); + // both SVTK and VVTK view models can be casted to SALOME_View + displayer()->Display( entry, true, dynamic_cast( vmodel ) ); + + // store displayed actor in a temporary map for quicker access later when restoring other parameters + SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) vman->getActiveView(); + QMap viewActorMap; + if ( vtkActors.contains( entry ) ) + viewActorMap = vtkActors[ entry ]; + viewActorMap[ viewerTypeIndex ] = getActor( entry, vtkView ); + vtkActors[ entry ] = viewActorMap; + } + } + else { // the rest properties "work" with VISU_Actor, so we initialize it at first + VISU_Actor* vActor = 0; + if ( vtkActors.contains( entry ) ) { + QMap viewActorMap = vtkActors[ entry ]; + if ( viewActorMap.contains( viewerTypeIndex ) ) + vActor = viewActorMap[ viewerTypeIndex ]; + } + if ( !vActor ) + continue; + + QString val( (*valuesIt).c_str() ); + + if ( paramName == "Name" ) + vActor->setName( val.latin1() ); + + else if ( paramName == "RepresentationMode" ) + vActor->SetRepresentation( val.toInt() ); + + else if ( paramName == "Opacity" ) + vActor->SetOpacity( val.toFloat() ); + + else if ( paramName == "Color" ) { + QStringList colors = QStringList::split( gDigitsSep, val ); + if ( colors.count() == 3 ) + vActor->SetColor( colors[0].toFloat(), colors[1].toFloat(), colors[2].toFloat() ); + } + + else if ( paramName == "LineWidth" ) + vActor->SetLineWidth( val.toFloat() ); + + else if ( paramName == "ShrinkMode" ) { + vActor->SetShrinkable( true ); + vActor->SetShrink(); + } + + else if ( paramName == "ShrunkFactor" ) + vActor->SetShrinkFactor( val.toFloat() ); + + else if ( paramName == "Shading" ) { + if ( VISU_ScalarMapAct* scalarMapActor = dynamic_cast( vActor ) ) + scalarMapActor->SetShading(); + } + + else if ( paramName.find( "ClippingPlane" ) != std::string::npos ) { + VISU::Prs3d_i* prs = vActor->GetPrs3d(); + if ( !prs ) + continue; + + prs->RemoveAllClippingPlanes(); + if ( val != "Off" ) { + QStringList vals = QStringList::split( gDigitsSep, val ); + if ( vals.count() == 6 ) { // format check: 6 float values + vtkFloatingPointType normal[3], origin[3]; + for (int x = 0; x < 3; x++ ) { + normal[x] = vals[x].toFloat(); + origin[x] = vals[x+3].toFloat(); + } + OrientedPlane* plane = OrientedPlane::New(); + plane->SetNormal( normal ); + plane->SetOrigin( origin ); + prs->AddClippingPlane( plane ); + plane->Delete(); + } + } + } + } // else .. + } // if SVTK + + else if ( viewerType == SPlot2d_Viewer::Type().latin1() ) { + + if ( paramName == "Visibility" && displayer() ) { + QPtrList lst; + getApp()->viewManagers( viewerType.c_str(), lst ); + + if ( viewIndex >= 0 && viewIndex < lst.count() ) { + SUIT_ViewManager* vman = lst.at( viewIndex ); + SUIT_ViewModel* vmodel = vman->getViewModel(); + // SVTK and VVTK view models can be casted to SALOME_View + displayer()->Display( entry, true, dynamic_cast( vmodel ) ); + } + } + + } // if SPlot2d + + } // for names/parameters iterator + } // for entries iterator + + // [ update all SVTK/VVTK/Plot2D views + QPtrList lst; + getApp()->viewManagers( lst ); + for ( QPtrListIterator it( lst ); it.current(); ++it ) { + SUIT_ViewManager* vman = it.current(); + SUIT_ViewModel* vmodel = vman->getViewModel(); + if ( !vmodel ) + continue; + if ( vmodel->getType() == SVTK_Viewer::Type() || // processing SVTK and VVTK viewers + vmodel->getType() == VVTK_Viewer::Type() ) { // in the same way + SVTK_ViewWindow* vtkView = (SVTK_ViewWindow*) vman->getActiveView(); + vtkView->getRenderer()->ResetCameraClippingRange(); + vtkView->Repaint(); + } + else if ( vmodel->getType() == SPlot2d_Viewer::Type().latin1() ) { + Plot2d_ViewWindow* plotView = (Plot2d_ViewWindow*) vman->getActiveView(); + plotView->getViewFrame()->Repaint(); + } + } // ] end of update views + + // VISU module opens one SVTK viewer in activateModule(). This causes a bug in save-restore visual + // parameters: it no SVTK view was saved, we need NOT any SVTK on restore. Here we close one + // default SVTK if needed. + /* + QString openedSvtkViewerStr = ip->getProperty( "VtkViewersCount" ).c_str(); + int openedSvtkViewer = openedSvtkViewerStr.toInt( &ok ); + if ( ok && openedSvtkViewer == 0 ) { + lst.clear(); + getApp()->viewManagers( SVTK_Viewer::Type(), lst ); + if ( lst.count() ) + lst.at( 0 )->closeAllViews(); + } + */ + + // if active Gauss Viewer is set ( != -1) then raise the gauss view window. + bool ok; + QString activeGaussViewerStr = ip->getProperty( "ActiveGaussViewer" ).c_str(); + int activeGaussViewer = activeGaussViewerStr.toInt( &ok ); + if ( ok && activeGaussViewer != -1 ) { + lst.clear(); + getApp()->viewManagers( VVTK_Viewer::Type(), lst ); + if ( activeGaussViewer >= 0 && activeGaussViewer < lst.count() ) { + SUIT_ViewWindow* activeView = lst.at( activeGaussViewer )->getActiveView(); + if ( activeView ) { + activeView->setActiveWindow(); + activeView->setFocus(); + } + } + } +} + diff --git a/src/VISUGUI/VisuGUI_Module.h b/src/VISUGUI/VisuGUI_Module.h index c13c8235..02abf76e 100644 --- a/src/VISUGUI/VisuGUI_Module.h +++ b/src/VISUGUI/VisuGUI_Module.h @@ -17,14 +17,13 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // // File : VisuGUI_Module.h // Author : // Module : VISU -// $Header$ #ifndef VisuGUI_Module_HeaderFile #define VisuGUI_Module_HeaderFile @@ -39,22 +38,12 @@ class SVTK_ViewWindow; #include "MED_SharedPtr.hxx" -namespace VISU -{ - class Viewer; - typedef MED::SharedPtr PViewer; - - typedef std::map TViewerMap; -} - //! This class inherits base VisuGUI. /*! Used to display, erase end edit presentations in the VVTK viewer. */ class VisuGUI_Module: public VisuGUI { Q_OBJECT; - friend class VISU::Viewer; - public: VisuGUI_Module(); @@ -84,6 +73,14 @@ public: getViewManager(const QString& theType, const bool theIsCreate); + virtual + void + storeVisualParameters(int savePoint); + + virtual + void + restoreVisualParameters(int savePoint); + public slots: //! Reimplemented method of the module deactivation. virtual @@ -129,9 +126,6 @@ protected slots: SUIT_ViewManager* onCreateViewManager(); - void - onLastViewClosed(SUIT_ViewManager*); - void OnCreateGaussPoints(); @@ -146,26 +140,6 @@ protected slots: void OnEditGaussPoints(); - //! Reimplemented method of the Gauss Points displaying. - virtual - void - OnDisplayPrs(); - - //! Reimplemented method of the Gauss Points displaying only. - virtual - void - OnDisplayOnlyPrs(); - - //! Reimplemented method of the Gauss Points full erasing. - virtual - void - OnEraseAll(); - - //! Reimplemented method of the Gauss Points erasing. - virtual - void - OnErasePrs(); - //! Virtual method of saving configuration. virtual void @@ -182,7 +156,6 @@ protected slots: OnRestoreConfiguration(); protected: - VISU::TViewerMap myViewerMap; _PTR(SObject) myConfigSObject; void setProperty( SVTK_ViewWindow*, const QString& ); // set a property (speed_increment, etc ) for SVTK ViewWindow diff --git a/src/VISUGUI/VisuGUI_NameDlg.cxx b/src/VISUGUI/VisuGUI_NameDlg.cxx index c847861f..b4a479ff 100644 --- a/src/VISUGUI/VisuGUI_NameDlg.cxx +++ b/src/VISUGUI/VisuGUI_NameDlg.cxx @@ -1,8 +1,21 @@ -// SALOME VisuGUI : implementation of desktop and GUI kernel -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// +// 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 : VisuGUI_NameDlg.cxx // Author : Vadim SANDLER @@ -10,11 +23,16 @@ // $Header$ #include "VisuGUI_NameDlg.h" +#include "VisuGUI.h" #include #include #include #include +#include +#include + +#include #include #include @@ -73,6 +91,11 @@ VisuGUI_NameDlg::VisuGUI_NameDlg( QWidget* parent ) myButtonCancel->setText( tr( "BUT_CANCEL" ) ); myButtonCancel->setAutoDefault( TRUE ); GroupButtonsLayout->addWidget( myButtonCancel ); + + myButtonHelp = new QPushButton( GroupButtons, "buttonHelp" ); + myButtonHelp->setText( tr( "BUT_HELP" ) ); + myButtonHelp->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( myButtonHelp ); /***************************************************************/ topLayout->addWidget( GroupC1 ); @@ -81,6 +104,7 @@ VisuGUI_NameDlg::VisuGUI_NameDlg( QWidget* parent ) // signals and slots connections connect( myButtonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( myButtonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); + connect( myButtonHelp, SIGNAL( clicked() ), this, SLOT( onHelp() ) ); /* Move widget on the botton right corner of main widget */ SUIT_Tools::centerWidget( this, parent ); @@ -118,6 +142,22 @@ void VisuGUI_NameDlg::accept() QDialog::accept(); } +void VisuGUI_NameDlg::onHelp() +{ + QString aHelpFileName = "/files/renaming_presentations.htm"; + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) { + VisuGUI* aVisuGUI = dynamic_cast( app->activeModule() ); + app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName); + } + else { + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + QObject::tr("BUT_OK")); + } +} + /*! Creates modal dialog and returns name entered [ static ] */ diff --git a/src/VISUGUI/VisuGUI_NameDlg.h b/src/VISUGUI/VisuGUI_NameDlg.h index 56a9819b..c9505799 100644 --- a/src/VISUGUI/VisuGUI_NameDlg.h +++ b/src/VISUGUI/VisuGUI_NameDlg.h @@ -1,13 +1,25 @@ -// SALOME VisuGUI : implementation of desktop and GUI kernel -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// +// 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 : VisuGUI_NameDlg.h // Author : Vadim SANDLER // Module : SALOME -// $Header$ #ifndef VisuGUI_NAMEDLG_H #define VisuGUI_NAMEDLG_H @@ -36,10 +48,12 @@ public: protected slots: void accept(); + void onHelp(); private: QPushButton* myButtonOk; QPushButton* myButtonCancel; + QPushButton* myButtonHelp; QLineEdit* myLineEdit; }; diff --git a/src/VISUGUI/VisuGUI_OffsetDlg.cxx b/src/VISUGUI/VisuGUI_OffsetDlg.cxx index 3fca41a1..759c9948 100644 --- a/src/VISUGUI/VisuGUI_OffsetDlg.cxx +++ b/src/VISUGUI/VisuGUI_OffsetDlg.cxx @@ -15,7 +15,7 @@ // 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/ +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #include "VisuGUI_OffsetDlg.h" @@ -26,10 +26,14 @@ #include "VISU_ViewManager_i.hh" #include "VISU_Actor.h" +#include "LightApp_Application.h" #include "SalomeApp_Application.h" #include "SVTK_ViewWindow.h" #include "SVTK_ViewModel.h" #include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SUIT_MessageBox.h" +#include "SUIT_ResourceMgr.h" #include "QtxDblSpinBox.h" @@ -63,25 +67,25 @@ myModule(theModule) TopLayout->setSpacing(6); TopLayout->setMargin(11); - QHBox* aOffsetsPane = new QHBox (this); - aOffsetsPane->setSpacing(6); + QHBox* anOffsetsPane = new QHBox (this); + anOffsetsPane->setSpacing(6); - new QLabel ("dX:", aOffsetsPane); - myDxEdt = new QtxDblSpinBox (aOffsetsPane, "myDxEdt"); + new QLabel ("dX:", anOffsetsPane); + myDxEdt = new QtxDblSpinBox (anOffsetsPane, "myDxEdt"); myDxEdt->setRange(-MAXVAL, MAXVAL); - new QLabel("dY:", aOffsetsPane); - myDyEdt = new QtxDblSpinBox (aOffsetsPane, "myDyEdt"); + new QLabel("dY:", anOffsetsPane); + myDyEdt = new QtxDblSpinBox (anOffsetsPane, "myDyEdt"); myDyEdt->setRange(-MAXVAL, MAXVAL); - new QLabel("dZ:", aOffsetsPane); - myDzEdt = new QtxDblSpinBox (aOffsetsPane, "myDzEdt"); + new QLabel("dZ:", anOffsetsPane); + myDzEdt = new QtxDblSpinBox (anOffsetsPane, "myDzEdt"); myDzEdt->setRange(-MAXVAL, MAXVAL); - QPushButton* aResetBtn = new QPushButton(tr("BTN_RESET"), aOffsetsPane); + QPushButton* aResetBtn = new QPushButton(tr("BTN_RESET"), anOffsetsPane); connect(aResetBtn, SIGNAL(clicked()), this, SLOT(onReset())); - TopLayout->addWidget(aOffsetsPane); + TopLayout->addWidget(anOffsetsPane); if (!VISU::GetCStudy(VISU::GetAppStudy(theModule))->GetProperties()->IsLocked()) { mySaveChk = new QCheckBox ("Save to presentation", this); @@ -115,37 +119,43 @@ myModule(theModule) QPushButton* buttonCancel = new QPushButton(tr("&Cancel") , GroupButtons, "buttonCancel"); buttonCancel->setAutoDefault(TRUE); GroupButtonsLayout->addWidget(buttonCancel, 0, 4); + GroupButtonsLayout->addItem(new QSpacerItem(5, 5, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 5); + + QPushButton* buttonHelp = new QPushButton(tr("&Help") , GroupButtons, "buttonHelp"); + buttonHelp->setAutoDefault(TRUE); + GroupButtonsLayout->addWidget(buttonHelp, 0, 6); TopLayout->addWidget(GroupButtons); connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept())); connect(buttonApply, SIGNAL(clicked()), this, SLOT(onApply())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); + connect(buttonHelp, SIGNAL(clicked()), this, SLOT(onHelp())); } void VisuGUI_OffsetDlg::addPresentation (VISU::Prs3d_i* thePrs) { myPrsList.append(thePrs); - OffsetStruct aOffs; - thePrs->GetOffset(aOffs.myOffset); - myOldOffsets.append(aOffs); + CORBA::Float anOffset[3]; + thePrs->GetOffset(anOffset[0],anOffset[1],anOffset[2]); + OffsetStruct anOffs(anOffset[0],anOffset[1],anOffset[2]); + myOldOffsets.append(anOffs); if (myPrsList.count() == 1) { - setOffset(aOffs.myOffset); + setOffset(anOffs.myOffset); } else if (myPrsList.count() == 2) { - float aOffset[3]; - aOffset[0] = aOffset[1] = aOffset[2] = 0; - setOffset(aOffset); + OffsetStruct anOffs; + setOffset(anOffs.myOffset); } } -void VisuGUI_OffsetDlg::setOffset (const float* theOffset) +void VisuGUI_OffsetDlg::setOffset (const vtkFloatingPointType* theOffset) { myDxEdt->setValue(theOffset[0]); myDyEdt->setValue(theOffset[1]); myDzEdt->setValue(theOffset[2]); } -void VisuGUI_OffsetDlg::getOffset (float* theOffset) const +void VisuGUI_OffsetDlg::getOffset (vtkFloatingPointType* theOffset) const { theOffset[0] = myDxEdt->value(); theOffset[1] = myDyEdt->value(); @@ -167,11 +177,11 @@ bool VisuGUI_OffsetDlg::isToSave() const return false; } -void VisuGUI_OffsetDlg::updateOffset (VISU::Prs3d_i* thePrs, float* theOffset) +void VisuGUI_OffsetDlg::updateOffset (VISU::Prs3d_i* thePrs, vtkFloatingPointType* theOffset) { if (myPrsList.count() == 0) return; - if (isToSave()) thePrs->SetOffset(theOffset); + if (isToSave()) thePrs->SetOffset(theOffset[0],theOffset[1],theOffset[2]); ViewManagerList aViewManagerList; SalomeApp_Application* anApp = myModule->getApp(); @@ -203,10 +213,10 @@ void VisuGUI_OffsetDlg::updateOffset (VISU::Prs3d_i* thePrs, float* theOffset) void VisuGUI_OffsetDlg::accept() { - float aOffset[3]; - getOffset(aOffset); + vtkFloatingPointType anOffset[3]; + getOffset(anOffset); for (int i = 0; i < myPrsList.count(); i++) { - updateOffset(myPrsList.at(i), aOffset); + updateOffset(myPrsList.at(i), anOffset); } QDialog::accept(); } @@ -221,9 +231,23 @@ void VisuGUI_OffsetDlg::reject() void VisuGUI_OffsetDlg::onApply() { - float aOffset[3]; - getOffset(aOffset); + vtkFloatingPointType anOffset[3]; + getOffset(anOffset); for (int i = 0; i < myPrsList.count(); i++) { - updateOffset(myPrsList.at(i), aOffset); + updateOffset(myPrsList.at(i), anOffset); + } +} + +void VisuGUI_OffsetDlg::onHelp() +{ + QString aHelpFileName = "/files/scaling_presentations.htm"; + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) + app->onHelpContextModule(myModule ? app->moduleName(myModule->moduleName()) : QString(""), aHelpFileName); + else { + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + QObject::tr("BUT_OK")); } } diff --git a/src/VISUGUI/VisuGUI_OffsetDlg.h b/src/VISUGUI/VisuGUI_OffsetDlg.h index b06092f9..80a3f114 100644 --- a/src/VISUGUI/VisuGUI_OffsetDlg.h +++ b/src/VISUGUI/VisuGUI_OffsetDlg.h @@ -15,12 +15,13 @@ // 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/ +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #ifndef DIALOGBOX_OFFSET_H #define DIALOGBOX_OFFSET_H +#include "VTKViewer.h" #include "VISU_Prs3d_i.hh" // QT Includes @@ -31,8 +32,23 @@ class QCheckBox; class QtxDblSpinBox; class VisuGUI; -struct OffsetStruct { - float myOffset[3]; +struct OffsetStruct +{ + vtkFloatingPointType myOffset[3]; + + OffsetStruct() + { + myOffset[0] = myOffset[1] = myOffset[2] = 0; + } + + OffsetStruct(vtkFloatingPointType theX, + vtkFloatingPointType theY, + vtkFloatingPointType theZ) + { + myOffset[0] = theX; + myOffset[1] = theY; + myOffset[2] = theZ; + } }; class VisuGUI_OffsetDlg: public QDialog @@ -45,8 +61,8 @@ class VisuGUI_OffsetDlg: public QDialog void addPresentation (VISU::Prs3d_i* thePrs); int getPrsCount() const { return myPrsList.count(); } - void setOffset (const float* theOffset); - void getOffset (float* theOffset) const; + void setOffset (const vtkFloatingPointType* theOffset); + void getOffset (vtkFloatingPointType* theOffset) const; bool isToSave() const; public slots: @@ -56,9 +72,10 @@ class VisuGUI_OffsetDlg: public QDialog virtual void accept(); virtual void reject(); void onApply(); + void onHelp(); private: - void updateOffset (VISU::Prs3d_i* thePrs, float* theOffset); + void updateOffset (VISU::Prs3d_i* thePrs, vtkFloatingPointType* theOffset); VisuGUI * myModule; diff --git a/src/VISUGUI/VisuGUI_Plot3DDlg.cxx b/src/VISUGUI/VisuGUI_Plot3DDlg.cxx index a7935632..04d78a4e 100644 --- a/src/VISUGUI/VisuGUI_Plot3DDlg.cxx +++ b/src/VISUGUI/VisuGUI_Plot3DDlg.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -30,13 +30,19 @@ #include "VisuGUI.h" #include "VisuGUI_Tools.h" +#include "VisuGUI_ViewTools.h" #include "VISU_ViewManager_i.hh" #include "VISU_Plot3DPL.hxx" -#include "SALOME_Actor.h" #include "SVTK_ViewWindow.h" + +#include "SALOME_Actor.h" #include "SUIT_Desktop.h" +#include "SUIT_Session.h" +#include "SUIT_MessageBox.h" +#include "SUIT_ResourceMgr.h" +#include "LightApp_Application.h" #include #include @@ -72,20 +78,20 @@ static void renderViewFrame (SVTK_ViewWindow* vw) //======================================================================= class TPlane : public SALOME_Actor { - float mySize; + vtkFloatingPointType mySize; vtkDataSetMapper* myMapper; vtkPlaneSource* myPlaneSource; public: // constructor - TPlane(float planeSize): mySize(planeSize) + TPlane(vtkFloatingPointType planeSize): mySize(planeSize) { Init(); } // set plane parameters - void Set(float origin[3], float normal[3]) + void Set(vtkFloatingPointType origin[3], vtkFloatingPointType normal[3]) { - float point2[3], point1[3]; + vtkFloatingPointType point2[3], point1[3]; vtkMath::Perpendiculars(normal, point1, point2, 0.); for (int i = 0; i < 3; ++i) { point1[ i ] = point1[ i ] * mySize + origin[ i ]; @@ -127,7 +133,7 @@ class TPlane : public SALOME_Actor //======================================================================= VisuGUI_Plot3DPane::VisuGUI_Plot3DPane (QWidget* parent) : QVBox(parent), myInitFromPrs(false), myPreviewActor(NULL), - myViewWindow(VISU::GetViewWindow()), myPrs(NULL), myPipeCopy(NULL) + myViewWindow(VISU::GetActiveViewWindow()), myPrs(NULL), myPipeCopy(NULL) { layout()->setAlignment(Qt::AlignTop); setSpacing(6); @@ -279,7 +285,7 @@ void VisuGUI_Plot3DPane::restorePrsParams() void VisuGUI_Plot3DPane::onPositionSpn() { if (myPrs && !RelativeChkB->isChecked()) { - float minPos, maxPos; + vtkFloatingPointType minPos, maxPos; storePrsParams(); myPrs->GetPlot3DPL()->GetMinMaxPosition(minPos, maxPos); restorePrsParams(); @@ -317,7 +323,7 @@ void VisuGUI_Plot3DPane::orientationChanged(int Id) //======================================================================= void VisuGUI_Plot3DPane::onRelativePos(bool isRelativePos) { - float minPos = 0., maxPos = 1., pos = PositionSpn->value(); + vtkFloatingPointType minPos = 0., maxPos = 1., pos = PositionSpn->value(); if (myPrs) { storePrsParams(); myPrs->GetPlot3DPL()->GetMinMaxPosition(minPos, maxPos); @@ -370,7 +376,7 @@ void VisuGUI_Plot3DPane::updatePreview() } // set plane parameters corresponding to control values storePrsParams(); - float normal[3], origin[3]; + vtkFloatingPointType normal[3], origin[3]; myPrs->GetPlot3DPL()->GetBasePlane(origin, normal, true); planePreview->Set(origin, normal); restorePrsParams(); @@ -494,6 +500,35 @@ bool VisuGUI_Plot3DPane::check() return true; } +void VisuGUI_Plot3DPane::setPlane(int theOrientation, double theXRotation, double theYRotation, double thePlanePos) +{ + // Set plane + int id; + switch (theOrientation) { + case VISU::Plot3D::XY: id = 0; break; + case VISU::Plot3D::YZ: id = 1; break; + default: id = 2; + } + GBOrientation->setButton(id); + orientationChanged(id); + GBOrientation->setEnabled(false); + + + // Set rotation + Rot1->setValue(theXRotation * 180./PI); + Rot1->setEnabled(false); + Rot2->setValue(theYRotation * 180./PI); + Rot2->setEnabled(false); + + // Set position + RelativeChkB->setChecked(false); + onRelativePos(false); // update range + PositionSpn->setValue(thePlanePos); + RelativeChkB->setEnabled(false); + PositionSpn->setEnabled(false); +} + + //======================================================================= //function : Constructor //purpose : @@ -537,12 +572,16 @@ VisuGUI_Plot3DDlg::VisuGUI_Plot3DDlg (SalomeApp_Module* theModule) QPushButton* buttonCancel = new QPushButton (tr("&Cancel") , GroupButtons, "buttonCancel"); buttonCancel->setAutoDefault(TRUE); GroupButtonsLayout->addWidget(buttonCancel, 0, 2); + QPushButton* buttonHelp = new QPushButton (tr("&Help") , GroupButtons, "buttonHelp"); + buttonHelp->setAutoDefault(TRUE); + GroupButtonsLayout->addWidget(buttonHelp, 0, 3); TopLayout->addWidget(GroupButtons); // signals and slots connections connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); + connect(buttonHelp, SIGNAL(clicked()), this, SLOT(onHelp())); } //======================================================================= @@ -569,3 +608,32 @@ void VisuGUI_Plot3DDlg::reject() QDialog::reject(); } + +//======================================================================= +//function : onHelp +//purpose : +//======================================================================= +void VisuGUI_Plot3DDlg::onHelp() +{ + QString aHelpFileName = "plot_3d_presentation.htm"; + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) { + VisuGUI* aVisuGUI = dynamic_cast( app->activeModule() ); + app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName); + } + else { + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + QObject::tr("BUT_OK")); + } +} + +//======================================================================= +//function : setPlane +//purpose : +//======================================================================= +void VisuGUI_Plot3DDlg::setPlane(int theOrientation, double theXRotation, double theYRotation, double thePlanePos) +{ + myIsoPane->setPlane(theOrientation, theXRotation, theYRotation, thePlanePos); +} diff --git a/src/VISUGUI/VisuGUI_Plot3DDlg.h b/src/VISUGUI/VisuGUI_Plot3DDlg.h index a1e59f90..e6e22751 100644 --- a/src/VISUGUI/VisuGUI_Plot3DDlg.h +++ b/src/VISUGUI/VisuGUI_Plot3DDlg.h @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -61,6 +61,8 @@ class VisuGUI_Plot3DPane : public QVBox VISU::Plot3D_i* GetPrs() { return myPrs; } + void setPlane(int theOrientation, double theXRotation, double theYRotation, double thePlanePos); + private: bool myInitFromPrs; SALOME_Actor* myPreviewActor; @@ -107,9 +109,12 @@ class VisuGUI_Plot3DDlg : public QDialog int storeToPrsObject (VISU::Plot3D_i* thePrs) { return myScalarPane->storeToPrsObject(thePrs) && myIsoPane->storeToPrsObject(thePrs); } + void setPlane(int theOrientation, double theXRotation, double theYRotation, double thePlanePos); + protected slots: void accept(); void reject(); + void onHelp(); private: VisuGUI_Plot3DPane* myIsoPane; diff --git a/src/VISUGUI/VisuGUI_PopupTools.cxx b/src/VISUGUI/VisuGUI_PopupTools.cxx index b4ca7c20..45d034d9 100644 --- a/src/VISUGUI/VisuGUI_PopupTools.cxx +++ b/src/VISUGUI/VisuGUI_PopupTools.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -26,15 +26,18 @@ // Module : VISU #include "VisuGUI_PopupTools.h" + #include "VisuGUI_ViewTools.h" #include "VisuGUI_Tools.h" -#include "SalomeApp_Study.h" -#include "LightApp_Study.h" + +#include "VISU_Result_i.hh" +#include "VISU_Gen_i.hh" #include "VISU_Actor.h" #include "VISU_ScalarMapAct.h" -#include "VISU_Result_i.hh" + #include "SalomeApp_Study.h" +#include "LightApp_Study.h" using namespace VISU; @@ -59,6 +62,7 @@ QtxValue VisuGUI_Selection::param( const int ind, const QString& p ) const else if ( p == "hasActor" ) val = QtxValue( hasActor( ind ) ); else if ( p == "isShading" ) val = QtxValue( isShading( ind ) ); else if ( p == "isScalarMapAct" ) val = QtxValue( isScalarMapAct( ind ) ); + else if ( p == "isVisuComponent") val = QtxValue( isVisuComponent( ind ) ); } return val; @@ -170,7 +174,7 @@ QString VisuGUI_Selection::medEntity( const int ind ) const QString VisuGUI_Selection::medSource( const int ind ) const { _PTR(Study) aStudyDS = GetStudy()->studyDS(); - if(_PTR(SObject) aSObject = aStudyDS->FindObjectID(entry(ind))){ + if(_PTR(SObject) aSObject = aStudyDS->FindObjectID(entry(ind).latin1())){ VISU::Result_var aRes; if(VISU::Result_i* aResult = CheckResult(myModule,aSObject,aRes)){ using namespace VISU; @@ -211,10 +215,10 @@ QString VisuGUI_Selection::representation( const int ind ) const { QString aResStr; - if ( SVTK_ViewWindow* aView = GetViewWindow( myModule ) ){ - if ( VISU_Actor* anVISUActor = FindActor( aView, entry( ind ).latin1() ) ){ + if (SVTK_ViewWindow* aView = GetActiveViewWindow(myModule)) { + if (VISU_Actor* anVISUActor = FindActor(aView, entry(ind).latin1())) { int aRepresent = anVISUActor->GetRepresentation(); - switch ( aRepresent ){ + switch (aRepresent) { ENUM2STRING( aResStr, VISU::POINT ); ENUM2STRING( aResStr, VISU::WIREFRAME ); ENUM2STRING( aResStr, VISU::SHADED ); @@ -278,8 +282,8 @@ namespace const QString& theEntry) { typedef typename TViewer::TViewWindow TViewWindow; - if(TViewWindow* aViewWindow = GetViewWindow(theModule)) - if(VISU_Actor* anActor = FindActor(aViewWindow,theEntry.latin1())) + if (TViewWindow* aViewWindow = GetActiveViewWindow(theModule)) + if (VISU_Actor* anActor = FindActor(aViewWindow,theEntry.latin1())) return anActor->GetVisibility() ? "true" : "false"; return QString(); @@ -315,7 +319,7 @@ QString VisuGUI_Selection::isShrunk( const int ind ) const { QString aResStr; - if ( SVTK_ViewWindow* aView = GetViewWindow( myModule ) ) + if ( SVTK_ViewWindow* aView = GetActiveViewWindow(myModule) ) if ( VISU_Actor* anVISUActor = FindActor( aView, entry( ind ).latin1() ) ) if ( anVISUActor->IsShrunkable() ) aResStr = anVISUActor->IsShrunk() ? "1" : "0"; @@ -332,7 +336,7 @@ QString VisuGUI_Selection::isShading( const int ind ) const { QString aResStr; - if ( SVTK_ViewWindow* aView = GetViewWindow( myModule ) ) + if ( SVTK_ViewWindow* aView = GetActiveViewWindow(myModule) ) if ( VISU_Actor* anVISUActor = FindActor( aView, entry( ind ).latin1() ) ) if ( VISU_ScalarMapAct* anActor = dynamic_cast(anVISUActor) ) aResStr = anActor->IsShading() ? "1" : "0"; @@ -344,12 +348,28 @@ QString VisuGUI_Selection::isScalarMapAct( const int ind ) const { QString aResStr; - if ( SVTK_ViewWindow* aView = GetViewWindow( myModule ) ) + if ( SVTK_ViewWindow* aView = GetActiveViewWindow(myModule) ) if ( VISU_Actor* anVISUActor = FindActor( aView, entry( ind ).latin1() ) ) - { - VISU_ScalarMapAct* anActor = dynamic_cast(anVISUActor); - aResStr = anActor ? "1" : "0"; - } - + { + VISU_ScalarMapAct* anActor = dynamic_cast(anVISUActor); + aResStr = anActor ? "1" : "0"; + } + return aResStr; } + +bool VisuGUI_Selection::isVisuComponent( const int ind ) const +{ + SalomeApp_Study* study = GetStudy(); + if ( !study ) + return false; + + _PTR(SObject) obj = study->studyDS()->FindObjectID( entry( ind ).latin1() ); + if ( !obj ) + return false; + CORBA::Object_var anObj = VISU::ClientSObjectToObject( obj ); + if( CORBA::is_nil( anObj ) ) + return false; + + return dynamic_cast( VISU::GetServant( anObj ).in() ); +} diff --git a/src/VISUGUI/VisuGUI_PopupTools.h b/src/VISUGUI/VisuGUI_PopupTools.h index 1a7ae957..536ef59a 100644 --- a/src/VISUGUI/VisuGUI_PopupTools.h +++ b/src/VISUGUI/VisuGUI_PopupTools.h @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -59,6 +59,7 @@ private: QString hasActor( const int ) const; QString isShading( const int ) const; QString isScalarMapAct( const int ) const; + bool isVisuComponent( const int ) const; private: int nbChild( const int, const bool ) const; diff --git a/src/VISUGUI/VisuGUI_Prs3dTools.h b/src/VISUGUI/VisuGUI_Prs3dTools.h index 7984a698..9050d5fd 100644 --- a/src/VISUGUI/VisuGUI_Prs3dTools.h +++ b/src/VISUGUI/VisuGUI_Prs3dTools.h @@ -17,14 +17,13 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // // File : VisuGUI_Module.h // Author : // Module : VISU -// $Header$ #ifndef VisuGUI_Prs3dTools_HeaderFile #define VisuGUI_Prs3dTools_HeaderFile @@ -52,9 +51,10 @@ namespace VISU template void EditPrs3d(VisuGUI* theModule, - VISU::Prs3d_i* thePrs3d) + VISU::Prs3d_i* thePrs3d, + SVTK_ViewWindow* theViewWindow) { - if(TPrs3d_i* aPrs3d = dynamic_cast(thePrs3d)){ + if (TPrs3d_i* aPrs3d = dynamic_cast(thePrs3d)) { TDlg* aDlg = new TDlg (theModule); aDlg->initFromPrsObject(aPrs3d); if (runAndWait(aDlg,TIsDlgModal)) { @@ -65,18 +65,17 @@ namespace VISU try { aPrs3d->UpdateActors(); } catch (std::runtime_error& exc) { + aPrs3d->RemoveActors(); + INFOS(exc.what()); SUIT_MessageBox::warn1 (GetDesktop(theModule), QObject::tr("WRN_VISU"), QObject::tr("ERR_CANT_BUILD_PRESENTATION") + ": " + QObject::tr(exc.what()), QObject::tr("BUT_OK")); - - aPrs3d->RemoveActors(); } - typedef typename TViewer::TViewWindow TViewWindow; - if(TViewWindow* aViewWindow = GetViewWindow(theModule)){ - aViewWindow->getRenderer()->ResetCameraClippingRange(); - aViewWindow->Repaint(); + if (theViewWindow) { + theViewWindow->getRenderer()->ResetCameraClippingRange(); + theViewWindow->Repaint(); } // Optionally, create table and curves for cut lines QApplication::setOverrideCursor(Qt::waitCursor); @@ -93,10 +92,19 @@ namespace VISU template inline void - EditPrs3d(VisuGUI* theModule, - VISU::Prs3d_i* thePrs3d) + EditPrs3d(VisuGUI* theModule, + Handle(SALOME_InteractiveObject)& theIO, + VISU::Prs3d_i* thePrs3d, + SVTK_ViewWindow* theViewWindow = NULL) { - EditPrs3d(theModule,thePrs3d); + SVTK_ViewWindow* aViewWindow = theViewWindow; + if (!aViewWindow) + // Create SVTK_ViewWindow, if it does not exist + aViewWindow = GetViewWindow(theModule); + if (aViewWindow) { + EditPrs3d(theModule, thePrs3d, aViewWindow); + aViewWindow->highlight(theIO, 1); + } } //--------------------------------------------------------------- @@ -134,26 +142,30 @@ namespace VISU bool CreatePrs3d(VisuGUI* theModule, _PTR(SObject) theTimeStamp, - const Handle(SALOME_InteractiveObject)& theIO, - const bool theIsCreateView = false) + const Handle(SALOME_InteractiveObject)& theIO) { Storable::TRestoringMap aMap = getMapOfValue(theTimeStamp); bool isExist; QString aType = Storable::FindValue(aMap,"myType",&isExist); - if(!isExist || aType.toInt() != TTIMESTAMP ) + if (!isExist || aType.toInt() != TTIMESTAMP ) return false; QString aMeshName = Storable::FindValue(aMap,"myMeshName",&isExist).latin1(); QString anEntity = Storable::FindValue(aMap,"myEntityId",&isExist).latin1(); QString aFieldName = Storable::FindValue(aMap,"myFieldName",&isExist).latin1(); QString aTimeStampId = Storable::FindValue(aMap,"myTimeStampId",&isExist).latin1(); - // - int aPos = GetFreePositionOfDefaultScalarBar(theModule); - GetResourceMgr()->setValue("VISU","scalar_bar_position_num",aPos); - // + + // Create new TViewWindow instance, if it does not exist. + typedef typename TViewer::TViewWindow TViewWindow; + TViewWindow* aViewWindow = GetViewWindow(theModule); + + // Define free position for scalar bar. + int aPos = GetFreePositionOfDefaultScalarBar(theModule, aViewWindow); + GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos); + QApplication::setOverrideCursor(Qt::waitCursor); - + TPrs3d_i* aPrs3d = CreatePrs3d(theModule, theTimeStamp, @@ -161,16 +173,16 @@ namespace VISU (Entity)anEntity.toInt(), aFieldName.latin1(), aTimeStampId.toInt()); - + QApplication::restoreOverrideCursor(); - if(aPrs3d){ + if (aPrs3d) { SUIT_ResourceMgr* aResourceMgr = GetResourceMgr(); int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0); - if(!aValue){ - if(TDlg* aDlg = new TDlg(theModule)){ // dialog box in creation mode + if (!aValue) { + if (TDlg* aDlg = new TDlg(theModule)) { // dialog box in creation mode aDlg->initFromPrsObject(aPrs3d); - if(runAndWait(aDlg,IsDlgModal) && (aDlg->storeToPrsObject(aPrs3d))) { + if (runAndWait(aDlg,IsDlgModal) && (aDlg->storeToPrsObject(aPrs3d))) { // Optionally, create table and curves for cut lines QApplication::setOverrideCursor(Qt::waitCursor); CreateCurves( theModule, @@ -187,57 +199,58 @@ namespace VISU } } } - PublishInView(theModule,aPrs3d,true,theIsCreateView); - AddScalarBarPosition(theModule,aPrs3d,aPos); + // Display created presentation. + if (aViewWindow) { + PublishInView(theModule, aPrs3d, aViewWindow, /*highlight = */true); + aViewWindow->onFitAll(); + + AddScalarBarPosition(theModule, aViewWindow, aPrs3d, aPos); + } return true; } return false; } - + //--------------------------------------------------------------- template inline void - CreatePrs3d(VisuGUI* theModule, - const bool theIsCreateView = true) + CreatePrs3d(VisuGUI* theModule) { if (CheckLock(GetCStudy(GetAppStudy(theModule)),GetDesktop(theModule))) return; - + _PTR(SObject) aTimeStampSObj; Handle(SALOME_InteractiveObject) anIO; - if(!CheckTimeStamp(theModule,aTimeStampSObj,&anIO)) + if (!CheckTimeStamp(theModule,aTimeStampSObj,&anIO)) + return; + + // Create new TViewWindow instance, if it does not exist. + typedef typename TViewer::TViewWindow TViewWindow; + if (!GetViewWindow(theModule)) return; - - if(!CreatePrs3d(theModule,aTimeStampSObj,anIO,theIsCreateView)) + + if (!CreatePrs3d(theModule,aTimeStampSObj,anIO)) return; - + theModule->application()->putInfo(QObject::tr("INF_DONE")); - - typedef typename TViewer::TViewWindow TView; - if(TView* aView = GetViewWindow(theModule,theIsCreateView)) - aView->onFitAll(); } template inline void - CreatePrs3d(VisuGUI* theModule, - const bool theIsCreateView = true) + CreatePrs3d(VisuGUI* theModule) { - if(SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager()){ - QString aType = aViewManager->getType(); - if(aType == SVTK_Viewer::Type()) - CreatePrs3d(theModule,theIsCreateView); - else if(aType == VVTK_Viewer::Type()) - CreatePrs3d(theModule,theIsCreateView); - } - } + if (SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager()) + if (aViewManager->getType() == VVTK_Viewer::Type()) + return CreatePrs3d(theModule); + CreatePrs3d(theModule); + } } #endif diff --git a/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx b/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx index ddc63e88..affe39ed 100644 --- a/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx +++ b/src/VISUGUI/VisuGUI_ScalarBarDlg.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -30,12 +30,10 @@ #include "VisuGUI.h" #include "VisuGUI_Tools.h" - -#include "SVTK_FontWidget.h" - -#include "SVTK_ViewWindow.h" +#include "VisuGUI_ViewTools.h" #include "SVTK_ViewWindow.h" +#include "SVTK_FontWidget.h" #include "VISUConfig.hh" #include "VISU_Convertor.hxx" @@ -44,8 +42,9 @@ #include "VISU_ScalarMap_i.hh" #include "VISU_ScalarMapAct.h" -#include "SalomeApp_Application.h" +#include "LightApp_Application.h" +#include "SUIT_Session.h" #include "SUIT_MessageBox.h" #include "SUIT_ResourceMgr.h" @@ -62,8 +61,20 @@ using namespace std; VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane (QWidget * parent, bool SetPref): QVBox(parent), myPreviewActor(0) { - myVerX = 0.01; myVerY = 0.10; myVerW = 0.10; myVerH = 0.80; - myHorX = 0.20; myHorY = 0.01; myHorW = 0.60; myHorH = 0.12; + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + QString propertyName; + propertyName = QString("scalar_bar_vertical_"); + myVerX = aResourceMgr->doubleValue("VISU", propertyName + "x", 0.); + myVerY = aResourceMgr->doubleValue("VISU", propertyName + "y", 0.); + myVerW = aResourceMgr->doubleValue("VISU", propertyName + "width", 0.); + myVerH = aResourceMgr->doubleValue("VISU", propertyName + "height",0.); + + propertyName = QString("scalar_bar_horizontal_"); + myHorX = aResourceMgr->doubleValue("VISU", propertyName + "x", 0.); + myHorY = aResourceMgr->doubleValue("VISU", propertyName + "y", 0.); + myHorW = aResourceMgr->doubleValue("VISU", propertyName + "width", 0.); + myHorH = aResourceMgr->doubleValue("VISU", propertyName + "height",0.); + Imin = 0.0; Imax = 0.0; /*Fmin = 0.0; Fmax = 0.0;*/ Rmin = 0.0; Rmax = 0.0; myRangeMode = -1; @@ -538,6 +549,7 @@ void VisuGUI_ScalarBarPane::storeToResources() { void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ScalarMap_i* thePrs) { initFromResources(); myScalarMap = thePrs; + myTitle = thePrs->GetTitle(); setPosAndSize( thePrs->GetPosX(), thePrs->GetPosY(), thePrs->GetWidth(), @@ -550,7 +562,7 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ScalarMap_i* thePrs) { default: setLogarithmic(false); } - float aRange[2]; + vtkFloatingPointType aRange[2]; thePrs->GetScalarMapPL()->GetSourceRange(aRange); Rmin = aRange[0]; Rmax = aRange[1]; setRange( thePrs->GetMin(), thePrs->GetMax(), @@ -566,13 +578,13 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ScalarMap_i* thePrs) { const VISU::TNames& aCompNames = aField->myCompNames; const VISU::TNames& aUnitNames = aField->myUnitNames; for(int i = 0; i < aNbComp; i++){ - QString aComponent = QString(aCompNames[i]).simplifyWhiteSpace(); + QString aComponent = QString(aCompNames[i].c_str()).simplifyWhiteSpace(); if(aComponent.isNull() || aComponent == "") aComponent = "Component " + QString::number(i+1); else aComponent = "[" + QString::number(i+1) + "] " + aComponent; - QString anUnit = QString(aUnitNames[i]).simplifyWhiteSpace(); + QString anUnit = QString(aUnitNames[i].c_str()).simplifyWhiteSpace(); if(anUnit.isNull() || anUnit == "") anUnit = "-"; @@ -592,7 +604,7 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ScalarMap_i* thePrs) { // "Title" myTextDlg->setTitleText(QString(thePrs->GetTitle())); - float R, G, B; + vtkFloatingPointType R, G, B; thePrs->GetTitleColor(&R, &G, &B); myTextDlg->myTitleFont->SetData(QColor((int)(R*255.), (int)(G*255.), (int)(B*255.)), @@ -622,7 +634,7 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ScalarMap_i* thePrs) { void VisuGUI_ScalarBarPane::updatePreview() { if (myPreviewCheck->isChecked()) { - if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) { + if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow()) { deleteScalarBar(); createScalarBar(); vf->Repaint(); @@ -634,12 +646,15 @@ void VisuGUI_ScalarBarPane::updatePreview() */ void VisuGUI_ScalarBarPane::createScalarBar() { - if (VISU::GetViewWindow() == NULL) return; + if (VISU::GetActiveViewWindow() == NULL) return; if (myPreviewActor != 0) return; if (myScalarMap == NULL) return; - if(!check()) return; - + if (!check()) return; + myScalarMapPL = VISU_ScalarMapPL::New(); + if(myScalarMap->GetScalarMapPL()) + myScalarMapPL->ShallowCopy(myScalarMap->GetScalarMapPL()); + if ( myBusy ) return; myBusy = true; @@ -656,31 +671,25 @@ void VisuGUI_ScalarBarPane::createScalarBar() myPreviewActor->GetScalarBar()->VisibilityOn(); myPreviewActor->PickableOff(); - myScalarMap->SetScalarMode(myModeCombo->currentItem()); - myScalarMap->SetPosition(getX(),getY()); - myScalarMap->SetSize(getWidth(),getHeight()); - myScalarMap->SetBarOrientation((RBvert->isChecked())? VISU::ScalarMap::VERTICAL : VISU::ScalarMap::HORIZONTAL); + myScalarMapPL->SetScalarMode(myModeCombo->currentItem()); if(isLogarithmic()) - myScalarMap->SetScaling(VISU::LOGARITHMIC); + myScalarMapPL->SetScaling(VISU::LOGARITHMIC); else - myScalarMap->SetScaling(VISU::LINEAR); - if (RBFrange->isChecked()) { - myScalarMap->SetSourceRange(); - } else { - myScalarMap->SetRange(MinEdit->text().toDouble(), MaxEdit->text().toDouble()); - } - myScalarMap->SetNbColors(sbCol); - myScalarMap->SetLabels(sbLab); + myScalarMapPL->SetScaling(VISU::LINEAR); + vtkFloatingPointType theRange[2]; + theRange[0] = (vtkFloatingPointType)MinEdit->text().toDouble(); + theRange[1] = (vtkFloatingPointType)MaxEdit->text().toDouble(); + myScalarMapPL->SetScalarRange(theRange); + myScalarMapPL->SetNbColors(sbCol); - myScalarMap->GetScalarMapPL()->SetNbColors(sbCol); - myScalarMap->GetScalarMapPL()->Update(); - - aScalarBarActor->SetLookupTable(myScalarMap->GetScalarMapPL()->GetBarTable()); + myScalarMapPL->Update(); + + aScalarBarActor->SetLookupTable(myScalarMapPL->GetBarTable()); if (myTextDlg->getTitleText().latin1() != "") aScalarBarActor->SetTitle(myTextDlg->getTitleText().latin1()); else - aScalarBarActor->SetTitle(myScalarMap->GetTitle()); + aScalarBarActor->SetTitle(myTitle.c_str()); aScalarBarActor->SetOrientation(getOrientation()); aScalarBarActor->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport(); aScalarBarActor->GetPositionCoordinate()->SetValue(getX(),getY()); @@ -699,9 +708,9 @@ void VisuGUI_ScalarBarPane::createScalarBar() isTitleBold,isTitleItalic,isTitleShadow); vtkTextProperty* aTitleProp = aScalarBarActor->GetTitleTextProperty(); aTitleProp->SetFontFamily(aTitleFontFamily); - aTitleProp->SetColor(float(aTitleColor.red())/255., - float(aTitleColor.green())/255., - float(aTitleColor.blue())/255.); + aTitleProp->SetColor(vtkFloatingPointType(aTitleColor.red())/255., + vtkFloatingPointType(aTitleColor.green())/255., + vtkFloatingPointType(aTitleColor.blue())/255.); (isTitleBold)? aTitleProp->BoldOn() : aTitleProp->BoldOff(); (isTitleItalic)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff(); (isTitleShadow)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff(); @@ -716,16 +725,16 @@ void VisuGUI_ScalarBarPane::createScalarBar() isLabelBold, isLabelItalic, isLabelShadow); vtkTextProperty* aLabelProp = aScalarBarActor->GetLabelTextProperty(); aLabelProp->SetFontFamily(aLabelFontFamily); - aLabelProp->SetColor(float(aLabelColor.red())/255., - float(aLabelColor.green())/255., - float(aLabelColor.blue())/255.); + aLabelProp->SetColor(vtkFloatingPointType(aLabelColor.red())/255., + vtkFloatingPointType(aLabelColor.green())/255., + vtkFloatingPointType(aLabelColor.blue())/255.); (isLabelBold)? aLabelProp->BoldOn() : aLabelProp->BoldOff(); (isLabelItalic)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff(); (isLabelShadow)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff(); aScalarBarActor->Modified(); - VISU::GetViewWindow()->AddActor(myPreviewActor); + VISU::GetActiveViewWindow()->AddActor(myPreviewActor); myBusy = false; } @@ -736,18 +745,25 @@ void VisuGUI_ScalarBarPane::deleteScalarBar() if ( myBusy ) return; if (myPreviewActor == 0) return; - if (SVTK_ViewWindow* vf = VISU::GetViewWindow()){ - vf->RemoveActor(myPreviewActor); - myPreviewActor->GetScalarBar()->VisibilityOff(); - } + vtkRenderer* aRend = myPreviewActor->GetRenderer(); + if(aRend) + myPreviewActor->RemoveFromRender(aRend); + myPreviewActor->GetScalarBar()->VisibilityOff(); myPreviewActor->Delete(); myPreviewActor = 0; + + if (myScalarMapPL){ + myScalarMapPL->Delete(); + myScalarMapPL = 0; + } } /*! public: Deleting preview scalar bar */ void VisuGUI_ScalarBarPane::deletePreview() { deleteScalarBar(); + if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow()) + vf->Repaint(); } /** * Store values to presentation object @@ -810,6 +826,7 @@ int VisuGUI_ScalarBarPane::storeToPrsObject(VISU::ScalarMap_i* thePrs) { thePrs->SetLabelColor(aLblColor.red()/255., aLblColor.green()/255., aLblColor.blue()/255.); + myIsStoreTextProp = false; } return 1; @@ -895,13 +912,16 @@ void VisuGUI_ScalarBarPane::changeScalarMode( int theMode ) { if ( myScalarMap ) { if ( RBFrange->isChecked() ) { - float aRange[2]; + vtkFloatingPointType aRange[2]; + int aMode = myScalarMap->GetScalarMode(); myScalarMap->SetScalarMode(theMode); myScalarMap->GetScalarMapPL()->GetSourceRange(aRange); MinEdit->setText( QString::number( aRange[0] ) ); MaxEdit->setText( QString::number( aRange[1] ) ); + myScalarMap->SetScalarMode(aMode); } } + updatePreview(); } /*! @@ -1027,13 +1047,14 @@ bool VisuGUI_ScalarBarPane::check() void VisuGUI_ScalarBarPane::onTextPref() { - myIsStoreTextProp = myTextDlg->exec(); + myTextDlg->storeBeginValues(); + myIsStoreTextProp = myTextDlg->exec() || myIsStoreTextProp; updatePreview(); } void VisuGUI_ScalarBarPane::onPreviewCheck (bool thePreview) { - if (SVTK_ViewWindow* vf = VISU::GetViewWindow()) { + if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow()) { if (thePreview) { createScalarBar(); } else { @@ -1083,10 +1104,15 @@ VisuGUI_ScalarBarDlg::VisuGUI_ScalarBarDlg (SalomeApp_Module* theModule, bool Se buttonCancel->setAutoDefault( TRUE ); GroupButtonsLayout->addWidget( buttonCancel, 0, 2 ); + QPushButton* buttonHelp = new QPushButton( tr( "&Help" ) , GroupButtons, "buttonHelp" ); + buttonHelp->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonHelp, 0, 3 ); + TopLayout->addWidget( GroupButtons ); connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); + connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( onHelp() ) ); } /*! @@ -1110,6 +1136,25 @@ void VisuGUI_ScalarBarDlg::reject() QDialog::reject(); } +/*! + Called when button is clicked, shows the corresponding help page in defined browser +*/ +void VisuGUI_ScalarBarDlg::onHelp() +{ + QString aHelpFileName = "/files/scalar_map_presentation.htm"; + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) { + VisuGUI* aVisuGUI = dynamic_cast( app->activeModule() ); + app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName); + } + else { + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + QObject::tr("BUT_OK")); + } +} + //####################################################################################### VisuGUI_TextPrefDlg::VisuGUI_TextPrefDlg (QWidget* parent) @@ -1166,8 +1211,57 @@ VisuGUI_TextPrefDlg::VisuGUI_TextPrefDlg (QWidget* parent) buttonCancel->setAutoDefault( TRUE ); GroupButtonsLayout->addWidget( buttonCancel, 0, 2 ); + QPushButton* buttonHelp = new QPushButton( tr( "&Help" ) , GroupButtons, "buttonHelp" ); + buttonHelp->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonHelp, 0, 3 ); + TopLayout->addWidget( GroupButtons ); connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); + connect(buttonHelp, SIGNAL(clicked()), this, SLOT(onHelp())); +} + +void VisuGUI_TextPrefDlg::onHelp() +{ + QString aHelpFileName = "/files/scalar_map_presentation.htm"; + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) { + VisuGUI* aVisuGUI = dynamic_cast( app->activeModule() ); + app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName); + } + else { + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + QObject::tr("BUT_OK")); + } +} + +void VisuGUI_TextPrefDlg::storeBeginValues() +{ + myTitle = myTitleEdt->text(); + myTitleFont->GetData(myColors[0], myComboVals[0], myCheckVals[0], myCheckVals[1], myCheckVals[2]); + myLabelFont->GetData(myColors[1], myComboVals[1], myCheckVals[3], myCheckVals[4], myCheckVals[5]); +} + +/*! + Called when button is clicked, restore begin values +*/ +void VisuGUI_TextPrefDlg::reject() +{ + myTitleEdt->setText(myTitle); + myTitleFont->SetData(myColors[0], myComboVals[0], myCheckVals[0], myCheckVals[1], myCheckVals[2]); + myLabelFont->SetData(myColors[1], myComboVals[1], myCheckVals[3], myCheckVals[4], myCheckVals[5]); + + QDialog::reject(); +} +/*! + Called when button is clicked, store begin values +*/ +void VisuGUI_TextPrefDlg::accept() +{ + storeBeginValues(); + + QDialog::accept(); } diff --git a/src/VISUGUI/VisuGUI_ScalarBarDlg.h b/src/VISUGUI/VisuGUI_ScalarBarDlg.h index 4f53a39b..5ef53b8d 100644 --- a/src/VISUGUI/VisuGUI_ScalarBarDlg.h +++ b/src/VISUGUI/VisuGUI_ScalarBarDlg.h @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -77,12 +77,23 @@ class VisuGUI_TextPrefDlg: public QDialog void setTitleVisible (bool isVisible) { (isVisible)? myTitleEdt->show() : myTitleEdt->hide(); } + void storeBeginValues(); + public: SVTK_FontWidget* myTitleFont; SVTK_FontWidget* myLabelFont; + protected slots: + void accept(); + void reject(); + void onHelp(); + private: QLineEdit* myTitleEdt; + QString myTitle; + QColor myColors[2]; + int myComboVals[2]; + bool myCheckVals[6]; }; @@ -169,6 +180,8 @@ class VisuGUI_ScalarBarPane : public QVBox QCheckBox* myPreviewCheck; VISU_ScalarMapAct* myPreviewActor; VISU::ScalarMap_i* myScalarMap; + VISU_ScalarMapPL* myScalarMapPL; + std::string myTitle; bool myBusy; }; @@ -193,6 +206,7 @@ class VisuGUI_ScalarBarDlg : public QDialog protected slots: void accept(); void reject(); + void onHelp(); protected: VisuGUI_ScalarBarPane* myScalarPane; diff --git a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx index ccb1c573..2ab7dcca 100644 --- a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx +++ b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -26,19 +26,27 @@ // Module : VISU #include "VisuGUI_ScalarMapOnDeformedShapeDlg.h" + #include "VisuGUI_Tools.h" + #include "VISU_Result_i.hh" #include "VISU_ScalarMapOnDeformedShape_i.hh" + +#include "VISU_ScalarMapPL.hxx" #include "VISU_ScalarMapOnDeformedShapePL.hxx" + +#include "VISU_Convertor.hxx" + #include "SalomeApp_Module.h" +#include "LightApp_Application.h" #include "LightApp_SelectionMgr.h" #include "SUIT_Desktop.h" -#include "VISU_ScalarMapPL.hxx" +#include "SUIT_ResourceMgr.h" +#include "SUIT_Session.h" +#include "SUIT_MessageBox.h" #include "SALOME_ListIO.hxx" -#include "VISU_Convertor.hxx" - #include "SALOMEDSClient_AttributeComment.hxx" #include "SALOMEDSClient_AttributeName.hxx" @@ -55,6 +63,7 @@ using namespace std; VisuGUI_ScalarMapOnDeformedShapeDlg::VisuGUI_ScalarMapOnDeformedShapeDlg (SalomeApp_Module* theModule) : QDialog(VISU::GetDesktop(theModule), "VisuGUI_ScalarMapOnDeformedShapeDlg", false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), + myIsAnimation(false), myVisuGUI(theModule) { myPrs = NULL; @@ -94,14 +103,14 @@ VisuGUI_ScalarMapOnDeformedShapeDlg::VisuGUI_ScalarMapOnDeformedShapeDlg (Salome TopGroupLayout->addWidget(FieldLabel, 1, 0); TopGroupLayout->addWidget(myFieldsCombo,1,1); - + // TimeStamps combo box QLabel* TimeStampLabel = new QLabel (tr("TIMESTAMP_ITEM"), TopGroup, "TimeStampLabel"); myTimeStampsCombo = new QComboBox (TopGroup,"TimeStamp"); TopGroupLayout->addWidget(TimeStampLabel, 2, 0); TopGroupLayout->addWidget(myTimeStampsCombo,2,1); - + // aTabBox->addTab(aBox, tr("SCALAR_MAP_ON_DEFORMED_SHAPE_TAB")); @@ -134,6 +143,10 @@ VisuGUI_ScalarMapOnDeformedShapeDlg::VisuGUI_ScalarMapOnDeformedShapeDlg (Salome buttonCancel->setAutoDefault(TRUE); GroupButtonsLayout->addWidget(buttonCancel, 0, 2); + QPushButton* buttonHelp = new QPushButton (tr("&Help") , GroupButtons, "buttonHelp"); + buttonHelp->setAutoDefault(TRUE); + GroupButtonsLayout->addWidget(buttonHelp, 0, 3); + // Add Tab box and Buttons to the top layout TopLayout->addWidget(aTabBox); TopLayout->addWidget(GroupButtons); @@ -141,25 +154,27 @@ VisuGUI_ScalarMapOnDeformedShapeDlg::VisuGUI_ScalarMapOnDeformedShapeDlg (Salome // signals and slots connections connect(buttonOk, SIGNAL(clicked()), this, SLOT(accept())); connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject())); + connect(buttonHelp, SIGNAL(clicked()), this, SLOT(onHelp())); connect(myFieldsCombo, SIGNAL(activated(int)), this, SLOT(onFieldChanged(int))); connect(myTimeStampsCombo, SIGNAL(activated(int)), this, SLOT(onTimeStampChanged(int))); - } -void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject (VISU::ScalarMapOnDeformedShape_i* thePrs,bool isAnim) +void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject + (VISU::ScalarMapOnDeformedShape_i* thePrs, bool isAnim) { + myIsAnimation = isAnim; myPrs = thePrs; - setFactor(thePrs->GetScale()); + setFactor(myPrs->GetScale()); myTimeStampsCombo->setDisabled(isAnim); - - QString aFieldName(thePrs->GetScalarFieldName()); - float aIterFloat = GetFloatValueOfTimeStamp(thePrs->GetMeshName().c_str(), - thePrs->GetScalarFieldName().c_str(), - thePrs->GetScalarIteration(), - thePrs->GetScalarEntity()); + + QString aFieldName(myPrs->GetScalarFieldName().c_str()); + float aIterFloat = GetFloatValueOfTimeStamp(myPrs->GetMeshName().c_str(), + myPrs->GetScalarFieldName().c_str(), + myPrs->GetScalarIteration(), + myPrs->GetScalarEntity()); QString aIteration(QString("%1").arg(aIterFloat)); - + if (myMeshFieldsTimes.size() == 0) { // find all fields and time stamps on it @@ -171,67 +186,109 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject (VISU::ScalarMapOnDe Handle(SALOME_InteractiveObject) aIO = selected.First(); if (aIO->hasEntry()) { _PTR(SObject) aSObject = aActiveStudy->FindObjectID(aIO->getEntry()); + + _PTR(GenericAttribute) anTmpAttr; + if (aSObject->FindAttribute(anTmpAttr, "AttributeComment")) { + _PTR(AttributeComment) aTmpComment (anTmpAttr); + string aTmpComm = aTmpComment->Value(); + QString aTmpstrIn (aTmpComm.c_str()); + VISU::Storable::TRestoringMap aTmpaMap; + VISU::Storable::StrToMap(aTmpstrIn,aTmpaMap); + bool aTmpisExist; + VISU::VISUType aTmpType = + (VISU::VISUType)VISU::Storable::FindValue(aTmpaMap,"myType",&aTmpisExist).toInt(); + switch(aTmpType){ + case VISU::TTIMESTAMP: + { + aSObject = aSObject->GetFather(); + aSObject = aSObject->GetFather(); + break; + } + case VISU::TFIELD: + { + _PTR(SObject) newSObject; + if(aSObject->ReferencedObject(newSObject)) aSObject = newSObject; + aSObject = aSObject->GetFather(); + break; + } + case VISU::TANIMATION: + { + _PTR(ChildIterator) aTmpIter = aActiveStudy->NewChildIterator(aSObject); + for (aTmpIter->InitEx(true); aTmpIter->More(); aTmpIter->Next()) { + _PTR(SObject) aTmpChildSObj = aTmpIter->Value(); + _PTR(SObject) newSObject; + if(aTmpChildSObj->ReferencedObject(newSObject)){ + aSObject = newSObject; + aSObject->GetFather(); + break; + } + } + break; + } + } + } + aSObject = aSObject->GetFather(); aSObject = aSObject->GetFather(); - aSObject = aSObject->GetFather(); - aSObject = aSObject->GetFather(); + mySelectionObj = aSObject; CORBA::Object_var anObject = VISU::ClientSObjectToObject(mySelectionObj); - VISU::Result_var aResult; if (CORBA::is_nil(anObject)) { mySelectionObj = mySelectionObj->GetFather(); } - _PTR(ChildIterator) aIter = aActiveStudy->NewChildIterator(mySelectionObj); - - for (aIter->InitEx(true); aIter->More(); aIter->Next()) { - _PTR(SObject) aChildSObj = aIter->Value(); - CORBA::Object_var aChildObject = VISU::ClientSObjectToObject(aChildSObj); - - _PTR(GenericAttribute) anAttr; - if (aChildSObj->FindAttribute(anAttr, "AttributeComment")) { - _PTR(AttributeComment) aComment (anAttr); - string aComm = aComment->Value(); - QString strIn (aComm.c_str()); - VISU::Storable::TRestoringMap aMap; - VISU::Storable::StrToMap(strIn,aMap); - bool isExist; - VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt(); - if (isExist) { - if ((aType == VISU::TTIMESTAMP)) { - _PTR(GenericAttribute) aNameAttr; - if (aChildSObj->FindAttribute(aNameAttr, "AttributeName")) { - _PTR(AttributeName) aName (aNameAttr); - VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow(aChildObject); - QString aMeshName = VISU::getValue(aChildSObj,"myMeshName"); - if(QString(thePrs->GetMeshName().c_str()) != aMeshName) continue; - myCurrMeshName = aMeshName; - QString aFieldName = VISU::getValue(aChildSObj,"myFieldName"); - QString aTimeIter = VISU::getValue(aChildSObj,"myTimeStampId"); - QString aEntity = VISU::getValue(aChildSObj,"myEntityId"); - VISU::TEntity anEntity; - switch(aEntity.toInt()){ - case 0: anEntity = VISU::NODE_ENTITY; break; - case 1: anEntity = VISU::EDGE_ENTITY; break; - case 2: anEntity = VISU::FACE_ENTITY; break; - case 3: anEntity = VISU::CELL_ENTITY; break; - } - TFT &aFieldsMap = myMeshFieldsTimes[aMeshName.latin1()]; - TFE aKey(aFieldName.latin1(),anEntity); - aFieldsMap[aKey][aTimeIter.toInt()] = - GetFloatValueOfTimeStamp(myPrs->GetMeshName().c_str(), - aFieldName.latin1(), - aTimeIter.toInt(), - anEntity); - } - } - } - } - } } } - - AddAllFieldNames(); + if (mySelectionObj) { + _PTR(ChildIterator) aIter = aActiveStudy->NewChildIterator(mySelectionObj); + + for (aIter->InitEx(true); aIter->More(); aIter->Next()) { + _PTR(SObject) aChildSObj = aIter->Value(); + CORBA::Object_var aChildObject = VISU::ClientSObjectToObject(aChildSObj); + + _PTR(GenericAttribute) anAttr; + if (aChildSObj->FindAttribute(anAttr, "AttributeComment")) { + _PTR(AttributeComment) aComment (anAttr); + string aComm = aComment->Value(); + QString strIn (aComm.c_str()); + VISU::Storable::TRestoringMap aMap; + VISU::Storable::StrToMap(strIn,aMap); + bool isExist; + VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt(); + if (isExist) { + if ((aType == VISU::TTIMESTAMP)) { + _PTR(GenericAttribute) aNameAttr; + if (aChildSObj->FindAttribute(aNameAttr, "AttributeName")) { + _PTR(AttributeName) aName (aNameAttr); + VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow(aChildObject); + QString aMeshName = VISU::getValue(aChildSObj, "myMeshName"); + if (QString(myPrs->GetMeshName().c_str()) != aMeshName) continue; + myCurrMeshName = aMeshName; + QString aFieldName = VISU::getValue(aChildSObj, "myFieldName"); + QString aTimeIter = VISU::getValue(aChildSObj, "myTimeStampId"); + QString aEntity = VISU::getValue(aChildSObj, "myEntityId"); + VISU::TEntity anEntity; + switch (aEntity.toInt()) { + case 0: anEntity = VISU::NODE_ENTITY; break; + case 1: anEntity = VISU::EDGE_ENTITY; break; + case 2: anEntity = VISU::FACE_ENTITY; break; + case 3: anEntity = VISU::CELL_ENTITY; break; + } + TFT &aFieldsMap = myMeshFieldsTimes[aMeshName.latin1()]; + TFE aKey (aFieldName.latin1(), anEntity); + aFieldsMap[aKey][aTimeIter.toInt()] = + GetFloatValueOfTimeStamp(myPrs->GetMeshName().c_str(), + aFieldName.latin1(), + aTimeIter.toInt(), + anEntity); + } + } + } + } + } + } + + AddAllFieldNames(); } myFieldsCombo->setCurrentText(aFieldName); AddAllTimes(myFieldsCombo->currentText()); @@ -241,21 +298,28 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::initFromPrsObject (VISU::ScalarMapOnDe myScalarPane->initFromPrsObject(myPrs); } -int VisuGUI_ScalarMapOnDeformedShapeDlg::storeToPrsObject(VISU::ScalarMapOnDeformedShape_i* thePrs, bool theUpdateScalar) { - +int VisuGUI_ScalarMapOnDeformedShapeDlg::storeToPrsObject + (VISU::ScalarMapOnDeformedShape_i* thePrs, bool theUpdateScalars, int theIter) +{ thePrs->SetScale(getFactor()); - - thePrs->SetScalarField(myPrs->GetScalarMeshName().c_str(), - myPrs->GetScalarFieldName().c_str(), - myPrs->GetScalarIteration(), - myPrs->GetScalarEntity()); - if (theUpdateScalar) SetScalarField(); + if (myIsAnimation) + thePrs->SetScalarField(myPrs->GetScalarMeshName().c_str(), + getCurrentScalarFieldName().latin1(), + theIter, + myPrs->GetScalarEntity()); + else + thePrs->SetScalarField(myPrs->GetScalarMeshName().c_str(), + getCurrentScalarFieldName().latin1(), + myTimeStampsCombo->currentItem() + 1, + myPrs->GetScalarEntity()); + + if (theUpdateScalars) SetScalarField(); thePrs->ShowColored(true); myScalarPane->storeToPrsObject(thePrs); - + myPrs = thePrs; return 1; @@ -304,7 +368,7 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::SetScalarField(int theIter,QString the aFieldName.latin1(), theIter, anEntity); - + myScalarPane->storeToPrsObject(myPrs); UpdateScalarField(); @@ -324,6 +388,20 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::reject() QDialog::reject(); } +void VisuGUI_ScalarMapOnDeformedShapeDlg::onHelp() +{ + QString aHelpFileName = "scalar_map_on_deformed_shape_presentation.htm"; + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) + app->onHelpContextModule(myVisuGUI ? app->moduleName(myVisuGUI->moduleName()) : QString(""), aHelpFileName); + else { + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + QObject::tr("BUT_OK")); + } +} + void VisuGUI_ScalarMapOnDeformedShapeDlg::AddAllFieldNames(){ TMF::const_iterator aIterMesh = myMeshFieldsTimes.begin(); for(;aIterMesh != myMeshFieldsTimes.end();aIterMesh++){ @@ -366,7 +444,7 @@ void VisuGUI_ScalarMapOnDeformedShapeDlg::onTimeStampChanged(int){ void VisuGUI_ScalarMapOnDeformedShapeDlg::UpdateScalarField(){ myPrs->SetScale(getFactor()); - float aRange[2]; + vtkFloatingPointType aRange[2]; myPrs->GetScalarMapOnDeformedShapePL()->Build(); myPrs->GetScalarMapOnDeformedShapePL()->Update(); myPrs->GetScalarMapOnDeformedShapePL()->GetSourceRange(aRange); diff --git a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.h b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.h index bf588c9e..7fb24fac 100644 --- a/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.h +++ b/src/VISUGUI/VisuGUI_ScalarMapOnDeformedShapeDlg.h @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -63,7 +63,7 @@ public: void initFromPrsObject(VISU::ScalarMapOnDeformedShape_i* thePrs,bool isAnim=false); - int storeToPrsObject(VISU::ScalarMapOnDeformedShape_i* thePrs,bool theUpdateScalar=true); + int storeToPrsObject(VISU::ScalarMapOnDeformedShape_i* thePrs,bool theUpdateScalars=true,int theIter=1); int getCurrentScalarFieldNamePos(); QString getCurrentScalarFieldName(); @@ -74,6 +74,7 @@ public: protected slots: void accept(); void reject(); + void onHelp(); private slots: void onFieldChanged(int i=0); @@ -92,6 +93,8 @@ private: TMF myMeshFieldsTimes; QString myCurrMeshName; + int myCurrScalarIter; + bool myIsAnimation; _PTR(SObject) mySelectionObj; VISU::ScalarMapOnDeformedShape_i* myPrs; diff --git a/src/VISUGUI/VisuGUI_Selection.cxx b/src/VISUGUI/VisuGUI_Selection.cxx index 5bcf465f..0f57d69e 100644 --- a/src/VISUGUI/VisuGUI_Selection.cxx +++ b/src/VISUGUI/VisuGUI_Selection.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -30,6 +30,7 @@ #include "VisuGUI.h" #include "VisuGUI_Tools.h" +#include "VisuGUI_ViewTools.h" #include "VISU_Actor.h" #include "VISU_PrsObject_i.hh" @@ -38,18 +39,19 @@ #include "SalomeApp_Study.h" #include "SalomeApp_Application.h" +#include "LightApp_Application.h" #include "LightApp_SelectionMgr.h" #include "LightApp_VTKSelector.h" #include "SUIT_MessageBox.h" #include "SUIT_ViewWindow.h" #include "SUIT_Session.h" +#include "SUIT_ResourceMgr.h" #include "SALOME_ListIO.hxx" #include "SALOME_ListIteratorOfListIO.hxx" #include "SVTK_ViewWindow.h" -#include "SVTK_ViewModel.h" #include "SVTK_Selector.h" #include "utilities.h" @@ -250,6 +252,9 @@ VisuGUI_SelectionDlg::VisuGUI_SelectionDlg (const SalomeApp_Module* theModule): QPushButton* aCloseBtn = new QPushButton (tr("BUT_CLOSE"), aBtnBox); connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(close())); + QPushButton* aHelpBtn = new QPushButton (tr("BUT_HELP"), aBtnBox); + connect(aHelpBtn, SIGNAL(clicked()), this, SLOT(onHelp())); + TopLayout->addWidget(aBtnBox, 3, 0); SalomeApp_Application* anApp = dynamic_cast @@ -263,7 +268,7 @@ VisuGUI_SelectionDlg::VisuGUI_SelectionDlg (const SalomeApp_Module* theModule): // Activate Points pane myWidgetStack->raiseWidget(myPointsPane); - if(SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myModule)) + if (SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow(myModule)) aViewWindow->SetSelectionMode(NodeSelection); onSelectionEvent(); @@ -276,7 +281,7 @@ VisuGUI_SelectionDlg::~VisuGUI_SelectionDlg() void VisuGUI_SelectionDlg::onSelectionChange (int theId) { - SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myModule); + SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow(myModule); if (!aViewWindow) return; switch (theId) { @@ -300,11 +305,10 @@ void VisuGUI_SelectionDlg::onSelectionChange (int theId) void VisuGUI_SelectionDlg::closeEvent (QCloseEvent* theEvent) { - if( mySelectionDlg ) - { + if (mySelectionDlg) { mySelectionDlg = NULL; disconnect(mySelectionMgr,0,0,0); - if(SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myModule)){ + if (SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow(myModule)) { switch(aViewWindow->SelectionMode()){ case NodeSelection: case CellSelection: @@ -318,7 +322,7 @@ void VisuGUI_SelectionDlg::closeEvent (QCloseEvent* theEvent) template QString getValue(TData* theData, int theId){ if (vtkDataArray *aScalar = theData->GetScalars()){ - float aVal = aScalar->GetTuple1(theId); + vtkFloatingPointType aVal = aScalar->GetTuple1(theId); return QString::number(aVal); } else { return QString("No data"); @@ -327,7 +331,7 @@ template QString getValue(TData* theData, int theId){ template QString getVector(TData* theData, int theId){ if (vtkDataArray *aVector = theData->GetVectors()) { - float *aVal = aVector->GetTuple3(theId); + vtkFloatingPointType *aVal = aVector->GetTuple3(theId); return QString("%1; %2; %3").arg(aVal[0]).arg(aVal[1]).arg(aVal[2]); } else { return QString("No data"); @@ -337,10 +341,10 @@ template QString getVector(TData* theData, int theId){ #define ABS(a) (a>=0)?a:-a void VisuGUI_SelectionDlg::onSelectionEvent() { - SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(myModule); + SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow(myModule); if (!aViewWindow) return; - switch(aViewWindow->SelectionMode()){ + switch (aViewWindow->SelectionMode()) { case NodeSelection: case CellSelection: case ActorSelection: @@ -413,7 +417,7 @@ void VisuGUI_SelectionDlg::onSelectionEvent() { VISU_Actor* anVISUActor = VISU::FindActor(aViewWindow, aSObject->GetID().c_str()); if (anVISUActor) { - float aCoord[6]; + vtkFloatingPointType aCoord[6]; anVISUActor->GetBounds(aCoord); myXPosLbl->setText(QString::number( aCoord[0] )); myYPosLbl->setText(QString::number( aCoord[2] )); @@ -424,7 +428,7 @@ void VisuGUI_SelectionDlg::onSelectionEvent() { myDZLbl->setText(QString::number( ABS(aCoord[5]-aCoord[4]) )); TColStd_IndexedMapOfInteger aMapIndex; - typedef map PointsMap; + typedef map PointsMap; PointsMap aPointsMap; aSelector->GetIndex(anIO, aMapIndex); @@ -438,7 +442,7 @@ void VisuGUI_SelectionDlg::onSelectionEvent() { switch (aType) { case 0: { - float* aCoord = anVISUActor->GetNodeCoord(anID); + vtkFloatingPointType* aCoord = anVISUActor->GetNodeCoord(anID); int aVTKID = anVISUActor->GetNodeVTKID(anID); myXValLbl->setText( QString::number( aCoord[0] ) ); myYValLbl->setText( QString::number( aCoord[1] ) ); @@ -462,7 +466,7 @@ void VisuGUI_SelectionDlg::onSelectionEvent() { myCellScalarValLbl->setText(getValue(aCellData, aVTKID)); myCellVectorValLbl->setText(getVector(aCellData, aVTKID)); - float* aCoord; + vtkFloatingPointType* aCoord; vtkIdList *aPointList = aCell->GetPointIds(); for (int i = 0; i < aNbOfPoints; i++) { @@ -483,7 +487,7 @@ void VisuGUI_SelectionDlg::onSelectionEvent() { myListPoints->verticalHeader()->setLabel(i, QString::number( i )); int id = It->first; myListPoints->setText(i, 0, QString::number( id )); - float* aCoord = It->second; + vtkFloatingPointType* aCoord = It->second; myListPoints->setText(i, 1, QString::number( aCoord[0] )); myListPoints->setText(i, 2, QString::number( aCoord[1] )); myListPoints->setText(i, 3, QString::number( aCoord[2] )); @@ -538,7 +542,7 @@ bool onIdEdit (const QString& theText, QLabel* theFieldName) { SalomeApp_Application* anApp = theModule->getApp(); - SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(theModule); + SVTK_ViewWindow* aViewWindow = VISU::GetActiveViewWindow(theModule); if (!aViewWindow) return false; SVTK_Selector* aSelector = aViewWindow->GetSelector(); @@ -618,3 +622,17 @@ void VisuGUI_SelectionDlg::onCellIdEdit (const QString& theText) else clearFields(); } + +void VisuGUI_SelectionDlg::onHelp() +{ + QString aHelpFileName = "/files/getting_elements_attributes.htm"; + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) + app->onHelpContextModule(myModule ? app->moduleName(myModule->moduleName()) : QString(""), aHelpFileName); + else { + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + QObject::tr("BUT_OK")); + } +} diff --git a/src/VISUGUI/VisuGUI_Selection.h b/src/VISUGUI/VisuGUI_Selection.h index 467e9c18..40da2d6c 100644 --- a/src/VISUGUI/VisuGUI_Selection.h +++ b/src/VISUGUI/VisuGUI_Selection.h @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -55,6 +55,7 @@ private slots: void onSelectionEvent (); void onPointIdEdit (const QString& theText); void onCellIdEdit (const QString& theText); + void onHelp(); private: void clearFields (); diff --git a/src/VISUGUI/VisuGUI_SetupPlot2dDlg.cxx b/src/VISUGUI/VisuGUI_SetupPlot2dDlg.cxx index 120785fa..f0e11c12 100644 --- a/src/VISUGUI/VisuGUI_SetupPlot2dDlg.cxx +++ b/src/VISUGUI/VisuGUI_SetupPlot2dDlg.cxx @@ -1,6 +1,21 @@ -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// +// 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 : VisuGUI_SetupPlot2dDlg.cxx // Author : Vadim SANDLER @@ -8,10 +23,15 @@ // $Header$ #include "VisuGUI_SetupPlot2dDlg.h" +#include "VisuGUI.h" #include "SPlot2d_Curve.h" #include "SUIT_Tools.h" #include "SUIT_MessageBox.h" +#include "SUIT_ResourceMgr.h" +#include "SUIT_Session.h" + +#include "LightApp_Application.h" #include #include @@ -183,20 +203,24 @@ VisuGUI_SetupPlot2dDlg::VisuGUI_SetupPlot2dDlg( _PTR(SObject) object, QWidget* p myView->setMinimumWidth( frame->sizeHint().width() + MARGIN_SIZE * 2 ); - /* OK/Cancel buttons */ + /* OK/Cancel/Help buttons */ myOkBtn = new QPushButton( tr( "BUT_OK" ), this, "buttonOk" ); myOkBtn->setAutoDefault( TRUE ); myOkBtn->setDefault( TRUE ); myCancelBtn = new QPushButton( tr( "BUT_CANCEL" ), this, "buttonCancel" ); myCancelBtn->setAutoDefault( TRUE ); + myHelpBtn = new QPushButton( tr( "BUT_HELP" ), this, "buttonHelp" ); + myHelpBtn->setAutoDefault( TRUE ); - topLayout->addMultiCellWidget( myView, 0, 0, 0, 2 ); + topLayout->addMultiCellWidget( myView, 0, 0, 0, 3 ); topLayout->addWidget( myOkBtn, 1, 0 ); topLayout->setColStretch( 1, 5 ); topLayout->addWidget( myCancelBtn, 1, 2 ); + topLayout->addWidget( myHelpBtn, 1, 3 ); connect( myOkBtn, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( myCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) ); + connect( myHelpBtn, SIGNAL( clicked() ), this, SLOT( onHelp() ) ); enableControls(); @@ -426,6 +450,24 @@ void VisuGUI_SetupPlot2dDlg::onVBtnToggled( bool on ) } enableControls(); } +/*! + Slot, called when button is clicked +*/ +void VisuGUI_SetupPlot2dDlg::onHelp() +{ + QString aHelpFileName = "/files/creating_curves.htm"; + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) { + VisuGUI* aVisuGUI = dynamic_cast( app->activeModule() ); + app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName); + } + else { + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + QObject::tr("BUT_OK")); + } +} /*! Enables/disables buttons */ diff --git a/src/VISUGUI/VisuGUI_SetupPlot2dDlg.h b/src/VISUGUI/VisuGUI_SetupPlot2dDlg.h index 1ce1e2aa..4332f048 100644 --- a/src/VISUGUI/VisuGUI_SetupPlot2dDlg.h +++ b/src/VISUGUI/VisuGUI_SetupPlot2dDlg.h @@ -1,11 +1,25 @@ -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// +// 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 : VisuGUI_SetupPlot2dDlg.h // Author : Vadim SANDLER // Module : SALOME -// $Header$ #ifndef VISUGUI_SetupPlot2dDlg_H #define VISUGUI_SetupPlot2dDlg_H @@ -46,12 +60,14 @@ public: private slots: void onHBtnToggled( bool ); void onVBtnToggled( bool ); + void onHelp(); void enableControls(); private: QScrollView* myView; QPushButton* myOkBtn; QPushButton* myCancelBtn; + QPushButton* myHelpBtn; QPtrList myItems; _PTR(SObject) myObject; diff --git a/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx b/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx index aba09d66..d1615223 100644 --- a/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx +++ b/src/VISUGUI/VisuGUI_StreamLinesDlg.cxx @@ -1,8 +1,21 @@ -// VISU VISUGUI : GUI of VISU component -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// +// 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 : VisuGUI_StreamLinesDlg.cxx // Author : Vitaly SMETANNIKOV @@ -20,11 +33,13 @@ #include "VISU_Actor.h" #include "SalomeApp_Application.h" +#include "LightApp_Application.h" #include "LightApp_SelectionMgr.h" #include "SVTK_ViewWindow.h" #include "SUIT_Desktop.h" +#include "SUIT_Session.h" #include "SUIT_ResourceMgr.h" #include "SUIT_MessageBox.h" @@ -82,8 +97,7 @@ VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule) connect(myUseSrcCombo, SIGNAL(activated(int)), this, SLOT(onSourceTypeChange(int))); - // Find All prs obj - //SUIT_Study* aActiveStudy = VISU::(myVisuGUI); + // Find all fields and time stamps on it _PTR(Study) aActiveStudy = VISU::GetCStudy(VISU::GetAppStudy(myVisuGUI)); LightApp_SelectionMgr* aSel = VISU::GetSelectionMgr(myVisuGUI); SALOME_ListIO selected; @@ -92,71 +106,114 @@ VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule) Handle(SALOME_InteractiveObject) aIO = selected.First(); if (aIO->hasEntry()) { _PTR(SObject) aSObject = aActiveStudy->FindObjectID(aIO->getEntry()); + + _PTR(GenericAttribute) anTmpAttr; + if (aSObject->FindAttribute(anTmpAttr, "AttributeComment")) { + _PTR(AttributeComment) aTmpComment (anTmpAttr); + string aTmpComm = aTmpComment->Value(); + QString aTmpstrIn (aTmpComm.c_str()); + VISU::Storable::TRestoringMap aTmpaMap; + VISU::Storable::StrToMap(aTmpstrIn,aTmpaMap); + bool aTmpisExist; + VISU::VISUType aTmpType = + (VISU::VISUType)VISU::Storable::FindValue(aTmpaMap,"myType",&aTmpisExist).toInt(); + switch (aTmpType) { + case VISU::TTIMESTAMP: + { + aSObject = aSObject->GetFather(); + aSObject = aSObject->GetFather(); + break; + } + case VISU::TFIELD: + { + _PTR(SObject) newSObject; + if(aSObject->ReferencedObject(newSObject)) aSObject = newSObject; + aSObject = aSObject->GetFather(); + break; + } + case VISU::TANIMATION: + { + _PTR(ChildIterator) aTmpIter = aActiveStudy->NewChildIterator(aSObject); + for (aTmpIter->InitEx(true); aTmpIter->More(); aTmpIter->Next()) { + _PTR(SObject) aTmpChildSObj = aTmpIter->Value(); + _PTR(SObject) newSObject; + if(aTmpChildSObj->ReferencedObject(newSObject)){ + aSObject = newSObject; + aSObject->GetFather(); + break; + } + } + break; + } + } + } + aSObject = aSObject->GetFather(); aSObject = aSObject->GetFather(); - aSObject = aSObject->GetFather(); - aSObject = aSObject->GetFather(); + mySelectionObj = aSObject; CORBA::Object_var anObject = VISU::ClientSObjectToObject(mySelectionObj); - VISU::Result_var aResult; if (CORBA::is_nil(anObject)) { mySelectionObj = mySelectionObj->GetFather(); } - _PTR(ChildIterator) aIter = aActiveStudy->NewChildIterator(mySelectionObj); - - for (aIter->InitEx(true); aIter->More(); aIter->Next()) { - _PTR(SObject) aChildSObj = aIter->Value(); - CORBA::Object_var aChildObject = VISU::ClientSObjectToObject(aChildSObj); - - if (!CORBA::is_nil(aChildObject)) { - VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow(aChildObject); - if (!CORBA::is_nil(aPrsObj)) { // if this is a Prs object - if ((aPrsObj->GetType() != VISU::TSTREAMLINES) && - (aPrsObj->GetType() != VISU::TMESH)) { - _PTR(GenericAttribute) anAttr; - if (aChildSObj->FindAttribute(anAttr, "AttributeName")) { - _PTR(AttributeName) aName (anAttr); - myPrsLst += QString(aName->Value().c_str()); - myPrsList.append(aPrsObj); - continue; - } - } - } - } - // else { // This is not a Prs object - _PTR(GenericAttribute) anAttr; - if (aChildSObj->FindAttribute(anAttr, "AttributeComment")) { - _PTR(AttributeComment) aComment (anAttr); - string aComm = aComment->Value(); - QString strIn (aComm.c_str()); - VISU::Storable::TRestoringMap aMap; - VISU::Storable::StrToMap(strIn,aMap); - bool isExist; - VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt(); - if (isExist) { - if ((aType == VISU::TFAMILY) || (aType == VISU::TGROUP) || (aType == VISU::TENTITY)) { - _PTR(GenericAttribute) aNameAttr; - if (aChildSObj->FindAttribute(aNameAttr, "AttributeName")) { - _PTR(AttributeName) aName (aNameAttr); - VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow(aChildObject); - switch (aType) { - case VISU::TFAMILY: - myFamilisLst += QString(aName->Value().c_str()); - myFamilyList.append(aPrsObj); - break; - case VISU::TGROUP: - myGroupsLst += QString(aName->Value().c_str()); - myGroupList.append(aPrsObj); - break; - case VISU::TENTITY: - myEntitiesLst += QString(aName->Value().c_str()); - myEntityList.append(aPrsObj); - break; - } - } - } - } - } + } + } + + if (mySelectionObj) { + _PTR(ChildIterator) aIter = aActiveStudy->NewChildIterator(mySelectionObj); + + for (aIter->InitEx(true); aIter->More(); aIter->Next()) { + _PTR(SObject) aChildSObj = aIter->Value(); + CORBA::Object_var aChildObject = VISU::ClientSObjectToObject(aChildSObj); + + if (!CORBA::is_nil(aChildObject)) { + VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow(aChildObject); + if (!CORBA::is_nil(aPrsObj)) { // if this is a Prs object + if ((aPrsObj->GetType() != VISU::TSTREAMLINES) && + (aPrsObj->GetType() != VISU::TMESH)) { + _PTR(GenericAttribute) anAttr; + if (aChildSObj->FindAttribute(anAttr, "AttributeName")) { + _PTR(AttributeName) aName (anAttr); + myPrsLst += QString(aName->Value().c_str()); + myPrsList.append(aPrsObj); + continue; + } + } + } + } + + _PTR(GenericAttribute) anAttr; + if (aChildSObj->FindAttribute(anAttr, "AttributeComment")) { + _PTR(AttributeComment) aComment (anAttr); + string aComm = aComment->Value(); + QString strIn (aComm.c_str()); + VISU::Storable::TRestoringMap aMap; + VISU::Storable::StrToMap(strIn,aMap); + bool isExist; + VISU::VISUType aType = (VISU::VISUType)VISU::Storable::FindValue(aMap,"myType",&isExist).toInt(); + if (isExist) { + if ((aType == VISU::TFAMILY) || (aType == VISU::TGROUP) || (aType == VISU::TENTITY)) { + _PTR(GenericAttribute) aNameAttr; + if (aChildSObj->FindAttribute(aNameAttr, "AttributeName")) { + _PTR(AttributeName) aName (aNameAttr); + VISU::Prs3d_var aPrsObj = VISU::Prs3d::_narrow(aChildObject); + switch (aType) { + case VISU::TFAMILY: + myFamilisLst += QString(aName->Value().c_str()); + myFamilyList.append(aPrsObj); + break; + case VISU::TGROUP: + myGroupsLst += QString(aName->Value().c_str()); + myGroupList.append(aPrsObj); + break; + case VISU::TENTITY: + myEntitiesLst += QString(aName->Value().c_str()); + myEntityList.append(aPrsObj); + break; + } + } + } + } } } } @@ -235,8 +292,14 @@ VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule) QPushButton* aCancelBtn = new QPushButton( tr( "&Cancel" ) , aGroupButtons, "buttonCancel" ); aCancelBtn->setAutoDefault( TRUE ); aGroupButtonsLayout->addWidget( aCancelBtn, 0, 2 ); + + QPushButton* aHelpBtn = new QPushButton( tr( "&Help" ) , aGroupButtons, "buttonHelp" ); + aHelpBtn->setAutoDefault( TRUE ); + aGroupButtonsLayout->addWidget( aHelpBtn, 0, 3 ); + connect( aOkBtn, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( aCancelBtn, SIGNAL( clicked() ), this, SLOT( reject() ) ); + connect( aHelpBtn, SIGNAL( clicked() ), this, SLOT( onHelp() ) ); aBoxLayout->addWidget(aGroupButtons); @@ -244,7 +307,6 @@ VisuGUI_StreamLinesDlg::VisuGUI_StreamLinesDlg (SalomeApp_Module* theModule) } - void VisuGUI_StreamLinesDlg::initFromPrsObject (VISU::StreamLines_i* thePrs) { myScalarPane->initFromPrsObject(thePrs); @@ -552,3 +614,17 @@ void VisuGUI_StreamLinesDlg::reject() myScalarPane->deletePreview(); QDialog::reject(); } + +void VisuGUI_StreamLinesDlg::onHelp() +{ + QString aHelpFileName = "/files/stream_lines_presentation.htm"; + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) + app->onHelpContextModule(myVisuGUI ? app->moduleName(myVisuGUI->moduleName()) : QString(""), aHelpFileName); + else { + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + QObject::tr("BUT_OK")); + } +} diff --git a/src/VISUGUI/VisuGUI_StreamLinesDlg.h b/src/VISUGUI/VisuGUI_StreamLinesDlg.h index a4485ff8..b1e33ac3 100644 --- a/src/VISUGUI/VisuGUI_StreamLinesDlg.h +++ b/src/VISUGUI/VisuGUI_StreamLinesDlg.h @@ -1,8 +1,21 @@ -// VISU VISUGUI : GUI of VISU component -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// +// 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 : VisuGUI_StreamLinesDlg.h // Author : Vitaly SMETANNIKOV @@ -40,9 +53,10 @@ public: protected slots: void accept(); void reject(); + void onHelp(); private slots: - //void onSelectionActive(bool theActive); +//VSR: 08/06/06: void onSelectionActive(bool theActive); void StepLengthChanged(double theValue); void IntegrationStepChanged(double theValue); void PropagationTimeChanged(double theValue); diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.cxx b/src/VISUGUI/VisuGUI_TimeAnimation.cxx index 476721a5..ce4110d9 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.cxx +++ b/src/VISUGUI/VisuGUI_TimeAnimation.cxx @@ -1,8 +1,21 @@ -// VISU VISUGUI : GUI of VISU component -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// +// 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 : VisuGUI_TimeAnimation.cxx // Author : Vitaly SMETANNIKOV @@ -12,6 +25,7 @@ #include "VisuGUI.h" #include "VisuGUI_Tools.h" +#include "VisuGUI_ViewTools.h" #include "VisuGUI_DeformedShapeDlg.h" #include "VisuGUI_CutPlanesDlg.h" #include "VisuGUI_CutLinesDlg.h" @@ -41,12 +55,14 @@ #include "VISU_Actor.h" #include "SalomeApp_Study.h" -#include "SalomeApp_Application.h" +#include "LightApp_Application.h" #include "SVTK_ViewWindow.h" #include "SUIT_OverrideCursor.h" #include "SUIT_MessageBox.h" +#include "SUIT_ResourceMgr.h" +#include "SUIT_Session.h" #include "SUIT_Desktop.h" #include "SUIT_FileDlg.h" @@ -68,15 +84,17 @@ #define MAXVAL 1e10 ArrangeDlg::ArrangeDlg(QWidget* theParent, VISU_TimeAnimation* theAnimator) - : QDialog(theParent, "ArrangeDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), - myAnimator(theAnimator), myViewWindow(theAnimator->getViewer()) + : QDialog(theParent, "ArrangeDlg", true, + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), + myAnimator(theAnimator), + myViewWindow(theAnimator->getViewer()) { myCurrent = 0; init(); QStringList aFieldNames; // Find names of fields - for (int i = 0; i < theAnimator->getNbFields(); i++) { - aFieldNames.append(VISU::getValue(theAnimator->getFieldData(i).myField, "myName")); + for (int i = 0; i < myAnimator->getNbFields(); i++) { + aFieldNames.append(VISU::getValue(myAnimator->getFieldData(i).myField, "myName")); Offset aOffs; aOffs.myOffset[0] = myAnimator->getFieldData(i).myOffset[0]; aOffs.myOffset[1] = myAnimator->getFieldData(i).myOffset[1]; @@ -90,7 +108,7 @@ ArrangeDlg::ArrangeDlg(QWidget* theParent, VISU_TimeAnimation* theAnimator) ArrangeDlg::ArrangeDlg(QWidget* theParent, SVTK_ViewWindow* theViewWindow) : QDialog(theParent, "ArrangeDlg", true, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu), - myAnimator(0), myViewWindow(theViewWindow) + myAnimator(NULL), myViewWindow(theViewWindow) { myCurrent = 0; init(); @@ -242,7 +260,7 @@ void ArrangeDlg::init() void ArrangeDlg::accept() { - if (myAnimator) { + if (myAnimator != NULL) { acceptAnimation(); } else { acceptViewWindow(); @@ -282,14 +300,12 @@ void ArrangeDlg::acceptAnimation() } } else { QApplication::setOverrideCursor( Qt::waitCursor ); - FieldData& aData = myAnimator->getFieldData(0); + FieldData& aData = myAnimator->getFieldData(myFieldLst->currentItem()); if (aData.myPrs.empty()) - myAnimator->generatePresentations(0); - VISU_Actor* aActor = aData.myPrs[0]->CreateActor(); - float aBounds[6]; - aActor->GetBounds(aBounds); - aActor->Delete(); - float aDist = 0; + myAnimator->generatePresentations(myFieldLst->currentItem()); + vtkFloatingPointType aBounds[6]; + aData.myPrs[0]->GetBounds(aBounds); + vtkFloatingPointType aDist = 0; int aAxis = getAxis(); switch (aAxis) { case XAxis: @@ -302,10 +318,10 @@ void ArrangeDlg::acceptAnimation() aDist = fabs(aBounds[5] - aBounds[4]); } - float dx = fabs(aBounds[1] - aBounds[0]); - float dy = fabs(aBounds[3] - aBounds[2]); - float dz = fabs(aBounds[5] - aBounds[4]); - float max = (dx > dy) ? dx : dy; + vtkFloatingPointType dx = fabs(aBounds[1] - aBounds[0]); + vtkFloatingPointType dy = fabs(aBounds[3] - aBounds[2]); + vtkFloatingPointType dz = fabs(aBounds[5] - aBounds[4]); + vtkFloatingPointType max = (dx > dy) ? dx : dy; max = (dz > max) ? dz : max; max /= 100.0; @@ -348,13 +364,13 @@ void ArrangeDlg::acceptViewWindow() anActor->SetPosition(aOffs.myOffset); if (mySaveChk) if (mySaveChk->isChecked()) - aPrs->SetOffset(aOffs.myOffset); + aPrs->SetOffset(aOffs.myOffset[0],aOffs.myOffset[1],aOffs.myOffset[2]); } } else { - float aDist = 0; - float aShift = 0; - float aPrevDist = 0; - float aPrevShift = 0; + vtkFloatingPointType aDist = 0; + vtkFloatingPointType aShift = 0; + vtkFloatingPointType aPrevDist = 0; + vtkFloatingPointType aPrevShift = 0; int i; QMap::Iterator it; for (it = myPrsMap.begin(), i = 0; it != myPrsMap.end(); ++it, i++) { @@ -362,12 +378,12 @@ void ArrangeDlg::acceptViewWindow() if (VISU_Actor* aActor = VISU::GetActor(aPrs, myViewWindow)) { int aAxis = getAxis(); - float aZeroOffset[3]; + vtkFloatingPointType aZeroOffset[3]; aZeroOffset[0] = aZeroOffset[1] = aZeroOffset[2] = 0; aActor->SetPosition(aZeroOffset); aActor->GetMapper()->Update(); - float aBounds[6]; + vtkFloatingPointType aBounds[6]; aActor->GetBounds(aBounds); switch (aAxis) { case XAxis: @@ -379,18 +395,18 @@ void ArrangeDlg::acceptViewWindow() case ZAxis: aDist = fabs(aBounds[5] - aBounds[4]); } - float aOffset[3]; + vtkFloatingPointType aOffset[3]; aOffset[0] = aOffset[1] = aOffset[2] = 0; aOffset[aAxis] = (aBounds[2*aAxis+1] < aBounds[2*aAxis]) ? -aBounds[2*aAxis+1] : -aBounds[2*aAxis]; if (i > 0) { - float aCCDist = (aDist + aPrevDist) / 2.0; + vtkFloatingPointType aCCDist = (aDist + aPrevDist) / 2.0; - float dx = fabs(aBounds[1] - aBounds[0]); - float dy = fabs(aBounds[3] - aBounds[2]); - float dz = fabs(aBounds[5] - aBounds[4]); - float max = (dx > dy) ? dx : dy; + vtkFloatingPointType dx = fabs(aBounds[1] - aBounds[0]); + vtkFloatingPointType dy = fabs(aBounds[3] - aBounds[2]); + vtkFloatingPointType dz = fabs(aBounds[5] - aBounds[4]); + vtkFloatingPointType max = (dx > dy) ? dx : dy; max = (dz > max) ? dz : max; max /= 100.0; @@ -425,7 +441,7 @@ void ArrangeDlg::acceptViewWindow() aActor->SetPosition(aOffset); if (mySaveChk) if (mySaveChk->isChecked()) - aPrs->SetOffset(aOffset); + aPrs->SetOffset(aOffset[0],aOffset[1],aOffset[2]); aPrevDist = aDist; aPrevShift = aShift; @@ -456,6 +472,7 @@ SetupDlg::SetupDlg (QWidget* theParent, QVBoxLayout* aMainLayout = new QVBoxLayout(this, 7, 6); aMainLayout->setSpacing(5); + // Range of time stamps QFrame* aRangeGrp = new QFrame(this); QGridLayout* aRangeLayout = new QGridLayout( aRangeGrp ); aRangeLayout->setSpacing( 6 ); @@ -466,16 +483,19 @@ SetupDlg::SetupDlg (QWidget* theParent, aRangeLayout->addMultiCellWidget(myUseRangeChk, 0, 0, 0, 3); myUseRangeChk->setChecked(myAnimator->isRangeDefined()); + double aMaxTime = myAnimator->getMaxTime(); + double aMinTime = myAnimator->getMinTime(); + double aStep = (aMaxTime - aMinTime) / (myAnimator->getFieldData(0).myNbTimes - 1); + QLabel* aMinLbl = new QLabel("From", aRangeGrp); aMinLbl->setEnabled(myUseRangeChk->isChecked()); aRangeLayout->addWidget(aMinLbl, 1, 0); - double aStep = (myAnimator->getMaxTime() - myAnimator->getMinTime())/(theAnimator->getFieldData(0).myNbTimes - 1); - myMinVal = new QtxDblSpinBox( myAnimator->getMinTime(), myAnimator->getMaxTime(), aStep, aRangeGrp ); + myMinVal = new QtxDblSpinBox( aMinTime, aMaxTime, aStep, aRangeGrp ); myMinVal->setEnabled(myUseRangeChk->isChecked()); if (myUseRangeChk->isChecked()) myMinVal->setValue( myAnimator->getMinRange() ); else - myMinVal->setValue( myAnimator->getMinTime() ); + myMinVal->setValue( aMinTime ); connect(myMinVal, SIGNAL( valueChanged(double)), this, SLOT( onMinValue(double) )); @@ -484,12 +504,12 @@ SetupDlg::SetupDlg (QWidget* theParent, QLabel* aMaxLbl = new QLabel("To", aRangeGrp); aMaxLbl->setEnabled(myUseRangeChk->isChecked()); aRangeLayout->addWidget(aMaxLbl, 1, 2); - myMaxVal = new QtxDblSpinBox( myAnimator->getMinTime(), myAnimator->getMaxTime(), aStep, aRangeGrp ); + myMaxVal = new QtxDblSpinBox( aMinTime, aMaxTime, aStep, aRangeGrp ); myMaxVal->setEnabled(myUseRangeChk->isChecked()); if (myUseRangeChk->isChecked()) myMaxVal->setValue( myAnimator->getMaxRange() ); else - myMaxVal->setValue( myAnimator->getMaxTime() ); + myMaxVal->setValue( aMaxTime ); connect(myMaxVal, SIGNAL( valueChanged(double)), this, SLOT( onMaxValue(double) )); @@ -505,6 +525,7 @@ SetupDlg::SetupDlg (QWidget* theParent, aMainLayout->addWidget(aRangeGrp); + // Fields and Properties QHBox* aPropFrame = new QHBox(this); aPropFrame->setSpacing(5); @@ -512,8 +533,8 @@ SetupDlg::SetupDlg (QWidget* theParent, myFieldLst = new QListBox(aNamesBox); QStringList aFieldNames; // Find names of fields - for (int i = 0; i < theAnimator->getNbFields(); i++) { - _PTR(SObject) aSO = theAnimator->getFieldData(i).myField; + for (int i = 0; i < myAnimator->getNbFields(); i++) { + _PTR(SObject) aSO = myAnimator->getFieldData(i).myField; aFieldNames.append(VISU::getValue(aSO, "myName")); } myFieldLst->insertStringList(aFieldNames); @@ -536,7 +557,7 @@ SetupDlg::SetupDlg (QWidget* theParent, // this, SLOT( onScalarBarDlg() ) ); myPropBtn = new QPushButton("Properties...", aPropBox); - // myPropBtn->setEnabled(theAnimator->getFieldData(0).myPrsType != VISU::TSCALARMAP); + // myPropBtn->setEnabled(myAnimator->getFieldData(0).myPrsType != VISU::TSCALARMAP); connect( myPropBtn, SIGNAL( clicked() ), this, SLOT( onPreferencesDlg() ) ); @@ -647,7 +668,7 @@ void SetupDlg::onFieldChange (int theIndex) myTypeCombo->setCurrentItem(myTypeId2ComboId[TDEFORMEDSHAPE_ITEM]); break; case VISU::TSCALARMAPONDEFORMEDSHAPE: //Scalar Map on Deformed Shape - myTypeCombo->setCurrentItem(TSCALARMAPONDEFORMEDSHAPE_ITEM); + myTypeCombo->setCurrentItem(myTypeId2ComboId[TSCALARMAPONDEFORMEDSHAPE_ITEM]); break; case VISU::TVECTORS: //Vectors myTypeCombo->setCurrentItem(myTypeId2ComboId[TVECTORS_ITEM]); @@ -730,6 +751,15 @@ void SetupDlg::onPreferencesDlg() if (aData.myPrs.empty()) myAnimator->generatePresentations(myFieldLst->currentItem()); + if(!aData.myNbFrames || !aData.myPrs[0]){ + QApplication::restoreOverrideCursor(); + SUIT_MessageBox::warn1(this, + tr("ERROR"), + VisuGUI_TimeAnimationDlg::tr("MSG_NO_ANIMATIONDATA"), + tr("&OK")); + return; + } + int aType = myComboId2TypeId[myTypeCombo->currentItem()]; switch (aType) { case TSCALARMAP_ITEM: //Scalar Map @@ -766,13 +796,13 @@ void SetupDlg::onPreferencesDlg() if (aDlg->exec()) { int anbFrames=aDlg->getCurrentScalarNbIterations(); + int aIter = 0; for (int i = 0; i < aData.myNbFrames; i++){ TYPE* aCurrPrs_i = dynamic_cast(aData.myPrs[i]); + aIter = i+1; if(i+1 > anbFrames) - aDlg->SetScalarField(anbFrames); - else - aDlg->SetScalarField(i+1); - aDlg->storeToPrsObject(aCurrPrs_i,false); + aIter=anbFrames; + aDlg->storeToPrsObject(aCurrPrs_i,false,aIter); } } delete aDlg; @@ -970,7 +1000,7 @@ VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg (VisuGUI* theModule, _PTR(Stu myAnimator = new VISU_TimeAnimation (theStudy); myAnimator->setSpeed(1); - myAnimator->setViewer(VISU::GetViewWindow(theModule)); + myAnimator->setViewer(VISU::GetActiveViewWindow(theModule)); connect(myAnimator, SIGNAL(frameChanged(long, double)), this, SLOT(onExecution(long, double))); connect(myAnimator, SIGNAL(stopped()), this, SLOT(onStop())); @@ -1076,6 +1106,8 @@ VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg (VisuGUI* theModule, _PTR(Stu aSaveLay->setMargin( 5 ); mySaveCheck = new QCheckBox("Save pictures to directory", aSaveBox); + connect(mySaveCheck, SIGNAL( toggled(bool)), + this, SLOT( onCheckDump(bool) )); aSaveLay->addMultiCellWidget(mySaveCheck, 0, 0, 0, 2); QLabel* aFormatLbl = new QLabel("Saving format:", aSaveBox); @@ -1097,6 +1129,8 @@ VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg (VisuGUI* theModule, _PTR(Stu aSaveLay->addWidget(myPicsFormat, 1, 2); connect(mySaveCheck, SIGNAL( toggled(bool)), myPicsFormat, SLOT( setEnabled(bool) )); + connect(myPicsFormat, SIGNAL( activated (int)), + this, SLOT( onPicsFormatChanged())); QLabel* aPathLbl = new QLabel("Path:", aSaveBox); aPathLbl->setEnabled(false); @@ -1120,6 +1154,35 @@ VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg (VisuGUI* theModule, _PTR(Stu mySaveCheck->setChecked(false); aSaveLay->addWidget(aBrowseBtn, 2, 2); + mySaveAVICheck = new QCheckBox("Save animation to AVI file", aSaveBox); + connect(mySaveAVICheck, SIGNAL( toggled(bool)), + this, SLOT( onCheckDump(bool) )); + aSaveLay->addMultiCellWidget(mySaveAVICheck, 3, 3, 0, 2); + + QLabel* aPathAVILbl = new QLabel("Path:", aSaveBox); + aPathAVILbl->setEnabled(false); + connect(mySaveAVICheck, SIGNAL( toggled(bool)), + aPathAVILbl, SLOT( setEnabled(bool) )); + aSaveLay->addWidget(aPathAVILbl, 4, 0); + + myPathAVIEdit = new QLineEdit(aSaveBox); + myPathAVIEdit->setReadOnly(true); + myPathAVIEdit->setEnabled(false); + connect(mySaveAVICheck, SIGNAL( toggled(bool)), + myPathAVIEdit, SLOT( setEnabled(bool) )); + aSaveLay->addWidget(myPathAVIEdit, 4, 1); + + QPushButton* aBrowseAVIBtn = new QPushButton("Browse...", aSaveBox); + aBrowseAVIBtn->setEnabled(false); + connect(mySaveAVICheck, SIGNAL( toggled(bool)), + aBrowseAVIBtn, SLOT( setEnabled(bool) )); + connect(aBrowseAVIBtn, SIGNAL( clicked()), + this, SLOT( onBrowseAVI() )); + aSaveLay->addWidget(aBrowseAVIBtn, 4, 2); + + mySaveAVICheck->setChecked(false); + mySaveAVICheck->setEnabled(myAnimator->checkAVIMaker()); + TopLayout->addMultiCellWidget(aSaveBox, 7, 7, 0, 3); aMainLayout->addWidget(myPlayFrame); @@ -1145,9 +1208,15 @@ VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg (VisuGUI* theModule, _PTR(Stu QPushButton* aCloseBtn = new QPushButton(tr("BUT_CLOSE"), aBtnBox); connect(aCloseBtn, SIGNAL(clicked()), this, SLOT(close())); + QPushButton* aHelpBtn = new QPushButton(tr("BUT_HELP"), aBtnBox); + connect(aHelpBtn, SIGNAL(clicked()), this, SLOT(onHelp())); + SUIT_Study* aStudy = VISU::GetAppStudy(myModule); connect(aStudy, SIGNAL(destroyed()), this, SLOT(close())); + connect(myAnimator->getViewer(), SIGNAL(destroyed()), this, SLOT(close())); + connect(myAnimator->getViewer(), SIGNAL(closing(SUIT_ViewWindow*)), this, SLOT(close())); + aMainLayout->addWidget(aBtnBox); myPlayFrame->setEnabled(false); @@ -1156,7 +1225,11 @@ VisuGUI_TimeAnimationDlg::VisuGUI_TimeAnimationDlg (VisuGUI* theModule, _PTR(Stu //------------------------------------------------------------------------ VisuGUI_TimeAnimationDlg::~VisuGUI_TimeAnimationDlg() { - delete myAnimator; + if(myAnimator != NULL){ + delete myAnimator; + myAnimator = NULL; + VISU::GetActiveViewWindow(myModule)->Repaint(); + } } //------------------------------------------------------------------------ @@ -1215,9 +1288,12 @@ void VisuGUI_TimeAnimationDlg::onPlayPressed() if (myPlayBtn->isOn() && (!myAnimator->running())) { myPlayBtn->setIconSet(MYpausePixmap); if (mySaveCheck->isChecked()) { - QStrList aDumpFormats = QImageIO::outputFormats(); - myAnimator->setDumpFormat(aDumpFormats.at(myPicsFormat->currentItem())); - myAnimator->dumpTo(myPathEdit->text()); + onPicsFormatChanged(); + onPathChanged(); + + } else if (mySaveAVICheck->isChecked()) { + myAnimator->setDumpFormat("AVI"); + myAnimator->dumpTo(myPathAVIEdit->text()); } else { myAnimator->dumpTo(""); } @@ -1269,14 +1345,32 @@ void VisuGUI_TimeAnimationDlg::showEvent(QShowEvent* theEvent) mySetupDlg = new SetupDlg(this,myModule, myAnimator); } +void VisuGUI_TimeAnimationDlg::reject() +{ + close(); + QDialog::reject(); +} + //------------------------------------------------------------------------ void VisuGUI_TimeAnimationDlg::closeEvent (QCloseEvent* theEvent) { - myAnimator->stopAnimation(); - myAnimator->wait(500); - if (myAnimator->running() && (! myAnimator->finished())) { - isClosing = true; - myEvent = theEvent; + if(myAnimator != NULL){ + myAnimator->stopAnimation(); + myAnimator->wait(500); + if (myAnimator->running() && (! myAnimator->finished())) { + isClosing = true; + myEvent = theEvent; + // * Destroing data in myAnimator before study closed. + // * It needed for correcting destroing of myAnimator, which + // * depend from SVTK_RenderWindowInteractor() e.t.c. + if(theEvent->type() == QEvent::Close){ + for (int i = 0; i < myAnimator->getNbFields(); i++) + myAnimator->clearData(myAnimator->getFieldData(i)); + myAnimator->clearFieldData(); + } + } else { + QDialog::closeEvent(theEvent); + } } else { QDialog::closeEvent(theEvent); } @@ -1324,9 +1418,59 @@ void VisuGUI_TimeAnimationDlg::onSetupDlg() //------------------------------------------------------------------------ void VisuGUI_TimeAnimationDlg::onBrowse() { - QString aPath = SUIT_FileDlg::getExistingDirectory(this, "/", "Select path"); + // QString aPath = SUIT_FileDlg::getExistingDirectory(this, "/", "Select path"); + QString aDir; + if (myPathEdit->text().isEmpty()) + aDir = getenv("HOME"); + else + aDir = myPathEdit->text(); + QString aPath = SUIT_FileDlg::getExistingDirectory(this, aDir, "Select path"); if (!aPath.isEmpty()) myPathEdit->setText(Qtx::addSlash(aPath)); + onPathChanged(); +} + +//------------------------------------------------------------------------ +void VisuGUI_TimeAnimationDlg::onBrowseAVI() +{ + QStringList aFilter; + aFilter.append( "AVI Files (*.avi)" ); + aFilter.append( "All Files (*.*)" ); + + QString aDir; + if (myPathAVIEdit->text().isEmpty()) + aDir = getenv("HOME"); + else { + QFileInfo aFile(myPathAVIEdit->text()); + aDir = aFile.dirPath(true); + } + QString aPath = SUIT_FileDlg::getFileName(this, aDir, aFilter, "Select file", false); + if (!aPath.isEmpty()) + myPathAVIEdit->setText(aPath); +} + +//------------------------------------------------------------------------ +void VisuGUI_TimeAnimationDlg::onCheckDump(bool) +{ + const QObject* source = sender(); + if (source == mySaveCheck) { + if (mySaveCheck->isChecked()) { + onPicsFormatChanged(); + onPathChanged(); + if (mySaveAVICheck->isChecked()) + mySaveAVICheck->setChecked(false); + } else { + myAnimator->dumpTo(""); + } + mySaveAVICheck->setEnabled(!mySaveCheck->isChecked() && myAnimator->checkAVIMaker()); + } + else if (source == mySaveAVICheck) { + if (mySaveAVICheck->isChecked()) { + if (mySaveCheck->isChecked()) + mySaveCheck->setChecked(false); + } + mySaveCheck->setEnabled(!mySaveAVICheck->isChecked()); + } } //------------------------------------------------------------------------ @@ -1342,6 +1486,21 @@ void VisuGUI_TimeAnimationDlg::onStop() } } +//------------------------------------------------------------------------ +void VisuGUI_TimeAnimationDlg::onHelp() +{ + QString aHelpFileName = "/files/animating_presentations.htm"; + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) + app->onHelpContextModule(myModule ? app->moduleName(myModule->moduleName()) : QString(""), aHelpFileName); + else { + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + QObject::tr("BUT_OK")); + } +} + //------------------------------------------------------------------------ void VisuGUI_TimeAnimationDlg::saveToStudy() { @@ -1363,3 +1522,16 @@ void VisuGUI_TimeAnimationDlg::restoreFromStudy(_PTR(SObject) theAnimation) myAnimator->restoreFromStudy(theAnimation); mySaveBtn->setEnabled(myAnimator->isSavedInStudy()); } + +//------------------------------------------------------------------------ +void VisuGUI_TimeAnimationDlg::onPicsFormatChanged() +{ + QStrList aDumpFormats = QImageIO::outputFormats(); + myAnimator->setDumpFormat(aDumpFormats.at(myPicsFormat->currentItem())); +} + +//------------------------------------------------------------------------ +void VisuGUI_TimeAnimationDlg::onPathChanged() +{ + myAnimator->dumpTo(myPathEdit->text()); +} diff --git a/src/VISUGUI/VisuGUI_TimeAnimation.h b/src/VISUGUI/VisuGUI_TimeAnimation.h index 53191604..3d592826 100644 --- a/src/VISUGUI/VisuGUI_TimeAnimation.h +++ b/src/VISUGUI/VisuGUI_TimeAnimation.h @@ -1,8 +1,21 @@ -// VISU VISUGUI : GUI of VISU component -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// +// 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 : VisuGUI_TimeAnimation.h // Author : Vitaly SMETANNIKOV @@ -12,13 +25,17 @@ #define VISUGUI_TIMEANIMATION_H #include "QtxDblSpinBox.h" - #include "SALOMEDSClient_Study.hxx" +#include "VTKViewer.h" + #include #include #include +#include +#include + class VisuGUI; class VISU_TimeAnimation; @@ -61,7 +78,7 @@ class ArrangeDlg: public QDialog private: struct Offset { - float myOffset[3]; + vtkFloatingPointType myOffset[3]; }; @@ -137,6 +154,7 @@ class VisuGUI_TimeAnimationDlg: public QDialog protected: virtual void closeEvent(QCloseEvent* theEvent); virtual void showEvent(QShowEvent* theEvent); + virtual void reject(); void stopAnimation(); private slots: @@ -152,9 +170,16 @@ class VisuGUI_TimeAnimationDlg: public QDialog void onSpeedChange(double theSpeed); void onExecution(long theNewFrame, double theTime); void onBrowse(); + void onBrowseAVI(); + void onCheckDump(bool); void onStop(); + void onHelp(); void saveToStudy(); void publishToStudy(); + /*!Sets dump format for myAnimator (setDumpFormat(...)), from myPicsFormat.*/ + void onPicsFormatChanged(); + /*!Sets path for myAnimator (dumpTo(...)), from myPathEdit.*/ + void onPathChanged(); private: QSlider* mySlider; @@ -177,6 +202,9 @@ class VisuGUI_TimeAnimationDlg: public QDialog bool isClosing; QCloseEvent* myEvent; + QCheckBox* mySaveAVICheck; + QLineEdit* myPathAVIEdit; + QPushButton* myPublishBtn; QPushButton* mySaveBtn; }; diff --git a/src/VISUGUI/VisuGUI_Timer.cxx b/src/VISUGUI/VisuGUI_Timer.cxx index ca1eea96..61a26816 100644 --- a/src/VISUGUI/VisuGUI_Timer.cxx +++ b/src/VISUGUI/VisuGUI_Timer.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // diff --git a/src/VISUGUI/VisuGUI_Timer.h b/src/VISUGUI/VisuGUI_Timer.h index bbfb7e57..b49b5f82 100644 --- a/src/VISUGUI/VisuGUI_Timer.h +++ b/src/VISUGUI/VisuGUI_Timer.h @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // diff --git a/src/VISUGUI/VisuGUI_Tools.cxx b/src/VISUGUI/VisuGUI_Tools.cxx index 9e9f523d..ffefafb9 100644 --- a/src/VISUGUI/VisuGUI_Tools.cxx +++ b/src/VISUGUI/VisuGUI_Tools.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -28,6 +28,9 @@ #include "VisuGUI_Tools.h" +#include "VisuGUI.h" +#include "VisuGUI_ViewTools.h" + #include "VISU_Gen_i.hh" #include "VISU_Prs3d_i.hh" #include "VISU_Result_i.hh" @@ -42,27 +45,26 @@ #include "SalomeApp_Study.h" #include "SalomeApp_Application.h" -#include "OB_Browser.h" #include "LightApp_DataObject.h" #include "LightApp_SelectionMgr.h" +#include "OB_Browser.h" + #include "SALOME_ListIO.hxx" #include "SALOME_ListIteratorOfListIO.hxx" #include "SVTK_ViewWindow.h" -#include "SVTK_ViewModel.h" #include "SVTK_Functor.h" #include "VTKViewer_Algorithm.h" #include "SPlot2d_ViewModel.h" #include "Plot2d_ViewFrame.h" +#include "Plot2d_ViewManager.h" #include "SUIT_Session.h" #include "SUIT_MessageBox.h" -#include "VisuGUI.h" - #include #include @@ -366,6 +368,11 @@ namespace VISU for (; anIter.More(); anIter.Next()) { Handle(SALOME_InteractiveObject) anIO = anIter.Value(); if (anIO->hasEntry()) { + + // asv : if selected object is a Save Point object selected in object browser - return false + if ( QString( anIO->getEntry() ).startsWith( QObject::tr( "SAVE_POINT_DEF_NAME" ) ) ) + return false; + _PTR(SObject) aSObject = aStudy->FindObjectID(anIO->getEntry()); VISU::Storable::TRestoringMap pMap; if (aSObject) { @@ -421,49 +428,6 @@ namespace VISU return true; } - // Display/Erase - - void - ErasePrs (const SalomeApp_Module* theModule, - CORBA::Object_ptr theObject, bool theUpdate) - { - if (!CORBA::is_nil(theObject)) { - VISU::Base_var aBase = VISU::Base::_narrow(theObject); - if (CORBA::is_nil(aBase)) return; - VISU::VISUType aType = aBase->GetType(); - switch (aType) { - case VISU::TCURVE: - { - if (VISU::Curve_i* aCurve = dynamic_cast(VISU::GetServant(aBase).in())) - PlotCurve(theModule, aCurve, VISU::eErase ); - break; - } - case VISU::TCONTAINER: - { - if (VISU::Container_i* aContainer = dynamic_cast(VISU::GetServant(aBase).in())) - PlotContainer(theModule, aContainer, VISU::eErase ); - break; - } - case VISU::TTABLE: - { - if (VISU::Table_i* aTable = dynamic_cast(VISU::GetServant(aBase).in())) - PlotTable(theModule, aTable, VISU::eErase ); - break; - } - default: - { - if (VISU::Prs3d_i* aPrsObject = dynamic_cast(VISU::GetServant(aBase).in())) { - ErasePrs3d(theModule, aPrsObject); - if (theUpdate) { - if (SVTK_ViewWindow* vw = GetViewWindow(theModule)) - vw->Repaint(); - } - } - } - } // switch (aType) - } - } - void DeleteSObject(VisuGUI* theModule, _PTR(Study) theStudy, @@ -472,16 +436,13 @@ namespace VISU _PTR(ChildIterator) aChildIter = theStudy->NewChildIterator(theSObject); for (aChildIter->InitEx(true); aChildIter->More(); aChildIter->Next()) { _PTR(SObject) aChildSObject = aChildIter->Value(); - CORBA::Object_var aChildObj = VISU::ClientSObjectToObject(aChildSObject); - RemoveScalarBarPosition(theModule,aChildObj); - ErasePrs(theModule, aChildObj); + ErasePrs(theModule, aChildObj, /*repaint_view_window = */false); } CORBA::Object_var anObj = VISU::ClientSObjectToObject(theSObject); if (!CORBA::is_nil(anObj)) { - RemoveScalarBarPosition(theModule,anObj); - ErasePrs(theModule, anObj); + ErasePrs(theModule, anObj, /*repaint_view_window = */true); VISU::RemovableObject_var aRemovableObject = VISU::RemovableObject::_narrow(anObj); if (!CORBA::is_nil(aRemovableObject)) { @@ -506,19 +467,10 @@ namespace VISU if (CheckLock(GetCStudy(GetAppStudy(theModule)),GetDesktop(theModule))) return; - RemoveScalarBarPosition(theModule,thePrs); - thePrs->RemoveFromStudy(); - } + SVTK_ViewWindow* vw = GetActiveViewWindow(theModule); + RemoveScalarBarPosition(theModule, vw, thePrs); - void - ErasePrs3d(const SalomeApp_Module* theModule, - VISU::Prs3d_i* thePrs) - { - if ( SVTK_ViewWindow* vw = GetViewWindow( theModule ) ){ - if (VISU_Actor* anVISUActor = FindActor( vw, thePrs )) { - anVISUActor->VisibilityOff(); - } - } + thePrs->RemoveFromStudy(); } // Presentation management @@ -527,8 +479,8 @@ namespace VISU ChangeRepresentation (const SalomeApp_Module* theModule, VISU::PresentationType theType) { - SVTK_ViewWindow* vw = GetViewWindow( theModule, false ); - if( !vw ) + SVTK_ViewWindow* vw = GetActiveViewWindow(theModule); + if (!vw) return; Handle(SALOME_InteractiveObject) anIO; @@ -563,17 +515,15 @@ namespace VISU } } } - + void SetShading ( const SalomeApp_Module* theModule, bool theOn ) { - SUIT_ViewWindow* aView = GetActiveView(theModule, SVTK_Viewer::Type()); - if (!aView) return; - SVTK_ViewWindow* vw = dynamic_cast( aView ); - if( !vw ) + SVTK_ViewWindow* vw = GetActiveViewWindow(theModule); + if (!vw) return; - + Handle(SALOME_InteractiveObject) anIO; CORBA::Object_var anObject = GetSelectedObj(theModule, &anIO); if (CORBA::is_nil(anObject)) return; @@ -654,167 +604,30 @@ namespace VISU return dynamic_cast(VISU::GetServant(anObject).in()); } - // Views - - SUIT_ViewWindow* GetActiveView(const SalomeApp_Module* theModule, QString theType) - { - if(SalomeApp_Application* anApp = theModule->getApp()){ - if(SUIT_ViewManager* aViewManager = anApp->activeViewManager()){ - if (!theType.isNull()) { - if (aViewManager->getType() != theType) - return 0; - } - return aViewManager->getActiveView(); - } - } - return 0; - } - // VTK View - TViewWindows - GetViews(const SalomeApp_Module* theModule) - { - TViewWindows aViewWindows; - if(SalomeApp_Application* anApp = theModule->getApp()){ - ViewManagerList aViewManagerList; - anApp->viewManagers(SVTK_Viewer::Type(),aViewManagerList); - QPtrListIterator anIter(aViewManagerList); - while(SUIT_ViewManager* aViewManager = anIter.current()){ - QPtrVector aViews = aViewManager->getViews(); - for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){ - if(SUIT_ViewWindow* aViewWindow = aViews.at(i)) - if(SVTK_ViewWindow* aView = dynamic_cast(aViewWindow)) - aViewWindows.push_back(aView); - } - ++anIter; - } - } - return aViewWindows; - } - - SVTK_ViewWindow* - GetViewWindow( const SalomeApp_Module* theModule, const bool theCreate ) - { - if (SalomeApp_Application* anApp = theModule->getApp()) - { - SVTK_ViewWindow* wnd = dynamic_cast(anApp->desktop()->activeWindow()); - if( wnd ) - return wnd; - else - { - SUIT_ViewManager* aViewManager = anApp->getViewManager( SVTK_Viewer::Type(), theCreate ); - return aViewManager ? dynamic_cast( aViewManager->getActiveView() ) : 0; - } - } - return NULL; - } - - /*SVTK_ViewWindow* - GetViewWindow(const SalomeApp_Module* theModule, const bool theCreate ) - { - if (SalomeApp_Application* anApp = theModule->getApp()) - { - SVTK_ViewWindow* wnd = dynamic_cast(anApp->desktop()->activeWindow()); - if( wnd ) - return wnd; - else - { - if(SUIT_ViewManager* aViewManager = anApp->getViewManager( SVTK_Viewer::Type(), theCreate )) - return dynamic_cast( aViewManager->getActiveView() ); - } - } - return NULL; - }*/ - - - SVTK_ViewWindow* - GetViewWindow() - { - SalomeApp_Application* anApp = dynamic_cast - (SUIT_Session::session()->activeApplication()); - if (anApp) { - if (SUIT_ViewManager* aViewManager = anApp->activeViewManager()) { - if (aViewManager->getType() == SVTK_Viewer::Type()) { - if (SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()) { - return dynamic_cast(aViewWindow); - } - } - } - } - return NULL; - } - VISU_Actor* - PublishInView(const SalomeApp_Module* theModule, - VISU::Prs3d_i* thePrs) + PublishMeshInView(const SalomeApp_Module* theModule, + VISU::Prs3d_i* thePrs, + SVTK_ViewWindow* theViewWindow) { VISU_Actor* aActor = NULL; - if(!thePrs) + if (!thePrs || !theViewWindow) return aActor; - if(SVTK_ViewWindow* aView = GetViewWindow(theModule)){ - QApplication::setOverrideCursor( Qt::waitCursor ); - try{ - if(aActor = thePrs->CreateActor()) - aView->AddActor(aActor); - }catch(std::exception& exc){ - SUIT_MessageBox::warn1 - (GetDesktop(theModule), QObject::tr("WRN_VISU"), - QObject::tr("ERR_CANT_CREATE_ACTOR") + ": " + QObject::tr(exc.what()), - QObject::tr("BUT_OK")); - } - QApplication::restoreOverrideCursor(); - } - return aActor; - } - VISU_Actor* - UpdateViewer(const SalomeApp_Module* theModule, - VISU::Prs3d_i* thePrs, - bool theDispOnly) - { - SVTK_ViewWindow* vw = GetViewWindow( theModule ); - if (!vw) return NULL; - - vtkRenderer *aRen = vw->getRenderer(); - vtkActorCollection *anActColl = aRen->GetActors(); - anActColl->InitTraversal(); - - vtkActor *anActor; - VISU_Actor* anVISUActor = NULL; - VISU_Actor* aResActor = NULL; - while(vtkActor *anActor = anActColl->GetNextActor()){ - anVISUActor = VISU_Actor::SafeDownCast(anActor); - if(anVISUActor){ - VISU::Prs3d_i* aPrs = anVISUActor->GetPrs3d(); - if(aPrs == NULL) continue; - if (thePrs == aPrs) { - try { - aResActor = anVISUActor; - thePrs->UpdateActor(aResActor); - aResActor->VisibilityOn(); - } catch (std::runtime_error& exc) { - aResActor->VisibilityOff(); - INFOS(exc.what()); - SUIT_MessageBox::warn1 - (GetDesktop(theModule), QObject::tr("WRN_VISU"), - QObject::tr("ERR_CANT_CREATE_ACTOR") + ": " + QObject::tr(exc.what()), - QObject::tr("BUT_OK")); - } - } else if (theDispOnly) { - anVISUActor->VisibilityOff(); - } else { - } - } else if (theDispOnly && anActor->GetVisibility()) { - anActor->VisibilityOff(); - } else { - } + QApplication::setOverrideCursor( Qt::waitCursor ); + try { + if ((aActor = thePrs->CreateActor())) + theViewWindow->AddActor(aActor); + } catch(std::exception& exc) { + SUIT_MessageBox::warn1 + (GetDesktop(theModule), QObject::tr("WRN_VISU"), + QObject::tr("ERR_CANT_CREATE_ACTOR") + ": " + QObject::tr(exc.what()), + QObject::tr("BUT_OK")); } - if (aResActor) - return aResActor; + QApplication::restoreOverrideCursor(); - //anVISUActor = PublishInView( theModule, thePrs ); - return anVISUActor; + return aActor; } void @@ -893,15 +706,17 @@ namespace VISU QApplication::restoreOverrideCursor(); } - static bool ComputeVisiblePropBounds(SVTK_ViewWindow* theViewWindow, - float allBounds[6], - const char* theActorClassName = "VISU_Actor") + static + bool + ComputeVisiblePropBounds(SVTK_ViewWindow* theViewWindow, + vtkFloatingPointType allBounds[6], + const char* theActorClassName = "VISU_Actor") { vtkRenderer *aRen = theViewWindow->getRenderer(); vtkActorCollection *anActColl = aRen->GetActors(); vtkProp *prop; - float *bounds; - int somethingVisible = false; + vtkFloatingPointType *bounds; + int somethingVisible = false; allBounds[0] = allBounds[2] = allBounds[4] = VTK_LARGE_FLOAT; allBounds[1] = allBounds[3] = allBounds[5] = -VTK_LARGE_FLOAT; @@ -931,14 +746,14 @@ namespace VISU void SetFitAll(SVTK_ViewWindow* theViewWindow) { - static float PRECISION = 0.000001; - static float DEVIATION = 600; - float XYZ_Bnd[6]; + static vtkFloatingPointType PRECISION = 0.000001; + static vtkFloatingPointType DEVIATION = 600; + vtkFloatingPointType XYZ_Bnd[6]; if (!ComputeVisiblePropBounds(theViewWindow, XYZ_Bnd)) return; - float absX = XYZ_Bnd[1] - XYZ_Bnd[0]; - float absY = XYZ_Bnd[3] - XYZ_Bnd[2]; - float absZ = XYZ_Bnd[5] - XYZ_Bnd[4]; + vtkFloatingPointType absX = XYZ_Bnd[1] - XYZ_Bnd[0]; + vtkFloatingPointType absY = XYZ_Bnd[3] - XYZ_Bnd[2]; + vtkFloatingPointType absZ = XYZ_Bnd[5] - XYZ_Bnd[4]; enum CameraOrient {e3D, eFront, eLeft, eTop}; CameraOrient aCameraOrient = e3D; @@ -949,9 +764,9 @@ namespace VISU if (absZ <= PRECISION) aCameraOrient = eTop; else { // all the three dimensions exceeds precision - float dev_abs_XY = absX / absY; - float dev_abs_YZ = absY / absZ; - float dev_abs_XZ = absX / absZ; + vtkFloatingPointType dev_abs_XY = absX / absY; + vtkFloatingPointType dev_abs_YZ = absY / absZ; + vtkFloatingPointType dev_abs_XZ = absX / absZ; if (dev_abs_XY >= DEVIATION || 1./dev_abs_YZ >= DEVIATION) aCameraOrient = eLeft; else { @@ -1124,6 +939,33 @@ namespace VISU aPlot->Repaint(); } + void + PlotRemoveCurve(const SalomeApp_Module* theModule, + VISU::Curve_i* pCrv) + { + QString anEntry = pCrv->GetEntry(); + ViewManagerList pvm_list; + theModule->getApp()->viewManagers( SPlot2d_Viewer::Type(), pvm_list ); + for( SUIT_ViewManager* mgr = pvm_list.first(); mgr; mgr = pvm_list.next() ){ + Plot2d_ViewManager* pvm = dynamic_cast( mgr ); + if( pvm ){ + SPlot2d_Viewer* aSPlot2d = dynamic_cast( pvm->getViewModel() ); + if( aSPlot2d ){ + Plot2d_ViewFrame* aPlot = aSPlot2d->getActiveViewFrame(); + if(aPlot){ + QList clist; + aPlot->getCurves( clist ); + for (int i = 0; i < clist.count(); i++) { + if(SPlot2d_Curve* plotCurve = dynamic_cast(clist.at(i))) + if(plotCurve->hasIO() && (plotCurve->getIO()->getEntry() == anEntry)) + aPlot->eraseCurve(clist.at(i)); + } + } + } + } + } + } + void PlotContainer(const SalomeApp_Module* theModule, VISU::Container_i* container, @@ -1196,7 +1038,8 @@ namespace VISU // Others void CreateMesh (const SalomeApp_Module* theModule, - const Handle(SALOME_InteractiveObject)& theIO) + const Handle(SALOME_InteractiveObject)& theIO, + SVTK_ViewWindow* theViewWindow) { _PTR(Study) aStudy = GetCStudy(GetAppStudy(theModule)); //if (CheckLock(aStudy)) @@ -1243,7 +1086,7 @@ namespace VISU timer.Show(); #endif - QApplication::restoreOverrideCursor(); + //QApplication::restoreOverrideCursor(); VISU::Mesh_i* pPresent = NULL; if (!CORBA::is_nil(aMesh)) pPresent = dynamic_cast(VISU::GetServant(aMesh).in()); @@ -1255,23 +1098,19 @@ namespace VISU return; } - if (SVTK_ViewWindow* aView = GetViewWindow(theModule)) { + if (theViewWindow) { try { #ifdef CHECKTIME Utils_Timer timer; timer.Start(); #endif - PublishInView(theModule, pPresent); - //aView->onFitAll(); - SetFitAll(aView); + PublishMeshInView(theModule, pPresent, theViewWindow); + SetFitAll(theViewWindow); #ifdef CHECKTIME timer.Stop(); MESSAGE("VisuGUI::CreateMesh() - DISPLAY MESH"); timer.Show(); #endif - theModule->application()->putInfo(QObject::tr("INF_DONE")); - // Make "Save" button active - theModule->getApp()->updateActions(); } catch (std::runtime_error& exc) { INFOS(exc.what()); SUIT_MessageBox::warn1 @@ -1280,6 +1119,10 @@ namespace VISU QObject::tr("BUT_OK")); } } + + theModule->application()->putInfo(QObject::tr("INF_DONE")); + // Make "Save" button active + theModule->getApp()->updateActions(); } // ======================================================================================== @@ -1411,58 +1254,45 @@ namespace VISU } return aList; } - - int GetFreePositionOfDefaultScalarBar(VisuGUI* theModule){ + + int GetFreePositionOfDefaultScalarBar(VisuGUI* theModule, SVTK_ViewWindow* theViewWindow) + { int minIndx = 1; std::set aIndexes; - SVTK_ViewWindow* vw = GetViewWindow(theModule); TViewToPrs3d aMap = theModule->getScalarBarsMap(); - TViewToPrs3d::const_iterator aViewToPrsIter = aMap.find(vw); - if (aViewToPrsIter != aMap.end()){ + TViewToPrs3d::const_iterator aViewToPrsIter = aMap.find(theViewWindow); + if (aViewToPrsIter != aMap.end()) { TSetPrs3d::const_iterator aPrsIter = (aViewToPrsIter->second).begin(); - for(;aPrsIter!=(aViewToPrsIter->second).end();aPrsIter++){ + for (; aPrsIter != (aViewToPrsIter->second).end(); aPrsIter++) { aIndexes.insert((*aPrsIter).second); } } std::set::const_iterator aIter = aIndexes.begin(); - for (int i=1,length=aIndexes.size(); i <= length; i++){ + for (int i = 1,length = aIndexes.size(); i <= length; i++) { std::set::const_iterator aIter = aIndexes.find(i); - if(aIter==aIndexes.end()){minIndx = i;break;} + if (aIter == aIndexes.end()) { minIndx = i; break; } else minIndx = i + 1; - } return minIndx; } - - void AddScalarBarPosition(VisuGUI* theModule,VISU::Prs3d_i* thePrs3d, int pos){ - SVTK_ViewWindow* vw = GetViewWindow(theModule); + + void AddScalarBarPosition (VisuGUI* theModule, SVTK_ViewWindow* theViewWindow, + VISU::Prs3d_i* thePrs3d, int pos) + { TViewToPrs3d& aMap = theModule->myScalarBarsMap; - TPrs3dToInd aPair; aPair.first=thePrs3d; aPair.second=pos; - aMap[vw].insert(aPair); + TPrs3dToInd aPair; aPair.first = thePrs3d; aPair.second = pos; + aMap[theViewWindow].insert(aPair); } - - void RemoveScalarBarPosition(VisuGUI* theModule,SVTK_ViewWindow* vw,VISU::Prs3d_i* thePrs3d){ + + void RemoveScalarBarPosition(VisuGUI* theModule, SVTK_ViewWindow* theViewWindow, + VISU::Prs3d_i* thePrs3d) + { TViewToPrs3d& aMap = theModule->myScalarBarsMap; - TSetPrs3d::iterator aIter = aMap[vw].begin(); - for(;aIter!=aMap[vw].end();aIter++) - if((*aIter).first == thePrs3d){ - aMap[vw].erase(*aIter); + TSetPrs3d::iterator aIter = aMap[theViewWindow].begin(); + for (; aIter != aMap[theViewWindow].end(); aIter++) + if ((*aIter).first == thePrs3d) { + aMap[theViewWindow].erase(*aIter); return; } } - - void RemoveScalarBarPosition(VisuGUI* theModule,VISU::Prs3d_i* thePrs3d){ - SVTK_ViewWindow* vw = GetViewWindow(theModule); - RemoveScalarBarPosition(theModule,vw,thePrs3d); - } - - void RemoveScalarBarPosition(VisuGUI* theModule,CORBA::Object_ptr theObject){ - if (!CORBA::is_nil(theObject)) { - Base_var aBase = Base::_narrow(theObject); - if (CORBA::is_nil(aBase)) return; - if (VISU::Prs3d_i* aPrsObject = dynamic_cast(VISU::GetServant(aBase).in())){ - RemoveScalarBarPosition(theModule,aPrsObject); - } - } - } } diff --git a/src/VISUGUI/VisuGUI_Tools.h b/src/VISUGUI/VisuGUI_Tools.h index d514b4b3..0e4258a0 100644 --- a/src/VISUGUI/VisuGUI_Tools.h +++ b/src/VISUGUI/VisuGUI_Tools.h @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -98,18 +98,12 @@ namespace VISU { bool IsRemovableSelected(const SalomeApp_Module* theModule); - // Display/Erase - void ErasePrs(const SalomeApp_Module* theModule, - CORBA::Object_ptr theObject, - bool theUpdate = true); void DeleteSObject(VisuGUI* theModule, _PTR(Study) theStudy, _PTR(SObject) theSObject); void DeletePrs3d(VisuGUI* theModule, VISU::Prs3d_i* thePrs, const Handle(SALOME_InteractiveObject)& theIO); - void ErasePrs3d(const SalomeApp_Module* theModule, - VISU::Prs3d_i* thePrs); // Presentation management void ChangeRepresentation (const SalomeApp_Module* theModule, @@ -126,21 +120,11 @@ namespace VISU { VISU::Result_var& theResult); bool IsSObjectTable(_PTR(SObject) theSObject); - // Views - SUIT_ViewWindow* GetActiveView(const SalomeApp_Module* theModule, - QString theType = QString::null); - - // VTK View - TViewWindows GetViews(const SalomeApp_Module* theModule); - SVTK_ViewWindow* GetViewWindow(const SalomeApp_Module* theModule, - const bool theCreate = false ); - SVTK_ViewWindow* GetViewWindow(); - - VISU_Actor* PublishInView(const SalomeApp_Module* theModule, - VISU::Prs3d_i* thePrs); - VISU_Actor* UpdateViewer(const SalomeApp_Module* theModule, - VISU::Prs3d_i* thePrs, - bool theDispOnly = false); + /*! Display mesh presentation in given VTK view window + */ + VISU_Actor* PublishMeshInView(const SalomeApp_Module* theModule, + VISU::Prs3d_i* thePrs, + SVTK_ViewWindow* theViewWindow); /*! * \brief Repaint all SVTK view windows, where the given object is displayed. @@ -177,32 +161,40 @@ namespace VISU { void PlotCurve( const SalomeApp_Module* theModule, VISU::Curve_i* curve, int theDisplaying ); + void PlotRemoveCurve(const SalomeApp_Module* theModule, + VISU::Curve_i* curve); void PlotContainer( const SalomeApp_Module* theModule, VISU::Container_i* container, int theDisplaying ); void CreatePlot( SalomeApp_Module* theModule, _PTR(SObject) theSobj ); + /*! Display/Erase/Update a curve presentation. + * Parameter \a frame may be NULL, in this case there is only update without display/erase + */ void UpdateCurve( VISU::Curve_i*, Plot2d_ViewFrame* frame, SPlot2d_Curve*, int theDisplaying ); - //parameter frame may be 0, in this case there is only update without display/erase - // Others + /*! Create mesh presentation and display it in \a theViewWindow. + * If \a theViewWindow is NULL, no displaying will be done. + */ void CreateMesh (const SalomeApp_Module* theModule, - const Handle(SALOME_InteractiveObject)& theIO); + const Handle(SALOME_InteractiveObject)& theIO, + SVTK_ViewWindow* theViewWindow = NULL); + // Others std::vector GetPrs3dList (const SalomeApp_Module* theModule, const Handle(SALOME_InteractiveObject)& theIO); std::vector GetPrs3dList (const SalomeApp_Module* theModule, _PTR(SObject) theObject); - int GetFreePositionOfDefaultScalarBar(VisuGUI* theModule); - void AddScalarBarPosition(VisuGUI* theModule,VISU::Prs3d_i* thePrs3d, int pos); - void RemoveScalarBarPosition(VisuGUI* theModule,VISU::Prs3d_i* thePrs3d); - void RemoveScalarBarPosition(VisuGUI* theModule,SVTK_ViewWindow* vw,VISU::Prs3d_i* thePrs3d); - void RemoveScalarBarPosition(VisuGUI* theModule,CORBA::Object_ptr theObject); + int GetFreePositionOfDefaultScalarBar(VisuGUI* theModule, SVTK_ViewWindow* theViewWindow); + void AddScalarBarPosition(VisuGUI* theModule, SVTK_ViewWindow* theViewWindow, + VISU::Prs3d_i* thePrs3d, int pos); + void RemoveScalarBarPosition(VisuGUI* theModule, SVTK_ViewWindow* theViewWindow, + VISU::Prs3d_i* thePrs3d); } #endif diff --git a/src/VISUGUI/VisuGUI_TransparencyDlg.cxx b/src/VISUGUI/VisuGUI_TransparencyDlg.cxx index bf893f50..bb5eff32 100644 --- a/src/VISUGUI/VisuGUI_TransparencyDlg.cxx +++ b/src/VISUGUI/VisuGUI_TransparencyDlg.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -35,6 +35,9 @@ #include "SUIT_Desktop.h" #include "SUIT_OverrideCursor.h" +#include "SUIT_Session.h" +#include "SUIT_MessageBox.h" +#include "SUIT_ResourceMgr.h" #include "SALOME_ListIO.hxx" #include "SALOME_ListIteratorOfListIO.hxx" @@ -42,6 +45,7 @@ #include "LightApp_Study.h" #include "LightApp_SelectionMgr.h" +#include "LightApp_Application.h" #include "SVTK_ViewWindow.h" @@ -66,7 +70,7 @@ VisuGUI_TransparencyDlg::VisuGUI_TransparencyDlg( VisuGUI* theModule, : QDialog( VISU::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ), mySelectionMgr( VISU::GetSelectionMgr( theModule ) ), - myViewWindow( VISU::GetViewWindow( theModule ) ) + myViewWindow( VISU::GetActiveViewWindow(theModule) ) { if (!name) setName("VisuGUI_TransparencyDlg"); @@ -128,9 +132,14 @@ VisuGUI_TransparencyDlg::VisuGUI_TransparencyDlg( VisuGUI* theModule, buttonOk->setText(tr("BUT_CLOSE")); buttonOk->setAutoDefault(TRUE); buttonOk->setDefault(TRUE); - GroupButtonsLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 0); - GroupButtonsLayout->addWidget(buttonOk, 0, 1); - GroupButtonsLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 2); + + buttonHelp = new QPushButton(GroupButtons, "buttonHelp"); + buttonHelp->setText(tr("BUT_HELP")); + buttonHelp->setAutoDefault(TRUE); + + GroupButtonsLayout->addWidget(buttonOk, 0, 0); + GroupButtonsLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1); + GroupButtonsLayout->addWidget(buttonHelp, 0, 2); VisuGUI_TransparencyDlgLayout->addWidget(GroupC1, 0, 0); VisuGUI_TransparencyDlgLayout->addWidget(GroupButtons, 1, 0); @@ -140,6 +149,7 @@ VisuGUI_TransparencyDlg::VisuGUI_TransparencyDlg( VisuGUI* theModule, // signals and slots connections : after ValueHasChanged() connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); connect(Slider1, SIGNAL(valueChanged(int)), this, SLOT(SetTransparency())); connect(Slider1, SIGNAL(sliderMoved(int)), this, SLOT(ValueHasChanged())); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged())); @@ -163,6 +173,26 @@ void VisuGUI_TransparencyDlg::ClickOnOk() close(); } +//======================================================================= +// function : ClickOnHelp() +// purpose : +//======================================================================= +void VisuGUI_TransparencyDlg::ClickOnHelp() +{ + QString aHelpFileName = "/files/changing_visualization_parameters_of_the_presenetation.htm#Changing3"; + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) { + VisuGUI* aVisuGUI = dynamic_cast( app->activeModule() ); + app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName); + } + else { + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + QObject::tr("BUT_OK")); + } +} + //================================================================================= // function : SetTransparency() // purpose : Called when value of slider change diff --git a/src/VISUGUI/VisuGUI_TransparencyDlg.h b/src/VISUGUI/VisuGUI_TransparencyDlg.h index 6dbc9437..9a67b25b 100644 --- a/src/VISUGUI/VisuGUI_TransparencyDlg.h +++ b/src/VISUGUI/VisuGUI_TransparencyDlg.h @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -61,6 +61,7 @@ private : SVTK_ViewWindow* myViewWindow; QPushButton* buttonOk; + QPushButton* buttonHelp; QLabel* TextLabelOpaque; QLabel* ValueLab; QLabel* TextLabelTransparent; @@ -68,6 +69,7 @@ private : public slots: void ClickOnOk(); + void ClickOnHelp(); void ValueHasChanged(); void SetTransparency(); void onSelectionChanged(); diff --git a/src/VISUGUI/VisuGUI_VectorsDlg.cxx b/src/VISUGUI/VisuGUI_VectorsDlg.cxx index a5e2f2c5..2dd8f719 100644 --- a/src/VISUGUI/VisuGUI_VectorsDlg.cxx +++ b/src/VISUGUI/VisuGUI_VectorsDlg.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -33,9 +33,13 @@ #include "VisuGUI_Tools.h" #include "VISU_Vectors_i.hh" - +#include "LightApp_Application.h" #include "SalomeApp_Module.h" + #include "SUIT_Desktop.h" +#include "SUIT_MessageBox.h" +#include "SUIT_ResourceMgr.h" +#include "SUIT_Session.h" #include #include @@ -162,6 +166,9 @@ VisuGUI_VectorsDlg::VisuGUI_VectorsDlg (SalomeApp_Module* theModule) buttonCancel = new QPushButton( tr( "&Cancel" ) , GroupButtons, "buttonCancel" ); buttonCancel->setAutoDefault( TRUE ); GroupButtonsLayout->addWidget( buttonCancel, 0, 2 ); + buttonHelp = new QPushButton( tr( "&Help" ) , GroupButtons, "buttonHelp" ); + buttonHelp->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonHelp, 0, 3 ); // top layout aTabBox->addTab(aBox, "Vectors"); @@ -178,6 +185,7 @@ VisuGUI_VectorsDlg::VisuGUI_VectorsDlg (SalomeApp_Module* theModule) connect( UseMagn, SIGNAL( clicked() ), this, SLOT( enableSetColor() ) ); connect( buttonOk, SIGNAL( clicked() ), this, SLOT( accept() ) ); connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( reject() ) ); + connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( onHelp() ) ); // default values UseMagn->setChecked( TRUE ); @@ -420,3 +428,19 @@ void VisuGUI_VectorsDlg::reject() myScalarPane->deletePreview(); QDialog::reject(); } + +void VisuGUI_VectorsDlg::onHelp() +{ + QString aHelpFileName = "/files/vectors_presentation.htm"; + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) { + VisuGUI* aVisuGUI = dynamic_cast( app->activeModule() ); + app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName); + } + else { + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + QObject::tr("BUT_OK")); + } +} diff --git a/src/VISUGUI/VisuGUI_VectorsDlg.h b/src/VISUGUI/VisuGUI_VectorsDlg.h index 2abdf591..857887ce 100644 --- a/src/VISUGUI/VisuGUI_VectorsDlg.h +++ b/src/VISUGUI/VisuGUI_VectorsDlg.h @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -82,6 +82,7 @@ public: protected slots: void accept(); void reject(); + void onHelp(); private: QGroupBox* TopGroup; @@ -104,6 +105,7 @@ private: QGroupBox* GroupButtons; QPushButton* buttonOk; QPushButton* buttonCancel; + QPushButton* buttonHelp; QColor myColor; VisuGUI_ScalarBarPane* myScalarPane; diff --git a/src/VISUGUI/VisuGUI_ViewTools.cxx b/src/VISUGUI/VisuGUI_ViewTools.cxx index 868ab606..047603e9 100644 --- a/src/VISUGUI/VisuGUI_ViewTools.cxx +++ b/src/VISUGUI/VisuGUI_ViewTools.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -37,37 +37,35 @@ namespace VISU { void ErasePrs(VisuGUI* theModule, - VISU::Base_ptr theBase, - bool thIsUpdate) + CORBA::Object_ptr theObject, + bool theDoRepaintVW) { - VISU::VISUType aType = theBase->GetType(); + if (CORBA::is_nil(theObject)) return; + VISU::Base_var aBase = VISU::Base::_narrow(theObject); + if (CORBA::is_nil(aBase)) return; + + VISU::VISUType aType = aBase->GetType(); switch (aType) { case VISU::TCURVE: { - if (VISU::Curve_i* aCurve = dynamic_cast(VISU::GetServant(theBase).in())) + if (VISU::Curve_i* aCurve = dynamic_cast(VISU::GetServant(aBase).in())) PlotCurve(theModule, aCurve, VISU::eErase ); break; } case VISU::TCONTAINER: { - if (VISU::Container_i* aContainer = dynamic_cast(VISU::GetServant(theBase).in())) + if (VISU::Container_i* aContainer = dynamic_cast(VISU::GetServant(aBase).in())) PlotContainer(theModule, aContainer, VISU::eErase ); break; } case VISU::TTABLE: { - if (VISU::Table_i* aTable = dynamic_cast(VISU::GetServant(theBase).in())) + if (VISU::Table_i* aTable = dynamic_cast(VISU::GetServant(aBase).in())) PlotTable(theModule, aTable, VISU::eErase ); break; } default: { - if(VISU::Prs3d_i* aPrsObject = dynamic_cast(VISU::GetServant(theBase).in())){ - if(aType == VISU::TGAUSSPOINTS) - ErasePrs3d(theModule,aPrsObject,thIsUpdate); - else if(SUIT_ViewManager* aViewManager = theModule->getApp()->activeViewManager()){ - QString aType = aViewManager->getType(); - if(aType == SVTK_Viewer::Type()) - ErasePrs3d(theModule,aPrsObject,thIsUpdate); - else if(aType == VVTK_Viewer::Type()) - ErasePrs3d(theModule,aPrsObject,thIsUpdate); - } + if (VISU::Prs3d_i* aPrsObject = dynamic_cast(VISU::GetServant(aBase).in())) { + SVTK_ViewWindow* vw = GetActiveViewWindow(theModule); + RemoveScalarBarPosition(theModule, vw, aPrsObject); + ErasePrs3d(theModule, aPrsObject, theDoRepaintVW); } }} // switch (aType) } diff --git a/src/VISUGUI/VisuGUI_ViewTools.h b/src/VISUGUI/VisuGUI_ViewTools.h index f10bf63e..1e7c3d0e 100644 --- a/src/VISUGUI/VisuGUI_ViewTools.h +++ b/src/VISUGUI/VisuGUI_ViewTools.h @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -30,34 +30,36 @@ #include "VisuGUI.h" -#include "SUIT_MessageBox.h" -#include "SUIT_ViewManager.h" -#include "SUIT_ViewWindow.h" +#include "VisuGUI_Tools.h" + +#include "VISU_Prs3d_i.hh" +#include "VISU_Table_i.hh" +#include "VISU_ViewManager_i.hh" + +#include "VISU_Actor.h" #include "SalomeApp_Module.h" #include "SalomeApp_Application.h" -#include "VISU_Prs3d_i.hh" - #include "VVTK_ViewModel.h" #include "VVTK_ViewWindow.h" +#include "SVTK_Functor.h" #include "SVTK_ViewModel.h" #include "SVTK_ViewWindow.h" -#include "VisuGUI_Tools.h" +#include "SPlot2d_ViewModel.h" + #include "VTKViewer_Algorithm.h" -#include "SVTK_Functor.h" -#include "VISU_Table_i.hh" -#include "VISU_ViewManager_i.hh" +#include "SUIT_Session.h" +#include "SUIT_MessageBox.h" +#include "SUIT_ViewManager.h" +#include "SUIT_ViewWindow.h" + #include "SALOME_ListIO.hxx" #include "SALOME_ListIteratorOfListIO.hxx" -#include "SPlot2d_ViewModel.h" - -#include "VISU_Actor.h" - #include #include @@ -65,17 +67,26 @@ class VVTK_Viewer; namespace VISU { - //--------------------------------------------------------------- + /*! Return active view window, if it instantiates TViewer::TViewWindow class, + * overwise find or create corresponding view window, make it active and return it. + * \note Active VVTK_ViewWindow can be returned by request GetViewWindow(), + * because VVTK_ViewWindow inherits SVTK_ViewWindow. + */ template inline typename TViewer::TViewWindow* - GetViewWindow(VisuGUI* theModule, - const bool theIsViewCreate = false) + GetViewWindow(VisuGUI* theModule) { - typedef typename TViewer::TViewWindow TView; - if(SUIT_ViewManager* aViewManager = theModule->getViewManager(TViewer::Type(),theIsViewCreate)){ - if(SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()){ - if(TView* aView = dynamic_cast(aViewWindow)){ + typedef typename TViewer::TViewWindow TViewWindow; + if (SalomeApp_Application* anApp = theModule->getApp()) { + if (TViewWindow* aView = dynamic_cast(anApp->desktop()->activeWindow())) + return aView; + } + SUIT_ViewManager* aViewManager = + theModule->getViewManager(TViewer::Type(), /*create = */true); + if (aViewManager) { + if (SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()) { + if (TViewWindow* aView = dynamic_cast(aViewWindow)) { aViewWindow->raise(); aViewWindow->setFocus(); return aView; @@ -85,30 +96,54 @@ namespace VISU return NULL; } + /*! Return active view window, if it instantiates TViewWindow class, overwise return NULL. + * \note Active VVTK_ViewWindow can be returned by request GetActiveViewWindow(), + * because VVTK_ViewWindow inherits SVTK_ViewWindow. + */ + template + inline + TViewWindow* + GetActiveViewWindow(const SalomeApp_Module* theModule = NULL) + { + SalomeApp_Application* anApp = NULL; + if (theModule) + anApp = theModule->getApp(); + else + anApp = dynamic_cast + (SUIT_Session::session()->activeApplication()); + + if (anApp) + if (SUIT_ViewManager* aViewManager = anApp->activeViewManager()) + if (SUIT_ViewWindow* aViewWindow = aViewManager->getActiveView()) + return dynamic_cast(aViewWindow); + + return NULL; + } + //--------------------------------------------------------------- - template inline VISU_Actor* PublishInView(VisuGUI* theModule, Prs3d_i* thePrs, - const bool theIsHighlight = false, - const bool theIsCreateView = false) + SVTK_ViewWindow* theViewWindow, + const bool theIsHighlight = false) { - typedef typename TViewer::TViewWindow TView; - if(TView* aView = GetViewWindow(theModule,theIsCreateView)){ + if (theViewWindow) { QApplication::setOverrideCursor( Qt::waitCursor ); try { - if(VISU_Actor* anActor = thePrs->CreateActor()){ - aView->AddActor(anActor); - if(theIsHighlight) - aView->highlight(anActor->getIO(),true); - aView->getRenderer()->ResetCameraClippingRange(); - aView->Repaint(); + if (VISU_Actor* anActor = thePrs->CreateActor()) { + theViewWindow->AddActor(anActor); + if (theIsHighlight) + theViewWindow->highlight(anActor->getIO(),true); + theViewWindow->getRenderer()->ResetCameraClippingRange(); + theViewWindow->Repaint(); QApplication::restoreOverrideCursor(); return anActor; } } catch(std::exception& exc) { + thePrs->RemoveActors(); + QApplication::restoreOverrideCursor(); INFOS(exc.what()); SUIT_MessageBox::warn1 @@ -122,56 +157,53 @@ namespace VISU //--------------------------------------------------------------- - template inline VISU_Actor* UpdateViewer(VisuGUI* theModule, VISU::Prs3d_i* thePrs, bool theDispOnly = false, - const bool theIsHighlight = false, - const bool theIsViewCreate = false) + const bool theIsHighlight = false) { - typedef typename TViewer::TViewWindow TView; - if(TView* aView = GetViewWindow(theModule,theIsViewCreate)){ - vtkRenderer *aRen = aView->getRenderer(); + if (SVTK_ViewWindow* aViewWindow = GetActiveViewWindow(theModule)) { + vtkRenderer *aRen = aViewWindow->getRenderer(); vtkActorCollection *anActColl = aRen->GetActors(); anActColl->InitTraversal(); VISU_Actor* aResActor = NULL; - while(vtkActor *anAct = anActColl->GetNextActor()){ - if(VISU_Actor* anActor = dynamic_cast(anAct)){ - if(VISU::Prs3d_i* aPrs3d = anActor->GetPrs3d()){ - if(thePrs == aPrs3d){ + bool isOk = true; + while (vtkActor *anAct = anActColl->GetNextActor()) { + if (VISU_Actor* anActor = dynamic_cast(anAct)) { + if (VISU::Prs3d_i* aPrs3d = anActor->GetPrs3d()) { + if (thePrs == aPrs3d) { try { + aResActor = anActor; thePrs->UpdateActors(); + aResActor->VisibilityOn(); } catch (std::runtime_error& exc) { + thePrs->RemoveActors(); + isOk = false; + INFOS(exc.what()); - QApplication::restoreOverrideCursor(); SUIT_MessageBox::warn1 (GetDesktop(theModule), QObject::tr("WRN_VISU"), QObject::tr("ERR_CANT_BUILD_PRESENTATION") + ": " + QObject::tr(exc.what()), QObject::tr("BUT_OK")); - - thePrs->RemoveActors(); - return NULL; } - aResActor = anActor; - aResActor->VisibilityOn(); - }else if(theDispOnly){ + } else if (theDispOnly) { anActor->VisibilityOff(); } - }else if(theDispOnly && anActor->GetVisibility()){ + } else if (theDispOnly && anActor->GetVisibility()) { anActor->VisibilityOff(); } } } - if(aResActor){ - if(theIsHighlight) - aView->highlight(aResActor->getIO(),true); - aView->getRenderer()->ResetCameraClippingRange(); - aView->Repaint(); + if (aResActor) { + if (theIsHighlight && isOk) + aViewWindow->highlight(aResActor->getIO(), true); + aViewWindow->getRenderer()->ResetCameraClippingRange(); + aViewWindow->Repaint(); return aResActor; } - return PublishInView(theModule,thePrs,theIsHighlight,theIsViewCreate); + return PublishInView(theModule, thePrs, aViewWindow, theIsHighlight); } return NULL; } @@ -184,14 +216,14 @@ namespace VISU OnEraseAll(VisuGUI* theModule) { typedef typename TViewer::TViewWindow TViewWindow; - if(TViewWindow* aViewWindow = GetViewWindow(theModule)){ + if (TViewWindow* aViewWindow = GetActiveViewWindow(theModule)) { aViewWindow->unHighlightAll(); - if(vtkRenderer *aRen = aViewWindow->getRenderer()){ + if (vtkRenderer *aRen = aViewWindow->getRenderer()) { vtkActorCollection *aCollection = aRen->GetActors(); aCollection->InitTraversal(); - while(vtkActor *anAct = aCollection->GetNextActor()){ - if(anAct->GetVisibility() > 0) - if(SALOME_Actor* anActor = dynamic_cast(anAct)){ + while (vtkActor *anAct = aCollection->GetNextActor()) { + if (anAct->GetVisibility() > 0) + if (SALOME_Actor* anActor = dynamic_cast(anAct)) { anActor->VisibilityOff(); } } @@ -199,57 +231,37 @@ namespace VISU } } } - + template<> inline void OnEraseAll(VisuGUI* theModule) { - if(SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(theModule,false)) + if (SPlot2d_Viewer* aPlot2d = GetPlot2dViewer(theModule, false)) aPlot2d->EraseAll(); } //--------------------------------------------------------------- - template - inline - VISU_Actor* - FindActor(TVieweWindow* theViewWindow, - const char* theEntry) - { - using namespace SVTK; - if(vtkRenderer* aRenderer = theViewWindow->getRenderer()){ - if(vtkActorCollection* aCollection = aRenderer->GetActors()){ - if(VISU_Actor* anActor = Find(aCollection,TIsSameEntry(theEntry))){ - return anActor; - } - } - } - return NULL; - } - - template inline void ErasePrs3d(VisuGUI* theModule, VISU::Prs3d_i* thePrs, - const bool thIsUpdate = true) + const bool theDoRepaintVW = true) { - typedef typename TViewer::TViewWindow TViewWindow; - if(TViewWindow* aViewWindow = GetViewWindow(theModule)){ - if(VISU_Actor* anActor = FindActor(aViewWindow,thePrs)){ + if (SVTK_ViewWindow* aViewWindow = GetActiveViewWindow(theModule)) { + if (VISU_Actor* anActor = FindActor(aViewWindow, thePrs)) { anActor->VisibilityOff(); - if(thIsUpdate) + if (theDoRepaintVW) aViewWindow->Repaint(); } } } - void ErasePrs(VisuGUI* theModule, - VISU::Base_ptr theBase, - bool thIsUpdate); + CORBA::Object_ptr theObject, + bool theDoRepaintVW); } #endif diff --git a/src/VISU_I/Makefile.in b/src/VISU_I/Makefile.in index 20168853..41b9c67e 100644 --- a/src/VISU_I/Makefile.in +++ b/src/VISU_I/Makefile.in @@ -1,17 +1,31 @@ -# Copyright (C) 2003 CEA/DEN, EDF R&D -# -# +# 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 : Makefile.in # Author : Alexey Petrov # Module : VISU -# $Header: top_srcdir=@top_srcdir@ top_builddir=../.. srcdir=@srcdir@ VPATH=.:@srcdir@:@top_srcdir@/idl - +BOOST_LIBSUFFIX=@BOOST_LIBSUFFIX@ @COMMENCE@ @@ -98,9 +112,9 @@ CPPFLAGS += \ $(HDF5_INCLUDES) \ $(QWT_INCLUDES) \ $(BOOST_CPPFLAGS)\ - -I${KERNEL_ROOT_DIR}/include/salome \ - -I${MED_ROOT_DIR}/include/salome \ - -I${GUI_ROOT_DIR}/include/salome + $(KERNEL_CXXFLAGS) \ + $(MED_CXXFLAGS) \ + $(GUI_CXXFLAGS) LDFLAGS += \ $(PYTHON_LIBS) \ @@ -108,11 +122,11 @@ LDFLAGS += \ $(VTK_LIBS) \ $(QWT_LIBS) \ $(BOOST_LIBS) \ - -L${KERNEL_ROOT_DIR}/lib/salome \ - -L${GUI_ROOT_DIR}/lib/salome \ - -L${MED_ROOT_DIR}/lib/salome + $(KERNEL_LDFLAGS) \ + $(GUI_LDFLAGS) \ + $(MED_LDFLAGS) -LIBS+= -lboost_signals-mt \ +LIBS+= -lboost_signals${BOOST_LIBSUFFIX} \ -lSalomeHDFPersist \ -lSalomeGenericObj \ -lSalomeContainer \ @@ -120,7 +134,6 @@ LIBS+= -lboost_signals-mt \ -lTOOLSDS \ -lOpUtil \ -lEvent \ - -lCASCatch \ -lSalomeApp \ -lSalomeSession \ -lVTKViewer \ @@ -129,10 +142,11 @@ LIBS+= -lboost_signals-mt \ -lVisuConvertor \ -lVisuPipeLine \ -lVisuObject \ + -lVVTK \ -lVISUGUITOOLS LDFLAGSFORBIN=$(LDFLAGS) $(LIBS) \ - -L${KERNEL_ROOT_DIR}/lib/salome \ + $(KERNEL_LDFLAGS) \ -lSALOMEBasics \ -lSalomeCatalog \ -lwith_loggerTraceCollector \ @@ -141,8 +155,7 @@ LDFLAGSFORBIN=$(LDFLAGS) $(LIBS) \ -lSalomeNotification \ -lSALOMELocalTrace \ -lSalomeResourcesManager \ - -lSalomeDS \ - -lSalomeDSImpl \ + -lSalomeDSClient \ -lSalomeObject \ -lqtx \ -lsuit \ diff --git a/src/VISU_I/VISUConfig.cc b/src/VISU_I/VISUConfig.cc index ee879b6a..72c1635d 100644 --- a/src/VISU_I/VISUConfig.cc +++ b/src/VISU_I/VISUConfig.cc @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISUConfig.cc @@ -194,6 +194,16 @@ namespace VISU{ } + QString Storable::FindValue(const TRestoringMap& theMap, const string& theArg, const QString& theDefaultValue) + { + bool anIsFound = false; + QString aValue = FindValue(theMap,theArg,&anIsFound); + if(anIsFound) + return aValue; + return theDefaultValue; + } + + //=========================================================================== PortableServer::ServantBase_var GetServant(CORBA::Object_ptr theObject){ if(CORBA::is_nil(theObject)) return NULL; diff --git a/src/VISU_I/VISUConfig.hh b/src/VISU_I/VISUConfig.hh index 9651c9c6..c4efc6ad 100644 --- a/src/VISU_I/VISUConfig.hh +++ b/src/VISU_I/VISUConfig.hh @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISUConfig.hh @@ -126,6 +126,7 @@ namespace VISU static void Registry(const char* theComment, TStorableEngine theEngine); static Storable* Create(SALOMEDS::SObject_ptr, const std::string& thePrefix, const std::string& theString); static QString FindValue(const TRestoringMap& theMap, const std::string& theArg, bool* isFind = NULL); + static QString FindValue(const TRestoringMap& theMap, const std::string& theArg, const QString& theDefaultValue); static void StrToMap(const QString& theStr, VISU::Storable::TRestoringMap& theMap); static SALOMEDS::SObject_ptr GetResultSO(SALOMEDS::SObject_ptr theSObject); static void DataToStream(std::ostringstream& theStr, const QString& theName, const QString& theVal); diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.cc b/src/VISU_I/VISU_ColoredPrs3d_i.cc index 8a691fd4..275d3e2e 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.cc +++ b/src/VISU_I/VISU_ColoredPrs3d_i.cc @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_PrsObject_i.cxx @@ -107,7 +107,7 @@ VISU::ColoredPrs3d_i myField = anOrigin->GetField(); myMeshName = myField->myMeshName; - myEntity = myField->myEntity; + myEntity = VISU::TEntity(anOrigin->GetEntity());//myField->myEntity; myIteration = anOrigin->GetIteration(); myFieldName = anOrigin->GetFieldName(); @@ -128,7 +128,7 @@ VISU::ColoredPrs3d_i SetItalicTitle(anOrigin->IsItalicTitle()); SetShadowTitle(anOrigin->IsShadowTitle()); SetTitFontType(anOrigin->GetTitFontType()); - float r,g,b; + vtkFloatingPointType r,g,b; anOrigin->GetTitleColor(&r,&g,&b); SetTitleColor(r,g,b); @@ -341,7 +341,9 @@ VISU::ColoredPrs3d_i void VISU::ColoredPrs3d_i -::GetTitleColor(float* theR, float* theG, float* theB) +::GetTitleColor(vtkFloatingPointType* theR, + vtkFloatingPointType* theG, + vtkFloatingPointType* theB) { *theR = myTitleColor[0]; *theG = myTitleColor[1]; @@ -350,7 +352,9 @@ VISU::ColoredPrs3d_i void VISU::ColoredPrs3d_i -::SetTitleColor(float theR, float theG, float theB) +::SetTitleColor(vtkFloatingPointType theR, + vtkFloatingPointType theG, + vtkFloatingPointType theB) { myTitleColor[0] = theR; myTitleColor[1] = theG; @@ -415,7 +419,9 @@ VISU::ColoredPrs3d_i void VISU::ColoredPrs3d_i -::GetLabelColor(float* theR, float* theG, float* theB) +::GetLabelColor(vtkFloatingPointType* theR, + vtkFloatingPointType* theG, + vtkFloatingPointType* theB) { *theR = myLabelColor[0]; *theG = myLabelColor[1]; @@ -424,7 +430,9 @@ VISU::ColoredPrs3d_i void VISU::ColoredPrs3d_i -::SetLabelColor(float theR, float theG, float theB) +::SetLabelColor(vtkFloatingPointType theR, + vtkFloatingPointType theG, + vtkFloatingPointType theB) { myLabelColor[0] = theR; myLabelColor[1] = theG; @@ -470,11 +478,11 @@ VISU::ColoredPrs3d_i // Scalar Bar origin QString propertyName = QString( "scalar_bar_%1_" ).arg( anOrientation == 0 ? "vertical" : "horizontal" ); - float aXorigin = (myOrientation == VISU::ScalarMap::VERTICAL) ? 0.01 : 0.2; + vtkFloatingPointType aXorigin = (myOrientation == VISU::ScalarMap::VERTICAL) ? 0.01 : 0.2; aXorigin = aResourceMgr->doubleValue("VISU", propertyName + "x", aXorigin); myPosition[0] = aXorigin; - float aYorigin = (myOrientation == VISU::ScalarMap::VERTICAL) ? 0.1 : 0.012; + vtkFloatingPointType aYorigin = (myOrientation == VISU::ScalarMap::VERTICAL) ? 0.1 : 0.012; aYorigin = aResourceMgr->doubleValue("VISU", propertyName + "y", aYorigin); myPosition[1] = aYorigin; diff --git a/src/VISU_I/VISU_ColoredPrs3d_i.hh b/src/VISU_I/VISU_ColoredPrs3d_i.hh index 4762f3d1..26a6d38e 100644 --- a/src/VISU_I/VISU_ColoredPrs3d_i.hh +++ b/src/VISU_I/VISU_ColoredPrs3d_i.hh @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_PrsObject_i.hxx @@ -135,7 +135,7 @@ namespace VISU VISU::ScalarMap::Orientation myOrientation; std::string myTitle; int myNumberOfLabels; - float myPosition[2], myWidth, myHeight; + vtkFloatingPointType myPosition[2], myWidth, myHeight; public: //---------------------------------------------------------------------------- @@ -166,7 +166,7 @@ namespace VISU void SameAsParams(const ColoredPrs3d_i* theOrigin); - const VISU::PField& + virtual const VISU::PField& GetField() const; const std::string& @@ -218,11 +218,15 @@ namespace VISU virtual void - GetTitleColor(float* theR, float* theG, float* theB); + GetTitleColor(vtkFloatingPointType* theR, + vtkFloatingPointType* theG, + vtkFloatingPointType* theB); virtual void - SetTitleColor(float theR, float theG, float theB); + SetTitleColor(vtkFloatingPointType theR, + vtkFloatingPointType theG, + vtkFloatingPointType theB); virtual bool @@ -258,11 +262,15 @@ namespace VISU virtual void - GetLabelColor(float* theR, float* theG, float* theB); + GetLabelColor(vtkFloatingPointType* theR, + vtkFloatingPointType* theG, + vtkFloatingPointType* theB); virtual void - SetLabelColor(float theR, float theG, float theB); + SetLabelColor(vtkFloatingPointType theR, + vtkFloatingPointType theG, + vtkFloatingPointType theB); //---------------------------------------------------------------------------- protected: @@ -276,13 +284,13 @@ namespace VISU bool myIsItalicTitle; bool myIsShadowTitle; int myTitFontType; - float myTitleColor[3]; + vtkFloatingPointType myTitleColor[3]; bool myIsBoldLabel; bool myIsItalicLabel; bool myIsShadowLabel; int myLblFontType; - float myLabelColor[3]; + vtkFloatingPointType myLabelColor[3]; VISU_ScalarMapPL* myScalarMapPL; bool myIsFixedRange; diff --git a/src/VISU_I/VISU_CorbaMedConvertor.cxx b/src/VISU_I/VISU_CorbaMedConvertor.cxx index b1dc814b..26b5074b 100644 --- a/src/VISU_I/VISU_CorbaMedConvertor.cxx +++ b/src/VISU_I/VISU_CorbaMedConvertor.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -1206,7 +1206,6 @@ VISU_MEDConvertor if(theFamily->myIsDone) return 0; - const VISU::TGeom2SubMesh& aGeom2SubMesh = theMeshOnEntity->myGeom2SubMesh; SALOME_MED::FAMILY_var aMedFamily = theFamily->myFamily; CORBA::Boolean anIsOnAllElements = aMedFamily->isOnAllElements(); if(!anIsOnAllElements){ diff --git a/src/VISU_I/VISU_CorbaMedConvertor.hxx b/src/VISU_I/VISU_CorbaMedConvertor.hxx index f4a975aa..97d47041 100644 --- a/src/VISU_I/VISU_CorbaMedConvertor.hxx +++ b/src/VISU_I/VISU_CorbaMedConvertor.hxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // diff --git a/src/VISU_I/VISU_CutLines_i.cc b/src/VISU_I/VISU_CutLines_i.cc index d88ecb5d..9df67004 100644 --- a/src/VISU_I/VISU_CutLines_i.cc +++ b/src/VISU_I/VISU_CutLines_i.cc @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_PrsObject_i.cxx @@ -32,12 +32,14 @@ #include "VISU_Convertor.hxx" #include "VISU_PipeLineUtils.hxx" +#include "SUIT_ResourceMgr.h" + #include using namespace VISU; using namespace std; -static float EPS_machine = 1.0E-7; +static vtkFloatingPointType EPS_machine = 1.0E-7; #ifdef _DEBUG_ static int MYDEBUG = 0; @@ -311,6 +313,9 @@ VISU::CutLines_i { if(VISU_Actor* anActor = ScalarMap_i::CreateActor(theIO)){ anActor->SetVTKMapping(true); + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + int aDispMode = aResourceMgr->integerValue("VISU" , "cut_lines_represent", 2); + anActor->SetRepresentation(aDispMode); return anActor; } return NULL; @@ -325,8 +330,8 @@ void VISU::CutLines_i::BuildTableOfReal(SALOMEDS::SObject_ptr theSObject){ anAttr = aStudyBuilder->FindOrCreateAttribute(theSObject, "AttributeTableOfReal"); SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr); - typedef set TXCont; - typedef map TXYMap; + typedef set TXCont; + typedef map TXYMap; typedef map TXYMapCont; typedef map TLineIdCont; @@ -340,9 +345,9 @@ void VISU::CutLines_i::BuildTableOfReal(SALOMEDS::SObject_ptr theSObject){ TXCont aXCont; TXYMapCont aXYMapCont; TLineIdCont aLineIdCont; // Define internal numeration of lines - const float *aDirLn = myCutLinesPL->GetDirLn(); - const float *aBasePnt = myCutLinesPL->GetBasePnt(); - const float *aBoundPrjLn = myCutLinesPL->GetBoundPrjLn(); + const vtkFloatingPointType *aDirLn = myCutLinesPL->GetDirLn(); + const vtkFloatingPointType *aBasePnt = myCutLinesPL->GetBasePnt(); + const vtkFloatingPointType *aBoundPrjLn = myCutLinesPL->GetBoundPrjLn(); for(int iLine = 0, jLine = 0; iLine < iLineEnd; iLine++){ vtkDataSet *aDataSet = myCutLinesPL->GetAppendPolyData()->GetInput(iLine); aDataSet->Update(); @@ -364,10 +369,12 @@ void VISU::CutLines_i::BuildTableOfReal(SALOMEDS::SObject_ptr theSObject){ if(MYDEBUG) MESSAGE("CutPlanes_i::BuildTableOfReal iLine = "<SetColumnTitle(i+1,aString.latin1()); @@ -467,7 +474,7 @@ void VISU::CutLines_i::BuildTableOfReal(SALOMEDS::SObject_ptr theSObject){ TXYMap::const_iterator aXYMapIter = aXYMap.find(aDist); // Can we find some value that belong to the line and have the same X coordinate? if(aXYMapIter == aXYMap.end()) continue; - float aVal = aXYMapIter->second; + vtkFloatingPointType aVal = aXYMapIter->second; aTableOfReal->PutValue(aVal,iLineId+2,i+1); } } diff --git a/src/VISU_I/VISU_CutLines_i.hh b/src/VISU_I/VISU_CutLines_i.hh index 18c4bc19..99dc2fc2 100644 --- a/src/VISU_I/VISU_CutLines_i.hh +++ b/src/VISU_I/VISU_CutLines_i.hh @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_PrsObject_i.hxx diff --git a/src/VISU_I/VISU_CutPlanes_i.cc b/src/VISU_I/VISU_CutPlanes_i.cc index d5c0ea04..c4b952e5 100644 --- a/src/VISU_I/VISU_CutPlanes_i.cc +++ b/src/VISU_I/VISU_CutPlanes_i.cc @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_PrsObject_i.cxx @@ -29,6 +29,8 @@ #include "VISU_CutPlanes_i.hh" #include "VISU_Actor.h" +#include "SUIT_ResourceMgr.h" + using namespace VISU; using namespace std; @@ -189,6 +191,9 @@ VISU::CutPlanes_i { if(VISU_Actor* anActor = ScalarMap_i::CreateActor(theIO)){ anActor->SetVTKMapping(true); + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + int aDispMode = aResourceMgr->integerValue("VISU" , "cut_planes_represent", 1); + anActor->SetRepresentation(aDispMode); return anActor; } return NULL; diff --git a/src/VISU_I/VISU_CutPlanes_i.hh b/src/VISU_I/VISU_CutPlanes_i.hh index 46d5e0cd..4ccc6270 100644 --- a/src/VISU_I/VISU_CutPlanes_i.hh +++ b/src/VISU_I/VISU_CutPlanes_i.hh @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_PrsObject_i.hxx diff --git a/src/VISU_I/VISU_DeformedShape_i.cc b/src/VISU_I/VISU_DeformedShape_i.cc index 83f679ce..7f9b4b7f 100644 --- a/src/VISU_I/VISU_DeformedShape_i.cc +++ b/src/VISU_I/VISU_DeformedShape_i.cc @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_PrsObject_i.cxx @@ -31,6 +31,8 @@ #include "VISU_DeformedShapePL.hxx" #include "VISU_Convertor.hxx" +#include "SUIT_ResourceMgr.h" + #include #include @@ -170,9 +172,13 @@ VISU::DeformedShape_i ::CreateActor(const Handle(SALOME_InteractiveObject)& theIO) { VISU_Actor* anActor = VISU::ScalarMap_i::CreateActor(theIO); - anActor->SetRepresentation(1); - anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B); anActor->SetVTKMapping(false); + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + int aDispMode = aResourceMgr->integerValue("VISU", "deformed_shape_represent", 1); + bool toShrink = aResourceMgr->booleanValue("VISU", "deformed_shape_shrink", false); + anActor->SetRepresentation(aDispMode); + if (toShrink) anActor->SetShrink(); + anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B); return anActor; } diff --git a/src/VISU_I/VISU_DeformedShape_i.hh b/src/VISU_I/VISU_DeformedShape_i.hh index 3767af61..c2e6777f 100644 --- a/src/VISU_I/VISU_DeformedShape_i.hh +++ b/src/VISU_I/VISU_DeformedShape_i.hh @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_PrsObject_i.hxx diff --git a/src/VISU_I/VISU_DumpPython.cc b/src/VISU_I/VISU_DumpPython.cc index 91b8ef80..dec25f6a 100644 --- a/src/VISU_I/VISU_DumpPython.cc +++ b/src/VISU_I/VISU_DumpPython.cc @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_DumpPython.cc @@ -39,6 +39,8 @@ #include "VISU_StreamLines_i.hh" #include "VISU_Plot3D_i.hh" #include "VISU_Table_i.hh" +#include "VISU_GaussPoints_i.hh" +#include "VISU_ScalarMapOnDeformedShape_i.hh" #include "utilities.h" @@ -53,7 +55,8 @@ using namespace std; -namespace VISU{ +namespace VISU +{ static std::string PREFIX(" "); typedef std::map TName2EntryMap; @@ -139,15 +142,27 @@ namespace VISU{ std::string thePrefix); + //=========================================================================== + void + Prs3dToPython(VISU::Prs3d_i* theServant, + std::ostream& theStr, + std::string& theName, + std::string thePrefix) + { + float x, y, z; + theServant->GetOffset(x,y,z); + theStr<GetEntity()){ @@ -175,10 +190,41 @@ namespace VISU{ theStr<Object map theStr<GetName(); + theStr<GetScalarMode()<<")"<GetPosX()<<","<GetPosY()<<")"<GetWidth()<<","<GetHeight()<<")"<GetNbColors()<<")"<GetLabels()<<")"<GetTitle()<<"')"<GetScaling()){ case LINEAR: aParam = "VISU.LINEAR"; @@ -200,12 +246,6 @@ namespace VISU{ } theStr<GetPosX()<<","<GetPosY()<<")"<GetWidth()<<","<GetHeight()<<")"<GetNbColors()<<")"<GetLabels()<<")"<GetTitle()<<"')"<GetName(); + theStr<GetID(); + CORBA::String_var aNameInStudy = theSObject->GetName(); + CORBA::Object_var anObj = SObjectToObject(theSObject); - if(!CORBA::is_nil(anObj)){ + if (!CORBA::is_nil(anObj)) { VISU::Base_var aBase = VISU::Base::_narrow(anObj); if(!CORBA::is_nil(aBase)){ std::string aName = GenerateName(theSObject,theName2EntryMap,theEntry2NameMap); - CORBA::String_var anID = theSObject->GetID(); VISU::VISUType aType = aBase->GetType(); switch(aType){ @@ -485,14 +531,28 @@ namespace VISU{ if(anId == Result_i::eImportFile || anId == Result_i::eCopyAndImportFile){ switch(anId){ case Result_i::eImportFile: - theStr<IsGroupsDone()<<")"<< + endl; + + theStr<IsFieldsDone()<<","<< + aServant->IsMinMaxDone()<<")"<< + endl; + + theStr<(GetServant(anObj).in())){ + if(Mesh_i* aServant = dynamic_cast(GetServant(anObj).in())){ VISU::Entity anEntity = aServant->GetEntity(); const std::string& aSubMeshName = aServant->GetSubMeshName(); if(anEntity >= 0){ @@ -594,8 +654,16 @@ namespace VISU{ theStr<Object map theStr<GetCellColor(); theStr<(GetServant(anObj).in())){ + thePrefix = ScalarMapToPython(theSObject,aServant,theStr,aName,"ScalarMapOnDeformedShapeOnField",theArgumentName,thePrefix); + + theStr<GetSourceRangeMin()<<","<GetSourceRangeMax()<<")"<GetScale()<<")"<GetScalarEEntity(); + switch(anEntity){ + case NODE: + aParam = "VISU.NODE"; + break; + case EDGE: + aParam = "VISU.EDGE"; + break; + case FACE: + aParam = "VISU.FACE"; + break; + case CELL: + aParam = "VISU.CELL"; + break; + } + + theStr<GetScalarMeshName()<<"',"<< + "'"<GetScalarFieldName()<<"',"<< + aServant->GetScalarIteration()<<","<< + aParam<< + ")"<(GetServant(anObj).in())){ thePrefix = DeformedShapeToPython(theSObject,aServant,theStr,aName,"VectorsOnField",theArgumentName,thePrefix); @@ -839,8 +941,7 @@ namespace VISU{ return; case VISU::TPLOT3D: if (Plot3D_i* aServant = dynamic_cast(GetServant(anObj).in())) { - thePrefix = ScalarMapToPython(theSObject, aServant, theStr, aName, - "Plot3DOnField", theArgumentName, thePrefix); + thePrefix = ScalarMapToPython(theSObject, aServant, theStr, aName,"Plot3DOnField", theArgumentName, thePrefix); std::string aParam; switch(aServant->GetOrientationType()){ @@ -857,6 +958,12 @@ namespace VISU{ theStr<(GetServant(anObj).in())){ + thePrefix = ColoredPrs3dToPython(theSObject,aServant,theStr,aName,"GaussPointsOnField",theArgumentName,thePrefix); + theStr<(GetServant(anObj).in())) { @@ -896,8 +1003,7 @@ namespace VISU{ } return; case VISU::TTABLE: - if(Table_i* aServant = dynamic_cast(GetServant(anObj).in())){ - SALOMEDS::SObject_var aSObject = aServant->GetSObject(); + if(dynamic_cast(GetServant(anObj).in())){ SALOMEDS::GenericAttribute_var anAttr; if(theSObject->FindAttribute(anAttr,"AttributeComment")){ using namespace SALOMEDS; @@ -921,6 +1027,10 @@ namespace VISU{ theStr<FindAttribute(anAttr,"AttributeComment")){ + if (theSObject->FindAttribute(anAttr,"AttributeComment")) { SALOMEDS::AttributeComment_var aComment = SALOMEDS::AttributeComment::_narrow(anAttr); CORBA::String_var aValue = aComment->Value(); @@ -986,8 +1100,8 @@ namespace VISU{ Storable::StrToMap(aValue.in(),aMap); bool anIsExist; QString aTypeName = VISU::Storable::FindValue(aMap,"myComment",&anIsExist); - if(anIsExist){ - if(strcmp(aTypeName.latin1(),"ImportTables") == 0){ + if (anIsExist) { + if (strcmp(aTypeName.latin1(),"ImportTables") == 0) { QString aFileName = VISU::Storable::FindValue(aMap,"myFileName",&anIsExist); if(anIsExist){ std::string aName = GenerateName(theSObject,theName2EntryMap,theEntry2NameMap); @@ -1009,7 +1123,7 @@ namespace VISU{ theStr<GetName(); + theStr<NewChildIterator(aSObject); for(aCurveIter->InitEx(false); aCurveIter->More(); aCurveIter->Next()){ SALOMEDS::SObject_var aRefSObj = aCurveIter->Value(); @@ -1170,6 +1319,15 @@ namespace VISU{ VISU::DumpChildrenToPython(aStudy,theIsPublished,theIsValidScript,aComponent.in(),aStr,aName2EntryMap,aEntry2NameMap,"",aPrefix); VISU::DumpContainersToPython(aStudy,theIsPublished,theIsValidScript,aComponent.in(),aStr,aName2EntryMap,aEntry2NameMap,"",aPrefix); + //Output the script that sets up the visul parameters. + if(theIsPublished) { + char* script = aStudy->GetDefaultScript("Post-Pro", aPrefix.c_str()); + if(script && strlen(script) > 0) { + aStr << script; + CORBA::string_free(script); + } + } + aStr<integerValue( "VISU", "scalar_bar_bicolor", GetBiColor() ); SetBiColor( aBicolor == 0 ); - float aSpacing = aResourceMgr->doubleValue( "VISU", "scalar_bar_spacing", GetSpacing() ); + vtkFloatingPointType aSpacing = aResourceMgr->doubleValue( "VISU", "scalar_bar_spacing", GetSpacing() ); SetSpacing( aSpacing ); - float aScaleFactor = aResourceMgr->doubleValue( "VISU", "deformed_shape_scale_factor", GetScaleFactor() ); + vtkFloatingPointType aScaleFactor = aResourceMgr->doubleValue( "VISU", "deformed_shape_scale_factor", GetScaleFactor() ); SetScaleFactor( aScaleFactor ); int aPrimitiveType = aResourceMgr->integerValue( "VISU", "point_sprite_primitive_type", GetPrimitiveType() ); SetPrimitiveType( aPrimitiveType ); - float aClamp = aResourceMgr->doubleValue( "VISU", "point_sprite_clamp", GetClamp() ); + vtkFloatingPointType aClamp = aResourceMgr->doubleValue( "VISU", "point_sprite_clamp", GetClamp() ); SetClamp( aClamp ); int aMinSize = aResourceMgr->integerValue( "VISU", "point_sprite_min_size", ( int )( GetMinSize() * 100.0 ) ); @@ -178,7 +178,7 @@ VISU::GaussPoints_i int aMagnification = aResourceMgr->integerValue( "VISU", "point_sprite_magnification", ( int )( GetMagnification() * 100.0 ) ); SetMagnification( aMagnification / 100.0 ); - float anIncrement = aResourceMgr->doubleValue( "VISU", "point_sprite_increment", GetMagnificationIncrement() ); + vtkFloatingPointType anIncrement = aResourceMgr->doubleValue( "VISU", "point_sprite_increment", GetMagnificationIncrement() ); SetMagnificationIncrement( anIncrement ); bool isColored = aResourceMgr->booleanValue( "VISU", "point_sprite_results", GetIsColored() ); @@ -187,7 +187,7 @@ VISU::GaussPoints_i QColor aColor = aResourceMgr->colorValue( "VISU", "point_sprite_color", GetColor() ); SetColor( aColor ); - float anAlphaThreshold = aResourceMgr->doubleValue( "VISU", "point_sprite_alpha_threshold", GetAlphaThreshold() ); + vtkFloatingPointType anAlphaThreshold = aResourceMgr->doubleValue( "VISU", "point_sprite_alpha_threshold", GetAlphaThreshold() ); SetAlphaThreshold( anAlphaThreshold ); int aResolution = aResourceMgr->integerValue( "VISU", "geom_sphere_resolution", GetResolution() ); @@ -322,12 +322,12 @@ VISU::GaussPoints_i void VISU::GaussPoints_i -::SetScaleFactor( float theScaleFactor ) +::SetScaleFactor( vtkFloatingPointType theScaleFactor ) { myGaussPointsPL->SetScale( theScaleFactor ); } -float +vtkFloatingPointType VISU::GaussPoints_i ::GetScaleFactor() { @@ -376,12 +376,12 @@ VISU::GaussPoints_i void VISU::GaussPoints_i -::SetAlphaThreshold( float theAlphaThreshold ) +::SetAlphaThreshold( vtkFloatingPointType theAlphaThreshold ) { myGaussPointsPL->SetAlphaThreshold( theAlphaThreshold ); } -float +vtkFloatingPointType VISU::GaussPoints_i ::GetAlphaThreshold() { @@ -416,7 +416,7 @@ VISU::GaussPoints_i return myGaussPointsPL->GetPrimitiveType(); } -float +vtkFloatingPointType VISU::GaussPoints_i ::GetMaximumSupportedSize() { @@ -425,12 +425,12 @@ VISU::GaussPoints_i void VISU::GaussPoints_i -::SetClamp(float theClamp) +::SetClamp(vtkFloatingPointType theClamp) { myGaussPointsPL->SetClamp( theClamp ); } -float +vtkFloatingPointType VISU::GaussPoints_i ::GetClamp() { @@ -439,12 +439,12 @@ VISU::GaussPoints_i void VISU::GaussPoints_i -::SetGeomSize( float theGeomSize ) +::SetGeomSize( vtkFloatingPointType theGeomSize ) { myGaussPointsPL->SetSize( theGeomSize ); } -float +vtkFloatingPointType VISU::GaussPoints_i ::GetGeomSize() { @@ -453,12 +453,12 @@ VISU::GaussPoints_i void VISU::GaussPoints_i -::SetMinSize( float theMinSize ) +::SetMinSize( vtkFloatingPointType theMinSize ) { myGaussPointsPL->SetMinSize( theMinSize ); } -float +vtkFloatingPointType VISU::GaussPoints_i ::GetMinSize() { @@ -467,12 +467,12 @@ VISU::GaussPoints_i void VISU::GaussPoints_i -::SetMaxSize( float theMaxSize ) +::SetMaxSize( vtkFloatingPointType theMaxSize ) { myGaussPointsPL->SetMaxSize( theMaxSize ); } -float +vtkFloatingPointType VISU::GaussPoints_i ::GetMaxSize() { @@ -481,12 +481,12 @@ VISU::GaussPoints_i void VISU::GaussPoints_i -::SetMagnification( float theMagnification ) +::SetMagnification( vtkFloatingPointType theMagnification ) { myGaussPointsPL->SetMagnification( theMagnification ); } -float +vtkFloatingPointType VISU::GaussPoints_i ::GetMagnification() { @@ -495,12 +495,12 @@ VISU::GaussPoints_i void VISU::GaussPoints_i -::SetMagnificationIncrement( float theIncrement ) +::SetMagnificationIncrement( vtkFloatingPointType theIncrement ) { myGaussPointsPL->SetMagnificationIncrement( theIncrement ); } -float +vtkFloatingPointType VISU::GaussPoints_i ::GetMagnificationIncrement() { @@ -639,14 +639,14 @@ VISU::GaussPoints_i vtkTextProperty* aTitleProp = theScalarBar->GetTitleTextProperty(); aTitleProp->SetFontFamily(myTitFontType); - aTitleProp->SetColor(myTitleColor); + aTitleProp->SetColor(myTitleColor[0],myTitleColor[1],myTitleColor[2]); (myIsBoldTitle)? aTitleProp->BoldOn() : aTitleProp->BoldOff(); (myIsItalicTitle)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff(); (myIsShadowTitle)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff(); vtkTextProperty* aLabelProp = theScalarBar->GetLabelTextProperty(); aLabelProp->SetFontFamily(myLblFontType); - aLabelProp->SetColor(myLabelColor); + aLabelProp->SetColor(myLabelColor[0],myLabelColor[1],myLabelColor[2]); (myIsBoldLabel)? aLabelProp->BoldOn() : aLabelProp->BoldOff(); (myIsItalicLabel)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff(); (myIsShadowLabel)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff(); @@ -666,7 +666,7 @@ VISU::GaussPoints_i anActor->SetBarVisibility(true); myPipeLine->GetMapper()->SetScalarVisibility(1); - float aRange[2]; + vtkFloatingPointType aRange[2]; myScalarMapPL->GetSourceRange(aRange); aScalarBarCtrl->SetRangeLocal(aRange); @@ -687,7 +687,7 @@ VISU::GaussPoints_i } if(aScalarBarMode == VISU_ScalarBarCtrl::eGlobal){ - float aRangeGlobal[2]; + vtkFloatingPointType aRangeGlobal[2]; // aRangeGlobal[0] = aTMinMax.first; aRangeGlobal[1] = aTMinMax.second; @@ -813,12 +813,12 @@ VISU::GaussPoints_i void VISU::GaussPoints_i -::SetSpacing(const float theSpacing) +::SetSpacing(const vtkFloatingPointType theSpacing) { mySpacing = theSpacing; } -float +vtkFloatingPointType VISU::GaussPoints_i ::GetSpacing() const { diff --git a/src/VISU_I/VISU_GaussPoints_i.hh b/src/VISU_I/VISU_GaussPoints_i.hh index aa9893bb..54d53d6b 100644 --- a/src/VISU_I/VISU_GaussPoints_i.hh +++ b/src/VISU_I/VISU_GaussPoints_i.hh @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_PrsObject_i.hxx @@ -86,11 +86,11 @@ namespace VISU void SetIsDeformed( bool theIsDeformed ); - float + vtkFloatingPointType GetScaleFactor(); void - SetScaleFactor( float theScaleFactor ); + SetScaleFactor( vtkFloatingPointType theScaleFactor ); //! Get color for Geometry mode of the presentation. QColor @@ -132,10 +132,10 @@ namespace VISU //! Redirect the request to VISU_GaussPointsPL::SetAlphaThreshold. void - SetAlphaThreshold(float theAlphaThreshold); + SetAlphaThreshold(vtkFloatingPointType theAlphaThreshold); //! Redirect the request to VISU_GaussPointsPL::GetAlphaThreshold. - float + vtkFloatingPointType GetAlphaThreshold(); //! Redirect the request to VISU_GaussPointsPL::SetResolution. @@ -153,55 +153,55 @@ namespace VISU GetPrimitiveType(); //! Redirect the request to VISU_GaussPointsPL::GetMaximumSupportedSize. - float + vtkFloatingPointType GetMaximumSupportedSize(); //! Redirect the request to VISU_GaussPointsPL::SetClamp. void - SetClamp(float theClamp); + SetClamp(vtkFloatingPointType theClamp); //! Redirect the request to VISU_GaussPointsPL::GetClamp. - float + vtkFloatingPointType GetClamp(); //! Redirect the request to VISU_GaussPointsPL::SetSize. void - SetGeomSize(float theGeomSize); + SetGeomSize(vtkFloatingPointType theGeomSize); //! Redirect the request to VISU_GaussPointsPL::GetSize. - float + vtkFloatingPointType GetGeomSize(); //! Redirect the request to VISU_GaussPointsPL::SetMinSize. void - SetMinSize(float theMinSize); + SetMinSize(vtkFloatingPointType theMinSize); //! Redirect the request to VISU_GaussPointsPL::GetMinSize. - float + vtkFloatingPointType GetMinSize(); //! Redirect the request to VISU_GaussPointsPL::SetMaxSize. void - SetMaxSize(float theMaxSize); + SetMaxSize(vtkFloatingPointType theMaxSize); //! Redirect the request to VISU_GaussPointsPL::GetMaxSize. - float + vtkFloatingPointType GetMaxSize(); //! Redirect the request to VISU_GaussPointsPL::SetMagnification. void - SetMagnification(float theMagnification); + SetMagnification(vtkFloatingPointType theMagnification); //! Redirect the request to VISU_GaussPointsPL::GetMagnification. - float + vtkFloatingPointType GetMagnification(); //! Redirect the request to VISU_GaussPointsPL::SetMagnificationIncrement. void - SetMagnificationIncrement(float theIncrement); + SetMagnificationIncrement(vtkFloatingPointType theIncrement); //! Redirect the request to VISU_GaussPointsPL::GetMagnificationIncrement. - float + vtkFloatingPointType GetMagnificationIncrement(); //! Set flag indicating which scalar bar is active. @@ -230,10 +230,10 @@ namespace VISU //! Set value of the distance between global and local scalar bars. void - SetSpacing(const float theSpacing); + SetSpacing(const vtkFloatingPointType theSpacing); //! Get value of the distance between global and local scalar bars. - float + vtkFloatingPointType GetSpacing() const; //! Let know is the global range is already calculated @@ -279,7 +279,7 @@ namespace VISU bool myIsDispGlobalScalarBar; bool myIsActiveLocalScalarBar; QColor myColor; - float mySpacing; + vtkFloatingPointType mySpacing; int myFaceLimit; QString myMainTexture; diff --git a/src/VISU_I/VISU_Gen_i.cc b/src/VISU_I/VISU_Gen_i.cc index be502de4..cd1ba85b 100644 --- a/src/VISU_I/VISU_Gen_i.cc +++ b/src/VISU_I/VISU_Gen_i.cc @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_Gen_i.cc @@ -85,6 +85,7 @@ #include #include "Utils_ExceptHandlers.hxx" +#include "CASCatch.hxx" using namespace std; @@ -238,18 +239,23 @@ namespace VISU const char* theFieldName, CORBA::Double theIteration) { + CASCatch_TRY{ #ifndef _DEXCEPT_ - try{ + try{ #endif - if(theColoredPrs3d->Create(theMeshName,theEntity,theFieldName,int(theIteration))) - return true; + if(theColoredPrs3d->Create(theMeshName,theEntity,theFieldName,int(theIteration))) + return true; #ifndef _DEXCEPT_ - }catch(std::exception& exc){ - INFOS("Follow exception was occured :\n"<GetMessageString()); + } return false; } @@ -299,58 +305,69 @@ namespace VISU //=========================================================================== SALOMEDS::TMPFile* VISU_Gen_i::Save(SALOMEDS::SComponent_ptr theComponent, const char* theURL, - bool isMultiFile) + bool theIsMultiFile) { Mutex mt(myMutex); - string aDir = isMultiFile ? theURL : SALOMEDS_Tool::GetTmpDir(); - TCollection_AsciiString aTmpDir (const_cast(aDir.c_str())); + string aTmpDir = theURL; if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - "<GetStudy(); - - //CORBA::Boolean anIsValidScript; - //Engines::TMPFile_var aDump = DumpPython(aStudy,false,anIsValidScript); + + typedef std::vector TFileNames; + TFileNames aFileNames; + TFileNames aFiles; - SALOMEDS::ChildIterator_var itBig = aStudy->NewChildIterator(theComponent); - for (; itBig->More(); itBig->Next()) { - SALOMEDS::SObject_var gotBranch = itBig->Value(); + SALOMEDS::Study_var aStudy = theComponent->GetStudy(); + SALOMEDS::ChildIterator_var anIter = aStudy->NewChildIterator(theComponent); + for (; anIter->More(); anIter->Next()) { + SALOMEDS::SObject_var gotBranch = anIter->Value(); CORBA::Object_var anObj = SObjectToObject(gotBranch); if(CORBA::is_nil(anObj)) continue; - if(Result_i* pResult = dynamic_cast(GetServant(anObj).in())){ - switch(pResult->GetCreationId()){ + if(Result_i* aResult = dynamic_cast(GetServant(anObj).in())){ + switch(aResult->GetCreationId()){ case Result_i::eImportFile: case Result_i::eCopyAndImportFile: { - const QFileInfo& aFileInfo = pResult->GetFileInfo(); - QString aPrefix(""); - if (isMultiFile) aPrefix = SALOMEDS_Tool::GetNameFromPath(aStudy->URL()).c_str(); - QString aFileName = aPrefix + "_" + (pResult->GetName()).c_str(); - static QString aCommand; - aCommand.sprintf("cp %s %s%s",aFileInfo.filePath().latin1(),aTmpDir.ToCString(),aFileName.latin1()); - - int aRes = system(aCommand); - if(aRes){ - if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - Cann't execute the command :"<URL()) + aFileName; + + std::ostringstream aStream; + aStream<<"cp "< 0){ - SALOMEDS::ListOfFileNames_var aSeq = new SALOMEDS::ListOfFileNames; - aSeq->length(aFileNames.Length()); - for(aCounter = aFileNames.Length(); aCounter > 0; aCounter--) - aSeq[aCounter-1] = CORBA::string_dup(aFileNames.Value(aCounter).ToCString()); - aStreamFile = SALOMEDS_Tool::PutFilesToStream(aTmpDir.ToCString(), aSeq.in(), isMultiFile); - if(!isMultiFile) - SALOMEDS_Tool::RemoveTemporaryFiles(aTmpDir.ToCString(), aSeq.in(), true); + + if(MYDEBUG) MESSAGE("VISU_Gen_i::Save - aFileNames.size() - "<length(aFileNames.size()); + for(int aCounter = aFileNames.size(); aCounter > 0; aCounter--) + aListOfFileNames[aCounter-1] = aFileNames[aCounter-1].c_str(); + } + + SALOMEDS::ListOfFileNames_var aListOfFiles = new SALOMEDS::ListOfFileNames; + aListOfFiles->length(aFiles.size()); + if(!aFiles.empty()){ + for(int aCounter = aFileNames.size(); aCounter > 0; aCounter--) + aListOfFiles[aCounter-1] = aFiles[aCounter-1].c_str(); } + + SALOMEDS::TMPFile_var aStreamFile = new SALOMEDS::TMPFile(0); + if(theIsMultiFile) + aStreamFile = SALOMEDS_Tool::PutFilesToStream(aTmpDir, aListOfFiles.in(), theIsMultiFile); + else + aStreamFile = SALOMEDS_Tool::PutFilesToStream(aListOfFiles.in(), aListOfFileNames.in()); + return aStreamFile._retn(); } @@ -588,6 +605,85 @@ namespace VISU } } + void VISU_Gen_i::RenameMeshInStudy(Result_ptr theResult, + string theMeshName, + int theEntity, // -1 for group indication + string theSubMeshName, // Family or Group name + string theNewName) + { + if (myStudyDocument->GetProperties()->IsLocked()) return; + Mutex mt(myMutex); + + Result_i* pResult = dynamic_cast(GetServant(theResult).in()); + if (!pResult) return; + + QString aComment; + VISU::VISUType aType; + if (theEntity >= 0) + if (theSubMeshName == "") + aType = VISU::TENTITY; + else + aType = VISU::TFAMILY; + else + aType = VISU::TGROUP; + + switch (aType) { + case VISU::TENTITY: + aComment.sprintf("myComment=ENTITY;myType=%d;myMeshName=%s;myId=%d", + VISU::TENTITY, theMeshName.c_str(), theEntity); + break; + case VISU::TFAMILY: + aComment.sprintf("myComment=FAMILY;myType=%d;myMeshName=%s;myEntityId=%d;myName=%s", + VISU::TFAMILY, theMeshName.c_str(), theEntity, theSubMeshName.c_str()); + break; + case VISU::TGROUP: + aComment.sprintf("myComment=GROUP;myType=%d;myMeshName=%s;myName=%s", + VISU::TGROUP, theMeshName.c_str(), theSubMeshName.c_str()); + break; + } + + string aResultEntry = pResult->GetEntry(); + string anEntry = pResult->GetEntry(aComment.latin1()); + if (anEntry == "") return; + + SALOMEDS::SObject_ptr aSObject = myStudyDocument->FindObjectID(anEntry.c_str()); + + SALOMEDS::StudyBuilder_var aStudyBuilder = myStudyDocument->NewBuilder(); + aStudyBuilder->NewCommand(); // There is a transaction + + SALOMEDS::GenericAttribute_var anAttr = + aStudyBuilder->FindOrCreateAttribute(aSObject,"AttributeName"); + SALOMEDS::AttributeName_var aNameAttr = SALOMEDS::AttributeName::_narrow(anAttr); + aNameAttr->SetValue(theNewName.c_str()); + + aStudyBuilder->CommitCommand(); + } + + void VISU_Gen_i::RenameEntityInStudy(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theNewName) + { + RenameMeshInStudy(theResult, theMeshName, (int)theEntity, "", theNewName); + } + + void VISU_Gen_i::RenameFamilyInStudy(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFamilyName, + const char* theNewName) + { + RenameMeshInStudy(theResult, theMeshName, (int)theEntity, theFamilyName, theNewName); + } + + void VISU_Gen_i::RenameGroupInStudy(Result_ptr theResult, + const char* theMeshName, + const char* theGroupName, + const char* theNewName) + { + RenameMeshInStudy(theResult, theMeshName, -1, theGroupName, theNewName); + } + Mesh_ptr VISU_Gen_i::MeshOnEntity(Result_ptr theResult, const char* theMeshName, VISU::Entity theEntity) diff --git a/src/VISU_I/VISU_Gen_i.hh b/src/VISU_I/VISU_Gen_i.hh index d8008b2f..04870fc5 100644 --- a/src/VISU_I/VISU_Gen_i.hh +++ b/src/VISU_I/VISU_Gen_i.hh @@ -1,11 +1,25 @@ -// Copyright (C) 2003 CEA/DEN, EDF R&D +// 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_GEN_i.h file +// File : VISU_Gen_i.hh // Author : Alexey Petrov // Module : VISU -// $Header: #ifndef __VISU_GEN_I_H__ #define __VISU_GEN_I_H__ @@ -15,6 +29,8 @@ #include "SALOME_Component_i.hxx" #include "SALOME_NamingService.hxx" +#include + namespace VISU { class Result_i; @@ -91,6 +107,33 @@ namespace VISU ImportMedField(SALOME_MED::FIELD_ptr theField); + //Rename Presentation Of Submeshes + void + RenameMeshInStudy(Result_ptr theResult, + std::string theMeshName, + int theEntity, // -1 for group indication + std::string theSubMeshName, // Family or Group name + std::string theNewName); + virtual + void + RenameEntityInStudy(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theNewName); + virtual + void + RenameFamilyInStudy(Result_ptr theResult, + const char* theMeshName, + VISU::Entity theEntity, + const char* theFamilyName, + const char* theNewName); + virtual + void + RenameGroupInStudy(Result_ptr theResult, + const char* theMeshName, + const char* theGroupName, + const char* theNewName); + //Create Presentation Of Submeshes virtual Mesh_ptr diff --git a/src/VISU_I/VISU_I.cxx b/src/VISU_I/VISU_I.cxx index a3a39f28..649d25df 100644 --- a/src/VISU_I/VISU_I.cxx +++ b/src/VISU_I/VISU_I.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // diff --git a/src/VISU_I/VISU_IsoSurfaces_i.cc b/src/VISU_I/VISU_IsoSurfaces_i.cc index 4198c8a6..0f0077bc 100644 --- a/src/VISU_I/VISU_IsoSurfaces_i.cc +++ b/src/VISU_I/VISU_IsoSurfaces_i.cc @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_PrsObject_i.cxx @@ -29,6 +29,8 @@ #include "VISU_IsoSurfaces_i.hh" #include "VISU_Actor.h" +#include "SUIT_ResourceMgr.h" + using namespace VISU; using namespace std; @@ -115,8 +117,9 @@ CORBA::Long VISU::IsoSurfaces_i::GetNbSurfaces(){ } -void VISU::IsoSurfaces_i::SetSubRange(CORBA::Double theMin, CORBA::Double theMax){ - float aRange[2] = {theMin, theMax}; +void VISU::IsoSurfaces_i::SetSubRange(CORBA::Double theMin, CORBA::Double theMax) +{ + vtkFloatingPointType aRange[2] = {theMin, theMax}; myIsoSurfacesPL->SetRange(aRange); } CORBA::Double VISU::IsoSurfaces_i::GetSubMin(){ @@ -142,6 +145,9 @@ VISU::IsoSurfaces_i { if(VISU_Actor* anActor = ScalarMap_i::CreateActor(theIO)){ anActor->SetVTKMapping(true); + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + int aDispMode = aResourceMgr->integerValue("VISU" , "iso_surfaces_represent", 2); + anActor->SetRepresentation(aDispMode); return anActor; } return NULL; diff --git a/src/VISU_I/VISU_IsoSurfaces_i.hh b/src/VISU_I/VISU_IsoSurfaces_i.hh index b36074ae..0916b66d 100644 --- a/src/VISU_I/VISU_IsoSurfaces_i.hh +++ b/src/VISU_I/VISU_IsoSurfaces_i.hh @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_PrsObject_i.hxx diff --git a/src/VISU_I/VISU_Mesh_i.cc b/src/VISU_I/VISU_Mesh_i.cc index 2a65400b..cdd8dc00 100644 --- a/src/VISU_I/VISU_Mesh_i.cc +++ b/src/VISU_I/VISU_Mesh_i.cc @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_PrsObject_i.cxx @@ -35,6 +35,8 @@ #include "SALOME_Event.hxx" +#include "SUIT_ResourceMgr.h" + using namespace VISU; using namespace std; @@ -227,7 +229,9 @@ VISU::Storable* VISU::Mesh_i::Build (int theRestoring) if (myResult->GetInput() == NULL) throw std::runtime_error("Mesh_i::Build - myResult->GetInput() == NULL !!!"); if (!theRestoring) { - myPresentType = VISU::SHADED; + myPresentType = VISU::PresentationType(VISU::GetResourceMgr()->integerValue("VISU" , "mesh_represent", 2)); + if(myEntity == VISU::NODE_ENTITY) + myPresentType = VISU::POINT; myName = GenerateName().latin1(); myCellColor.R = 0.0; myCellColor.G = myCellColor.B = 1.0; myNodeColor.R = myNodeColor.G = 1.0; myNodeColor.B = 1.0; @@ -273,7 +277,8 @@ VISU::Storable* VISU::Mesh_i::Build (int theRestoring) myMeshPL->Init(); string aResultEntry = myResult->GetEntry(); string anEntry = myResult->GetEntry(aComment.latin1()); - if(anEntry == "") throw std::runtime_error("Mesh_i::Build - anEntry was not found !!!"); + if(anEntry == "") + throw std::runtime_error("Mesh_i::Build - anEntry was not found !!!"); mySObject = myStudy->FindObjectID(anEntry.c_str()); SALOMEDS::StudyBuilder_var aStudyBuilder = myStudy->NewBuilder(); SALOMEDS::GenericAttribute_var anAttr = aStudyBuilder->FindOrCreateAttribute(mySObject,"AttributeIOR"); @@ -298,6 +303,9 @@ VISU_Actor* VISU::Mesh_i::CreateActor(const Handle(SALOME_InteractiveObject)& th VISU_MeshAct* anActor = VISU_MeshAct::New(); try{ VISU::Prs3d_i::CreateActor(anActor,theIO); + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + bool toShrink = aResourceMgr->booleanValue("VISU", "mesh_shrink", false); + if (toShrink) anActor->SetShrink(); UpdateActor(anActor); }catch (...) { anActor->Delete(); diff --git a/src/VISU_I/VISU_Mesh_i.hh b/src/VISU_I/VISU_Mesh_i.hh index 7649f1ab..d405a95b 100644 --- a/src/VISU_I/VISU_Mesh_i.hh +++ b/src/VISU_I/VISU_Mesh_i.hh @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_PrsObject_i.hxx diff --git a/src/VISU_I/VISU_Plot3D_i.cc b/src/VISU_I/VISU_Plot3D_i.cc index 0cc631b2..d86ca318 100644 --- a/src/VISU_I/VISU_Plot3D_i.cc +++ b/src/VISU_I/VISU_Plot3D_i.cc @@ -15,7 +15,7 @@ // 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/ +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #include "VISU_Plot3D_i.hh" @@ -26,6 +26,8 @@ #include "VISU_Actor.h" +#include "SUIT_ResourceMgr.h" + using namespace VISU; using namespace std; @@ -190,6 +192,9 @@ VISU::Plot3D_i { if(VISU_Actor* anActor = ScalarMap_i::CreateActor(theIO)){ anActor->SetVTKMapping(true); + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + int aDispMode = aResourceMgr->integerValue("VISU", "plot3d_represent", 2); + anActor->SetRepresentation(aDispMode); return anActor; } return NULL; diff --git a/src/VISU_I/VISU_Plot3D_i.hh b/src/VISU_I/VISU_Plot3D_i.hh index 58006072..6b861fba 100644 --- a/src/VISU_I/VISU_Plot3D_i.hh +++ b/src/VISU_I/VISU_Plot3D_i.hh @@ -15,7 +15,7 @@ // 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/ +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // #ifndef VISU_Plot3D_i_HeaderFile diff --git a/src/VISU_I/VISU_Prs3d_i.cc b/src/VISU_I/VISU_Prs3d_i.cc index 64bb0bb9..70d0e429 100644 --- a/src/VISU_I/VISU_Prs3d_i.cc +++ b/src/VISU_I/VISU_Prs3d_i.cc @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_Prs3d_i.cc @@ -252,7 +252,7 @@ VISU::Prs3d_i theActor->SetPrs3d(this); theActor->SetShrinkFactor(); - theActor->SetPosition(myOffset); + theActor->SetPosition(myOffset[0],myOffset[1],myOffset[2]); theActor->SetPipeLine(GetPipeLine()); theActor->SetFactory(this); @@ -265,8 +265,8 @@ VISU::Prs3d_i }catch(std::bad_alloc& ex){ throw std::runtime_error("CreateActor >> No enough memory"); throw ex; - } catch(std::exception& ex){ - throw ex; + } catch(std::exception&){ + throw; }catch(...) { throw std::runtime_error("CreateActor >> unexpected exception was caught!!!"); } @@ -295,7 +295,7 @@ VISU::Prs3d_i { if(MYDEBUG) MESSAGE("Prs3d_i::UpdateActor - this = "< +#include "VTKViewer.h" + #include class VISU_PipeLine; @@ -184,25 +185,31 @@ namespace VISU GetClippingPlane(vtkIdType theID) const; void - SetPlaneParam(float theDir[3], float theDist, vtkPlane* thePlane); + SetPlaneParam(vtkFloatingPointType theDir[3], + vtkFloatingPointType theDist, + vtkPlane* thePlane); //---------------------------------------------------------------------------- void - GetBounds(float aBounds[6]); + GetBounds(vtkFloatingPointType aBounds[6]); void - SetOffset(const float* theOffsets); + SetOffset(const CORBA::Float* theOffsets); virtual void - SetOffset(float theDx, float theDy, float theDz); + SetOffset(CORBA::Float theDx, + CORBA::Float theDy, + CORBA::Float theDz); void - GetOffset(float* theOffsets); + GetOffset(CORBA::Float* theOffsets); virtual void - GetOffset(float& theDx, float& theDy, float& theDz); + GetOffset(CORBA::Float& theDx, + CORBA::Float& theDy, + CORBA::Float& theDz); //---------------------------------------------------------------------------- protected: @@ -220,7 +227,7 @@ namespace VISU CheckDataSet(); bool myAddToStudy; - float myOffset[3]; + CORBA::Float myOffset[3]; Result_i *myResult; VISU_PipeLine *myPipeLine; SALOMEDS::SObject_var mySObject; diff --git a/src/VISU_I/VISU_PrsObject_i.cc b/src/VISU_I/VISU_PrsObject_i.cc index 321696a1..3a1126ca 100644 --- a/src/VISU_I/VISU_PrsObject_i.cc +++ b/src/VISU_I/VISU_PrsObject_i.cc @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_PrsObject_i.cxx diff --git a/src/VISU_I/VISU_PrsObject_i.hh b/src/VISU_I/VISU_PrsObject_i.hh index d62ada67..c9bc3de6 100644 --- a/src/VISU_I/VISU_PrsObject_i.hh +++ b/src/VISU_I/VISU_PrsObject_i.hh @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_PrsObject_i.hxx diff --git a/src/VISU_I/VISU_Result_i.cc b/src/VISU_I/VISU_Result_i.cc index 2a85df81..2abc3b87 100644 --- a/src/VISU_I/VISU_Result_i.cc +++ b/src/VISU_I/VISU_Result_i.cc @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_Result_i.cc @@ -213,12 +213,14 @@ namespace VISU aStudyBuilder->Addreference(aNewObj,aRefSObj); } - string + + //--------------------------------------------------------------- + inline + std::string CreateAttributes(_PTR(Study) theStudyDocument, const string& theFatherEntry, const string& theIOR, const string& theName, - const string& thePersistentRef, const string& theComment, CORBA::Boolean theCreateNew) { @@ -244,11 +246,6 @@ namespace VISU _PTR(AttributeName) aName (anAttr); aName->SetValue(theName); } - if (thePersistentRef != "") { - anAttr = aStudyBuilder->FindOrCreateAttribute(aNewObj, "AttributePersistentRef"); - _PTR(AttributePersistentRef) aPRef (anAttr); - aPRef->SetValue(thePersistentRef); - } if (theComment != "") { anAttr = aStudyBuilder->FindOrCreateAttribute(aNewObj, "AttributeComment"); _PTR(AttributeComment) aCmnt (anAttr); @@ -257,6 +254,54 @@ namespace VISU return aNewObj->GetID(); } + + //--------------------------------------------------------------- + inline + void + UpdateAttributes(_PTR(Study) theStudyDocument, + const string& theEntry, + const string& theIOR, + const string& theName, + const string& theComment) + { + TLock aLock(myMutex); + + _PTR(StudyBuilder) aStudyBuilder = theStudyDocument->NewBuilder(); + _PTR(SObject) aSObject = theStudyDocument->FindObjectID(theEntry); + + _PTR(GenericAttribute) anAttr; + if (theIOR != "") { + anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeIOR"); + _PTR(AttributeIOR) anIOR (anAttr); + anIOR->SetValue(theIOR); + } + if (theName != "") { + anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeName"); + _PTR(AttributeName) aName (anAttr); + aName->SetValue(theName); + } + if (theComment != "") { + anAttr = aStudyBuilder->FindOrCreateAttribute(aSObject, "AttributeComment"); + _PTR(AttributeComment) aCmnt (anAttr); + aCmnt->SetValue(theComment); + } + } + + + //--------------------------------------------------------------- + inline + void + RemoveSObject(_PTR(Study) theStudyDocument, + const string& theEntry) + { + TLock aLock(myMutex); + + _PTR(StudyBuilder) aStudyBuilder = theStudyDocument->NewBuilder(); + _PTR(SObject) aSObject = theStudyDocument->FindObjectID(theEntry); + aStudyBuilder->RemoveObject(aSObject); + } + + //--------------------------------------------------------------- struct TResultManager { @@ -339,6 +384,9 @@ namespace VISU VISU_Convertor* theInput, CORBA::Boolean* theIsDone, std::string theResultEntry, + CORBA::Boolean theIsAtOnce, + CORBA::Boolean theIsBuildGroups, + CORBA::Boolean theIsBuildFields, _PTR(Study) theStudy) { if(*theIsDone) @@ -371,7 +419,6 @@ namespace VISU theResultEntry, "", aMeshName, - "", aComment.latin1(), true); @@ -382,9 +429,29 @@ namespace VISU aMesh->myEntry, "", "Families", - "", aComment.latin1(), true); + + if(theIsBuildGroups){ + aMesh->myGroupsEntry = + CreateAttributes(theStudy, + aMesh->myEntry, + "", + "", + "", + true); + } + + if(theIsBuildFields){ + aMesh->myFieldsEntry = + CreateAttributes(theStudy, + aMesh->myEntry, + "", + "", + "", + true); + } + //Import entities TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin(); for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){ @@ -419,7 +486,6 @@ namespace VISU aSubMeshesEntry, "", anEntityName.c_str(), - "", aComment.latin1(), true); } @@ -434,6 +500,7 @@ namespace VISU VISU_Convertor* theInput, CORBA::Boolean* theIsDone, CORBA::Boolean theIsBuild, + CORBA::Boolean theIsAtOnce, _PTR(Study) theStudy) { if(!theIsBuild || *theIsDone) @@ -479,7 +546,6 @@ namespace VISU aMeshOnEntity->myEntry, "", aFamilyName, - "", aComment.latin1(), true); } @@ -489,14 +555,13 @@ namespace VISU if(!aGroupMap.empty()){ aComment.sprintf("myComment=GROUPS;myMeshName=%s", aMeshName.c_str()); - string aGroupsEntry = - CreateAttributes(theStudy, - aMesh->myEntry, - "", - "Groups", - "", - aComment.latin1(), - true); + + UpdateAttributes(theStudy, + aMesh->myGroupsEntry, + "", + "Groups", + aComment.latin1()); + TGroupMap::const_iterator aGroupMapIter = aGroupMap.begin(); for(; aGroupMapIter != aGroupMap.end(); aGroupMapIter++){ const string& aGroupName = aGroupMapIter->first; @@ -505,10 +570,9 @@ namespace VISU TGROUP,aMeshName.c_str(),aGroupName.c_str()); aGroup->myEntry = CreateAttributes(theStudy, - aGroupsEntry, + aMesh->myGroupsEntry, "", aGroupName, - "", aComment.latin1(), true); const TFamilySet& aFamilySet = aGroup->myFamilySet; @@ -520,7 +584,9 @@ namespace VISU aFamily->myEntry); } } - } + }else if(!theIsAtOnce) + RemoveSObject(theStudy, + aMesh->myGroupsEntry); } ProcessVoidEvent(new TUpdateObjBrowser(theStudy->StudyId(),theIsDone)); @@ -533,6 +599,7 @@ namespace VISU VISU_Convertor* theInput, CORBA::Boolean* theIsDone, CORBA::Boolean theIsBuild, + CORBA::Boolean theIsAtOnce, _PTR(Study) theStudy) { if(!theIsBuild || *theIsDone) @@ -559,9 +626,7 @@ namespace VISU continue; //Import fields - string aFieldsEntry; - bool anIsFieldsEntryCreated = false; - + bool anIsFieldsEntryUpdated = false; TMeshOnEntityMap::const_iterator aMeshOnEntityMapIter = aMeshOnEntityMap.begin(); for(; aMeshOnEntityMapIter != aMeshOnEntityMap.end(); aMeshOnEntityMapIter++){ const TEntity& anEntity = aMeshOnEntityMapIter->first; @@ -569,18 +634,17 @@ namespace VISU const TFieldMap& aFieldMap = aMeshOnEntity->myFieldMap; TFieldMap::const_iterator aFieldMapIter = aFieldMap.begin(); for(; aFieldMapIter != aFieldMap.end(); aFieldMapIter++){ - if(!anIsFieldsEntryCreated){ + if(!anIsFieldsEntryUpdated){ aComment.sprintf("myComment=FIELDS;myMeshName=%s", aMeshName.c_str()); - aFieldsEntry = - CreateAttributes(theStudy, - aMesh->myEntry, - "", - "Fields", - "", - aComment.latin1(), - true); - anIsFieldsEntryCreated = true; + + UpdateAttributes(theStudy, + aMesh->myFieldsEntry, + "", + "Fields", + aComment.latin1()); + + anIsFieldsEntryUpdated = true; } const string& aFieldName = aFieldMapIter->first; const PField& aField = aFieldMapIter->second; @@ -595,10 +659,9 @@ namespace VISU aField->myNbComp); aField->myEntry = CreateAttributes(theStudy, - aFieldsEntry, + aMesh->myFieldsEntry, "", aFieldNameWithUnit.latin1(), - "", aComment.latin1(), true); CreateReference(theStudy, @@ -621,12 +684,15 @@ namespace VISU aField->myEntry, "", aTimeStampId, - "", aComment.latin1(), true); } } } + + if(!anIsFieldsEntryUpdated && !theIsAtOnce) + RemoveSObject(theStudy, + aMesh->myFieldsEntry); } ProcessVoidEvent(new TUpdateObjBrowser(theStudy->StudyId(),theIsDone)); @@ -670,6 +736,7 @@ namespace VISU theInput, theIsFieldsDone, theIsBuildFields, + false, theStudy); BuildMinMax(theResult, @@ -732,6 +799,9 @@ namespace VISU theBuildArgs.myInput, theBuildArgs.myIsEntitiesDone, theBuildArgs.myResultEntry, + false, + theBuildArgs.myIsBuildGroups, + theBuildArgs.myIsBuildFields, theBuildArgs.myStudy); { boost::thread aThread(boost::bind(&BuildGroups, @@ -739,6 +809,7 @@ namespace VISU theBuildArgs.myInput, theBuildArgs.myIsGroupsDone, theBuildArgs.myIsBuildGroups, + false, theBuildArgs.myStudy)); } { @@ -787,20 +858,23 @@ VISU::Result_i ::Result_i (SALOMEDS::Study_ptr theStudy, const ESourceId& theSourceId, const ECreationId& theCreationId, - CORBA::Boolean theIsBuildImmediately): + CORBA::Boolean theIsBuildImmediately, + CORBA::Boolean theIsBuildFields, + CORBA::Boolean theIsBuildMinMax, + CORBA::Boolean theIsBuildGroups): myStudyDocument(SALOMEDS::Study::_duplicate(theStudy)), myCreationId(theCreationId), mySourceId(theSourceId), myIsBuildImmediately(theIsBuildImmediately), - myInput(NULL), + myIsBuildFields(theIsBuildFields), + myIsBuildMinMax(theIsBuildMinMax), + myIsBuildGroups(theIsBuildGroups), myIsEntitiesDone(false), myIsFieldsDone(false), myIsGroupsDone(false), myIsMinMaxDone(false), - myIsBuildFields(true), - myIsBuildGroups(true), - myIsBuildMinMax(true), - myIsAllDone(false) + myIsAllDone(false), + myInput(NULL) { myStudy = ProcessEvent(new TGetStudy(myStudyDocument->StudyId())); } @@ -992,7 +1066,6 @@ VISU::Result_i aSComponentEntry.in(), anIOR.in(), myName, - "", aComment.latin1(), true); mySObject = myStudyDocument->FindObjectID(aResultEntry.c_str()); @@ -1006,18 +1079,23 @@ VISU::Result_i myInput, &myIsEntitiesDone, aResultEntry, + theIsAtOnce, + myIsBuildGroups, + myIsBuildFields, myStudy); BuildGroups(this, myInput, &myIsGroupsDone, myIsBuildGroups, + theIsAtOnce, myStudy); BuildFields(this, myInput, &myIsFieldsDone, myIsBuildFields, + theIsAtOnce, myStudy); BuildMinMax(this, @@ -1181,7 +1259,8 @@ Restore(SALOMEDS::SObject_ptr theSObject, SALOMEDS::SObject_var aRefSObj, aTargetRefSObj; if (mySObject->FindSubObject(1, aRefSObj) && - aRefSObj->ReferencedObject(aTargetRefSObj)) { + aRefSObj->ReferencedObject(aTargetRefSObj)) + { if(MYDEBUG) MESSAGE("Result_i::GetInput - There is some reference."); SALOMEDS::SComponent_var aCompRefSObj = aTargetRefSObj->GetFatherComponent(); CORBA::String_var aDataType = aCompRefSObj->ComponentDataType(); @@ -1258,7 +1337,21 @@ Restore(SALOMEDS::SObject_ptr theSObject, } if(MYDEBUG) MESSAGE("VISU::Result_i::Restore - mySourceId = " << mySourceId); myInput = CreateConvertor(myFileInfo.filePath().latin1()); - myInput->Build(); + + myInput->BuildEntities(); + if(myIsBuildFields){ + myInput->BuildFields(); + myIsFieldsDone = true; + if(myIsBuildMinMax){ + myInput->BuildMinMax(); + myIsMinMaxDone = true; + } + } + if(myIsBuildGroups){ + myInput->BuildGroups(); + myIsGroupsDone = true; + } + QString aComment; aComment.sprintf("myComment=%s;myType=%d;myFileName=%s;myInitFileName=%s", GetComment(), VISU::TRESULT, myFileInfo.filePath().latin1(), @@ -1269,8 +1362,8 @@ Restore(SALOMEDS::SObject_ptr theSObject, SALOMEDS::AttributeComment_var aCmnt = SALOMEDS::AttributeComment::_narrow(anAttr); aCmnt->SetValue(aComment.latin1()); } - bool isBuildAll = VISU::GetResourceMgr()->booleanValue("VISU", "full_med_loading", false); - if (isBuildAll) + bool anIsBuildAll = VISU::GetResourceMgr()->booleanValue("VISU", "full_med_loading", false); + if(anIsBuildAll) BuildAll(); return this; } catch(std::exception& exc) { @@ -1357,6 +1450,9 @@ VISU::Result_i Storable::DataToStream(theStr,"myName",myName.c_str()); Storable::DataToStream(theStr,"myInitFileName",myInitFileName.c_str()); Storable::DataToStream(theStr,"myCreationId",myCreationId); + Storable::DataToStream(theStr,"myIsBuildFields",myIsFieldsDone); + Storable::DataToStream(theStr,"myIsBuildMinMax",myIsMinMaxDone); + Storable::DataToStream(theStr,"myIsBuildGroups",myIsGroupsDone); } @@ -1374,11 +1470,20 @@ VISU::Result_i if(aCreationId == eImportMed || aCreationId == eImportMedField) aSourceId = eRestoredComponent; - VISU::Result_i* pResult = new VISU::Result_i(aStudy,aSourceId,aCreationId); - if (pResult == NULL) + CORBA::Boolean anIsBuildFields = Storable::FindValue(theMap,"myIsBuildFields","0").toInt(); + CORBA::Boolean anIsBuildMinMax = Storable::FindValue(theMap,"myIsBuildMinMax","0").toInt(); + CORBA::Boolean anIsBuildGroups = Storable::FindValue(theMap,"myIsBuildGroups","0").toInt(); + + VISU::Result_i* aResult = new VISU::Result_i(aStudy, + aSourceId, + aCreationId, + anIsBuildFields, + anIsBuildMinMax, + anIsBuildGroups); + if (aResult == NULL) return NULL; - return pResult->Restore(theSObject,theMap,thePrefix); + return aResult->Restore(theSObject,theMap,thePrefix); } @@ -1446,11 +1551,13 @@ VISU::Result_i //function : GetAxisInfo //purpose : //======================================================================= -const vector< float >* Result_i::GetAxisInfo(const string& theMeshName, - TAxis theAxis, - gp_Dir& thePlaneNormal) +const Result_i::TAxisInfo* +Result_i +::GetAxisInfo(const string& theMeshName, + TAxis theAxis, + gp_Dir& thePlaneNormal) { - const vector< float >* components = NULL; + const TAxisInfo* components = NULL; if ( theAxis < AXIS_X || theAxis > AXIS_Z ) { MESSAGE(" Bad axis index " << theAxis ); @@ -1496,7 +1603,7 @@ const vector< float >* Result_i::GetAxisInfo(const string& theMeshName, if ( nbPnt != 8 ) continue; vtkPoints * points = cell->GetPoints(); - float* coords[ 4 ]; + vtkFloatingPointType* coords[ 4 ]; coords[0] = points->GetPoint( 0 ); coords[1] = points->GetPoint( 1 ); coords[2] = points->GetPoint( 3 ); @@ -1504,10 +1611,10 @@ const vector< float >* Result_i::GetAxisInfo(const string& theMeshName, gp_Pnt p0( coords[0][0], coords[0][1], coords[0][2] ); for ( iAx = 0; iAx < nbAxes; ++iAx ) { - float* coo = coords[ iAx + 1 ]; + vtkFloatingPointType* coo = coords[ iAx + 1 ]; gp_Pnt p( coo[0], coo[1], coo[2] ); // min size - float size = p0.SquareDistance( p ); + vtkFloatingPointType size = p0.SquareDistance( p ); if ( size > FLT_MIN && size < minSize[ iAx ] ) minSize[ iAx ] = size; // axis direction @@ -1537,34 +1644,34 @@ const vector< float >* Result_i::GetAxisInfo(const string& theMeshName, // get and sort intermediate component values - projections of nodes // on axis direction; define bnd box - set< float > comps[ 3 ]; + set< vtkFloatingPointType > comps[ 3 ]; Bnd_Box box; vtkPoints * points = aMesh->GetPoints(); vtkIdType iP, nbP = aMesh->GetNumberOfPoints(); for ( iP = 0; iP < nbP; ++iP ) { - float* coo = points->GetPoint( iP ); + vtkFloatingPointType* coo = points->GetPoint( iP ); gp_Pnt p( coo[0], coo[1], coo[2] ); box.Add( p ); for ( iAx = 0; iAx < nbAxes; ++iAx ) { const gp_Dir& dir = gInfo->myAxis[ iAx ]; - float dot = dir.XYZ() * p.XYZ(); + vtkFloatingPointType dot = dir.XYZ() * p.XYZ(); comps[ iAx ].insert( dot ); } } // find a range of projections of bnd box corners on each axis - float range[3], firstValue[3]; + vtkFloatingPointType range[3], firstValue[3]; double x[2],y[2],z[2]; box.Get(x[0],y[0],z[0],x[1],y[1],z[1]); for ( iAx = 0; iAx < nbAxes; ++iAx ) { - set< float > bndComps; + set< vtkFloatingPointType > bndComps; const gp_Dir& dir = gInfo->myAxis[ iAx ]; for ( int iX = 0; iX < 2; ++iX ) { for ( int iY = 0; iY < 2; ++iY ) { for ( int iZ = 0; iZ < 2; ++iZ ) { gp_Pnt p( x[ iX ], y[ iY ], z[ iZ ] ); - float dot = dir.XYZ() * p.XYZ(); + vtkFloatingPointType dot = dir.XYZ() * p.XYZ(); bndComps.insert( dot ); } } @@ -1576,14 +1683,14 @@ const vector< float >* Result_i::GetAxisInfo(const string& theMeshName, // compute component values for ( iAx = 0; iAx < nbAxes; ++iAx ) { - list< float > values; + list< vtkFloatingPointType > values; int nbVals = 0; - set< float >& comp = comps[ iAx ]; - set< float >::iterator val = comp.begin(); - float bnd = -1., rng = range[ iAx ], first = firstValue[ iAx ]; - float tol = 0.1 * sqrt( minSize[ iAx ]) / rng; + set< vtkFloatingPointType >& comp = comps[ iAx ]; + set< vtkFloatingPointType >::iterator val = comp.begin(); + vtkFloatingPointType bnd = -1., rng = range[ iAx ], first = firstValue[ iAx ]; + vtkFloatingPointType tol = 0.1 * sqrt( minSize[ iAx ]) / rng; for ( ; val != comp.end(); ++val ) { - float value = ( *val - first ) / rng; + vtkFloatingPointType value = ( *val - first ) / rng; if ( value > bnd ) { values.push_back( value ); bnd = value + tol; @@ -1591,9 +1698,9 @@ const vector< float >* Result_i::GetAxisInfo(const string& theMeshName, } } // store values in gInfo - vector< float >& myComp = gInfo->myComponets[ iAx ]; + vector< vtkFloatingPointType >& myComp = gInfo->myComponets[ iAx ]; myComp.resize( nbVals ); - list< float >::iterator v = values.begin(); + list< vtkFloatingPointType >::iterator v = values.begin(); for ( int i = 0; v != values.end(); ++v ) myComp[ i++ ] = *v; } diff --git a/src/VISU_I/VISU_Result_i.hh b/src/VISU_I/VISU_Result_i.hh index c1d4bde4..72025fda 100644 --- a/src/VISU_I/VISU_Result_i.hh +++ b/src/VISU_I/VISU_Result_i.hh @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_Result_i.hh @@ -28,10 +28,10 @@ #define __VISU_RESULT_I_H__ #include "VISUConfig.hh" +#include "VISU_BoostSignals.h" #include "SALOME_GenericObj_i.hh" -#include -#include +#include "VTKViewer.h" #include #include @@ -72,7 +72,10 @@ namespace VISU Result_i(SALOMEDS::Study_ptr theStudy, const ESourceId& theSourceId, const ECreationId& theCreationId, - CORBA::Boolean theIsBuildImmediately = true); + CORBA::Boolean theIsBuildImmediately = true, + CORBA::Boolean theIsBuildFields = true, + CORBA::Boolean theIsBuildMinMax = true, + CORBA::Boolean theIsBuildGroups = true); virtual ~Result_i(); virtual void RemoveFromStudy(); @@ -173,17 +176,18 @@ namespace VISU // Info on structured mesh contained in TInput public: typedef enum { AXIS_X = 0, AXIS_Y, AXIS_Z } TAxis; - const std::vector< float >* GetAxisInfo(const std::string& theMeshName, - TAxis theAxis, - gp_Dir& thePlaneNormal); + typedef std::vector< vtkFloatingPointType > TAxisInfo; + const TAxisInfo* GetAxisInfo(const std::string& theMeshName, + TAxis theAxis, + gp_Dir& thePlaneNormal); // Return i,j or k values and cutting plane normal for theAxis. // In the case of any problems, return NULL pointer private: struct TGridInfo { - std::vector< float > myComponets[ 3 ]; - gp_Dir myAxis [ 3 ]; + TAxisInfo myComponets[ 3 ]; + gp_Dir myAxis [ 3 ]; }; - map< string, TGridInfo > myMeshName2GridInfoMap; + std::map< std::string, TGridInfo > myMeshName2GridInfoMap; }; Result_var FindResult(SALOMEDS::SObject_ptr theSObject); diff --git a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc index 9b8868e3..71fe93cb 100644 --- a/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc +++ b/src/VISU_I/VISU_ScalarMapOnDeformedShape_i.cc @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_ScalarMapOnDeformedShape_i.cc @@ -31,6 +31,8 @@ #include "VISU_Convertor.hxx" #include "VISU_ScalarMapAct.h" +#include "SUIT_ResourceMgr.h" + #include #include #include @@ -102,6 +104,7 @@ ScalarMapOnDeformedShape_i(Result_i* theResult, VISU::Storable* VISU::ScalarMapOnDeformedShape_i::Create(const char* theMeshName, VISU::Entity theEntity, const char* theFieldName, int theIteration) { + if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::Create:"<<__LINE__<GetScalarIteration(); + string theScalarMeshName = this->GetScalarMeshName(); + string theScalarFieldName = this->GetScalarFieldName(); + if(MYDEBUG) cout << "SameAs:"<(theOrigin)){ ScalarMapOnDeformedShape_i* anOrigin = const_cast(aPrs3d); - // increment the scalar iteration for using in VISU_TimeAnimation class implementation. this->SetScalarField(anOrigin->GetScalarMeshName().c_str(), anOrigin->GetScalarFieldName().c_str(), - anOrigin->GetScalarIteration() + 1, + theScalarIter, anOrigin->GetScalarEntity()); Update(); } @@ -184,26 +195,27 @@ CORBA::Double VISU::ScalarMapOnDeformedShape_i::GetScale(){ } void VISU::ScalarMapOnDeformedShape_i::SetSourceRange(CORBA::Double theMinRange,CORBA::Double theMaxRange){ - float aRange[2]; - aRange[0] = float(theMinRange); - aRange[1] = float(theMaxRange); + vtkFloatingPointType aRange[2]; + aRange[0] = vtkFloatingPointType(theMinRange); + aRange[1] = vtkFloatingPointType(theMaxRange); myScalarMapOnDeformedShapePL->SetScalarRange(aRange); } CORBA::Double VISU::ScalarMapOnDeformedShape_i::GetSourceRangeMin(){ - float aRange[2]; + vtkFloatingPointType aRange[2]; myScalarMapOnDeformedShapePL->GetSourceRange(aRange); return aRange[0]; } CORBA::Double VISU::ScalarMapOnDeformedShape_i::GetSourceRangeMax(){ - float aRange[2]; + vtkFloatingPointType aRange[2]; myScalarMapOnDeformedShapePL->GetSourceRange(aRange); return aRange[1]; } void VISU::ScalarMapOnDeformedShape_i::DoHook() { + if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::DoHook:"<<__LINE__<SetRepresentation(2); + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + int aDispMode = aResourceMgr->integerValue("VISU", "scalar_def_represent", 2); + bool toShrink = aResourceMgr->booleanValue("VISU", "scalar_def_shrink", false); + anActor->SetRepresentation(aDispMode); + if (toShrink) anActor->SetShrink(); anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B); anActor->SetVTKMapping(false); return anActor; @@ -224,6 +241,7 @@ VISU_Actor* VISU::ScalarMapOnDeformedShape_i::CreateActor(const Handle(SALOME_In void VISU::ScalarMapOnDeformedShape_i::UpdateActor(VISU_Actor* theActor) { + if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::UpdateActor:"<<__LINE__<(theActor)){ if(IsColored()){ anActor->SetBarVisibility(true); @@ -239,15 +257,18 @@ void VISU::ScalarMapOnDeformedShape_i::UpdateActor(VISU_Actor* theActor) { void VISU::ScalarMapOnDeformedShape_i::SetScalarField(const char* theMeshName, const char* theFieldName, - const int theIteration, - const VISU::TEntity theEntity) + int theIteration, + VISU::TEntity theEntity) { + if(MYDEBUG) cout << "VISU::ScalarMapOnDeformedShape_i::SetScalarField:"<<__LINE__<booleanValue("VISU", "scalar_map_shrink", false); bool toUseShading = aResourceMgr->booleanValue("VISU", "represent_shading", false); + anActor->SetRepresentation(aDispMode); + if (toShrink) anActor->SetShrink(); anActor->SetShading(toUseShading); UpdateActor(anActor); }catch(...){ @@ -339,14 +342,14 @@ VISU::ScalarMap_i vtkTextProperty* aTitleProp = aScalarBar->GetTitleTextProperty(); aTitleProp->SetFontFamily(myTitFontType); - aTitleProp->SetColor(myTitleColor); + aTitleProp->SetColor(myTitleColor[0],myTitleColor[1],myTitleColor[2]); (myIsBoldTitle)? aTitleProp->BoldOn() : aTitleProp->BoldOff(); (myIsItalicTitle)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff(); (myIsShadowTitle)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff(); vtkTextProperty* aLabelProp = aScalarBar->GetLabelTextProperty(); aLabelProp->SetFontFamily(myLblFontType); - aLabelProp->SetColor(myLabelColor); + aLabelProp->SetColor(myLabelColor[0],myLabelColor[1],myLabelColor[2]); (myIsBoldLabel)? aLabelProp->BoldOn() : aLabelProp->BoldOff(); (myIsItalicLabel)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff(); (myIsShadowLabel)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff(); diff --git a/src/VISU_I/VISU_ScalarMap_i.hh b/src/VISU_I/VISU_ScalarMap_i.hh index 0d275401..c3999cca 100644 --- a/src/VISU_I/VISU_ScalarMap_i.hh +++ b/src/VISU_I/VISU_ScalarMap_i.hh @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_PrsObject_i.hxx diff --git a/src/VISU_I/VISU_StreamLines_i.cc b/src/VISU_I/VISU_StreamLines_i.cc index fbeeb75f..8bf6fa27 100644 --- a/src/VISU_I/VISU_StreamLines_i.cc +++ b/src/VISU_I/VISU_StreamLines_i.cc @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_PrsObject_i.cxx @@ -31,6 +31,8 @@ #include "VISU_StreamLinesPL.hxx" #include "VISU_Convertor.hxx" +#include "SUIT_ResourceMgr.h" + #include #include #include @@ -271,6 +273,9 @@ VISU::StreamLines_i { if(VISU_Actor* anActor = VISU::DeformedShape_i::CreateActor(theIO)){ anActor->SetVTKMapping(true); + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + int aDispMode = aResourceMgr->integerValue("VISU", "stream_lines_represent", 1); + anActor->SetRepresentation(aDispMode); return anActor; } return NULL; diff --git a/src/VISU_I/VISU_StreamLines_i.hh b/src/VISU_I/VISU_StreamLines_i.hh index 4ae3150f..03c6ec96 100644 --- a/src/VISU_I/VISU_StreamLines_i.hh +++ b/src/VISU_I/VISU_StreamLines_i.hh @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_PrsObject_i.hxx diff --git a/src/VISU_I/VISU_Table_i.cc b/src/VISU_I/VISU_Table_i.cc index 4f0151bf..4713feda 100644 --- a/src/VISU_I/VISU_Table_i.cc +++ b/src/VISU_I/VISU_Table_i.cc @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_Table_i.cc diff --git a/src/VISU_I/VISU_Table_i.hh b/src/VISU_I/VISU_Table_i.hh index 3fd6dc65..5ba1efc3 100644 --- a/src/VISU_I/VISU_Table_i.hh +++ b/src/VISU_I/VISU_Table_i.hh @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_Table_i.hh diff --git a/src/VISU_I/VISU_TimeAnimation.cxx b/src/VISU_I/VISU_TimeAnimation.cxx index c1db8093..b337e3ad 100644 --- a/src/VISU_I/VISU_TimeAnimation.cxx +++ b/src/VISU_I/VISU_TimeAnimation.cxx @@ -1,6 +1,21 @@ -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// +// 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_TimeAnimation.cxx // Author : Vitaly SMETANNIKOV @@ -42,10 +57,12 @@ #include "SALOMEDSClient_AttributeComment.hxx" #include "SALOMEDSClient_AttributeName.hxx" +#include "CASCatch.hxx" #include #include #include +#include using namespace std; @@ -64,18 +81,21 @@ VISU_TimeAnimation::VISU_TimeAnimation (_PTR(Study) theStudy, if (!CORBA::is_nil(theView3D)) { VISU::View3D_i* pView = dynamic_cast(GetServant(theView3D).in()); SUIT_ViewWindow* aVW = pView->GetViewWindow(); - myView = VISU::GetViewWindow(aVW); + myView = dynamic_cast(aVW); connect( myView, SIGNAL( destroyed() ), this, SLOT( onViewDeleted() ) ); } - myMaxVal = 0; - myMinVal = 0; + myTimeMinVal = 0; + myTimeMaxVal = 0; myTimeMin = 0; myTimeMax = 0; myLastError = ""; myCycling = false; myAnimEntry = ""; + + myDumpPath = ""; + myAVIMaker = "jpeg2yuv"; } @@ -90,6 +110,25 @@ VISU_TimeAnimation::~VISU_TimeAnimation() for (int i = 0; i < getNbFields(); i++) { clearData(myFieldsLst[i]); } + + /* Terminates the execution of the thread. + * The thread may or may not be terminated immediately, + * depending on the operating system's scheduling policies. + * + * Use QThread::wait() after terminate() for synchronous termination. + * + * When the thread is terminated, all threads waiting for the the thread to finish will be woken up. + * + * Warning: This function is dangerous, and its use is discouraged. + * The thread can be terminated at any point in its code path. + * Threads can be terminated while modifying data. + * There is no chance for the thread to cleanup after itself, + * unlock any held mutexes, etc. In short, use this function only if absolutely necessary. + */ + myDumpPath = ""; + QThread::wait(100); + QThread::terminate(); + QThread::wait(400); } @@ -162,13 +201,10 @@ namespace FieldData& theData, VISU::Result_i* theResult, bool theIsRangeDefined, - CORBA::Double& theMinVal, - CORBA::Double& theMaxVal, CORBA::Double theTimeMin, CORBA::Double theTimeMax) { - theMinVal = VTK_LARGE_FLOAT; - theMaxVal = -VTK_LARGE_FLOAT; + double aMin = VTK_LARGE_FLOAT, aMax = -VTK_LARGE_FLOAT; _PTR(ChildIterator) anIter = theStudy->NewChildIterator(theData.myField); anIter->Next(); // First is reference on support @@ -197,13 +233,27 @@ namespace QString aFieldName = VISU::Storable::FindValue(aTimeMap,"myFieldName"); int aTimeStampId = VISU::Storable::FindValue(aTimeMap,"myTimeStampId").toInt(); + bool anIsCreated = false; TPrs3d* aPresent = new TPrs3d(theResult, false); - aPresent->Create(aMeshName.latin1(), anEntity, - aFieldName.latin1(), aTimeStampId); - theData.myPrs[aFrameId++] = aPresent; - - theMinVal = std::min(aPresent->GetMin(),theMinVal); - theMaxVal = std::max(aPresent->GetMax(),theMaxVal); + CASCatch_TRY{ + try{ + if(aPresent->Create(aMeshName.latin1(),anEntity,aFieldName.latin1(),aTimeStampId)){ + anIsCreated = true; + theData.myPrs[aFrameId++] = aPresent; + aMin = std::min(aPresent->GetMin(), aMin); + aMax = std::max(aPresent->GetMax(), aMax); + } + }catch(std::exception& exc){ + INFOS("Follow exception was occured :\n"<GetMessageString()); + } + if(!anIsCreated) + aPresent->_remove_ref(); } theData.myNbFrames = aFrameId; @@ -212,7 +262,7 @@ namespace if( aRangeType != 1 ){ for(long aFrameId = 0; aFrameId < theData.myNbFrames; aFrameId++) { if (VISU::ScalarMap_i* aPrs = dynamic_cast(theData.myPrs[aFrameId])){ - aPrs->SetRange(theMinVal, theMaxVal); + aPrs->SetRange(aMin, aMax); aPrs->SetOffset(theData.myOffset); } } @@ -220,7 +270,7 @@ namespace if (theData.myPrsType == VISU::TISOSURFACE) for (long aFrameId = 0; aFrameId < theData.myNbFrames; aFrameId++) if (VISU::IsoSurfaces_i* aPrs = dynamic_cast(theData.myPrs[aFrameId])) - aPrs->SetSubRange(theMinVal, theMaxVal); + aPrs->SetSubRange(aMin, aMax); } } } @@ -246,100 +296,80 @@ void VISU_TimeAnimation::generatePresentations(CORBA::Long theFieldNum) { aData, aResult, isRangeDefined(), - myMinVal, - myMaxVal, - myTimeMin, - myTimeMax); + myTimeMinVal, + myTimeMaxVal); break; case VISU::TISOSURFACE: // Iso Surfaces GeneratePresentations(myStudy, aData, aResult, isRangeDefined(), - myMinVal, - myMaxVal, - myTimeMin, - myTimeMax); + myTimeMinVal, + myTimeMaxVal); break; case VISU::TCUTPLANES: // Cut Planes GeneratePresentations(myStudy, aData, aResult, isRangeDefined(), - myMinVal, - myMaxVal, - myTimeMin, - myTimeMax); + myTimeMinVal, + myTimeMaxVal); break; case VISU::TCUTLINES: // Cut Lines GeneratePresentations(myStudy, aData, aResult, isRangeDefined(), - myMinVal, - myMaxVal, - myTimeMin, - myTimeMax); + myTimeMinVal, + myTimeMaxVal); break; case VISU::TPLOT3D: // Plot3d GeneratePresentations(myStudy, aData, aResult, isRangeDefined(), - myMinVal, - myMaxVal, - myTimeMin, - myTimeMax); + myTimeMinVal, + myTimeMaxVal); break; case VISU::TDEFORMEDSHAPE: // Deformed Shape GeneratePresentations(myStudy, aData, aResult, isRangeDefined(), - myMinVal, - myMaxVal, - myTimeMin, - myTimeMax); + myTimeMinVal, + myTimeMaxVal); break; case VISU::TVECTORS: // Vectors GeneratePresentations(myStudy, aData, aResult, isRangeDefined(), - myMinVal, - myMaxVal, - myTimeMin, - myTimeMax); + myTimeMinVal, + myTimeMaxVal); break; case VISU::TSTREAMLINES: // Stream Lines GeneratePresentations(myStudy, aData, aResult, isRangeDefined(), - myMinVal, - myMaxVal, - myTimeMin, - myTimeMax); + myTimeMinVal, + myTimeMaxVal); break; case VISU::TGAUSSPOINTS: // Gauss Points GeneratePresentations(myStudy, aData, aResult, isRangeDefined(), - myMinVal, - myMaxVal, - myTimeMin, - myTimeMax); + myTimeMinVal, + myTimeMaxVal); break; case VISU::TSCALARMAPONDEFORMEDSHAPE: // Scalar map on deformed shape GeneratePresentations(myStudy, aData, aResult, isRangeDefined(), - myMinVal, - myMaxVal, - myTimeMin, - myTimeMax); + myTimeMinVal, + myTimeMaxVal); break; default: MESSAGE("Not implemented for this presentation type: " << aData.myPrsType); @@ -570,9 +600,15 @@ void VISU_TimeAnimation::run() double aOneVal = 1; if (myFieldsLst[0].myNbFrames > 2) aOneVal = myFieldsLst[0].myTiming[1] - myFieldsLst[0].myTiming[0]; + myFileIndex = 0; + int aNbFiles = 0; + QValueList anIndexList; + qApp->lock(); while (myIsActive) { emit frameChanged(myFrame, myFieldsLst[0].myTiming[myFrame]); + if(!(myFieldsLst[0].myField)) + break; for (int i = 0; i < getNbFields(); i++) { FieldData& aData = myFieldsLst[i]; if (myFrame > 0) { @@ -605,6 +641,7 @@ void VISU_TimeAnimation::run() } } int delay = (int)(1000. * k / mySpeed); + isDumping = !myDumpPath.isEmpty(); if (delay < 1 && isDumping) { // We must unlock mutex for some time before grabbing to allow view updating delay = 1; @@ -616,19 +653,61 @@ void VISU_TimeAnimation::run() if (isDumping) { // We must unlock mutex for some time before grabbing to allow view updating qApp->unlock(); - msleep(100); + msleep(delay); qApp->lock(); + if(!(myFieldsLst[0].myField)) // break, if field was deleted. + break; + if (myDumpFormat.compare("AVI") != 0) { + QString aFile(myDumpPath); + QString aName = QString("%1").arg(myFieldsLst[0].myTiming[myFrame]); + int aPos = -1; + while ((aPos = aName.find(".")) > -1 ) + aName.replace(aPos, 1, "_"); + aFile += aName; + aFile += "."; + aFile += myDumpFormat.lower(); + myView->dumpViewToFormat(aFile,myDumpFormat); + } else { + QFileInfo aFileInfo(myDumpPath); + QString aDirPath = aFileInfo.dirPath(true); + QString aBaseName = aFileInfo.fileName(); + + switch (myFrame) { + case 0: + break; + case 1: + myFileIndex += 5; + break; + default: + if (myProportional) { + double p = (myFieldsLst[0].myTiming[myFrame] - + myFieldsLst[0].myTiming[myFrame-1]) / aOneVal; + myFileIndex += (long) (5*p); + } else { + myFileIndex += 5; + } + } - QPixmap px = QPixmap::grabWindow(myView->winId()); - QString aFile(myDumpPath); - QString aName = QString("%1").arg(myFieldsLst[0].myTiming[myFrame]); - int aPos = -1; - while ((aPos = aName.find(".")) > -1 ) - aName.replace(aPos, 1, "_"); - aFile += aName; - aFile += "."; - aFile += myDumpFormat.lower(); - px.save(aFile, myDumpFormat); + QString aFile = aDirPath + QDir::separator() + aBaseName; + aFile += "_"; + aFile += QString("%1").arg(myFileIndex).rightJustify(8, '0'); + aFile += ".jpeg"; + + /* check image size is divisable 16 + myView->dumpViewToFormat(aFile,"JPEG"); + */ + SUIT_ViewWindow* aView = myView; + QImage img = aView->dumpView(); + if (!img.isNull()) { + int width = img.width(); width = (width/16)*16; + int height = img.height(); height = (height/16)*16; + QImage copy = img.copy(0, 0, width, height); + if (copy.save(aFile, "JPEG")) { + anIndexList.append(myFileIndex); + aNbFiles++; + } + } + } } if (!myIsActive) break; @@ -643,6 +722,58 @@ void VISU_TimeAnimation::run() myFrame = 0; } } + + // make AVI file if need + if (isDumping && myDumpFormat.compare("AVI") == 0) { + double aFPS = 17.3 * mySpeed; + + QFileInfo aFileInfo(myDumpPath); + QString aDirPath = aFileInfo.dirPath(true); + QString aBaseName = aFileInfo.fileName(); + + // add missing files + if (anIndexList.count() > 1) { + QString aFFile = aDirPath + QDir::separator() + 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).rightJustify(8, '0')); + QStringList aCommands; + for (int j = aStartIndex+1; j < anEndIndex; j++) { + QString aFile = aFFile.arg(QString::number(j).rightJustify(8, '0')); + aCommands.append(QString("ln -s %1 %2").arg(aCurFile).arg(aFile)); + } + system(aCommands.join(" ; \\\n").latin1()); + aStartIndex = anEndIndex; + } + } + + // make AVI file + QString aPattern = aDirPath + QDir::separator() + aBaseName; + aPattern += "_\%08d.jpeg"; + + QString aCmd = myAVIMaker; + aCmd += " -I p"; + aCmd += " -v 0"; + 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 += " | yuv2lav"; + aCmd += QString(" -o %1").arg(myDumpPath); + system(aCmd.latin1()); + + // remove temporary jpeg files + aCmd = "( "; + aCmd += QString("cd %1").arg(aDirPath); + aCmd += "; ls"; + aCmd += QString(" | egrep '%1_[0-9]*.jpeg'").arg(aBaseName); + aCmd += " | xargs rm"; + aCmd += " )"; + system(aCmd.latin1()); + } + emit stopped(); qApp->unlock(); QThread::exit(); @@ -701,7 +832,8 @@ std::string VISU_TimeAnimation::setDumpFormat(const char* theFormat) { myDumpFormat = theFormat; QStrList aDumpFormats = QImageIO::outputFormats(); - if (myDumpFormat.isEmpty() || aDumpFormats.find(theFormat) < 0) { + if (myDumpFormat.isEmpty() || + (aDumpFormats.find(theFormat) < 0 && myDumpFormat.compare("AVI") != 0)) { if (aDumpFormats.find("JPEG")) myDumpFormat = "JPEG"; else @@ -710,6 +842,19 @@ std::string VISU_TimeAnimation::setDumpFormat(const char* theFormat) return myDumpFormat.latin1(); } +//------------------------------------------------------------------------ +bool VISU_TimeAnimation::checkAVIMaker() const +{ + QStrList aDumpFormats = QImageIO::outputFormats(); + if (aDumpFormats.find("JPEG") < 0) return false; + + QString aCmd("which "); + aCmd += myAVIMaker; + aCmd += " >& /dev/null"; + int iErr = system(aCmd.latin1()); + return (iErr == 0); +} + //************************************************************************ int VISU_TimeAnimation::myNBAnimations = 0; QString VISU_TimeAnimation::GenerateName() @@ -771,8 +916,8 @@ SALOMEDS::SObject_ptr VISU_TimeAnimation::publishInStudy() std::string aSComponentEntry = aSComponent->GetID(); QString aComment; - aComment.sprintf("myComment=ANIMATION;myType=%d;myMinVal=%g;myMaxVal=%g", - VISU::TANIMATION,myMinVal,myMaxVal); + aComment.sprintf("myComment=ANIMATION;myType=%d;myTimeMinVal=%g;myTimeMaxVal=%g", + VISU::TANIMATION,myTimeMinVal,myTimeMaxVal); string anEntry = VISU::CreateAttributes(myStudy,aSComponentEntry.c_str(),"","", GenerateName(),"",aComment,true); @@ -814,8 +959,8 @@ void VISU_TimeAnimation::saveAnimation() std::string aSComponentEntry = aSComponent->GetID(); QString aComment; - aComment.sprintf("myComment=ANIMATION;myType=%d;myMinVal=%g;myMaxVal=%g", - VISU::TANIMATION,myMinVal,myMaxVal); + aComment.sprintf("myComment=ANIMATION;myType=%d;myTimeMinVal=%g;myTimeMaxVal=%g", + VISU::TANIMATION,myTimeMinVal,myTimeMaxVal); _PTR(GenericAttribute) anAttr; anAttr = aStudyBuilder->FindOrCreateAttribute(aAnimSObject, "AttributeComment"); @@ -881,8 +1026,8 @@ void VISU_TimeAnimation::restoreFromStudy(_PTR(SObject) theField) VISU::Storable::StrToMap(strIn,aMap); bool isExist; - myMinVal = VISU::Storable::FindValue(aMap,"myMinVal",&isExist).toDouble(); - myMaxVal = VISU::Storable::FindValue(aMap,"myMaxVal",&isExist).toDouble(); + myTimeMinVal = VISU::Storable::FindValue(aMap,"myTimeMinVal",&isExist).toDouble(); + myTimeMaxVal = VISU::Storable::FindValue(aMap,"myTimeMaxVal",&isExist).toDouble(); _PTR(ChildIterator) anIter = myStudy->NewChildIterator(aAnimSObject); for (anIter->Init(); anIter->More(); anIter->Next()) { @@ -939,8 +1084,7 @@ void VISU_TimeAnimation::restoreFromStudy(_PTR(SObject) theField) aData.myPrs[0]->GetOffset(aData.myOffset); for (int i = 1; i < aData.myNbFrames; i++) { //jfa 03.08.2005:aData.myPrs[i]->SameAs(aData.myPrs[0]); - //enk 06.02.2006:aData.myPrs[i]->SameAsParams(aData.myPrs[0]);//jfa 03.08.2005 - aData.myPrs[i]->SameAsParams(aData.myPrs[i-1]);//enk 06.02.2006: initializing from previous presentation + aData.myPrs[i]->SameAsParams(aData.myPrs[0]);//jfa 03.08.2005 } } string aStr = aAnimSObject->GetID(); diff --git a/src/VISU_I/VISU_TimeAnimation.h b/src/VISU_I/VISU_TimeAnimation.h index 4e9360f6..438bc8d7 100644 --- a/src/VISU_I/VISU_TimeAnimation.h +++ b/src/VISU_I/VISU_TimeAnimation.h @@ -1,6 +1,21 @@ -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// +// 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_TimeAnimation.h // Author : Vitaly SMETANNIKOV @@ -20,7 +35,8 @@ class SVTK_ViewWindow; class VISU_Actor; -namespace VISU{ +namespace VISU +{ class Result_i; class ColoredPrs3d_i; } @@ -34,7 +50,7 @@ struct FieldData std::vector myPrs; // Presentations std::vector myActors; // Actors std::vector myTiming; // time values - float myOffset[3]; + CORBA::Float myOffset[3]; }; @@ -66,6 +82,7 @@ class VISU_I_EXPORT VISU_TimeAnimation: public QObject, public QThread SVTK_ViewWindow* getViewer() { return myView; } void clearView(); void clearData(FieldData& theData); + void clearFieldData() { myFieldsLst.clear();}; void stopAnimation(); void startAnimation(); @@ -93,14 +110,15 @@ class VISU_I_EXPORT VISU_TimeAnimation: public QObject, public QThread CORBA::Boolean isProportional() { return myProportional; } void setAnimationRange(CORBA::Double theMin, CORBA::Double theMax) - { myMaxVal = theMax; myMinVal = theMin; } + { myTimeMinVal = theMin; myTimeMaxVal = theMax; } - CORBA::Double getMinRange() { return myMinVal; } - CORBA::Double getMaxRange() { return myMaxVal; } - CORBA::Boolean isRangeDefined() { return !((myMaxVal==0) && (myMinVal == myMaxVal)); } + CORBA::Double getMinRange() { return myTimeMinVal; } + CORBA::Double getMaxRange() { return myTimeMaxVal; } + CORBA::Boolean isRangeDefined() { return !((myTimeMaxVal == 0) && (myTimeMinVal == myTimeMaxVal)); } void dumpTo(const char* thePath) { myDumpPath = thePath; } std::string setDumpFormat(const char* theFormat); + bool checkAVIMaker() const; QString getLastErrorMsg() { return myLastError; } @@ -132,7 +150,7 @@ class VISU_I_EXPORT VISU_TimeAnimation: public QObject, public QThread private slots: void onViewDeleted(); - + private: QString myLastError; @@ -144,10 +162,12 @@ class VISU_I_EXPORT VISU_TimeAnimation: public QObject, public QThread bool myCycling; _PTR(Study) myStudy; - double myMaxVal, myMinVal; - double myTimeMin, myTimeMax; + double myTimeMinVal, myTimeMaxVal; //!< Range of time stams, set by user + double myTimeMin , myTimeMax ; //!< Range of time stams, available for animation QString myDumpPath; QString myDumpFormat; + QString myAVIMaker; + long myFileIndex; SVTK_ViewWindow* myView; QString myAnimEntry; diff --git a/src/VISU_I/VISU_Vectors_i.cc b/src/VISU_I/VISU_Vectors_i.cc index 071ba811..1ab9c254 100644 --- a/src/VISU_I/VISU_Vectors_i.cc +++ b/src/VISU_I/VISU_Vectors_i.cc @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_Vectors_i.cc @@ -31,6 +31,8 @@ #include "VISU_VectorsPL.hxx" #include "VISU_Convertor.hxx" +#include "SUIT_ResourceMgr.h" + #include using namespace VISU; @@ -194,6 +196,9 @@ VISU_Actor* VISU::Vectors_i::CreateActor(const Handle(SALOME_InteractiveObject)& anActor->SetBarVisibility(true); anActor->GetProperty()->SetColor(myColor.R,myColor.G,myColor.B); anActor->GetProperty()->SetLineWidth(GetLineWidth()); + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + int aDispMode = aResourceMgr->integerValue("VISU", "vectors_represent", 1); + anActor->SetRepresentation(aDispMode); UpdateActor(anActor); }catch(...){ anActor->Delete(); diff --git a/src/VISU_I/VISU_Vectors_i.hh b/src/VISU_I/VISU_Vectors_i.hh index 39eb8e32..de635e83 100644 --- a/src/VISU_I/VISU_Vectors_i.hh +++ b/src/VISU_I/VISU_Vectors_i.hh @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_PrsObject_i.hxx diff --git a/src/VISU_I/VISU_ViewManager_i.cc b/src/VISU_I/VISU_ViewManager_i.cc index c86ac5d8..29c69d21 100644 --- a/src/VISU_I/VISU_ViewManager_i.cc +++ b/src/VISU_I/VISU_ViewManager_i.cc @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_ViewManager_i.cc @@ -257,31 +257,29 @@ namespace VISU { //=========================================================================== // VISU namespace functions //=========================================================================== - SVTK_ViewWindow* GetViewWindow (SUIT_ViewWindow* theStudyFrame) + vtkRenderer* GetRenderer (SUIT_ViewWindow* theViewWindow) { - return dynamic_cast(theStudyFrame); - } - - vtkRenderer* GetRenderer (SUIT_ViewWindow* theStudyFrame) - { - return GetViewWindow(theStudyFrame)->getRenderer(); + if (SVTK_ViewWindow* vw = dynamic_cast(theViewWindow)) + return vw->getRenderer(); + return NULL; } - vtkCamera* GetCamera (SUIT_ViewWindow* theStudyFrame) + vtkCamera* GetCamera (SUIT_ViewWindow* theViewWindow) { - return GetRenderer(theStudyFrame)->GetActiveCamera(); + return GetRenderer(theViewWindow)->GetActiveCamera(); } void RepaintView (SUIT_ViewWindow* theViewWindow) { - SVTK_ViewWindow* vf = GetViewWindow(theViewWindow); - vf->getRenderer()->ResetCameraClippingRange(); - vf->getRenderWindow()->Render(); + if (SVTK_ViewWindow* vf = dynamic_cast(theViewWindow)) { + vf->getRenderer()->ResetCameraClippingRange(); + vf->getRenderWindow()->Render(); + } } - VISU_Actor* UpdateViewer (SUIT_ViewWindow* theStudyFrame, int theDisplaing, Prs3d_i* thePrs) + VISU_Actor* UpdateViewer (SUIT_ViewWindow* theViewWindow, int theDisplaing, Prs3d_i* thePrs) { - SVTK_ViewWindow* vf = GetViewWindow(theStudyFrame); + SVTK_ViewWindow* vf = dynamic_cast(theViewWindow); if (!vf) return NULL; if(MYDEBUG) MESSAGE("UpdateViewer - theDisplaing = "<activeViewManager()){ if(SUIT_ViewWindow* aView = aViewManager->getActiveView()){ - if(SVTK_ViewWindow* aViewWindow = dynamic_cast(aView)){ + if(dynamic_cast(aView)){ myView3D->myViewManager = aViewManager; myResult = aViewManager->getActiveView(); } @@ -1557,7 +1559,7 @@ namespace VISU { {} virtual void Execute() { - SVTK_ViewWindow* vf = VISU::GetViewWindow(myVW); + SVTK_ViewWindow* vf = dynamic_cast(myVW); vtkRenderer* Renderer = vf->getRenderer(); vtkActorCollection* theActors = Renderer->GetActors(); theActors->InitTraversal(); @@ -1759,7 +1761,7 @@ namespace VISU { { Storable::DataToStream(theStr,"myType",VISU::TVIEW3D); - float backint[3]; + vtkFloatingPointType backint[3]; GetRenderer(theViewWindow)->GetBackground(backint); Storable::DataToStream(theStr,"myColor.R",backint[0]); Storable::DataToStream(theStr,"myColor.G",backint[1]); @@ -1786,7 +1788,7 @@ namespace VISU { Storable::DataToStream(theStr,"myParallelScale",GetParallelScale(theViewWindow)); double aScaleFactor[3]; - VISU::GetViewWindow(theViewWindow)->GetScale(aScaleFactor); + (dynamic_cast(theViewWindow))->GetScale(aScaleFactor); Storable::DataToStream(theStr,"myScaleFactor[0]",aScaleFactor[0]); Storable::DataToStream(theStr,"myScaleFactor[1]",aScaleFactor[1]); Storable::DataToStream(theStr,"myScaleFactor[2]",aScaleFactor[2]); @@ -1841,13 +1843,13 @@ namespace VISU { aColor[1] = int(255.0*theColor.G); aColor[2] = int(255.0*theColor.B); QColor aNewColor (aColor[0],aColor[1],aColor[2]); - VISU::GetViewWindow(theViewWindow)->setBackgroundColor(aNewColor); + (dynamic_cast(theViewWindow))->setBackgroundColor(aNewColor); } SALOMEDS::Color View3D_i::GetBackground (SUIT_ViewWindow* theViewWindow) { SALOMEDS::Color aColor; - float backint[3]; + vtkFloatingPointType backint[3]; GetRenderer(theViewWindow)->GetBackground(backint); aColor.R = backint[0]; aColor.G = backint[1]; aColor.B = backint[2]; return aColor; @@ -1922,7 +1924,7 @@ namespace VISU { SUIT_ViewWindow* aVW = GetViewWindow(); if (aVW) { ProcessVoidEvent(new TVoidMemFunEvent - (VISU::GetViewWindow(aVW), &SVTK_ViewWindow::onFitAll)); + (dynamic_cast(aVW), &SVTK_ViewWindow::onFitAll)); Update(); } } @@ -1936,27 +1938,27 @@ namespace VISU { switch (theType) { case VISU::View3D::FRONT : ProcessVoidEvent(new TVoidMemFunEvent - (VISU::GetViewWindow(aVW), &SVTK_ViewWindow::onFrontView)); + (dynamic_cast(aVW), &SVTK_ViewWindow::onFrontView)); break; case VISU::View3D::BACK : ProcessVoidEvent(new TVoidMemFunEvent - (VISU::GetViewWindow(aVW), &SVTK_ViewWindow::onBackView)); + (dynamic_cast(aVW), &SVTK_ViewWindow::onBackView)); break; case VISU::View3D::LEFT : ProcessVoidEvent(new TVoidMemFunEvent - (VISU::GetViewWindow(aVW),&SVTK_ViewWindow::onLeftView)); + (dynamic_cast(aVW),&SVTK_ViewWindow::onLeftView)); break; case VISU::View3D::RIGHT : ProcessVoidEvent(new TVoidMemFunEvent - (VISU::GetViewWindow(aVW),&SVTK_ViewWindow::onRightView)); + (dynamic_cast(aVW),&SVTK_ViewWindow::onRightView)); break; case VISU::View3D::TOP : ProcessVoidEvent(new TVoidMemFunEvent - (VISU::GetViewWindow(aVW),&SVTK_ViewWindow::onTopView)); + (dynamic_cast(aVW),&SVTK_ViewWindow::onTopView)); break; case VISU::View3D::BOTTOM : ProcessVoidEvent(new TVoidMemFunEvent - (VISU::GetViewWindow(aVW),&SVTK_ViewWindow::onBottomView)); + (dynamic_cast(aVW),&SVTK_ViewWindow::onBottomView)); break; } Update(); @@ -2126,7 +2128,7 @@ namespace VISU { void View3D_i::ScaleView (SUIT_ViewWindow* theViewWindow, VISU::View3D::Axis theAxis, CORBA::Double theParam) { - SVTK_ViewWindow* aViewWindow = VISU::GetViewWindow(theViewWindow); + SVTK_ViewWindow* aViewWindow = dynamic_cast(theViewWindow); double aScaleFactor[3]; aViewWindow->GetScale(aScaleFactor); aScaleFactor[theAxis] = theParam; @@ -2136,7 +2138,7 @@ namespace VISU { void SetScaleView (SUIT_ViewWindow* theViewWindow, const CORBA::Double theScale[3]) { double aScale[3] = {theScale[0], theScale[1], theScale[2]}; - VISU::GetViewWindow(theViewWindow)->SetScale(aScale); + (dynamic_cast(theViewWindow))->SetScale(aScale); } void View3D_i::ScaleView(VISU::View3D::Axis theAxis, CORBA::Double theParam) @@ -2145,7 +2147,7 @@ namespace VISU { SUIT_ViewWindow* aVW = GetViewWindow(); if (aVW) { double aScale[3]; - VISU::GetViewWindow(aVW)->GetScale(aScale); + (dynamic_cast(aVW))->GetScale(aScale); aScale[theAxis] = theParam; ProcessVoidEvent(new TSet3DViewParamEvent(&SetScaleView,aVW,aScale)); } @@ -2160,4 +2162,316 @@ namespace VISU { ProcessVoidEvent(new TSet3DViewParamEvent(&SetScaleView,aVW,aScale)); } } + + //================================================ + // Certain presentation view parameters management + //================================================ + class TPrsManageEvent: public SALOME_Event + { + protected: + View3D_i* myView3D; + ScalarMap_ptr myPrs; + string myError; + + TPrsManageEvent(View3D_i* theView3D, ScalarMap_ptr thePrs): + myView3D(theView3D), + myPrs(ScalarMap::_duplicate(thePrs)), + myError("Unknown error occured") + {} + VISU_Actor* GetMyActor() + { + SUIT_ViewWindow* aVW = myView3D->GetViewWindow(); + SVTK_ViewWindow* vw = dynamic_cast(aVW); + if (!aVW) { + myError = "Corrupted view window"; + } else { + ScalarMap_i* aPrs = dynamic_cast(VISU::GetServant(myPrs).in()); + if (!aPrs) { + myError = "Corrupted presentation"; + } else { + VISU_Actor* anActor = VISU::GetActor(aPrs, vw); + if (!anActor) { + myError = "No actor found. Display the presentation at first."; + } else { + myError = ""; + return anActor; + } + } + } + return NULL; + } + }; + + // Get + class TGetPrsTypeEvent: public TPrsManageEvent { + public: + typedef VISU::PresentationType TResult; + TResult myResult; + TGetPrsTypeEvent(View3D_i* theView3D, ScalarMap_ptr thePrs): + TPrsManageEvent(theView3D, thePrs), myResult(VISU::SHRINK) {} + virtual void Execute() { + if (VISU_Actor* anActor = GetMyActor()) + myResult = (VISU::PresentationType)anActor->GetRepresentation(); + } + }; + + class TGetShrinkedEvent: public TPrsManageEvent { + public: + typedef bool TResult; + TResult myResult; + TGetShrinkedEvent(View3D_i* theView3D, ScalarMap_ptr thePrs): + TPrsManageEvent(theView3D, thePrs), myResult(false) {} + virtual void Execute() { + if (VISU_Actor* anActor = GetMyActor()) { + if (anActor->IsShrunkable()) + myResult = anActor->IsShrunk(); + else + myResult = false; + } + } + }; + + class TGetShadedEvent: public TPrsManageEvent { + public: + typedef bool TResult; + TResult myResult; + TGetShadedEvent(View3D_i* theView3D, ScalarMap_ptr thePrs): + TPrsManageEvent(theView3D, thePrs), myResult(false) {} + virtual void Execute() { + if (VISU_Actor* anActor = GetMyActor()) + if (VISU_ScalarMapAct* aScalarMapActor = dynamic_cast(anActor)) + myResult = aScalarMapActor->IsShading(); + } + }; + + class TGetOpacityEvent: public TPrsManageEvent { + public: + typedef double TResult; + TResult myResult; + TGetOpacityEvent(View3D_i* theView3D, ScalarMap_ptr thePrs): + TPrsManageEvent(theView3D, thePrs), myResult(-1.0) {} + virtual void Execute() { + if (VISU_Actor* anActor = GetMyActor()) { + vtkFloatingPointType oldvalue = anActor->GetOpacity(); + myResult = (double)oldvalue; + } + } + }; + + class TGetLineWidthEvent: public TPrsManageEvent { + public: + typedef double TResult; + TResult myResult; + TGetLineWidthEvent(View3D_i* theView3D, ScalarMap_ptr thePrs): + TPrsManageEvent(theView3D, thePrs), myResult(-1.0) {} + virtual void Execute() { + if (VISU_Actor* anActor = GetMyActor()) { + vtkFloatingPointType oldvalue = anActor->GetLineWidth(); + myResult = (double)oldvalue; + } + } + }; + + // Set + class TSetPrsTypeEvent: public TPrsManageEvent { + private: + PresentationType myPrsType; + public: + typedef string TResult; + TResult myResult; + TSetPrsTypeEvent(View3D_i* theView3D, ScalarMap_ptr thePrs, PresentationType thePrsType): + TPrsManageEvent(theView3D, thePrs), myPrsType(thePrsType), + myResult("Unknown error occured") + {} + virtual void Execute() { + switch (myPrsType) { + case VISU::INSIDEFRAME: + { + VISU::VISUType aType = myPrs->GetType(); + if (aType != VISU::TSCALARMAP && + aType != VISU::TDEFORMEDSHAPE && + aType != VISU::TSCALARMAPONDEFORMEDSHAPE) { + myResult = "Insideframe representation is not available for this type of presentations."; + return; + } + } + break; + case VISU::SURFACEFRAME: + myResult = "Surfaceframe representation is available only for mesh presentation."; + return; + case VISU::SHRINK: + myResult = "Use SetShrinked() method to shrink/unshrink presentation."; + return; + default: + break; + } + if (VISU_Actor* anActor = GetMyActor()) { + anActor->SetRepresentation((int)myPrsType); + SVTK_ViewWindow* vw = dynamic_cast(myView3D->GetViewWindow()); + vw->Repaint(); + myResult = ""; + } else { + myResult = myError; + } + } + }; + + class TSetShrinkedEvent: public TPrsManageEvent { + private: + bool myIsOn; + public: + typedef string TResult; + TResult myResult; + TSetShrinkedEvent(View3D_i* theView3D, ScalarMap_ptr thePrs, bool isOn): + TPrsManageEvent(theView3D, thePrs), myIsOn(isOn), + myResult("Unknown error occured") + {} + virtual void Execute() { + VISU::VISUType aType = myPrs->GetType(); + if (aType == VISU::TVECTORS || aType == VISU::TSTREAMLINES) { + myResult = "Shrinked representation is not available for this type of presentations."; + } else { + if (VISU_Actor* anActor = GetMyActor()) { + if (anActor->IsShrunkable()) { + if (myIsOn) anActor->SetShrink(); + else anActor->UnShrink(); + SVTK_ViewWindow* vw = dynamic_cast(myView3D->GetViewWindow()); + vw->Repaint(); + myResult = ""; + } else { + myResult = "This presentation is not shrunkable."; + } + } else { + myResult = myError; + } + } + } + }; + + class TSetShadedEvent: public TPrsManageEvent { + private: + bool myIsOn; + public: + typedef string TResult; + TResult myResult; + TSetShadedEvent(View3D_i* theView3D, ScalarMap_ptr thePrs, bool isOn): + TPrsManageEvent(theView3D, thePrs), myIsOn(isOn), + myResult("Unknown error occured") + {} + virtual void Execute() { + if (VISU_Actor* anActor = GetMyActor()) { + if (VISU_ScalarMapAct* aScalarMapActor = + dynamic_cast(anActor)) { + aScalarMapActor->SetShading(myIsOn); + SVTK_ViewWindow* vw = dynamic_cast(myView3D->GetViewWindow()); + vw->Repaint(); + myResult = ""; + } else { + myResult = "Corrupted actor"; + } + } else { + myResult = myError; + } + } + }; + + class TSetOpacityEvent: public TPrsManageEvent { + private: + double myOpacity; + public: + typedef string TResult; + TResult myResult; + TSetOpacityEvent(View3D_i* theView3D, ScalarMap_ptr thePrs, double theOpacity): + TPrsManageEvent(theView3D, thePrs), myOpacity(theOpacity), + myResult("Unknown error occured") + {} + virtual void Execute() { + VISU::VISUType aType = myPrs->GetType(); + if (aType == VISU::TVECTORS || aType == VISU::TSTREAMLINES) { + myResult = "Opacity is meaningless for this type of presentations."; + return; + } + if (VISU_Actor* anActor = GetMyActor()) { + anActor->SetOpacity((vtkFloatingPointType)myOpacity); + SVTK_ViewWindow* vw = dynamic_cast(myView3D->GetViewWindow()); + vw->Repaint(); + myResult = ""; + } else { + myResult = myError; + } + } + }; + + class TSetLineWidthEvent: public TPrsManageEvent { + private: + double myLineWidth; + public: + typedef string TResult; + TResult myResult; + TSetLineWidthEvent(View3D_i* theView3D, ScalarMap_ptr thePrs, double theLineWidth): + TPrsManageEvent(theView3D, thePrs), myLineWidth(theLineWidth), + myResult("Unknown error occured") + {} + virtual void Execute() { + if (myPrs->GetType() == VISU::TVECTORS) { + myResult = "Line Width is meaningless for Vectors presentation."; + return; + } + if (VISU_Actor* anActor = GetMyActor()) { + anActor->SetLineWidth((vtkFloatingPointType)myLineWidth); + SVTK_ViewWindow* vw = dynamic_cast(myView3D->GetViewWindow()); + vw->Repaint(); + myResult = ""; + } else { + myResult = myError; + } + } + }; + + PresentationType View3D_i::GetPresentationType(ScalarMap_ptr thePrs) + { + return ProcessEvent(new TGetPrsTypeEvent(this,thePrs)); + } + CORBA::Boolean View3D_i::IsShrinked(ScalarMap_ptr thePrs) + { + return ProcessEvent(new TGetShrinkedEvent(this,thePrs)); + } + CORBA::Boolean View3D_i::IsShaded(ScalarMap_ptr thePrs) + { + return ProcessEvent(new TGetShadedEvent(this,thePrs)); + } + CORBA::Double View3D_i::GetOpacity(ScalarMap_ptr thePrs) + { + return ProcessEvent(new TGetOpacityEvent(this,thePrs)); + } + CORBA::Double View3D_i::GetLineWidth(ScalarMap_ptr thePrs) + { + return ProcessEvent(new TGetLineWidthEvent(this,thePrs)); + } + + char* View3D_i::SetPresentationType(ScalarMap_ptr thePrs, PresentationType thePrsType) + { + string aRet = ProcessEvent(new TSetPrsTypeEvent(this,thePrs,thePrsType)); + return CORBA::string_dup(aRet.c_str()); + } + char* View3D_i::SetShrinked(ScalarMap_ptr thePrs, CORBA::Boolean isShrinked) + { + string aRet = ProcessEvent(new TSetShrinkedEvent(this,thePrs,isShrinked)); + return CORBA::string_dup(aRet.c_str()); + } + char* View3D_i::SetShaded(ScalarMap_ptr thePrs, CORBA::Boolean isShaded) + { + string aRet = ProcessEvent(new TSetShadedEvent(this,thePrs,isShaded)); + return CORBA::string_dup(aRet.c_str()); + } + char* View3D_i::SetOpacity(ScalarMap_ptr thePrs, CORBA::Double theOpacity) + { + string aRet = ProcessEvent(new TSetOpacityEvent(this,thePrs,theOpacity)); + return CORBA::string_dup(aRet.c_str()); + } + char* View3D_i::SetLineWidth(ScalarMap_ptr thePrs, CORBA::Double theLineWidth) + { + string aRet = ProcessEvent(new TSetLineWidthEvent(this,thePrs,theLineWidth)); + return CORBA::string_dup(aRet.c_str()); + } } diff --git a/src/VISU_I/VISU_View_i.hh b/src/VISU_I/VISU_View_i.hh index 17f19918..c0c4e505 100644 --- a/src/VISU_I/VISU_View_i.hh +++ b/src/VISU_I/VISU_View_i.hh @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_View_i.hh @@ -292,6 +292,19 @@ namespace VISU virtual void Close(); + // Certain presentation view parameters management + virtual PresentationType GetPresentationType(ScalarMap_ptr thePrs); + virtual CORBA::Boolean IsShrinked (ScalarMap_ptr thePrs); + virtual CORBA::Boolean IsShaded (ScalarMap_ptr thePrs); + virtual CORBA::Double GetOpacity (ScalarMap_ptr thePrs); + virtual CORBA::Double GetLineWidth (ScalarMap_ptr thePrs); + + virtual char* SetPresentationType(ScalarMap_ptr thePrs, PresentationType thePrsType); + virtual char* SetShrinked (ScalarMap_ptr thePrs, CORBA::Boolean isShrinked); + virtual char* SetShaded (ScalarMap_ptr thePrs, CORBA::Boolean isShaded); + virtual char* SetOpacity (ScalarMap_ptr thePrs, CORBA::Double theOpacity); + virtual char* SetLineWidth (ScalarMap_ptr thePrs, CORBA::Double theLineWidth); + protected: static int myNbViewParams; diff --git a/src/VISU_SWIG/Makefile.in b/src/VISU_SWIG/Makefile.in index 93d34b31..384afc38 100644 --- a/src/VISU_SWIG/Makefile.in +++ b/src/VISU_SWIG/Makefile.in @@ -17,14 +17,12 @@ # 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com # # # File : Makefile.in # Author : Paul RASCLE, EDF # Module : VISU -# $Header$ top_srcdir=@top_srcdir@ top_builddir=../.. @@ -45,14 +43,20 @@ EXPORT_PYSCRIPTS = libVISU_Swig.py batchmode_visu.py batchmode_visu_table.py bat visu_med.py visu_view3d.py visu.py visu_gui.py visu_prs_example.py \ visu_table.py visu_big_table.py visu_view.py visu_delete.py \ visu_swig_test.py test_events.py batch_test_events.py visu_split_views.py \ - VISU_Example_01.py VISU_Example_02.py VISU_Example_03.py VISU_Example_04.py VISU_Example_05.py VISU_Example_06.py + VISU_Example_01.py VISU_Example_02.py VISU_Example_03.py VISU_Example_04.py \ + VISU_Example_05.py VISU_Example_06.py VISU_Example_07.py EXPORT_SHAREDPYSCRIPTS = VISU_shared_modules.py LIB_CLIENT_IDL = -CPPFLAGS += -ftemplate-depth-32 $(PYTHON_INCLUDES) $(HDF5_INCLUDES) $(QT_INCLUDES) \ - $(VTK_INCLUDES) -I${KERNEL_ROOT_DIR}/include/salome \ - -I${MED_ROOT_DIR}/include/salome \ +CPPFLAGS += -ftemplate-depth-32 \ + $(PYTHON_INCLUDES) \ + $(HDF5_INCLUDES) \ + $(QT_INCLUDES) \ + $(VTK_INCLUDES) \ + $(KERNEL_CXXFLAGS) \ + $(GUI_CXXFLAGS) \ + $(MED_CXXFLAGS) \ $(BOOST_CPPFLAGS) LDFLAGS += $(PYTHON_LIBS) -lVisuConvertor -lVisuPipeLine diff --git a/src/VISU_SWIG/VISU_Example_01.py b/src/VISU_SWIG/VISU_Example_01.py index d8c19b65..04d1f8d5 100644 --- a/src/VISU_SWIG/VISU_Example_01.py +++ b/src/VISU_SWIG/VISU_Example_01.py @@ -1,3 +1,22 @@ +# Copyright (C) 2005 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 +# # T 2.23, 28: Displaying fields (scalar and vectorial) on nodes, change presentation options. # Uses MED files ResOK_0000.med and Fields_group3D.med # @@ -80,6 +99,13 @@ cutplanes.SetNbPlanes(30) cutplanes.SetOrientation(VISU.CutPlanes.YZ, 0, 0) myView.DisplayOnly(cutplanes) +print "Creating Scalar Map On Deformed Shape.......", +scalarmapondefshape = myVisu.ScalarMapOnDeformedShapeOnField(myResult,myMeshName,myNodeEntity,'vitesse',1); +if scalarmapondefshape is None : print "Error" +else : print "OK" +scalarmapondefshape.SetScalarField(myMeshName,'pression',2,myCellEntity); +myView.DisplayOnly(scalarmapondefshape) + #%====================Stage4: Opening a new study and Med file import====================% # Opening a new study tempoparily commented due to a problem @@ -131,6 +157,11 @@ else : print "OK" cutplanes1.SetOrientation(VISU.CutPlanes.YZ, 0, 0) myView1.DisplayOnly(cutplanes1) +print "Creating Scalar Map On Deformed Shape.......", +scalarmapondefshape1 = myVisu.ScalarMapOnDeformedShapeOnField(myResult1,myMeshName1,myCellEntity,'vectoriel field',1); +if scalarmapondefshape1 is None : print "Error" +else : print "OK" +myView1.DisplayOnly(scalarmapondefshape1) #%====================Stage6: Object browser popup====================% print "**** Stage6: Object browser popup" diff --git a/src/VISU_SWIG/VISU_Example_02.py b/src/VISU_SWIG/VISU_Example_02.py index 38f2b6b6..a65f4e50 100644 --- a/src/VISU_SWIG/VISU_Example_02.py +++ b/src/VISU_SWIG/VISU_Example_02.py @@ -1,3 +1,22 @@ +# Copyright (C) 2005 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 +# # T 2.24: Save/retrieve view parameters. # Uses MED file fra.med from ${DATA_DIR}/MedFiles directory. # diff --git a/src/VISU_SWIG/VISU_Example_03.py b/src/VISU_SWIG/VISU_Example_03.py index dfa066cc..d8500bee 100644 --- a/src/VISU_SWIG/VISU_Example_03.py +++ b/src/VISU_SWIG/VISU_Example_03.py @@ -1,3 +1,22 @@ +# Copyright (C) 2005 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 +# # Animation of "vitesse" field, stored in file TimeStamps.med # # This script is equivalent to non-regression test script 003/A5 diff --git a/src/VISU_SWIG/VISU_Example_04.py b/src/VISU_SWIG/VISU_Example_04.py index 9ae4d110..0d4d0551 100644 --- a/src/VISU_SWIG/VISU_Example_04.py +++ b/src/VISU_SWIG/VISU_Example_04.py @@ -1,3 +1,22 @@ +# Copyright (C) 2005 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 +# # Show some results presentations in different 3D and 2D viewers # with different options (view parameters and display modes). # Uses MED files fra.med and TimeStamps.med from ${DATA_DIR}/MedFiles directory. @@ -236,7 +255,7 @@ myResult = myVisu.ImportFile(medFile) anAnim = myVisu.CreateAnimation(myView); aSObj = myStudy.FindObjectIOR(myResult.GetID()) aSObj = aSObj.FindSubObject(1)[1] -aSObj = aSObj.FindSubObject(2)[1] +aSObj = aSObj.FindSubObject(3)[1] aSObj = aSObj.FindSubObject(2)[1] anAnim.addField(aSObj) anAnim.setPresentationType(0,VISU.TISOSURFACE) diff --git a/src/VISU_SWIG/VISU_Example_05.py b/src/VISU_SWIG/VISU_Example_05.py index a70943e4..26046ed9 100644 --- a/src/VISU_SWIG/VISU_Example_05.py +++ b/src/VISU_SWIG/VISU_Example_05.py @@ -1,3 +1,22 @@ +# Copyright (C) 2005 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 +# # Create a table and show it in Plot2d viewer # # This script is equivalent to script VISU_SWIG/visu_big_table.py diff --git a/src/VISU_SWIG/VISU_Example_06.py b/src/VISU_SWIG/VISU_Example_06.py index 622b6cb4..044000f6 100644 --- a/src/VISU_SWIG/VISU_Example_06.py +++ b/src/VISU_SWIG/VISU_Example_06.py @@ -1,3 +1,22 @@ +# Copyright (C) 2005 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 +# # Import a table from file and show it in Plot2d viewer import salome diff --git a/src/VISU_SWIG/VISU_Gen_s.cc b/src/VISU_SWIG/VISU_Gen_s.cc index ddad586a..0f79ad0b 100644 --- a/src/VISU_SWIG/VISU_Gen_s.cc +++ b/src/VISU_SWIG/VISU_Gen_s.cc @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_Gen_s.cc diff --git a/src/VISU_SWIG/VISU_Gen_s.hh b/src/VISU_SWIG/VISU_Gen_s.hh index ecb0c3d0..01c16707 100644 --- a/src/VISU_SWIG/VISU_Gen_s.hh +++ b/src/VISU_SWIG/VISU_Gen_s.hh @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // File : VISU_Gen_s.hh diff --git a/src/VISU_SWIG/VISU_shared_modules.py b/src/VISU_SWIG/VISU_shared_modules.py index afd4231f..f802f0ac 100644 --- a/src/VISU_SWIG/VISU_shared_modules.py +++ b/src/VISU_SWIG/VISU_shared_modules.py @@ -1,3 +1,22 @@ +# Copyright (C) 2005 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 +# """ """ diff --git a/src/VISU_SWIG/batch_test_events.py b/src/VISU_SWIG/batch_test_events.py index df7f3c3c..804aaee1 100644 --- a/src/VISU_SWIG/batch_test_events.py +++ b/src/VISU_SWIG/batch_test_events.py @@ -1,3 +1,22 @@ +# Copyright (C) 2005 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 : batch_test_events.py diff --git a/src/VISU_SWIG/batchmode_visu.py b/src/VISU_SWIG/batchmode_visu.py index 559a3eb4..62223534 100644 --- a/src/VISU_SWIG/batchmode_visu.py +++ b/src/VISU_SWIG/batchmode_visu.py @@ -1,8 +1,23 @@ # VISU VISU_SWIG : binding of C++ implementation and Python # -# Copyright (C) 2003 CEA/DEN, EDF R&D -# +# 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 : batchmode_visu.py # Module : VISU diff --git a/src/VISU_SWIG/batchmode_visu_table.py b/src/VISU_SWIG/batchmode_visu_table.py index aca745d1..b1d23d91 100644 --- a/src/VISU_SWIG/batchmode_visu_table.py +++ b/src/VISU_SWIG/batchmode_visu_table.py @@ -1,8 +1,23 @@ # VISU VISU_SWIG : binding of C++ implementation and Python # -# Copyright (C) 2003 CEA/DEN, EDF R&D -# -# +# 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_big_table.py # Author : Vadim SANDLER diff --git a/src/VISU_SWIG/batchmode_visu_view.py b/src/VISU_SWIG/batchmode_visu_view.py index 4bc74a8b..3c0f4249 100644 --- a/src/VISU_SWIG/batchmode_visu_view.py +++ b/src/VISU_SWIG/batchmode_visu_view.py @@ -1,13 +1,27 @@ # VISU VISU_SWIG : binding of C++ implementation and Python # -# Copyright (C) 2003 CEA/DEN, EDF R&D -# -# +# 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 : test_table.py # Author : Alexey Petrov # Module : VISU -# $Header: from VISU import * from batchmode_visu_table import * diff --git a/src/VISU_SWIG/batchmode_visu_view3d.py b/src/VISU_SWIG/batchmode_visu_view3d.py index f5154355..a08a91b0 100644 --- a/src/VISU_SWIG/batchmode_visu_view3d.py +++ b/src/VISU_SWIG/batchmode_visu_view3d.py @@ -1,8 +1,23 @@ # VISU VISU_SWIG : binding of C++ implementation and Python # -# Copyright (C) 2003 CEA/DEN, EDF R&D -# -# +# 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 : batchmode_visu_view3d.py # Module : VISU @@ -246,7 +261,7 @@ myResult = myVisu.ImportFile(medFile) anAnim = myVisu.CreateAnimation(myView); aSObj = myStudy.FindObjectIOR(myResult.GetID()) aSObj = aSObj.FindSubObject(1)[1] -aSObj = aSObj.FindSubObject(2)[1] +aSObj = aSObj.FindSubObject(3)[1] aSObj = aSObj.FindSubObject(2)[1] anAnim.addField(aSObj) anAnim.setPresentationType(0,VISU.TISOSURFACE) diff --git a/src/VISU_SWIG/libVISU_Swig.i b/src/VISU_SWIG/libVISU_Swig.i index 1f9a4de7..280bb30d 100644 --- a/src/VISU_SWIG/libVISU_Swig.i +++ b/src/VISU_SWIG/libVISU_Swig.i @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // diff --git a/src/VISU_SWIG/test_events.py b/src/VISU_SWIG/test_events.py index df53a3e8..385466fd 100755 --- a/src/VISU_SWIG/test_events.py +++ b/src/VISU_SWIG/test_events.py @@ -1,3 +1,22 @@ +# Copyright (C) 2005 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 : test_events.py diff --git a/src/VISU_SWIG/visu.py b/src/VISU_SWIG/visu.py index daadf7aa..2d8b23bb 100644 --- a/src/VISU_SWIG/visu.py +++ b/src/VISU_SWIG/visu.py @@ -1,8 +1,23 @@ # VISU VISU_SWIG : binding of C++ implementation and Python # -# Copyright (C) 2003 CEA/DEN, EDF R&D -# -# +# 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.py # Module : VISU @@ -81,6 +96,12 @@ def PublishComponent(theStudyDocument): pass return aSComponent; + +def SetName(theObj, theName): + anIOR = myORB.object_to_string(theObj) + aSObj = myLocalStudy.FindObjectIOR(anIOR) + anAttr = aSObj.FindAttribute("AttributeName")[1] + anAttr.SetValue(theName) def StrToMap(theString) : aPairList = split(theString,";") @@ -339,7 +360,9 @@ def CreatePrsForResult(theVisu, theResult, theView, thePrsTypeList, thePictureDi while aFolderIter.More() : aFolderSObj = aFolderIter.Value() aFolderIter.Next() - anAttr = aFolderSObj.FindAttribute("AttributeName")[1] + anIsFound, anAttr = aFolderSObj.FindAttribute("AttributeName") + if not anIsFound : + continue anAttr = anAttr._narrow(SALOMEDS.AttributeName); aFolderName = anAttr.Value() print " ", aFolderName @@ -602,6 +625,23 @@ def CreatePrsForResult(theVisu, theResult, theView, thePrsTypeList, thePictureDi aPrsObj.RemoveFromStudy() else : aVISUObjList.append(aPrsObj) + + if HasValue(thePrsTypeList,VISU.TSCALARMAPONDEFORMEDSHAPE) : + print " Creating ScalarMapOnDeformedShapeOnField", + aPrsObj = theVisu.ScalarMapOnDeformedShapeOnField(theResult,aMeshName,anEntity,aFieldName,aTimeStampId) + if aPrsObj is None : print "Error" + else : + print ",OK" + theView.DisplayOnly(aPrsObj) + theView.FitAll() + aPictureName = thePictureDir + aMeshNamePic + "_" + anEntityId + "_" + aFieldName + "_" + str(aTimeStampId) + "_TSCALARMAPONDEFORMEDSHAPE." + thePictureExt + aPictureName = re.sub("\s+","_", aPictureName) + theView.SavePicture(aPictureName) + if theIsAutoDelete : + aPrsObj.RemoveFromStudy() + else : + aVISUObjList.append(aPrsObj) + return aVISUObjList diff --git a/src/VISU_SWIG/visu_big_table.py b/src/VISU_SWIG/visu_big_table.py index fb90b2d6..401c5ffe 100644 --- a/src/VISU_SWIG/visu_big_table.py +++ b/src/VISU_SWIG/visu_big_table.py @@ -1,8 +1,23 @@ # VISU VISU_SWIG : binding of C++ implementation and Python # -# Copyright (C) 2003 CEA/DEN, EDF R&D -# -# +# 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_big_table.py # Author : Vadim SANDLER diff --git a/src/VISU_SWIG/visu_delete.py b/src/VISU_SWIG/visu_delete.py index d001d601..88514870 100644 --- a/src/VISU_SWIG/visu_delete.py +++ b/src/VISU_SWIG/visu_delete.py @@ -1,3 +1,22 @@ +# Copyright (C) 2005 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 +# import VISU import SALOMEDS from visu_gui import * diff --git a/src/VISU_SWIG/visu_gui.py b/src/VISU_SWIG/visu_gui.py index d21a239f..b5798331 100644 --- a/src/VISU_SWIG/visu_gui.py +++ b/src/VISU_SWIG/visu_gui.py @@ -1,8 +1,23 @@ # VISU VISU_SWIG : binding of C++ implementation and Python # -# Copyright (C) 2003 CEA/DEN, EDF R&D -# -# +# 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_gui.py # Module : VISU diff --git a/src/VISU_SWIG/visu_med.py b/src/VISU_SWIG/visu_med.py index 04715e52..2a7c7f9d 100644 --- a/src/VISU_SWIG/visu_med.py +++ b/src/VISU_SWIG/visu_med.py @@ -1,8 +1,23 @@ # VISU VISU_SWIG : binding of C++ implementation and Python # -# Copyright (C) 2003 CEA/DEN, EDF R&D -# -# +# 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_med.py # Module : VISU @@ -13,8 +28,9 @@ import SALOMEDS import SALOME_MED import VISU -from libSALOME_Swig import * -sg = SALOMEGUI_Swig() +if salome.hasDesktop(): + from libSALOME_Swig import * + sg = SALOMEGUI_Swig() def getMedObjectFromStudy(): mySO = salome.myStudy.FindObject("Objet MED") @@ -47,7 +63,8 @@ medDir = os.getenv('DATA_DIR') + '/MedFiles/' def importMedFrom(medDir,medFile): medFile = medDir + medFile med_comp.readStructFileWithFieldType(medFile,salome.myStudyName) - sg.updateObjBrowser(1) + if salome.hasDesktop(): + sg.updateObjBrowser(1) def importMed(medFile): importMedFrom(medDir,medFile) diff --git a/src/VISU_SWIG/visu_prs_example.py b/src/VISU_SWIG/visu_prs_example.py index 1453c5ad..72ab668d 100644 --- a/src/VISU_SWIG/visu_prs_example.py +++ b/src/VISU_SWIG/visu_prs_example.py @@ -1,8 +1,23 @@ # VISU VISU_SWIG : binding of C++ implementation and Python # -# Copyright (C) 2003 CEA/DEN, EDF R&D -# -# +# 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_prs_exam.py # Module : VISU @@ -15,9 +30,9 @@ import SALOME import SALOME_MED import VISU -from libSALOME_Swig import * -sg = SALOMEGUI_Swig() - +if salome.hasDesktop(): + from libSALOME_Swig import * + sg = SALOMEGUI_Swig() import visu_gui myVisu = visu_gui.myVisu @@ -57,8 +72,8 @@ try: aScalarMap2 = myVisu.ScalarMapOnField(myResult2, aMeshName, anEntity, myField.getName(), aTimeStampId) if(myField.getNumberOfComponents() > 1) : aCutPlanes = myVisu.CutPlanesOnField(myResult2, aMeshName, anEntity, myField.getName(), aTimeStampId) - - sg.updateObjBrowser(0) + if salome.hasDesktop(): + sg.updateObjBrowser(0) else : print "We have no permission to rewrite medFile, so readStructFileWithFieldType can't open this file"; else : print "We have no permission to read medFile, it will not be opened"; except: diff --git a/src/VISU_SWIG/visu_split_views.py b/src/VISU_SWIG/visu_split_views.py index 545ed7a3..887f885b 100644 --- a/src/VISU_SWIG/visu_split_views.py +++ b/src/VISU_SWIG/visu_split_views.py @@ -1,3 +1,22 @@ +# Copyright (C) 2005 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 +# import VISU import SALOMEDS diff --git a/src/VISU_SWIG/visu_swig_test.py b/src/VISU_SWIG/visu_swig_test.py index 411e532e..2eb4a9db 100644 --- a/src/VISU_SWIG/visu_swig_test.py +++ b/src/VISU_SWIG/visu_swig_test.py @@ -1,3 +1,22 @@ +# Copyright (C) 2005 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 +# from libVISU_Swig import * medFile = os.getenv('DATA_DIR') + '/MedFiles/fra.med' myCon=Convertor(medFile) diff --git a/src/VISU_SWIG/visu_table.py b/src/VISU_SWIG/visu_table.py index 780e698c..ab2c8724 100644 --- a/src/VISU_SWIG/visu_table.py +++ b/src/VISU_SWIG/visu_table.py @@ -1,8 +1,23 @@ # VISU VISU_SWIG : binding of C++ implementation and Python # -# Copyright (C) 2003 CEA/DEN, EDF R&D -# -# +# 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_table.py # Author : Vadim SANDLER diff --git a/src/VISU_SWIG/visu_view.py b/src/VISU_SWIG/visu_view.py index d301e592..bc099d12 100644 --- a/src/VISU_SWIG/visu_view.py +++ b/src/VISU_SWIG/visu_view.py @@ -1,13 +1,27 @@ # VISU VISU_SWIG : binding of C++ implementation and Python # -# Copyright (C) 2003 CEA/DEN, EDF R&D +# 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 : test_table.py +# File : visu_view.py # Author : Alexey Petrov # Module : VISU -# $Header: import SALOMEDS import VISU diff --git a/src/VISU_SWIG/visu_view3d.py b/src/VISU_SWIG/visu_view3d.py index d1bf0721..8d1c94a0 100644 --- a/src/VISU_SWIG/visu_view3d.py +++ b/src/VISU_SWIG/visu_view3d.py @@ -1,10 +1,25 @@ # VISU VISU_SWIG : binding of C++ implementation and Python # -# Copyright (C) 2003 CEA/DEN, EDF R&D +# 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 : batchmode_visu_view3d.py +# File : visu_view3d.py # Module : VISU import os @@ -253,7 +268,7 @@ myResult = myVisu.ImportFile(medFile) anAnim = myVisu.CreateAnimation(myView); aSObj = myStudy.FindObjectIOR(myResult.GetID()) aSObj = aSObj.FindSubObject(1)[1] -aSObj = aSObj.FindSubObject(2)[1] +aSObj = aSObj.FindSubObject(3)[1] aSObj = aSObj.FindSubObject(2)[1] anAnim.addField(aSObj) anAnim.setPresentationType(0,VISU.TISOSURFACE) diff --git a/src/VVTK/Makefile.in b/src/VVTK/Makefile.in index 66b48653..9032e4d0 100755 --- a/src/VVTK/Makefile.in +++ b/src/VVTK/Makefile.in @@ -1,3 +1,22 @@ +# Copyright (C) 2005 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 : Makefile.in # Author : Alexander Solovyov(OCN) # Module : VVTK @@ -63,16 +82,16 @@ CPPFLAGS += \ $(OCC_INCLUDES) \ $(VTK_INCLUDES) \ $(BOOST_CPPFLAGS) \ - -I$(KERNEL_ROOT_DIR)/include/salome \ - -I$(GUI_ROOT_DIR)/include/salome \ - -I${MED_ROOT_DIR}/include/salome + $(KERNEL_CXXFLAGS) \ + $(GUI_CXXFLAGS) \ + $(MED_CXXFLAGS) LDFLAGS += \ $(QT_MT_LIBS) \ $(OCC_LIBS) \ $(VTK_LIBS) \ - -L$(KERNEL_ROOT_DIR)/lib/salome \ - -L$(GUI_ROOT_DIR)/lib/salome + $(KERNEL_LDFLAGS) \ + $(GUI_LDFLAGS) LIBS+= -lsuit -lCAM -lSalomeObject -lSVTK -lOpUtil diff --git a/src/VVTK/VVTK.h b/src/VVTK/VVTK.h index e8b032f1..5954601c 100755 --- a/src/VVTK/VVTK.h +++ b/src/VVTK/VVTK.h @@ -1,3 +1,22 @@ +// Copyright (C) 2005 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 +// #ifdef WNT #ifdef VISU_VVTK_EXPORTS #define VVTK_EXPORT __declspec(dllexport) diff --git a/src/VVTK/VVTK_ImageWriter.cxx b/src/VVTK/VVTK_ImageWriter.cxx index 9d047598..b91a4aa7 100755 --- a/src/VVTK/VVTK_ImageWriter.cxx +++ b/src/VVTK/VVTK_ImageWriter.cxx @@ -1,112 +1,112 @@ -// SALOME VTKViewer : build VTK viewer into Salome desktop -// -// 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : -// Author : -// Module : -// $Header$ - -#include "VVTK_ImageWriter.h" - -#include - -#include -#include -#include -#include - -#ifdef _DEBUG_ -static int MYDEBUG = 0; -#else -static int MYDEBUG = 0; -#endif - - -//---------------------------------------------------------------------------- -VVTK_ImageWriter -::VVTK_ImageWriter(QSemaphore* theSemaphore, - vtkImageData* theImageData, - const std::string& theName, - int theProgressive, - int theQuality): - mySemaphore(theSemaphore), - myImageData(theImageData), - myName(theName), - myProgressive(theProgressive), - myQuality(theQuality), - myConstraint16Flag(true) -{} - -//---------------------------------------------------------------------------- -VVTK_ImageWriter -::~VVTK_ImageWriter() -{ - if(MYDEBUG) cout<<"VVTK_ImageWriter::~VVTK_ImageWriter - this = "< anImageClip; - // - if(myConstraint16Flag){ - int uExtent[6]; - myImageData->GetUpdateExtent(uExtent); - unsigned int width = uExtent[1] - uExtent[0] + 1; - unsigned int height = uExtent[3] - uExtent[2] + 1; - width = (width / 16) * 16; - height= (height / 16) * 16; - uExtent[1] = uExtent[0] + width - 1; - uExtent[3] = uExtent[2] + height - 1; - // - anImageClip = vtkImageClip::New(); - anImageClip->Delete(); - - anImageClip->SetInput(myImageData); - anImageClip->SetOutputWholeExtent(uExtent); - anImageClip->ClipDataOn(); - anImageData = anImageClip->GetOutput(); - } - // - aWriter->WriteToMemoryOff(); - aWriter->SetFileName(myName.c_str()); - aWriter->SetQuality(myQuality); - aWriter->SetProgressive(myProgressive); - aWriter->SetInput(anImageData); - aWriter->Write(); - - aWriter->Delete(); - myImageData->Delete(); - - if(MYDEBUG) cout<<"VVTK_ImageWriter::run "<< - "- this = "< + +#include +#include +#include +#include + +#ifdef _DEBUG_ +static int MYDEBUG = 0; +#else +static int MYDEBUG = 0; +#endif + + +//---------------------------------------------------------------------------- +VVTK_ImageWriter +::VVTK_ImageWriter(QSemaphore* theSemaphore, + vtkImageData* theImageData, + const std::string& theName, + int theProgressive, + int theQuality): + mySemaphore(theSemaphore), + myImageData(theImageData), + myName(theName), + myProgressive(theProgressive), + myQuality(theQuality), + myConstraint16Flag(true) +{} + +//---------------------------------------------------------------------------- +VVTK_ImageWriter +::~VVTK_ImageWriter() +{ + if(MYDEBUG) cout<<"VVTK_ImageWriter::~VVTK_ImageWriter - this = "< anImageClip; + // + if(myConstraint16Flag){ + int uExtent[6]; + myImageData->GetUpdateExtent(uExtent); + unsigned int width = uExtent[1] - uExtent[0] + 1; + unsigned int height = uExtent[3] - uExtent[2] + 1; + width = (width / 16) * 16; + height= (height / 16) * 16; + uExtent[1] = uExtent[0] + width - 1; + uExtent[3] = uExtent[2] + height - 1; + // + anImageClip = vtkImageClip::New(); + anImageClip->Delete(); + + anImageClip->SetInput(myImageData); + anImageClip->SetOutputWholeExtent(uExtent); + anImageClip->ClipDataOn(); + anImageData = anImageClip->GetOutput(); + } + // + aWriter->WriteToMemoryOff(); + aWriter->SetFileName(myName.c_str()); + aWriter->SetQuality(myQuality); + aWriter->SetProgressive(myProgressive); + aWriter->SetInput(anImageData); + aWriter->Write(); + + aWriter->Delete(); + myImageData->Delete(); + + if(MYDEBUG) cout<<"VVTK_ImageWriter::run "<< + "- this = "< - -#include - -#include - - -#ifdef _DEBUG_ -static int MYDEBUG = 0; -#else -static int MYDEBUG = 0; -#endif - -//---------------------------------------------------------------------------- -VVTK_ImageWriterMgr -::VVTK_ImageWriterMgr() -{ - int aMax = std::numeric_limits::max() / 2; - mySemaphore = new QSemaphore(aMax); - *mySemaphore += aMax; - if(MYDEBUG) cout<<"VVTK_ImageWriterMgr::VVTK_ImageWriterMgr "<< - "- total = "<total()<< - "; available = "<available()<start(); - -} - - -//---------------------------------------------------------------------------- -void -VVTK_ImageWriterMgr -::Stop() -{ - if(MYDEBUG) cout<<"VVTK_ImageWriterMgr::Stop "<< - "- total = "<total()<< - "; available = "<available()< + +#include + +#include + + +#ifdef _DEBUG_ +static int MYDEBUG = 0; +#else +static int MYDEBUG = 0; +#endif + +//---------------------------------------------------------------------------- +VVTK_ImageWriterMgr +::VVTK_ImageWriterMgr() +{ + int aMax = std::numeric_limits::max() / 2; + mySemaphore = new QSemaphore(aMax); + *mySemaphore += aMax; + if(MYDEBUG) cout<<"VVTK_ImageWriterMgr::VVTK_ImageWriterMgr "<< + "- total = "<total()<< + "; available = "<available()<start(); + +} + + +//---------------------------------------------------------------------------- +void +VVTK_ImageWriterMgr +::Stop() +{ + if(MYDEBUG) cout<<"VVTK_ImageWriterMgr::Stop "<< + "- total = "<total()<< + "; available = "<available()<setLabel(tr("LBL_TOOLBAR_RECORD_LABEL")); moveDockWindow(myRecordingToolBar,Qt::DockLeft); myStartAction = new QtxAction(tr("MNU_VVTK_RECORDING_START"), @@ -173,7 +173,7 @@ void VVTK_MainWindow::onDumpView() fmt = "JPEG"; QApplication::setOverrideCursor( Qt::waitCursor ); - bool res = img.save( fileName, fmt.latin1() ); + img.save( fileName, fmt.latin1() ); QApplication::restoreOverrideCursor(); } @@ -263,7 +263,7 @@ VVTK_MainWindow1 { myPtsToolBar = new QToolBar(this); myPtsToolBar->setCloseMode(QDockWindow::Undocked); - myPtsToolBar->setLabel(tr("LBL_TOOLBAR_LABEL")); + myPtsToolBar->setLabel(tr("LBL_TOOLBAR_GAUSS_LABEL")); moveDockWindow(myPtsToolBar,Qt::DockLeft); QPixmap aPixmap; @@ -299,8 +299,7 @@ VVTK_MainWindow1 myPickingAction->addTo( myPtsToolBar ); connect(myPickingAction, SIGNAL(toggled(bool)), this, SLOT(OnSelectionModeSwitch(bool))); - myPickingDlg = new VVTK_PickingDlg( this, "PickingDlg" ); - myPickingDlg->SetAction( myPickingAction ); + myPickingDlg = new VVTK_PickingDlg( myPickingAction, this, "PickingDlg" ); // Plane/Sphere Segmentation aPixmap = theResourceMgr->loadPixmap("VISU",tr("ICON_VVTK_PLANE_SEGMENTATION_SWITCH")); @@ -384,6 +383,9 @@ void VVTK_MainWindow1 ::OnSelectionModeSwitch(bool theIsSelectionOn) { + if ( theIsSelectionOn && !isVisible() ) + return; + Selection_Mode aSelectionMode = SelectionMode(); if(theIsSelectionOn && aSelectionMode != GaussPointSelection) SetSelectionMode(GaussPointSelection); diff --git a/src/VVTK/VVTK_MainWindow.h b/src/VVTK/VVTK_MainWindow.h index 1d0b0bc3..dc440807 100644 --- a/src/VVTK/VVTK_MainWindow.h +++ b/src/VVTK/VVTK_MainWindow.h @@ -1,3 +1,22 @@ +// Copyright (C) 2005 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 +// #ifndef VVTK_MAINWINDOW_H #define VVTK_MAINWINDOW_H diff --git a/src/VVTK/VVTK_PickingDlg.cxx b/src/VVTK/VVTK_PickingDlg.cxx index 06e1dabb..716ae439 100644 --- a/src/VVTK/VVTK_PickingDlg.cxx +++ b/src/VVTK/VVTK_PickingDlg.cxx @@ -1,8 +1,21 @@ -// VISU VISUGUI : GUI of VISU component -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// +// 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 : VVTK_PickingDlg.cxx // Author : Oleg Uvarov @@ -13,9 +26,11 @@ #include "VISU_GaussPtsAct.h" #include "VISU_GaussPtsSettings.h" +#include "SUIT_MessageBox.h" #include "SUIT_ResourceMgr.h" #include "SUIT_Session.h" +#include "SVTK_MainWindow.h" #include "SVTK_RenderWindowInteractor.h" #include @@ -40,20 +55,24 @@ #include "QtxDblSpinBox.h" #include "QtxIntSpinBox.h" +#include "LightApp_Application.h" + using namespace std; -VVTK_PickingDlg::VVTK_PickingDlg( QWidget* parent, const char* name ) - :QDialog( parent, name, false, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ), - myEventCallbackCommand( vtkCallbackCommand::New() ), - myPickingSettings( VISU_PickingSettings::New() ) +VVTK_PickingDlg::VVTK_PickingDlg(QtxAction* theAction, + SVTK_MainWindow* theParent, + const char* theName): + SVTK_DialogBase(theAction, + theParent, + theName), + myEventCallbackCommand( vtkCallbackCommand::New() ), + myPickingSettings( VISU_PickingSettings::New() ) { myPriority = 0.0; myEventCallbackCommand->Delete(); myEventCallbackCommand->SetClientData(this); myEventCallbackCommand->SetCallback(VVTK_PickingDlg::ProcessEvents); - SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); - setCaption( tr( "PICKING_DLG_TITLE" ) ); setSizeGripEnabled(TRUE); @@ -206,11 +225,16 @@ VVTK_PickingDlg::VVTK_PickingDlg( QWidget* parent, const char* name ) buttonClose->setAutoDefault( TRUE ); GroupButtonsLayout->addWidget( buttonClose, 0, 2 ); + QPushButton* buttonHelp = new QPushButton( tr( "&Help" ) , GroupButtons, "buttonHelp" ); + buttonHelp->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonHelp, 0, 3 ); + TopLayout->addWidget( aBox ); TopLayout->addWidget( GroupButtons ); connect( buttonApply, SIGNAL( clicked() ), this, SLOT( onClickApply() ) ); connect( buttonClose, SIGNAL( clicked() ), this, SLOT( onClickClose() ) ); + connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( onClickHelp() ) ); } VVTK_PickingDlg::~VVTK_PickingDlg() @@ -250,7 +274,7 @@ void VVTK_PickingDlg::Update() myStepNumberSpinBox->setValue( myPickingSettings->GetStepNumber() ); myDisplayParentMeshCheckBox->setChecked( myPickingSettings->GetDisplayParentMesh() ); - float* aColor = myPickingSettings->GetColor(); + vtkFloatingPointType* aColor = myPickingSettings->GetColor(); mySelectionColorButton->setPaletteBackgroundColor( QColor( ( int )( aColor[0] * 255.0 ), ( int )( aColor[1] * 255.0 ), ( int )( aColor[2] * 255.0 ) ) ); @@ -349,7 +373,7 @@ void VVTK_PickingDlg::onClickApply() myPickingSettings->SetDisplayParentMesh( myDisplayParentMeshCheckBox->isChecked() ); QColor aButtonColor = mySelectionColorButton->paletteBackgroundColor(); - float aColor[3]; + vtkFloatingPointType aColor[3]; aColor[0] = aButtonColor.red() / 255.0; aColor[1] = aButtonColor.green() / 255.0; aColor[2] = aButtonColor.blue() / 255.0; @@ -360,14 +384,21 @@ void VVTK_PickingDlg::onClickApply() void VVTK_PickingDlg::onClickClose() { - myAction->setOn( false ); reject(); } -void VVTK_PickingDlg::done( int r ) +void VVTK_PickingDlg::onClickHelp() { - myAction->setOn( false ); - QDialog::done( r ); + QString aHelpFileName = "picking.htm"; + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) + app->onHelpContextModule(app->activeModule() ? app->moduleName(app->activeModule()->moduleName()) : QString(""), aHelpFileName); + else { + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + QObject::tr("BUT_OK")); + } } void VVTK_PickingDlg::onColorButtonPressed() diff --git a/src/VVTK/VVTK_PickingDlg.h b/src/VVTK/VVTK_PickingDlg.h index 72d3a4ec..9cd68798 100644 --- a/src/VVTK/VVTK_PickingDlg.h +++ b/src/VVTK/VVTK_PickingDlg.h @@ -1,8 +1,21 @@ -// VISU VISUGUI : GUI of VISU component -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// +// 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 : VVTK_PickingDlg.h // Author : Oleg Uvarov @@ -11,7 +24,7 @@ #ifndef VVTK_PICKINGDLG_H #define VVTK_PICKINGDLG_H -#include +#include "SVTK_DialogBase.h" #include #include @@ -32,6 +45,7 @@ class QtxIntSpinBox; class VISU_GaussPtsAct; class VISU_PickingSettings; +class SVTK_MainWindow; class SVTK_RenderWindowInteractor; //! Picking Dialog. @@ -39,16 +53,16 @@ class SVTK_RenderWindowInteractor; * Uses for set up picking preferenses and apply * them to all actors in the current renderer. */ -class VVTK_PickingDlg : public QDialog +class VVTK_PickingDlg : public SVTK_DialogBase { Q_OBJECT public: - VVTK_PickingDlg( QWidget* parent = 0, const char* name = 0 ); - ~VVTK_PickingDlg(); + VVTK_PickingDlg(QtxAction* theAction, + SVTK_MainWindow* theParent, + const char* theName); - //! Used to switch toggle state of the Picking action. - void SetAction( QtxAction* theAction ) { myAction = theAction; } + ~VVTK_PickingDlg(); //! Make an actor to listen the event of Update Picking Settings event. void AddActor( VISU_GaussPtsAct* ); @@ -62,10 +76,9 @@ public: void SetInteractor( SVTK_RenderWindowInteractor* ); protected slots: - virtual void done( int ); - void onClickApply(); void onClickClose(); + void onClickHelp(); void onColorButtonPressed(); diff --git a/src/VVTK/VVTK_PrimitiveBox.cxx b/src/VVTK/VVTK_PrimitiveBox.cxx index f874be7b..58c8bc36 100644 --- a/src/VVTK/VVTK_PrimitiveBox.cxx +++ b/src/VVTK/VVTK_PrimitiveBox.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // diff --git a/src/VVTK/VVTK_PrimitiveBox.h b/src/VVTK/VVTK_PrimitiveBox.h index 5ee04398..722d17f2 100644 --- a/src/VVTK/VVTK_PrimitiveBox.h +++ b/src/VVTK/VVTK_PrimitiveBox.h @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // diff --git a/src/VVTK/VVTK_Recorder.cxx b/src/VVTK/VVTK_Recorder.cxx index 849f810a..f39020f2 100755 --- a/src/VVTK/VVTK_Recorder.cxx +++ b/src/VVTK/VVTK_Recorder.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -318,13 +318,23 @@ VVTK_Recorder { myPaused = myPaused ? 0 : 1; if(myPaused && !myFrameIndexes.empty()){ - size_t aLastId = myFrameIndexes.size() - 1; - myFrameIndexes[aLastId] *= -1; + myFrameIndexes.back() *= -1; + if(MYDEBUG) cout<<"VVTK_Recorder::Pause - myFrameIndexes.back() = "< -#include -#include - -#include - -class vtkRenderWindow; -class vtkCallbackCommand; -class vtkWindowToImageFilter; -class VVTK_ImageWriterMgr; -// -class VVTK_Recorder : public vtkObject -{ - protected: - enum State { - VVTK_Recorder_Unknown=0, - VVTK_Recorder_Record, - VVTK_Recorder_Stop - }; - - public: - static VVTK_Recorder *New(); - vtkTypeRevisionMacro(VVTK_Recorder,vtkObject); - - void - SetRenderWindow(vtkRenderWindow* theRenderWindow); - - vtkRenderWindow* - RenderWindow(); - - void - SetName(const char *theName); - - const char* - Name() const; - - void - SetNbFPS(const double theNbFPS); - - double - NbFPS() const; - - void - SetQuality(int theQuality); - - int - GetQuality() const; - - void - SetProgressiveMode(bool theProgressiveMode); - - bool - GetProgressiveMode() const; - - void - SetUseSkippedFrames(bool theUseSkippedFrames); - - bool - UseSkippedFrames() const; - - void - Record(); - - void - Pause(); - - void - Stop(); - - int - State() const; - - int - ErrorStatus() const; - - void - CheckExistAVIMaker(); - -protected : - VVTK_Recorder(); - - ~VVTK_Recorder(); - - void - DoRecord(); - - void - MakeFileAVI(); - - void - AddSkippedFrames(); - - void - PreWrite(); - - static - void - ProcessEvents(vtkObject* theObject, - unsigned long theEvent, - void* theClientData, - void* theCallData); - -protected : - int myState; - int myPaused; - int myErrorStatus; - - float myPriority; - double myTimeStart; - - int myFrameIndex; - int myNbWrittenFrames; - - double myNbFPS; - int myQuality; - bool myProgressiveMode; - - typedef std::vector TFrameIndexes; - TFrameIndexes myFrameIndexes; - bool myUseSkippedFrames; - - std::string myName; - std::string myNameAVIMaker; - - vtkCallbackCommand *myCommand; - vtkRenderWindow *myRenderWindow; - vtkWindowToImageFilter *myFilter; - VVTK_ImageWriterMgr *myWriterMgr; - - -private: - VVTK_Recorder(const VVTK_Recorder&); //Not implemented - void operator=(const VVTK_Recorder&); //Not implemented -}; -#endif +// SALOME VTKViewer : build VTK viewer into Salome desktop +// +// 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 : +// Author : +// Module : SALOME +// $Header$ + +#ifndef _VVTK_Recorder_Header_File_ +#define _VVTK_Recorder_Header_File_ + +#include +#include +#include + +#include + +class vtkRenderWindow; +class vtkCallbackCommand; +class vtkWindowToImageFilter; +class VVTK_ImageWriterMgr; +// +class VVTK_Recorder : public vtkObject +{ + protected: + enum State { + VVTK_Recorder_Unknown=0, + VVTK_Recorder_Record, + VVTK_Recorder_Stop + }; + + public: + static VVTK_Recorder *New(); + vtkTypeRevisionMacro(VVTK_Recorder,vtkObject); + + void + SetRenderWindow(vtkRenderWindow* theRenderWindow); + + vtkRenderWindow* + RenderWindow(); + + void + SetName(const char *theName); + + const char* + Name() const; + + void + SetNbFPS(const double theNbFPS); + + double + NbFPS() const; + + void + SetQuality(int theQuality); + + int + GetQuality() const; + + void + SetProgressiveMode(bool theProgressiveMode); + + bool + GetProgressiveMode() const; + + void + SetUseSkippedFrames(bool theUseSkippedFrames); + + bool + UseSkippedFrames() const; + + void + Record(); + + void + Pause(); + + void + Stop(); + + int + State() const; + + int + ErrorStatus() const; + + void + CheckExistAVIMaker(); + +protected : + VVTK_Recorder(); + + ~VVTK_Recorder(); + + void + DoRecord(); + + void + MakeFileAVI(); + + void + AddSkippedFrames(); + + void + PreWrite(); + + static + void + ProcessEvents(vtkObject* theObject, + unsigned long theEvent, + void* theClientData, + void* theCallData); + +protected : + int myState; + int myPaused; + int myErrorStatus; + + float myPriority; + double myTimeStart; + + int myFrameIndex; + int myNbWrittenFrames; + + double myNbFPS; + int myQuality; + bool myProgressiveMode; + + typedef std::vector TFrameIndexes; + TFrameIndexes myFrameIndexes; + bool myUseSkippedFrames; + + std::string myName; + std::string myNameAVIMaker; + + vtkCallbackCommand *myCommand; + vtkRenderWindow *myRenderWindow; + vtkWindowToImageFilter *myFilter; + VVTK_ImageWriterMgr *myWriterMgr; + + +private: + VVTK_Recorder(const VVTK_Recorder&); //Not implemented + void operator=(const VVTK_Recorder&); //Not implemented +}; +#endif diff --git a/src/VVTK/VVTK_RecorderDlg.cxx b/src/VVTK/VVTK_RecorderDlg.cxx index b188c99e..bb495f1e 100644 --- a/src/VVTK/VVTK_RecorderDlg.cxx +++ b/src/VVTK/VVTK_RecorderDlg.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -29,12 +29,15 @@ #include "VVTK_Recorder.h" #include "SUIT_FileDlg.h" +#include "SUIT_MessageBox.h" #include "SUIT_ResourceMgr.h" #include "SUIT_Session.h" #include "QtxDblSpinBox.h" #include "QtxIntSpinBox.h" +#include "LightApp_Application.h" + #include #include #include @@ -127,8 +130,13 @@ VVTK_RecorderDlg::VVTK_RecorderDlg( QWidget* theParent, VVTK_Recorder* theRecord aCloseButton->setAutoDefault( true ); CommonGroupLayout->addWidget( aCloseButton, 0, 2 ); + QPushButton* aHelpButton = new QPushButton( tr( "HELP" ), CommonGroup ); + aHelpButton->setAutoDefault( true ); + CommonGroupLayout->addWidget( aHelpButton, 0, 3 ); + connect( aStartButton, SIGNAL( clicked() ), this, SLOT( onStart() ) ); connect( aCloseButton, SIGNAL( clicked() ), this, SLOT( onClose() ) ); + connect( aHelpButton, SIGNAL( clicked() ), this, SLOT( onHelp() ) ); } VVTK_RecorderDlg::~VVTK_RecorderDlg() @@ -162,6 +170,20 @@ void VVTK_RecorderDlg::onClose() reject(); } +void VVTK_RecorderDlg::onHelp() +{ + QString aHelpFileName = "animation_in_gauss_viewer.htm"; + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) + app->onHelpContextModule(app->activeModule() ? app->moduleName(app->activeModule()->moduleName()) : QString(""), aHelpFileName); + else { + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + QObject::tr("BUT_OK")); + } +} + bool VVTK_RecorderDlg::onBrowseFile() { QString aRootDir = QString( getenv( "VISU_ROOT_DIR") ); diff --git a/src/VVTK/VVTK_RecorderDlg.h b/src/VVTK/VVTK_RecorderDlg.h index f46ef1b1..5c2ead33 100644 --- a/src/VVTK/VVTK_RecorderDlg.h +++ b/src/VVTK/VVTK_RecorderDlg.h @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -61,6 +61,7 @@ public: protected slots: void onStart(); void onClose(); + void onHelp(); bool onBrowseFile(); diff --git a/src/VVTK/VVTK_Renderer.cxx b/src/VVTK/VVTK_Renderer.cxx index 484eff95..8517d78d 100644 --- a/src/VVTK/VVTK_Renderer.cxx +++ b/src/VVTK/VVTK_Renderer.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -125,7 +125,7 @@ VISU_FPSActor } std::ostringstream aStr; float aFPS = 1.0 / aLastRenderTimeInSeconds; - aStr<<"FPS: "<SetMapper(aTextMapper); aTextMapper->Delete(); - GetDevice()->AddActor2D(myFPSActor.GetPointer()); + //GetDevice()->AddActor2D(myFPSActor.GetPointer()); myGaussPointPicker->Delete(); @@ -236,19 +236,17 @@ vtkStandardNewMacro(VVTK_Renderer1); //---------------------------------------------------------------------------- VVTK_Renderer1::VVTK_Renderer1(): - //myImplicitFunctionWidget(VISU_ImplicitFunctionWidget::New()), myWidgetCtrl(VISU_WidgetCtrl::New()), myOutsideCursorSettings(NULL) { if(MYDEBUG) INFOS("VVTK_Renderer1() - "<SetPlaceFactor(1.1); myWidgetCtrl->SetPlaceFactor(1.1); // - VISU_PlanesWidget *pPlanesWidget=myWidgetCtrl->GetPlanesWidget(); - pPlanesWidget->SetOutlineTranslation(false); - vtkProperty* aSelectedPlaneProperty = pPlanesWidget->GetSelectedPlaneProperty(); - vtkProperty* aPlaneProperty = pPlanesWidget->GetPlaneProperty(); + VISU_PlanesWidget *aPlanesWidget = myWidgetCtrl->GetPlanesWidget(); + aPlanesWidget->SetOutlineTranslation(false); + vtkProperty* aSelectedPlaneProperty = aPlanesWidget->GetSelectedPlaneProperty(); + vtkProperty* aPlaneProperty = aPlanesWidget->GetPlaneProperty(); aPlaneProperty->SetOpacity(aSelectedPlaneProperty->GetOpacity()*1.5); // myWidgetCtrl->Delete(); @@ -274,6 +272,7 @@ VVTK_Renderer1 } } + //---------------------------------------------------------------------------- void VVTK_Renderer1 @@ -286,30 +285,32 @@ VVTK_Renderer1 AdjustWidgetCtrl(); } } + + //---------------------------------------------------------------------------- -void VVTK_Renderer1::AdjustWidgetCtrl() +void +VVTK_Renderer1 +::AdjustWidgetCtrl() { - if(SVTK_Renderer::OnAdjustActors()){ - VISU_PlanesWidget *pPlanesWidget=myWidgetCtrl->GetPlanesWidget(); - pPlanesWidget->InitialPlaceWidget(myBndBox); - pPlanesWidget->SetOrigin(0.5*(myBndBox[1] + myBndBox[0]), - 0.5*(myBndBox[3] + myBndBox[2]), - 0.5*(myBndBox[5] + myBndBox[4])); - // - VISU_SphereWidget *pSphereWidget=myWidgetCtrl->GetSphereWidget(); - pSphereWidget->SetCenter(0.5*(myBndBox[1] + myBndBox[0]), - 0.5*(myBndBox[3] + myBndBox[2]), - 0.5*(myBndBox[5] + myBndBox[4])); - float dX, dXmin=1.e20; - for (int i=0; i<3; ++i) { - dX=myBndBox[2*i+1]-myBndBox[2*i]; - if (dXSetRadius(dXmin); + VISU_PlanesWidget *aPlanesWidget = myWidgetCtrl->GetPlanesWidget(); + aPlanesWidget->InitialPlaceWidget(myBndBox); + aPlanesWidget->SetOrigin(0.5*(myBndBox[1] + myBndBox[0]), + 0.5*(myBndBox[3] + myBndBox[2]), + 0.5*(myBndBox[5] + myBndBox[4])); + // + VISU_SphereWidget *aSphereWidget = myWidgetCtrl->GetSphereWidget(); + aSphereWidget->SetCenter(0.5*(myBndBox[1] + myBndBox[0]), + 0.5*(myBndBox[3] + myBndBox[2]), + 0.5*(myBndBox[5] + myBndBox[4])); + + float aMinLength = VTK_LARGE_FLOAT; + for (int i=0; i<3; ++i) { + float aLength = myBndBox[2*i+1]-myBndBox[2*i]; + aMinLength = std::min(aMinLength,aLength); } + aSphereWidget->SetRadius(aMinLength); } + //---------------------------------------------------------------------------- void VVTK_Renderer1 @@ -329,7 +330,9 @@ VVTK_Renderer1 } //---------------------------------------------------------------------------- -VISU_WidgetCtrl* VVTK_Renderer1::GetWidgetCtrl() +VISU_WidgetCtrl* +VVTK_Renderer1 +::GetWidgetCtrl() { return myWidgetCtrl.GetPointer(); } diff --git a/src/VVTK/VVTK_Renderer.h b/src/VVTK/VVTK_Renderer.h index 1f566884..6cf53326 100644 --- a/src/VVTK/VVTK_Renderer.h +++ b/src/VVTK/VVTK_Renderer.h @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // diff --git a/src/VVTK/VVTK_SegmentationCursorDlg.cxx b/src/VVTK/VVTK_SegmentationCursorDlg.cxx index 525ef469..4f8a9e5a 100644 --- a/src/VVTK/VVTK_SegmentationCursorDlg.cxx +++ b/src/VVTK/VVTK_SegmentationCursorDlg.cxx @@ -1,8 +1,21 @@ -// VISU VISUGUI : GUI of VISU component -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// +// 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 : VVTK_SegmentationCursorDlg.cxx // Author : Oleg Uvarov @@ -22,6 +35,7 @@ #include "VISU_GaussPointsPL.hxx" #include "VISU_OpenGLPointSpriteMapper.hxx" +#include "LightApp_Application.h" #include "SUIT_MessageBox.h" #include "SUIT_ResourceMgr.h" #include "SUIT_Session.h" @@ -101,7 +115,7 @@ namespace VISU static TTextureMap aTextureMap; TTextureValue aTextureValue; - TTextureKey aTextureKey(theMainTexture,theAlphaTexture); + TTextureKey aTextureKey(theMainTexture.latin1(),theAlphaTexture.latin1()); TTextureMap::const_iterator anIter = aTextureMap.find(aTextureKey); if(anIter != aTextureMap.end()){ aTextureValue = anIter->second; @@ -146,8 +160,6 @@ VVTK_SegmentationCursorDlg::VVTK_SegmentationCursorDlg( QWidget* parent, const c myEventCallbackCommand.GetPointer(), myPriority); - SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); - setCaption( tr( "SEGMENTATION_CURSOR_DLG_TITLE" ) ); setSizeGripEnabled(TRUE); @@ -188,9 +200,9 @@ VVTK_SegmentationCursorDlg::VVTK_SegmentationCursorDlg( QWidget* parent, const c QLabel* ZOriginLabel = new QLabel( tr( "ORIGIN_Z" ), myOriginGroup ); myZOriginSpinBox = new QtxDblSpinBox( -1000.0, 1000.0, 0.1, myOriginGroup ); - myZOriginSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); + //myZOriginSpinBox->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); myZOriginSpinBox->setMinimumWidth( 100 ); - myZOriginSpinBox->setValue( 0.0 ); + myZOriginSpinBox->setValue( 1.0 ); OriginGroupLayout->addWidget( XOriginLabel, 0, 0 ); OriginGroupLayout->addWidget( myXOriginSpinBox, 0, 1 ); @@ -386,11 +398,19 @@ VVTK_SegmentationCursorDlg::VVTK_SegmentationCursorDlg( QWidget* parent, const c buttonClose->setAutoDefault( TRUE ); GroupButtonsLayout->addWidget( buttonClose, 0, 2 ); + QPushButton* buttonHelp = new QPushButton( tr( "&Help" ) , GroupButtons, "buttonHelp" ); + buttonHelp->setAutoDefault( TRUE ); + GroupButtonsLayout->addWidget( buttonHelp, 0, 3 ); + TopLayout->addWidget( myTabBox ); TopLayout->addWidget( GroupButtons ); connect( buttonApply, SIGNAL( clicked() ), this, SLOT( onClickApply() ) ); connect( buttonClose, SIGNAL( clicked() ), this, SLOT( onClickClose() ) ); + connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( onClickHelp() ) ); + + connect(parent, SIGNAL(Show( QShowEvent * )), this, SLOT(onParentShow())); + connect(parent, SIGNAL(Hide( QHideEvent * )), this, SLOT(onParentHide())); } VVTK_SegmentationCursorDlg::~VVTK_SegmentationCursorDlg() @@ -468,13 +488,13 @@ void VVTK_SegmentationCursorDlg::UpdateSegmentation() myRadiusGroup->hide(); VISU_PlanesWidget *pPlanesWidget=myWidgetCtrl->GetPlanesWidget(); - float origin[3]; + vtkFloatingPointType origin[3]; pPlanesWidget->GetOrigin( origin ); myXOriginSpinBox->setValue( origin[0] ); myYOriginSpinBox->setValue( origin[1] ); myZOriginSpinBox->setValue( origin[2] ); - float normal[3]; + vtkFloatingPointType normal[3]; pPlanesWidget->GetNormal( normal ); myDXDirectionSpinBox->setValue( normal[0] ); myDYDirectionSpinBox->setValue( normal[1] ); @@ -489,7 +509,7 @@ void VVTK_SegmentationCursorDlg::UpdateSegmentation() myRadiusGroup->show(); VISU_SphereWidget *pSphereWidget=myWidgetCtrl->GetSphereWidget(); - float origin[3], aRadius; + vtkFloatingPointType origin[3], aRadius; pSphereWidget->GetCenter(origin); myXOriginSpinBox->setValue( origin[0] ); myYOriginSpinBox->setValue( origin[1] ); @@ -503,15 +523,15 @@ void VVTK_SegmentationCursorDlg::UpdateSegmentation() void VVTK_SegmentationCursorDlg::UpdateInsideGaussPoints() { int aPrimitiveType = VISU_OpenGLPointSpriteMapper::PointSprite; - float aClamp = 200.0; + vtkFloatingPointType aClamp = 200.0; QString aMainTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_texture.bmp"; QString anAlphaTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_alpha.bmp"; - float anAlphaThreshold = 0.1; + vtkFloatingPointType anAlphaThreshold = 0.1; int aResolution = 8; int aMinSize = 3; int aMaxSize = 33; int aMagnification = 100; - float anIncrement = 2.0; + vtkFloatingPointType anIncrement = 2.0; if( !myInsideCursorSettings->GetInitial() ) { @@ -570,11 +590,11 @@ void VVTK_SegmentationCursorDlg::UpdateInsideGaussPoints() void VVTK_SegmentationCursorDlg::UpdateOutsideGaussPoints() { - float aClamp = 256.0; + vtkFloatingPointType aClamp = 256.0; int aPrimitiveType = VISU_OpenGLPointSpriteMapper::PointSprite; QString aMainTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_texture.bmp"; QString anAlphaTexture = QString( getenv( "VISU_ROOT_DIR") ) + "/share/salome/resources/sprite_alpha.bmp"; - float anAlphaThreshold = 0.1; + vtkFloatingPointType anAlphaThreshold = 0.1; int aResolution = 8; int aSize = 25; bool aUniform = false; @@ -592,7 +612,7 @@ void VVTK_SegmentationCursorDlg::UpdateOutsideGaussPoints() myOutsideSizeBox->setOutsideSize( myOutsideCursorSettings->GetSize() ); myOutsideSizeBox->setUniform( myOutsideCursorSettings->GetUniform() ); - float* aColor = myOutsideCursorSettings->GetColor(); + vtkFloatingPointType* aColor = myOutsideCursorSettings->GetColor(); myOutsideSizeBox->setColor( QColor( ( int )( aColor[0] * 255.0 ), ( int )( aColor[1] * 255.0 ), ( int )( aColor[2] * 255.0 ) ) ); @@ -701,13 +721,13 @@ void VVTK_SegmentationCursorDlg::ApplySegmentationCursor() if( myIsPlaneSegmentation ) { VISU_PlanesWidget *pPlanesWidget=myWidgetCtrl->GetPlanesWidget(); - float origin[3]; + vtkFloatingPointType origin[3]; origin[0] = myXOriginSpinBox->value(); origin[1] = myYOriginSpinBox->value(); origin[2] = myZOriginSpinBox->value(); pPlanesWidget->SetOrigin( origin ); - float normal[3]; + vtkFloatingPointType normal[3]; normal[0] = myDXDirectionSpinBox->value(); normal[1] = myDYDirectionSpinBox->value(); normal[2] = myDZDirectionSpinBox->value(); @@ -727,7 +747,7 @@ void VVTK_SegmentationCursorDlg::ApplySegmentationCursor() else { VISU_SphereWidget *pSphereWidget=myWidgetCtrl->GetSphereWidget(); - float origin[3], aRadius; + vtkFloatingPointType origin[3], aRadius; origin[0] = myXOriginSpinBox->value(); origin[1] = myYOriginSpinBox->value(); origin[2] = myZOriginSpinBox->value(); @@ -786,7 +806,7 @@ void VVTK_SegmentationCursorDlg::ApplyOutsideGaussPoints() myOutsideCursorSettings->SetUniform( myOutsideSizeBox->getUniform() ); QColor aButtonColor = myOutsideSizeBox->getColor(); - float aColor[3]; + vtkFloatingPointType aColor[3]; aColor[0] = aButtonColor.red() / 255.0; aColor[1] = aButtonColor.green() / 255.0; aColor[2] = aButtonColor.blue() / 255.0; @@ -808,6 +828,20 @@ void VVTK_SegmentationCursorDlg::onClickClose() reject(); } +void VVTK_SegmentationCursorDlg::onClickHelp() +{ + QString aHelpFileName = "segmentation.htm"; + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) + app->onHelpContextModule(app->activeModule() ? app->moduleName(app->activeModule()->moduleName()) : QString(""), aHelpFileName); + else { + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + QObject::tr("BUT_OK")); + } +} + void VVTK_SegmentationCursorDlg::done( int r ) { myPlaneAction->setOn( false ); @@ -818,6 +852,19 @@ void VVTK_SegmentationCursorDlg::done( int r ) QDialog::done( r ); } +void VVTK_SegmentationCursorDlg::onParentShow() +{ + if(myPlaneAction->isOn() || mySphereAction->isOn()) + show(); + else + hide(); +} + +void VVTK_SegmentationCursorDlg::onParentHide() +{ + hide(); +} + bool VVTK_SegmentationCursorDlg::CheckNumberOfFaces() { if( !myInteractor ) diff --git a/src/VVTK/VVTK_SegmentationCursorDlg.h b/src/VVTK/VVTK_SegmentationCursorDlg.h index 6e521427..8f1e462a 100644 --- a/src/VVTK/VVTK_SegmentationCursorDlg.h +++ b/src/VVTK/VVTK_SegmentationCursorDlg.h @@ -1,8 +1,21 @@ -// VISU VISUGUI : GUI of VISU component -// -// Copyright (C) 2003 CEA/DEN, EDF R&D -// -// +// 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 : VVTK_SegmentationCursorDlg.h // Author : Oleg Uvarov @@ -115,9 +128,12 @@ private: protected slots: virtual void done( int ); + void onParentShow(); + void onParentHide(); void onClickApply(); void onClickClose(); + void onClickHelp(); signals: void scgClose(); diff --git a/src/VVTK/VVTK_SizeBox.cxx b/src/VVTK/VVTK_SizeBox.cxx index 654b69a7..18d1d020 100644 --- a/src/VVTK/VVTK_SizeBox.cxx +++ b/src/VVTK/VVTK_SizeBox.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -48,8 +48,6 @@ using namespace std; VVTK_SizeBox::VVTK_SizeBox( QWidget* parent ) : QVBox( parent ) { - SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); - layout()->setSpacing( 0 ); layout()->setMargin( 0 ); diff --git a/src/VVTK/VVTK_SizeBox.h b/src/VVTK/VVTK_SizeBox.h index 85eafa75..06e3971c 100644 --- a/src/VVTK/VVTK_SizeBox.h +++ b/src/VVTK/VVTK_SizeBox.h @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // diff --git a/src/VVTK/VVTK_ViewManager.cxx b/src/VVTK/VVTK_ViewManager.cxx index 8c3cb03b..a1eb30f7 100644 --- a/src/VVTK/VVTK_ViewManager.cxx +++ b/src/VVTK/VVTK_ViewManager.cxx @@ -1,3 +1,22 @@ +// Copyright (C) 2005 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 +// #include "VVTK_ViewManager.h" #include "VVTK_ViewModel.h" @@ -7,7 +26,7 @@ int VVTK_ViewManager::_VVTKViewMgr_Id = 0; VVTK_ViewManager ::VVTK_ViewManager( SUIT_Study* study, SUIT_Desktop* theDesktop ) -: SUIT_ViewManager( study, theDesktop ) +: SVTK_ViewManager( study, theDesktop ) { myId = ++_VVTKViewMgr_Id; setViewModel( new VVTK_Viewer() ); diff --git a/src/VVTK/VVTK_ViewManager.h b/src/VVTK/VVTK_ViewManager.h index 101fa583..e5d06348 100644 --- a/src/VVTK/VVTK_ViewManager.h +++ b/src/VVTK/VVTK_ViewManager.h @@ -1,13 +1,32 @@ +// Copyright (C) 2005 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 +// #ifndef VVTK_VIEWMANAGER_H #define VVTK_VIEWMANAGER_H -#include "SUIT_ViewManager.h" +#include "SVTK_ViewManager.h" #include "VVTK.h" class SUIT_Desktop; //! Extend SUIT_ViewManager to deal with VVTK_Viewer -class VVTK_EXPORT VVTK_ViewManager : public SUIT_ViewManager +class VVTK_EXPORT VVTK_ViewManager : public SVTK_ViewManager { Q_OBJECT; public: diff --git a/src/VVTK/VVTK_ViewModel.cxx b/src/VVTK/VVTK_ViewModel.cxx index e3778816..af6f65ed 100644 --- a/src/VVTK/VVTK_ViewModel.cxx +++ b/src/VVTK/VVTK_ViewModel.cxx @@ -1,208 +1,46 @@ -#include -#include - +// Copyright (C) 2005 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 +// #include "VVTK_ViewModel.h" -#include "VVTK_ViewWindow.h" - -#include "SVTK_View.h" -#include "SVTK_MainWindow.h" -#include "SVTK_RenderWindowInteractor.h" -#include "VTKViewer_ViewModel.h" +#include "VVTK_ViewWindow.h" -//========================================================== -VVTK_Viewer -::VVTK_Viewer() +VVTK_Viewer:: +VVTK_Viewer() { - myTrihedronSize = 105; } -VVTK_Viewer -::~VVTK_Viewer() -{} - - -//========================================================== -void -VVTK_Viewer -::setViewManager(SUIT_ViewManager* theViewManager) +VVTK_Viewer:: +~VVTK_Viewer() { - SUIT_ViewModel::setViewManager(theViewManager); - - if ( !theViewManager ) - return; - - connect(theViewManager, SIGNAL(mousePress(SUIT_ViewWindow*, QMouseEvent*)), - this, SLOT(onMousePress(SUIT_ViewWindow*, QMouseEvent*))); - - connect(theViewManager, SIGNAL(mouseMove(SUIT_ViewWindow*, QMouseEvent*)), - this, SLOT(onMouseMove(SUIT_ViewWindow*, QMouseEvent*))); - - connect(theViewManager, SIGNAL(mouseRelease(SUIT_ViewWindow*, QMouseEvent*)), - this, SLOT(onMouseRelease(SUIT_ViewWindow*, QMouseEvent*))); } - //========================================================== -SUIT_ViewWindow* -VVTK_Viewer -::createView( SUIT_Desktop* theDesktop ) +SUIT_ViewWindow* +VVTK_Viewer:: +createView( SUIT_Desktop* theDesktop ) { - TViewWindow* aViewWindow = new TViewWindow(theDesktop); + TViewWindow* aViewWindow = new TViewWindow (theDesktop); aViewWindow->Initialize(this); - + aViewWindow->setBackgroundColor( backgroundColor() ); aViewWindow->SetTrihedronSize( trihedronSize() ); return aViewWindow; } - - -//========================================================== -void -VVTK_Viewer -::contextMenuPopup( QPopupMenu* thePopup ) -{ - thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_DUMP_VIEW" ), this, SLOT( onDumpView() ) ); - thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_CHANGE_BACKGROUD" ), this, SLOT( onChangeBgColor() ) ); - - thePopup->insertSeparator(); - - if(TViewWindow* aView = dynamic_cast(myViewManager->getActiveView())){ - if ( !aView->getMainWindow()->getToolBar()->isVisible() ){ - thePopup->insertItem( VTKViewer_Viewer::tr( "MEN_SHOW_TOOLBAR" ), this, SLOT( onShowToolbar() ) ); - } - } -} - - -//========================================================== -void -VVTK_Viewer -::Repaint() -{ - QPtrVector aViews = myViewManager->getViews(); - for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){ - if(TViewWindow* aView = dynamic_cast(aViews.at(i))){ - aView->getMainWindow()->Repaint(); - } - } -} - - -//========================================================== -bool -VVTK_Viewer -::isVisible( const Handle(SALOME_InteractiveObject)& io ) -{ - QPtrVector aViews = myViewManager->getViews(); - for(int i = 0, iEnd = aViews.size(); i < iEnd; i++) - if(SUIT_ViewWindow* aViewWindow = aViews.at(i)) - if(TViewWindow* aView = dynamic_cast(aViewWindow)) - if(!aView->getView()->isVisible( io )) - return false; - - return true; -} - - -//========================================================== -void -VVTK_Viewer -::onMousePress(SUIT_ViewWindow* vw, QMouseEvent* event) -{} - -void -VVTK_Viewer -::onMouseMove(SUIT_ViewWindow* vw, QMouseEvent* event) -{} - -void -VVTK_Viewer -::onMouseRelease(SUIT_ViewWindow* vw, QMouseEvent* event) -{} - - -//========================================================== -QColor -VVTK_Viewer -::backgroundColor() const -{ - return myBgColor; -} - -void -VVTK_Viewer -::setBackgroundColor( const QColor& theColor ) -{ - if ( !theColor.isValid() ) - return; - - QPtrVector aViews = myViewManager->getViews(); - for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){ - if(SUIT_ViewWindow* aViewWindow = aViews.at(i)){ - if(TViewWindow* aView = dynamic_cast(aViewWindow)){ - aView->setBackgroundColor(theColor); - } - } - } - - myBgColor = theColor; -} - -//========================================================== -int -VVTK_Viewer -::trihedronSize() const -{ - return myTrihedronSize; -} - -void -VVTK_Viewer -::setTrihedronSize( const int theSize ) -{ - myTrihedronSize = theSize; - if(SUIT_ViewManager* aViewManager = getViewManager()){ - QPtrVector aViews = aViewManager->getViews(); - for ( int i = 0; i < aViews.count(); i++ ){ - if(TViewWindow* aView = dynamic_cast(aViews.at( i ))){ - aView->getMainWindow()->SetTrihedronSize( theSize ); - } - } - } -} - -//========================================================== -void -VVTK_Viewer -::onDumpView() -{ - if(SUIT_ViewWindow* aView = myViewManager->getActiveView()) - aView->onDumpView(); -} - -//========================================================== -void -VVTK_Viewer -::onChangeBgColor() -{ - if(SUIT_ViewWindow* aView = myViewManager->getActiveView()){ - QColor aColor = QColorDialog::getColor( backgroundColor(), aView); - setBackgroundColor(aColor); - } -} - -//========================================================== -void -VVTK_Viewer -::onShowToolbar() -{ - QPtrVector aViews = myViewManager->getViews(); - for(int i = 0, iEnd = aViews.size(); i < iEnd; i++){ - if(TViewWindow* aView = dynamic_cast(aViews.at(i))){ - aView->getMainWindow()->getToolBar()->show(); - } - } -} - diff --git a/src/VVTK/VVTK_ViewModel.h b/src/VVTK/VVTK_ViewModel.h index 0846edcd..fb7ca0dc 100644 --- a/src/VVTK/VVTK_ViewModel.h +++ b/src/VVTK/VVTK_ViewModel.h @@ -1,18 +1,34 @@ +// Copyright (C) 2005 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 +// #ifndef VVTK_VIEWMODEL_H #define VVTK_VIEWMODEL_H #include #include "VVTK.h" -#include "SVTK_ViewModelBase.h" - -#include "SALOME_Prs.h" -#include "SALOME_InteractiveObject.hxx" +#include "SVTK_ViewModel.h" class VVTK_ViewWindow; -//! Extends two interfaces #SVTK_ViewModelBase and #SALOME_View -class VVTK_EXPORT VVTK_Viewer : public SVTK_ViewModelBase, public SALOME_View +//! VVTK View Model +class VVTK_EXPORT VVTK_Viewer : public SVTK_Viewer { Q_OBJECT; @@ -23,48 +39,11 @@ public: VVTK_Viewer(); virtual ~VVTK_Viewer(); - //! Redefine SUIT_ViewModel::createView + //! See #SUIT_ViewModel::createView virtual SUIT_ViewWindow* createView(SUIT_Desktop*); - //! Redefine SUIT_ViewModel::setViewManager - virtual void setViewManager(SUIT_ViewManager* theViewManager); - //! Redefine SUIT_ViewModel::contextMenuPopup - virtual void contextMenuPopup( QPopupMenu* ); //! See SUIT_ViewModel::getType virtual QString getType() const { return Type(); } - - //! Redefine SALOME_View::Repaint - virtual void Repaint(); - - //! Redefine SALOME_View::isVisible - virtual bool isVisible( const Handle(SALOME_InteractiveObject)& ); - - //! Get background color of the viewer - QColor backgroundColor() const; - - //! Set background color to the viewer - void setBackgroundColor( const QColor& ); - - //! Get size of trihedron of the viewer (see SVTK_Renderer::SetTrihedronSize) - int trihedronSize() const; - - //! Set size of trihedron of the viewer (see SVTK_Renderer::SetTrihedronSize) - void setTrihedronSize( const int ); - -protected slots: - void onMousePress(SUIT_ViewWindow*, QMouseEvent*); - void onMouseMove(SUIT_ViewWindow*, QMouseEvent*); - void onMouseRelease(SUIT_ViewWindow*, QMouseEvent*); - - void onDumpView(); - void onShowToolbar(); - void onChangeBgColor(); - -private: - QColor myBgColor; - int myTrihedronSize; - bool mySelectionEnabled; - bool myMultiSelectionEnabled; }; #endif diff --git a/src/VVTK/VVTK_ViewWindow.cxx b/src/VVTK/VVTK_ViewWindow.cxx index a181ad6a..cbd0d46a 100755 --- a/src/VVTK/VVTK_ViewWindow.cxx +++ b/src/VVTK/VVTK_ViewWindow.cxx @@ -17,7 +17,7 @@ // 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.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -258,14 +258,17 @@ VVTK_ViewWindow } //---------------------------------------------------------------------------- -void +bool VVTK_ViewWindow ::action( const int accelAction ) { - if(myMainWindow1->hasFocus()) - myMainWindow1->action(accelAction); - if(myMainWindow2->hasFocus()) - myMainWindow2->action(accelAction); + if ( myMainWindow1->hasFocus() ) + myMainWindow1->action( accelAction ); + else if ( myMainWindow2->hasFocus() ) + myMainWindow2->action( accelAction ); + else + return false; + return true; } //---------------------------------------------------------------------------- @@ -287,11 +290,7 @@ void VVTK_ViewWindow ::setBackgroundColor( const QColor& theColor ) { - if( myMainWindow1->GetInteractor()->hasFocus() ) - myMainWindow1->SetBackgroundColor( theColor ); - else if( myMainWindow2->GetInteractor()->hasFocus() ) - myMainWindow2->SetBackgroundColor( theColor ); - else - myMainWindow->SetBackgroundColor( theColor ); + myMainWindow1->SetBackgroundColor( theColor ); + myMainWindow2->SetBackgroundColor( theColor ); } diff --git a/src/VVTK/VVTK_ViewWindow.h b/src/VVTK/VVTK_ViewWindow.h index 54e4745d..ca0ab04c 100755 --- a/src/VVTK/VVTK_ViewWindow.h +++ b/src/VVTK/VVTK_ViewWindow.h @@ -1,3 +1,22 @@ +// Copyright (C) 2005 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 +// #ifndef VVTK_VIEWWINDOW_H #define VVTK_VIEWWINDOW_H @@ -105,7 +124,7 @@ public slots: //---------------------------------------------------------------------------- protected: virtual - void + bool action( const int ); virtual QImage dumpView();