if( !myBarPrs )
return;
- if (myBarPrs->IsPositiveTable()) {
- switch(myBarPrs->GetScaling()){
- case VISU::LOGARITHMIC :
- CBLog->setChecked( true );
- break;
- default:
- CBLog->setChecked( false );
- }
+ switch(myBarPrs->GetScaling()){
+ case VISU::LOGARITHMIC :
+ CBLog->setChecked( true );
+ break;
+ default:
+ CBLog->setChecked( false );
}
- else
- CBLog->setEnabled(false);
setRange( myBarPrs->GetMin(), myBarPrs->GetMax(), myBarPrs->IsRangeFixed() );
VisuGUI_Table3DDlg::~VisuGUI_Table3DDlg()
{}
+//=======================================================================
+//function : Check
+//purpose : Called when <OK> button is clicked, validates data and closes dialog
+//=======================================================================
+bool VisuGUI_TableScalarBarPane::check()
+{
+ double minVal = MinEdit->text().toDouble();
+ double maxVal = MaxEdit->text().toDouble();
+ if ( RBIrange->isChecked() ) {
+ if (minVal >= maxVal) {
+ SUIT_MessageBox::warn1( this,tr("WRN_VISU"),
+ tr("MSG_MINMAX_VALUES"),
+ tr("BUT_OK"));
+ return false;
+ }
+ }
+
+ // check if logarithmic mode is on and check imposed range to not contain negative values
+ 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"));
+ } else {
+ SUIT_MessageBox::warn1( this,
+ tr("WRN_VISU"),
+ tr("WRN_LOGARITHMIC_FIELD_RANGE"),
+ tr("BUT_OK"));
+ RBIrange->setChecked(true);
+ changeRange(1);
+ }
+ return false;
+ }
+ }
+ return true;
+}
+
//=======================================================================
//function : accept
//purpose :
//=======================================================================
void VisuGUI_Table3DDlg::accept()
{
- QDialog::accept();
+ if (myScalarBarPane->check())
+ QDialog::accept();
}
//=======================================================================
//=======================================================================
void VisuGUI_Table3DDlg::onApply()
{
- storeToPrsObject( myPrsCopy );
- myPrsCopy->UpdateActors();
+ if (myScalarBarPane->check()) {
+ storeToPrsObject( myPrsCopy );
+ myPrsCopy->UpdateActors();
+ }
}
//=======================================================================
//------------------ ColoredPrs3dBase Methods --------------------
CORBA::Double VISU::PointMap3d_i::GetMin()
{
- return myTablePL->GetScalarRange()[0];
+ 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()
{
- return myTablePL->GetScalarRange()[1];
+ SALOMEDS::GenericAttribute_var anAttr;
+ mySObj->FindAttribute(anAttr, "AttributeTableOfReal");
+ SALOMEDS::AttributeTableOfReal_var aTableOfReal = SALOMEDS::AttributeTableOfReal::_narrow(anAttr);
+ double aMax = 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 > aMax)
+ aMax = aVal;
+ }
+
+ return aMax;
+ // return myTablePL->GetScalarRange()[1];
}
void VISU::PointMap3d_i::SetRange(CORBA::Double theMin, CORBA::Double theMax)