From: jfa Date: Mon, 19 Oct 2009 10:30:46 +0000 (+0000) Subject: Bug 0020164: EDF 954 VISU : Constant field with Gauss points. X-Git-Tag: V4_1_0_maintainance_20091109~2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=11675ceb90e6fb4744a3216d51861cccc163bb5e;p=modules%2Fvisu.git Bug 0020164: EDF 954 VISU : Constant field with Gauss points. --- diff --git a/src/OBJECT/VISU_Actor.cxx b/src/OBJECT/VISU_Actor.cxx index 47e76582..9d61171b 100644 --- a/src/OBJECT/VISU_Actor.cxx +++ b/src/OBJECT/VISU_Actor.cxx @@ -20,8 +20,8 @@ // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // VISU OBJECT : interactive object for VISU entities implementation -// File : -// Author : +// File : +// Author : // Module : VISU // $Header$ // @@ -30,7 +30,7 @@ #include "VTKViewer_ShrinkFilter.h" #include "VTKViewer_GeometryFilter.h" #include "VISU_ActorFactory.h" - + #include #include @@ -142,57 +142,57 @@ VISU_Actor } //---------------------------------------------------------------------------- -void +void VISU_Actor ::setIO(const Handle(SALOME_InteractiveObject)& theIO) { - Superclass::setIO(theIO); - myName = theIO->getName(); + Superclass::setIO(theIO); + myName = theIO->getName(); } //---------------------------------------------------------------------------- -void +void VISU_Actor ::SetPrs3d(VISU::Prs3d_i* thePrs3d) -{ +{ myPrs3d = thePrs3d; } -VISU::Prs3d_i* +VISU::Prs3d_i* VISU_Actor ::GetPrs3d() -{ +{ return myPrs3d; } //---------------------------------------------------------------------------- void VISU_Actor -::SetPipeLine(VISU_PipeLine* thePipeLine) +::SetPipeLine(VISU_PipeLine* thePipeLine) { myPipeLine = thePipeLine; if ( thePipeLine ) { if ( vtkMapper *aMapper = myPipeLine->GetMapper() ) { if ( vtkDataSet *aDataSet = aMapper->GetInput() ) { - SetShrinkable( thePipeLine->IsShrinkable() ); - SetMapperInput( aDataSet ); + SetShrinkable( thePipeLine->IsShrinkable() ); + SetMapperInput( aDataSet ); } } } this->Modified(); } -VISU_PipeLine* +VISU_PipeLine* VISU_Actor -::GetPipeLine() -{ +::GetPipeLine() +{ return myPipeLine.GetPointer(); } -VISU_PipeLine* +VISU_PipeLine* VISU_Actor -::GetCurrentPL() -{ +::GetCurrentPL() +{ return GetPipeLine(); } @@ -200,8 +200,8 @@ VISU_Actor //---------------------------------------------------------------------------- void VISU_Actor -::SetRepresentation(int theMode) -{ +::SetRepresentation(int theMode) +{ Superclass::SetRepresentation(theMode); if(myRepresentation == VTK_POINTS) UnShrink(); @@ -213,7 +213,7 @@ void VISU_Actor ::SetShrink() { - if(!myIsShrinkable) + if(!myIsShrinkable) return; if(vtkDataSet* aDataSet = myPassFilter[0]->GetOutput()){ myShrinkFilter->SetInput(aDataSet); @@ -226,7 +226,7 @@ void VISU_Actor ::UnShrink() { - if(!myIsShrunk) + if(!myIsShrunk) return; if(vtkDataSet* aDataSet = myPassFilter[0]->GetOutput()){ myPassFilter[1]->SetInput(aDataSet); @@ -252,8 +252,8 @@ VISU_Actor bool VISU_Actor -::IsShrunkable() -{ +::IsShrunkable() +{ return myIsShrinkable; } @@ -284,7 +284,7 @@ VISU_Actor vtkFloatingPointType VISU_Actor ::GetOpacity() -{ +{ return GetProperty()->GetOpacity(); } @@ -323,19 +323,19 @@ VISU_Actor ::RemoveFromRender(vtkRenderer* theRenderer) { theRenderer->RemoveActor(myAnnotationActor.GetPointer()); - Superclass::RemoveFromRender(theRenderer); + Superclass::RemoveFromRender(theRenderer); myDestroySignal(this); } //---------------------------------------------------------------------------- -void +void VISU_Actor ::SetVTKMapping(bool theIsVTKMapping) { myIsVTKMapping = theIsVTKMapping; } -bool +bool VISU_Actor ::IsVTKMapping() const { @@ -343,7 +343,7 @@ VISU_Actor } //---------------------------------------------------------------------------- -vtkDataSet* +vtkDataSet* VISU_Actor ::GetInput() { @@ -426,7 +426,7 @@ VISU_Actor return VISU::GetElemVTKID(GetMapper()->GetInput(), theID); } -vtkCell* +vtkCell* VISU_Actor ::GetElemCell(vtkIdType theObjID) { @@ -440,95 +440,95 @@ VISU_Actor //---------------------------------------------------------------------------- bool VISU_Actor -::PreHighlight(vtkInteractorStyle* theInteractorStyle, - SVTK_SelectionEvent* theSelectionEvent, - bool theIsHighlight) +::PreHighlight(vtkInteractorStyle* theInteractorStyle, + SVTK_SelectionEvent* theSelectionEvent, + bool theIsHighlight) { bool aRet = Superclass::PreHighlight(theInteractorStyle, - theSelectionEvent, - theIsHighlight); + theSelectionEvent, + theIsHighlight); #ifndef ENABLE_ANNOTATION return aRet; -#endif +#endif // myAnnotationActor->SetVisibility(0); if(theIsHighlight){ switch(mySelectionMode){ - case CellSelection:{ + case CellSelection:{ vtkRenderer* aRenderer = theInteractorStyle->GetCurrentRenderer(); - myCellPicker->Pick(theSelectionEvent->myX, - theSelectionEvent->myY, - 0.0, - aRenderer); + myCellPicker->Pick(theSelectionEvent->myX, + theSelectionEvent->myY, + 0.0, + aRenderer); if(myCellPicker->GetActor() != this) - return false; - + return false; + vtkIdType aVTKId = myCellPicker->GetCellId(); if(aVTKId >= 0 && mySelector->IsValid(this,aVTKId,true) && hasIO()){ - vtkIdType anObjId = GetElemObjId(aVTKId); - if(vtkCell* aCell = GetElemCell(anObjId)){ - vtkPoints* aPts = aCell->GetPoints(); - if(int aNbPts = aCell->GetNumberOfPoints()){ - vtkFloatingPointType aCoord[3] = {0.0, 0.0, 0.0}; - for(int i = 0; i < aNbPts; i++){ - vtkFloatingPointType *aPntCoord = aPts->GetPoint(i); - aCoord[0] += aPntCoord[0]; - aCoord[1] += aPntCoord[1]; - aCoord[2] += aPntCoord[2]; - } - // Display coordinates - vtkFloatingPointType aWorldCoord[4] = {aCoord[0]/aNbPts, aCoord[1]/aNbPts, aCoord[2]/aNbPts, 1.0}; - aRenderer->SetWorldPoint(aWorldCoord); - aRenderer->WorldToDisplay(); - vtkFloatingPointType aSelectionPoint[3]; - aRenderer->GetDisplayPoint(aSelectionPoint); - myAnnotationActor->SetPosition(aSelectionPoint); - // - // To prepare the annotation text - std::ostringstream aStr; - aStr<<"Cell ID: "<< anObjId; - std::string aString = aStr.str(); - myAnnotationMapper->SetInput(aString.c_str()); - - myAnnotationActor->SetVisibility(1); - return true; - } - } + vtkIdType anObjId = GetElemObjId(aVTKId); + if(vtkCell* aCell = GetElemCell(anObjId)){ + vtkPoints* aPts = aCell->GetPoints(); + if(int aNbPts = aCell->GetNumberOfPoints()){ + vtkFloatingPointType aCoord[3] = {0.0, 0.0, 0.0}; + for(int i = 0; i < aNbPts; i++){ + vtkFloatingPointType *aPntCoord = aPts->GetPoint(i); + aCoord[0] += aPntCoord[0]; + aCoord[1] += aPntCoord[1]; + aCoord[2] += aPntCoord[2]; + } + // Display coordinates + vtkFloatingPointType aWorldCoord[4] = {aCoord[0]/aNbPts, aCoord[1]/aNbPts, aCoord[2]/aNbPts, 1.0}; + aRenderer->SetWorldPoint(aWorldCoord); + aRenderer->WorldToDisplay(); + vtkFloatingPointType aSelectionPoint[3]; + aRenderer->GetDisplayPoint(aSelectionPoint); + myAnnotationActor->SetPosition(aSelectionPoint); + // + // To prepare the annotation text + std::ostringstream aStr; + aStr<<"Cell ID: "<< anObjId; + std::string aString = aStr.str(); + myAnnotationMapper->SetInput(aString.c_str()); + + myAnnotationActor->SetVisibility(1); + return true; + } + } } break; } - case NodeSelection:{ + case NodeSelection:{ vtkRenderer* aRenderer = theInteractorStyle->GetCurrentRenderer(); - myPointPicker->Pick(theSelectionEvent->myX, - theSelectionEvent->myY, - 0.0, - aRenderer); - + myPointPicker->Pick(theSelectionEvent->myX, + theSelectionEvent->myY, + 0.0, + aRenderer); + if(myPointPicker->GetActor() != this) - return false; + return false; vtkIdType aVtkId = myPointPicker->GetPointId(); if(aVtkId >= 0 && mySelector->IsValid(this,aVtkId,true) && hasIO()){ - vtkIdType anObjId = GetNodeObjId( aVtkId ); - if(vtkFloatingPointType* aCoord = GetNodeCoord(anObjId)){ - // Display coordinates - vtkFloatingPointType aWorldCoord[4] = {aCoord[0], aCoord[1], aCoord[2], 1.0}; - aRenderer->SetWorldPoint(aWorldCoord); - aRenderer->WorldToDisplay(); - vtkFloatingPointType aSelectionPoint[3]; - aRenderer->GetDisplayPoint(aSelectionPoint); - myAnnotationActor->SetPosition(aSelectionPoint); - // - // To prepare the annotation text - std::ostringstream aStr; - aStr<<"Node ID: "<< anObjId; - std::string aString = aStr.str(); - myAnnotationMapper->SetInput(aString.c_str()); - - myAnnotationActor->SetVisibility(1); - return true; - } + vtkIdType anObjId = GetNodeObjId( aVtkId ); + if(vtkFloatingPointType* aCoord = GetNodeCoord(anObjId)){ + // Display coordinates + vtkFloatingPointType aWorldCoord[4] = {aCoord[0], aCoord[1], aCoord[2], 1.0}; + aRenderer->SetWorldPoint(aWorldCoord); + aRenderer->WorldToDisplay(); + vtkFloatingPointType aSelectionPoint[3]; + aRenderer->GetDisplayPoint(aSelectionPoint); + myAnnotationActor->SetPosition(aSelectionPoint); + // + // To prepare the annotation text + std::ostringstream aStr; + aStr<<"Node ID: "<< anObjId; + std::string aString = aStr.str(); + myAnnotationMapper->SetInput(aString.c_str()); + + myAnnotationActor->SetVisibility(1); + return true; + } } break; } diff --git a/src/PIPELINE/VISU_Extractor.cxx b/src/PIPELINE/VISU_Extractor.cxx index 0a53d675..9048ecc6 100644 --- a/src/PIPELINE/VISU_Extractor.cxx +++ b/src/PIPELINE/VISU_Extractor.cxx @@ -22,11 +22,14 @@ // VISU OBJECT : interactive object for VISU entities implementation // File : VISU_Extractor.cxx // Module : VISU -// + #include "VISU_Extractor.hxx" #include "VISU_PipeLineUtils.hxx" #include "VISU_ConvertorUtils.hxx" +#include "SUIT_Session.h" +#include "SUIT_ResourceMgr.h" + #include #include @@ -38,7 +41,6 @@ #include - //---------------------------------------------------------------------------- vtkStandardNewMacro(VISU_Extractor); @@ -75,22 +77,38 @@ VISU_Extractor return myScalarMode; } +//---------------------------------------------------------------------------- +vtkFloatingPointType CutValue (vtkFloatingPointType theValue, int theDecimals) +{ + vtkFloatingPointType v = theValue; + vtkFloatingPointType aDegree = 0.0; + if (abs((long long)v) > 1) + aDegree = (long long)log10(abs((long long)v)) + 1; + aDegree = theDecimals - aDegree; + //printf("$$$ 1 v = %.20g , aDegree = %lld \n", v, (long long)aDegree); + + aDegree = pow(10, aDegree); + v = ((vtkFloatingPointType)((long long)(v * aDegree))) / aDegree; + //printf("$$$ 2 v = %.20g , aDegree = %lld \n", v, (long long)aDegree); + + return v; +} //---------------------------------------------------------------------------- -template +template void Module2Scalars(vtkDataArray *theInputDataArray, - TValueType* theOutputPtr, - vtkIdType theNbOfTuples) + TValueType* theOutputPtr, + vtkIdType theNbOfTuples) { vtkIdType aNbComp = theInputDataArray->GetNumberOfComponents(); std::vector anArray(aNbComp < 3? 3: aNbComp); for(vtkIdType aTupleId = 0; aTupleId < theNbOfTuples; aTupleId++){ theInputDataArray->GetTuple(aTupleId, &anArray[0]); vtkFloatingPointType aVector[3] = {anArray[0], anArray[1], anArray[2]}; - vtkFloatingPointType aScalar = sqrt(aVector[0]*aVector[0] + - aVector[1]*aVector[1] + - aVector[2]*aVector[2]); + vtkFloatingPointType aScalar = sqrt(aVector[0]*aVector[0] + + aVector[1]*aVector[1] + + aVector[2]*aVector[2]); *theOutputPtr = TValueType(aScalar); theOutputPtr++; } @@ -98,13 +116,13 @@ Module2Scalars(vtkDataArray *theInputDataArray, //---------------------------------------------------------------------------- -template +template void Component2Scalars(vtkDataArray *theInputDataArray, - TValueType* theInputPtr, - TValueType* theOutputPtr, - vtkIdType theNbOfTuples, - vtkIdType theComponentId) + TValueType* theInputPtr, + TValueType* theOutputPtr, + vtkIdType theNbOfTuples, + vtkIdType theComponentId) { vtkIdType aNbComp = theInputDataArray->GetNumberOfComponents(); for(vtkIdType aTupleId = 0; aTupleId < theNbOfTuples; aTupleId++){ @@ -114,15 +132,27 @@ Component2Scalars(vtkDataArray *theInputDataArray, } } +//---------------------------------------------------------------------------- +template +void +CutScalarsTempl(TValueType* theDataPtr, + vtkIdType theNbOfTuples, + int theDecimals) +{ + for (vtkIdType aTupleId = 0; aTupleId < theNbOfTuples; aTupleId++) { + *theDataPtr = TValueType(CutValue(*theDataPtr, theDecimals)); + theDataPtr++; + } +} //---------------------------------------------------------------------------- template void -ExecuteScalars(vtkIdType theNbOfTuples, - vtkIdType theScalarMode, - TDataSetAttributesType* theInputData, - TDataSetAttributesType* theOutputData) +ExecuteScalars(vtkIdType theNbOfTuples, + vtkIdType theScalarMode, + TDataSetAttributesType* theInputData, + TDataSetAttributesType* theOutputData) { - if(theNbOfTuples < 1) + if (theNbOfTuples < 1) return; vtkDataArray* aFieldArray = theInputData->GetArray("VISU_FIELD"); @@ -134,39 +164,66 @@ ExecuteScalars(vtkIdType theNbOfTuples, void *anInputPtr = aFieldArray->GetVoidPointer(0); void *anOutputPtr = anOutputScalars->GetVoidPointer(0); - if(theScalarMode == 0){ - switch(anInputDataType){ + if (theScalarMode == 0) { + switch (anInputDataType) { vtkTemplateMacro3(Module2Scalars, - aFieldArray, - (VTK_TT *)(anOutputPtr), - theNbOfTuples); + aFieldArray, + (VTK_TT *)(anOutputPtr), + theNbOfTuples); default: break; } - }else{ - switch(anInputDataType){ + } else { + switch (anInputDataType) { vtkTemplateMacro5(Component2Scalars, - aFieldArray, - (VTK_TT *)(anInputPtr), - (VTK_TT *)(anOutputPtr), - theNbOfTuples, - theScalarMode - 1); + aFieldArray, + (VTK_TT *)(anInputPtr), + (VTK_TT *)(anOutputPtr), + theNbOfTuples, + theScalarMode - 1); default: break; } } - + theOutputData->SetScalars(anOutputScalars); anOutputScalars->Delete(); } +//--------------------------------------------------------------- +template void +CutScalars(vtkIdType theNbOfTuples, + TDataSetAttributesType* theData) +{ + if (theNbOfTuples < 1) + return; + + vtkDataArray *aScalars = theData->GetScalars(); + if (!aScalars) + return; + + vtkIdType aDataType = aScalars->GetDataType(); + void *aPtr = aScalars->GetVoidPointer(0); + + SUIT_ResourceMgr* aResourceMgr = SUIT_Session::session()->resourceMgr(); + int aDecimals = aResourceMgr->integerValue("VISU", "floating_point_precision", 6); + + switch(aDataType) { + vtkTemplateMacro3(CutScalarsTempl, + (VTK_TT *)(aPtr), + theNbOfTuples, + aDecimals); + default: + break; + } +} //--------------------------------------------------------------- int VISU_Extractor ::RequestData(vtkInformation *theRequest, - vtkInformationVector **theInputVector, - vtkInformationVector *theOutputVector) + vtkInformationVector **theInputVector, + vtkInformationVector *theOutputVector) { vtkDataSet *anInput = VISU::GetInput( theInputVector, 0 ); vtkDataSet *anOutput = VISU::GetOutput( theOutputVector ); @@ -175,20 +232,22 @@ VISU_Extractor vtkPointData *anInputPointData = anInput->GetPointData(); vtkPointData *anOutputPointData = anOutput->GetPointData(); - anOutputPointData->PassData( anInputPointData ); + anOutputPointData->PassData( anInputPointData ); if ( VISU::IsDataOnPoints( anInput ) ) { int aNbElems = anInput->GetNumberOfPoints(); if ( anInputPointData->GetAttribute( vtkDataSetAttributes::VECTORS ) ) ExecuteScalars( aNbElems, myScalarMode, anInputPointData, anOutputPointData ); + CutScalars( aNbElems, anOutputPointData ); } - + vtkCellData *anInputCellData = anInput->GetCellData(); vtkCellData *anOutputCellData = anOutput->GetCellData(); - anOutputCellData->PassData( anInputCellData ); + anOutputCellData->PassData( anInputCellData ); if ( VISU::IsDataOnCells( anInput ) ) { int aNbElems = anInput->GetNumberOfCells(); if ( anInputCellData->GetAttribute( vtkDataSetAttributes::VECTORS ) ) ExecuteScalars( aNbElems, myScalarMode, anInputCellData, anOutputCellData ); + CutScalars( aNbElems, anOutputCellData ); } return 1; diff --git a/src/PIPELINE/VISU_LookupTable.cxx b/src/PIPELINE/VISU_LookupTable.cxx index b8dc9dc6..d1a12dbb 100644 --- a/src/PIPELINE/VISU_LookupTable.cxx +++ b/src/PIPELINE/VISU_LookupTable.cxx @@ -23,7 +23,7 @@ // File : VISU_LookupTable.cxx // Author : Vitaliy Smetannikov // Module : VISU -// + #include "VISU_LookupTable.hxx" #include @@ -36,12 +36,12 @@ vtkStandardNewMacro(VISU_LookupTable); VISU_LookupTable ::VISU_LookupTable(int sze, int ext): - vtkLookupTable(sze, ext), - myScale(1.0), - myBicolor(false) + vtkLookupTable(sze, ext), + myScale(1.0), + myBicolor(false) {} -void +void VISU_LookupTable ::SetMapScale(vtkFloatingPointType theScale) { @@ -62,10 +62,10 @@ void VISU_LookupTable::SetBicolor( bool theBicolor ) } -int +int VISU_LookupTable -::ComputeLogRange(vtkFloatingPointType inRange[2], - vtkFloatingPointType outRange[2]) +::ComputeLogRange(vtkFloatingPointType inRange[2], + vtkFloatingPointType outRange[2]) { if(inRange[0] >= inRange[1]) return -1; @@ -84,9 +84,9 @@ VISU_LookupTable return -1; } -unsigned char* +unsigned char* VISU_LookupTable -::MapValue(vtkFloatingPointType v) +::MapValue(vtkFloatingPointType v) { if(GetScale() == VTK_SCALE_LOG10) { vtkFloatingPointType aLowBound = log10(this->TableRange[0]); @@ -103,11 +103,11 @@ VISU_LookupTable } // Apply log to value, with appropriate constraints. -inline -vtkFloatingPointType -VISU_ApplyLogScale(vtkFloatingPointType v, - vtkFloatingPointType range[2], - vtkFloatingPointType logRange[2]) +inline +vtkFloatingPointType +VISU_ApplyLogScale(vtkFloatingPointType v, + vtkFloatingPointType range[2], + vtkFloatingPointType logRange[2]) { // is the range set for negative numbers? if (range[0] < 0) @@ -141,17 +141,17 @@ VISU_ApplyLogScale(vtkFloatingPointType v, } } return v; -} +} // Apply shift/scale to the scalar value v and do table lookup. -inline +inline unsigned char * -VISU_LinearLookup(vtkFloatingPointType v, - unsigned char *table, - vtkFloatingPointType maxIndex, - vtkFloatingPointType shift, - vtkFloatingPointType scale, - bool bicolor) +VISU_LinearLookup(vtkFloatingPointType v, + unsigned char *table, + vtkFloatingPointType maxIndex, + vtkFloatingPointType shift, + vtkFloatingPointType scale, + bool bicolor) { if( !bicolor ) { @@ -176,14 +176,14 @@ VISU_LinearLookup(vtkFloatingPointType v, // of 8-bit chunks template void -VISU_LookupTableMapData(vtkLookupTable *self, - T *input, - unsigned char *output, - int length, - int inIncr, - int outFormat, - vtkFloatingPointType theMapScale, - bool bicolor) +VISU_LookupTableMapData(vtkLookupTable *self, + T *input, + unsigned char *output, + int length, + int inIncr, + int outFormat, + vtkFloatingPointType theMapScale, + bool bicolor) { int i = length; vtkFloatingPointType *range = self->GetTableRange(); @@ -193,7 +193,7 @@ VISU_LookupTableMapData(vtkLookupTable *self, unsigned char *cptr; vtkFloatingPointType alpha; - if ( (alpha=self->GetAlpha()) >= 1.0 ) //no blending required + if ( (alpha=self->GetAlpha()) >= 1.0 ) //no blending required { if (self->GetScale() == VTK_SCALE_LOG10) { @@ -214,23 +214,23 @@ VISU_LookupTableMapData(vtkLookupTable *self, */ if (outFormat == VTK_RGBA) { - while (--i >= 0) + while (--i >= 0) { val = VISU_ApplyLogScale(*input, range, logRange); - cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor); + cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor); + *output++ = *cptr++; *output++ = *cptr++; *output++ = *cptr++; *output++ = *cptr++; - *output++ = *cptr++; input += inIncr; } } else if (outFormat == VTK_RGB) { - while (--i >= 0) + while (--i >= 0) { val = VISU_ApplyLogScale(*input, range, logRange); - cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor); + cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor); *output++ = *cptr++; *output++ = *cptr++; *output++ = *cptr++; @@ -239,11 +239,11 @@ VISU_LookupTableMapData(vtkLookupTable *self, } else if (outFormat == VTK_LUMINANCE_ALPHA) { - while (--i >= 0) + while (--i >= 0) { val = VISU_ApplyLogScale(*input, range, logRange); - cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor); - *output++ = static_cast(cptr[0]*0.30 + cptr[1]*0.59 + + cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor); + *output++ = static_cast(cptr[0]*0.30 + cptr[1]*0.59 + cptr[2]*0.11 + 0.5); *output++ = cptr[3]; input += inIncr; @@ -251,11 +251,11 @@ VISU_LookupTableMapData(vtkLookupTable *self, } else // outFormat == VTK_LUMINANCE { - while (--i >= 0) + while (--i >= 0) { val = VISU_ApplyLogScale(*input, range, logRange); - cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor); - *output++ = static_cast(cptr[0]*0.30 + cptr[1]*0.59 + + cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor); + *output++ = static_cast(cptr[0]*0.30 + cptr[1]*0.59 + cptr[2]*0.11 + 0.5); input += inIncr; } @@ -279,21 +279,21 @@ VISU_LookupTableMapData(vtkLookupTable *self, if (outFormat == VTK_RGBA) { - while (--i >= 0) + while (--i >= 0) { - cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor); + cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor); + *output++ = *cptr++; *output++ = *cptr++; *output++ = *cptr++; *output++ = *cptr++; - *output++ = *cptr++; input += inIncr; } } else if (outFormat == VTK_RGB) { - while (--i >= 0) + while (--i >= 0) { - cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor); + cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor); *output++ = *cptr++; *output++ = *cptr++; *output++ = *cptr++; @@ -302,10 +302,10 @@ VISU_LookupTableMapData(vtkLookupTable *self, } else if (outFormat == VTK_LUMINANCE_ALPHA) { - while (--i >= 0) + while (--i >= 0) { - cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor); - *output++ = static_cast(cptr[0]*0.30 + cptr[1]*0.59 + + cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor); + *output++ = static_cast(cptr[0]*0.30 + cptr[1]*0.59 + cptr[2]*0.11 + 0.5); *output++ = cptr[3]; input += inIncr; @@ -313,10 +313,10 @@ VISU_LookupTableMapData(vtkLookupTable *self, } else // outFormat == VTK_LUMINANCE { - while (--i >= 0) + while (--i >= 0) { - cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor); - *output++ = static_cast(cptr[0]*0.30 + cptr[1]*0.59 + + cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor); + *output++ = static_cast(cptr[0]*0.30 + cptr[1]*0.59 + cptr[2]*0.11 + 0.5); input += inIncr; } @@ -345,10 +345,10 @@ VISU_LookupTableMapData(vtkLookupTable *self, */ if (outFormat == VTK_RGBA) { - while (--i >= 0) + while (--i >= 0) { val = VISU_ApplyLogScale(*input, range, logRange); - cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor); + cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor); *output++ = *cptr++; *output++ = *cptr++; *output++ = *cptr++; @@ -358,10 +358,10 @@ VISU_LookupTableMapData(vtkLookupTable *self, } else if (outFormat == VTK_RGB) { - while (--i >= 0) + while (--i >= 0) { val = VISU_ApplyLogScale(*input, range, logRange); - cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor); + cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor); *output++ = *cptr++; *output++ = *cptr++; *output++ = *cptr++; @@ -370,11 +370,11 @@ VISU_LookupTableMapData(vtkLookupTable *self, } else if (outFormat == VTK_LUMINANCE_ALPHA) { - while (--i >= 0) + while (--i >= 0) { val = VISU_ApplyLogScale(*input, range, logRange); - cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor); - *output++ = static_cast(cptr[0]*0.30 + cptr[1]*0.59 + + cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor); + *output++ = static_cast(cptr[0]*0.30 + cptr[1]*0.59 + cptr[2]*0.11 + 0.5); *output++ = static_cast(alpha*cptr[3]); input += inIncr; @@ -382,11 +382,11 @@ VISU_LookupTableMapData(vtkLookupTable *self, } else // outFormat == VTK_LUMINANCE { - while (--i >= 0) + while (--i >= 0) { val = VISU_ApplyLogScale(*input, range, logRange); - cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor); - *output++ = static_cast(cptr[0]*0.30 + cptr[1]*0.59 + + cptr = VISU_LinearLookup(val, table, maxIndex, shift, scale*theMapScale, bicolor); + *output++ = static_cast(cptr[0]*0.30 + cptr[1]*0.59 + cptr[2]*0.11 + 0.5); input += inIncr; } @@ -410,9 +410,9 @@ VISU_LookupTableMapData(vtkLookupTable *self, if (outFormat == VTK_RGBA) { - while (--i >= 0) + while (--i >= 0) { - cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor); + cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor); *output++ = *cptr++; *output++ = *cptr++; *output++ = *cptr++; @@ -422,9 +422,9 @@ VISU_LookupTableMapData(vtkLookupTable *self, } else if (outFormat == VTK_RGB) { - while (--i >= 0) + while (--i >= 0) { - cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor); + cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor); *output++ = *cptr++; *output++ = *cptr++; *output++ = *cptr++; @@ -433,10 +433,10 @@ VISU_LookupTableMapData(vtkLookupTable *self, } else if (outFormat == VTK_LUMINANCE_ALPHA) { - while (--i >= 0) + while (--i >= 0) { - cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor); - *output++ = static_cast(cptr[0]*0.30 + cptr[1]*0.59 + + cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor); + *output++ = static_cast(cptr[0]*0.30 + cptr[1]*0.59 + cptr[2]*0.11 + 0.5); *output++ = static_cast(cptr[3]*alpha); input += inIncr; @@ -444,10 +444,10 @@ VISU_LookupTableMapData(vtkLookupTable *self, } else // outFormat == VTK_LUMINANCE { - while (--i >= 0) + while (--i >= 0) { - cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor); - *output++ = static_cast(cptr[0]*0.30 + cptr[1]*0.59 + + cptr = VISU_LinearLookup(*input, table, maxIndex, shift, scale*theMapScale, bicolor); + *output++ = static_cast(cptr[0]*0.30 + cptr[1]*0.59 + cptr[2]*0.11 + 0.5); input += inIncr; } @@ -461,14 +461,14 @@ VISU_LookupTableMapData(vtkLookupTable *self, // for subsequent renders. template void -VISU_LookupTableMapMag(vtkLookupTable *self, - T *input, - unsigned char *output, - int length, - int inIncr, - int outFormat, - vtkFloatingPointType theMapScale, - bool bicolor) +VISU_LookupTableMapMag(vtkLookupTable *self, + T *input, + unsigned char *output, + int length, + int inIncr, + int outFormat, + vtkFloatingPointType theMapScale, + bool bicolor) { double tmp, sum; double *mag; @@ -480,7 +480,7 @@ VISU_LookupTableMapMag(vtkLookupTable *self, sum = 0; for (j = 0; j < inIncr; ++j) { - tmp = (double)(*input); + tmp = (double)(*input); sum += (tmp * tmp); ++input; } @@ -493,12 +493,12 @@ VISU_LookupTableMapMag(vtkLookupTable *self, } -void VISU_LookupTable::MapScalarsThroughTable2(void *input, - unsigned char *output, - int inputDataType, - int numberOfValues, - int inputIncrement, - int outputFormat) +void VISU_LookupTable::MapScalarsThroughTable2(void *input, + unsigned char *output, + int inputDataType, + int numberOfValues, + int inputIncrement, + int outputFormat) { if (this->UseMagnitude && inputIncrement > 1) { @@ -509,8 +509,8 @@ void VISU_LookupTable::MapScalarsThroughTable2(void *input, break; case VTK_CHAR: VISU_LookupTableMapMag(this,static_cast(input),output, - numberOfValues,inputIncrement,outputFormat,myScale,myBicolor); - return; + numberOfValues,inputIncrement,outputFormat,myScale,myBicolor); + return; case VTK_UNSIGNED_CHAR: VISU_LookupTableMapMag(this,static_cast(input),output, numberOfValues,inputIncrement,outputFormat,myScale,myBicolor); @@ -567,67 +567,66 @@ void VISU_LookupTable::MapScalarsThroughTable2(void *input, newInput->SetValue(i, bitArray->GetValue(id)); } VISU_LookupTableMapData(this, - static_cast(newInput->GetPointer(0)), - output,numberOfValues, - inputIncrement,outputFormat,myScale,myBicolor); + static_cast(newInput->GetPointer(0)), + output,numberOfValues, + inputIncrement,outputFormat,myScale,myBicolor); newInput->Delete(); bitArray->Delete(); } break; - + case VTK_CHAR: VISU_LookupTableMapData(this,static_cast(input),output, - numberOfValues,inputIncrement,outputFormat,myScale,myBicolor); + numberOfValues,inputIncrement,outputFormat,myScale,myBicolor); break; - + case VTK_UNSIGNED_CHAR: VISU_LookupTableMapData(this,static_cast(input),output, - numberOfValues,inputIncrement,outputFormat,myScale,myBicolor); + numberOfValues,inputIncrement,outputFormat,myScale,myBicolor); break; - + case VTK_SHORT: VISU_LookupTableMapData(this,static_cast(input),output, - numberOfValues,inputIncrement,outputFormat,myScale,myBicolor); + numberOfValues,inputIncrement,outputFormat,myScale,myBicolor); break; - + case VTK_UNSIGNED_SHORT: VISU_LookupTableMapData(this,static_cast(input),output, - numberOfValues,inputIncrement,outputFormat,myScale,myBicolor); + numberOfValues,inputIncrement,outputFormat,myScale,myBicolor); break; - + case VTK_INT: VISU_LookupTableMapData(this,static_cast(input),output, - numberOfValues,inputIncrement,outputFormat,myScale,myBicolor); + numberOfValues,inputIncrement,outputFormat,myScale,myBicolor); break; - + case VTK_UNSIGNED_INT: VISU_LookupTableMapData(this,static_cast(input),output, - numberOfValues,inputIncrement,outputFormat,myScale,myBicolor); + numberOfValues,inputIncrement,outputFormat,myScale,myBicolor); break; - + case VTK_LONG: VISU_LookupTableMapData(this,static_cast(input),output, - numberOfValues,inputIncrement,outputFormat,myScale,myBicolor); + numberOfValues,inputIncrement,outputFormat,myScale,myBicolor); break; - + case VTK_UNSIGNED_LONG: VISU_LookupTableMapData(this,static_cast(input),output, - numberOfValues,inputIncrement,outputFormat,myScale,myBicolor); + numberOfValues,inputIncrement,outputFormat,myScale,myBicolor); break; - + case VTK_FLOAT: VISU_LookupTableMapData(this,static_cast(input),output, - numberOfValues,inputIncrement,outputFormat,myScale,myBicolor); + numberOfValues,inputIncrement,outputFormat,myScale,myBicolor); break; - + case VTK_DOUBLE: VISU_LookupTableMapData(this,static_cast(input),output, - numberOfValues,inputIncrement,outputFormat,myScale,myBicolor); + numberOfValues,inputIncrement,outputFormat,myScale,myBicolor); break; - + default: vtkErrorMacro(<< "MapImageThroughTable: Unknown input ScalarType"); return; } -} - +} diff --git a/src/VISUGUI/VisuGUI.cxx b/src/VISUGUI/VisuGUI.cxx index cd4b97da..8b284a9e 100644 --- a/src/VISUGUI/VisuGUI.cxx +++ b/src/VISUGUI/VisuGUI.cxx @@ -24,7 +24,7 @@ // Author : // Module : VISU // $Header$ -// + #include "VisuGUI.h" // STL Includes @@ -186,7 +186,7 @@ VisuGUI if(MYDEBUG) MESSAGE("VisuGUI::OnImportFromFile()"); if ( CheckLock(GetCStudy(GetAppStudy(this)),GetDesktop(this)) ) return; - + SUIT_ResourceMgr* aResourceMgr = GetResourceMgr(); // Get file name(s) @@ -194,12 +194,12 @@ VisuGUI aFilter.append( tr( "FLT_MED_FILES" ) ); aFilter.append( tr( "FLT_DISTRIBUTED_MED_FILES" ) ); aFilter.append( tr( "FLT_ALL_FILES" ) ); - + bool toUseBuildProgress = aResourceMgr->booleanValue("VISU", "use_build_progress", false); SalomeApp_CheckFileDlg fd( GetDesktop(this), true, tr("USE_BUILD_PROGRESS") ); fd.setCaption( tr( "IMPORT_FROM_FILE" ) ); - fd.setMode( SalomeApp_CheckFileDlg::ExistingFiles ); + fd.setMode( SalomeApp_CheckFileDlg::ExistingFiles ); fd.setFilters( aFilter ); fd.SetChecked( toUseBuildProgress ); if ( SalomeApp_CheckFileDlg::getLastVisitedPath().isEmpty() ) @@ -220,59 +220,59 @@ VisuGUI for ( QStringList::ConstIterator it = fileNames.begin(); it != fileNames.end(); ++it ) { QFileInfo aFileInfo( *it ); - + if ( !aFileInfo.exists() ) { // file not exist errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ). - arg( tr( "ERR_FILE_NOT_EXISTS" ) ) ); + arg( tr( "ERR_FILE_NOT_EXISTS" ) ) ); } else { try { - if ( !toUseBuildProgress ) { - // build progress is not used, use build flags from settings - 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( tr( "IMPORT_FROM_FILE" ) + " " + aFileInfo.filePath() + " ... " ); - application()->putInfo( anInfo ); - - VISU::Result_var aResult = GetVisuGen( this )->CreateResult( aFileInfo.filePath() ); - - if ( CORBA::is_nil( aResult.in() ) ) { - errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ). - arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) ); - } - else { - aResult->SetBuildFields( toBuildFields, toBuildMinMax ); - aResult->SetBuildGroups( toBuildGroups ); - aResult->Build( toBuildAll, toBuildAtOnce ); - application()->putInfo( anInfo + tr("INF_DONE") ); - } - } // if ( !toUseBuildProgress ) - else { - // use build progress - wc.suspend(); - VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) ); - aBuildProgressDlg->setFileName( aFileInfo.filePath() ); - aBuildProgressDlg->setGenerator( GetVisuGen(this) ); - aBuildProgressDlg->exec(); - wc.resume(); - } + if ( !toUseBuildProgress ) { + // build progress is not used, use build flags from settings + 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( tr( "IMPORT_FROM_FILE" ) + " " + aFileInfo.filePath() + " ... " ); + application()->putInfo( anInfo ); + + VISU::Result_var aResult = GetVisuGen( this )->CreateResult( aFileInfo.filePath() ); + + if ( CORBA::is_nil( aResult.in() ) ) { + errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ). + arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) ); + } + else { + aResult->SetBuildFields( toBuildFields, toBuildMinMax ); + aResult->SetBuildGroups( toBuildGroups ); + aResult->Build( toBuildAll, toBuildAtOnce ); + application()->putInfo( anInfo + tr("INF_DONE") ); + } + } // if ( !toUseBuildProgress ) + else { + // use build progress + wc.suspend(); + VisuGUI_BuildProgressDlg* aBuildProgressDlg = new VisuGUI_BuildProgressDlg( GetDesktop(this) ); + aBuildProgressDlg->setFileName( aFileInfo.filePath() ); + aBuildProgressDlg->setGenerator( GetVisuGen(this) ); + aBuildProgressDlg->exec(); + wc.resume(); + } } // try catch(...) { - errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) ); + errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) ); } } // else // if ( !aFileInfo.exists() ) } // for (...) if ( errors.count() > 0 ) { SUIT_MessageBox::error1( GetDesktop(this), - tr("ERR_ERROR"), - tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ), - tr("BUT_OK") ); + tr("ERR_ERROR"), + tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ), + tr("BUT_OK") ); } else { UpdateObjBrowser(this); @@ -296,9 +296,9 @@ VisuGUI anInitialPath = QDir::currentDirPath(); QStringList aFiles = SUIT_FileDlg::getOpenFileNames(GetDesktop(this), - anInitialPath, - aFilter, - tr("TLT_IMPORT_TABLE")); + anInitialPath, + aFilter, + tr("TLT_IMPORT_TABLE")); if ( aFiles.count() == 0 ) return; // nothing selected @@ -308,34 +308,34 @@ VisuGUI if ( !aFileInfo.exists() ) { errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ). - arg( tr( "ERR_FILE_NOT_EXISTS" ) ) ); + arg( tr( "ERR_FILE_NOT_EXISTS" ) ) ); } else { try { - QString anInfo( tr("TLT_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." ); - application()->putInfo( anInfo ); - - CORBA::Object_var anObject = GetVisuGen(this)->ImportTables(aFileInfo.filePath()); - - if (CORBA::is_nil(anObject.in())) { - errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ). - arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) ); - } - else { - application()->putInfo( anInfo + tr("INF_DONE") ); - } + QString anInfo( tr("TLT_IMPORT_TABLE") + " " + aFileInfo.filePath() + " ..." ); + application()->putInfo( anInfo ); + + CORBA::Object_var anObject = GetVisuGen(this)->ImportTables(aFileInfo.filePath()); + + if (CORBA::is_nil(anObject.in())) { + errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ). + arg( tr( "ERR_ERROR_IN_THE_FILE" ) ) ); + } + else { + application()->putInfo( anInfo + tr("INF_DONE") ); + } } catch(...) { - errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) ); + errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) ); } } } if ( errors.count() > 0 ) { SUIT_MessageBox::error1( GetDesktop(this), - tr("ERR_ERROR"), - tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ), - tr("BUT_OK") ); + tr("ERR_ERROR"), + tr("IMPORT_ERRORS" ) + "\n" + errors.join( "\n" ), + tr("BUT_OK") ); } else { UpdateObjBrowser(this); @@ -388,8 +388,8 @@ VisuGUI if (!aTabAttr) return; aTitle = aTabAttr->GetTitle().c_str(); } else { - _PTR(AttributeTableOfInteger) aTabAttr (anAttr); - if (!aTabAttr) return; + _PTR(AttributeTableOfInteger) aTabAttr (anAttr); + if (!aTabAttr) return; aTitle = aTabAttr->GetTitle().c_str(); } aTitle.simplifyWhiteSpace(); @@ -421,25 +421,25 @@ VisuGUI QString aFile = aFileInfo.filePath(); if (!aFile.isEmpty()) { application()->putInfo(tr("MEN_EXPORT_TABLE") + " " + aFile + " ..."); - aDir = Qtx::dir(aFile, true); + aDir = Qtx::dir(aFile, true); aResourceMgr->setValue("VISU", "OutputDir", aDir); - try { - GetVisuGen(this)->ExportTableToFile(GetSObject(aSObj), aFile.latin1()); + try { + GetVisuGen(this)->ExportTableToFile(GetSObject(aSObj), aFile.latin1()); application()->putInfo(aFile + " " + tr("INF_DONE")); - } catch(std::exception& exc) { - INFOS(exc.what()); - SUIT_MessageBox::warn1(GetDesktop(this), + } catch(std::exception& exc) { + INFOS(exc.what()); + SUIT_MessageBox::warn1(GetDesktop(this), tr("WRN_VISU"), - tr("ERR_ERROR_DURING_EXPORT") + " " + tr(exc.what()), - tr("BUT_OK")); - } catch(...) { - INFOS(tr("ERR_ERROR_DURING_EXPORT")); - SUIT_MessageBox::warn1(GetDesktop(this), + tr("ERR_ERROR_DURING_EXPORT") + " " + tr(exc.what()), + tr("BUT_OK")); + } catch(...) { + INFOS(tr("ERR_ERROR_DURING_EXPORT")); + SUIT_MessageBox::warn1(GetDesktop(this), tr("WRN_VISU"), - tr("ERR_ERROR_DURING_EXPORT"), - tr("BUT_OK") ); - } + tr("ERR_ERROR_DURING_EXPORT"), + tr("BUT_OK") ); + } } } } @@ -547,7 +547,7 @@ void VisuGUI::OnLoadComponentData() CORBA::String_var aCompDataType = aSComp->ComponentDataType(); QString anInfo ("Loading "); - anInfo = anInfo + aCompDataType.in() + " Component Data ..."; + anInfo = anInfo + aCompDataType.in() + " Component Data ..."; application()->putInfo( anInfo ); // obtain a driver by a component data type @@ -605,29 +605,28 @@ CreateCurves( SalomeApp_Module* theModule, 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){ - Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSO); - if (aRestoringMap["myComment"] == "CURVE") { - CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSO); - if(!CORBA::is_nil(aCORBAObject)){ - PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject); - if(VISU::Curve_i* aCurve = dynamic_cast(aServant.in())){ - PlotRemoveCurve(theModule, aCurve); - } - } - } - } - - } + _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){ + Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aSO); + if (aRestoringMap["myComment"] == "CURVE") { + CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSO); + if(!CORBA::is_nil(aCORBAObject)){ + PortableServer::ServantBase_var aServant = VISU::GetServant(aCORBAObject); + if(VISU::Curve_i* aCurve = dynamic_cast(aServant.in())){ + PlotRemoveCurve(theModule, aCurve); + } + } + } + } + } aBuilder->RemoveObjectWithChildren( aTblObj ); // We should have only one child - //UpdateObjBrowser(theModule,true,aTblObj); + //UpdateObjBrowser(theModule,true,aTblObj); break; } } @@ -669,7 +668,7 @@ VisuGUI VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this); if(aSelectionInfo.empty()) return; - + // Get selected SObject VISU::TSelectionItem aSelectionItem = aSelectionInfo.front(); Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO; @@ -804,35 +803,35 @@ VisuGUI Handle(SALOME_InteractiveObject) anIO = it.Value(); TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry()); VISU::Base_i* aBase = anObjectInfo.myBase; - if(!aBase) + if(!aBase) continue; - + VISU::VISUType aType = aBase->GetType(); switch (aType) { - case VISU::TCURVE: + case VISU::TCURVE: case VISU::TCONTAINER: - case VISU::TTABLE: + case VISU::TTABLE: displayer()->Display(anIO->getEntry()); break; - case VISU::TPOINTMAP3D: + case VISU::TPOINTMAP3D: if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow(this)){ - displayer()->Display(anIO->getEntry()); - aViewWindow->highlight(anIO, 1); - aViewWindow->getRenderer()->ResetCameraClippingRange(); - aViewWindow->Repaint(); + displayer()->Display(anIO->getEntry()); + aViewWindow->highlight(anIO, 1); + aViewWindow->getRenderer()->ResetCameraClippingRange(); + aViewWindow->Repaint(); } else - displayer()->Display(anIO->getEntry()); + displayer()->Display(anIO->getEntry()); break; default: { VISU::Prs3d_i* aPrs3d = VISU::GetPrs3dFromBase(aBase); if(aPrs3d){ - if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow(this)){ - displayer()->Display(anIO->getEntry()); - aViewWindow->highlight(anIO, 1); - aViewWindow->getRenderer()->ResetCameraClippingRange(); - aViewWindow->Repaint(); - } + if(SVTK_ViewWindow* aViewWindow = GetActiveViewWindow(this)){ + displayer()->Display(anIO->getEntry()); + aViewWindow->highlight(anIO, 1); + aViewWindow->getRenderer()->ResetCameraClippingRange(); + aViewWindow->Repaint(); + } } } } @@ -886,7 +885,7 @@ VisuGUI for (anActColl->InitTraversal(); (anActor = anActColl->GetNextActor()) != NULL; ) { if (anActor->GetVisibility() > 0) if (VISU_Actor* anVISUActor = VISU_Actor::SafeDownCast(anActor)) { - RemoveScalarBarPosition(this, vw, anVISUActor->GetPrs3d()); + RemoveScalarBarPosition(this, vw, anVISUActor->GetPrs3d()); anVISUActor->VisibilityOff(); } } @@ -903,7 +902,7 @@ namespace //---------------------------------------------------------------------------- VISU::Prs3d_i* GetPrsToModify(const SalomeApp_Module* theModule, - Handle(SALOME_InteractiveObject)& theIO) + Handle(SALOME_InteractiveObject)& theIO) { VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule); if(aSelectionInfo.empty()) @@ -1077,27 +1076,27 @@ namespace //---------------------------------------------------------------------------- bool GetPrs3dSelectionInfo(const SalomeApp_Module* theModule, - VISU::Prs3d_i*& thePrs3d, - SVTK_ViewWindow*& theViewWindow, - VISU_Actor*& thenActor) + VISU::Prs3d_i*& thePrs3d, + SVTK_ViewWindow*& theViewWindow, + VISU_Actor*& thenActor) { VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(theModule); if(aSelectionInfo.empty()) return false; - + VISU::TSelectionItem aSelectionItem = aSelectionInfo.front(); thePrs3d = GetPrs3dFromBase(aSelectionItem.myObjectInfo.myBase); if(!thePrs3d) return false; - + theViewWindow = GetActiveViewWindow(theModule); if(!theViewWindow) return false; - + thenActor = FindActor(theViewWindow, thePrs3d); if(!thenActor) return false; - + return true; } } @@ -1112,7 +1111,7 @@ VisuGUI SVTK_ViewWindow* aViewWindow = NULL; if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor)) return; - + VISU::Mesh_i* aMesh = dynamic_cast(aPrs3d); VISU::DeformedShape_i* aDeformedShape = dynamic_cast(aPrs3d); @@ -1177,15 +1176,15 @@ VisuGUI SVTK_ViewWindow* aViewWindow = NULL; if(!GetPrs3dSelectionInfo(this, aPrs3d, aViewWindow, anActor)) return; - + VISU::Mesh_i* aMesh = dynamic_cast(aPrs3d); if(!aMesh) return; SALOMEDS::Color anOldColor = aMesh->GetLinkColor(), aNewColor; QColor aColor (int(255*anOldColor.R), - int(255*anOldColor.G), - int(255*anOldColor.B)); + int(255*anOldColor.G), + int(255*anOldColor.B)); QColor aColorNew = QColorDialog::getColor(aColor, GetDesktop(this)); if (aColorNew.isValid()) { aNewColor.R = aColorNew.red()/255.; @@ -1232,7 +1231,7 @@ VisuGUI VisuGUI_CursorDlg* CursorDlg = new VisuGUI_CursorDlg (GetDesktop(this), tr("DLG_LINEWIDTH_TITLE"), TRUE); - + CursorDlg->helpFileName = "viewing_3d_presentations_intro_page.html#width_opacity_anchor"; CursorDlg->Comment1->setText(tr("DLG_LINEWIDTH_CMT1")); CursorDlg->Comment2->setText(tr("DLG_LINEWIDTH_CMT2")); @@ -1241,7 +1240,7 @@ VisuGUI int intlwid = int(oldlwid); CursorDlg->SpinBox1->setValue(intlwid); - + int ret = CursorDlg->exec(); if (ret == 1) { intlwid = CursorDlg->SpinBox1->value(); @@ -1262,14 +1261,14 @@ VisuGUI VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this); if(aSelectionInfo.empty()) return; - + VISU::TSelectionItem aSelectionItem = aSelectionInfo.front(); Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO; VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase; _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject; if(VISU::Table_i* aTable = dynamic_cast(aBase)) aSObject = GetCStudy( GetAppStudy( this ) )->FindObjectID( aTable->GetObjectEntry() ); - + if( !IsSObjectTable( aSObject ) ) return; @@ -1290,7 +1289,7 @@ VisuGUI VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this); if(aSelectionInfo.empty()) return; - + VISU::TSelectionItem aSelectionItem = aSelectionInfo.front(); Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO; VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase; @@ -1314,7 +1313,7 @@ VisuGUI VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this); if(aSelectionInfo.empty()) return; - + VISU::TSelectionItem aSelectionItem = aSelectionInfo.front(); _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject; VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase; @@ -1348,18 +1347,18 @@ VisuGUI anIO = it.Value(); if (anIO->hasEntry()) { if (IsRemovable(anIO->getEntry(), this)) { - aNameList.append("\n - "); - // Get Name Of the Main Object if it's a referenced object - VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anIO->getEntry()); - if(_PTR(SObject) aSObject = anObjectInfo.mySObject){ - _PTR(SObject) aRefSObject; - if (aSObject->ReferencedObject(aRefSObject)) { - QString aRefName ( aRefSObject->GetName() ); - aNameList.append( aRefName ); - } - else - aNameList.append(anIO->getName()); - } + aNameList.append("\n - "); + // Get Name Of the Main Object if it's a referenced object + VISU::TObjectInfo anObjectInfo = GetObjectByEntry(GetAppStudy(this), anIO->getEntry()); + if(_PTR(SObject) aSObject = anObjectInfo.mySObject){ + _PTR(SObject) aRefSObject; + if (aSObject->ReferencedObject(aRefSObject)) { + QString aRefName ( aRefSObject->GetName() ); + aNameList.append( aRefName ); + } + else + aNameList.append(anIO->getName()); + } anEntries[i++] = anIO->getEntry(); } } @@ -1374,10 +1373,10 @@ VisuGUI } if ( SUIT_MessageBox::warn2( GetDesktop(this), - QObject::tr( "WRN_VISU" ), - QObject::tr( "VISU_REALLY_DELETE" ).arg( nbSelected ).arg( aNameList ), - QObject::tr( "BUT_YES" ), - QObject::tr( "BUT_NO" ), 1, 0, 0 ) != 1 ) + QObject::tr( "WRN_VISU" ), + QObject::tr( "VISU_REALLY_DELETE" ).arg( nbSelected ).arg( aNameList ), + QObject::tr( "BUT_YES" ), + QObject::tr( "BUT_NO" ), 1, 0, 0 ) != 1 ) return; // There is a transaction @@ -1389,32 +1388,32 @@ VisuGUI if(_PTR(SObject) aSObject = anObjectInfo.mySObject){ _PTR(SObject) aRefSObject; if (aSObject->ReferencedObject(aRefSObject)) { - // 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. - VISU::TObjectInfo aRefObjectInfo = GetObjectByEntry(GetAppStudy(this), aRefSObject->GetID()); - VISU::Base_i* aRefBase = aRefObjectInfo.myBase; - if(aRefBase && aRefBase->GetType() == VISU::TMESH){ - DeleteSObject(this, aCStudy, aRefSObject); - UpdateObjBrowser(this, true, aRefSObject); - }else if(aRefBase && aRefBase->GetType() == VISU::TCURVE){ - CORBA::Object_var anObject = ClientSObjectToObject(aRefSObject); - VISU::Curve_var aCurve = VISU::Curve::_narrow(anObject); - _PTR(SObject) aParentSO = aSObject->GetFather(); - VISU::TObjectInfo aParentObjectInfo = GetObjectByEntry(GetAppStudy(this), aParentSO->GetID()); - if(VISU::Base_i* aParentBase = aParentObjectInfo.myBase){ - if(VISU::Container_i* aContainer = dynamic_cast(aParentBase)){ - if(aContainer->GetNbCurves() > 0){ - aContainer->RemoveCurve(aCurve); - UpdateObjBrowser(this, true, aParentSO); - } - } - } - } + // 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. + VISU::TObjectInfo aRefObjectInfo = GetObjectByEntry(GetAppStudy(this), aRefSObject->GetID()); + VISU::Base_i* aRefBase = aRefObjectInfo.myBase; + if(aRefBase && aRefBase->GetType() == VISU::TMESH){ + DeleteSObject(this, aCStudy, aRefSObject); + UpdateObjBrowser(this, true, aRefSObject); + }else if(aRefBase && aRefBase->GetType() == VISU::TCURVE){ + CORBA::Object_var anObject = ClientSObjectToObject(aRefSObject); + VISU::Curve_var aCurve = VISU::Curve::_narrow(anObject); + _PTR(SObject) aParentSO = aSObject->GetFather(); + VISU::TObjectInfo aParentObjectInfo = GetObjectByEntry(GetAppStudy(this), aParentSO->GetID()); + if(VISU::Base_i* aParentBase = aParentObjectInfo.myBase){ + if(VISU::Container_i* aContainer = dynamic_cast(aParentBase)){ + if(aContainer->GetNbCurves() > 0){ + aContainer->RemoveCurve(aCurve); + UpdateObjBrowser(this, true, aParentSO); + } + } + } + } } else{ - DeleteSObject(this, aCStudy, aSObject); - UpdateObjBrowser(this, true, aSObject); + DeleteSObject(this, aCStudy, aSObject); + UpdateObjBrowser(this, true, aSObject); } } } @@ -1432,70 +1431,70 @@ VisuGUI VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this); if(aSelectionInfo.empty()) return; - + VISU::TSelectionItem aSelectionItem = aSelectionInfo.front(); if(VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase){ if(aBase->GetType() == VISU::TTABLE || aBase->GetType() == VISU::TPOINTMAP3D) { if(VISU::Table_i* aTable = dynamic_cast(aBase)){ - _PTR(Study) aStudy = GetCStudy(GetAppStudy(this)); - _PTR(SObject) aSObject = aStudy->FindObjectID( aTable->GetObjectEntry() ); - if(IsSObjectTable(aSObject)){ - VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this)); - if(aDlg->exec() == QDialog::Accepted){ - if(!IsStudyLocked(aStudy)){ - // if study is not locked - create new container, create curves and insert them - // into container, then plot container if current viewer is of VIEW_PLOT2D type - int horIndex; - QValueList verIndices, zIndices; - aDlg->getCurvesSource( horIndex, verIndices, zIndices ); - if( horIndex >= 0 && verIndices.count() > 0 ){ - CORBA::Object_var aContainerObj = GetVisuGen(this)->CreateContainer(); - if(VISU::Container_i* aContainer = dynamic_cast(VISU::GetServant(aContainerObj).in())){ - for( int i = 0; i < verIndices.count(); i++ ){ - VISU::Curve_var aCurveObject = - GetVisuGen(this)->CreateCurveWithZ(aTable->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1 ); - if(VISU::Curve_i* aCurve = dynamic_cast(VISU::GetServant(aCurveObject).in())){ - bool isAuto; - int marker, line, lineWidth; - QColor color; - if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker, - line, lineWidth, color) && !isAuto ) - { - SALOMEDS::Color c; - c.R = color.red() /255.; - c.G = color.green()/255.; - c.B = color.blue() /255.; - aCurve->SetColor( c ); - aCurve->SetMarker( ( VISU::Curve::MarkerType )marker ); - aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth ); - } - aContainer->AddCurve(aCurveObject); - } - } - UpdateObjBrowser(this); - PlotContainer( this, aContainer, VISU::eDisplay ); - } - } - } else { - // get name of SObject - QString aSObjectName; - _PTR(GenericAttribute) anAttr; - if(aSObject->FindAttribute( anAttr, "AttributeName" )){ - _PTR(AttributeName) aName = anAttr; - aSObjectName = QString( aName->Value().c_str() ); - } - // if study is locked just get curves info and plot them - // if current viewer is of VIEW_PLOT2D type - QPtrList container; - aDlg->getCurves( container ); - if ( !container.isEmpty() ) { - GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true ); - GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName ); - } - } - } - delete aDlg; - } + _PTR(Study) aStudy = GetCStudy(GetAppStudy(this)); + _PTR(SObject) aSObject = aStudy->FindObjectID( aTable->GetObjectEntry() ); + if(IsSObjectTable(aSObject)){ + VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this)); + if(aDlg->exec() == QDialog::Accepted){ + if(!IsStudyLocked(aStudy)){ + // if study is not locked - create new container, create curves and insert them + // into container, then plot container if current viewer is of VIEW_PLOT2D type + int horIndex; + QValueList verIndices, zIndices; + aDlg->getCurvesSource( horIndex, verIndices, zIndices ); + if( horIndex >= 0 && verIndices.count() > 0 ){ + CORBA::Object_var aContainerObj = GetVisuGen(this)->CreateContainer(); + if(VISU::Container_i* aContainer = dynamic_cast(VISU::GetServant(aContainerObj).in())){ + for( int i = 0; i < verIndices.count(); i++ ){ + VISU::Curve_var aCurveObject = + GetVisuGen(this)->CreateCurveWithZ(aTable->_this(), horIndex+1, verIndices[i]+1, zIndices[i]+1 ); + if(VISU::Curve_i* aCurve = dynamic_cast(VISU::GetServant(aCurveObject).in())){ + bool isAuto; + int marker, line, lineWidth; + QColor color; + if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker, + line, lineWidth, color) && !isAuto ) + { + SALOMEDS::Color c; + c.R = color.red() /255.; + c.G = color.green()/255.; + c.B = color.blue() /255.; + aCurve->SetColor( c ); + aCurve->SetMarker( ( VISU::Curve::MarkerType )marker ); + aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth ); + } + aContainer->AddCurve(aCurveObject); + } + } + UpdateObjBrowser(this); + PlotContainer( this, aContainer, VISU::eDisplay ); + } + } + } else { + // get name of SObject + QString aSObjectName; + _PTR(GenericAttribute) anAttr; + if(aSObject->FindAttribute( anAttr, "AttributeName" )){ + _PTR(AttributeName) aName = anAttr; + aSObjectName = QString( aName->Value().c_str() ); + } + // if study is locked just get curves info and plot them + // if current viewer is of VIEW_PLOT2D type + QPtrList container; + aDlg->getCurves( container ); + if ( !container.isEmpty() ) { + GetPlot2dViewer( this )->getActiveViewFrame()->displayCurves( container, true ); + GetPlot2dViewer( this )->getActiveViewFrame()->setTitle( aSObjectName ); + } + } + } + delete aDlg; + } } } }else if(!aSelectionItem.myIO.IsNull()){ @@ -1504,7 +1503,7 @@ VisuGUI if(IsSObjectTable(aSObject)){ VisuGUI_SetupPlot2dDlg* aDlg = new VisuGUI_SetupPlot2dDlg(aSObject, GetDesktop(this)); if(aDlg->exec() == QDialog::Accepted){ - _PTR(Study) aStudy = GetCStudy(GetAppStudy(this)); + _PTR(Study) aStudy = GetCStudy(GetAppStudy(this)); if(!IsStudyLocked(aStudy)){ // if study is not locked - create new table and container objects, create curves // and insert them into container, then plot container if current viewer is of VIEW_PLOT2D type @@ -1514,41 +1513,41 @@ VisuGUI if ( horIndex >= 0 && verIndices.count() > 0 ) { VISU::Table_var aTableObject = GetVisuGen(this)->CreateTable(aSObject->GetID().c_str()); if(!CORBA::is_nil(aTableObject)){ - VISU::Container_var aContainerObject = GetVisuGen(this)->CreateContainer(); + VISU::Container_var aContainerObject = GetVisuGen(this)->CreateContainer(); VISU::Container_i* aContainer = dynamic_cast(VISU::GetServant(aContainerObject).in()); - for ( int i = 0; i < verIndices.count(); i++ ) { - VISU::Curve_var aCurveObject = GetVisuGen(this)->CreateCurveWithZ - ( aTableObject, horIndex+1, verIndices[i]+1, zIndices[i]+1 ); - if(VISU::Curve_i* aCurve = dynamic_cast(VISU::GetServant(aCurveObject).in())){ - bool isAuto; - int marker, line, lineWidth; - QColor color; - if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker, - line, lineWidth, color) && !isAuto ) - { - SALOMEDS::Color c; - c.R = color.red()/255.; - c.G = color.green()/255.; - c.B = color.blue()/255.; - aCurve->SetColor( c ); - aCurve->SetMarker( ( VISU::Curve::MarkerType )marker ); - aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth ); - } - aContainerObject->AddCurve(aCurveObject); - } - } - UpdateObjBrowser(this); - PlotContainer( this, aContainer, VISU::eDisplay ); - } - } + for ( int i = 0; i < verIndices.count(); i++ ) { + VISU::Curve_var aCurveObject = GetVisuGen(this)->CreateCurveWithZ + ( aTableObject, horIndex+1, verIndices[i]+1, zIndices[i]+1 ); + if(VISU::Curve_i* aCurve = dynamic_cast(VISU::GetServant(aCurveObject).in())){ + bool isAuto; + int marker, line, lineWidth; + QColor color; + if ( aDlg->getCurveAttributes(verIndices[i], isAuto, marker, + line, lineWidth, color) && !isAuto ) + { + SALOMEDS::Color c; + c.R = color.red()/255.; + c.G = color.green()/255.; + c.B = color.blue()/255.; + aCurve->SetColor( c ); + aCurve->SetMarker( ( VISU::Curve::MarkerType )marker ); + aCurve->SetLine( ( VISU::Curve::LineType )line, lineWidth ); + } + aContainerObject->AddCurve(aCurveObject); + } + } + UpdateObjBrowser(this); + PlotContainer( this, aContainer, VISU::eDisplay ); + } + } } else { - // get name of SObject - QString aSObjectName; - _PTR(GenericAttribute) anAttr; - if(aSObject->FindAttribute(anAttr, "AttributeName")){ - _PTR(AttributeName) aName = anAttr; - aSObjectName = QString( aName->Value().c_str() ); - } + // get name of SObject + QString aSObjectName; + _PTR(GenericAttribute) anAttr; + if(aSObject->FindAttribute(anAttr, "AttributeName")){ + _PTR(AttributeName) aName = anAttr; + aSObjectName = QString( aName->Value().c_str() ); + } // if study is locked just get curves info and plot them QPtrList container; aDlg->getCurves( container ); @@ -1575,7 +1574,7 @@ VisuGUI VISU::TSelectionItem aSelectionItem = aSelectionInfo.front(); Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO; VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase; - if(!aBase) + if(!aBase) return; if(aBase->GetType() == VISU::TCURVE) { @@ -1615,7 +1614,7 @@ VisuGUI VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this); if(aSelectionInfo.empty()) return; - + VISU::TSelectionItem aSelectionItem = aSelectionInfo.front(); VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase; if(!aBase) @@ -1640,14 +1639,14 @@ VisuGUI VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this); if(aSelectionInfo.empty()) return; - + VISU::TSelectionItem aSelectionItem = aSelectionInfo.front(); VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase; if(!aBase) return; VISU::Container_i* aContainer = dynamic_cast(aBase); - if(!aContainer) + if(!aContainer) return; VisuGUI_EditContainerDlg* aDlg = new VisuGUI_EditContainerDlg (this); @@ -1771,7 +1770,7 @@ VisuGUI case VISU::TPOINTMAP3D: { // Table object if (VISU::PointMap3d_i* aTable3d = dynamic_cast(aBase)) { aTable3d->SetTitle(Name); - aTable3d->UpdateActors(); + aTable3d->UpdateActors(); } break; } @@ -1861,16 +1860,16 @@ VisuGUI for (int i = 0; i <= aSteps; i++) { try { float aPercents; - float aT; - if( aMode >= 1 ) - aT = ( is2Pi == 1 ? -PI + 2. * PI * float(i)/aSteps : PI * float(i)/aSteps ); + float aT; + if( aMode >= 1 ) + aT = ( is2Pi == 1 ? -PI + 2. * PI * float(i)/aSteps : PI * float(i)/aSteps ); if( aMode == 1 ){ //if selected Periodic cosinusoidal mode of sweeping //This is necessary in order for animation to return to the initial picture - aPercents = (1.-cos( aT ))/2.; + aPercents = (1.-cos( aT ))/2.; } else if( aMode == 2 ){ //if selected Periodic sinusoidal mode of sweeping //This is necessary in order for animation to return to the initial picture - aPercents = sin( aT - PI/2 ); + aPercents = sin( aT - PI/2 ); } else //if selected Linear mode of sweeping aPercents = float(i)/aSteps; @@ -1910,9 +1909,9 @@ VisuGUI _PTR(SObject) aSObject = aCStudy->FindObjectID(It.Value()->getEntry()); if ( !aAnimationDlg->addField(aSObject) ) { SUIT_MessageBox::warn1(GetDesktop(this), - tr("WRN_VISU"), - tr("ERR_CANT_CREATE_ANIMATION"), - tr("BUT_OK")); + tr("WRN_VISU"), + tr("ERR_CANT_CREATE_ANIMATION"), + tr("BUT_OK")); delete aAnimationDlg; return; } @@ -1955,11 +1954,11 @@ VisuGUI _PTR(Study) aCStudy = GetCStudy(GetAppStudy(this)); _PTR(SObject) aSObj = aCStudy->FindObjectID(anIO->getEntry()); - if (!aSObj) + if (!aSObj) return; VISU::VISUType aType = VISU::Storable::SObject2Type( aSObj ); - if (aType != VISU::TANIMATION) + if (aType != VISU::TANIMATION) return; VisuGUI_TimeAnimationDlg* aAnimationDlg = @@ -1980,7 +1979,7 @@ VisuGUI VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this); if(aSelectionInfo.empty()) return; - + VISU::TSelectionItem aSelectionItem = aSelectionInfo.front(); VISU::Base_i* aBase = aSelectionItem.myObjectInfo.myBase; if(!aBase) @@ -2380,11 +2379,11 @@ VisuGUI createAction( VISU_UNSHRINK, tr("MEN_UNSHRINK"), QIconSet(), tr("MEN_UNSHRINK"), "", 0, aParent, false, this, SLOT(OnMakeShrink())); - + createAction( VISU_SHADING, tr("MEN_SHADING"), QIconSet(), tr("MEN_SHADING"), "", 0, aParent, false, this, SLOT(OnSetShadingOn())); - + createAction( VISU_NOSHADING, tr("MEN_NOSHADING"), QIconSet(), tr("MEN_NOSHADING"), "", 0, aParent, false, this, SLOT(OnSetShadingOff())); @@ -2535,7 +2534,7 @@ VisuGUI int aMenuId; aMenuId = createMenu( tr( "MEN_DESK_FILE" ), -1 ); createMenu( separator(), aMenuId, -1, 10 ); - + 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 @@ -2708,13 +2707,13 @@ VisuGUI mgr->insert( action( VISU_MULTIPR_LOW_RES ), -1, -1, -1 ); mgr->insert( action( VISU_MULTIPR_HIDE ), -1, -1, -1 ); - mgr->insert( action( VISU_FILE_INFO ), -1, -1, -1 ); + mgr->insert( action( VISU_FILE_INFO ), -1, -1, -1 ); // Rules QString aPrsAll ("'VISU::TSCALARMAP' 'VISU::TISOSURFACES' 'VISU::TDEFORMEDSHAPE' 'VISU::TCUTPLANES' " "'VISU::TCUTLINES' 'VISU::TVECTORS' 'VISU::TSTREAMLINES' 'VISU::TPLOT3D' " - "'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCOLOREDPRS3DHOLDER'"); + "'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP' 'VISU::TCOLOREDPRS3DHOLDER'"); // VISU root commands QString aRule = "client='ObjectBrowser' and selcount=1 and type='VISU::TVISUGEN'"; @@ -2843,25 +2842,25 @@ VisuGUI mgr->setRule( action( VISU_CLEAR_CONTAINER ), aRule, true ); mgr->setRule( action( VISU_EDIT_SCALARMAP ), - "selcount=1 and type='VISU::TSCALARMAP'", true ); + "selcount=1 and type='VISU::TSCALARMAP'", true ); mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPE ), - "selcount=1 and type='VISU::TDEFORMEDSHAPE'", true ); + "selcount=1 and type='VISU::TDEFORMEDSHAPE'", true ); mgr->setRule( action( VISU_EDIT_DEFORMEDSHAPEANDSCALARMAP ), - "selcount=1 and $type in {'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}", true ); + "selcount=1 and $type in {'VISU::TSCALARMAPONDEFORMEDSHAPE' 'VISU::TDEFORMEDSHAPEANDSCALARMAP'}", true ); mgr->setRule( action( VISU_EDIT_CUTPLANES ), - "selcount=1 and type='VISU::TCUTPLANES'", true ); + "selcount=1 and type='VISU::TCUTPLANES'", true ); mgr->setRule( action( VISU_EDIT_CUTLINES ), - "selcount=1 and type='VISU::TCUTLINES'", true ); + "selcount=1 and type='VISU::TCUTLINES'", true ); mgr->setRule( action( VISU_EDIT_ISOSURFACES ), - "selcount=1 and type='VISU::TISOSURFACES'", true ); + "selcount=1 and type='VISU::TISOSURFACES'", true ); mgr->setRule( action( VISU_EDIT_VECTORS ), - "selcount=1 and type='VISU::TVECTORS'", true ); + "selcount=1 and type='VISU::TVECTORS'", true ); mgr->setRule( action( VISU_EDIT_STREAMLINES ), - "selcount=1 and type='VISU::TSTREAMLINES'", true ); + "selcount=1 and type='VISU::TSTREAMLINES'", true ); mgr->setRule( action( VISU_EDIT_PLOT3D ), - "selcount=1 and type='VISU::TPLOT3D'", true ); + "selcount=1 and type='VISU::TPLOT3D'", true ); mgr->setRule( action( VISU_EDIT_POINTMAP3D ), - "selcount=1 and type='VISU::TPOINTMAP3D'", true ); + "selcount=1 and type='VISU::TPOINTMAP3D'", true ); aRule = "selcount=1 and type='VISU::TCUTLINES' and nbNamedChildren=0"; mgr->setRule( action( VISU_CREATE_TABLE ), aRule, true ); @@ -2889,11 +2888,11 @@ VisuGUI mgr->setRule( action( VISU_CREATE_PRS ), aRule + " and selcount=1", true ); mgr->setRule( action( VISU_CREATE_MANY_PRS ), aRule + " and selcount>1", true ); mgr->setRule( action( VISU_EDIT_PLOT3D ), - "selcount=1 and type='VISU::TPLOT3D'", true ); + "selcount=1 and type='VISU::TPLOT3D'", true ); //aRule = "client='ObjectBrowser' and type='MEDFIELD'"; //mgr->setRule( action( VISU_IMPORT_MED ), aRule, true ); - + aRule = "client='ObjectBrowser' and selcount>=1 and $type in {'VISU::TPART'} and "; { QString aCustomRule = aRule + "fullResolution=1 and resolutionState!='F'"; @@ -2922,7 +2921,7 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q OB_Browser* ob = getApp()->objectBrowser(); bool isOBClient = (ob && theClient == ob->popupClientType()); - + LightApp_SelectionMgr* aSelectionMgr = GetSelectionMgr(this); SALOME_ListIO aListIO; aSelectionMgr->selectedObjects(aListIO); @@ -2936,33 +2935,33 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q SALOME_ListIteratorOfListIO It (aListIO); for (; It.More(); It.Next()) { Handle(SALOME_InteractiveObject)& anIO = It.Value(); - + if (!anIO.IsNull() && anIO->hasEntry()) { _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry()); if ( !aSObject ) - continue; + continue; if ( !isOBClient ) { - QString aName = QString( aSObject->GetName().c_str() ); - while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of popup - aName.remove( (aName.length() - 1), 1 ); - theTitle = aName; + QString aName = QString( aSObject->GetName().c_str() ); + while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of popup + aName.remove( (aName.length() - 1), 1 ); + theTitle = aName; } CORBA::Object_var aCORBAObject = VISU::ClientSObjectToObject(aSObject); if (CORBA::is_nil(aCORBAObject)) { - VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject ); - if (aType == VISU::TTIMESTAMP) { - _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject); - _PTR(SObject) aPrs; - for (; anIter->More(); anIter->Next()) { - aPrs = anIter->Value(); - if (!aPrs) - continue; - std::vector aSubList = GetPrs3dList(this, aPrs); - nbPrs += aSubList.size(); - } - } + VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject ); + if (aType == VISU::TTIMESTAMP) { + _PTR(ChildIterator) anIter = aCStudy->NewChildIterator(aSObject); + _PTR(SObject) aPrs; + for (; anIter->More(); anIter->Next()) { + aPrs = anIter->Value(); + if (!aPrs) + continue; + std::vector aSubList = GetPrs3dList(this, aPrs); + nbPrs += aSubList.size(); + } + } } } } @@ -2981,18 +2980,18 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q if (!anIO.IsNull() && anIO->hasEntry()) { _PTR(SObject) aSObject = aCStudy->FindObjectID(anIO->getEntry()); if ( !aSObject ) - continue; + continue; VISU::VISUType aType = VISU::Storable::SObject2Type( aSObject ); if (aType == VISU::TCURVE) { - isCurves = true; + isCurves = true; } else { - VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry()); - if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){ - if (aPrsObject->GetType() == VISU::TCUTPLANES) { - if (VISU::CutPlanes_i* aCutPrs = dynamic_cast(aPrsObject)) - isOneCutPlane = aCutPrs->GetNbPlanes() == 1; - } - } + VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry()); + if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){ + if (aPrsObject->GetType() == VISU::TCUTPLANES) { + if (VISU::CutPlanes_i* aCutPrs = dynamic_cast(aPrsObject)) + isOneCutPlane = aCutPrs->GetNbPlanes() == 1; + } + } } } } @@ -3003,7 +3002,7 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this); if(aSelectionInfo.empty()) return; - + VISU::TSelectionItem aSelectionItem = aSelectionInfo.front(); Handle(SALOME_InteractiveObject) anIO = aSelectionItem.myIO; _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject; @@ -3029,7 +3028,7 @@ void VisuGUI::contextMenuPopup( const QString& theClient, QPopupMenu* theMenu, Q } // Check single selection - if (aListIO.Extent() != 1) + if (aListIO.Extent() != 1) return; // Check if the object's data is loaded @@ -3172,7 +3171,7 @@ void VisuGUI::createPreferences() { // TAB: "MED import" int importTab = addPreference( tr( "MED import" ) ); - + // group: "MED files import" int importGr = addPreference( tr( "MED files import" ), importTab ); setPreferenceProperty( importGr, "columns", 1 ); @@ -3258,7 +3257,7 @@ void VisuGUI::createPreferences() setPreferenceProperty( numcol, "max", 256 ); addPreference( tr( "VISU_IS_UNITS" ), colorsLabelsGr, - LightApp_Preferences::Bool, "VISU", "scalar_bar_display_units" ); + LightApp_Preferences::Bool, "VISU", "scalar_bar_display_units" ); int numlab = addPreference( tr( "VISU_NB_LABELS" ), colorsLabelsGr, LightApp_Preferences::IntSpin, "VISU", "scalar_bar_num_labels" ); @@ -3266,7 +3265,7 @@ void VisuGUI::createPreferences() setPreferenceProperty( numlab, "max", 65 ); addPreference( tr( "VISU_LABELS_FORMAT" ), colorsLabelsGr, - LightApp_Preferences::String, "VISU", "scalar_bar_label_format" ); + LightApp_Preferences::String, "VISU", "scalar_bar_label_format" ); // group: "Orientation" int orientGr = addPreference( tr( "VISU_ORIENTATION" ), sbarTab ); @@ -3409,11 +3408,11 @@ void VisuGUI::createPreferences() // TAB: "Sweep, Animation" int srangeTab = addPreference( tr( "Sweep, Animation" ) ); - + // group: "Sweeping preferences" int sweepGr = addPreference( tr( "VISU_SWEEPING_PREF" ), srangeTab ); setPreferenceProperty( sweepGr, "columns", 1 ); - + int modeSw = addPreference( tr( "VISU_SWEEPING_MODES" ), sweepGr, LightApp_Preferences::Selector, "VISU", "sweeping_modes" ); QStringList sweep_modes; sweep_modes.append( tr( "VISU_LINEAR_SWEEP" ) ); @@ -3446,7 +3445,7 @@ void VisuGUI::createPreferences() setPreferenceProperty( timestep, "step", 0.1 ); setPreferenceProperty( timestep, "max", 1000 ); setPreferenceProperty( nbcycles, "max", 100 ); - setPreferenceProperty( nbsteps, "max", 200 ); + setPreferenceProperty( nbsteps, "max", 200 ); // group: "Animation preferences" int animationGr = addPreference( tr( "Animation preferences" ), srangeTab ); @@ -3456,15 +3455,15 @@ void VisuGUI::createPreferences() addPreference( tr( "Cycled animation" ), animationGr, LightApp_Preferences::Bool, "VISU", "cycled_animation" ); addPreference( tr( "Use proportional timing" ), animationGr, LightApp_Preferences::Bool, "VISU", "use_proportional_timing" ); addPreference( tr( "Clean memory at each frame" ), animationGr, LightApp_Preferences::Bool, "VISU", "clean_memory_at_each_frame" ); - + setPreferenceProperty( speed, "min", 1 ); setPreferenceProperty( speed, "max", 99 ); // 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" ); @@ -3477,12 +3476,12 @@ void VisuGUI::createPreferences() mesh_indices.append( 3 ); mesh_indices.append( 4 ); mesh_indices.append( 2 ); - + QStringList modes1 = mesh_modes; modes1.remove( "Insideframe" ); QValueList indices1 = mesh_indices; indices1.remove( 3 ); - + QStringList modes2 = modes1; modes2.remove( "Surfaceframe" ); QValueList indices2 = indices1; @@ -3492,8 +3491,8 @@ void VisuGUI::createPreferences() 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 ); @@ -3545,12 +3544,12 @@ void VisuGUI::createPreferences() addPreference( tr( "VISU_SHRINK" ), representGr, LightApp_Preferences::Bool, "VISU", "scalar_def_shrink" ); int point_precision = addPreference( tr( "VISU_FLOATING_POINT_PRECISION" ), representGr, - LightApp_Preferences::IntSpin, "VISU", "floating_point_precision" ); + LightApp_Preferences::IntSpin, "VISU", "floating_point_precision" ); setPreferenceProperty( point_precision, "min", 1 ); setPreferenceProperty( point_precision, "max", 16 ); setPreferenceProperty( point_precision, "step", 1 ); addPreference( "", representGr, LightApp_Preferences::Space ); - + addPreference( tr( "VISU_USE_SHADING" ), representGr, LightApp_Preferences::Bool, "VISU", "represent_shading" ); addPreference( "", representGr, LightApp_Preferences::Space ); @@ -3564,12 +3563,12 @@ void VisuGUI::createPreferences() // TAB: 3D Cache ; group: "Cache properties" int cacheTab = addPreference( tr( "3D Cache" ) ); - + int cacheGr = addPreference( tr( "VISU_3DCACHE_PROPS" ), cacheTab ); setPreferenceProperty( cacheGr, "columns", 1 ); int memory_mode = addPreference( tr( "VISU_MEMORY_MODE" ), cacheGr, - LightApp_Preferences::Selector, "VISU", "cache_memory_mode" ); + LightApp_Preferences::Selector, "VISU", "cache_memory_mode" ); modes.clear(); modes.append( tr( "VISU_MINIMAL" ) ); @@ -3578,11 +3577,11 @@ void VisuGUI::createPreferences() indices.clear(); indices.append( 0 ); - indices.append( 1 ); + indices.append( 1 ); setPreferenceProperty( memory_mode, "indexes", indices ); int memory_limit = addPreference( tr( "VISU_MEMORY_LIMIT" ), cacheGr, - LightApp_Preferences::IntSpin, "VISU", "cache_memory_limit" ); + LightApp_Preferences::IntSpin, "VISU", "cache_memory_limit" ); setPreferenceProperty( memory_limit, "min", 1 ); setPreferenceProperty( memory_limit, "max", 5000 ); setPreferenceProperty( memory_limit, "step", 10 ); @@ -3653,16 +3652,16 @@ void VisuGUI::preferencesChanged( const QString& a, const QString& b) if (aWarning.size() != 0){ aWarning += "The default values are applied instead."; SUIT_MessageBox::warn1(GetDesktop(this), - tr("ERR_SCALARBAR_PARAMS"), - tr(aWarning.c_str()), - tr("BUT_OK") ); + tr("ERR_SCALARBAR_PARAMS"), + tr(aWarning.c_str()), + tr("BUT_OK") ); } } SUIT_ViewManager* VisuGUI ::getViewManager(const QString& theType, - const bool theIsCreate) + const bool theIsCreate) { return getApp()->getViewManager(theType,theIsCreate); } @@ -3678,7 +3677,7 @@ LightApp_Displayer* VisuGUI::displayer() { if( !myDisplayer ) myDisplayer = new VisuGUI_Displayer( getApp() ); - + return myDisplayer; } @@ -3706,13 +3705,13 @@ void VisuGUI::OnPlot3dFromCutPlane() if (!anIO.IsNull() && anIO->hasEntry()) { aSObject = aCStudy->FindObjectID(anIO->getEntry()); if ( !aSObject ) - continue; + continue; VISU::TObjectInfo anObjectInfo = VISU::GetObjectByEntry(GetAppStudy(this), anIO->getEntry()); if(VISU::Prs3d_i* aPrsObject = VISU::GetPrs3dFromBase(anObjectInfo.myBase)){ if (aPrsObject->GetType() == VISU::TCUTPLANES) { - aCutPrs = dynamic_cast(aPrsObject); - if (aCutPrs) - break; + aCutPrs = dynamic_cast(aPrsObject); + if (aCutPrs) + break; } } } @@ -3727,8 +3726,8 @@ void VisuGUI::OnPlot3dFromCutPlane() Storable::TRestoringMap aRestoringMap = Storable::GetStorableMap(aTimeStampSObj); VISU::VISUType aType = VISU::Storable::RestoringMap2Type( aRestoringMap ); if (aType != TTIMESTAMP ) - return; - + return; + QString aMeshName = aRestoringMap["myMeshName"]; QString anEntity = aRestoringMap["myEntityId"]; QString aFieldName = aRestoringMap["myFieldName"]; @@ -3737,49 +3736,49 @@ void VisuGUI::OnPlot3dFromCutPlane() int aPos; SUIT_ViewWindow* aViewWindow = 0; if (anIsVVTK) { - aViewWindow = GetViewWindow(this); - aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast(aViewWindow)); + aViewWindow = GetViewWindow(this); + aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast(aViewWindow)); } else { - aViewWindow = GetViewWindow(this); - aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast(GetViewWindow(this))); + aViewWindow = GetViewWindow(this); + aPos = GetFreePositionOfDefaultScalarBar(this, dynamic_cast(GetViewWindow(this))); } GetResourceMgr()->setValue("VISU", "scalar_bar_position_num", aPos); - - VISU::Plot3D_i* aPrs3d = - CreatePrs3dFromFactory(this, - aTimeStampSObj, - aMeshName.latin1(), - (Entity)anEntity.toInt(), - aFieldName.latin1(), - aTimeStampId.toInt(), - ColoredPrs3d_i::EPublishUnderTimeStamp); + + VISU::Plot3D_i* aPrs3d = + CreatePrs3dFromFactory(this, + aTimeStampSObj, + aMeshName.latin1(), + (Entity)anEntity.toInt(), + aFieldName.latin1(), + aTimeStampId.toInt(), + ColoredPrs3d_i::EPublishUnderTimeStamp); 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, true); - 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); - 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); - } + SUIT_ResourceMgr* aResourceMgr = GetResourceMgr(); + int aValue = aResourceMgr->integerValue("VISU","BuildDefaultPrs3d",0); + if (!aValue) { + VisuGUI_Plot3DDlg* aDlg = new VisuGUI_Plot3DDlg(this); + aDlg->initFromPrsObject(aPrs3d, true); + 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); + 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")); @@ -3791,7 +3790,7 @@ void VisuGUI::OnCacheProperties() VISU::TSelectionInfo aSelectionInfo = VISU::GetSelectedObjects(this); if(aSelectionInfo.empty()) return; - + VISU::TSelectionItem aSelectionItem = aSelectionInfo.front(); _PTR(SObject) aSObject = aSelectionItem.myObjectInfo.mySObject; @@ -3863,7 +3862,7 @@ void VisuGUI::OnMultiprChangeRes(VISU::Result::Resolution theResolution) VISU::Result_var aResult = FindResult( VISU::GetSObject( aSObject ).in() ); if(CORBA::is_nil(aResult.in())) continue; - + VISU::Result_i* aCResult = dynamic_cast(VISU::GetServant(aResult).in()); if(!aCResult) continue; @@ -3873,7 +3872,7 @@ void VisuGUI::OnMultiprChangeRes(VISU::Result::Resolution theResolution) QString aMeshName = Storable::FindValue(aRestoringMap, "myMeshName", &anIsFound); if(!anIsFound) continue; - + std::string aPartName = aSObject->GetName(); aCResult->SetResolution(aMeshName.latin1(), aPartName.c_str(), theResolution); diff --git a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx index 89bec1de..a84de316 100644 --- a/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx +++ b/src/VISUGUI/VisuGUI_GaussPointsDlg.cxx @@ -23,7 +23,7 @@ // File : VisuGUI_GaussPointsDlg.cxx // Author : Oleg UVAROV // Module : VISU -// + #include "VisuGUI_GaussPointsDlg.h" #include "VISUConfig.hh" @@ -131,10 +131,16 @@ VisuGUI_GaussScalarBarPane::VisuGUI_GaussScalarBarPane (QWidget * parent): RBImposedRange = new QRadioButton (tr("IMPOSED_RANGE_BTN"), RangeGroup, "RBImposedRange"); RBFieldRange->setChecked( true ); + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + int aPrecision = aResourceMgr->integerValue( "VISU", "floating_point_precision", 0 ); + + QDoubleValidator* dv = new QDoubleValidator(this); + dv->setDecimals(aPrecision); + MinEdit = new QLineEdit( RangeGroup, "MinEdit" ); MinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); MinEdit->setMinimumWidth( 70 ); - MinEdit->setValidator( new QDoubleValidator(this) ); + MinEdit->setValidator( dv ); MinEdit->setText( "0.0" ); QLabel* MinLabel = new QLabel (tr("LBL_MIN"), RangeGroup, "MinLabel"); MinLabel->setBuddy(MinEdit); @@ -142,7 +148,7 @@ VisuGUI_GaussScalarBarPane::VisuGUI_GaussScalarBarPane (QWidget * parent): MaxEdit = new QLineEdit( RangeGroup, "MaxEdit" ); MaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); MaxEdit->setMinimumWidth( 70 ); - MaxEdit->setValidator( new QDoubleValidator(this) ); + MaxEdit->setValidator( dv ); MaxEdit->setText( "0.0" ); QLabel* MaxLabel = new QLabel (tr("LBL_MAX"), RangeGroup, "MaxLabel"); MaxLabel->setBuddy(MaxEdit); @@ -330,8 +336,11 @@ void VisuGUI_GaussScalarBarPane::onGlobalScalarBar() MinEdit->setEnabled( false ); MaxEdit->setEnabled( false ); - MinEdit->setText( QString::number( myPrsCopy->GetMin() ) ); - MaxEdit->setText( QString::number( myPrsCopy->GetMax() ) ); + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + int aPrecision = aResourceMgr->integerValue("VISU", "floating_point_precision", 0); + + MinEdit->setText( QString::number( myPrsCopy->GetMin(), 'g', aPrecision ) ); + MaxEdit->setText( QString::number( myPrsCopy->GetMax(), 'g', aPrecision ) ); } @@ -351,8 +360,11 @@ void VisuGUI_GaussScalarBarPane::onLocalScalarBar() MinEdit->setEnabled( RBImposedRange->isChecked() ); MaxEdit->setEnabled( RBImposedRange->isChecked() ); - MinEdit->setText( QString::number( myPrsCopy->GetMin() ) ); - MaxEdit->setText( QString::number( myPrsCopy->GetMax() ) ); + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + int aPrecision = aResourceMgr->integerValue("VISU", "floating_point_precision", 0); + + MinEdit->setText( QString::number( myPrsCopy->GetMin(), 'g', aPrecision ) ); + MaxEdit->setText( QString::number( myPrsCopy->GetMax(), 'g', aPrecision ) ); } @@ -369,8 +381,11 @@ void VisuGUI_GaussScalarBarPane::fieldRangeClicked() MinEdit->setEnabled( false ); MaxEdit->setEnabled( false ); - MinEdit->setText( QString::number( myPrsCopy->GetMin() ) ); - MaxEdit->setText( QString::number( myPrsCopy->GetMax() ) ); + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + int aPrecision = aResourceMgr->integerValue("VISU", "floating_point_precision", 0); + + MinEdit->setText( QString::number( myPrsCopy->GetMin(), 'g', aPrecision ) ); + MaxEdit->setText( QString::number( myPrsCopy->GetMax(), 'g', aPrecision ) ); } @@ -396,8 +411,11 @@ void VisuGUI_GaussScalarBarPane::changeScalarMode( int theMode ) { myPrsCopy->SetScalarMode( theMode ); if ( UseFieldRange() ) { - MinEdit->setText( QString::number( myPrsCopy->GetSourceMin() ) ); - MaxEdit->setText( QString::number( myPrsCopy->GetSourceMax() ) ); + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + int aPrecision = aResourceMgr->integerValue("VISU", "floating_point_precision", 0); + + MinEdit->setText( QString::number( myPrsCopy->GetSourceMin(), 'g', aPrecision ) ); + MaxEdit->setText( QString::number( myPrsCopy->GetSourceMax(), 'g', aPrecision ) ); } } @@ -405,7 +423,7 @@ void VisuGUI_GaussScalarBarPane::changeScalarMode( int theMode ) * Initialise dialog box from presentation object */ void VisuGUI_GaussScalarBarPane::initFromPrsObject(VISU::GaussPoints_i* thePrs, - bool theInit ) + bool theInit ) { myPrsCopy = thePrs; @@ -424,14 +442,17 @@ void VisuGUI_GaussScalarBarPane::initFromPrsObject(VISU::GaussPoints_i* thePrs, MaxEdit->setEnabled( false ); } - MinEdit->setText( QString::number( thePrs->GetMin() ) ); - MaxEdit->setText( QString::number( thePrs->GetMax() ) ); + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + int aPrecision = aResourceMgr->integerValue("VISU", "floating_point_precision", 0); + + MinEdit->setText( QString::number( thePrs->GetMin(), 'g', aPrecision ) ); + MaxEdit->setText( QString::number( thePrs->GetMax(), 'g', aPrecision ) ); setPosAndSize( thePrs->GetPosX(), - thePrs->GetPosY(), - thePrs->GetWidth(), - thePrs->GetHeight(), - thePrs->GetBarOrientation()); + thePrs->GetPosY(), + thePrs->GetWidth(), + thePrs->GetHeight(), + thePrs->GetBarOrientation()); if(RBvert->isChecked()) { myVerTW = thePrs->GetTitleWidth(); @@ -492,7 +513,7 @@ void VisuGUI_GaussScalarBarPane::initFromPrsObject(VISU::GaussPoints_i* thePrs, QString anUnit = QString(aUnitNames[i].c_str()).simplifyWhiteSpace(); if(anUnit.isNull() || anUnit == "") anUnit = "-"; - + aComponent = aComponent + ", " + anUnit; myModeCombo->insertItem(aComponent); @@ -581,8 +602,8 @@ int VisuGUI_GaussScalarBarPane::storeToPrsObject(VISU::GaussPoints_i* thePrs) { thePrs->SetShadowTitle(isTitleShadow); thePrs->SetTitFontType(aTitleFontFamily); thePrs->SetTitleColor(aTitColor.red()/255., - aTitColor.green()/255., - aTitColor.blue()/255.); + aTitColor.green()/255., + aTitColor.blue()/255.); // "Label" QColor aLblColor (255, 255, 255); @@ -599,8 +620,8 @@ int VisuGUI_GaussScalarBarPane::storeToPrsObject(VISU::GaussPoints_i* thePrs) { thePrs->SetShadowLabel(isLabelShadow); thePrs->SetLblFontType(aLabelFontFamily); thePrs->SetLabelColor(aLblColor.red()/255., - aLblColor.green()/255., - aLblColor.blue()/255.); + aLblColor.green()/255., + aLblColor.blue()/255.); } return 1; @@ -842,7 +863,7 @@ VisuGUI_GaussPointsDlg::~VisuGUI_GaussPointsDlg() {} void VisuGUI_GaussPointsDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs, - bool theInit ) + bool theInit ) { if( theInit ) myPrsCopy = VISU::TSameAsFactory().Create(thePrs, VISU::ColoredPrs3d_i::EDoNotPublish); @@ -910,7 +931,7 @@ int VisuGUI_GaussPointsDlg::storeToPrsObject( VISU::ColoredPrs3d_i* thePrs ) aMainTexture = aMainTexture.isNull() ? myPrsCopy->GetQMainTexture() : aMainTexture; anAlphaTexture = anAlphaTexture.isNull() ? myPrsCopy->GetQAlphaTexture() : anAlphaTexture; - + myPrsCopy->SetTextures( aMainTexture, anAlphaTexture ); myPrsCopy->SetAlphaThreshold( myPrimitiveBox->getAlphaThreshold() ); @@ -935,8 +956,8 @@ int VisuGUI_GaussPointsDlg::storeToPrsObject( VISU::ColoredPrs3d_i* thePrs ) myPrsCopy->SetMagnification( mySizeBox->getMagnification() ); myPrsCopy->SetMagnificationIncrement( mySizeBox->getIncrement() ); - VISU::TSameAsFactory().Copy(myPrsCopy, thePrs); - + VISU::TSameAsFactory().Copy(myPrsCopy, thePrs); + //Set created Gauss points presentation selected, //Issue 0019874(EDF 746 VISU: Picking alphanumeric Gauss) if(thePrs){ @@ -978,7 +999,7 @@ void VisuGUI_GaussPointsDlg::accept() aWarning.append( "presentation might be too important to ensure an acceptable frame rate.\n\n" ); aWarning.append( "Can you please confirm that you want to continue anyway?" ); if( SUIT_MessageBox::warn2( this, tr( "Warning" ), aWarning, tr( "&OK" ), tr( "&Cancel" ), 0, 1, 1 ) == 1 ) - return; + return; } /* diff --git a/src/VISUGUI/VisuGUI_Prs3dDlg.cxx b/src/VISUGUI/VisuGUI_Prs3dDlg.cxx index 2a02f785..1b96f425 100644 --- a/src/VISUGUI/VisuGUI_Prs3dDlg.cxx +++ b/src/VISUGUI/VisuGUI_Prs3dDlg.cxx @@ -23,7 +23,7 @@ // File : VisuGUI_Prs3dDlg.cxx // Author : Laurent CORNABE & Hubert ROLLAND // Module : VISU -// + #include "VisuGUI_Prs3dDlg.h" #include "VisuGUI.h" @@ -178,9 +178,9 @@ void VisuGUI_TextPrefDlg::onHelp() } 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")); + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + QObject::tr("BUT_OK")); } } @@ -261,7 +261,7 @@ VisuGUI_BarPrefDlg::VisuGUI_BarPrefDlg (QWidget* parent) QVBoxLayout* TopLayout = new QVBoxLayout(this); TopLayout->setSpacing(6); TopLayout->setMargin(11); - + QGroupBox* WidthHeightGroup = new QGroupBox (tr(""), this, "WidthHeightGroup"); WidthHeightGroup->setColumnLayout(0, Qt::Vertical ); WidthHeightGroup->layout()->setSpacing( 0 ); @@ -382,8 +382,8 @@ VisuGUI_BarPrefDlg::VisuGUI_BarPrefDlg (QWidget* parent) //---------------------------------------------------------------------------- void VisuGUI_BarPrefDlg::setRatios(int titleRatioWidth, int titleRatioHeight, - int labelRatioWidth, int labelRatioHeight, - int barRatioWidth, int barRatioHeight) + int labelRatioWidth, int labelRatioHeight, + int barRatioWidth, int barRatioHeight) { TitleWidthSpin->setValue( myTitleWidth=titleRatioWidth ); TitleHeightSpin->setValue( myTitleHeight=titleRatioHeight ); @@ -396,8 +396,8 @@ void VisuGUI_BarPrefDlg::setRatios(int titleRatioWidth, int titleRatioHeight, //---------------------------------------------------------------------------- void VisuGUI_BarPrefDlg::getRatios(int& titleRatioWidth, int& titleRatioHeight, - int& labelRatioWidth, int& labelRatioHeight, - int& barRatioWidth, int& barRatioHeight) + int& labelRatioWidth, int& labelRatioHeight, + int& barRatioWidth, int& barRatioHeight) { titleRatioWidth=TitleWidthSpin->value(); titleRatioHeight=TitleHeightSpin->value(); @@ -433,9 +433,9 @@ void VisuGUI_BarPrefDlg::onHelp() } 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")); + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + QObject::tr("BUT_OK")); } } @@ -482,26 +482,26 @@ void VisuGUI_BarPrefDlg::accept() dVal.sprintf(UnitsEdit->text(),1.1); if(dVal.toDouble() == 0.) { SUIT_MessageBox::warn1( this,tr("WRN_VISU"), - tr("MSG_LABEL_FORMAT"), - tr("BUT_OK")); + tr("MSG_LABEL_FORMAT"), + tr("BUT_OK")); } else { if( ( - TitleWidthSpin->value()+ - LabelWidthSpin->value()+ - BarWidthSpin->value() - > 100 - ) || + TitleWidthSpin->value()+ + LabelWidthSpin->value()+ + BarWidthSpin->value() + > 100 + ) || ( - TitleHeightSpin->value()+ - LabelHeightSpin->value()+ - BarHeightSpin->value() - > 100 + TitleHeightSpin->value()+ + LabelHeightSpin->value()+ + BarHeightSpin->value() + > 100 ) ) { SUIT_MessageBox::warn1( this,tr("WRN_VISU"), - tr("MSG_BIG_SCALE"), - tr("BUT_OK")); + tr("MSG_BIG_SCALE"), + tr("BUT_OK")); } else { myTitleWidth = TitleWidthSpin->value(); myTitleHeight = TitleHeightSpin->value(); @@ -596,10 +596,14 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane (QWidget * parent, bool thePreview) RBIrange = new QRadioButton (tr("IMPOSED_RANGE_BTN"), RangeGroup, "RBIrange"); RBFrange->setChecked( true ); + int aPrecision = aResourceMgr->integerValue( "VISU", "floating_point_precision", 0 ); + QDoubleValidator* dv = new QDoubleValidator(this); + dv->setDecimals(aPrecision); + MinEdit = new QLineEdit( RangeGroup, "MinEdit" ); MinEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); MinEdit->setMinimumWidth( 70 ); - MinEdit->setValidator( new QDoubleValidator(this) ); + MinEdit->setValidator( dv ); MinEdit->setText( "0.0" ); QLabel* MinLabel = new QLabel (tr("LBL_MIN"), RangeGroup, "MinLabel"); MinLabel->setBuddy(MinEdit); @@ -607,7 +611,7 @@ VisuGUI_ScalarBarPane::VisuGUI_ScalarBarPane (QWidget * parent, bool thePreview) MaxEdit = new QLineEdit( RangeGroup, "MaxEdit" ); MaxEdit->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Fixed ) ); MaxEdit->setMinimumWidth( 70 ); - MaxEdit->setValidator( new QDoubleValidator(this) ); + MaxEdit->setValidator( dv ); MaxEdit->setText( "0.0" ); QLabel* MaxLabel = new QLabel (tr("LBL_MAX"), RangeGroup, "MaxLabel"); MaxLabel->setBuddy(MaxEdit); @@ -843,9 +847,9 @@ void VisuGUI_ScalarBarPane::storeToResources() { } else aResourceMgr->setValue("VISU", "scalar_range_type", 0); - + aResourceMgr->setValue("VISU", "scalar_bar_logarithmic", isLogarithmic()); - + //// if (myIsStoreTextProp) { @@ -860,11 +864,11 @@ void VisuGUI_ScalarBarPane::storeToResources() { isTitleBold, isTitleItalic, isTitleShadow); QFont aTitleFont; - + aTitleFont.setBold(isTitleBold); aTitleFont.setItalic(isTitleItalic); aTitleFont.setUnderline(isTitleShadow); - + QString titleFontFamily; switch (aTitleFontFamily) { case VTK_ARIAL: @@ -878,11 +882,11 @@ void VisuGUI_ScalarBarPane::storeToResources() { break; } aTitleFont.setFamily(titleFontFamily); - + aResourceMgr->setValue("VISU", "scalar_bar_title_font", aTitleFont); - + aResourceMgr->setValue("VISU", "scalar_bar_title_color", aTitleColor); - + // "Label" QColor aLabelColor (255, 255, 255); int aLabelFontFamily = VTK_ARIAL; @@ -895,7 +899,7 @@ void VisuGUI_ScalarBarPane::storeToResources() { QFont aLabelFont; - + aLabelFont.setBold(isLabelBold); aLabelFont.setItalic(isLabelItalic); aLabelFont.setUnderline(isLabelShadow); @@ -914,7 +918,7 @@ void VisuGUI_ScalarBarPane::storeToResources() { } aLabelFont.setFamily(labelFontFamily); - + aResourceMgr->setValue("VISU", "scalar_bar_label_font", aLabelFont); aResourceMgr->setValue("VISU", "scalar_bar_label_color", aLabelColor); @@ -937,7 +941,7 @@ VisuGUI_ScalarBarPane::~VisuGUI_ScalarBarPane() void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs) { myScalarMap = dynamic_cast(thePrs); - + if( !myScalarMap ) return; @@ -967,7 +971,7 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs) QString anUnit = QString(aUnitNames[i].c_str()).simplifyWhiteSpace(); if(anUnit.isNull() || anUnit == "") anUnit = "-"; - + aComponent = aComponent + ", " + anUnit; myModeCombo->insertItem(aComponent); @@ -990,10 +994,10 @@ void VisuGUI_ScalarBarPane::initFromPrsObject(VISU::ColoredPrs3d_i* thePrs) myTitle = aTitle.in(); setPosAndSize( myScalarMap->GetPosX(), - myScalarMap->GetPosY(), - myScalarMap->GetWidth(), - myScalarMap->GetHeight(), - myScalarMap->GetBarOrientation()); + myScalarMap->GetPosY(), + myScalarMap->GetWidth(), + myScalarMap->GetHeight(), + myScalarMap->GetBarOrientation()); if(RBvert->isChecked()) { myVerTW = myScalarMap->GetTitleWidth(); @@ -1074,7 +1078,7 @@ void VisuGUI_ScalarBarPane::createScalarBar() myScalarMapPL = VISU_ScalarMapPL::New(); if(myScalarMap->GetSpecificPL()) myScalarMapPL->ShallowCopy(myScalarMap->GetSpecificPL(), true); - + if ( myBusy ) return; myBusy = true; @@ -1090,7 +1094,7 @@ void VisuGUI_ScalarBarPane::createScalarBar() VISU_ScalarBarActor* aScalarBarActor = myPreviewActor->GetScalarBar(); myPreviewActor->GetScalarBar()->VisibilityOn(); myPreviewActor->PickableOff(); - + myScalarMapPL->SetScalarMode(myModeCombo->currentItem()); if(isLogarithmic()) myScalarMapPL->SetScaling(VISU::LOGARITHMIC); @@ -1106,11 +1110,11 @@ void VisuGUI_ScalarBarPane::createScalarBar() } myScalarMapPL->SetScalarRange(theRange); myScalarMapPL->SetNbColors(sbCol); - + myScalarMapPL->Update(); - + aScalarBarActor->SetLookupTable(myScalarMapPL->GetBarTable()); - + if (myTextDlg->getTitleText().latin1() != "") { VISU::PValForTime aValForTime; const VISU::PField& aField = myScalarMap->GetScalarField(); @@ -1123,12 +1127,12 @@ void VisuGUI_ScalarBarPane::createScalarBar() std::strstream aStream; const VISU::TTime& aTime = aValForTime->myTime; aStream<< myTextDlg->getTitleText() <<" "; - if(myBarDlg->isUnitsVisible()) - aStream<isUnitsVisible()) + aStream<SetTitle(aScalarBarTitle.c_str()); @@ -1153,16 +1157,16 @@ void VisuGUI_ScalarBarPane::createScalarBar() bool isTitleItalic; bool isTitleShadow; myTextDlg->myTitleFont->GetData(aTitleColor,aTitleFontFamily, - isTitleBold,isTitleItalic,isTitleShadow); + isTitleBold,isTitleItalic,isTitleShadow); vtkTextProperty* aTitleProp = aScalarBarActor->GetTitleTextProperty(); aTitleProp->SetFontFamily(aTitleFontFamily); aTitleProp->SetColor(vtkFloatingPointType(aTitleColor.red())/255., - vtkFloatingPointType(aTitleColor.green())/255., - vtkFloatingPointType(aTitleColor.blue())/255.); + vtkFloatingPointType(aTitleColor.green())/255., + vtkFloatingPointType(aTitleColor.blue())/255.); (isTitleBold)? aTitleProp->BoldOn() : aTitleProp->BoldOff(); (isTitleItalic)? aTitleProp->ItalicOn() : aTitleProp->ItalicOff(); (isTitleShadow)? aTitleProp->ShadowOn() : aTitleProp->ShadowOff(); - + // label text property QColor aLabelColor; int aLabelFontFamily; @@ -1170,12 +1174,12 @@ void VisuGUI_ScalarBarPane::createScalarBar() bool isLabelItalic; bool isLabelShadow; myTextDlg->myLabelFont->GetData(aLabelColor, aLabelFontFamily, - isLabelBold, isLabelItalic, isLabelShadow); + isLabelBold, isLabelItalic, isLabelShadow); vtkTextProperty* aLabelProp = aScalarBarActor->GetLabelTextProperty(); aLabelProp->SetFontFamily(aLabelFontFamily); aLabelProp->SetColor(vtkFloatingPointType(aLabelColor.red())/255., - vtkFloatingPointType(aLabelColor.green())/255., - vtkFloatingPointType(aLabelColor.blue())/255.); + vtkFloatingPointType(aLabelColor.green())/255., + vtkFloatingPointType(aLabelColor.blue())/255.); (isLabelBold)? aLabelProp->BoldOn() : aLabelProp->BoldOff(); (isLabelItalic)? aLabelProp->ItalicOn() : aLabelProp->ItalicOff(); (isLabelShadow)? aLabelProp->ShadowOn() : aLabelProp->ShadowOff(); @@ -1200,7 +1204,7 @@ void VisuGUI_ScalarBarPane::createScalarBar() void VisuGUI_ScalarBarPane::deleteScalarBar() { if ( myBusy ) return; - + if (myPreviewActor == 0) return; vtkRenderer* aRend = myPreviewActor->GetRenderer(); vtkRenderWindow* aWnd = aRend->GetRenderWindow(); @@ -1271,8 +1275,8 @@ int VisuGUI_ScalarBarPane::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) { myScalarMap->SetShadowTitle(isTitleShadow); myScalarMap->SetTitFontType(aTitleFontFamily); myScalarMap->SetTitleColor(aTitColor.red()/255., - aTitColor.green()/255., - aTitColor.blue()/255.); + aTitColor.green()/255., + aTitColor.blue()/255.); // "Label" QColor aLblColor (255, 255, 255); @@ -1289,8 +1293,8 @@ int VisuGUI_ScalarBarPane::storeToPrsObject(VISU::ColoredPrs3d_i* thePrs) { myScalarMap->SetShadowLabel(isLabelShadow); myScalarMap->SetLblFontType(aLabelFontFamily); myScalarMap->SetLabelColor(aLblColor.red()/255., - aLblColor.green()/255., - aLblColor.blue()/255.); + aLblColor.green()/255., + aLblColor.blue()/255.); myIsStoreTextProp = false; } @@ -1366,8 +1370,11 @@ void VisuGUI_ScalarBarPane::changeScalarMode( int theMode ) myScalarMap->SetScalarMode(theMode); if ( RBFrange->isChecked() ) { - MinEdit->setText( QString::number( myScalarMap->GetSourceMin() ) ); - MaxEdit->setText( QString::number( myScalarMap->GetSourceMax() ) ); + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + int aPrecision = aResourceMgr->integerValue("VISU", "floating_point_precision", 0); + + MinEdit->setText( QString::number( myScalarMap->GetSourceMin(), 'g', aPrecision ) ); + MaxEdit->setText( QString::number( myScalarMap->GetSourceMax(), 'g', aPrecision ) ); } updatePreview(); @@ -1380,8 +1387,11 @@ void VisuGUI_ScalarBarPane::changeScalarMode( int theMode ) */ void VisuGUI_ScalarBarPane::setRange( double imin, double imax, bool sbRange ) { - MinEdit->setText( QString::number( imin ) ); - MaxEdit->setText( QString::number( imax ) ); + SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); + int aPrecision = aResourceMgr->integerValue("VISU", "floating_point_precision", 0); + + MinEdit->setText( QString::number( imin, 'g', aPrecision ) ); + MaxEdit->setText( QString::number( imax, 'g', aPrecision ) ); if( sbRange ) RBIrange->setChecked( true ); @@ -1520,8 +1530,8 @@ bool VisuGUI_ScalarBarPane::check() if ( RBIrange->isChecked() ) { if (minVal >= maxVal) { SUIT_MessageBox::warn1( this,tr("WRN_VISU"), - tr("MSG_MINMAX_VALUES"), - tr("BUT_OK")); + tr("MSG_MINMAX_VALUES"), + tr("BUT_OK")); return false; } } @@ -1530,23 +1540,23 @@ bool VisuGUI_ScalarBarPane::check() if ( CBLog->isChecked() ) { if ( minVal <= 0.0 || maxVal <= 0.0 ) { if ( RBIrange->isChecked() ) { - SUIT_MessageBox::warn1( this, - tr("WRN_VISU"), - tr("WRN_LOGARITHMIC_RANGE"), - tr("BUT_OK")); + SUIT_MessageBox::warn1( this, + tr("WRN_VISU"), + tr("WRN_LOGARITHMIC_RANGE"), + tr("BUT_OK")); } else { - if ( minVal == 0 || maxVal == 0) - SUIT_MessageBox::warn1( this, - tr("WRN_VISU"), - tr("WRN_LOGARITHMIC_RANGE"), - tr("BUT_OK")); - else - SUIT_MessageBox::warn1( this, - tr("WRN_VISU"), - tr("WRN_LOGARITHMIC_FIELD_RANGE"), - tr("BUT_OK")); - RBIrange->setChecked(true); - changeRange(1); + if ( minVal == 0 || maxVal == 0) + SUIT_MessageBox::warn1( this, + tr("WRN_VISU"), + tr("WRN_LOGARITHMIC_RANGE"), + tr("BUT_OK")); + else + SUIT_MessageBox::warn1( this, + tr("WRN_VISU"), + tr("WRN_LOGARITHMIC_FIELD_RANGE"), + tr("BUT_OK")); + RBIrange->setChecked(true); + changeRange(1); } return false; } @@ -1598,7 +1608,7 @@ void VisuGUI_ScalarBarPane::onPreviewCheck (bool thePreview) //---------------------------------------------------------------------------- VisuGUI_Prs3dDlg::VisuGUI_Prs3dDlg( SalomeApp_Module* theModule ) : QDialog( VISU::GetDesktop( theModule ), 0, false, - WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) + WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu ) {} @@ -1616,9 +1626,9 @@ void VisuGUI_Prs3dDlg::onHelp() } 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")); + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName), + QObject::tr("BUT_OK")); } } @@ -1629,7 +1639,7 @@ void VisuGUI_Prs3dDlg::keyPressEvent( QKeyEvent* e ) QDialog::keyPressEvent( e ); if ( e->isAccepted() ) return; - + if ( e->key() == Key_F1 ) { e->accept(); onHelp(); @@ -1654,7 +1664,7 @@ VisuGUI_ScalarBarBaseDlg::~VisuGUI_ScalarBarBaseDlg() //---------------------------------------------------------------------------- void VisuGUI_ScalarBarBaseDlg::initFromPrsObject( VISU::ColoredPrs3d_i* thePrs, - bool theInit ) + bool theInit ) { myScalarPane->initFromPrsObject( thePrs ); }