} // end buildPrintArray public static List <string> buildPrintArray(PlotDO pl, string stratumCode, string unitCode) { // overloaded to build array for report A13 (A14) -- plot page var plotArray = new List <string>(); string fieldFormat1 = "{0,10:F2}"; string fieldFormat2 = "{0,9:F2}"; // print plot table if (pl.XCoordinate != 0.0) { plotArray.Add(""); plotArray.Add(pl.PlotNumber.ToString().PadLeft(4, ' ')); plotArray.Add(unitCode.PadLeft(3, ' ')); plotArray.Add(stratumCode.PadLeft(2, ' ')); plotArray.Add(String.Format(fieldFormat1, pl.XCoordinate)); if (pl.YCoordinate == 0.0) { plotArray.Add("---------"); } else { plotArray.Add(String.Format(fieldFormat2, pl.YCoordinate)); } if (pl.ZCoordinate == 0.0) { plotArray.Add("---------"); } else { plotArray.Add(String.Format(fieldFormat1, pl.ZCoordinate)); } plotArray.Add(pl.MetaData ?? (" ")); } // endif coordinates exist return(plotArray); } // end buildPrintArray
public static string GetDescriptionShort(this PlotDO plot) { StringBuilder sb = new StringBuilder(); if (plot.Stratum.BasalAreaFactor > 0.0) { sb.AppendFormat(null, "Stratum:{0} {1} BAF:{2}", plot.Stratum.Code, plot.Stratum.Method, plot.Stratum.BasalAreaFactor); } else { sb.AppendFormat(null, "Stratum:{0} {1} 1/{2} acre", plot.Stratum.Code, plot.Stratum.Method, plot.Stratum.FixedPlotSize); } if (plot.Stratum.Method == "3PPNT") { sb.AppendFormat(null, " KPI:{0}", plot.KPI); if (plot.IsEmpty == true.ToString()) { sb.Append("-Count"); } else { sb.Append("-Measure"); } } return(sb.ToString()); }
} // end FindDuplicatePlots public static List <string> buildPrintArray(PlotDO pl, string cruiseName, string stratumCode, string unitCode) { var plotArray = new List <string>(); plotArray.Add(" "); plotArray.Add(cruiseName.PadRight(5, ' ')); plotArray.Add(pl.PlotNumber.ToString().PadLeft(4, ' ')); plotArray.Add(unitCode.PadLeft(3, ' ')); plotArray.Add(stratumCode.PadLeft(2, ' ')); plotArray.Add(pl.Slope.ToString().PadLeft(6, ' ')); plotArray.Add(pl.Aspect.ToString().PadLeft(3, ' ')); plotArray.Add(pl.KPI.ToString().PadLeft(6, ' ')); if (pl.IsEmpty == "1" || pl.IsEmpty == "True") { plotArray.Add("YES"); } else { plotArray.Add(" "); } return(plotArray); } // end buildPrintArray
public Plot3PPNT(PlotDO plot) : base(plot) { }
public Plot(PlotDO obj) : base(obj) { }
public static string GetDescription(this PlotDO plot) { //throw new NotImplementedException(); return("<Plot Stats Place Holder>"); }
DAL CreateDataStore(string salePurpose = null, string saleRegion = "01", IEnumerable <string> methods = null) { methods = methods ?? new string[] { CruiseMethods.STR, CruiseMethods.FIX }; var ds = new DAL(); var sale = new SaleDO() { DAL = ds, SaleNumber = "12345", Region = saleRegion, Forest = "11", District = "something", Purpose = salePurpose }; sale.Save(); var cuttingUnit = new CuttingUnitDO() { DAL = ds, Code = "01" }; cuttingUnit.Save(); var tdv = new TreeDefaultValueDO() { DAL = ds, Species = "something", PrimaryProduct = "something", LiveDead = "L" }; tdv.Save(); int counter = 0; foreach (var method in methods) { var stratum = new StratumDO() { DAL = ds, Code = counter++.ToString("d2"), Method = method }; stratum.Save(); stratum.CuttingUnits.Add(cuttingUnit); stratum.CuttingUnits.Save(); var sg = new SampleGroupDO() { DAL = ds, Code = 1.ToString("d2"), Stratum = stratum, CutLeave = "C", UOM = "something", PrimaryProduct = "something" }; sg.Save(); sg.TreeDefaultValues.Add(tdv); sg.TreeDefaultValues.Save(); if (CruiseMethods.PLOT_METHODS.Contains(method)) { var plot = new PlotDO() { DAL = ds, Stratum = stratum, CuttingUnit = cuttingUnit, PlotNumber = 1 }; plot.Save(); var tree = new TreeDO() { DAL = ds, CuttingUnit = cuttingUnit, Stratum = stratum, Plot = plot, SampleGroup = sg, TreeDefaultValue = tdv, TreeNumber = 1 }; tree.Save(); } else { var tree = new TreeDO() { DAL = ds, CuttingUnit = cuttingUnit, Stratum = stratum, SampleGroup = sg, TreeDefaultValue = tdv, TreeNumber = 1 }; tree.Save(); } var countTree = new CountTree() { CuttingUnit_CN = cuttingUnit.CuttingUnit_CN, SampleGroup_CN = sg.SampleGroup_CN, TreeDefaultValue_CN = tdv.TreeDefaultValue_CN, }; ds.Save(countTree); } return(ds); }
} // end SumTreeCountsPRO public void CalcExpFac(StratumDO sdo, List <PlotDO> justPlots, List <POPDO> justCurrentPOP) { CPbusinessLayer bslyr = new CPbusinessLayer(); bslyr.DAL = DAL; bslyr.fileName = fileName; // Calculates expansion factor, tree factor and point factor for each tree in the current population double EF = 0.0; // expansion factor double TF = 0.0; // tree factor double PF = 0.0; // point factor // Need total number of plots and measured plots (3PPNT only) double totalPlots = justPlots.Count(); double totalMeasPlots = 0.0; // process by population foreach (POPDO pdo in justCurrentPOP) { // pull trees for population List <TreeDO> justTrees = new List <TreeDO>(); if (sdo.Method == "FIXCNT") { justTrees = bslyr.getPOPtrees(pdo, "C"); } else { justTrees = bslyr.getPOPtrees(pdo, "M"); } // 3PPNT uses measured plots if (sdo.Method == "3PPNT") { foreach (PlotDO p in justPlots) { int nthRow = justTrees.FindIndex( delegate(TreeDO td) { return(td.Plot_CN == p.Plot_CN && td.Stratum_CN == p.Stratum_CN); }); if (nthRow >= 0) { totalMeasPlots++; } } // end foreach loop } // endif Method is 3PPNT // calculate factors on each tree foreach (TreeDO tdo in justTrees) { // Calculate point factor for P3P S3P F3P PCM FCM and 3PPNT switch (sdo.Method) { case "P3P": case "S3P": case "F3P": PF = CommonEquations.Frequency3P(pdo.SumKPI, tdo.KPI, pdo.MeasuredTrees); break; case "PCM": case "PCMTRE": PF = CommonEquations.CalcTreeFactor(pdo.FirstStageTrees, pdo.MeasuredTrees, 0.0, 1, 2); break; case "FCM": PF = CommonEquations.CalcTreeFactor(0.0, pdo.MeasuredTrees, pdo.TalliedTrees, 3, 2); break; case "3PPNT": // uses plot KPI PlotDO plotKPI = justPlots.Find( delegate(PlotDO p) { return(p.Plot_CN == tdo.Plot_CN); }); PF = CommonEquations.Frequency3P(pdo.SumKPI, plotKPI.KPI, totalMeasPlots); break; } // end switch on method to calculate point factor // Calculate tree factor for FIXCNT FIX F3P FCM PNT P3P PCM 3PPNT and S3P switch (sdo.Method) { case "FIXCNT": case "FIX": case "F3P": TF = sdo.FixedPlotSize; break; case "FCM": if (totalPlots > 0) { TF = sdo.FixedPlotSize / totalPlots; } break; case "PNT": case "P3P": case "PCM": case "PCMTRE": case "3PPNT": if (tdo.DBH > 0) { TF = CommonEquations.PointSampleFrequency(sdo.BasalAreaFactor, tdo.DBH); } else if (tdo.DRC > 0) { TF = CommonEquations.PointSampleFrequency(sdo.BasalAreaFactor, tdo.DRC); } break; case "S3P": TF = CommonEquations.CalcTreeFactor(pdo.FirstStageTrees, 0.0, pdo.TalliedTrees, 3, 1); break; } // end switch on method to calculate tree factor // Calculate expansion factor switch (sdo.Method) { case "100": EF = 1.0; break; case "FIXCNT": if (totalPlots > 0) { EF = (sdo.FixedPlotSize / totalPlots) * tdo.TreeCount; } break; case "FIX": if (totalPlots > 0) { EF = sdo.FixedPlotSize / totalPlots; } break; case "PNT": if (totalPlots > 0) { EF = TF / totalPlots; } break; case "STR": EF = CommonEquations.CalcTreeFactor(0.0, pdo.MeasuredTrees, pdo.TalliedTrees, 3, 2); break; case "P3P": case "F3P": case "PCM": case "PCMTRE": case "3PPNT": if (totalPlots > 0) { EF = (TF * PF) / totalPlots; } break; case "FCM": case "S3P": EF = TF * PF; break; case "3P": EF = CommonEquations.Frequency3P(pdo.SumKPI, tdo.KPI, pdo.MeasuredTrees); break; } // end switch on method to calculate expansion factor if (tdo.STM == "Y") { EF = 1.0; } // round just the expansion factor EF = CommonEquations.RoundExpansionFactor(EF); // store factors tdo.ExpansionFactor = (float)EF; tdo.TreeFactor = (float)TF; tdo.PointFactor = (float)PF; } // end foreach loop on justTrees // save this bunch of trees bslyr.SaveTrees(justTrees); } // end foreach loop on justCurrentPOP return; } // end CalcExpFac