Ejemplo n.º 1
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();
 }
Ejemplo n.º 2
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();
        }
Ejemplo n.º 3
0
 public static Mashup OpenMashupInteractive(string fileName, out MashupFileWarningList warningList)
 {
     if (File.Exists(Mashup.GetAutoSaveName(fileName)))
     {
         RecoverAutoSavedFileDialog recoverAutoSavedFileDialog = new RecoverAutoSavedFileDialog();
         recoverAutoSavedFileDialog.Initialize(Mashup.GetAutoSaveName(fileName));
         DialogResult dialogResult = recoverAutoSavedFileDialog.ShowDialog();
         if (dialogResult == DialogResult.Yes)
         {
             Mashup mashup = new Mashup(Mashup.GetAutoSaveName(fileName), out warningList);
             mashup.fileName = Path.Combine(Path.GetDirectoryName(fileName), "Copy of " + Path.GetFileName(fileName));
             mashup.SetDirty();
             mashup.AutoSaveBackup();
             File.Delete(Mashup.GetAutoSaveName(fileName));
             return(mashup);
         }
         if (dialogResult == DialogResult.Ignore)
         {
             File.Delete(Mashup.GetAutoSaveName(fileName));
         }
         else
         {
             if (dialogResult == DialogResult.Cancel)
             {
                 warningList = null;
                 return(null);
             }
             D.Assert(false, "Invalid enum");
         }
     }
     return(new Mashup(fileName, out warningList));
 }
Ejemplo n.º 4
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();
        }
Ejemplo n.º 5
0
 internal void UndoConstruction()
 {
     if (this.mashup != null)
     {
         this.mashup.dirtyEvent.Remove(new DirtyListener(this.MashupChangedHandler));
         this.mashup = null;
     }
     this.renderState.Dispose();
     this.renderState = null;
 }
Ejemplo n.º 6
0
 private void RemoveAutoSaveBackup()
 {
     try
     {
         File.Delete(Mashup.GetAutoSaveName(this.fileName));
     }
     catch (Exception ex)
     {
         D.Say(0, "Mashup.Close(): " + ex.ToString());
     }
 }
Ejemplo n.º 7
0
        internal void UndoConstruction()
        {
            if (mashup != null)
            {
                mashup.dirtyEvent.Remove(MashupChangedHandler);
                mashup = null;
            }

            renderState.Dispose();
            renderState = null;
        }
Ejemplo n.º 8
0
 internal void Setup(RenderOptions renderOptions, Mashup currentMashup,
                     MapTileSourceFactory mapTileSourceFactory,
                     RenderProgressPanel2.LaunchRenderedBrowserDelegate LaunchRenderedBrowser,
                     RenderState.FlushRenderedTileCachePackageDelegate flushRenderedTileCachePackage)
 {
     renderOptionsPanel.SetRenderOptions(renderOptions);
     renderProgressPanel.Setup(currentMashup,
                               mapTileSourceFactory,
                               LaunchRenderedBrowser,
                               flushRenderedTileCachePackage);
 }
Ejemplo n.º 9
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;
		}
Ejemplo n.º 10
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;
 }
Ejemplo n.º 11
0
 public void SetFilename(string fileName)
 {
     if (File.Exists(Mashup.GetAutoSaveName(this.fileName)))
     {
         this.RemoveAutoSaveBackup();
         this.autoSaveDirty = true;
     }
     this.fileName = fileName;
     D.Assert(Path.GetFullPath(fileName).ToLower().Equals(fileName.ToLower()));
     if (this.autoSaveDirty)
     {
         this.AutoSaveBackup();
     }
 }
Ejemplo n.º 12
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.º 13
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.º 14
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.º 15
0
		public void Setup(Mashup mashup, MapTileSourceFactory mapTileSourceFactory, RenderProgressPanel2.LaunchRenderedBrowserDelegate launchRenderedBrowser, RenderState.FlushRenderedTileCachePackageDelegate flushRenderedTileCachePackage)
		{
			this.flushRenderedTileCachePackage = flushRenderedTileCachePackage;
			this.ReplacePreviewImage(null);
			if (this.mashup != null)
			{
				this.mashup.dirtyEvent.Remove(new DirtyListener(this.MashupChangedHandler));
			}
			this.mashup = mashup;
			this.mapTileSourceFactory = mapTileSourceFactory;
			this.launchRenderedBrowser = launchRenderedBrowser;
			if (this.mashup != null)
			{
				this.mashup.dirtyEvent.Add(new DirtyListener(this.MashupChangedHandler));
			}
			this.MashupChangedHandler();
		}
Ejemplo n.º 16
0
 public void Setup(Mashup mashup, MapTileSourceFactory mapTileSourceFactory, RenderProgressPanel2.LaunchRenderedBrowserDelegate launchRenderedBrowser, RenderState.FlushRenderedTileCachePackageDelegate flushRenderedTileCachePackage)
 {
     this.flushRenderedTileCachePackage = flushRenderedTileCachePackage;
     this.ReplacePreviewImage(null);
     if (this.mashup != null)
     {
         this.mashup.dirtyEvent.Remove(new DirtyListener(this.MashupChangedHandler));
     }
     this.mashup = mashup;
     this.mapTileSourceFactory  = mapTileSourceFactory;
     this.launchRenderedBrowser = launchRenderedBrowser;
     if (this.mashup != null)
     {
         this.mashup.dirtyEvent.Add(new DirtyListener(this.MashupChangedHandler));
     }
     this.MashupChangedHandler();
 }
