コード例 #1
0
        private static AvgSpeed.ITrack TrackStub(Int32 value, UnitsNet.Units.LengthUnit unit)
        {
            var trackMock = new Mock <AvgSpeed.ITrack>();

            trackMock.Setup(track => track.Distance).Returns(new UnitsNet.Length(value, unit));
            return(trackMock.Object);
        }
コード例 #2
0
        /// <summary>
        /// Returns a dictionary of named range values in the XML spreadsheet to replace with stat values
        /// </summary>
        /// <param name="dodStat"></param>
        /// <returns></returns>
        private static Dictionary <string, string> GetStatValues(GCDConsoleLib.GCD.DoDStats dodStat)
        {
            Dictionary <string, string> StatValues = new Dictionary <string, string>();

            //get settings and options
            UnitsNet.Area            ca      = ProjectManager.Project.CellArea;
            DoDSummaryDisplayOptions options = new DoDSummaryDisplayOptions(ProjectManager.Project.Units);

            UnitsNet.Units.LengthUnit vunit = ProjectManager.Project.Units.VertUnit;

            //using same pattern as ucDoDSummary
            StatValues["ArealLoweringRaw"]         = dodStat.ErosionRaw.GetArea(ca).As(options.AreaUnits).ToString();
            StatValues["ArealLoweringThresholded"] = dodStat.ErosionThr.GetArea(ca).As(options.AreaUnits).ToString();
            StatValues["ArealRaisingRaw"]          = dodStat.DepositionRaw.GetArea(ca).As(options.AreaUnits).ToString();
            StatValues["ArealRaisingThresholded"]  = dodStat.DepositionThr.GetArea(ca).As(options.AreaUnits).ToString();

            StatValues["VolumeLoweringRaw"]         = dodStat.ErosionRaw.GetVolume(ca, vunit).As(options.VolumeUnits).ToString();
            StatValues["VolumeLoweringThresholded"] = dodStat.ErosionThr.GetVolume(ca, vunit).As(options.VolumeUnits).ToString();
            StatValues["VolumeErrorLowering"]       = dodStat.ErosionErr.GetVolume(ca, vunit).As(options.VolumeUnits).ToString();
            StatValues["VolumeRaisingRaw"]          = dodStat.DepositionRaw.GetVolume(ca, vunit).As(options.VolumeUnits).ToString();
            StatValues["VolumeRaisingThresholded"]  = dodStat.DepositionThr.GetVolume(ca, vunit).As(options.VolumeUnits).ToString();
            StatValues["VolumeErrorRaising"]        = dodStat.DepositionErr.GetVolume(ca, vunit).As(options.VolumeUnits).ToString();

            return(StatValues);
        }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="changeStats"></param>
        /// <returns></returns>
        /// <remarks>This method is needed by budget segregation as well</remarks>
        protected void GenerateSummaryXML(DoDStats changeStats, FileInfo outputPath)
        {
            string templatePath = Path.Combine(Project.ProjectManager.ExcelTemplatesFolder.FullName, "GCDSummary.xml");

            System.Text.StringBuilder outputText = default(System.Text.StringBuilder);

            try
            {
                using (System.IO.StreamReader objReader = new System.IO.StreamReader(templatePath))
                {
                    outputText = new System.Text.StringBuilder(objReader.ReadToEnd());
                }
            }
            catch (Exception ex)
            {
                Exception ex2 = new Exception("Error reading the GCD summary XML template file", ex);
                ex.Data["Excel Template Path"] = templatePath;
                throw ex2;
            }

            UnitsNet.Area             ca = Project.ProjectManager.Project.CellArea;
            UnitsNet.Units.LengthUnit lu = Project.ProjectManager.Project.Units.VertUnit;
            UnitsNet.Units.AreaUnit   au = Project.ProjectManager.Project.Units.ArUnit;
            UnitsNet.Units.VolumeUnit vu = Project.ProjectManager.Project.Units.VolUnit;
            string abbr = UnitsNet.Length.GetAbbreviation(lu);

            outputText.Replace("[LinearUnits]", abbr);

            outputText.Replace("[TotalAreaOfErosionRaw]", changeStats.ErosionRaw.GetArea(ca).As(au).ToString(CultureInfo.InvariantCulture));
            outputText.Replace("[TotalAreaOfErosionThresholded]", changeStats.ErosionThr.GetArea(ca).As(au).ToString(CultureInfo.InvariantCulture));

            outputText.Replace("[TotalAreaOfDepositionRaw]", changeStats.DepositionRaw.GetArea(ca).As(au).ToString(CultureInfo.InvariantCulture));
            outputText.Replace("[TotalAreaOfDepositionThresholded]", changeStats.DepositionThr.GetArea(ca).As(au).ToString(CultureInfo.InvariantCulture));

            outputText.Replace("[TotalVolumeOfErosionRaw]", changeStats.ErosionRaw.GetVolume(ca, Project.ProjectManager.Project.Units).As(vu).ToString(CultureInfo.InvariantCulture));
            outputText.Replace("[TotalVolumeOfErosionThresholded]", changeStats.ErosionThr.GetVolume(ca, Project.ProjectManager.Project.Units).As(vu).ToString(CultureInfo.InvariantCulture));
            outputText.Replace("[ErrorVolumeOfErosion]", changeStats.ErosionErr.GetVolume(ca, Project.ProjectManager.Project.Units).As(vu).ToString(CultureInfo.InvariantCulture));

            outputText.Replace("[TotalVolumeOfDepositionRaw]", changeStats.DepositionRaw.GetVolume(ca, Project.ProjectManager.Project.Units).As(vu).ToString(CultureInfo.InvariantCulture));
            outputText.Replace("[TotalVolumeOfDepositionThresholded]", changeStats.DepositionThr.GetVolume(ca, Project.ProjectManager.Project.Units).As(vu).ToString(CultureInfo.InvariantCulture));
            outputText.Replace("[ErrorVolumeOfDeposition]", changeStats.DepositionErr.GetVolume(ca, Project.ProjectManager.Project.Units).As(vu).ToString(CultureInfo.InvariantCulture));

            try
            {
                using (StreamWriter objWriter = new StreamWriter(outputPath.FullName))
                {
                    objWriter.Write(outputText);
                }
            }
            catch (Exception ex)
            {
                Exception ex2 = new Exception("Error writing the GCD summary XML template file", ex);
                ex.Data["Excel Template Path"] = templatePath;
                throw ex2;
            }
        }
コード例 #4
0
ファイル: GCDUnits.cs プロジェクト: tarinishukla/gcd
 public static void SelectUnit(System.Windows.Forms.ComboBox cbo, UnitsNet.Units.LengthUnit unit)
 {
     foreach (FormattedUnit <UnitsNet.Units.LengthUnit> cboUnit in cbo.Items)
     {
         if (cboUnit.Unit == unit)
         {
             cbo.SelectedItem = cboUnit;
             return;
         }
     }
 }
