Пример #1
0
        public static void CopyFile(string sourcePath, RenderOutputMethod renderOutput, string relativeDestPath,
                                    string mimeType)
        {
            FileIdentification fileIdentificationStatic = FileOutputMethod.GetFileIdentificationStatic(sourcePath);
            FileIdentification fileIdentification       = renderOutput.GetFileIdentification(relativeDestPath);

            if (fileIdentificationStatic.CompareTo(fileIdentification) == 0)
            {
                return;
            }

            Stream stream  = new FileStream(sourcePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
            Stream stream2 = renderOutput.CreateFile(relativeDestPath, mimeType);

            byte[] buffer = new byte[65536];
            while (true)
            {
                int num = stream.Read(buffer, 0, 65536);
                if (num == 0)
                {
                    break;
                }

                stream2.Write(buffer, 0, num);
            }

            stream.Close();
            stream2.Close();
        }
Пример #2
0
        public void WriteSourceMapLegendFrame(RenderOutputMethod renderOutput)
        {
            Stream       stream       = renderOutput.MakeChildMethod("legends").CreateFile(this.filename, "text/html");
            StreamWriter streamWriter = new StreamWriter(stream);

            streamWriter.WriteLine("<html>");
            streamWriter.WriteLine(string.Format("<head><title>{0}</title></head>", this.displayName));
            streamWriter.WriteLine("<body>");
            streamWriter.WriteLine(string.Format("<h3>{0}</h3>", this.displayName));
            ThumbnailRecord thumbnailRecord = this.thumbnailDelegate();

            if (thumbnailRecord != null)
            {
                streamWriter.WriteLine(thumbnailRecord.WriteImgTag("../"));
            }
            if (this.sourceMapInfo.mapFileURL != "")
            {
                streamWriter.WriteLine(string.Format("<br>Map URL: <a href=\"{0}\">{0}</a>", this.sourceMapInfo.mapFileURL));
            }
            if (this.sourceMapInfo.mapHomePage != "")
            {
                streamWriter.WriteLine(string.Format("<br>Map Home Page: <a href=\"{0}\">{0}</a>", this.sourceMapInfo.mapHomePage));
            }
            if (this.sourceMapInfo.mapDescription != "")
            {
                streamWriter.WriteLine(string.Format("<p>{0}</p>", this.sourceMapInfo.mapDescription));
            }
            foreach (LegendRecord current in this.legendRecords)
            {
                streamWriter.WriteLine(string.Format("<br><img src=\"{0}\" width=\"{1}\" height=\"{2}\">", current.urlSuffix, current.imageDimensions.Width, current.imageDimensions.Height));
            }
            streamWriter.WriteLine("</body>");
            streamWriter.WriteLine("</html>");
            streamWriter.Close();
        }
Пример #3
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();
        }
Пример #4
0
            private void WriteChanges(RenderOutputMethod outputMethod)
            {
                Stream w = outputMethod.MakeChildMethod("manifests")
                           .CreateFile(manifestFilename(blockId), "text/xml");
                XmlTextWriter xmlTextWriter = new XmlTextWriter(w, Encoding.UTF8);

                using (xmlTextWriter)
                {
                    xmlTextWriter.Formatting = Formatting.Indented;
                    xmlTextWriter.WriteStartDocument(true);
                    xmlTextWriter.WriteStartElement("ManifestBlock");
                    if (superBlock != null)
                    {
                        superBlock.WriteXML(xmlTextWriter);
                    }

                    foreach (ManifestRecord current in this)
                    {
                        current.WriteXML(xmlTextWriter);
                    }

                    xmlTextWriter.WriteEndElement();
                    xmlTextWriter.Close();
                }
            }
Пример #5
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();
 }
		public void WriteSourceMapLegendFrame(RenderOutputMethod renderOutput)
		{
			Stream stream = renderOutput.MakeChildMethod("legends").CreateFile(this.filename, "text/html");
			StreamWriter streamWriter = new StreamWriter(stream);
			streamWriter.WriteLine("<html>");
			streamWriter.WriteLine(string.Format("<head><title>{0}</title></head>", this.displayName));
			streamWriter.WriteLine("<body>");
			streamWriter.WriteLine(string.Format("<h3>{0}</h3>", this.displayName));
			ThumbnailRecord thumbnailRecord = this.thumbnailDelegate();
			if (thumbnailRecord != null)
			{
				streamWriter.WriteLine(thumbnailRecord.WriteImgTag("../"));
			}
			if (this.sourceMapInfo.mapFileURL != "")
			{
				streamWriter.WriteLine(string.Format("<br>Map URL: <a href=\"{0}\">{0}</a>", this.sourceMapInfo.mapFileURL));
			}
			if (this.sourceMapInfo.mapHomePage != "")
			{
				streamWriter.WriteLine(string.Format("<br>Map Home Page: <a href=\"{0}\">{0}</a>", this.sourceMapInfo.mapHomePage));
			}
			if (this.sourceMapInfo.mapDescription != "")
			{
				streamWriter.WriteLine(string.Format("<p>{0}</p>", this.sourceMapInfo.mapDescription));
			}
			foreach (LegendRecord current in this.legendRecords)
			{
				streamWriter.WriteLine(string.Format("<br><img src=\"{0}\" width=\"{1}\" height=\"{2}\">", current.urlSuffix, current.imageDimensions.Width, current.imageDimensions.Height));
			}
			streamWriter.WriteLine("</body>");
			streamWriter.WriteLine("</html>");
			streamWriter.Close();
		}
