示例#1
0
文件: SvgPage.cs 项目: notator/Moritz
        /// <summary>
        /// Writes this page.
        /// </summary>
        /// <param name="w"></param>
        public void WriteSVG(SvgWriter w, Metadata metadata)
        {
            int nOutputVoices = 0;
            int nInputVoices = 0;
            GetNumbersOfVoices(Systems[0], ref nOutputVoices, ref nInputVoices);

            w.WriteStartDocument(); // standalone="no"
            //<?xml-stylesheet href="../../fontsStyleSheet.css" type="text/css"?>
            w.WriteProcessingInstruction("xml-stylesheet", "href=\"../../fontsStyleSheet.css\" type=\"text/css\"");
            w.WriteStartElement("svg", "http://www.w3.org/2000/svg");

            WriteSvgHeader(w);

            WriteSodipodiNamedview(w);

            metadata.WriteSVG(w, _pageNumber, _score.PageCount, _pageFormat.AboutLinkURL, nOutputVoices, nInputVoices);

            _score.WriteDefs(w);

            #region layers

            int layerNumber = 1;

            if(_pageNumber > 0)
            {
                WriteFrameLayer(w, layerNumber++, "frame", _pageFormat.Right, _pageFormat.Bottom);
            }

            WriteScoreLayer(w, layerNumber++, "score", _pageNumber, metadata);

            WriteEmptyLayer(w, layerNumber++, "user annotations", true);
            #endregion layers

            w.WriteEndElement(); // close the svg element
            w.WriteEndDocument();
        }