コード例 #5
0
ファイル: frmPointDensity.cs プロジェクト: tarinishukla/gcd
        private void cboNeighbourhood_SelectedIndexChanged(object sender, EventArgs e)
        {
            UnitsNet.Units.LengthUnit lUnits = ProjectManager.Project.Units.HorizUnit;

            string label;

            if ((RasterOperators.KernelShapes)cboNeighbourhood.SelectedItem == RasterOperators.KernelShapes.Circle)
            {
                label = "Diameter";
                tTip.SetToolTip(valSampleDistance, string.Format("Diameter of the circular sample window (in {0}) over which point density is calculated", lUnits));
            }
            else
            {
                label = "Length";
                tTip.SetToolTip(valSampleDistance, string.Format("Size of the square sample window (in {0}) over which point density is calculated", lUnits));
            }

            lblDistance.Text = string.Format("{0} ({1})", label, UnitsNet.Length.GetAbbreviation(lUnits));
        }
コード例 #6
0
ファイル: GCDProject.cs プロジェクト: tarinishukla/gcd
        public static GCDProject Load(FileInfo projectFile)
        {
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(projectFile.FullName);

            XmlNode  nodProject = xmlDoc.SelectSingleNode("Project");
            string   name       = nodProject.SelectSingleNode("Name").InnerText;
            string   desc       = nodProject.SelectSingleNode("Description").InnerText;
            string   gcdv       = nodProject.SelectSingleNode("GCDVersion").InnerText;
            DateTime dtCreated  = DateTime.Parse(nodProject.SelectSingleNode("DateTimeCreated").InnerText);

            UnitsNet.Units.LengthUnit   horiz = (UnitsNet.Units.LengthUnit)Enum.Parse(typeof(UnitsNet.Units.LengthUnit), nodProject.SelectSingleNode("Units/Horizontal").InnerText);
            UnitsNet.Units.LengthUnit   vert  = (UnitsNet.Units.LengthUnit)Enum.Parse(typeof(UnitsNet.Units.LengthUnit), nodProject.SelectSingleNode("Units/Vertical").InnerText);
            UnitsNet.Units.AreaUnit     area  = (UnitsNet.Units.AreaUnit)Enum.Parse(typeof(UnitsNet.Units.AreaUnit), nodProject.SelectSingleNode("Units/Area").InnerText);
            UnitsNet.Units.VolumeUnit   vol   = (UnitsNet.Units.VolumeUnit)Enum.Parse(typeof(UnitsNet.Units.VolumeUnit), nodProject.SelectSingleNode("Units/Volume").InnerText);
            GCDConsoleLib.GCD.UnitGroup units = new GCDConsoleLib.GCD.UnitGroup(vol, area, vert, horiz);

            UnitsNet.Area cellArea    = UnitsNet.Area.From(0, area);
            XmlNode       nodCellArea = nodProject.SelectSingleNode("CellArea");

            if (!string.IsNullOrEmpty(nodCellArea.InnerText))
            {
                cellArea = UnitsNet.Area.From(double.Parse(nodCellArea.InnerText, CultureInfo.InvariantCulture), area);
            }

            ProjectManager.Project = new GCDProject(name, desc, projectFile, dtCreated, gcdv, cellArea, units);

            foreach (XmlNode nodOnline in nodProject.SelectNodes("Online/*"))
            {
                ProjectManager.Project.OnlineParams[nodOnline.Name] = nodOnline.InnerText;
            }

            // Load masks before DEMs. DEMs will load error surfaces that refer to masks
            foreach (XmlNode nodMask in nodProject.SelectNodes("Masks/Mask"))
            {
                if (nodMask.SelectSingleNode("Field") is XmlNode)
                {
                    // Regular or directional mask
                    if (nodMask.SelectSingleNode("Items") is XmlNode)
                    {
                        ProjectManager.Project.Masks.Add(new Masks.RegularMask(nodMask));
                    }
                    else
                    {
                        ProjectManager.Project.Masks.Add(new Project.Masks.DirectionalMask(nodMask));
                    }
                }
                else
                {
                    // Area of interest
                    ProjectManager.Project.Masks.Add(new Project.Masks.AOIMask(nodMask));
                }
            }

            // Load profile routes before DEMs, Ref Surfs and DoDs that might refer to
            // routes in their linear extractions
            foreach (XmlNode nodRoute in nodProject.SelectNodes("ProfileRoutes/ProfileRoute"))
            {
                ProjectManager.Project.ProfileRoutes.Add(new Project.ProfileRoutes.ProfileRoute(nodRoute));
            }

            foreach (XmlNode nodDEM in nodProject.SelectNodes("DEMSurveys/DEM"))
            {
                DEMSurvey dem = new DEMSurvey(nodDEM);
                ProjectManager.Project.DEMSurveys.Add(dem);
            }

            foreach (XmlNode nodRefSurf in nodProject.SelectNodes("ReferenceSurfaces/ReferenceSurface"))
            {
                Surface surf = new Surface(nodRefSurf, true, true);
                ProjectManager.Project.ReferenceSurfaces.Add(surf);
            }

            foreach (XmlNode nodDoD in nodProject.SelectNodes("DoDs/DoD"))
            {
                DoDBase dod = null;
                if (nodDoD.SelectSingleNode("Threshold") is XmlNode)
                {
                    dod = new DoDMinLoD(nodDoD);
                }
                else if (nodDoD.SelectSingleNode("ConfidenceLevel") is XmlNode)
                {
                    dod = new DoDProbabilistic(nodDoD);
                }
                else
                {
                    dod = new DoDPropagated(nodDoD);
                }

                ProjectManager.Project.DoDs.Add(dod);
            }

            foreach (XmlNode nodInter in nodProject.SelectNodes("InterComparisons/InterComparison"))
            {
                InterComparison inter = new InterComparison(nodInter, ProjectManager.Project.DoDs);
                ProjectManager.Project.InterComparisons.Add(inter);
            }

            foreach (XmlNode nodItem in nodProject.SelectNodes("MetaData/Item"))
            {
                ProjectManager.Project.MetaData[nodItem.SelectSingleNode("Key").InnerText] = nodItem.SelectSingleNode("Value").InnerText;
            }

            return(ProjectManager.Project);
        }
