public void WriteXML(XmlTextWriter writer) { writer.WriteStartElement(crunchedFileTag); writer.WriteAttributeString("xmlns:rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); writer.WriteAttributeString("xmlns:dc", "http://purl.org/dc/elements/1.1/"); writer.WriteAttributeString("xmlns:cc", "http://web.resource.org/cc/"); writer.WriteAttributeString("Version", "1.6"); writer.WriteAttributeString(renderDateTag, DateTime.Now.ToString()); if (sourceMashupFilename != null) { writer.WriteAttributeString(SourceMashupFilenameAttr, sourceMashupFilename); } if (permitComposition) { WritePermitCompositionLicense(writer); } writer.WriteStartElement("BoundsList"); foreach (TileRectangle current in boundsList) { writer.WriteStartElement("Bounds"); writer.WriteAttributeString("zoom", current.zoom.ToString()); writer.WriteAttributeString("X0", current.TopLeft.TileX.ToString()); writer.WriteAttributeString("Y0", current.TopLeft.TileY.ToString()); writer.WriteAttributeString("X1", (current.BottomRight.TileX + 1).ToString()); writer.WriteAttributeString("Y1", (current.BottomRight.TileY + 1).ToString()); writer.WriteEndElement(); } writer.WriteEndElement(); writer.WriteStartElement("CrunchedFileIdentifier"); FodderSupport.WriteAppFodderString(writer, FodderSupport.MapCruncherAppIDString, ""); writer.WriteEndElement(); writer.WriteStartElement("MapCruncherAppVersion"); writer.WriteAttributeString("version", MapCruncher.MSR.CVE.BackMaker.Resources.Version.ApplicationVersionNumber); FodderSupport.WriteAppFodderString(writer, FodderSupport.MapCruncherAppIDString, "Version" + FodderSupport.DigitsToLetters( FodderSupport.ExtractDigits( MapCruncher.MSR.CVE.BackMaker.Resources.Version.ApplicationVersionNumber))); writer.WriteEndElement(); writer.WriteStartElement(LayerList.GetXMLTag()); foreach (CrunchedLayer current2 in crunchedLayers) { current2.WriteXML(writer); } writer.WriteEndElement(); writer.WriteEndElement(); }
public CrunchedFile(MashupParseContext context) { XMLTagReader xMLTagReader = context.NewTagReader(CrunchedFile.crunchedFileTag); while (xMLTagReader.FindNextStartTag()) { if (xMLTagReader.TagIs(LayerList.GetXMLTag())) { XMLTagReader xMLTagReader2 = context.NewTagReader(LayerList.GetXMLTag()); while (xMLTagReader2.FindNextStartTag()) { if (xMLTagReader2.TagIs(CrunchedLayer.GetXMLTag())) { this.crunchedLayers.Add(new CrunchedLayer(context)); } } } } }
public void ReadXML(MashupParseContext context) { XMLTagReader xMLTagReader = context.NewTagReader("MapGrinderMashupFile"); context.version = MashupXMLSchemaVersion.ReadXMLAttribute(context.reader); SingleMaxZoomForEntireMashupCompatibilityBlob singleMaxZoomForEntireMashupCompatibilityBlob = null; string text = null; while (xMLTagReader.FindNextStartTag()) { if (context.version != MonolithicMapPositionsSchema.schema && xMLTagReader.TagIs(LayerList.GetXMLTag())) { layerList = new LayerList(context, GetFilenameContext, dirtyEvent, readyToLockEvent); } else { if (context.version == MonolithicMapPositionsSchema.schema && xMLTagReader.TagIs(SourceMap.GetXMLTag())) { if (layerList != null && layerList.Count > 0) { throw new InvalidMashupFile(context, string.Format("Multiple SourceMaps in Version {0} file.", context.version.versionNumberString)); } SourceMap sourceMap = new SourceMap(context, GetFilenameContext, dirtyEvent, readyToLockEvent); layerList = new LayerList(dirtyEvent); layerList.AddNewLayer(); layerList.First.Add(sourceMap); } else { if (xMLTagReader.TagIs(RenderOptions.GetXMLTag())) { renderOptions = new RenderOptions(context, dirtyEvent, ref singleMaxZoomForEntireMashupCompatibilityBlob); } else { if (xMLTagReader.TagIs(LastViewTag)) { XMLTagReader xMLTagReader2 = context.NewTagReader(LastViewTag); text = context.reader.GetAttribute(LastView_TargetIdAttr); xMLTagReader2.SkipAllSubTags(); } } } } } lastView = new NoView(); if (text != null) { object obj = context.FetchObjectByIdentity(text); if (obj != null && obj is LastViewIfc) { lastView = ((LastViewIfc)obj).lastView; } } if (renderOptions == null) { if (context.version != MonolithicMapPositionsSchema.schema) { context.warnings.Add(new MashupFileWarning("RenderOptions tag absent.")); } renderOptions = new RenderOptions(dirtyEvent); } if (singleMaxZoomForEntireMashupCompatibilityBlob != null) { D.Assert(context.version == SingleMaxZoomForEntireMashupSchema.schema); foreach (Layer current in layerList) { foreach (SourceMap current2 in current) { current2.sourceMapRenderOptions.maxZoom = singleMaxZoomForEntireMashupCompatibilityBlob.maxZoom; } } } }