示例#1
0
        private static void SaveReportToFile(TcRepStatistics m_ReportForm, TcReportObject m_StatReport)
        {
            if (m_StatReport == null || m_ReportForm == null)
            {
                return;
            }


            var ReportDataFile = String.Format(@"{0}\prep_report.asr", options.OutputDir);
            var ReportPrnxFile = string.Format(@"{0}\prep_report.prnx", options.OutputDir);

            // Serialize and store them in file.
            XmlSerializer serialzier = new XmlSerializer(typeof(TcReportObject));

            using (FileStream stream = new FileStream(ReportDataFile, FileMode.Create))
            {
                serialzier.Serialize(stream, m_StatReport);
                using (StreamWriter wrt = new StreamWriter(stream))
                {
                    try
                    {
                        // Write the data to the form.
                        wrt.Flush();

                        // Save the report as pdf.
                        m_ReportForm.ExportToPdf(String.Format(@"{0}\Statistical_Report_3Sigma_{1}_{2}.pdf", options.OutputDir, options.ProjectName, options.ProjectArea));

                        // Save as prnx.
                        m_ReportForm.CreateDocument();
                        m_ReportForm.PrintingSystem.SaveDocument(ReportPrnxFile);
                    }
                    finally
                    {
                        wrt.Close();
                    }
                }
            }
        }
示例#2
0
        private static void UpdateReportDataSet(TcReportPoint3D[] prmPoints, Single prmSigma, Single prmZAdjustment, long samples, float XAdjustment, float YAdjustment
                                                , string[] ffiles)
        {
            // Points that are not accepted.
            var m_StatReport = new TcReportObject()
            {
                Project            = options.ProjectName,
                Area               = options.ProjectArea,
                XAdjustment        = XAdjustment,
                YAdjustment        = YAdjustment,
                ZAdjustment        = prmZAdjustment,
                Sigma              = prmSigma,
                NoOfCoveragePoints = (int)(FlatPoints.Length / 3.5),
                files              = ffiles,
                heightfile         = options.GCPFile,
            };

            foreach (TcReportPoint3D point in prmPoints)
            {
                switch (point.Status)
                {
                case TePointStatus.Accepted:
                    m_StatReport.Accepted.Add(point);
                    break;

                case TePointStatus.NotFlat:
                    m_StatReport.NotFlat.Add(point);
                    break;

                case TePointStatus.NotCovered:
                    m_StatReport.NotCovered.Add(point);
                    break;

                case TePointStatus.OutOfSigma:
                    m_StatReport.OutOfSigma.Add(point);
                    break;
                }
            }

            // Add the histograms.
            m_StatReport.HistogramScaling = 25;
            m_StatReport.Histograms.Add(TcHistogram.Get(m_StatReport.Accepted.Select(iter => iter.Difference), m_StatReport.HistogramScaling));

            var m_ReportForm = new TcRepStatistics(m_StatReport);

            if (File.Exists(Path.Combine(options.OutputDir, "report.txt")))
            {
                File.Delete(Path.Combine(options.OutputDir, "report.txt"));
            }

            using (var sr = File.CreateText(Path.Combine(options.OutputDir, "report.txt")))
            {
                sr.WriteLine(string.Format("{0,-20} {1,-20} {2,-20} {3,-20} {4,-20} {5,-20} {6,-20} {7,-20}", "ID", "X", "Y", "Z", "Lidar Z", "DIFF", "STATUS", "ADJUSTMENT"));
                sr.WriteLine(string.Format("{0,-20} {1,-20} {2,-20} {3,-20} {4,-20} {5,-20} {6,-20} {7,-20}", "------", "----------", "----------", "------", "----------", "------", "----------", "----------"));

                foreach (var pt in prmPoints)
                {
                    sr.WriteLine(string.Format("{0,-20} {1,-20} {2,-20} {3,-20} {4,-20} {5,-20} {6,-20} {7,-20}",
                                               pt.Id, string.Format("{0:000000.000}", pt.X), string.Format("{0:000000.000}", pt.Y), string.Format("{0:000.00}", pt.Z), string.Format("{0:000.00}", pt.LidarHeight), string.Format("{0:00.00}", pt.Difference), pt.Status.ToString(), string.Format("{0:00.00}", pt.ZAjustment)));
                }
            }



            // Save the report set to file.
            SaveReportToFile(m_ReportForm, m_StatReport);
        }