private void RefreshBars(object sender, EventArgs e) { if (!(cboType.SelectedItem is naru.db.NamedObject) || ProjectManager.Project == null) { return; } ElevationChangeBarViewer.BarTypes eType = (ElevationChangeBarViewer.BarTypes)Convert.ToInt32(((naru.db.NamedObject)cboType.SelectedItem).ID); UnitsNet.Area ca = ProjectManager.Project.CellArea; switch (eType) { case ElevationChangeBarViewer.BarTypes.Area: Viewer.Refresh(m_chngStats.ErosionThr.GetArea(ca).As(DisplayUnits.ArUnit), m_chngStats.DepositionThr.GetArea(ca).As(DisplayUnits.ArUnit), UnitsNet.Area.GetAbbreviation(DisplayUnits.ArUnit), eType, rdoAbsolute.Checked); break; case ElevationChangeBarViewer.BarTypes.Volume: Viewer.Refresh(m_chngStats.ErosionThr.GetVolume(ca, m_chngStats.StatsUnits.VertUnit).As(DisplayUnits.VolUnit), m_chngStats.DepositionThr.GetVolume(ca, m_chngStats.StatsUnits.VertUnit).As(DisplayUnits.VolUnit), m_chngStats.NetVolumeOfDifference_Thresholded.As(DisplayUnits.VolUnit), m_chngStats.ErosionErr.GetVolume(ca, m_chngStats.StatsUnits.VertUnit).As(DisplayUnits.VolUnit), m_chngStats.DepositionErr.GetVolume(ca, m_chngStats.StatsUnits.VertUnit).As(DisplayUnits.VolUnit), m_chngStats.NetVolumeOfDifference_Error.As(DisplayUnits.VolUnit), UnitsNet.Volume.GetAbbreviation(DisplayUnits.VolUnit), eType, rdoAbsolute.Checked); break; case ElevationChangeBarViewer.BarTypes.Vertical: Viewer.Refresh(m_chngStats.AverageDepthErosion_Thresholded.As(DisplayUnits.VertUnit), m_chngStats.AverageDepthDeposition_Thresholded.As(DisplayUnits.VertUnit), m_chngStats.AverageThicknessOfDifferenceADC_Thresholded.As(DisplayUnits.VertUnit), m_chngStats.AverageThicknessOfDifferenceADC_Error.As(DisplayUnits.VertUnit), m_chngStats.AverageDepthErosion_Error.As(DisplayUnits.VertUnit), m_chngStats.AverageNetThicknessOfDifferenceADC_Error.As(DisplayUnits.VertUnit), UnitsNet.Length.GetAbbreviation(DisplayUnits.VertUnit), eType, rdoAbsolute.Checked); break; } }
public bool Compute() { UnitsNet.Length[] sample = new UnitsNet.Length[NumberOfParameters]; for (int j = 0; j < Iterations; j++) { for (int i = 0; i < sample.Length; i++) { sample[i] = UnitsNet.Length.FromCentimeters(Random.NextDouble() * Range[i].Length.Centimeters + Range[i].Min.Centimeters); } UnitsNet.Length f = Function(sample); count++; sum += f; sum2 += f * f; } double volume = 1; for (int i = 0; i < Range.Length; i++) { volume *= Range[i].Length.Centimeters; } double avg = sum.Centimeters / count; double avg2 = sum2.SquareCentimeters / count; Area = UnitsNet.Area.FromSquareCentimeters(volume * avg); Error = UnitsNet.Area.FromSquareCentimeters(volume * Math.Sqrt((avg2 - avg * avg) / count)); return(true); }
/// <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); }
public void Reset() { this.sum = UnitsNet.Length.FromCentimeters(0); this.sum2 = UnitsNet.Area.FromSquareCentimeters(0); this.count = 0; this.Area = UnitsNet.Area.FromSquareCentimeters(0); this.Error = UnitsNet.Area.FromSquareCentimeters(Double.MaxValue); }
/// <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; } }
public GCDProject(string name, string description, FileInfo projectFile, DateTime dtCreated, string gcdVersion, UnitsNet.Area cellArea, GCDConsoleLib.GCD.UnitGroup units) : base(name) { Description = description; ProjectFile = projectFile; DateTimeCreated = dtCreated; GCDVersion = gcdVersion; Units = units; CellArea = cellArea; DEMSurveys = new List <DEMSurvey>(); ReferenceSurfaces = new List <Surface>(); Masks = new List <Masks.Mask>(); DoDs = new List <DoDBase>(); InterComparisons = new List <InterComparison>(); ProfileRoutes = new List <ProfileRoutes.ProfileRoute>(); MetaData = new Dictionary <string, string>(); OnlineParams = new Dictionary <string, string>(); }
/// <summary> /// Deserialize change statistics /// </summary> /// <param name="nodStatistics"></param> /// <param name="cellArea"></param> /// <param name="units"></param> /// <returns></returns> /// <remarks>This is used by budget segregations and so needs to be static and public</remarks> public static DoDStats DeserializeStatistics(XmlNode nodStatistics, UnitsNet.Area cellArea, UnitGroup units) { UnitsNet.Area AreaErosion_Raw = UnitsNet.Area.From(double.Parse(nodStatistics.SelectSingleNode("Erosion/Raw/Area").InnerText), units.ArUnit); UnitsNet.Area AreaDeposit_Raw = UnitsNet.Area.From(double.Parse(nodStatistics.SelectSingleNode("Deposition/Raw/Area").InnerText), units.ArUnit); UnitsNet.Area AreaErosion_Thr = UnitsNet.Area.From(double.Parse(nodStatistics.SelectSingleNode("Erosion/Thresholded/Area").InnerText), units.ArUnit); UnitsNet.Area AreaDeposit_Thr = UnitsNet.Area.From(double.Parse(nodStatistics.SelectSingleNode("Deposition/Thresholded/Area").InnerText), units.ArUnit); UnitsNet.Volume VolErosion_Raw = UnitsNet.Volume.From(double.Parse(nodStatistics.SelectSingleNode("Erosion/Raw/Volume").InnerText), units.VolUnit); UnitsNet.Volume VolDeposit_Raw = UnitsNet.Volume.From(double.Parse(nodStatistics.SelectSingleNode("Deposition/Raw/Volume").InnerText), units.VolUnit); UnitsNet.Volume VolErosion_Thr = UnitsNet.Volume.From(double.Parse(nodStatistics.SelectSingleNode("Erosion/Thresholded/Volume").InnerText), units.VolUnit); UnitsNet.Volume VolDeposit_Thr = UnitsNet.Volume.From(double.Parse(nodStatistics.SelectSingleNode("Deposition/Thresholded/Volume").InnerText), units.VolUnit); UnitsNet.Volume VolErosion_Err = UnitsNet.Volume.From(double.Parse(nodStatistics.SelectSingleNode("Erosion/Error/Volume").InnerText), units.VolUnit); UnitsNet.Volume VolDeposit_Err = UnitsNet.Volume.From(double.Parse(nodStatistics.SelectSingleNode("Deposition/Error/Volume").InnerText), units.VolUnit); return(new DoDStats( AreaErosion_Raw, AreaDeposit_Raw, AreaErosion_Thr, AreaDeposit_Thr, VolErosion_Raw, VolDeposit_Raw, VolErosion_Thr, VolDeposit_Thr, VolErosion_Err, VolDeposit_Err, cellArea, units)); }
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); }
private static void SerializeAreaVolume(XmlDocument xmlDoc, XmlNode nodParent, GCDAreaVolume areaVol, UnitGroup units, UnitsNet.Area cellArea) { nodParent.AppendChild(xmlDoc.CreateElement("Area")).InnerText = areaVol.GetArea(cellArea).As(units.ArUnit).ToString("R"); nodParent.AppendChild(xmlDoc.CreateElement("Volume")).InnerText = areaVol.GetVolume(cellArea, units.VertUnit).As(units.VolUnit).ToString("R"); }
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); }
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; }
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; } //} } } }