コード例 #7
0
        public static IRasterRenderer CreateGrainSizeStatisticColorRamp(GCDConsoleLib.Raster gRaster, UnitsNet.Units.LengthUnit eUnits)
        {
            try
            {
                // Open file raster dataset and ensure that statistics and histograms are present (absence of histograms will cause Renderer.Update() to crash)
                IRasterDataset rasterDataset = ArcMapUtilities.GetRasterDataset(gRaster);
                ESRI.ArcGIS.DataSourcesRaster.IRasterBandCollection pRastBands     = (ESRI.ArcGIS.DataSourcesRaster.IRasterBandCollection)rasterDataset;
                ESRI.ArcGIS.DataSourcesRaster.IEnumRasterBand       enumRasterBand = (ESRI.ArcGIS.DataSourcesRaster.IEnumRasterBand)pRastBands.Bands;
                rasterDataset.PrecalculateStats(0);
                ESRI.ArcGIS.DataSourcesRaster.IRasterBand pRastBand = enumRasterBand.Next();
                pRastBand.ComputeStatsAndHist();

                IRasterClassifyColorRampRenderer classifyRenderer = new RasterClassifyColorRampRendererClass();
                IRasterRenderer rasterRenderer = (IRasterRenderer)classifyRenderer;
                IRaster         raster         = rasterDataset.CreateDefaultRaster();

                rasterRenderer.Raster       = raster;
                classifyRenderer.ClassCount = 5;
                rasterRenderer.Update();
                classifyRenderer.Break[0] = 0;
                classifyRenderer.Label[0] = "Fines, Sand (0 to 2 mm)";
                classifyRenderer.Break[1] = UnitsNet.Length.From(2, UnitsNet.Units.LengthUnit.Millimeter).As(eUnits);
                classifyRenderer.Label[1] = "Fine Gravel (2 mm to 16 mm)";
                classifyRenderer.Break[2] = UnitsNet.Length.From(16, UnitsNet.Units.LengthUnit.Millimeter).As(eUnits);
                classifyRenderer.Label[2] = "Coarse Gravel (16 mm to 64 mm)";
                classifyRenderer.Break[3] = UnitsNet.Length.From(64, UnitsNet.Units.LengthUnit.Millimeter).As(eUnits);
                classifyRenderer.Label[3] = "Cobbles (64 mm to 256 mm)";
                classifyRenderer.Break[4] = UnitsNet.Length.From(256, UnitsNet.Units.LengthUnit.Millimeter).As(eUnits);
                classifyRenderer.Label[4] = "Boulders (> 256 mm)";

                List <RgbColor> lColors = new List <RgbColor>();
                lColors.Add(CreateRGBColor(194, 82, 60));
                lColors.Add(CreateRGBColor(240, 180, 17));
                lColors.Add(CreateRGBColor(123, 237, 0));
                lColors.Add(CreateRGBColor(27, 168, 124));
                lColors.Add(CreateRGBColor(11, 44, 122));

                IFillSymbol fillSymbol = new SimpleFillSymbol();
                for (int i = 0; i < classifyRenderer.ClassCount; i++)
                {
                    fillSymbol.Color           = lColors[i];
                    classifyRenderer.Symbol[i] = (ISymbol)fillSymbol;
                }

                return(rasterRenderer);
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message);
                return(null);
            }
        }
コード例 #8
0
ファイル: frmImportRaster.cs プロジェクト: tarinishukla/gcd
        private void UpdateOutputExtent(object sender, EventArgs e)
        {
            ExtentAdjusterBase temp = ExtImporter;

            if (sender == valTop || sender == valRight || sender == valBottom || sender == valLeft)
            {
                temp = ExtImporter.AdjustDimensions(valTop.Value, valRight.Value, valBottom.Value, valLeft.Value);
            }
            else if (sender == valCellSize)
            {
                if (valCellSize.Value <= 0m)
                {
                    valCellSize.Value = ExtImporter.OutExtent.CellWidth;
                    return;
                }

                temp = ExtImporter.AdjustCellSize(valCellSize.Value);
            }
            else if (sender == valPrecision)
            {
                temp = ExtImporter.AdjustPrecision((ushort)valPrecision.Value);
            }

            // Turn off event firing
            valTop.ValueChanged       -= UpdateOutputExtent;
            valBottom.ValueChanged    -= UpdateOutputExtent;
            valRight.ValueChanged     -= UpdateOutputExtent;
            valLeft.ValueChanged      -= UpdateOutputExtent;
            valCellSize.ValueChanged  -= UpdateOutputExtent;
            valPrecision.ValueChanged -= UpdateOutputExtent;

            // Update the extent adjustor
            ExtImporter = temp;

            // Update output control values
            valCellSize.DecimalPlaces = ExtImporter.Precision;
            valTop.DecimalPlaces      = ExtImporter.Precision;
            valLeft.DecimalPlaces     = ExtImporter.Precision;
            valRight.DecimalPlaces    = ExtImporter.Precision;
            valBottom.DecimalPlaces   = ExtImporter.Precision;

            valTop.Value       = ExtImporter.OutExtent.Top;
            valLeft.Value      = ExtImporter.OutExtent.Left;
            valRight.Value     = ExtImporter.OutExtent.Right;
            valBottom.Value    = ExtImporter.OutExtent.Bottom;
            valCellSize.Value  = ExtImporter.OutExtent.CellWidth;
            valPrecision.Value = ExtImporter.Precision;

            // Colour the numeric up down boxes based on whether they match the original extent
            valTop.ForeColor    = SourceRaster.Extent.Top == ExtImporter.OutExtent.Top ? System.Drawing.Color.DarkGreen : System.Drawing.Color.Black;
            valLeft.ForeColor   = SourceRaster.Extent.Left == ExtImporter.OutExtent.Left ? System.Drawing.Color.DarkGreen : System.Drawing.Color.Black;
            valRight.ForeColor  = SourceRaster.Extent.Right == ExtImporter.OutExtent.Right ? System.Drawing.Color.DarkGreen : System.Drawing.Color.Black;
            valBottom.ForeColor = SourceRaster.Extent.Bottom == ExtImporter.OutExtent.Bottom ? System.Drawing.Color.DarkGreen : System.Drawing.Color.Black;

            txtProjCols.Text = ExtImporter.OutExtent.Cols.ToString("#,##0");
            txtProjRows.Text = ExtImporter.OutExtent.Rows.ToString("#,##0");
            UnitsNet.Units.LengthUnit hUnits = SourceRaster.Proj.HorizontalUnit;
            txtProjWidth.Text  = string.Format("{0}{1}", ExtImporter.OutExtent.Width, UnitsNet.Length.GetAbbreviation(hUnits));
            txtProjHeight.Text = string.Format("{0}{1}", ExtImporter.OutExtent.Height, UnitsNet.Length.GetAbbreviation(hUnits));

            txtInterpolationMethod.Text = ExtImporter.RequiresResampling ? "Bilinear Interpolation" : "None (straight cell-wise copy)";

            // Turn on event firing
            valTop.ValueChanged       += UpdateOutputExtent;
            valBottom.ValueChanged    += UpdateOutputExtent;
            valRight.ValueChanged     += UpdateOutputExtent;
            valLeft.ValueChanged      += UpdateOutputExtent;
            valCellSize.ValueChanged  += UpdateOutputExtent;
            valPrecision.ValueChanged += UpdateOutputExtent;
        }
