public RenderToS3Options(MashupParseContext context, DirtyEvent parentDirtyEvent)
		{
			XMLTagReader xMLTagReader = context.NewTagReader(RenderToS3Options.xmlTag);
			this._s3credentialsFilename = new DirtyString(parentDirtyEvent);
			this.s3credentialsFilename = context.GetRequiredAttribute(RenderToS3Options.attr_s3credentialsFilename);
			this._s3bucket = new DirtyString(parentDirtyEvent);
			this.s3bucket = context.GetRequiredAttribute(RenderToS3Options.attr_s3bucket);
			this._s3pathPrefix = new DirtyString(parentDirtyEvent);
			this.s3pathPrefix = context.GetRequiredAttribute(RenderToS3Options.attr_s3pathPrefix);
			xMLTagReader.SkipAllSubTags();
		}
示例#2
0
        public RenderToS3Options(MashupParseContext context, DirtyEvent parentDirtyEvent)
        {
            XMLTagReader xMLTagReader = context.NewTagReader(RenderToS3Options.xmlTag);

            this._s3credentialsFilename = new DirtyString(parentDirtyEvent);
            this.s3credentialsFilename  = context.GetRequiredAttribute(RenderToS3Options.attr_s3credentialsFilename);
            this._s3bucket     = new DirtyString(parentDirtyEvent);
            this.s3bucket      = context.GetRequiredAttribute(RenderToS3Options.attr_s3bucket);
            this._s3pathPrefix = new DirtyString(parentDirtyEvent);
            this.s3pathPrefix  = context.GetRequiredAttribute(RenderToS3Options.attr_s3pathPrefix);
            xMLTagReader.SkipAllSubTags();
        }
示例#3
0
        public SourceMapRecord(MashupParseContext context)
        {
            this.displayName = context.GetRequiredAttribute("DisplayName");
            XMLTagReader xMLTagReader = context.NewTagReader("SourceMapRecord");

            while (xMLTagReader.FindNextStartTag())
            {
                if (xMLTagReader.TagIs(SourceMapInfo.GetXMLTag()))
                {
                    this.sourceMapInfo = new SourceMapInfo(context, new DirtyEvent());
                }
                else
                {
                    if (xMLTagReader.TagIs(MapRectangle.GetXMLTag()))
                    {
                        this.userBoundingRect = new MapRectangle(context, MercatorCoordinateSystem.theInstance);
                    }
                    else
                    {
                        if (xMLTagReader.TagIs(LegendRecord.GetXMLTag()))
                        {
                            this.legendRecords.Add(new LegendRecord(context));
                        }
                        else
                        {
                            if (xMLTagReader.TagIs(SourceMapLegendFrame.GetXMLTag()))
                            {
                                context.AssertUnique(this.sourceMapLegendFrame);
                                this.sourceMapLegendFrame = new SourceMapLegendFrame(context);
                            }
                        }
                    }
                }
            }
        }
		public RenderToFileOptions(MashupParseContext context, DirtyEvent parentDirtyEvent, string byTagName)
		{
			XMLTagReader xMLTagReader = context.NewTagReader(byTagName);
			this._outputFolder = new DirtyString(parentDirtyEvent);
			this.outputFolder = context.GetRequiredAttribute(RenderToFileOptions.OutputFolderAttr);
			xMLTagReader.SkipAllSubTags();
		}
示例#5
0
文件: Legend.cs 项目: gabilic/Oplan
        public Legend(SourceMap sourceMap, MashupParseContext context, DirtyEvent parentEvent, DirtyEvent parentBoundsChangedEvent)
        {
            this._sourceMap          = sourceMap;
            this.dirtyEvent          = new DirtyEvent(parentEvent);
            this._latentRegionHolder = new LatentRegionHolder(this.dirtyEvent, parentBoundsChangedEvent);
            this._displayName        = context.GetRequiredAttribute("DisplayName");
            string attribute = context.reader.GetAttribute("RenderedSize");

            if (attribute != null)
            {
                Legend.renderedSizeRange.Parse(context, "RenderedSize", attribute);
            }
            XMLTagReader xMLTagReader = context.NewTagReader(Legend.GetXMLTag());

            context.ExpectIdentity(this);
            while (xMLTagReader.FindNextStartTag())
            {
                if (xMLTagReader.TagIs(RenderRegion.GetXMLTag()))
                {
                    context.AssertUnique(this._latentRegionHolder.renderRegion);
                    this._latentRegionHolder.renderRegion = new RenderRegion(context, this.dirtyEvent, ContinuousCoordinateSystem.theInstance);
                }
                else
                {
                    if (xMLTagReader.TagIs(LegendView.GetXMLTag()))
                    {
                        this._lastView = new LegendView(this, context);
                    }
                }
            }
        }
		public SourceMapRecord(MashupParseContext context)
		{
			this.displayName = context.GetRequiredAttribute("DisplayName");
			XMLTagReader xMLTagReader = context.NewTagReader("SourceMapRecord");
			while (xMLTagReader.FindNextStartTag())
			{
				if (xMLTagReader.TagIs(SourceMapInfo.GetXMLTag()))
				{
					this.sourceMapInfo = new SourceMapInfo(context, new DirtyEvent());
				}
				else
				{
					if (xMLTagReader.TagIs(MapRectangle.GetXMLTag()))
					{
						this.userBoundingRect = new MapRectangle(context, MercatorCoordinateSystem.theInstance);
					}
					else
					{
						if (xMLTagReader.TagIs(LegendRecord.GetXMLTag()))
						{
							this.legendRecords.Add(new LegendRecord(context));
						}
						else
						{
							if (xMLTagReader.TagIs(SourceMapLegendFrame.GetXMLTag()))
							{
								context.AssertUnique(this.sourceMapLegendFrame);
								this.sourceMapLegendFrame = new SourceMapLegendFrame(context);
							}
						}
					}
				}
			}
		}