Пример #7
0
        private static void WriteMain(Mashup mashup, RenderOutputMethod renderOutput, string fileName)
        {
            TextWriter textWriter           = new StreamWriter(renderOutput.CreateFile(fileName, "text/html"));
            string     showDefaultLayerName = 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}",
                        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>",
                        ReferenceName(current.GetDisplayName()));
                text += string.Format("{0}&nbsp;{1}&nbsp;|", arg2, arg3);
            }

            textWriter.Write(SampleHTMLWriterConstants.Body(showDefaultLayerName, text, CrunchedFile.CrunchedFilename));
            textWriter.Close();
        }
Пример #8
0
 internal void WriteSourceMapLegendFrames(RenderOutputMethod renderOutput)
 {
     foreach (SourceMapRecord current in this.sourceMapRecords)
     {
         current.WriteSourceMapLegendFrame(renderOutput);
     }
 }
Пример #9
0
        public static LayerMetadataFile Read(RenderOutputMethod outputMethod)
        {
            LayerMetadataFile  layerMetadataFile  = null;
            Stream             input              = outputMethod.ReadFile("LayerMetadata.xml");
            XmlTextReader      reader             = new XmlTextReader(input);
            MashupParseContext mashupParseContext = new MashupParseContext(reader);

            using (mashupParseContext)
            {
                while (mashupParseContext.reader.Read())
                {
                    if (mashupParseContext.reader.NodeType == XmlNodeType.Element &&
                        mashupParseContext.reader.Name == LayerMetadataTag)
                    {
                        layerMetadataFile = new LayerMetadataFile(outputMethod, mashupParseContext);
                        break;
                    }
                }

                mashupParseContext.Dispose();
            }

            if (layerMetadataFile == null)
            {
                throw new InvalidMashupFile(mashupParseContext,
                                            string.Format("{0} doesn't appear to be a valid {1}",
                                                          outputMethod.GetUri("LayerMetadata.xml"),
                                                          LayerMetadataTag));
            }

            return(layerMetadataFile);
        }
Пример #10
0
        //[CompilerGenerated]
        //private static Predicate<ImageCodecInfo> <>9__CachedAnonymousMethodDelegate1;

        public CompositeTileUnit(Layer layer, TileAddress address, RenderOutputMethod renderOutput, string outputFilename, OutputTileType outputTileType)
        {
            this.layer          = layer;
            this.address        = address;
            this.renderOutput   = renderOutput;
            this.outputFilename = outputFilename;
            this.outputTileType = outputTileType;
        }
Пример #11
0
		//[CompilerGenerated]
		//private static Predicate<ImageCodecInfo> <>9__CachedAnonymousMethodDelegate1;
		
        public CompositeTileUnit(Layer layer, TileAddress address, RenderOutputMethod renderOutput, string outputFilename, OutputTileType outputTileType)
		{
			this.layer = layer;
			this.address = address;
			this.renderOutput = renderOutput;
			this.outputFilename = outputFilename;
			this.outputTileType = outputTileType;
		}
Пример #12
0
		public static void SaveImage(ImageRef imageRef, RenderOutputMethod renderOutput, string relativeDestPath, ImageFormat imageFormat)
		{
			Stream stream = renderOutput.CreateFile(relativeDestPath, ImageTypeMapper.ByImageFormat(imageFormat).mimeType);
			using (stream)
			{
				imageRef.image.Save(stream, imageFormat);
				stream.Close();
			}
		}
Пример #13
0
        public static void SaveImage(ImageRef imageRef, RenderOutputMethod renderOutput, string relativeDestPath, ImageFormat imageFormat)
        {
            Stream stream = renderOutput.CreateFile(relativeDestPath, ImageTypeMapper.ByImageFormat(imageFormat).mimeType);

            using (stream)
            {
                imageRef.image.Save(stream, imageFormat);
                stream.Close();
            }
        }
