コード例 #1
0
        /// <summary>
        /// Gets the Map XML Document for the specified data
        /// </summary>
        /// <param name="caption">The caption to display at the top of the map</param>
        /// <param name="sourcePath">The full path to the map source file</param>
        /// <param name="timestamp">The timestamp to display below the map</param>
        /// <param name="scale">The scale to display below the map</param>
        /// <param name="legalNotices">The legal notices to display below the map</param>
        /// <param name="options">The report options</param>
        /// <returns>An XML Document containing the XML ready for transformation using FMO_PDFReport_Generic.xslt</returns>
        public static XmlDocument GetMap(string caption, string sourcePath, string timestamp, string scale, string[] legalNotices, MapConfiguration options)
        {
            // Validate the arguments
            if (string.IsNullOrWhiteSpace(sourcePath))
            {
                throw new ArgumentNullException(nameof(sourcePath));
            }

            // Create the XML document
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.CreateXmlDeclaration("1.0", "UTF-8", null);

            // Create the report element
            XmlElement reportNode = ReportFactoryHelper.AddReportElement(xmlDoc, options.OutputTo, false);

            // Create the content element
            XmlElement contentNode = ReportFactoryHelper.AddContentElement(reportNode, xmlDoc);

            // The content element contains a section that contains the caption, map, timestamp, scale and legal notices
            ReportFactoryHelper.AddMapSection(contentNode, xmlDoc, caption, sourcePath, timestamp, scale, legalNotices);

            // Return the XML document containing the report
            return(xmlDoc);
        }
コード例 #2
0
        /// <summary>
        /// Gets the Route Log Summary XML Document for the specified data
        /// </summary>
        /// <param name="leftTable">The data for the left table in the route log summary</param>
        /// <param name="centerTable">The data for the center table in the route log summary</param>
        /// <param name="rightTable">The data for the right table in the route log summary</param>
        /// <param name="sequencedPoints">The data for the sequenced points table in the route log summary</param>
        /// <param name="unsequencedPoints">The data for the unsequenced points table in the route log summary</param>
        /// <param name="options">The report options</param>
        /// <returns>An XML Document containing the XML ready for transformation using FMO_PDFReport_Generic.xslt</returns>
        public static XmlDocument GetRouteLogSummary(List <Tuple <string, string> > leftTable, List <Tuple <string, string> > centerTable, List <Tuple <string, string> > rightTable, List <RouteLogSummaryPoint> sequencedPoints, List <RouteLogSummaryPoint> unsequencedPoints, RouteLogSummaryConfiguration options)
        {
            // Validate the arguments
            if (leftTable == null)
            {
                throw new ArgumentNullException(nameof(leftTable));
            }
            if (centerTable == null)
            {
                throw new ArgumentNullException(nameof(centerTable));
            }
            if (rightTable == null)
            {
                throw new ArgumentNullException(nameof(rightTable));
            }
            if (sequencedPoints == null)
            {
                throw new ArgumentNullException(nameof(sequencedPoints));
            }
            if (unsequencedPoints == null)
            {
                throw new ArgumentNullException(nameof(unsequencedPoints));
            }
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }


            // Create the XML document
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.CreateXmlDeclaration("1.0", "UTF-8", null);

            // Create the report element
            XmlElement reportNode = ReportFactoryHelper.AddReportElement(xmlDoc, options.OutputTo, true);

            // The report element can contain pageHeader, pageFooter and content (required) elements
            string pageHeaderCaption = string.Empty; // TODO load from resource file
            string pageFooterCaption = string.Empty; // TODO load from resource file

            ReportFactoryHelper.AddPageHeaderElement(reportNode, xmlDoc, pageHeaderCaption, options.PageHeaderShowPageNumbers);
            ReportFactoryHelper.AddPageFooterElement(reportNode, xmlDoc, pageFooterCaption, options.PageFooterShowPageNumbers);
            XmlElement contentNode = ReportFactoryHelper.AddContentElement(reportNode, xmlDoc);

            // The content element contains the main heading, route log summary, sequenced points and unsequenced points
            //
            // Add the main heading
            string heading = "Route Log Summary"; // TODO load from resource file

            ReportFactoryHelper.AddFullWidthSectionWithMainHeading(contentNode, xmlDoc, heading);

            // Add the route log summary, sequenced points and unsequenced points
            AddRouteLogSummarySection(contentNode, xmlDoc, leftTable, centerTable, rightTable, options);
            AddSequencedPointsSection(contentNode, xmlDoc, sequencedPoints, options);
            AddUnsequencedPointsSection(contentNode, xmlDoc, unsequencedPoints, options);

            // Return the XML document containing the report
            return(xmlDoc);
        }