示例#7
0
        public static LatLonZoom ReadFromAttributes(MashupParseContext context, CoordinateSystemIfc coordSys)
        {
            int zoom = coordSys.GetZoomRange()
                       .ParseAllowUndefinedZoom(context, "zoom", context.GetRequiredAttribute("zoom"));
            LatLon latLon = LatLon.ReadFromAttributes(context, coordSys);

            return(new LatLonZoom(latLon.lat, latLon.lon, zoom));
        }
示例#8
0
        public RenderToFileOptions(MashupParseContext context, DirtyEvent parentDirtyEvent, string byTagName)
        {
            XMLTagReader xMLTagReader = context.NewTagReader(byTagName);

            this._outputFolder = new DirtyString(parentDirtyEvent);
            this.outputFolder  = context.GetRequiredAttribute(RenderToFileOptions.OutputFolderAttr);
            xMLTagReader.SkipAllSubTags();
        }
示例#9
0
		public LegendRecord(MashupParseContext context)
		{
			XMLTagReader xMLTagReader = context.NewTagReader("Legend");
			this.url = context.GetRequiredAttribute("URL");
			this.displayName = context.GetRequiredAttribute("DisplayName");
			object obj = null;
			while (xMLTagReader.FindNextStartTag())
			{
				if (xMLTagReader.TagIs("Size"))
				{
					context.AssertUnique(obj);
					obj = new object();
					this.imageDimensions = XMLUtils.ReadSize(context);
				}
			}
			context.AssertPresent(obj, "Size");
		}
		public LocalDocumentDescriptor(MashupParseContext context, string pathBase)
		{
			XMLTagReader xMLTagReader = context.NewTagReader(LocalDocumentDescriptor.GetXMLTag());
			string requiredAttribute = context.GetRequiredAttribute(LocalDocumentDescriptor.LocalDocumentFilenameAttr);
			this._filename = Path.Combine(pathBase, requiredAttribute);
			this._pageNumber = context.GetRequiredAttributeInt(LocalDocumentDescriptor.LocalDocumentPageNumberAttr);
			xMLTagReader.SkipAllSubTags();
		}
示例#11
0
        public SourceMapInfo(MashupParseContext context, DirtyEvent parentDirty)
        {
            dirtyEvent = new DirtyEvent(parentDirty);
            XMLTagReader xMLTagReader = context.NewTagReader(GetXMLTag());

            while (xMLTagReader.FindNextStartTag())
            {
                if (xMLTagReader.TagIs("MapFileURL"))
                {
                    if (context.version == SourceMapInfoAsCharDataSchema.schema)
                    {
                        _mapFileURL = XMLUtils.ReadStringXml(context, "MapFileURL");
                    }
                    else
                    {
                        XMLTagReader xMLTagReader2 = context.NewTagReader("MapFileURL");
                        _mapFileURL = context.GetRequiredAttribute("url");
                        xMLTagReader2.SkipAllSubTags();
                    }
                }
                else
                {
                    if (xMLTagReader.TagIs("MapHomePage"))
                    {
                        if (context.version == SourceMapInfoAsCharDataSchema.schema)
                        {
                            _mapHomePage = XMLUtils.ReadStringXml(context, "MapHomePage");
                        }
                        else
                        {
                            XMLTagReader xMLTagReader3 = context.NewTagReader("MapHomePage");
                            _mapHomePage = context.GetRequiredAttribute("url");
                            xMLTagReader3.SkipAllSubTags();
                        }
                    }
                    else
                    {
                        if (xMLTagReader.TagIs("MapDescription"))
                        {
                            _mapDescription = XMLUtils.ReadStringXml(context, "MapDescription");
                        }
                    }
                }
            }
        }
		public SourceMapLegendFrame(MashupParseContext context)
		{
			XMLTagReader xMLTagReader = context.NewTagReader(SourceMapLegendFrame.GetXMLTag());
			this.filename = context.GetRequiredAttribute("Filename");
			this.loadedSize.Width = context.GetRequiredAttributeInt("Width");
			this.loadedSize.Height = context.GetRequiredAttributeInt("Height");
			this.useLoadedSize = true;
			xMLTagReader.SkipAllSubTags();
		}