Пример #14
0
 public CrunchedFile(Mashup mashup, RangeQueryData rangeQueryData, RenderOutputMethod renderOutput, string sourceMashupFilename, List <TileRectangle> boundsList, MapTileSourceFactory mapTileSourceFactory)
 {
     foreach (Layer current in mashup.layerList)
     {
         this.crunchedLayers.Add(new CrunchedLayer(mashup.GetRenderOptions(), current, rangeQueryData[current], mapTileSourceFactory));
     }
     this.renderOutput         = renderOutput;
     this.sourceMashupFilename = sourceMashupFilename;
     this.permitComposition    = mashup.GetRenderOptions().permitComposition;
     this.boundsList           = boundsList;
 }
Пример #15
0
		public CrunchedFile(Mashup mashup, RangeQueryData rangeQueryData, RenderOutputMethod renderOutput, string sourceMashupFilename, List<TileRectangle> boundsList, MapTileSourceFactory mapTileSourceFactory)
		{
			foreach (Layer current in mashup.layerList)
			{
				this.crunchedLayers.Add(new CrunchedLayer(mashup.GetRenderOptions(), current, rangeQueryData[current], mapTileSourceFactory));
			}
			this.renderOutput = renderOutput;
			this.sourceMashupFilename = sourceMashupFilename;
			this.permitComposition = mashup.GetRenderOptions().permitComposition;
			this.boundsList = boundsList;
		}
Пример #16
0
            public ManifestBlock(TellManifestDirty tellManifestDirty, RenderOutputMethod outputMethod, int blockId)
            {
                this.tellManifestDirty = tellManifestDirty;
                this.blockId           = blockId;
                try
                {
                    Stream        input         = outputMethod.MakeChildMethod("manifests").ReadFile(manifestFilename(blockId));
                    XmlTextReader xmlTextReader = new XmlTextReader(input);
                    using (xmlTextReader)
                    {
                        MashupParseContext mashupParseContext = new MashupParseContext(xmlTextReader);
                        while (mashupParseContext.reader.Read())
                        {
                            if (mashupParseContext.reader.NodeType == XmlNodeType.Element &&
                                mashupParseContext.reader.Name == "ManifestBlock")
                            {
                                XMLTagReader xMLTagReader = mashupParseContext.NewTagReader("ManifestBlock");
                                while (xMLTagReader.FindNextStartTag())
                                {
                                    if (xMLTagReader.TagIs(ManifestRecord.GetXmlTag()))
                                    {
                                        recordList.Add(new ManifestRecord(mashupParseContext, this));
                                    }
                                    else
                                    {
                                        if (xMLTagReader.TagIs(ManifestSuperBlock.GetXmlTag()))
                                        {
                                            superBlock = new ManifestSuperBlock(mashupParseContext,
                                                                                new TellManifestDirty(SetDirty));
                                        }
                                    }
                                }

                                return;
                            }
                        }

                        throw new InvalidMashupFile(mashupParseContext, "No ManifestBlock tag");
                    }
                }
                catch (Exception)
                {
                }
                finally
                {
                    if (blockId == 0 && superBlock == null)
                    {
                        superBlock = new ManifestSuperBlock(1, new TellManifestDirty(SetDirty));
                    }
                }
            }
Пример #17
0
		private LayerMetadataFile(RenderOutputMethod renderOutputMethod, MashupParseContext context)
		{
			this.renderOutputMethod = renderOutputMethod;
			XMLTagReader xMLTagReader = context.NewTagReader(LayerMetadataFile.LayerMetadataTag);
			while (xMLTagReader.FindNextStartTag())
			{
				if (xMLTagReader.TagIs("StrongHash"))
				{
					context.AssertUnique(this._encodableHash);
					this._encodableHash = new EncodableHash(context);
				}
			}
			context.AssertPresent(this._encodableHash, "StrongHash");
		}
Пример #18
0
        private LayerMetadataFile(RenderOutputMethod renderOutputMethod, MashupParseContext context)
        {
            this.renderOutputMethod = renderOutputMethod;
            XMLTagReader xMLTagReader = context.NewTagReader(LayerMetadataFile.LayerMetadataTag);

            while (xMLTagReader.FindNextStartTag())
            {
                if (xMLTagReader.TagIs("StrongHash"))
                {
                    context.AssertUnique(this._encodableHash);
                    this._encodableHash = new EncodableHash(context);
                }
            }
            context.AssertPresent(this._encodableHash, "StrongHash");
        }
Пример #19
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;
 }
Пример #20
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();
 }
