Example #1
0
        }         //  end createByUnit

        private void createByStratum(StratumDO currST, List <LCDDO> justSpecies, List <TreeDO> justTrees,
                                     StreamWriter strWriteOut, ref int pageNumb, reportHeaders rh)
        {
            //  SC3 reports by stratum
            completeHeader = createCompleteHeader(justSpecies, "", currST.Code, 0);
            //  clear out stand table list for next unit
            countsToOutput.Clear();
            //  load DIB classes for this stratum and load into output list
            List <TreeDO> justDIBS = bslyr.getTreeDBH("C", currST.Code, "C");
            double        DIBsum   = justDIBS.Sum(j => j.DBH);

            if (DIBsum > 0)
            {
                LoadTreeDIBclasses(justDIBS[justDIBS.Count - 1].DBH, countsToOutput, 3);
            }
            else
            {
                // no DIBs recorded so only one class to accumulate
                StandTables s = new StandTables();
                s.dibClass = "0";
                countsToOutput.Add(s);
                footFlag = 1;
            }       //  endif
            //  find all species for this cutting unit
            int nthColumn = 1;
            int nthRow    = 0;

            foreach (LCDDO js in justSpecies)
            {
                List <TreeDO> justGroup = justTrees.FindAll(
                    delegate(TreeDO t)
                {
                    return(t.Species == js.Species);
                });
                //  then load output list -- find row first for each tree
                if (justGroup.Count > 0)
                {
                    foreach (TreeDO jg in justGroup)
                    {
                        //  find index in output list for DBH
                        nthRow = FindTreeDIBindex(countsToOutput, jg.DBH, 3);
                        if (nthRow >= 0)
                        {
                            loadCountsToOutput(nthRow, nthColumn, jg.ExpansionFactor, 1);
                        }
                    }       //  end foreach loop
                    nthColumn++;
                }
            }       //  end foreach loop on species groups

            // output current cutting unit
            double calcValue = countsToOutput.Sum(c => c.lineTotal);

            if (calcValue > 0)
            {
                WriteCurrentPage(strWriteOut, ref pageNumb, rh, justSpecies);
                numOlines = 0;
            } //  endif
            return;
        }     //  end createByStratum
Example #2
0
        }         //  end createStemCountReports

        private void createByUnit(StratumDO currST, List <LCDDO> justSpecies, List <TreeDO> justTrees,
                                  StreamWriter strWriteOut, ref int pageNumb, reportHeaders rh)
        {
            int numOplots = 0;

            //  SC1 and SC2 reports by units
            //  cutting unit acres used in SC2 to expand unit per acre value
            currST.CuttingUnits.Populate();
            List <PlotDO> pList = bslyr.getPlots();

            foreach (CuttingUnitDO cu in currST.CuttingUnits)
            {
                //  need number of plots for SC2 report
                List <PlotDO> justPlots = pList.FindAll(
                    delegate(PlotDO p)
                {
                    return(p.Stratum_CN == currST.Stratum_CN && p.CuttingUnit_CN == cu.CuttingUnit_CN);
                });
                numOplots = justPlots.Count();
                //  load headers for each cutting unit
                if (currentReport == "SC1")
                {
                    completeHeader = createCompleteHeader(justSpecies, cu.Code, currST.Code, 0);
                }
                else if (currentReport == "SC2")
                {
                    completeHeader = createCompleteHeader(justSpecies, cu.Code, currST.Code, numOplots);
                }
                //  clear out stand table list for next unit
                countsToOutput.Clear();
                //  load DIB classes for this stratum and load into output list
                List <TreeDO> justDIBS = bslyr.getTreeDBH("C", currST.Code, "C");
                double        DIBsum   = justDIBS.Sum(j => j.DBH);
                if (DIBsum > 0)
                {
                    LoadTreeDIBclasses(justDIBS[justDIBS.Count - 1].DBH, countsToOutput, 3);
                }
                else
                {
                    // no DIBs recorded so only one class to accumulate
                    StandTables s = new StandTables();
                    s.dibClass = "0";
                    countsToOutput.Add(s);
                    footFlag = 1;
                }   //  endif
                //  find all species for this cutting unit
                int nthColumn = 1;
                int nthRow    = 0;
                foreach (LCDDO js in justSpecies)
                {
                    List <TreeDO> justGroup = justTrees.FindAll(
                        delegate(TreeDO t)
                    {
                        return(t.CuttingUnit.Code == cu.Code && t.Species == js.Species);
                    });
                    //  then load output list -- find row first for each tree
                    if (justGroup.Count > 0)
                    {
                        foreach (TreeDO jg in justGroup)
                        {
                            //  find index in output list for DBH
                            nthRow = FindTreeDIBindex(countsToOutput, jg.DBH, 3);
                            if (nthRow >= 0)
                            {
                                if (currentReport == "SC2")
                                {
                                    loadCountsToOutput(nthRow, nthColumn, jg.ExpansionFactor, cu.Area);
                                }
                                else if (currentReport == "SC1")
                                {
                                    loadCountsToOutput(nthRow, nthColumn, jg.ExpansionFactor, 1);
                                }
                            }
                        }   //  end foreach loop
                        nthColumn++;
                    }
                }   //  end foreach loop on species groups

                // output current cutting unit
                double calcValue = countsToOutput.Sum(c => c.lineTotal);
                if (calcValue > 0)
                {
                    WriteCurrentPage(strWriteOut, ref pageNumb, rh, justSpecies);
                    numOlines = 0;
                } //  endif
            }     //  end foreach loop on cutting unit
            return;
        }         //  end createByUnit