示例#13
0
        public LocalDocumentDescriptor(MashupParseContext context, string pathBase)
        {
            XMLTagReader xMLTagReader      = context.NewTagReader(GetXMLTag());
            string       requiredAttribute = context.GetRequiredAttribute(LocalDocumentFilenameAttr);

            _filename   = Path.Combine(pathBase, requiredAttribute);
            _pageNumber = context.GetRequiredAttributeInt(LocalDocumentPageNumberAttr);
            xMLTagReader.SkipAllSubTags();
        }
示例#14
0
 public SourceMapInfo(MashupParseContext context, DirtyEvent parentDirty)
 {
     this.dirtyEvent = new DirtyEvent(parentDirty);
     XMLTagReader xMLTagReader = context.NewTagReader(SourceMapInfo.GetXMLTag());
     while (xMLTagReader.FindNextStartTag())
     {
         if (xMLTagReader.TagIs("MapFileURL"))
         {
             if (context.version == SourceMapInfoAsCharDataSchema.schema)
             {
                 this._mapFileURL = XMLUtils.ReadStringXml(context, "MapFileURL");
             }
             else
             {
                 XMLTagReader xMLTagReader2 = context.NewTagReader("MapFileURL");
                 this._mapFileURL = context.GetRequiredAttribute("url");
                 xMLTagReader2.SkipAllSubTags();
             }
         }
         else
         {
             if (xMLTagReader.TagIs("MapHomePage"))
             {
                 if (context.version == SourceMapInfoAsCharDataSchema.schema)
                 {
                     this._mapHomePage = XMLUtils.ReadStringXml(context, "MapHomePage");
                 }
                 else
                 {
                     XMLTagReader xMLTagReader3 = context.NewTagReader("MapHomePage");
                     this._mapHomePage = context.GetRequiredAttribute("url");
                     xMLTagReader3.SkipAllSubTags();
                 }
             }
             else
             {
                 if (xMLTagReader.TagIs("MapDescription"))
                 {
                     this._mapDescription = XMLUtils.ReadStringXml(context, "MapDescription");
                 }
             }
         }
     }
 }
示例#15
0
        public LegendRecord(MashupParseContext context)
        {
            XMLTagReader xMLTagReader = context.NewTagReader("Legend");

            this.url         = context.GetRequiredAttribute("URL");
            this.displayName = context.GetRequiredAttribute("DisplayName");
            object obj = null;

            while (xMLTagReader.FindNextStartTag())
            {
                if (xMLTagReader.TagIs("Size"))
                {
                    context.AssertUnique(obj);
                    obj = new object();
                    this.imageDimensions = XMLUtils.ReadSize(context);
                }
            }
            context.AssertPresent(obj, "Size");
        }
示例#16
0
 public static ViewState ReadXML(MashupParseContext context)
 {
     string requiredAttribute = context.GetRequiredAttribute("Value");
     if (requiredAttribute == "Locked")
     {
         return ViewState.Slaved;
     }
     D.Assert(requiredAttribute == "Unlocked");
     return ViewState.Unslaved;
 }
示例#17
0
        public SourceMapLegendFrame(MashupParseContext context)
        {
            XMLTagReader xMLTagReader = context.NewTagReader(GetXMLTag());

            filename          = context.GetRequiredAttribute("Filename");
            loadedSize.Width  = context.GetRequiredAttributeInt("Width");
            loadedSize.Height = context.GetRequiredAttributeInt("Height");
            useLoadedSize     = true;
            xMLTagReader.SkipAllSubTags();
        }
示例#18
0
        public static ViewState ReadXML(MashupParseContext context)
        {
            string requiredAttribute = context.GetRequiredAttribute("Value");

            if (requiredAttribute == "Locked")
            {
                return(ViewState.Slaved);
            }
            D.Assert(requiredAttribute == "Unlocked");
            return(ViewState.Unslaved);
        }
示例#19
0
            public ManifestRecord(MashupParseContext context, ManifestBlock block)
            {
                this.block = block;
                XMLTagReader xMLTagReader = context.NewTagReader("ManifestRecord");

                path                    = context.GetRequiredAttribute("Path");
                _fileExists             = context.GetRequiredAttributeBoolean("FileExists");
                _fileLength             = context.GetRequiredAttributeLong("FileLength");
                indirectManifestBlockId = context.GetRequiredAttributeInt("IndirectManifestBlockId");
                xMLTagReader.SkipAllSubTags();
            }
示例#20
0
        private void TryOneFetchFormatString()
        {
            try
            {
                HttpWebRequest httpWebRequest =
                    (HttpWebRequest)WebRequest.Create(BuildConfig.theConfig.veFormatUpdateURL);
                httpWebRequest.Timeout = 5000;
                HttpWebResponse httpWebResponse;
                try
                {
                    httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
                }
                catch (WebException)
                {
                    return;
                }

                if (httpWebResponse.StatusCode == HttpStatusCode.OK)
                {
                    Stream             responseStream     = httpWebResponse.GetResponseStream();
                    XmlTextReader      reader             = new XmlTextReader(responseStream);
                    MashupParseContext mashupParseContext = new MashupParseContext(reader);
                    using (mashupParseContext)
                    {
                        while (mashupParseContext.reader.Read())
                        {
                            if (mashupParseContext.reader.NodeType == XmlNodeType.Element &&
                                mashupParseContext.reader.Name == "VEUrlFormat")
                            {
                                XMLTagReader xMLTagReader = mashupParseContext.NewTagReader("VEUrlFormat");
                                formatString     = mashupParseContext.GetRequiredAttribute("FormatString");
                                generationNumber = mashupParseContext.GetRequiredAttributeInt("GenerationNumber");
                                xMLTagReader.SkipAllSubTags();
                                break;
                            }
                        }

                        mashupParseContext.Dispose();
                    }
                }
            }
            catch (Exception ex)
            {
                D.Sayf(0, "VEUrlFormat fetch failed with unexpected {0}", new object[] { ex });
            }
        }