コード例 #9
0
        protected void GenerateChangeBarGraphicFiles(DirectoryInfo analysisFolder, DoDStats stats, int fChartWidth, int fChartHeight, string sFilePrefix = "")
        {
            ElevationChangeBarViewer barViewer = new ElevationChangeBarViewer();

            if (!string.IsNullOrEmpty(sFilePrefix))
            {
                if (!sFilePrefix.EndsWith("_"))
                {
                    sFilePrefix += "_";
                }
            }

            DirectoryInfo figuresFolder = Project.DoDBase.FiguresFolderPath(analysisFolder);

            figuresFolder.Create();

            UnitsNet.Area             ca = GCDCore.Project.ProjectManager.Project.CellArea;
            UnitsNet.Units.LengthUnit lu = Project.ProjectManager.Project.Units.VertUnit;
            UnitsNet.Units.AreaUnit   au = Project.ProjectManager.Project.Units.ArUnit;
            UnitsNet.Units.VolumeUnit vu = Project.ProjectManager.Project.Units.VolUnit;
            string abbr = UnitsNet.Length.GetAbbreviation(lu);

            barViewer.Refresh(
                stats.ErosionThr.GetArea(ca).As(au),
                stats.DepositionThr.GetArea(ca).As(au), abbr, ElevationChangeBarViewer.BarTypes.Area, true);
            barViewer.Save(new FileInfo(Path.Combine(figuresFolder.FullName, sFilePrefix + "ChangeBars_AreaAbsolute.png")), fChartWidth, fChartHeight);

            barViewer.Refresh(
                stats.ErosionThr.GetArea(ca).As(au),
                stats.DepositionThr.GetArea(ca).As(au), abbr, ElevationChangeBarViewer.BarTypes.Area, false);
            barViewer.Save(new FileInfo(Path.Combine(figuresFolder.FullName, sFilePrefix + "ChangeBars_AreaRelative.png")), fChartWidth, fChartHeight);

            barViewer.Refresh(
                stats.ErosionThr.GetVolume(ca, Project.ProjectManager.Project.Units).As(vu),
                stats.DepositionThr.GetVolume(ca, Project.ProjectManager.Project.Units).As(vu),
                stats.NetVolumeOfDifference_Thresholded.As(vu),
                stats.ErosionErr.GetVolume(ca, Project.ProjectManager.Project.Units).As(vu),
                stats.DepositionErr.GetVolume(ca, Project.ProjectManager.Project.Units).As(vu),
                stats.NetVolumeOfDifference_Error.As(vu), abbr, ElevationChangeBarViewer.BarTypes.Volume, true);
            barViewer.Save(new FileInfo(Path.Combine(figuresFolder.FullName, sFilePrefix + "ChangeBars_VolumeAbsolute.png")), fChartWidth, fChartHeight);

            barViewer.Refresh(
                stats.ErosionThr.GetVolume(ca, Project.ProjectManager.Project.Units).As(vu),
                stats.DepositionThr.GetVolume(ca, Project.ProjectManager.Project.Units).As(vu),
                stats.NetVolumeOfDifference_Thresholded.As(vu),
                stats.ErosionErr.GetVolume(ca, Project.ProjectManager.Project.Units).As(vu),
                stats.DepositionErr.GetVolume(ca, Project.ProjectManager.Project.Units).As(vu),
                stats.NetVolumeOfDifference_Error.As(vu), abbr, ElevationChangeBarViewer.BarTypes.Volume, false);
            barViewer.Save(new FileInfo(Path.Combine(figuresFolder.FullName, sFilePrefix + "ChangeBars_VolumeRelative.png")), fChartWidth, fChartHeight);

            barViewer.Refresh(
                stats.AverageDepthErosion_Thresholded.As(lu),
                stats.AverageDepthDeposition_Thresholded.As(lu),
                stats.AverageNetThicknessOfDifferenceADC_Thresholded.As(lu),
                stats.AverageDepthErosion_Error.As(lu),
                stats.AverageDepthDeposition_Error.As(lu),
                stats.AverageThicknessOfDifferenceADC_Error.As(lu), abbr, ElevationChangeBarViewer.BarTypes.Vertical, true);
            barViewer.Save(new FileInfo(Path.Combine(figuresFolder.FullName, sFilePrefix + "ChangeBars_DepthAbsolute.png")), fChartWidth, fChartHeight);

            barViewer.Refresh(
                stats.AverageDepthErosion_Thresholded.As(lu),
                stats.AverageDepthDeposition_Thresholded.As(lu),
                stats.AverageNetThicknessOfDifferenceADC_Thresholded.As(lu),
                stats.AverageDepthErosion_Error.As(lu),
                stats.AverageDepthDeposition_Error.As(lu),
                stats.AverageThicknessOfDifferenceADC_Error.As(lu), abbr, ElevationChangeBarViewer.BarTypes.Vertical, false);
            barViewer.Save(new FileInfo(Path.Combine(figuresFolder.FullName, sFilePrefix + "ChangeBars_DepthRelative.png")), fChartWidth, fChartHeight);
        }
