コード例 #1
0
        /// <summary>
        /// Updates the histogram chart if it is marked dirty and is visible.
        /// </summary>
        private void maybeUpdateHistogram()
        {
            // We check
            if (!splDisplay.Panel2Collapsed && histogramDirty)
            {
                addBackgroundOperation(
                    GraphicOperations.CalculateHistogram(new[] {
                    (cmbR.SelectedIndex > 0) ? dataset.Bands[cmbR.SelectedIndex - 1] : null,
                    (cmbG.SelectedIndex > 0) ? dataset.Bands[cmbG.SelectedIndex - 1] : null,
                    (cmbB.SelectedIndex > 0) ? dataset.Bands[cmbB.SelectedIndex - 1] : null
                }),
                    "Calculating histogram of the RGB composite.",
                    (ps, pe) => {
                    double[][] data = pe.Result as double[][];

                    // Bind histogram values to the chart series.
                    chtHistogram.Series["R"].Points.DataBindY(data[0]);
                    chtHistogram.Series["G"].Points.DataBindY(data[1]);
                    chtHistogram.Series["B"].Points.DataBindY(data[2]);
                    histogramDirty = false;
                });
            }
        }