예제 #1
0
        public DisplayPicesImages(PicesDataBase _dbConn,
                                  PicesImageSizeDistribution _sizeDistribution,
                                  int _selectedSizeIndex,
                                  float _depthMin,
                                  float _depthMax,
                                  PicesDataBaseImageList _picesImages
                                  )
        {
            InitializeComponent();
            thumbNails = new List <FlowLayoutPanel> ();

            dbConn            = _dbConn;
            sizeDistribution  = _sizeDistribution;
            picesImages       = _picesImages;
            selectedSizeIndex = _selectedSizeIndex;
            depthMin          = _depthMin;
            depthMax          = _depthMax;

            float[] startValues = sizeDistribution.SizeStartValues();
            float[] endValues   = sizeDistribution.SizeEndValues();

            if ((selectedSizeIndex >= 0) && (selectedSizeIndex < startValues.Length))
            {
                String t = "Size Range [" + startValues[selectedSizeIndex].ToString("###,##0.000") + " - " + endValues[selectedSizeIndex].ToString("#,###,##0.000") + "]";
                if (depthMax > 0.0f)
                {
                    t = t + "   Depth Range [" + depthMin.ToString("##0.0") + " - " + depthMax.ToString("##0.0") + "]";
                }
                Text = t;
            }

            UpdateDisplayTimer.Enabled = true;
        }
예제 #2
0
        public ChartSizeDepthDistribution(String _cruise,
                                          String _station,
                                          String _deployment,
                                          PicesClass _classToPlot,
                                          bool _includeSubClasses,
                                          char _statistic,
                                          String _cast,
                                          PicesImageSizeDistribution _sizeDistribution,
                                          int _selectedSizeBucket
                                          )
        {
            cruise            = _cruise;
            station           = _station;
            deployment        = _deployment;
            classToPlot       = _classToPlot;
            includeSubClasses = _includeSubClasses;
            cast               = _cast;
            statistic          = _statistic;
            sizeDistribution   = _sizeDistribution;
            selectedSizeBucket = _selectedSizeBucket;
            sizeStartValues    = sizeDistribution.SizeStartValues();
            sizeEndValues      = sizeDistribution.SizeEndValues();
            depthProfile       = sizeDistribution.DepthProfileForSizeBin((uint)selectedSizeBucket);
            volumeSampled      = sizeDistribution.VolumeSampledByDepthBucket();

            if ((selectedSizeBucket >= 0) && (selectedSizeBucket < sizeDistribution.NumSizeBuckets))
            {
                sizeStart = sizeStartValues[selectedSizeBucket];
                sizeEnd   = sizeEndValues  [selectedSizeBucket];
            }

            runLog = new PicesRunLog();

            mainWinConn = PicesDataBase.GetGlobalDatabaseManagerNewInstance(runLog);

            InitializeComponent();
        }