コード例 #10
0
ファイル: ucDoDSummary.cs プロジェクト: tarinishukla/gcd
        public void RefreshDisplay(GCDConsoleLib.GCD.DoDStats activeStats, List <GCDConsoleLib.GCD.DoDStats> allStats, UserInterface.BudgetSegregation.frmBudgetSegResults.RawRepresents raw, DoDSummaryDisplayOptions options)
        {
            // Load the base statistics for this class
            RefreshDisplay(activeStats, options);

            // Previous call will hide col 6. Make it visible for bs view
            grdData.Columns[colTot].Visible = true;

            // Build the string formatting based on the precision in the pop-up properties form
            string sFormat = GetFormatString(options);

            UnitsNet.Area             ca = ProjectManager.Project.CellArea;
            UnitsNet.Units.LengthUnit lu = ProjectManager.Project.Units.VertUnit;

            // AREAL

            // Erosion
            double classErosionArea = activeStats.ErosionThr.GetArea(ca).As(options.AreaUnits);
            double totalErosionArea = classErosionArea;

            switch (raw)
            {
            case BudgetSegregation.frmBudgetSegResults.RawRepresents.RawDoDAreaOfInterest:
                totalErosionArea = allStats.Sum(x => x.ErosionRaw.GetArea(ca).As(options.AreaUnits));
                break;

            case BudgetSegregation.frmBudgetSegResults.RawRepresents.ThrDoDAreaDetectableChange:
                totalErosionArea = allStats.Sum(x => x.ErosionThr.GetArea(ca).As(options.AreaUnits));
                break;

            case BudgetSegregation.frmBudgetSegResults.RawRepresents.RawClassAreaOfInterest:
                totalErosionArea = activeStats.ErosionRaw.GetArea(ca).As(options.AreaUnits);
                break;
            }
            grdData.Rows[1].Cells[colTot].Value = SafePercent(classErosionArea, totalErosionArea) / 100f;

            // Deposition
            double classDepositionArea = activeStats.DepositionThr.GetArea(ca).As(options.AreaUnits);
            double totalDepositionArea = classDepositionArea;

            switch (raw)
            {
            case BudgetSegregation.frmBudgetSegResults.RawRepresents.RawDoDAreaOfInterest:
                totalDepositionArea = allStats.Sum(x => x.DepositionRaw.GetArea(ca).As(options.AreaUnits));
                break;

            case BudgetSegregation.frmBudgetSegResults.RawRepresents.ThrDoDAreaDetectableChange:
                totalDepositionArea = allStats.Sum(x => x.DepositionThr.GetArea(ca).As(options.AreaUnits));
                break;

            case BudgetSegregation.frmBudgetSegResults.RawRepresents.RawClassAreaOfInterest:
                totalDepositionArea = activeStats.DepositionRaw.GetArea(ca).As(options.AreaUnits);
                break;
            }
            grdData.Rows[2].Cells[colTot].Value = SafePercent(classDepositionArea, totalDepositionArea) / 100f;

            // VOLUME

            // Erosion
            double classErosionVol = activeStats.ErosionThr.GetVolume(ca, activeStats.StatsUnits).As(options.VolumeUnits);
            double totalErosionVol = classErosionVol;

            switch (raw)
            {
            case BudgetSegregation.frmBudgetSegResults.RawRepresents.RawDoDAreaOfInterest:
                totalErosionVol = allStats.Sum(x => x.ErosionRaw.GetVolume(ca, activeStats.StatsUnits).As(options.VolumeUnits));
                break;

            case BudgetSegregation.frmBudgetSegResults.RawRepresents.ThrDoDAreaDetectableChange:
                totalErosionVol = allStats.Sum(x => x.ErosionThr.GetVolume(ca, activeStats.StatsUnits).As(options.VolumeUnits));
                break;

            case BudgetSegregation.frmBudgetSegResults.RawRepresents.RawClassAreaOfInterest:
                totalErosionVol = activeStats.ErosionRaw.GetVolume(ca, activeStats.StatsUnits).As(options.VolumeUnits);
                break;
            }
            grdData.Rows[7].Cells[colTot].Value = SafePercent(classErosionVol, totalErosionVol) / 100f;

            // Deposition
            double classDepositionVol = activeStats.DepositionThr.GetVolume(ca, activeStats.StatsUnits).As(options.VolumeUnits);
            double totalDepositionVol = classDepositionVol;

            switch (raw)
            {
            case BudgetSegregation.frmBudgetSegResults.RawRepresents.RawDoDAreaOfInterest:
                totalDepositionVol = allStats.Sum(x => x.DepositionRaw.GetVolume(ca, activeStats.StatsUnits).As(options.VolumeUnits));
                break;

            case BudgetSegregation.frmBudgetSegResults.RawRepresents.ThrDoDAreaDetectableChange:
                totalDepositionVol = allStats.Sum(x => x.DepositionThr.GetVolume(ca, activeStats.StatsUnits).As(options.VolumeUnits));
                break;

            case BudgetSegregation.frmBudgetSegResults.RawRepresents.RawClassAreaOfInterest:
                totalDepositionVol = activeStats.DepositionRaw.GetVolume(ca, activeStats.StatsUnits).As(options.VolumeUnits);
                break;
            }
            grdData.Rows[8].Cells[colTot].Value = SafePercent(classDepositionVol, totalDepositionVol) / 100f;

            // Vol of Difference
            double classVolDiff = activeStats.VolumeOfDifference_Thresholded.As(options.VolumeUnits);
            double totalVolDiff = classVolDiff;

            switch (raw)
            {
            case BudgetSegregation.frmBudgetSegResults.RawRepresents.RawDoDAreaOfInterest:
                totalVolDiff = allStats.Sum(x => x.VolumeOfDifference_Raw.As(options.VolumeUnits));
                break;

            case BudgetSegregation.frmBudgetSegResults.RawRepresents.ThrDoDAreaDetectableChange:
                totalVolDiff = allStats.Sum(x => x.VolumeOfDifference_Thresholded.As(options.VolumeUnits));
                break;

            case BudgetSegregation.frmBudgetSegResults.RawRepresents.RawClassAreaOfInterest:
                totalVolDiff = activeStats.VolumeOfDifference_Raw.As(options.VolumeUnits);
                break;
            }
            grdData.Rows[9].Cells[colTot].Value = SafePercent(classVolDiff, totalVolDiff) / 100f;

            // Net Vol of Difference
            double classNetVolDiff = activeStats.NetVolumeOfDifference_Thresholded.As(options.VolumeUnits);
            double totalNetVolDiff = classNetVolDiff;

            switch (raw)
            {
            case BudgetSegregation.frmBudgetSegResults.RawRepresents.RawDoDAreaOfInterest:
                totalNetVolDiff = allStats.Sum(x => x.NetVolumeOfDifference_Raw.As(options.VolumeUnits));
                break;

            case BudgetSegregation.frmBudgetSegResults.RawRepresents.ThrDoDAreaDetectableChange:
                totalNetVolDiff = allStats.Sum(x => x.NetVolumeOfDifference_Thresholded.As(options.VolumeUnits));
                break;

            case BudgetSegregation.frmBudgetSegResults.RawRepresents.RawClassAreaOfInterest:
                totalNetVolDiff = activeStats.NetVolumeOfDifference_Raw.As(options.VolumeUnits);
                break;
            }
            grdData.Rows[10].Cells[colTot].Value = SafePercent(classNetVolDiff, totalNetVolDiff) / 100f;
        }
