Ejemplo n.º 1
0
 public void WriteXML(XmlTextWriter writer)
 {
     writer.WriteStartElement(SourceMapRecord.GetXMLTag());
     writer.WriteAttributeString("DisplayName", this.displayName);
     writer.WriteAttributeString("ReferenceName", SampleHTMLWriter.ReferenceName(this.displayName));
     writer.WriteAttributeString("MaxZoom", this.maxZoom.ToString());
     this.sourceMapLegendFrame.WriteXML(writer);
     this.sourceMapInfo.WriteXML(writer);
     if (this.userBoundingRect != null)
     {
         this.userBoundingRect.WriteXML(writer);
     }
     foreach (LegendRecord current in this.legendRecords)
     {
         current.WriteXML(writer);
     }
     if (this.imageTransformer != null)
     {
         this.imageTransformer.writeToXml(writer);
     }
     foreach (ThumbnailRecord current2 in this.thumbnailRecords)
     {
         current2.WriteXML(writer);
     }
     writer.WriteEndElement();
 }
Ejemplo n.º 2
0
 public void WriteXML(XmlTextWriter writer)
 {
     writer.WriteStartElement(CrunchedLayer.GetXMLTag());
     writer.WriteAttributeString(Layer.GetLayerDisplayNameTag(), this.displayName);
     writer.WriteAttributeString("ReferenceName", SampleHTMLWriter.ReferenceName(this.displayName));
     this.namingScheme.WriteXML(writer);
     writer.WriteStartElement("DefaultView");
     this.defaultView.WriteXMLToAttributes(writer);
     writer.WriteEndElement();
     writer.WriteStartElement("SourceMapRecordList");
     foreach (SourceMapRecord current in this.sourceMapRecords)
     {
         current.WriteXML(writer);
     }
     writer.WriteEndElement();
     writer.WriteStartElement("RangeDescriptors");
     foreach (RangeDescriptor current2 in this.rangeDescriptors)
     {
         current2.WriteXML(writer);
     }
     writer.WriteEndElement();
     foreach (ThumbnailRecord current3 in this.thumbnailRecords)
     {
         current3.WriteXML(writer);
     }
     writer.WriteEndElement();
 }
Ejemplo n.º 3
0
 public static Uri Write(Mashup mashup, SampleHTMLWriter.PostMessageDelegate postMessage, RenderOutputMethod renderOutput)
 {
     string arg = "";
     try
     {
         SampleHTMLWriter.WriteMain(mashup, renderOutput, SampleHTMLWriter.SampleHTMLFilename);
         SampleHTMLWriter.WriteKey(mashup, renderOutput, SampleHTMLWriter.SampleKeyFilename);
         return renderOutput.GetUri(SampleHTMLWriter.SampleHTMLFilename);
     }
     catch (Exception ex)
     {
         postMessage(string.Format("Couldn't write {0}: {1}", arg, ex.ToString()));
     }
     return null;
 }
Ejemplo n.º 4
0
        public static Uri Write(Mashup mashup, SampleHTMLWriter.PostMessageDelegate postMessage, RenderOutputMethod renderOutput)
        {
            string arg = "";

            try
            {
                SampleHTMLWriter.WriteMain(mashup, renderOutput, SampleHTMLWriter.SampleHTMLFilename);
                SampleHTMLWriter.WriteKey(mashup, renderOutput, SampleHTMLWriter.SampleKeyFilename);
                return(renderOutput.GetUri(SampleHTMLWriter.SampleHTMLFilename));
            }
            catch (Exception ex)
            {
                postMessage(string.Format("Couldn't write {0}: {1}", arg, ex.ToString()));
            }
            return(null);
        }
Ejemplo n.º 5
0
        private static void WriteMain(Mashup mashup, RenderOutputMethod renderOutput, string fileName)
        {
            TextWriter textWriter           = new StreamWriter(renderOutput.CreateFile(fileName, "text/html"));
            string     showDefaultLayerName = SampleHTMLWriter.ReferenceName(mashup.layerList.First.GetDisplayName());
            string     text = "";
            string     arg  = " checked";

            foreach (Layer current in mashup.layerList)
            {
                string arg2 = string.Format("<input type=\"checkbox\" id=\"checkbox:{0}\" onClick=\"javascript:ToggleLayer('{0}', this.checked);\"{1}>{0}", SampleHTMLWriter.ReferenceName(current.GetDisplayName()), arg);
                arg = "";
                string arg3 = string.Format("<a href=\"javascript:crunchedLayerManager.layerList.find('{0}').SetDefaultView(map);\"><font size=\"-1\">center here</font></a>", SampleHTMLWriter.ReferenceName(current.GetDisplayName()));
                text += string.Format("{0}&nbsp;{1}&nbsp;|", arg2, arg3);
            }
            textWriter.Write(SampleHTMLWriterConstants.Body(showDefaultLayerName, text, CrunchedFile.CrunchedFilename));
            textWriter.Close();
        }
Ejemplo n.º 6
0
        public static void WriteKey(Mashup mashup, RenderOutputMethod renderOutput, string fileName)
        {
            TextWriter textWriter = new StreamWriter(renderOutput.CreateFile(fileName, "text/html"));
            string     fileNameWithoutExtension = Path.GetFileNameWithoutExtension(mashup.GetFilename());

            textWriter.WriteLine("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Transitional//EN\">");
            textWriter.WriteLine(string.Format("<html><head><title>{0}</title></head>", fileNameWithoutExtension));
            textWriter.WriteLine(string.Format("<body><h1>{0}</h1>", fileNameWithoutExtension));
            foreach (Layer current in mashup.layerList)
            {
                textWriter.WriteLine(string.Format("<p><h2><a name=\"{0}\">{1}</a></h2>", SampleHTMLWriter.ReferenceName(current.displayName), current.displayName));
                foreach (SourceMap current2 in current)
                {
                    textWriter.WriteLine(string.Format("<p><h3>{0}</h3>", current2.displayName));
                    if (current2.sourceMapInfo.mapHomePage != "")
                    {
                        textWriter.WriteLine(string.Format("<a href=\"{0}\">Home page</a>", current2.sourceMapInfo.mapHomePage));
                    }
                    if (current2.sourceMapInfo.mapFileURL != "")
                    {
                        textWriter.WriteLine(string.Format(" <a href=\"{0}\">Map URL</a>", current2.sourceMapInfo.mapFileURL));
                    }
                    textWriter.WriteLine(string.Format("<br>{0}", current2.sourceMapInfo.mapDescription));
                }
                textWriter.WriteLine("<hr>");
            }
            textWriter.WriteLine("</body></html>");
            textWriter.Close();
        }