Пример #21
0
        public static Uri Write(Mashup mashup, PostMessageDelegate postMessage, RenderOutputMethod renderOutput)
        {
            string arg = "";

            try
            {
                WriteMain(mashup, renderOutput, SampleHTMLFilename);
                WriteKey(mashup, renderOutput, SampleKeyFilename);
                return(renderOutput.GetUri(SampleHTMLFilename));
            }
            catch (Exception ex)
            {
                postMessage(string.Format("Couldn't write {0}: {1}", arg, ex.ToString()));
            }

            return(null);
        }
Пример #22
0
		public static void CopyFile(string sourcePath, RenderOutputMethod renderOutput, string relativeDestPath, string mimeType)
		{
			FileIdentification fileIdentificationStatic = FileOutputMethod.GetFileIdentificationStatic(sourcePath);
			FileIdentification fileIdentification = renderOutput.GetFileIdentification(relativeDestPath);
			if (fileIdentificationStatic.CompareTo(fileIdentification) == 0)
			{
				return;
			}
			Stream stream = new FileStream(sourcePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
			Stream stream2 = renderOutput.CreateFile(relativeDestPath, mimeType);
			byte[] buffer = new byte[65536];
			while (true)
			{
				int num = stream.Read(buffer, 0, 65536);
				if (num == 0)
				{
					break;
				}
				stream2.Write(buffer, 0, num);
			}
			stream.Close();
			stream2.Close();
		}
Пример #23
0
		public static LayerMetadataFile Read(RenderOutputMethod outputMethod)
		{
			LayerMetadataFile layerMetadataFile = null;
			Stream input = outputMethod.ReadFile("LayerMetadata.xml");
			XmlTextReader reader = new XmlTextReader(input);
			MashupParseContext mashupParseContext = new MashupParseContext(reader);
			using (mashupParseContext)
			{
				while (mashupParseContext.reader.Read())
				{
					if (mashupParseContext.reader.NodeType == XmlNodeType.Element && mashupParseContext.reader.Name == LayerMetadataFile.LayerMetadataTag)
					{
						layerMetadataFile = new LayerMetadataFile(outputMethod, mashupParseContext);
						break;
					}
				}
				mashupParseContext.Dispose();
			}
			if (layerMetadataFile == null)
			{
				throw new InvalidMashupFile(mashupParseContext, string.Format("{0} doesn't appear to be a valid {1}", outputMethod.GetUri("LayerMetadata.xml"), LayerMetadataFile.LayerMetadataTag));
			}
			return layerMetadataFile;
		}
Пример #24
0
		public LayerMetadataFile(RenderOutputMethod renderOutputMethod, EncodableHash encodableHash)
		{
			this.renderOutputMethod = renderOutputMethod;
			this._encodableHash = encodableHash;
		}
Пример #25
0
		public void WriteSourceMapLegendFrame(RenderOutputMethod renderOutput)
		{
			this.sourceMapLegendFrame.WriteSourceMapLegendFrame(renderOutput);
		}
		public ManifestOutputMethod(RenderOutputMethod baseMethod)
		{
			this.basePath = "";
			this.baseMethod = baseMethod;
			this.manifest = new Manifest(baseMethod);
		}
		private ManifestOutputMethod(RenderOutputMethod baseMethod, string basePath, Manifest manifest)
		{
			this.baseMethod = baseMethod;
			this.basePath = basePath;
			this.manifest = manifest;
		}
Пример #28
0
 public ManifestOutputMethod(RenderOutputMethod baseMethod)
 {
     basePath        = "";
     this.baseMethod = baseMethod;
     manifest        = new Manifest(baseMethod);
 }
Пример #29
0
 private ManifestOutputMethod(RenderOutputMethod baseMethod, string basePath, Manifest manifest)
 {
     this.baseMethod = baseMethod;
     this.basePath   = basePath;
     this.manifest   = manifest;
 }
Пример #30
0
 public Manifest(RenderOutputMethod storageMethod)
 {
     this.storageMethod = storageMethod;
     rootBlock          = FetchBlock(0);
 }
Пример #31
0
		internal void WriteSourceMapLegendFrames(RenderOutputMethod renderOutput)
		{
			foreach (SourceMapRecord current in this.sourceMapRecords)
			{
				current.WriteSourceMapLegendFrame(renderOutput);
			}
		}
Пример #32
0
 public void WriteSourceMapLegendFrame(RenderOutputMethod renderOutput)
 {
     this.sourceMapLegendFrame.WriteSourceMapLegendFrame(renderOutput);
 }
Пример #33
0
 public LayerMetadataFile(RenderOutputMethod renderOutputMethod, EncodableHash encodableHash)
 {
     this.renderOutputMethod = renderOutputMethod;
     _encodableHash          = encodableHash;
 }