コード例 #11
0
ファイル: ucDoDSummary.cs プロジェクト: tarinishukla/gcd
        public void RefreshDisplay(GCDConsoleLib.GCD.DoDStats dodStats, DoDSummaryDisplayOptions options)
        {
            // Hide the % total column in single DoD View
            grdData.Columns[colTot].Visible = false;
            grdData.Rows.Clear();
            DataGridViewRow aRow = null;

            // Build the string formatting based on the precision in the pop-up properties form
            string sFormat = GetFormatString(options);

            UnitsNet.Area             ca    = ProjectManager.Project.CellArea;
            UnitsNet.Units.LengthUnit vunit = ProjectManager.Project.Units.VertUnit;

            // Now we know the desired format precision we can assign it to all the numeric columns
            for (int i = 1; i < grdData.Columns.Count; i++)
            {
                grdData.Columns[i].DefaultCellStyle.Format = sFormat;

                if (grdData.Columns[i] == colErrorPC || grdData.Columns[i] == colPCTotal)
                {
                    grdData.Columns[i].DefaultCellStyle.Format += "%";
                }
                else if (grdData.Columns[i] == colError)
                {
                    grdData.Columns[i].DefaultCellStyle.Format = "±" + sFormat;
                }
            }

            ////////////////////////////////////////////////////////////////////////////////////////////////////
            // Show/hide columns based on the properties pop-up
            colRawDoD.Visible      = options.m_bColsRaw;
            colThresholded.Visible = options.m_bColsThresholded;
            colError.Visible       = options.m_bColsPMError;
            colErrorPC.Visible     = options.m_bColsPCError;

            ////////////////////////////////////////////////////////////////////////////////////////////////////
            // Area of erosion header

            if (options.m_eRowGroups == DoDSummaryDisplayOptions.RowGroups.ShowAll || (options.m_eRowGroups == DoDSummaryDisplayOptions.RowGroups.SpecificGroups && options.m_bRowsAreal))
            {
                aRow = grdData.Rows[grdData.Rows.Add()];
                aRow.Cells[colAtt].Value      = "AREAL";
                aRow.Cells[colAtt].Style.Font = new System.Drawing.Font(grdData.Font, System.Drawing.FontStyle.Bold);

                // Area of erosion
                aRow = grdData.Rows[grdData.Rows.Add()];
                aRow.Cells[colAtt].Value           = "Total Area of Surface Lowering (" + UnitsNet.Area.GetAbbreviation(options.AreaUnits) + ")";
                aRow.Cells[colAtt].ToolTipText     = "The amount of area experiencing a lowering of surface elevations";
                aRow.Cells[colRaw].Value           = dodStats.ErosionRaw.GetArea(ca).As(options.AreaUnits);
                aRow.Cells[colThr].Value           = dodStats.ErosionThr.GetArea(ca).As(options.AreaUnits);
                aRow.Cells[colErr].Style.BackColor = System.Drawing.Color.LightGray;
                aRow.Cells[colEPC].Style.BackColor = System.Drawing.Color.LightGray;

                // Area of deposition
                aRow = grdData.Rows[grdData.Rows.Add()];
                aRow.Cells[colAtt].Value           = "Total Area of Surface Raising (" + UnitsNet.Area.GetAbbreviation(options.AreaUnits) + ")";
                aRow.Cells[colAtt].ToolTipText     = "The amount of area experiencing an increase of surface elevations";
                aRow.Cells[colRaw].Value           = dodStats.DepositionRaw.GetArea(ca).As(options.AreaUnits);
                aRow.Cells[colThr].Value           = dodStats.DepositionThr.GetArea(ca).As(options.AreaUnits);
                aRow.Cells[colErr].Style.BackColor = System.Drawing.Color.LightGray;
                aRow.Cells[colEPC].Style.BackColor = System.Drawing.Color.LightGray;

                // Area of detectable change
                aRow = grdData.Rows[grdData.Rows.Add()];
                aRow.Cells[colAtt].Value           = "Total Area of Detectable Change (" + UnitsNet.Area.GetAbbreviation(options.AreaUnits) + ")";
                aRow.Cells[colAtt].ToolTipText     = "The sum of areas experiencing detectable lowering and raising";
                aRow.Cells[colRaw].Value           = "NA";
                aRow.Cells[colThr].Value           = dodStats.AreaDetectableChange_Thresholded.As(options.AreaUnits);
                aRow.Cells[colErr].Style.BackColor = System.Drawing.Color.LightGray;
                aRow.Cells[colEPC].Style.BackColor = System.Drawing.Color.LightGray;

                // Area of interest
                aRow = grdData.Rows[grdData.Rows.Add()];
                aRow.Cells[colAtt].Value           = "Total Area of Interest (" + UnitsNet.Area.GetAbbreviation(options.AreaUnits) + ")";
                aRow.Cells[colAtt].ToolTipText     = "The total amount of area under analysis (including detectable and undetectable)";
                aRow.Cells[colRaw].Value           = dodStats.AreaOfInterest_Raw.As(options.AreaUnits);
                aRow.Cells[colThr].Value           = "NA";
                aRow.Cells[colThr].Style.BackColor = System.Drawing.Color.LightGray;
                aRow.Cells[colErr].Style.BackColor = System.Drawing.Color.LightGray;
                aRow.Cells[colEPC].Style.BackColor = System.Drawing.Color.LightGray;

                // Percent of area of interest with detectable change
                aRow = grdData.Rows[grdData.Rows.Add()];
                aRow.Cells[colAtt].Value           = "Percent of Area of Interest with Detectable Change";
                aRow.Cells[colAtt].ToolTipText     = "The percent of the total area of interest with detectable changes (i.e. either exceeding the minimum level of detection or with a proability greater then the confidence interval chosen by user)";
                aRow.Cells[colRaw].Value           = "NA";
                aRow.Cells[colRaw].Style.BackColor = System.Drawing.Color.LightGray;
                aRow.Cells[colThr].Value           = dodStats.AreaPercentAreaInterestWithDetectableChange.ToString(sFormat) + "%";
                aRow.Cells[colErr].Style.BackColor = System.Drawing.Color.LightGray;
                aRow.Cells[colEPC].Style.BackColor = System.Drawing.Color.LightGray;
            }

            ////////////////////////////////////////////////////////////////////////////////////////////////////
            // VOLUMETRIC

            if (options.m_eRowGroups == DoDSummaryDisplayOptions.RowGroups.ShowAll || options.m_eRowGroups == DoDSummaryDisplayOptions.RowGroups.Normalized || (options.m_eRowGroups == DoDSummaryDisplayOptions.RowGroups.SpecificGroups && options.m_bRowsVolumetric))
            {
                // Volume of erosion header
                aRow = grdData.Rows[grdData.Rows.Add()];
                aRow.Cells[colAtt].Value      = "VOLUMETRIC";
                aRow.Cells[colAtt].Style.Font = new System.Drawing.Font(grdData.Font, System.Drawing.FontStyle.Bold);
            }

            if (options.m_eRowGroups == DoDSummaryDisplayOptions.RowGroups.ShowAll || (options.m_eRowGroups == DoDSummaryDisplayOptions.RowGroups.SpecificGroups && options.m_bRowsVolumetric))
            {
                // Volume of erosion
                aRow = grdData.Rows[grdData.Rows.Add()];
                aRow.Cells[colAtt].Value       = "Total Volume of Surface Lowering (" + UnitsNet.Volume.GetAbbreviation(options.VolumeUnits) + ")";
                aRow.Cells[colAtt].ToolTipText = "On a cell-by-cell basis, the DoD surface lowering depth (e.g. erosion, cut or deflation) multiplied by cell area and summed";
                aRow.Cells[colRaw].Value       = dodStats.ErosionRaw.GetVolume(ca, dodStats.StatsUnits).As(options.VolumeUnits);
                aRow.Cells[colThr].Value       = dodStats.ErosionThr.GetVolume(ca, dodStats.StatsUnits).As(options.VolumeUnits);
                aRow.Cells[colErr].Value       = dodStats.ErosionErr.GetVolume(ca, dodStats.StatsUnits).As(options.VolumeUnits);
                aRow.Cells[colEPC].Value       = dodStats.VolumeOfErosion_Percent / 100m;

                // Volume of deposition
                aRow = grdData.Rows[grdData.Rows.Add()];
                aRow.Cells[colAtt].Value       = "Total Volume of Surface Raising (" + UnitsNet.Volume.GetAbbreviation(options.VolumeUnits) + ")";
                aRow.Cells[colAtt].ToolTipText = "On a cell-by-cell basis, the DoD surface raising (e.g. deposition, fill or inflation) depth multiplied by cell area and summed";
                aRow.Cells[colRaw].Value       = dodStats.DepositionRaw.GetVolume(ca, dodStats.StatsUnits).As(options.VolumeUnits);
                aRow.Cells[colThr].Value       = dodStats.DepositionThr.GetVolume(ca, dodStats.StatsUnits).As(options.VolumeUnits);
                aRow.Cells[colErr].Value       = dodStats.DepositionErr.GetVolume(ca, dodStats.StatsUnits).As(options.VolumeUnits);
                aRow.Cells[colEPC].Value       = dodStats.VolumeOfDeposition_Percent / 100m;

                // Total volume of difference
                aRow = grdData.Rows[grdData.Rows.Add()];
                aRow.Cells[colAtt].Value       = "Total Volume of Difference (" + UnitsNet.Volume.GetAbbreviation(options.VolumeUnits) + ")";
                aRow.Cells[colAtt].ToolTipText = "The sum of lowering and raising volumes (a measure of total turnover)";
                aRow.Cells[colRaw].Value       = dodStats.VolumeOfDifference_Raw.As(options.VolumeUnits);
                aRow.Cells[colThr].Value       = dodStats.VolumeOfDifference_Thresholded.As(options.VolumeUnits);
                aRow.Cells[colErr].Value       = dodStats.VolumeOfDifference_Error.As(options.VolumeUnits);
                aRow.Cells[colEPC].Value       = dodStats.VolumeOfDifference_Percent / 100m;
            }


            if (options.m_eRowGroups == DoDSummaryDisplayOptions.RowGroups.ShowAll || options.m_eRowGroups == DoDSummaryDisplayOptions.RowGroups.Normalized || (options.m_eRowGroups == DoDSummaryDisplayOptions.RowGroups.SpecificGroups && options.m_bRowsVolumetric))
            {
                //Total NET volume difference
                aRow = grdData.Rows[grdData.Rows.Add()];
                aRow.Cells[colAtt].Value       = "Total Net Volume Difference (" + UnitsNet.Volume.GetAbbreviation(options.VolumeUnits) + ")";
                aRow.Cells[colAtt].ToolTipText = "The net difference of erosion and depostion volumes (i.e. deposition minus erosion)";
                aRow.Cells[colRaw].Value       = dodStats.NetVolumeOfDifference_Raw.As(options.VolumeUnits);
                aRow.Cells[colThr].Value       = dodStats.NetVolumeOfDifference_Thresholded.As(options.VolumeUnits);
                aRow.Cells[colErr].Value       = dodStats.NetVolumeOfDifference_Error.As(options.VolumeUnits);
                aRow.Cells[colEPC].Value       = dodStats.NetVolumeOfDifference_Percent / 100m;
            }

            ////////////////////////////////////////////////////////////////////////////////////////////////////
            // VERTICAL AVERAGES

            if (options.m_eRowGroups == DoDSummaryDisplayOptions.RowGroups.ShowAll || options.m_eRowGroups == DoDSummaryDisplayOptions.RowGroups.Normalized || (options.m_eRowGroups == DoDSummaryDisplayOptions.RowGroups.SpecificGroups && options.m_bRowsVerticalAverages))
            {
                // Vertical Averages header
                aRow = grdData.Rows[grdData.Rows.Add()];
                aRow.Cells[colAtt].Value      = "VERTICAL AVERAGES";
                aRow.Cells[colAtt].Style.Font = new System.Drawing.Font(grdData.Font, System.Drawing.FontStyle.Bold);
            }

            if (options.m_eRowGroups == DoDSummaryDisplayOptions.RowGroups.ShowAll || options.m_eRowGroups == DoDSummaryDisplayOptions.RowGroups.SpecificGroups && options.m_bRowsVerticalAverages)
            {
                // Average Depth of Erosion
                aRow = grdData.Rows[grdData.Rows.Add()];
                aRow.Cells[colAtt].Value       = "Average Depth of Surface Lowering (" + UnitsNet.Length.GetAbbreviation(options.LinearUnits) + ")";
                aRow.Cells[colAtt].ToolTipText = "The average depth of lowering (lowering volume divided by lowering area)";
                aRow.Cells[colRaw].Value       = dodStats.AverageDepthErosion_Raw.As(options.LinearUnits);
                aRow.Cells[colThr].Value       = dodStats.AverageDepthErosion_Thresholded.As(options.LinearUnits);
                aRow.Cells[colErr].Value       = dodStats.AverageDepthErosion_Error.As(options.LinearUnits);
                aRow.Cells[colEPC].Value       = dodStats.AverageDepthErosion_Percent / 100m;

                // Average Depth of Deposition
                aRow = grdData.Rows[grdData.Rows.Add()];
                aRow.Cells[colAtt].Value       = "Average Depth of Surface Raising (" + UnitsNet.Length.GetAbbreviation(options.LinearUnits) + ")";
                aRow.Cells[colAtt].ToolTipText = "The average depth of raising (raising volume divided by raising area)";
                aRow.Cells[colRaw].Value       = dodStats.AverageDepthDeposition_Raw.As(options.LinearUnits);
                aRow.Cells[colThr].Value       = dodStats.AverageDepthDeposition_Thresholded.As(options.LinearUnits);
                aRow.Cells[colErr].Value       = dodStats.AverageDepthDeposition_Error.As(options.LinearUnits);
                aRow.Cells[colEPC].Value       = dodStats.AverageDepthDeposition_Percent / 100m;

                // Average Total Thickness of Difference for AOI
                aRow = grdData.Rows[grdData.Rows.Add()];
                aRow.Cells[colAtt].Value       = "Average Total Thickness of Difference (" + UnitsNet.Length.GetAbbreviation(options.LinearUnits) + ") for Area of Interest";
                aRow.Cells[colAtt].ToolTipText = "The total volume of difference divided by the area of interest (a measure of total turnover thickness in the analysis area)";
                aRow.Cells[colRaw].Value       = dodStats.AverageThicknessOfDifferenceAOI_Raw.As(options.LinearUnits);
                aRow.Cells[colThr].Value       = dodStats.AverageThicknessOfDifferenceAOI_Thresholded.As(options.LinearUnits);
                aRow.Cells[colErr].Value       = dodStats.AverageThicknessOfDifferenceAOI_Error.As(options.LinearUnits);
                aRow.Cells[colEPC].Value       = dodStats.AverageThicknessOfDifferenceAOI_Percent / 100m;
            }

            if (options.m_eRowGroups == DoDSummaryDisplayOptions.RowGroups.ShowAll || options.m_eRowGroups == DoDSummaryDisplayOptions.RowGroups.Normalized || (options.m_eRowGroups == DoDSummaryDisplayOptions.RowGroups.SpecificGroups && options.m_bRowsVerticalAverages))
            {
                // Average **NET** Thickness of Difference AOI
                aRow = grdData.Rows[grdData.Rows.Add()];
                aRow.Cells[colAtt].Value       = "Average Net Thickness of Difference (" + UnitsNet.Length.GetAbbreviation(options.LinearUnits) + ") for Area of Interest";
                aRow.Cells[colAtt].ToolTipText = "The total net volume of difference divided by the area of interest (a measure of resulting net change within the analysis area)";
                aRow.Cells[colRaw].Value       = dodStats.AverageNetThicknessofDifferenceAOI_Raw.As(options.LinearUnits);
                aRow.Cells[colThr].Value       = dodStats.AverageNetThicknessOfDifferenceAOI_Thresholded.As(options.LinearUnits);
                aRow.Cells[colErr].Value       = dodStats.AverageNetThicknessOfDifferenceAOI_Error.As(options.LinearUnits);
                aRow.Cells[colEPC].Value       = dodStats.AverageNetThicknessOfDifferenceAOI_Percent / 100m;
            }

            if (options.m_eRowGroups == DoDSummaryDisplayOptions.RowGroups.ShowAll || options.m_eRowGroups == DoDSummaryDisplayOptions.RowGroups.SpecificGroups && options.m_bRowsVerticalAverages)
            {
                // Average Thickness of Difference ADC
                aRow = grdData.Rows[grdData.Rows.Add()];
                aRow.Cells[colAtt].Value           = "Average Total Thickness of Difference (" + UnitsNet.Length.GetAbbreviation(options.LinearUnits) + ") for Area with Detectable Change";
                aRow.Cells[colAtt].ToolTipText     = "The total volume of difference divided by the total area of detectable change (a measure of total turnover thickness where there was detectable change)";
                aRow.Cells[colRaw].Value           = "NA";
                aRow.Cells[colRaw].Style.BackColor = System.Drawing.Color.LightGray;
                aRow.Cells[colThr].Value           = dodStats.AverageThicknessOfDifferenceADC_Thresholded.As(options.LinearUnits);
                aRow.Cells[colErr].Value           = dodStats.AverageThicknessOfDifferenceADC_Error.As(options.LinearUnits);
                aRow.Cells[colEPC].Value           = dodStats.AverageThicknessOfDifferenceADC_Percent / 100m;
            }

            if (options.m_eRowGroups == DoDSummaryDisplayOptions.RowGroups.ShowAll || options.m_eRowGroups == DoDSummaryDisplayOptions.RowGroups.Normalized || (options.m_eRowGroups == DoDSummaryDisplayOptions.RowGroups.SpecificGroups && options.m_bRowsVerticalAverages))
            {
                // Average **NET** Thickness of Difference ADC
                aRow = grdData.Rows[grdData.Rows.Add()];
                aRow.Cells[colAtt].Value           = "Average Net Thickness of Difference (" + UnitsNet.Length.GetAbbreviation(options.LinearUnits) + ") for Area with Detectable Change";
                aRow.Cells[colAtt].ToolTipText     = "The total net volume of difference divided by the total area of detectable change (a measure of resulting net change where the was detectable change)";
                aRow.Cells[colRaw].Value           = "NA";
                aRow.Cells[colRaw].Style.BackColor = System.Drawing.Color.LightGray;
                aRow.Cells[colThr].Value           = dodStats.AverageNetThicknessOfDifferenceADC_Thresholded.As(options.LinearUnits);
                aRow.Cells[colErr].Value           = dodStats.AverageNetThicknessOfDifferenceADC_Error.As(options.LinearUnits);
                aRow.Cells[colEPC].Value           = dodStats.AverageNetThicknessOfDifferenceADC_Percent / 100m;
            }

            if (options.m_eRowGroups == DoDSummaryDisplayOptions.RowGroups.ShowAll || (options.m_eRowGroups == DoDSummaryDisplayOptions.RowGroups.SpecificGroups && options.m_bRowsPercentages))
            {
                ///'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
                // Percentages by Volume
                aRow = grdData.Rows[grdData.Rows.Add()];
                aRow.Cells[colAtt].Value      = "PERCENTAGES (BY VOLUME)";
                aRow.Cells[colAtt].Style.Font = new System.Drawing.Font(grdData.Font, System.Drawing.FontStyle.Bold);

                // Percent Erosion
                aRow = grdData.Rows[grdData.Rows.Add()];
                aRow.Cells[colAtt].Value           = "Percent Elevation Lowering";
                aRow.Cells[colAtt].ToolTipText     = "Percent of Total Volume of Difference that is surface lowering";
                aRow.Cells[colRaw].Value           = dodStats.PercentErosion_Raw;
                aRow.Cells[colThr].Value           = dodStats.PercentErosion_Thresholded;
                aRow.Cells[colErr].Style.BackColor = System.Drawing.Color.LightGray;
                aRow.Cells[colEPC].Style.BackColor = System.Drawing.Color.LightGray;
                aRow.Cells[colTot].Style.BackColor = System.Drawing.Color.LightGray;

                // Percent Deposition
                aRow = grdData.Rows[grdData.Rows.Add()];
                aRow.Cells[colAtt].Value           = "Percent Elevation Raising";
                aRow.Cells[colAtt].ToolTipText     = "Percent of Total Volume of Difference that is surface raising";
                aRow.Cells[colRaw].Value           = dodStats.PercentDeposition_Raw;
                aRow.Cells[colThr].Value           = dodStats.PercentDeposition_Thresholded;
                aRow.Cells[colErr].Style.BackColor = System.Drawing.Color.LightGray;
                aRow.Cells[colEPC].Style.BackColor = System.Drawing.Color.LightGray;
                aRow.Cells[colTot].Style.BackColor = System.Drawing.Color.LightGray;

                // Percent Imbalance
                aRow = grdData.Rows[grdData.Rows.Add()];
                aRow.Cells[colAtt].Value           = "Percent Imbalance (departure from equilibium)";
                aRow.Cells[colAtt].ToolTipText     = "The percent depature from a 50%-50% equilibirum lowering/raising (i.e. erosion/deposition) balance (a normalized indication of the magnitude of the net difference)";
                aRow.Cells[colRaw].Value           = dodStats.PercentImbalance_Raw;
                aRow.Cells[colThr].Value           = dodStats.PercentImbalance_Thresholded;
                aRow.Cells[colErr].Style.BackColor = System.Drawing.Color.LightGray;
                aRow.Cells[colEPC].Style.BackColor = System.Drawing.Color.LightGray;
                aRow.Cells[colTot].Style.BackColor = System.Drawing.Color.LightGray;

                // Net to Total Volume Ratio
                aRow = grdData.Rows[grdData.Rows.Add()];
                aRow.Cells[colAtt].Value           = "Net to Total Volume Ratio";
                aRow.Cells[colAtt].ToolTipText     = "The ratio of net volumetric change divided by total volume of change (a measure of how much the net trend explains of the total turnover)";
                aRow.Cells[colRaw].Value           = dodStats.NetToTotalVolumeRatio_Raw;
                aRow.Cells[colThr].Value           = dodStats.NetToTotalVolumeRatio_Thresholded;
                aRow.Cells[colErr].Style.BackColor = System.Drawing.Color.LightGray;
                aRow.Cells[colEPC].Style.BackColor = System.Drawing.Color.LightGray;
                aRow.Cells[colTot].Style.BackColor = System.Drawing.Color.LightGray;
            }

            for (int rowIndex = 1; rowIndex < grdData.Rows.Count; rowIndex++)
            {
                for (int colIndex = 1; colIndex < grdData.Columns.Count; colIndex++)
                {
                    //if (rowIndex == 0)
                    //{
                    //    grdData.Rows[rowIndex].Cells[colIndex].Style.Font = new System.Drawing.Font(grdData.Font, System.Drawing.FontStyle.Bold);
                    //    grdData.Rows[rowIndex].Cells[colIndex].Style.Alignment = DataGridViewContentAlignment.MiddleCenter;
                    //}
                    //else
                    //{
                    if (grdData.Rows[rowIndex].Cells[colIndex].Value != null)
                    {
                        // Assign the copy to clipboard context menu to non-null cells
                        grdData.Rows[rowIndex].Cells[colIndex].ContextMenuStrip = cmsCopy;
                    }
                    //}
                }
            }
        }
コード例 #12
0
ファイル: GCDUnits.cs プロジェクト: tarinishukla/gcd
 private static void AddUnit(Dictionary <string, UnitsNet.Units.LengthUnit> dict, UnitsNet.Units.LengthUnit unit)
 {
     dict[Regex.Replace(unit.ToString(), "(\\B[A-Z])", " $1")] = unit;
 }