示例#21
0
		private void TryOneFetchFormatString()
		{
			try
			{
				HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(BuildConfig.theConfig.veFormatUpdateURL);
				httpWebRequest.Timeout = 5000;
				HttpWebResponse httpWebResponse;
				try
				{
					httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
				}
				catch (WebException)
				{
					return;
				}
				if (httpWebResponse.StatusCode == HttpStatusCode.OK)
				{
					Stream responseStream = httpWebResponse.GetResponseStream();
					XmlTextReader reader = new XmlTextReader(responseStream);
					MashupParseContext mashupParseContext = new MashupParseContext(reader);
					using (mashupParseContext)
					{
						while (mashupParseContext.reader.Read())
						{
							if (mashupParseContext.reader.NodeType == XmlNodeType.Element && mashupParseContext.reader.Name == "VEUrlFormat")
							{
								XMLTagReader xMLTagReader = mashupParseContext.NewTagReader("VEUrlFormat");
								this.formatString = mashupParseContext.GetRequiredAttribute("FormatString");
								this.generationNumber = mashupParseContext.GetRequiredAttributeInt("GenerationNumber");
								xMLTagReader.SkipAllSubTags();
								break;
							}
						}
						mashupParseContext.Dispose();
					}
				}
			}
			catch (Exception ex)
			{
				D.Sayf(0, "VEUrlFormat fetch failed with unexpected {0}", new object[]
				{
					ex
				});
			}
		}
示例#22
0
文件: Legend.cs 项目: mikhp/greatmaps
		public Legend(SourceMap sourceMap, MashupParseContext context, DirtyEvent parentEvent, DirtyEvent parentBoundsChangedEvent)
		{
			this._sourceMap = sourceMap;
			this.dirtyEvent = new DirtyEvent(parentEvent);
			this._latentRegionHolder = new LatentRegionHolder(this.dirtyEvent, parentBoundsChangedEvent);
			this._displayName = context.GetRequiredAttribute("DisplayName");
			string attribute = context.reader.GetAttribute("RenderedSize");
			if (attribute != null)
			{
				Legend.renderedSizeRange.Parse(context, "RenderedSize", attribute);
			}
			XMLTagReader xMLTagReader = context.NewTagReader(Legend.GetXMLTag());
			context.ExpectIdentity(this);
			while (xMLTagReader.FindNextStartTag())
			{
				if (xMLTagReader.TagIs(RenderRegion.GetXMLTag()))
				{
					context.AssertUnique(this._latentRegionHolder.renderRegion);
					this._latentRegionHolder.renderRegion = new RenderRegion(context, this.dirtyEvent, ContinuousCoordinateSystem.theInstance);
				}
				else
				{
					if (xMLTagReader.TagIs(LegendView.GetXMLTag()))
					{
						this._lastView = new LegendView(this, context);
					}
				}
			}
		}
