Example #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();
 }
Example #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();
        }
Example #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));
 }
Example #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();
        }
Example #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;
 }
Example #6
0
 private void RemoveAutoSaveBackup()
 {
     try
     {
         File.Delete(Mashup.GetAutoSaveName(this.fileName));
     }
     catch (Exception ex)
     {
         D.Say(0, "Mashup.Close(): " + ex.ToString());
     }
 }
Example #7
0
        internal void UndoConstruction()
        {
            if (mashup != null)
            {
                mashup.dirtyEvent.Remove(MashupChangedHandler);
                mashup = null;
            }

            renderState.Dispose();
            renderState = null;
        }
Example #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);
 }
Example #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;
		}
Example #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;
 }
Example #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();
     }
 }
Example #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;
 }
Example #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);
        }
Example #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();
 }
		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();
		}
Example #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();
 }
Example #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);
        }
Example #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);
         }
     }
 }
		internal void UndoConstruction()
		{
			if (this.mashup != null)
			{
				this.mashup.dirtyEvent.Remove(new DirtyListener(this.MashupChangedHandler));
				this.mashup = null;
			}
			this.renderState.Dispose();
			this.renderState = null;
		}
Example #20
0
 public void SetMashup(Mashup mashup)
 {
     this._mashup = mashup;
     this.Reload();
 }
Example #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;
 }
Example #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();
 }
Example #23
0
 public void SetMashup(Mashup mashup)
 {
     _mashup = mashup;
     Reload();
 }
Example #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);
		}
Example #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);
		}
Example #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;
		}
Example #27
0
		public void SetMashup(Mashup mashup)
		{
			this._mashup = mashup;
			this.Reload();
		}