Free cookie consent management tool by TermsFeed Policy Generator

Changeset 6676 for trunk


Ignore:
Timestamp:
08/22/11 10:16:53 (13 years ago)
Author:
abeham
Message:

#1623

  • Added some range checks in the DataRowVisualPropertiesControl
  • Added a check to prevent axis minimum and maximum equality to avoid a crash
  • Added AfterDeserialization hooks to the visual properties to detect the illegal .Net default configuration
Location:
trunk/sources
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Analysis.Views/3.3/DataRowVisualPropertiesControl.cs

    r6628 r6676  
    8080          lineStyleComboBox.SelectedItem = Content.LineStyle;
    8181          startIndexZeroCheckBox.Checked = Content.StartIndexZero;
    82           lineWidthNumericUpDown.Value = Content.LineWidth;
    83           binsNumericUpDown.Value = Content.Bins;
     82          if (Content.LineWidth < lineWidthNumericUpDown.Minimum)
     83            lineWidthNumericUpDown.Value = lineWidthNumericUpDown.Minimum;
     84          else if (Content.LineWidth > lineWidthNumericUpDown.Maximum)
     85            lineWidthNumericUpDown.Value = lineWidthNumericUpDown.Maximum;
     86          else lineWidthNumericUpDown.Value = Content.LineWidth;
     87          if (Content.Bins < binsNumericUpDown.Minimum)
     88            binsNumericUpDown.Value = binsNumericUpDown.Minimum;
     89          else if (Content.Bins > binsNumericUpDown.Maximum)
     90            binsNumericUpDown.Value = binsNumericUpDown.Maximum;
     91          else binsNumericUpDown.Value = Content.Bins;
    8492          binsApproximatelyRadioButton.Checked = !Content.ExactBins;
    8593          binsExactRadioButton.Checked = Content.ExactBins;
  • trunk/sources/HeuristicLab.Analysis.Views/3.3/DataTableView.cs

    r6628 r6676  
    258258      if (!Content.VisualProperties.SecondYAxisMinimumAuto && !double.IsNaN(Content.VisualProperties.SecondYAxisMinimumFixedValue)) area.AxisY2.Minimum = Content.VisualProperties.SecondYAxisMinimumFixedValue;
    259259      if (!Content.VisualProperties.SecondYAxisMaximumAuto && !double.IsNaN(Content.VisualProperties.SecondYAxisMaximumFixedValue)) area.AxisY2.Maximum = Content.VisualProperties.SecondYAxisMaximumFixedValue;
    260       if (area.AxisX.Minimum > area.AxisX.Maximum) area.AxisX.Maximum = area.AxisX.Minimum + 1;
    261       if (area.AxisX2.Minimum > area.AxisX2.Maximum) area.AxisX2.Maximum = area.AxisX2.Minimum + 1;
    262       if (area.AxisY.Minimum > area.AxisY.Maximum) area.AxisY.Maximum = area.AxisY.Minimum + 1;
    263       if (area.AxisY2.Minimum > area.AxisY2.Maximum) area.AxisY2.Maximum = area.AxisY2.Minimum + 1;
     260      if (area.AxisX.Minimum >= area.AxisX.Maximum) area.AxisX.Maximum = area.AxisX.Minimum + 1;
     261      if (area.AxisX2.Minimum >= area.AxisX2.Maximum) area.AxisX2.Maximum = area.AxisX2.Minimum + 1;
     262      if (area.AxisY.Minimum >= area.AxisY.Maximum) area.AxisY.Maximum = area.AxisY.Minimum + 1;
     263      if (area.AxisY2.Minimum >= area.AxisY2.Maximum) area.AxisY2.Maximum = area.AxisY2.Minimum + 1;
    264264    }
    265265
  • trunk/sources/HeuristicLab.Analysis/3.3/DataVisualization/DataRowVisualProperties.cs

    r6628 r6676  
    252252      if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
    253253    }
     254
     255    [StorableHook(HookType.AfterDeserialization)]
     256    private void AfterDeserialization() {
     257      // BackwardsCompatibility3.3
     258      #region Backwards compatible code, remove with 3.4
     259      if (secondXAxis == default(bool)
     260        && lineStyle == default(DataRowLineStyle)
     261        && lineWidth == default(int) && bins == default(int) && exactBins == default(bool)
     262        && displayName == default(string)) {
     263        secondXAxis = false;
     264        lineStyle = DataRowLineStyle.Solid;
     265        lineWidth = 1;
     266        bins = 10;
     267        exactBins = false;
     268        displayName = String.Empty;
     269      }
     270      #endregion
     271    }
    254272  }
    255273}
  • trunk/sources/HeuristicLab.Analysis/3.3/DataVisualization/DataTableVisualProperties.cs

    r6342 r6676  
    491491      if (handler != null) handler(this, new PropertyChangedEventArgs(propertyName));
    492492    }
     493
     494    [StorableHook(HookType.AfterDeserialization)]
     495    private void AfterDeserialization() {
     496      // BackwardsCompatibility3.3
     497      #region Backwards compatible code, remove with 3.4
     498      // check if most of the properties that were added in Mai'11 were set to their default values, then we want to reset them to our default values
     499      if (xAxisMinimumAuto == default(bool) && xAxisMaximumAuto == default(bool)
     500        && yAxisMinimumAuto == default(bool) && yAxisMaximumAuto == default(bool)
     501        && secondXAxisMinimumAuto == default(bool) && secondXAxisMaximumAuto == default(bool)
     502        && secondYAxisMinimumAuto == default(bool) && secondYAxisMaximumAuto == default(bool)
     503        && titleColor == default(Color) && axisTitleColor == default(Color)
     504        && secondXAxisTitle == default(string)
     505        && xAxisMinimumFixedValue == default(double) && xAxisMaximumFixedValue == default(double)
     506        && yAxisMinimumFixedValue == default(double) && yAxisMaximumFixedValue == default(double)
     507        && secondXAxisMinimumFixedValue == default(double) && secondXAxisMaximumFixedValue == default(double)
     508        && secondYAxisMinimumFixedValue == default(double) && secondYAxisMaximumFixedValue == default(double)) {
     509        titleColor = Color.Black;
     510        axisTitleColor = Color.Black;
     511        this.secondXAxisTitle = string.Empty;
     512        this.xAxisMinimumAuto = true;
     513        this.xAxisMinimumFixedValue = double.NaN;
     514        this.xAxisMaximumAuto = true;
     515        this.xAxisMaximumFixedValue = double.NaN;
     516        this.secondXAxisMinimumAuto = true;
     517        this.secondXAxisMinimumFixedValue = double.NaN;
     518        this.secondXAxisMaximumAuto = true;
     519        this.secondXAxisMaximumFixedValue = double.NaN;
     520        this.yAxisMinimumAuto = true;
     521        this.yAxisMinimumFixedValue = double.NaN;
     522        this.yAxisMaximumAuto = true;
     523        this.yAxisMaximumFixedValue = double.NaN;
     524        this.secondYAxisMinimumAuto = true;
     525        this.secondYAxisMinimumFixedValue = double.NaN;
     526        this.secondYAxisMaximumAuto = true;
     527        this.secondYAxisMaximumFixedValue = double.NaN;
     528      #endregion
     529      }
     530    }
    493531  }
    494532}
Note: See TracChangeset for help on using the changeset viewer.