Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Analysis.Views/3.3/ScatterPlotView.cs @ 8280

Last change on this file since 8280 was 8280, checked in by swagner, 12 years ago

Added enhanced version of ScatterPlot (#1892)

File size: 21.8 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Collections.Generic;
24using System.Drawing;
25using System.Linq;
26using System.Windows.Forms;
27using System.Windows.Forms.DataVisualization.Charting;
28using HeuristicLab.Collections;
29using HeuristicLab.Common;
30using HeuristicLab.Core.Views;
31using HeuristicLab.MainForm;
32
33namespace HeuristicLab.Analysis.Views {
34  [View("ScatterPlot View")]
35  [Content(typeof(ScatterPlot), true)]
36  public partial class ScatterPlotView : NamedItemView, IConfigureableView {
37    protected List<Series> invisibleSeries;
38    protected Dictionary<IObservableList<Point2D<double>>, ScatterPlotDataRow> pointsRowsTable;
39
40    public new ScatterPlot Content {
41      get { return (ScatterPlot)base.Content; }
42      set { base.Content = value; }
43    }
44
45    public ScatterPlotView() {
46      InitializeComponent();
47      pointsRowsTable = new Dictionary<IObservableList<Point2D<double>>, ScatterPlotDataRow>();
48      invisibleSeries = new List<Series>();
49      chart.CustomizeAllChartAreas();
50      chart.ChartAreas[0].CursorX.Interval = 1;
51    }
52
53    #region Event Handler Registration
54    protected override void DeregisterContentEvents() {
55      foreach (ScatterPlotDataRow row in Content.Rows)
56        DeregisterScatterPlotDataRowEvents(row);
57      Content.VisualPropertiesChanged -= new EventHandler(Content_VisualPropertiesChanged);
58      Content.Rows.ItemsAdded -= new CollectionItemsChangedEventHandler<ScatterPlotDataRow>(Rows_ItemsAdded);
59      Content.Rows.ItemsRemoved -= new CollectionItemsChangedEventHandler<ScatterPlotDataRow>(Rows_ItemsRemoved);
60      Content.Rows.ItemsReplaced -= new CollectionItemsChangedEventHandler<ScatterPlotDataRow>(Rows_ItemsReplaced);
61      Content.Rows.CollectionReset -= new CollectionItemsChangedEventHandler<ScatterPlotDataRow>(Rows_CollectionReset);
62      base.DeregisterContentEvents();
63    }
64    protected override void RegisterContentEvents() {
65      base.RegisterContentEvents();
66      Content.VisualPropertiesChanged += new EventHandler(Content_VisualPropertiesChanged);
67      Content.Rows.ItemsAdded += new CollectionItemsChangedEventHandler<ScatterPlotDataRow>(Rows_ItemsAdded);
68      Content.Rows.ItemsRemoved += new CollectionItemsChangedEventHandler<ScatterPlotDataRow>(Rows_ItemsRemoved);
69      Content.Rows.ItemsReplaced += new CollectionItemsChangedEventHandler<ScatterPlotDataRow>(Rows_ItemsReplaced);
70      Content.Rows.CollectionReset += new CollectionItemsChangedEventHandler<ScatterPlotDataRow>(Rows_CollectionReset);
71    }
72
73    protected virtual void RegisterScatterPlotDataRowEvents(ScatterPlotDataRow row) {
74      row.NameChanged += new EventHandler(Row_NameChanged);
75      row.VisualPropertiesChanged += new EventHandler(Row_VisualPropertiesChanged);
76      pointsRowsTable.Add(row.Points, row);
77      row.Points.ItemsAdded += new CollectionItemsChangedEventHandler<IndexedItem<Point2D<double>>>(Points_ItemsAdded);
78      row.Points.ItemsRemoved += new CollectionItemsChangedEventHandler<IndexedItem<Point2D<double>>>(Points_ItemsRemoved);
79      row.Points.ItemsReplaced += new CollectionItemsChangedEventHandler<IndexedItem<Point2D<double>>>(Points_ItemsReplaced);
80      row.Points.CollectionReset += new CollectionItemsChangedEventHandler<IndexedItem<Point2D<double>>>(Points_CollectionReset);
81    }
82    protected virtual void DeregisterScatterPlotDataRowEvents(ScatterPlotDataRow row) {
83      row.Points.ItemsAdded -= new CollectionItemsChangedEventHandler<IndexedItem<Point2D<double>>>(Points_ItemsAdded);
84      row.Points.ItemsRemoved -= new CollectionItemsChangedEventHandler<IndexedItem<Point2D<double>>>(Points_ItemsRemoved);
85      row.Points.ItemsReplaced -= new CollectionItemsChangedEventHandler<IndexedItem<Point2D<double>>>(Points_ItemsReplaced);
86      row.Points.CollectionReset -= new CollectionItemsChangedEventHandler<IndexedItem<Point2D<double>>>(Points_CollectionReset);
87      pointsRowsTable.Remove(row.Points);
88      row.VisualPropertiesChanged -= new EventHandler(Row_VisualPropertiesChanged);
89      row.NameChanged -= new EventHandler(Row_NameChanged);
90    }
91    #endregion
92
93    protected override void OnContentChanged() {
94      base.OnContentChanged();
95      invisibleSeries.Clear();
96      chart.Titles[0].Text = string.Empty;
97      chart.ChartAreas[0].AxisX.Title = string.Empty;
98      chart.ChartAreas[0].AxisY.Title = string.Empty;
99      chart.Series.Clear();
100      if (Content != null) {
101        chart.Titles[0].Text = Content.Name;
102        AddScatterPlotDataRows(Content.Rows);
103        ConfigureChartArea(chart.ChartAreas[0]);
104        RecalculateAxesScale(chart.ChartAreas[0]);
105      }
106    }
107
108    protected override void SetEnabledStateOfControls() {
109      base.SetEnabledStateOfControls();
110      chart.Enabled = Content != null;
111    }
112
113    public void ShowConfiguration() {
114      //if (Content != null) {
115      //  using (ScatterPlotVisualPropertiesDialog dialog = new ScatterPlotVisualPropertiesDialog(Content)) {
116      //    dialog.ShowDialog(this);
117      //  }
118      //} else MessageBox.Show("Nothing to configure.");
119    }
120    protected virtual void AddScatterPlotDataRows(IEnumerable<ScatterPlotDataRow> rows) {
121      foreach (var row in rows) {
122        RegisterScatterPlotDataRowEvents(row);
123        Series series = new Series(row.Name);
124        if (row.VisualProperties.DisplayName.Trim() != String.Empty) series.LegendText = row.VisualProperties.DisplayName;
125        else series.LegendText = row.Name;
126        ConfigureSeries(series, row);
127        FillSeriesWithRowValues(series, row);
128        chart.Series.Add(series);
129      }
130      ConfigureChartArea(chart.ChartAreas[0]);
131      RecalculateAxesScale(chart.ChartAreas[0]);
132      UpdateYCursorInterval();
133    }
134
135    protected virtual void RemoveScatterPlotDataRows(IEnumerable<ScatterPlotDataRow> rows) {
136      foreach (var row in rows) {
137        DeregisterScatterPlotDataRowEvents(row);
138        Series series = chart.Series[row.Name];
139        chart.Series.Remove(series);
140        if (invisibleSeries.Contains(series))
141          invisibleSeries.Remove(series);
142      }
143      RecalculateAxesScale(chart.ChartAreas[0]);
144    }
145
146    private void ConfigureSeries(Series series, ScatterPlotDataRow row) {
147      series.BorderWidth = 1;
148      series.BorderDashStyle = ChartDashStyle.Solid;
149      series.BorderColor = Color.Empty;
150
151      if (row.VisualProperties.Color != Color.Empty)
152        series.Color = row.VisualProperties.Color;
153      else series.Color = Color.Empty;
154      series.IsVisibleInLegend = row.VisualProperties.IsVisibleInLegend;
155      series.ChartType = SeriesChartType.FastPoint;
156      series.MarkerSize = row.VisualProperties.PointSize;
157      series.MarkerStyle = ConvertPointStyle(row.VisualProperties.PointStyle);
158      series.XAxisType = AxisType.Primary;
159      series.YAxisType = AxisType.Primary;
160
161      if (row.VisualProperties.DisplayName.Trim() != String.Empty) series.LegendText = row.VisualProperties.DisplayName;
162      else series.LegendText = row.Name;
163
164      string xAxisTitle = string.IsNullOrEmpty(Content.VisualProperties.XAxisTitle)
165                      ? "X"
166                      : Content.VisualProperties.XAxisTitle;
167      string yAxisTitle = string.IsNullOrEmpty(Content.VisualProperties.YAxisTitle)
168                            ? "Y"
169                            : Content.VisualProperties.YAxisTitle;
170      series.ToolTip =
171        series.LegendText + Environment.NewLine +
172        xAxisTitle + " = " + "#VALX," + Environment.NewLine +
173        yAxisTitle + " = " + "#VAL";
174    }
175
176    private void ConfigureChartArea(ChartArea area) {
177      if (Content.VisualProperties.TitleFont != null) chart.Titles[0].Font = Content.VisualProperties.TitleFont;
178      if (!Content.VisualProperties.TitleColor.IsEmpty) chart.Titles[0].ForeColor = Content.VisualProperties.TitleColor;
179      chart.Titles[0].Text = Content.VisualProperties.Title;
180
181      if (Content.VisualProperties.AxisTitleFont != null) area.AxisX.TitleFont = Content.VisualProperties.AxisTitleFont;
182      if (!Content.VisualProperties.AxisTitleColor.IsEmpty) area.AxisX.TitleForeColor = Content.VisualProperties.AxisTitleColor;
183      area.AxisX.Title = Content.VisualProperties.XAxisTitle;
184
185      if (Content.VisualProperties.AxisTitleFont != null) area.AxisY.TitleFont = Content.VisualProperties.AxisTitleFont;
186      if (!Content.VisualProperties.AxisTitleColor.IsEmpty) area.AxisY.TitleForeColor = Content.VisualProperties.AxisTitleColor;
187      area.AxisY.Title = Content.VisualProperties.YAxisTitle;
188    }
189
190    private void RecalculateAxesScale(ChartArea area) {
191      // Reset the axes bounds so that RecalculateAxesScale() will assign new bounds
192      foreach (Axis a in area.Axes) {
193        a.Minimum = double.NaN;
194        a.Maximum = double.NaN;
195      }
196      area.RecalculateAxesScale();
197      area.AxisX.IsMarginVisible = false;
198
199      if (!Content.VisualProperties.XAxisMinimumAuto && !double.IsNaN(Content.VisualProperties.XAxisMinimumFixedValue)) area.AxisX.Minimum = Content.VisualProperties.XAxisMinimumFixedValue;
200      if (!Content.VisualProperties.XAxisMaximumAuto && !double.IsNaN(Content.VisualProperties.XAxisMaximumFixedValue)) area.AxisX.Maximum = Content.VisualProperties.XAxisMaximumFixedValue;
201      if (!Content.VisualProperties.YAxisMinimumAuto && !double.IsNaN(Content.VisualProperties.YAxisMinimumFixedValue)) area.AxisY.Minimum = Content.VisualProperties.YAxisMinimumFixedValue;
202      if (!Content.VisualProperties.YAxisMaximumAuto && !double.IsNaN(Content.VisualProperties.YAxisMaximumFixedValue)) area.AxisY.Maximum = Content.VisualProperties.YAxisMaximumFixedValue;
203      if (area.AxisX.Minimum >= area.AxisX.Maximum) area.AxisX.Maximum = area.AxisX.Minimum + 1;
204      if (area.AxisY.Minimum >= area.AxisY.Maximum) area.AxisY.Maximum = area.AxisY.Minimum + 1;
205    }
206
207    protected virtual void UpdateYCursorInterval() {
208      double interestingValuesRange = (
209        from series in chart.Series
210        where series.Enabled
211        let values = (from point in series.Points
212                      where !point.IsEmpty
213                      select point.YValues[0]).DefaultIfEmpty(1.0)
214        let range = values.Max() - values.Min()
215        where range > 0.0
216        select range
217        ).DefaultIfEmpty(1.0).Min();
218
219      double digits = (int)Math.Log10(interestingValuesRange) - 3;
220      double yZoomInterval = Math.Pow(10, digits);
221      this.chart.ChartAreas[0].CursorY.Interval = yZoomInterval;
222    }
223
224    #region Event Handlers
225    #region Content Event Handlers
226    protected override void Content_NameChanged(object sender, EventArgs e) {
227      if (InvokeRequired)
228        Invoke(new EventHandler(Content_NameChanged), sender, e);
229      else {
230        chart.Titles[0].Text = Content.Name;
231        base.Content_NameChanged(sender, e);
232      }
233    }
234    private void Content_VisualPropertiesChanged(object sender, EventArgs e) {
235      if (InvokeRequired)
236        Invoke(new EventHandler(Content_VisualPropertiesChanged), sender, e);
237      else {
238        ConfigureChartArea(chart.ChartAreas[0]);
239        RecalculateAxesScale(chart.ChartAreas[0]); // axes min/max could have changed
240      }
241    }
242    #endregion
243    #region Rows Event Handlers
244    private void Rows_ItemsAdded(object sender, CollectionItemsChangedEventArgs<ScatterPlotDataRow> e) {
245      if (InvokeRequired)
246        Invoke(new CollectionItemsChangedEventHandler<ScatterPlotDataRow>(Rows_ItemsAdded), sender, e);
247      else {
248        AddScatterPlotDataRows(e.Items);
249      }
250    }
251    private void Rows_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<ScatterPlotDataRow> e) {
252      if (InvokeRequired)
253        Invoke(new CollectionItemsChangedEventHandler<ScatterPlotDataRow>(Rows_ItemsRemoved), sender, e);
254      else {
255        RemoveScatterPlotDataRows(e.Items);
256      }
257    }
258    private void Rows_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<ScatterPlotDataRow> e) {
259      if (InvokeRequired)
260        Invoke(new CollectionItemsChangedEventHandler<ScatterPlotDataRow>(Rows_ItemsReplaced), sender, e);
261      else {
262        RemoveScatterPlotDataRows(e.OldItems);
263        AddScatterPlotDataRows(e.Items);
264      }
265    }
266    private void Rows_CollectionReset(object sender, CollectionItemsChangedEventArgs<ScatterPlotDataRow> e) {
267      if (InvokeRequired)
268        Invoke(new CollectionItemsChangedEventHandler<ScatterPlotDataRow>(Rows_CollectionReset), sender, e);
269      else {
270        RemoveScatterPlotDataRows(e.OldItems);
271        AddScatterPlotDataRows(e.Items);
272      }
273    }
274    #endregion
275    #region Row Event Handlers
276    private void Row_VisualPropertiesChanged(object sender, EventArgs e) {
277      if (InvokeRequired)
278        Invoke(new EventHandler(Row_VisualPropertiesChanged), sender, e);
279      else {
280        ScatterPlotDataRow row = (ScatterPlotDataRow)sender;
281        Series series = chart.Series[row.Name];
282        series.Points.Clear();
283        ConfigureSeries(series, row);
284        FillSeriesWithRowValues(series, row);
285        RecalculateAxesScale(chart.ChartAreas[0]);
286      }
287    }
288    private void Row_NameChanged(object sender, EventArgs e) {
289      if (InvokeRequired)
290        Invoke(new EventHandler(Row_NameChanged), sender, e);
291      else {
292        ScatterPlotDataRow row = (ScatterPlotDataRow)sender;
293        chart.Series[row.Name].Name = row.Name;
294      }
295    }
296    #endregion
297    #region Points Event Handlers
298    private void Points_ItemsAdded(object sender, CollectionItemsChangedEventArgs<IndexedItem<Point2D<double>>> e) {
299      if (InvokeRequired)
300        Invoke(new CollectionItemsChangedEventHandler<IndexedItem<Point2D<double>>>(Points_ItemsAdded), sender, e);
301      else {
302        ScatterPlotDataRow row = null;
303        pointsRowsTable.TryGetValue((IObservableList<Point2D<double>>)sender, out row);
304        if (row != null) {
305          Series rowSeries = chart.Series[row.Name];
306          if (!invisibleSeries.Contains(rowSeries)) {
307            rowSeries.Points.Clear();
308            FillSeriesWithRowValues(rowSeries, row);
309            RecalculateAxesScale(chart.ChartAreas[0]);
310            UpdateYCursorInterval();
311          }
312        }
313      }
314    }
315    private void Points_ItemsRemoved(object sender, CollectionItemsChangedEventArgs<IndexedItem<Point2D<double>>> e) {
316      if (InvokeRequired)
317        Invoke(new CollectionItemsChangedEventHandler<IndexedItem<Point2D<double>>>(Points_ItemsRemoved), sender, e);
318      else {
319        ScatterPlotDataRow row = null;
320        pointsRowsTable.TryGetValue((IObservableList<Point2D<double>>)sender, out row);
321        if (row != null) {
322          Series rowSeries = chart.Series[row.Name];
323          if (!invisibleSeries.Contains(rowSeries)) {
324            rowSeries.Points.Clear();
325            FillSeriesWithRowValues(rowSeries, row);
326            RecalculateAxesScale(chart.ChartAreas[0]);
327            UpdateYCursorInterval();
328          }
329        }
330      }
331    }
332    private void Points_ItemsReplaced(object sender, CollectionItemsChangedEventArgs<IndexedItem<Point2D<double>>> e) {
333      if (InvokeRequired)
334        Invoke(new CollectionItemsChangedEventHandler<IndexedItem<Point2D<double>>>(Points_ItemsReplaced), sender, e);
335      else {
336        ScatterPlotDataRow row = null;
337        pointsRowsTable.TryGetValue((IObservableList<Point2D<double>>)sender, out row);
338        if (row != null) {
339          Series rowSeries = chart.Series[row.Name];
340          if (!invisibleSeries.Contains(rowSeries)) {
341            rowSeries.Points.Clear();
342            FillSeriesWithRowValues(rowSeries, row);
343            RecalculateAxesScale(chart.ChartAreas[0]);
344            UpdateYCursorInterval();
345          }
346        }
347      }
348    }
349    private void Points_CollectionReset(object sender, CollectionItemsChangedEventArgs<IndexedItem<Point2D<double>>> e) {
350      if (InvokeRequired)
351        Invoke(new CollectionItemsChangedEventHandler<IndexedItem<Point2D<double>>>(Points_CollectionReset), sender, e);
352      else {
353        ScatterPlotDataRow row = null;
354        pointsRowsTable.TryGetValue((IObservableList<Point2D<double>>)sender, out row);
355        if (row != null) {
356          Series rowSeries = chart.Series[row.Name];
357          if (!invisibleSeries.Contains(rowSeries)) {
358            rowSeries.Points.Clear();
359            FillSeriesWithRowValues(rowSeries, row);
360            RecalculateAxesScale(chart.ChartAreas[0]);
361            UpdateYCursorInterval();
362          }
363        }
364      }
365    }
366    #endregion
367    #endregion
368
369    #region Chart Event Handlers
370    private void chart_MouseDown(object sender, MouseEventArgs e) {
371      HitTestResult result = chart.HitTest(e.X, e.Y);
372      if (result.ChartElementType == ChartElementType.LegendItem) {
373        ToggleSeriesVisible(result.Series);
374      }
375    }
376    private void chart_MouseMove(object sender, MouseEventArgs e) {
377      HitTestResult result = chart.HitTest(e.X, e.Y);
378      if (result.ChartElementType == ChartElementType.LegendItem)
379        this.Cursor = Cursors.Hand;
380      else
381        this.Cursor = Cursors.Default;
382    }
383    private void chart_CustomizeLegend(object sender, CustomizeLegendEventArgs e) {
384      foreach (LegendItem legendItem in e.LegendItems) {
385        var series = chart.Series[legendItem.SeriesName];
386        if (series != null) {
387          bool seriesIsInvisible = invisibleSeries.Contains(series);
388          foreach (LegendCell cell in legendItem.Cells) {
389            cell.ForeColor = seriesIsInvisible ? Color.Gray : Color.Black;
390          }
391        }
392      }
393    }
394    #endregion
395
396    private void ToggleSeriesVisible(Series series) {
397      if (!invisibleSeries.Contains(series)) {
398        series.Points.Clear();
399        invisibleSeries.Add(series);
400      } else {
401        invisibleSeries.Remove(series);
402        if (Content != null) {
403
404          var row = (from r in Content.Rows
405                     where r.Name == series.Name
406                     select r).Single();
407          FillSeriesWithRowValues(series, row);
408          this.chart.Legends[series.Legend].ForeColor = Color.Black;
409          RecalculateAxesScale(chart.ChartAreas[0]);
410          UpdateYCursorInterval();
411        }
412      }
413    }
414
415    private void FillSeriesWithRowValues(Series series, ScatterPlotDataRow row) {
416      for (int i = 0; i < row.Points.Count; i++) {
417        var value = row.Points[i];
418        DataPoint point = new DataPoint();
419        if (IsInvalidValue(value.X) || IsInvalidValue(value.Y))
420          point.IsEmpty = true;
421        else {
422          point.XValue = value.X;
423          point.YValues = new double[] { value.Y };
424        }
425        series.Points.Add(point);
426      }
427    }
428
429    #region Helpers
430    public static IEnumerable<double> DoubleRange(double min, double max, double step) {
431      double i;
432      for (i = min; i <= max; i += step)
433        yield return i;
434
435      if (i != max + step)
436        yield return i;
437    }
438
439    private double HumanRoundRange(double range) {
440      double base10 = Math.Pow(10.0, Math.Floor(Math.Log10(range)));
441      double rounding = range / base10;
442      if (rounding <= 1.5) rounding = 1;
443      else if (rounding <= 2.25) rounding = 2;
444      else if (rounding <= 3.75) rounding = 2.5;
445      else if (rounding <= 7.5) rounding = 5;
446      else rounding = 10;
447      return rounding * base10;
448    }
449
450    private double HumanRoundMax(double max) {
451      double base10;
452      if (max > 0) base10 = Math.Pow(10.0, Math.Floor(Math.Log10(max)));
453      else base10 = Math.Pow(10.0, Math.Ceiling(Math.Log10(-max)));
454      double rounding = (max > 0) ? base10 : -base10;
455      while (rounding < max) rounding += base10;
456      return rounding;
457    }
458
459    private MarkerStyle ConvertPointStyle(ScatterPlotDataRowVisualProperties.ScatterPlotDataRowPointStyle pointStyle) {
460      switch (pointStyle) {
461        case ScatterPlotDataRowVisualProperties.ScatterPlotDataRowPointStyle.Circle:
462          return MarkerStyle.Circle;
463        case ScatterPlotDataRowVisualProperties.ScatterPlotDataRowPointStyle.Cross:
464          return MarkerStyle.Cross;
465        case ScatterPlotDataRowVisualProperties.ScatterPlotDataRowPointStyle.Diamond:
466          return MarkerStyle.Diamond;
467        case ScatterPlotDataRowVisualProperties.ScatterPlotDataRowPointStyle.Square:
468          return MarkerStyle.Square;
469        case ScatterPlotDataRowVisualProperties.ScatterPlotDataRowPointStyle.Star4:
470          return MarkerStyle.Star4;
471        case ScatterPlotDataRowVisualProperties.ScatterPlotDataRowPointStyle.Star5:
472          return MarkerStyle.Star5;
473        case ScatterPlotDataRowVisualProperties.ScatterPlotDataRowPointStyle.Star6:
474          return MarkerStyle.Star6;
475        case ScatterPlotDataRowVisualProperties.ScatterPlotDataRowPointStyle.Star10:
476          return MarkerStyle.Star10;
477        case ScatterPlotDataRowVisualProperties.ScatterPlotDataRowPointStyle.Triangle:
478          return MarkerStyle.Triangle;
479        default:
480          return MarkerStyle.None;
481      }
482    }
483
484    protected static bool IsInvalidValue(double x) {
485      return double.IsNaN(x) || x < (double)decimal.MinValue || x > (double)decimal.MaxValue;
486    }
487    #endregion
488  }
489}
Note: See TracBrowser for help on using the repository browser.