示例#23
0
        public SourceMap(MashupParseContext context, GetFilenameContext filenameContextDelegate, DirtyEvent parentDirty,
                         DirtyEvent parentReadyToLockEvent)
        {
            dirtyEvent = new DirtyEvent(parentDirty);
            readyToLockChangedEvent      = new DirtyEvent(parentReadyToLockEvent);
            this.filenameContextDelegate = filenameContextDelegate;
            latentRegionHolder           = new LatentRegionHolder(dirtyEvent, readyToLockChangedEvent);
            var xMLTagReader = context.NewTagReader("SourceMap");

            context.ExpectIdentity(this);
            string attribute = context.reader.GetAttribute("SourceMapFilename");

            if (attribute != null)
            {
                string path       = Path.Combine(filenameContextDelegate(), attribute);
                int    pageNumber = 0;
                context.GetAttributeInt("PageNumber", ref pageNumber);
                documentFuture = new GeneralDocumentFuture(new FutureDocumentFromFilesystem(path, pageNumber));
            }

            context.GetAttributeBoolean("Expanded", ref _expanded);
            string      attribute2   = context.reader.GetAttribute("DisplayName");
            MapPosition mapPosition  = null;
            MapPosition mapPosition2 = null;

            while (xMLTagReader.FindNextStartTag())
            {
                if (xMLTagReader.TagIs(RegistrationDefinition.GetXMLTag()))
                {
                    context.AssertUnique(registration);
                    registration = new RegistrationDefinition(context, dirtyEvent);
                }
                else
                {
                    if (xMLTagReader.TagIs(GeneralDocumentFuture.GetXMLTag()))
                    {
                        context.AssertUnique(documentFuture);
                        documentFuture = new GeneralDocumentFuture(context, filenameContextDelegate());
                    }
                    else
                    {
                        if (xMLTagReader.TagIs(LocalDocumentDescriptor.GetXMLTag()))
                        {
                            context.AssertUnique(documentFuture);
                            var localDocumentDescriptor =
                                new LocalDocumentDescriptor(context, filenameContextDelegate());
                            documentFuture = new GeneralDocumentFuture(
                                new FutureDocumentFromFilesystem(localDocumentDescriptor.GetFilesystemAbsolutePath(),
                                                                 localDocumentDescriptor.GetPageNumber()));
                        }
                        else
                        {
                            if (xMLTagReader.TagIs("LastSourceMapPosition"))
                            {
                                var xMLTagReader2 = context.NewTagReader("LastSourceMapPosition");
                                while (xMLTagReader2.FindNextStartTag())
                                {
                                    if (xMLTagReader2.TagIs(MapPosition.GetXMLTag(context.version)))
                                    {
                                        mapPosition = new MapPosition(context,
                                                                      null,
                                                                      ContinuousCoordinateSystem.theInstance);
                                    }
                                }
                            }
                            else
                            {
                                if (xMLTagReader.TagIs("LastVEPosition"))
                                {
                                    var xMLTagReader3 = context.NewTagReader("LastVEPosition");
                                    while (xMLTagReader3.FindNextStartTag())
                                    {
                                        if (xMLTagReader3.TagIs(MapPosition.GetXMLTag(context.version)))
                                        {
                                            mapPosition2 = new MapPosition(context,
                                                                           null,
                                                                           MercatorCoordinateSystem.theInstance);
                                        }
                                    }
                                }
                                else
                                {
                                    if (xMLTagReader.TagIs(RenderRegion.GetXMLTag()))
                                    {
                                        context.AssertUnique(renderRegion);
                                        renderRegion = new RenderRegion(context,
                                                                        dirtyEvent,
                                                                        ContinuousCoordinateSystem.theInstance);
                                    }
                                    else
                                    {
                                        if (xMLTagReader.TagIs(SourceMapInfo.GetXMLTag()))
                                        {
                                            context.AssertUnique(sourceMapInfo);
                                            sourceMapInfo = new SourceMapInfo(context, dirtyEvent);
                                        }
                                        else
                                        {
                                            if (xMLTagReader.TagIs(SourceMapRenderOptions.GetXMLTag()))
                                            {
                                                context.AssertUnique(sourceMapRenderOptions);
                                                sourceMapRenderOptions =
                                                    new SourceMapRenderOptions(context, dirtyEvent);
                                            }
                                            else
                                            {
                                                if (xMLTagReader.TagIs(TransparencyOptions.GetXMLTag()))
                                                {
                                                    transparencyOptions =
                                                        new TransparencyOptions(context, dirtyEvent);
                                                }
                                                else
                                                {
                                                    if (xMLTagReader.TagIs(SourceMapRegistrationView.GetXMLTag()))
                                                    {
                                                        context.AssertUnique(_lastView);
                                                        _lastView = new SourceMapRegistrationView(this, context);
                                                    }
                                                    else
                                                    {
                                                        if (xMLTagReader.TagIs(LegendList.GetXMLTag()))
                                                        {
                                                            context.AssertUnique(legendList);
                                                            legendList = new LegendList(this,
                                                                                        context,
                                                                                        dirtyEvent);
                                                        }
                                                        else
                                                        {
                                                            if (xMLTagReader.TagIs("SnapView"))
                                                            {
                                                                var xMLTagReader4 =
                                                                    context.NewTagReader("SnapView");
                                                                string requiredAttribute =
                                                                    context.GetRequiredAttribute("Context");
                                                                var  latLonZoom = default(LatLonZoom);
                                                                bool flag       = false;
                                                                bool flag2      = true;
                                                                CoordinateSystemIfc coordSys;
                                                                if (requiredAttribute == "Source")
                                                                {
                                                                    coordSys = ContinuousCoordinateSystem.theInstance;
                                                                }
                                                                else
                                                                {
                                                                    if (!(requiredAttribute == "Reference"))
                                                                    {
                                                                        throw new InvalidMashupFile(context,
                                                                                                    string.Format("Invalid {0} value {1}",
                                                                                                                  "Context",
                                                                                                                  requiredAttribute));
                                                                    }

                                                                    coordSys = MercatorCoordinateSystem.theInstance;
                                                                }

                                                                while (xMLTagReader4.FindNextStartTag())
                                                                {
                                                                    if (xMLTagReader4.TagIs(LatLonZoom.GetXMLTag()))
                                                                    {
                                                                        if (flag)
                                                                        {
                                                                            context.ThrowUnique();
                                                                        }

                                                                        try
                                                                        {
                                                                            latLonZoom = new LatLonZoom(context,
                                                                                                        coordSys);
                                                                        }
                                                                        catch (InvalidLLZ)
                                                                        {
                                                                            flag2 = false;
                                                                        }

                                                                        flag = true;
                                                                    }
                                                                }

                                                                if (flag2)
                                                                {
                                                                    if (!flag)
                                                                    {
                                                                        context.AssertPresent(null,
                                                                                              LatLonZoom.GetXMLTag());
                                                                    }

                                                                    if (requiredAttribute == "Source")
                                                                    {
                                                                        sourceSnap = latLonZoom;
                                                                    }
                                                                    else
                                                                    {
                                                                        if (requiredAttribute == "Reference")
                                                                        {
                                                                            referenceSnap = latLonZoom;
                                                                        }
                                                                        else
                                                                        {
                                                                            D.Assert(false, "handled above.");
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                            else
                                                            {
                                                                if (xMLTagReader.TagIs("SnapZoom"))
                                                                {
                                                                    context.NewTagReader("SnapZoom");
                                                                    string requiredAttribute2 =
                                                                        context.GetRequiredAttribute("Context");
                                                                    bool flag3 = false;
                                                                    CoordinateSystemIfc theInstance;
                                                                    if (requiredAttribute2 == "Source")
                                                                    {
                                                                        theInstance = ContinuousCoordinateSystem
                                                                                      .theInstance;
                                                                    }
                                                                    else
                                                                    {
                                                                        if (!(requiredAttribute2 == "Reference"))
                                                                        {
                                                                            throw new InvalidMashupFile(context,
                                                                                                        string.Format("Invalid {0} value {1}",
                                                                                                                      "Context",
                                                                                                                      requiredAttribute2));
                                                                        }

                                                                        theInstance = MercatorCoordinateSystem
                                                                                      .theInstance;
                                                                    }

                                                                    int num = 0;
                                                                    try
                                                                    {
                                                                        theInstance.GetZoomRange()
                                                                        .Parse(context, "Zoom");
                                                                        flag3 = true;
                                                                    }
                                                                    catch (InvalidMashupFile)
                                                                    {
                                                                    }

                                                                    if (flag3)
                                                                    {
                                                                        if (requiredAttribute2 == "Source")
                                                                        {
                                                                            sourceSnapZoom = num;
                                                                        }
                                                                        else
                                                                        {
                                                                            if (requiredAttribute2 == "Reference")
                                                                            {
                                                                                referenceSnapZoom = num;
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }

                if (context.version == InlineSourceMapInfoSchema.schema)
                {
                    if (xMLTagReader.TagIs("MapFileURL"))
                    {
                        sourceMapInfo.mapFileURL = XMLUtils.ReadStringXml(context, "MapFileURL");
                    }
                    else
                    {
                        if (xMLTagReader.TagIs("MapHomePage"))
                        {
                            sourceMapInfo.mapHomePage = XMLUtils.ReadStringXml(context, "MapHomePage");
                        }
                        else
                        {
                            if (xMLTagReader.TagIs("MapDescription"))
                            {
                                sourceMapInfo.mapDescription = XMLUtils.ReadStringXml(context, "MapDescription");
                            }
                        }
                    }
                }
            }

            if (attribute2 != null)
            {
                _displayName = attribute2;
            }
            else
            {
                _displayName = documentFuture.documentFuture.GetDefaultDisplayName();
            }

            if (_lastView == null && mapPosition != null && mapPosition2 != null)
            {
                _lastView = new SourceMapRegistrationView(this, mapPosition.llz, mapPosition2);
            }

            if (documentFuture == null)
            {
                throw new Exception("Source Map element missing document descriptor tag");
            }

            if (registration == null)
            {
                registration = new RegistrationDefinition(dirtyEvent);
            }

            registration.dirtyEvent.Add(readyToLockChangedEvent);
            if (legendList == null)
            {
                legendList = new LegendList(this, dirtyEvent, readyToLockChangedEvent);
            }

            if (sourceMapInfo == null)
            {
                sourceMapInfo = new SourceMapInfo(dirtyEvent);
            }

            if (sourceMapRenderOptions == null)
            {
                sourceMapRenderOptions = new SourceMapRenderOptions(dirtyEvent);
            }

            if (transparencyOptions == null)
            {
                transparencyOptions = new TransparencyOptions(dirtyEvent);
            }
        }
示例#24
0
 public T Parse(MashupParseContext context, string fieldName)
 {
     return(Parse(context, fieldName, context.GetRequiredAttribute(fieldName), null));
 }
示例#25
0
 public SourceMap(MashupParseContext context, SourceMap.GetFilenameContext filenameContextDelegate, DirtyEvent parentDirty, DirtyEvent parentReadyToLockEvent)
 {
     this.dirtyEvent = new DirtyEvent(parentDirty);
     this.readyToLockChangedEvent = new DirtyEvent(parentReadyToLockEvent);
     this.filenameContextDelegate = filenameContextDelegate;
     this.latentRegionHolder = new LatentRegionHolder(this.dirtyEvent, this.readyToLockChangedEvent);
     XMLTagReader xMLTagReader = context.NewTagReader("SourceMap");
     context.ExpectIdentity(this);
     string attribute = context.reader.GetAttribute("SourceMapFilename");
     if (attribute != null)
     {
         string path = Path.Combine(filenameContextDelegate(), attribute);
         int pageNumber = 0;
         context.GetAttributeInt("PageNumber", ref pageNumber);
         this._documentFuture = new GeneralDocumentFuture(new FutureDocumentFromFilesystem(path, pageNumber));
     }
     context.GetAttributeBoolean("Expanded", ref this._expanded);
     string attribute2 = context.reader.GetAttribute("DisplayName");
     MapPosition mapPosition = null;
     MapPosition mapPosition2 = null;
     while (xMLTagReader.FindNextStartTag())
     {
         if (xMLTagReader.TagIs(RegistrationDefinition.GetXMLTag()))
         {
             context.AssertUnique(this.registration);
             this.registration = new RegistrationDefinition(context, this.dirtyEvent);
         }
         else
         {
             if (xMLTagReader.TagIs(GeneralDocumentFuture.GetXMLTag()))
             {
                 context.AssertUnique(this._documentFuture);
                 this._documentFuture = new GeneralDocumentFuture(context, filenameContextDelegate());
             }
             else
             {
                 if (xMLTagReader.TagIs(LocalDocumentDescriptor.GetXMLTag()))
                 {
                     context.AssertUnique(this._documentFuture);
                     LocalDocumentDescriptor localDocumentDescriptor = new LocalDocumentDescriptor(context, filenameContextDelegate());
                     this._documentFuture = new GeneralDocumentFuture(new FutureDocumentFromFilesystem(localDocumentDescriptor.GetFilesystemAbsolutePath(), localDocumentDescriptor.GetPageNumber()));
                 }
                 else
                 {
                     if (xMLTagReader.TagIs("LastSourceMapPosition"))
                     {
                         XMLTagReader xMLTagReader2 = context.NewTagReader("LastSourceMapPosition");
                         while (xMLTagReader2.FindNextStartTag())
                         {
                             if (xMLTagReader2.TagIs(MapPosition.GetXMLTag(context.version)))
                             {
                                 mapPosition = new MapPosition(context, null, ContinuousCoordinateSystem.theInstance);
                             }
                         }
                     }
                     else
                     {
                         if (xMLTagReader.TagIs("LastVEPosition"))
                         {
                             XMLTagReader xMLTagReader3 = context.NewTagReader("LastVEPosition");
                             while (xMLTagReader3.FindNextStartTag())
                             {
                                 if (xMLTagReader3.TagIs(MapPosition.GetXMLTag(context.version)))
                                 {
                                     mapPosition2 = new MapPosition(context, null, MercatorCoordinateSystem.theInstance);
                                 }
                             }
                         }
                         else
                         {
                             if (xMLTagReader.TagIs(RenderRegion.GetXMLTag()))
                             {
                                 context.AssertUnique(this.renderRegion);
                                 this.renderRegion = new RenderRegion(context, this.dirtyEvent, ContinuousCoordinateSystem.theInstance);
                             }
                             else
                             {
                                 if (xMLTagReader.TagIs(SourceMapInfo.GetXMLTag()))
                                 {
                                     context.AssertUnique(this._sourceMapInfo);
                                     this._sourceMapInfo = new SourceMapInfo(context, this.dirtyEvent);
                                 }
                                 else
                                 {
                                     if (xMLTagReader.TagIs(SourceMapRenderOptions.GetXMLTag()))
                                     {
                                         context.AssertUnique(this._sourceMapRenderOptions);
                                         this._sourceMapRenderOptions = new SourceMapRenderOptions(context, this.dirtyEvent);
                                     }
                                     else
                                     {
                                         if (xMLTagReader.TagIs(TransparencyOptions.GetXMLTag()))
                                         {
                                             this._transparencyOptions = new TransparencyOptions(context, this.dirtyEvent);
                                         }
                                         else
                                         {
                                             if (xMLTagReader.TagIs(SourceMapRegistrationView.GetXMLTag()))
                                             {
                                                 context.AssertUnique(this._lastView);
                                                 this._lastView = new SourceMapRegistrationView(this, context);
                                             }
                                             else
                                             {
                                                 if (xMLTagReader.TagIs(LegendList.GetXMLTag()))
                                                 {
                                                     context.AssertUnique(this.legendList);
                                                     this.legendList = new LegendList(this, context, this.dirtyEvent);
                                                 }
                                                 else
                                                 {
                                                     if (xMLTagReader.TagIs("SnapView"))
                                                     {
                                                         XMLTagReader xMLTagReader4 = context.NewTagReader("SnapView");
                                                         string requiredAttribute = context.GetRequiredAttribute("Context");
                                                         LatLonZoom latLonZoom = default(LatLonZoom);
                                                         bool flag = false;
                                                         bool flag2 = true;
                                                         CoordinateSystemIfc coordSys = null;
                                                         if (requiredAttribute == "Source")
                                                         {
                                                             coordSys = ContinuousCoordinateSystem.theInstance;
                                                         }
                                                         else
                                                         {
                                                             if (!(requiredAttribute == "Reference"))
                                                             {
                                                                 throw new InvalidMashupFile(context, string.Format("Invalid {0} value {1}", "Context", requiredAttribute));
                                                             }
                                                             coordSys = MercatorCoordinateSystem.theInstance;
                                                         }
                                                         while (xMLTagReader4.FindNextStartTag())
                                                         {
                                                             if (xMLTagReader4.TagIs(LatLonZoom.GetXMLTag()))
                                                             {
                                                                 if (flag)
                                                                 {
                                                                     context.ThrowUnique();
                                                                 }
                                                                 try
                                                                 {
                                                                     latLonZoom = new LatLonZoom(context, coordSys);
                                                                 }
                                                                 catch (InvalidLLZ)
                                                                 {
                                                                     flag2 = false;
                                                                 }
                                                                 flag = true;
                                                             }
                                                         }
                                                         if (flag2)
                                                         {
                                                             if (!flag)
                                                             {
                                                                 context.AssertPresent(null, LatLonZoom.GetXMLTag());
                                                             }
                                                             if (requiredAttribute == "Source")
                                                             {
                                                                 this.sourceSnap = latLonZoom;
                                                             }
                                                             else
                                                             {
                                                                 if (requiredAttribute == "Reference")
                                                                 {
                                                                     this.referenceSnap = latLonZoom;
                                                                 }
                                                                 else
                                                                 {
                                                                     D.Assert(false, "handled above.");
                                                                 }
                                                             }
                                                         }
                                                     }
                                                     else
                                                     {
                                                         if (xMLTagReader.TagIs("SnapZoom"))
                                                         {
                                                             context.NewTagReader("SnapZoom");
                                                             string requiredAttribute2 = context.GetRequiredAttribute("Context");
                                                             bool flag3 = false;
                                                             CoordinateSystemIfc theInstance;
                                                             if (requiredAttribute2 == "Source")
                                                             {
                                                                 theInstance = ContinuousCoordinateSystem.theInstance;
                                                             }
                                                             else
                                                             {
                                                                 if (!(requiredAttribute2 == "Reference"))
                                                                 {
                                                                     throw new InvalidMashupFile(context, string.Format("Invalid {0} value {1}", "Context", requiredAttribute2));
                                                                 }
                                                                 theInstance = MercatorCoordinateSystem.theInstance;
                                                             }
                                                             int num = 0;
                                                             try
                                                             {
                                                                 theInstance.GetZoomRange().Parse(context, "Zoom");
                                                                 flag3 = true;
                                                             }
                                                             catch (InvalidMashupFile)
                                                             {
                                                             }
                                                             if (flag3)
                                                             {
                                                                 if (requiredAttribute2 == "Source")
                                                                 {
                                                                     this.sourceSnapZoom = num;
                                                                 }
                                                                 else
                                                                 {
                                                                     if (requiredAttribute2 == "Reference")
                                                                     {
                                                                         this.referenceSnapZoom = num;
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         if (context.version == InlineSourceMapInfoSchema.schema)
         {
             if (xMLTagReader.TagIs("MapFileURL"))
             {
                 this._sourceMapInfo.mapFileURL = XMLUtils.ReadStringXml(context, "MapFileURL");
             }
             else
             {
                 if (xMLTagReader.TagIs("MapHomePage"))
                 {
                     this._sourceMapInfo.mapHomePage = XMLUtils.ReadStringXml(context, "MapHomePage");
                 }
                 else
                 {
                     if (xMLTagReader.TagIs("MapDescription"))
                     {
                         this._sourceMapInfo.mapDescription = XMLUtils.ReadStringXml(context, "MapDescription");
                     }
                 }
             }
         }
     }
     if (attribute2 != null)
     {
         this._displayName = attribute2;
     }
     else
     {
         this._displayName = this._documentFuture.documentFuture.GetDefaultDisplayName();
     }
     if (this._lastView == null && mapPosition != null && mapPosition2 != null)
     {
         this._lastView = new SourceMapRegistrationView(this, mapPosition.llz, mapPosition2);
     }
     if (this._documentFuture == null)
     {
         throw new Exception("Source Map element missing document descriptor tag");
     }
     if (this.registration == null)
     {
         this.registration = new RegistrationDefinition(this.dirtyEvent);
     }
     this.registration.dirtyEvent.Add(this.readyToLockChangedEvent);
     if (this.legendList == null)
     {
         this.legendList = new LegendList(this, this.dirtyEvent, this.readyToLockChangedEvent);
     }
     if (this._sourceMapInfo == null)
     {
         this._sourceMapInfo = new SourceMapInfo(this.dirtyEvent);
     }
     if (this._sourceMapRenderOptions == null)
     {
         this._sourceMapRenderOptions = new SourceMapRenderOptions(this.dirtyEvent);
     }
     if (this._transparencyOptions == null)
     {
         this._transparencyOptions = new TransparencyOptions(this.dirtyEvent);
     }
 }
示例#26
0
		public static LatLonZoom ReadFromAttributes(MashupParseContext context, CoordinateSystemIfc coordSys)
		{
			int zoom = coordSys.GetZoomRange().ParseAllowUndefinedZoom(context, "zoom", context.GetRequiredAttribute("zoom"));
			LatLon latLon = LatLon.ReadFromAttributes(context, coordSys);
			return new LatLonZoom(latLon.lat, latLon.lon, zoom);
		}