From 80068f7e9b90c849c7c2a2b498c61829e0e8eac8 Mon Sep 17 00:00:00 2001 From: dmv Date: Mon, 7 Jul 2008 06:28:44 +0000 Subject: [PATCH] Bug IPAL20027 4.x: "Preferences" aren't taken into account for the table presentation. --- src/VISUGUI/VisuGUI_Table3dDlg.cxx | 5 ++++- src/VISU_I/VISU_PointMap3d_i.cc | 31 +++++++++++++++++++++++++----- src/VISU_I/VISU_PointMap3d_i.hh | 2 ++ 3 files changed, 32 insertions(+), 6 deletions(-) diff --git a/src/VISUGUI/VisuGUI_Table3dDlg.cxx b/src/VISUGUI/VisuGUI_Table3dDlg.cxx index dd5046eb..d7e7a6ba 100644 --- a/src/VISUGUI/VisuGUI_Table3dDlg.cxx +++ b/src/VISUGUI/VisuGUI_Table3dDlg.cxx @@ -149,7 +149,10 @@ void VisuGUI_Table3DPane::initFromPrsObject(VISU::PointMap3d_i* thePrs) myPrs = thePrs; // scale - ScaleSpn->setValue(thePrs->GetScaleFactor()); + double aScale = thePrs->GetScaleFactor(); + if (aScale<0) + aScale = 0; + ScaleSpn->setValue( aScale ); // prs type int id = thePrs->GetIsContourPrs() ? CONTOUR_PRS_ID : SURFACE_PRS_ID; diff --git a/src/VISU_I/VISU_PointMap3d_i.cc b/src/VISU_I/VISU_PointMap3d_i.cc index a36cc8ca..e8d1d87b 100644 --- a/src/VISU_I/VISU_PointMap3d_i.cc +++ b/src/VISU_I/VISU_PointMap3d_i.cc @@ -204,6 +204,17 @@ VISU::Storable* VISU::PointMap3d_i::Create() else SetScaling(VISU::LINEAR); + int aNumberOfColors = aResourceMgr->integerValue( "VISU", "scalar_bar_num_colors", 64 ); + SetNbColors(aNumberOfColors); + + int aRangeType = aResourceMgr->integerValue("VISU" , "scalar_range_type", 0); + UseFixedRange(aRangeType == 1); + if(aRangeType == 1){ + float aMin = aResourceMgr->doubleValue("VISU", "scalar_range_min", 0); + float aMax = aResourceMgr->doubleValue("VISU", "scalar_range_max", 0); + SetRange(aMin, aMax); + } + QString aLabelsFormat = aResourceMgr->stringValue( "VISU", "scalar_bar_label_format", "%-#6.3g" ); const char *lf=aLabelsFormat.latin1(); SetLabelsFormat(lf); @@ -359,7 +370,9 @@ VISU_PointMap3dActor* VISU::PointMap3d_i::CreateActor() SUIT_ResourceMgr* aResourceMgr = VISU::GetResourceMgr(); int aDispMode = aResourceMgr->integerValue("VISU", "point_map_represent", 2); + bool toShrink = aResourceMgr->booleanValue("VISU", "scalar_map_shrink", false); anActor->SetRepresentation(aDispMode); + if (toShrink) anActor->SetShrink(); Handle (SALOME_InteractiveObject) anIO = new SALOME_InteractiveObject(GetEntry().c_str(), "VISU", GetName().c_str()); anActor->setIO(anIO); @@ -735,24 +748,28 @@ CORBA::Float VISU::PointMap3d_i::GetMemorySize() //------------------ ColoredPrs3dBase Methods -------------------- CORBA::Double VISU::PointMap3d_i::GetMin() +{ + return myTablePL->GetScalarRange()[0]; +} + +CORBA::Double VISU::PointMap3d_i::GetMinTableValue() { SALOMEDS::GenericAttribute_var anAttr; mySObj->FindAttribute(anAttr, "AttributeTableOfReal"); SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr); double aMin = aTableOfReal->GetValue(1, 1); - + for (int i=1; i<=aTableOfReal->GetNbColumns(); i++) for (int j=1; j<=aTableOfReal->GetNbRows(); j++) { double aVal = aTableOfReal->GetValue(j, i); if (aVal < aMin) aMin = aVal; } - + return aMin; - // return myTablePL->GetScalarRange()[0]; } -CORBA::Double VISU::PointMap3d_i::GetMax() +CORBA::Double VISU::PointMap3d_i::GetMaxTableValue() { SALOMEDS::GenericAttribute_var anAttr; mySObj->FindAttribute(anAttr, "AttributeTableOfReal"); @@ -767,7 +784,11 @@ CORBA::Double VISU::PointMap3d_i::GetMax() } return aMax; - // return myTablePL->GetScalarRange()[1]; +} + +CORBA::Double VISU::PointMap3d_i::GetMax() +{ + return myTablePL->GetScalarRange()[1]; } void VISU::PointMap3d_i::SetRange(CORBA::Double theMin, CORBA::Double theMax) diff --git a/src/VISU_I/VISU_PointMap3d_i.hh b/src/VISU_I/VISU_PointMap3d_i.hh index cda3b01e..aa7c0af3 100644 --- a/src/VISU_I/VISU_PointMap3d_i.hh +++ b/src/VISU_I/VISU_PointMap3d_i.hh @@ -86,6 +86,8 @@ namespace VISU virtual CORBA::Double GetMin(); virtual CORBA::Double GetMax(); + virtual CORBA::Double GetMinTableValue(); + virtual CORBA::Double GetMaxTableValue(); virtual void SetRange(CORBA::Double theMin, CORBA::Double theMax); virtual CORBA::Double GetSourceMin(); -- 2.39.2