Ejemplo n.º 17
0
        internal Mashup Duplicate()
        {
            MemoryStream memoryStream = new MemoryStream();

            using (memoryStream)
            {
                this.WriteXML(new MashupWriteContext(new XmlTextWriter(memoryStream, null)));
            }
            MemoryStream memoryStream3 = new MemoryStream(memoryStream.ToArray());
            Mashup       result;

            using (memoryStream3)
            {
                MashupFileWarningList mashupFileWarningList;
                Mashup mashup = new Mashup(this.fileName, memoryStream3, out mashupFileWarningList);
                D.Assert(mashupFileWarningList == null);
                result = mashup;
            }
            return(result);
        }
Ejemplo n.º 18
0
 internal void AutoSaveBackup()
 {
     if (!this.autoSaveDirty)
     {
         return;
     }
     try
     {
         this.WriteXML(Mashup.GetAutoSaveName(this.fileName));
         this.autoSaveDirty        = false;
         this.autoSaveFailNotified = false;
     }
     catch (Exception ex)
     {
         if (!this.autoSaveFailNotified)
         {
             this.autoSaveFailNotified = true;
             MessageBox.Show(string.Format("Failed to autosave {0}:\n{1}", Mashup.GetAutoSaveName(this.fileName), ex.Message), "AutoSave Failed", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         }
     }
 }
Ejemplo n.º 19
0
		internal void UndoConstruction()
		{
			if (this.mashup != null)
			{
				this.mashup.dirtyEvent.Remove(new DirtyListener(this.MashupChangedHandler));
				this.mashup = null;
			}
			this.renderState.Dispose();
			this.renderState = null;
		}
Ejemplo n.º 20
0
 public void SetMashup(Mashup mashup)
 {
     this._mashup = mashup;
     this.Reload();
 }
Ejemplo n.º 21
0
 private bool CloseMashup()
 {
     if (this.currentMashup == null)
     {
         return true;
     }
     if (this.currentMashup.IsDirty())
     {
         string text;
         if (this.currentMashup.GetFilename() == null)
         {
             text = "Save untitled mashup?";
         }
         else
         {
             text = string.Format("Save changes to mashup {0}?", this.currentMashup.GetFilename());
         }
         DialogResult dialogResult = MessageBox.Show(text, "Save changes?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);
         if (dialogResult == DialogResult.Cancel)
         {
             return false;
         }
         if (dialogResult == DialogResult.Yes && !this.SaveMashup())
         {
             return false;
         }
     }
     this.currentMashup.Close();
     this.currentMashup = null;
     this.SetInterfaceNoMashupOpen();
     return true;
 }
Ejemplo n.º 22
0
 private void OpenMashup(Mashup newmash)
 {
     D.Assert(this.currentMashup == null);
     this.currentMashup = newmash;
     this.OpenView(new NothingLayerViewManager(this));
     this.EnableMashupInterfaceItems(true);
     this.updateWindowTitle();
     this.layerControls.SetMashup(this.currentMashup);
     this.currentMashup.readyToLockEvent.Add(new DirtyListener(this.ReadyToLockChangedHandler));
     this.ReadyToLockChanged();
 }
Ejemplo n.º 23
0
 public void SetMashup(Mashup mashup)
 {
     _mashup = mashup;
     Reload();
 }
Ejemplo n.º 24
0
		internal void Setup(RenderOptions renderOptions, Mashup currentMashup, MapTileSourceFactory mapTileSourceFactory, RenderProgressPanel2.LaunchRenderedBrowserDelegate LaunchRenderedBrowser, RenderState.FlushRenderedTileCachePackageDelegate flushRenderedTileCachePackage)
		{
			this.renderOptionsPanel.SetRenderOptions(renderOptions);
			this.renderProgressPanel.Setup(currentMashup, mapTileSourceFactory, LaunchRenderedBrowser, flushRenderedTileCachePackage);
		}
Ejemplo n.º 25
0
		public static Mashup OpenMashupInteractive(string fileName, out MashupFileWarningList warningList)
		{
			if (File.Exists(Mashup.GetAutoSaveName(fileName)))
			{
				RecoverAutoSavedFileDialog recoverAutoSavedFileDialog = new RecoverAutoSavedFileDialog();
				recoverAutoSavedFileDialog.Initialize(Mashup.GetAutoSaveName(fileName));
				DialogResult dialogResult = recoverAutoSavedFileDialog.ShowDialog();
				if (dialogResult == DialogResult.Yes)
				{
					Mashup mashup = new Mashup(Mashup.GetAutoSaveName(fileName), out warningList);
					mashup.fileName = Path.Combine(Path.GetDirectoryName(fileName), "Copy of " + Path.GetFileName(fileName));
					mashup.SetDirty();
					mashup.AutoSaveBackup();
					File.Delete(Mashup.GetAutoSaveName(fileName));
					return mashup;
				}
				if (dialogResult == DialogResult.Ignore)
				{
					File.Delete(Mashup.GetAutoSaveName(fileName));
				}
				else
				{
					if (dialogResult == DialogResult.Cancel)
					{
						warningList = null;
						return null;
					}
					D.Assert(false, "Invalid enum");
				}
			}
			return new Mashup(fileName, out warningList);
		}
Ejemplo n.º 26
0
		internal Mashup Duplicate()
		{
			MemoryStream memoryStream = new MemoryStream();
			using (memoryStream)
			{
				this.WriteXML(new MashupWriteContext(new XmlTextWriter(memoryStream, null)));
			}
			MemoryStream memoryStream3 = new MemoryStream(memoryStream.ToArray());
			Mashup result;
			using (memoryStream3)
			{
				MashupFileWarningList mashupFileWarningList;
				Mashup mashup = new Mashup(this.fileName, memoryStream3, out mashupFileWarningList);
				D.Assert(mashupFileWarningList == null);
				result = mashup;
			}
			return result;
		}
Ejemplo n.º 27
0
		public void SetMashup(Mashup mashup)
		{
			this._mashup = mashup;
			this.Reload();
		}