public DoDSummaryDisplayOptions(GCDConsoleLib.GCD.UnitGroup dataUnits) { m_Units = dataUnits; m_nPrecision = 2; m_eRowGroups = RowGroups.ShowAll; m_bRowsAreal = true; m_bRowsVolumetric = true; m_bRowsVerticalAverages = true; m_bRowsPercentages = true; m_bColsRaw = true; m_bColsThresholded = true; m_bColsPMError = true; m_bColsPCError = true; Font = Properties.Settings.Default.ChartFont; AutomatedYAxisScale = true; }
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>(); }
public void UpdateDisplay(bool bArea, GCDConsoleLib.GCD.UnitGroup displayUnits = null) { // Store the display units so that the user can switch between area and volume easily if (displayUnits != null) { DisplayUnits = displayUnits; } // Go recalc our values GetDisplayValues(bArea); Chart.Series.FindByName(EROSION).Points.DataBindXY(histoData.Values, "Elevation", histoData.Values, "Erosion"); Chart.Series.FindByName(DEPOSITION).Points.DataBindXY(histoData.Values, "Elevation", histoData.Values, "Deposition"); Chart.Series.FindByName(RAW).Points.DataBindXY(histoData.Values, "Elevation", histoData.Values, "Raw"); double binWidth = _thrHist.BinWidth(Project.ProjectManager.Project.Units).As(DisplayUnits.VertUnit); Axis axisX = Chart.ChartAreas[0].AxisX; axisX.Title = string.Format("Elevation Change ({0})", UnitsNet.Length.GetAbbreviation(DisplayUnits.VertUnit)); axisX.Minimum = _thrHist.BinLower(_thrHist.FirstBinId, Project.ProjectManager.Project.Units).As(DisplayUnits.VertUnit); axisX.Maximum = _thrHist.BinLower(_thrHist.LastBinId, Project.ProjectManager.Project.Units).As(DisplayUnits.VertUnit) + binWidth; axisX.MajorGrid.Interval = 10 * binWidth; axisX.MajorGrid.IntervalOffset = binWidth; axisX.Interval = 10 * binWidth; axisX.IntervalOffset = binWidth; axisX.MinorGrid.Interval = binWidth; if (bArea) { Chart.ChartAreas[0].AxisY.Title = string.Format("Area ({0})", UnitsNet.Area.GetAbbreviation(DisplayUnits.ArUnit)); } else { Chart.ChartAreas[0].AxisY.Title = string.Format("Volume ({0})", UnitsNet.Volume.GetAbbreviation(DisplayUnits.VolUnit)); } Chart.ChartAreas[0].RecalculateAxesScale(); Chart.ChartAreas[0].AxisY.RoundAxisValues(); }
/// <summary> /// Call this constructor from non-UI code that simply wants to generate histogram plot image files /// </summary> public DoDHistogramViewer(Histogram rawHisto, Histogram thrHisto, GCDConsoleLib.GCD.UnitGroup dataUnits, Chart chtControl = null) : base(chtControl) { DataUnits = dataUnits; DisplayUnits = dataUnits; Dictionary <string, Color> seriesDefs = new Dictionary <string, Color> { { EROSION, Project.ProjectManager.ColorErosion }, { DEPOSITION, Project.ProjectManager.ColorDeposition }, { RAW, Color.LightGray } }; foreach (KeyValuePair <string, Color> aDef in seriesDefs) { Series series = Chart.Series.Add(aDef.Key); series.ChartType = SeriesChartType.StackedColumn; series.Color = aDef.Value; series.ChartArea = Chart.ChartAreas.First().Name; } Axis x = Chart.ChartAreas[0].AxisX; x.MajorGrid.LineColor = Color.LightSlateGray; x.MinorTickMark.Enabled = false; x.ScaleView.Zoomable = true; Axis y = Chart.ChartAreas[0].AxisY; y.MajorGrid.LineColor = Color.LightSlateGray; y.MinorTickMark.Enabled = true; y.ScaleView.Zoomable = true; // Allow the user to swipe across the X axis to zoom Chart.ChartAreas[0].CursorX.IsUserSelectionEnabled = true; Chart.ChartAreas[0].CursorY.IsUserSelectionEnabled = true; UpdateHistograms(rawHisto, thrHisto, true); }
public void RefreshPieCharts(GCDConsoleLib.GCD.UnitGroup displayUnits) { Series seriesErArea = Chart.Series.Add("EROSION_AREA"); seriesErArea.ChartType = SeriesChartType.Pie; seriesErArea.ChartArea = seriesErArea.Name; seriesErArea.IsVisibleInLegend = true; double sumErosionArea = BudgetSegClasses.Sum <BudgetSegregationClass>(x => x.Statistics.ErosionThr.GetArea(ProjectManager.Project.CellArea).As(displayUnits.ArUnit)); seriesErArea.Points.DataBindXY( BudgetSegClasses.Select(x => x.Name).ToArray <string>(), BudgetSegClasses.Select(x => x.Statistics.ErosionThr.GetArea(ProjectManager.Project.CellArea).As(displayUnits.ArUnit) / sumErosionArea).ToArray <double>()); Series seriesDepArea = Chart.Series.Add("DEPOSIT_AREA"); seriesDepArea.ChartType = SeriesChartType.Pie; seriesDepArea.ChartArea = seriesDepArea.Name; double sumDepArea = BudgetSegClasses.Sum <BudgetSegregationClass>(x => x.Statistics.DepositionThr.GetArea(ProjectManager.Project.CellArea).As(displayUnits.ArUnit)); seriesDepArea.Points.DataBindY(BudgetSegClasses.Select(x => x.Statistics.DepositionThr.GetArea(ProjectManager.Project.CellArea).As(displayUnits.ArUnit) / sumDepArea).ToArray <double>()); Series seriesErVol = Chart.Series.Add("EROSION_VOL"); seriesErVol.ChartType = SeriesChartType.Pie; seriesErVol.ChartArea = seriesErVol.Name; double sumErVol = BudgetSegClasses.Sum <BudgetSegregationClass>(x => x.Statistics.ErosionThr.GetVolume(ProjectManager.Project.CellArea, ProjectManager.Project.Units.VertUnit).As(displayUnits.VolUnit)); seriesErVol.Points.DataBindY(BudgetSegClasses.Select(x => x.Statistics.ErosionThr.GetVolume(ProjectManager.Project.CellArea, ProjectManager.Project.Units.VertUnit).As(displayUnits.VolUnit) / sumErVol).ToArray <double>()); Series seriesDepVol = Chart.Series.Add("DEPOSIT_VOL"); seriesDepVol.ChartType = SeriesChartType.Pie; seriesDepVol.ChartArea = seriesDepVol.Name; double sumDepVol = BudgetSegClasses.Sum <BudgetSegregationClass>(x => x.Statistics.DepositionThr.GetVolume(ProjectManager.Project.CellArea, ProjectManager.Project.Units.VertUnit).As(displayUnits.VolUnit)); seriesDepVol.Points.DataBindY(BudgetSegClasses.Select(x => x.Statistics.DepositionThr.GetVolume(ProjectManager.Project.CellArea, ProjectManager.Project.Units.VertUnit).As(displayUnits.VolUnit) / sumDepVol).ToArray <double>()); }
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); }
public void SetHistogramUnits(GCDConsoleLib.GCD.UnitGroup displayUnits) { HistogramViewer.UpdateDisplay(rdoArea.Checked, displayUnits); }