예제 #3
0
        } /* SuperScriptExponent */

        private void  UpdateChartAreas()
        {
            if (integratedDensityDistribution == null)
            {
                return;
            }

            goalie.StartBlock();

            String t1 = "Abundance by Size";

            switch (statistic)
            {
            case '0': t1 = "Abundance by Size";                       break;

            case '1': t1 = "Abundance by Estimated Diameter";         break;

            case '2': t1 = "Abundance by Estimated Spheroid Volume";  break;

            case '3': t1 = "Abundance by Estimated Ellipsoid Volume"; break;
            }

            String t2 = "Cruise: " + cruise + "  Station: " + station;

            if (String.IsNullOrEmpty(deployment))
            {
                t2 += "  Deployment: " + deployment;
            }

            t2 += "  Class: " + classToPlot.Name;

            ProfileChart.Titles.Clear();
            ProfileChart.Titles.Add(new Title(t1, Docking.Top, titleFont, Color.Black));
            ProfileChart.Titles.Add(new Title(t2, Docking.Top, titleFont, Color.Black));

            if (!String.IsNullOrEmpty(criteriaStr))
            {
                ProfileChart.Titles.Add(new Title(criteriaStr, Docking.Top, titleFont, Color.Black));
            }

            ProfileChart.Series.Clear();

            ChartArea ca = ProfileChart.ChartAreas[0];

            Series s = new Series("Size Distribution");

            s.ChartArea = "ChartArea1";
            s.ChartType = SeriesChartType.Column;

            float[] startValues = bucketsDisplayed.SizeStartValues();
            float[] endValues   = bucketsDisplayed.SizeEndValues();

            float minX = float.MaxValue;
            float minY = float.MaxValue;
            float maxX = float.MinValue;
            float maxY = float.MinValue;

            List <CustomLabel> customLabels = new List <CustomLabel> ();

            for (int x = 0; x < integratedDensityDistribution.Length; ++x)
            {
                float sv = startValues[x];
                float ev = sv * growthRate;
                if (sv <= 0.0f)
                {
                    sv = initialSizeValue / growthRate;
                    ev = initialSizeValue;
                }
                float midPoint = (sv + ev) / 2.0f;

                {
                    double      svLog10 = Math.Log10(sv);
                    double      evLog10 = Math.Log10(ev);
                    CustomLabel cl      = null;
                    if (midPoint < 1.0f)
                    {
                        cl = new CustomLabel(svLog10, evLog10, midPoint.ToString("#0.000"), 0, LabelMarkStyle.SideMark);
                    }
                    else if (midPoint < 10.0f)
                    {
                        cl = new CustomLabel(svLog10, evLog10, midPoint.ToString("#0.00"), 0, LabelMarkStyle.SideMark);
                    }
                    else if (midPoint < 100.0f)
                    {
                        cl = new CustomLabel(svLog10, evLog10, midPoint.ToString("##0.0"), 0, LabelMarkStyle.SideMark);
                    }
                    else
                    {
                        cl = new CustomLabel(svLog10, evLog10, midPoint.ToString("##,##0"), 0, LabelMarkStyle.SideMark);
                    }
                    customLabels.Add(cl);
                }

                double d      = (double)integratedDensityDistribution[x];
                float  log10D = (float)Math.Log10(d + 1.0);

                minY = Math.Min(minY, log10D);
                maxY = Math.Max(maxY, log10D);
                minX = Math.Min(minX, midPoint);
                maxX = Math.Max(maxX, midPoint);
                DataPoint dp = new DataPoint(midPoint, log10D);
                s.Points.Add(dp);
            }
            s.XAxisType = AxisType.Primary;
            s.YAxisType = AxisType.Primary;
            ProfileChart.ChartAreas[0].AxisY.LogarithmBase     = 10.0;
            ProfileChart.ChartAreas[0].AxisY.LabelStyle.Format = "##,###,##0";

            {
                ca.AxisX.CustomLabels.Clear();
                ca.AxisX.CustomLabels.Add(customLabels[1]);
                int   n          = 8;
                float interSpace = (float)customLabels.Count / (float)(n + 1);
                for (int x = 1; x <= n; ++x)
                {
                    int idx = 1 + (int)((float)x * interSpace + 0.5f);
                    ca.AxisX.CustomLabels.Add(customLabels[idx]);
                }

                ca.AxisX.CustomLabels.Add(customLabels[customLabels.Count - 1]);
            }


            ca.AxisY.Title = SubInSuperScriptExponent("Log 10  Abundance");

            switch (statistic)
            {
            case '0':
                ca.AxisX.Title = SubInSuperScriptExponent("area(m-2)");
                //ca.AxisX.LabelStyle.Format =  "##,##0.000";
                break;

            case '1':
                ca.AxisX.Title = SubInSuperScriptExponent("Length(mili-meters)");
                //ca.AxisX.LabelStyle.Format =  "##00.00";
                break;

            case '2':
                ca.AxisX.Title = SubInSuperScriptExponent("Volume(mm-3)");
                //ca.AxisX.LabelStyle.Format =  "##0.0000";
                break;

            case '3':
                ca.AxisX.Title = SubInSuperScriptExponent("Volume(mm-3)");
                //ca.AxisX.LabelStyle.Format =  "##0.0000";
                break;
            }

            ca.AxisX.IsLogarithmic = true;
            //ca.AxisX.Minimum          = 0.0;
            ca.AxisX.Maximum          = maxX;
            ca.AxisX.LabelStyle.Angle = 45;
            ca.AxisX.LabelStyle.Font  = axisLabelFont;
            ca.AxisX.TitleFont        = axisLabelFont;

            ca.AxisY.Minimum         = 0.0;
            ca.AxisY.IsLogarithmic   = false;
            ca.AxisY.LabelStyle.Font = axisLabelFont;
            ca.AxisY.TitleFont       = axisLabelFont;
            //ca.AxisX.IsLogarithmic = true;

            s.BorderWidth = 2;
            ProfileChart.Series.Add(s);

            try
            {
                ProfileChart.ChartAreas[0].RecalculateAxesScale();
            }
            catch (Exception e)
            {
                runLog.Writeln(e.ToString());
            }

            goalie.EndBlock();
        } /* UpdateChartAreas */