Exemplo n.º 1
0
        private Mashup(string fileName, Stream fromStream, out MashupFileWarningList warningList)
        {
            this.dirtyEvent.Add(new DirtyListener(this.SetDirtyFlag));
            this.fileName = fileName;
            D.Assert(fileName == null || Path.GetFullPath(fileName).ToLower().Equals(fileName.ToLower()));
            bool               flag               = false;
            XmlTextReader      reader             = new XmlTextReader(fromStream);
            MashupParseContext mashupParseContext = new MashupParseContext(reader);

            using (mashupParseContext)
            {
                while (mashupParseContext.reader.Read() && !flag)
                {
                    if (mashupParseContext.reader.NodeType == XmlNodeType.Element && mashupParseContext.reader.Name == "MapGrinderMashupFile")
                    {
                        flag = true;
                        this.ReadXML(mashupParseContext);
                    }
                }
                mashupParseContext.Dispose();
            }
            warningList = null;
            if (mashupParseContext.warnings.Count > 0)
            {
                warningList = mashupParseContext.warnings;
            }
            if (!flag)
            {
                throw new InvalidMashupFile(mashupParseContext, string.Format("{0} doesn't appear to be a valid mashup file.", fileName));
            }
            this.ClearDirty();
        }
Exemplo n.º 2
0
		public static Size ReadSize(MashupParseContext context)
		{
			XMLTagReader xMLTagReader = context.NewTagReader("Size");
			Size result = new Size(context.GetRequiredAttributeInt("Width"), context.GetRequiredAttributeInt("Height"));
			xMLTagReader.SkipAllSubTags();
			return result;
		}
Exemplo n.º 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);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 4
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));
        }
Exemplo n.º 5
0
		public void ReadXML(MashupParseContext context)
		{
			XMLTagReader xMLTagReader = context.NewTagReader("S3Credentials");
			while (xMLTagReader.FindNextStartTag())
			{
				if (xMLTagReader.TagIs("AccessKeyId"))
				{
					context.AssertUnique(this._accessKeyId);
					XMLTagReader xMLTagReader2 = context.NewTagReader("AccessKeyId");
					this._accessKeyId = context.reader.GetAttribute("Value");
					xMLTagReader2.SkipAllSubTags();
				}
				else
				{
					if (xMLTagReader.TagIs("SecretAccessKeyTag"))
					{
						context.AssertUnique(this._secretAccessKey);
						XMLTagReader xMLTagReader3 = context.NewTagReader("SecretAccessKeyTag");
						this._secretAccessKey = context.reader.GetAttribute("Value");
						xMLTagReader3.SkipAllSubTags();
					}
				}
			}
			context.AssertPresent(this._accessKeyId, "AccessKeyId");
			context.AssertPresent(this._secretAccessKey, "SecretAccessKeyTag");
		}
Exemplo n.º 6
0
        public static string ReadStringXml(MashupParseContext context, string TagName)
        {
            XMLTagReader xMLTagReader = context.NewTagReader(TagName);

            xMLTagReader.SkipAllSubTags();
            return(xMLTagReader.GetContent());
        }
Exemplo n.º 7
0
        public void ReadXML(MashupParseContext context)
        {
            XMLTagReader xMLTagReader = context.NewTagReader("S3Credentials");

            while (xMLTagReader.FindNextStartTag())
            {
                if (xMLTagReader.TagIs("AccessKeyId"))
                {
                    context.AssertUnique(_accessKeyId);
                    XMLTagReader xMLTagReader2 = context.NewTagReader("AccessKeyId");
                    _accessKeyId = context.reader.GetAttribute("Value");
                    xMLTagReader2.SkipAllSubTags();
                }
                else
                {
                    if (xMLTagReader.TagIs("SecretAccessKeyTag"))
                    {
                        context.AssertUnique(_secretAccessKey);
                        XMLTagReader xMLTagReader3 = context.NewTagReader("SecretAccessKeyTag");
                        _secretAccessKey = context.reader.GetAttribute("Value");
                        xMLTagReader3.SkipAllSubTags();
                    }
                }
            }

            context.AssertPresent(_accessKeyId, "AccessKeyId");
            context.AssertPresent(_secretAccessKey, "SecretAccessKeyTag");
        }
Exemplo n.º 8
0
        public static LayerMetadataFile Read(RenderOutputMethod outputMethod)
        {
            LayerMetadataFile  layerMetadataFile  = null;
            Stream             input              = outputMethod.ReadFile("LayerMetadata.xml");
            XmlTextReader      reader             = new XmlTextReader(input);
            MashupParseContext mashupParseContext = new MashupParseContext(reader);

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

                mashupParseContext.Dispose();
            }

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

            return(layerMetadataFile);
        }
Exemplo n.º 9
0
		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);
					}
				}
			}
		}
Exemplo n.º 10
0
        public static LatLon ReadFromAttributes(MashupParseContext context, CoordinateSystemIfc coordSys)
        {
            double lat = coordSys.GetLatRange().Parse(context, "lat");
            double lon = coordSys.GetLonRange().Parse(context, "lon");

            return(new LatLon(lat, lon));
        }
Exemplo n.º 11
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();
		}
Exemplo n.º 12
0
        public MapPosition(MashupParseContext context, PositionUpdateIfc updateIfc, CoordinateSystemIfc coordSys)
        {
            this.updateIfc = updateIfc;
            if (context.version == MonolithicMapPositionsSchema.schema)
            {
                XMLTagReader xMLTagReader = context.NewTagReader("MapPosition");
                this._llz = new LatLonZoom(Convert.ToDouble(context.reader.GetAttribute("lat"), CultureInfo.InvariantCulture), Convert.ToDouble(context.reader.GetAttribute("lon"), CultureInfo.InvariantCulture), Convert.ToInt32(context.reader.GetAttribute("zoom"), CultureInfo.InvariantCulture));
                if (context.reader.GetAttribute("style") != null)
                {
                    this.setStyle(context.reader.GetAttribute("style"));
                }
                this.valid = true;
                while (xMLTagReader.FindNextStartTag())
                {
                }
                return;
            }
            XMLTagReader xMLTagReader2 = context.NewTagReader("MapPosition");

            if (context.reader.GetAttribute("style") != null)
            {
                this.setStyle(context.reader.GetAttribute("style"));
            }
            while (xMLTagReader2.FindNextStartTag())
            {
                if (xMLTagReader2.TagIs(LatLonZoom.GetXMLTag()))
                {
                    this._llz  = new LatLonZoom(context, coordSys);
                    this.valid = true;
                }
            }
            while (xMLTagReader2.FindNextStartTag())
            {
            }
        }
Exemplo n.º 13
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);
							}
						}
					}
				}
			}
		}
Exemplo n.º 14
0
        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);
                    }
                }
            }
        }
Exemplo n.º 15
0
        public SourceMapRenderOptions(MashupParseContext context, DirtyEvent parentDirty)
        {
            dirtyEvent = new DirtyEvent(parentDirty);
            XMLTagReader xMLTagReader = context.NewTagReader("SourceMapRenderOptions");

            new MercatorCoordinateSystem();
            string attribute = context.reader.GetAttribute("MinZoom");

            if (attribute != null)
            {
                _minZoom = MercatorCoordinateSystem.theInstance.GetZoomRange()
                           .Parse(context, "MinZoom", attribute);
            }
            else
            {
                _minZoom = MercatorCoordinateSystem.theInstance.GetZoomRange().min;
            }

            _maxZoom = MercatorCoordinateSystem.theInstance.GetZoomRange()
                       .ParseAllowUndefinedZoom(context, "MaxZoom", context.reader.GetAttribute("MaxZoom"));
            if (_minZoom > _maxZoom)
            {
                throw new InvalidMashupFile(context,
                                            string.Format("MinZoom {0} > MaxZoom {1}", _minZoom, _maxZoom));
            }

            xMLTagReader.SkipAllSubTags();
        }
Exemplo n.º 16
0
        public CrunchedLayer(MashupParseContext context)
        {
            displayName = context.reader.GetAttribute(Layer.GetLayerDisplayNameTag());
            XMLTagReader xMLTagReader = context.NewTagReader(Layer.GetXMLTag());

            while (xMLTagReader.FindNextStartTag())
            {
                if (xMLTagReader.TagIs("RangeDescriptors"))
                {
                    XMLTagReader xMLTagReader2 = context.NewTagReader("RangeDescriptors");
                    xMLTagReader2.SkipAllSubTags();
                }
                else
                {
                    if (xMLTagReader.TagIs("DefaultView"))
                    {
                        XMLTagReader xMLTagReader3 = context.NewTagReader("DefaultView");
                        defaultView = LatLonZoom.ReadFromAttributes(context, MercatorCoordinateSystem.theInstance);
                        xMLTagReader3.SkipAllSubTags();
                    }
                    else
                    {
                        if (xMLTagReader.TagIs("SourceMapInfoList"))
                        {
                            XMLTagReader xMLTagReader4 = context.NewTagReader("SourceMapInfoList");
                            while (xMLTagReader4.FindNextStartTag())
                            {
                                if (xMLTagReader4.TagIs(SourceMapInfo.GetXMLTag()))
                                {
                                    sourceMapRecords.Add(
                                        new SourceMapRecord(new SourceMapInfo(context, new DirtyEvent())));
                                }
                            }
                        }
                        else
                        {
                            if (xMLTagReader.TagIs("SourceMapRecordList"))
                            {
                                XMLTagReader xMLTagReader5 = context.NewTagReader("SourceMapRecordList");
                                while (xMLTagReader5.FindNextStartTag())
                                {
                                    if (xMLTagReader5.TagIs(SourceMapRecord.GetXMLTag()))
                                    {
                                        sourceMapRecords.Add(new SourceMapRecord(context));
                                    }
                                }
                            }
                            else
                            {
                                if (xMLTagReader.TagIs(RenderedTileNamingScheme.GetXMLTag()))
                                {
                                    namingScheme = RenderedTileNamingScheme.ReadXML(context);
                                }
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 17
0
        public static Size ReadSize(MashupParseContext context)
        {
            XMLTagReader xMLTagReader = context.NewTagReader("Size");
            Size         result       = new Size(context.GetRequiredAttributeInt("Width"), context.GetRequiredAttributeInt("Height"));

            xMLTagReader.SkipAllSubTags();
            return(result);
        }
Exemplo n.º 18
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();
        }
		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();
		}
Exemplo n.º 20
0
		public CrunchedLayer(MashupParseContext context)
		{
			this.displayName = context.reader.GetAttribute(Layer.GetLayerDisplayNameTag());
			XMLTagReader xMLTagReader = context.NewTagReader(Layer.GetXMLTag());
			while (xMLTagReader.FindNextStartTag())
			{
				if (xMLTagReader.TagIs("RangeDescriptors"))
				{
					XMLTagReader xMLTagReader2 = context.NewTagReader("RangeDescriptors");
					xMLTagReader2.SkipAllSubTags();
				}
				else
				{
					if (xMLTagReader.TagIs("DefaultView"))
					{
						XMLTagReader xMLTagReader3 = context.NewTagReader("DefaultView");
						this.defaultView = LatLonZoom.ReadFromAttributes(context, MercatorCoordinateSystem.theInstance);
						xMLTagReader3.SkipAllSubTags();
					}
					else
					{
						if (xMLTagReader.TagIs("SourceMapInfoList"))
						{
							XMLTagReader xMLTagReader4 = context.NewTagReader("SourceMapInfoList");
							while (xMLTagReader4.FindNextStartTag())
							{
								if (xMLTagReader4.TagIs(SourceMapInfo.GetXMLTag()))
								{
									this.sourceMapRecords.Add(new SourceMapRecord(new SourceMapInfo(context, new DirtyEvent())));
								}
							}
						}
						else
						{
							if (xMLTagReader.TagIs("SourceMapRecordList"))
							{
								XMLTagReader xMLTagReader5 = context.NewTagReader("SourceMapRecordList");
								while (xMLTagReader5.FindNextStartTag())
								{
									if (xMLTagReader5.TagIs(SourceMapRecord.GetXMLTag()))
									{
										this.sourceMapRecords.Add(new SourceMapRecord(context));
									}
								}
							}
							else
							{
								if (xMLTagReader.TagIs(RenderedTileNamingScheme.GetXMLTag()))
								{
									this.namingScheme = RenderedTileNamingScheme.ReadXML(context);
								}
							}
						}
					}
				}
			}
		}
Exemplo n.º 21
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();
        }
Exemplo n.º 22
0
		public LatLon(MashupParseContext context, CoordinateSystemIfc coordSys)
		{
			XMLTagReader xMLTagReader = context.NewTagReader("LatLon");
			this._lat = coordSys.GetLatRange().Parse(context, "lat");
			this._lon = coordSys.GetLonRange().Parse(context, "lon");
			while (xMLTagReader.FindNextStartTag())
			{
			}
		}
Exemplo n.º 23
0
		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();
		}
Exemplo n.º 24
0
            public ManifestSuperBlock(MashupParseContext context, TellManifestDirty tellDirty)
            {
                this.tellDirty = tellDirty;
                XMLTagReader xMLTagReader = context.NewTagReader(GetXmlTag());

                _nextUnassignedBlockId = context.GetRequiredAttributeInt("NextUnassignedBlockId");
                _splitThreshold        = context.GetRequiredAttributeInt("SplitThreshold");
                xMLTagReader.SkipAllSubTags();
            }
Exemplo n.º 25
0
        public static CrunchedFile FromUri(Uri uri)
        {
            XmlTextReader reader;

            if (uri.IsFile)
            {
                string localPath = uri.LocalPath;
                reader = new XmlTextReader(File.Open(localPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite));
            }
            else
            {
                if (!(uri.Scheme == "http"))
                {
                    throw new Exception(string.Format("Unhandled URI scheme {0}", uri.Scheme));
                }

                HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(uri);
                httpWebRequest.CachePolicy = new HttpRequestCachePolicy(HttpRequestCacheLevel.Revalidate);
                D.Sayf(1, "Fetching {0}", new object[] { uri });
                HttpWebResponse httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
                if (httpWebResponse.StatusCode != HttpStatusCode.OK)
                {
                    throw new Exception(
                              string.Format("HTTP {0} from web source", httpWebResponse.StatusCode.ToString()));
                }

                Stream responseStream = httpWebResponse.GetResponseStream();
                reader = new XmlTextReader(responseStream);
            }

            MashupParseContext mashupParseContext = new MashupParseContext(reader);
            CrunchedFile       crunchedFile       = null;

            using (mashupParseContext)
            {
                while (mashupParseContext.reader.Read() && crunchedFile == null)
                {
                    if (mashupParseContext.reader.NodeType == XmlNodeType.Element &&
                        mashupParseContext.reader.Name == crunchedFileTag)
                    {
                        crunchedFile = new CrunchedFile(mashupParseContext);
                        break;
                    }
                }

                mashupParseContext.Dispose();
            }

            if (crunchedFile == null)
            {
                throw new InvalidMashupFile(mashupParseContext,
                                            string.Format("{0} doesn't appear to be a valid crunched file.", uri));
            }

            return(crunchedFile);
        }
Exemplo n.º 26
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;
 }
Exemplo n.º 27
0
		public DisplayablePosition(MashupParseContext context, CoordinateSystemIfc coordSys)
		{
			if (context.version == MonolithicMapPositionsSchema.schema)
			{
				MapPosition mapPosition = new MapPosition(context, null, coordSys);
				this._pinPosition = mapPosition.llz;
				return;
			}
			this._pinPosition = new LatLonZoom(context, coordSys);
		}
Exemplo n.º 28
0
        public LatLon(MashupParseContext context, CoordinateSystemIfc coordSys)
        {
            XMLTagReader xMLTagReader = context.NewTagReader("LatLon");

            lat = coordSys.GetLatRange().Parse(context, "lat");
            lon = coordSys.GetLonRange().Parse(context, "lon");
            while (xMLTagReader.FindNextStartTag())
            {
            }
        }
Exemplo n.º 29
0
 public DisplayablePosition(MashupParseContext context, CoordinateSystemIfc coordSys)
 {
     if (context.version == MonolithicMapPositionsSchema.schema)
     {
         MapPosition mapPosition = new MapPosition(context, null, coordSys);
         this._pinPosition = mapPosition.llz;
         return;
     }
     this._pinPosition = new LatLonZoom(context, coordSys);
 }
Exemplo n.º 30
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();
        }
Exemplo n.º 31
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();
		}
Exemplo n.º 32
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();
            }
Exemplo n.º 33
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);
        }
Exemplo n.º 34
0
		public LayerList(MashupParseContext context, SourceMap.GetFilenameContext filenameContextDelegate, DirtyEvent parentDirty, DirtyEvent parentReadyToLockEvent)
		{
			this.dirtyEvent = parentDirty;
			XMLTagReader xMLTagReader = context.NewTagReader("LayerList");
			while (xMLTagReader.FindNextStartTag())
			{
				if (xMLTagReader.TagIs(Layer.GetXMLTag()))
				{
					this.Add(new Layer(context, filenameContextDelegate, this.dirtyEvent, parentReadyToLockEvent));
				}
			}
		}
Exemplo n.º 35
0
		public RenderClip(MashupParseContext context)
		{
			XMLTagReader xMLTagReader = context.NewTagReader(RenderClip.GetXMLTag());
			while (xMLTagReader.FindNextStartTag())
			{
				if (xMLTagReader.TagIs(MapRectangle.GetXMLTag()))
				{
					context.AssertUnique(this._rect);
					this._rect = new MapRectangle(context, MercatorCoordinateSystem.theInstance);
				}
			}
		}
Exemplo n.º 36
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();
        }
Exemplo n.º 37
0
        public LayerList(MashupParseContext context, SourceMap.GetFilenameContext filenameContextDelegate, DirtyEvent parentDirty, DirtyEvent parentReadyToLockEvent)
        {
            this.dirtyEvent = parentDirty;
            XMLTagReader xMLTagReader = context.NewTagReader("LayerList");

            while (xMLTagReader.FindNextStartTag())
            {
                if (xMLTagReader.TagIs(Layer.GetXMLTag()))
                {
                    this.Add(new Layer(context, filenameContextDelegate, this.dirtyEvent, parentReadyToLockEvent));
                }
            }
        }
Exemplo n.º 38
0
        public RenderClip(MashupParseContext context)
        {
            XMLTagReader xMLTagReader = context.NewTagReader(GetXMLTag());

            while (xMLTagReader.FindNextStartTag())
            {
                if (xMLTagReader.TagIs(MapRectangle.GetXMLTag()))
                {
                    context.AssertUnique(rect);
                    rect = new MapRectangle(context, MercatorCoordinateSystem.theInstance);
                }
            }
        }
Exemplo n.º 39
0
        public RenderRegion(MashupParseContext context, DirtyEvent parentDirty, CoordinateSystemIfc coordSys)
        {
            dirtyEvent = new DirtyEvent(parentDirty);
            XMLTagReader xMLTagReader = context.NewTagReader("RenderRegion");

            while (xMLTagReader.FindNextStartTag())
            {
                if (xMLTagReader.TagIs(LatLon.GetXMLTag()))
                {
                    vertexList.Add(new LatLon(context, coordSys));
                }
            }
        }
Exemplo n.º 40
0
            public ManifestBlock(TellManifestDirty tellManifestDirty, RenderOutputMethod outputMethod, int blockId)
            {
                this.tellManifestDirty = tellManifestDirty;
                this.blockId           = blockId;
                try
                {
                    Stream        input         = outputMethod.MakeChildMethod("manifests").ReadFile(manifestFilename(blockId));
                    XmlTextReader xmlTextReader = new XmlTextReader(input);
                    using (xmlTextReader)
                    {
                        MashupParseContext mashupParseContext = new MashupParseContext(xmlTextReader);
                        while (mashupParseContext.reader.Read())
                        {
                            if (mashupParseContext.reader.NodeType == XmlNodeType.Element &&
                                mashupParseContext.reader.Name == "ManifestBlock")
                            {
                                XMLTagReader xMLTagReader = mashupParseContext.NewTagReader("ManifestBlock");
                                while (xMLTagReader.FindNextStartTag())
                                {
                                    if (xMLTagReader.TagIs(ManifestRecord.GetXmlTag()))
                                    {
                                        recordList.Add(new ManifestRecord(mashupParseContext, this));
                                    }
                                    else
                                    {
                                        if (xMLTagReader.TagIs(ManifestSuperBlock.GetXmlTag()))
                                        {
                                            superBlock = new ManifestSuperBlock(mashupParseContext,
                                                                                new TellManifestDirty(SetDirty));
                                        }
                                    }
                                }

                                return;
                            }
                        }

                        throw new InvalidMashupFile(mashupParseContext, "No ManifestBlock tag");
                    }
                }
                catch (Exception)
                {
                }
                finally
                {
                    if (blockId == 0 && superBlock == null)
                    {
                        superBlock = new ManifestSuperBlock(1, new TellManifestDirty(SetDirty));
                    }
                }
            }
Exemplo n.º 41
0
        public RegistrationDefinition(MashupParseContext context, DirtyEvent dirtyEvent)
        {
            this.dirtyEvent = new DirtyEvent(dirtyEvent);
            XMLTagReader xMLTagReader = context.NewTagReader(RegistrationDefinition.RegistrationDefinitionTag);

            this.warpStyle = TransformationStyleFactory.ReadFromXMLAttribute(context);
            while (xMLTagReader.FindNextStartTag())
            {
                if (xMLTagReader.TagIs(PositionAssociation.XMLTag()))
                {
                    this.AddAssociation(new PositionAssociation(context, dirtyEvent));
                }
            }
        }
Exemplo n.º 42
0
        public PositionAssociation(MashupParseContext context, DirtyEvent dirtyEvent)
        {
            this.dirtyEvent = dirtyEvent;
            XMLTagReader xMLTagReader = context.NewTagReader(PositionAssociationTag);

            _pinId = -1;
            context.GetAttributeInt(pinIdAttr, ref _pinId);
            if ((associationName = context.reader.GetAttribute(associationNameAttr)) == null)
            {
                associationName = "";
            }

            while (xMLTagReader.FindNextStartTag())
            {
                if (xMLTagReader.TagIs(SourcePositionTag))
                {
                    XMLTagReader xMLTagReader2 = context.NewTagReader(SourcePositionTag);
                    while (xMLTagReader2.FindNextStartTag())
                    {
                        if (xMLTagReader2.TagIs(DisplayablePosition.GetXMLTag(context.version)))
                        {
                            _sourcePosition =
                                new DisplayablePosition(context, ContinuousCoordinateSystem.theInstance);
                            _imagePosition = new DisplayablePosition(_sourcePosition.pinPosition);
                        }
                    }
                }
                else
                {
                    if (xMLTagReader.TagIs(GlobalPositionTag))
                    {
                        XMLTagReader xMLTagReader3 = context.NewTagReader(GlobalPositionTag);
                        while (xMLTagReader3.FindNextStartTag())
                        {
                            if (xMLTagReader3.TagIs(DisplayablePosition.GetXMLTag(context.version)))
                            {
                                _globalPosition =
                                    new DisplayablePosition(context, MercatorCoordinateSystem.theInstance);
                            }
                        }
                    }
                }
            }

            if (_sourcePosition == null || _globalPosition == null)
            {
                throw new Exception(string.Format("Pin {0} does not have a source and/or global position defined",
                                                  associationName));
            }
        }
Exemplo n.º 43
0
		public LegendList(SourceMap sourceMap, MashupParseContext context, DirtyEvent parentEvent)
		{
			this._sourceMap = sourceMap;
			this.dirtyEvent = new DirtyEvent(parentEvent);
			this.parentBoundsChangedEvent = parentEvent;
			XMLTagReader xMLTagReader = context.NewTagReader(LegendList.GetXMLTag());
			while (xMLTagReader.FindNextStartTag())
			{
				if (xMLTagReader.TagIs(Legend.GetXMLTag()))
				{
					this.list.Add(new Legend(this._sourceMap, context, this.dirtyEvent, this.parentBoundsChangedEvent));
				}
			}
		}
Exemplo n.º 44
0
		private LayerMetadataFile(RenderOutputMethod renderOutputMethod, MashupParseContext context)
		{
			this.renderOutputMethod = renderOutputMethod;
			XMLTagReader xMLTagReader = context.NewTagReader(LayerMetadataFile.LayerMetadataTag);
			while (xMLTagReader.FindNextStartTag())
			{
				if (xMLTagReader.TagIs("StrongHash"))
				{
					context.AssertUnique(this._encodableHash);
					this._encodableHash = new EncodableHash(context);
				}
			}
			context.AssertPresent(this._encodableHash, "StrongHash");
		}
Exemplo n.º 45
0
        public Pixel(MashupParseContext context)
        {
            this.p.r = 0;
            this.p.g = 0;
            this.p.b = 0;
            this.p.a = 0;
            XMLTagReader xMLTagReader = context.NewTagReader("PixelValues");

            this.p.r = (byte)Pixel.byteRange.Parse(context, "r");
            this.p.g = (byte)Pixel.byteRange.Parse(context, "g");
            this.p.b = (byte)Pixel.byteRange.Parse(context, "b");
            this.p.a = (byte)Pixel.byteRange.Parse(context, "a");
            xMLTagReader.SkipAllSubTags();
        }
Exemplo n.º 46
0
        public SourceMapRegistrationView(SourceMap sourceMap, MashupParseContext context)
        {
            this.sourceMap = sourceMap;
            XMLTagReader xMLTagReader = context.NewTagReader(GetXMLTag());

            locked = context.GetRequiredAttributeBoolean(lockedAttribute);
            bool flag = false;

            while (xMLTagReader.FindNextStartTag())
            {
                if (xMLTagReader.TagIs(sourceMapViewTag))
                {
                    XMLTagReader xMLTagReader2 = context.NewTagReader(sourceMapViewTag);
                    while (xMLTagReader2.FindNextStartTag())
                    {
                        if (xMLTagReader2.TagIs(LatLonZoom.GetXMLTag()))
                        {
                            sourceMapView = new LatLonZoom(context, ContinuousCoordinateSystem.theInstance);
                            flag          = true;
                        }
                    }
                }
                else
                {
                    if (xMLTagReader.TagIs(referenceMapViewTag))
                    {
                        XMLTagReader xMLTagReader3 = context.NewTagReader(referenceMapViewTag);
                        while (xMLTagReader3.FindNextStartTag())
                        {
                            if (xMLTagReader3.TagIs(MapPosition.GetXMLTag(context.version)))
                            {
                                referenceMapView =
                                    new MapPosition(context, null, MercatorCoordinateSystem.theInstance);
                            }
                        }
                    }
                }
            }

            if (referenceMapView == null)
            {
                throw new InvalidMashupFile(context, "No " + referenceMapViewTag + " tag in LayerView.");
            }

            if (flag == locked)
            {
                throw new InvalidMashupFile(context, "locked flag disagrees with " + sourceMapViewTag + " element.");
            }
        }
Exemplo n.º 47
0
 public XMLTagReader(XmlTextReader reader, string tag, IgnoredTags ignoredTags, MashupParseContext context)
 {
     this.context = context;
     this.ignoredTags = ignoredTags;
     if (reader.NodeType != XmlNodeType.Element || reader.Name != tag)
     {
         throw new Exception(string.Format("You found a bug.  Reader for {0} called improperly at start of {1} block.", tag, reader.Name));
     }
     this.reader = reader;
     this.tag = tag;
     if (reader.IsEmptyElement)
     {
         this.empty = true;
     }
 }
Exemplo n.º 48
0
		public static RenderedTileNamingScheme ReadXML(MashupParseContext context)
		{
			XMLTagReader xMLTagReader = context.NewTagReader("TileNamingScheme");
			string attribute = context.reader.GetAttribute("Type");
			string attribute2 = context.reader.GetAttribute("FilePrefix");
			string attribute3 = context.reader.GetAttribute("FileSuffix");
			xMLTagReader.SkipAllSubTags();
			if (attribute == null || attribute2 == null || attribute3 == null)
			{
				throw new InvalidMashupFile(context, string.Format("Invalid contents in {0} tag.", "TileNamingScheme"));
			}
			if (attribute == VENamingScheme.SchemeName)
			{
				return new VENamingScheme(attribute2, attribute3);
			}
			throw new InvalidMashupFile(context, "Unknown type: " + attribute);
		}
Exemplo n.º 49
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 static TransformationStyle ReadFromXMLAttribute(MashupParseContext context)
		{
			TransformationStyleFactory.init();
			string attribute = context.reader.GetAttribute(TransformationStyle.TransformationStyleNameAttr);
			if (attribute != null)
			{
				for (int i = 0; i < TransformationStyleFactory.transformationStyles.Count; i++)
				{
					if (TransformationStyleFactory.transformationStyles[i].getXmlName() == attribute)
					{
						return TransformationStyleFactory.transformationStyles[i];
					}
				}
				throw new InvalidMashupFile(context, string.Format("Invalid attribute value {1} for {0}", TransformationStyle.TransformationStyleNameAttr, attribute));
			}
			return TransformationStyleFactory.transformationStyles[0];
		}
Exemplo n.º 51
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
				});
			}
		}
Exemplo n.º 52
0
		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));
						}
					}
				}
			}
		}
Exemplo n.º 53
0
		public LayerView(Layer layer, MashupParseContext context)
		{
			this._layer = layer;
			bool flag = false;
			XMLTagReader xMLTagReader = context.NewTagReader(LayerView.GetXMLTag());
			while (xMLTagReader.FindNextStartTag())
			{
				if (xMLTagReader.TagIs(MapPosition.GetXMLTag(context.version)))
				{
					this.lockedView = new MapPosition(context, null, MercatorCoordinateSystem.theInstance);
					flag = true;
				}
			}
			if (!flag)
			{
				throw new InvalidMashupFile(context, "No LatLonZoom tag in LayerView.");
			}
		}
Exemplo n.º 54
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");
                 }
             }
         }
     }
 }
		public SourceMapRegistrationView(SourceMap sourceMap, MashupParseContext context)
		{
			this._sourceMap = sourceMap;
			XMLTagReader xMLTagReader = context.NewTagReader(SourceMapRegistrationView.GetXMLTag());
			this._locked = context.GetRequiredAttributeBoolean(SourceMapRegistrationView.lockedAttribute);
			bool flag = false;
			while (xMLTagReader.FindNextStartTag())
			{
				if (xMLTagReader.TagIs(SourceMapRegistrationView.sourceMapViewTag))
				{
					XMLTagReader xMLTagReader2 = context.NewTagReader(SourceMapRegistrationView.sourceMapViewTag);
					while (xMLTagReader2.FindNextStartTag())
					{
						if (xMLTagReader2.TagIs(LatLonZoom.GetXMLTag()))
						{
							this.sourceMapView = new LatLonZoom(context, ContinuousCoordinateSystem.theInstance);
							flag = true;
						}
					}
				}
				else
				{
					if (xMLTagReader.TagIs(SourceMapRegistrationView.referenceMapViewTag))
					{
						XMLTagReader xMLTagReader3 = context.NewTagReader(SourceMapRegistrationView.referenceMapViewTag);
						while (xMLTagReader3.FindNextStartTag())
						{
							if (xMLTagReader3.TagIs(MapPosition.GetXMLTag(context.version)))
							{
								this.referenceMapView = new MapPosition(context, null, MercatorCoordinateSystem.theInstance);
							}
						}
					}
				}
			}
			if (this.referenceMapView == null)
			{
				throw new InvalidMashupFile(context, "No " + SourceMapRegistrationView.referenceMapViewTag + " tag in LayerView.");
			}
			if (flag == this._locked)
			{
				throw new InvalidMashupFile(context, "locked flag disagrees with " + SourceMapRegistrationView.sourceMapViewTag + " element.");
			}
		}
Exemplo n.º 56
0
		public TransparencyColor(MashupParseContext context)
		{
			XMLTagReader xMLTagReader = context.NewTagReader("TransparencyColor");
			this._fuzz = TransparencyOptions.FuzzRange.Parse(context, "Fuzz");
			this._halo = TransparencyOptions.HaloSizeRange.Parse(context, "HaloSize");
			bool flag = false;
			while (xMLTagReader.FindNextStartTag())
			{
				if (xMLTagReader.TagIs(Pixel.GetXMLTag()))
				{
					Pixel pixel = new Pixel(context);
					this._color = new Pixel(pixel.r, pixel.g, pixel.b, 255);
					flag = true;
				}
			}
			if (!flag)
			{
				throw new InvalidMashupFile(context, string.Format("TransparencyColor has no %1 tag", Pixel.GetXMLTag()));
			}
		}
Exemplo n.º 57
0
 public MapRectangle(MashupParseContext context, CoordinateSystemIfc coordSys)
 {
     XMLTagReader reader = context.NewTagReader("MapRectangle");
     List<LatLon> list = new List<LatLon>();
     while (reader.FindNextStartTag())
     {
         if (reader.TagIs(LatLon.GetXMLTag()))
         {
             list.Add(new LatLon(context, coordSys));
         }
     }
     reader.SkipAllSubTags();
     if (list.Count != 2)
     {
         throw new InvalidMashupFile(context, string.Format("{0} should contain exactly 2 {1} subtags", "MapRectangle", LatLon.GetXMLTag()));
     }
     this.ll0 = list[0];
     this.ll1 = list[1];
     this.AssertOrder();
 }
		public SourceMapRenderOptions(MashupParseContext context, DirtyEvent parentDirty)
		{
			this.dirtyEvent = new DirtyEvent(parentDirty);
			XMLTagReader xMLTagReader = context.NewTagReader("SourceMapRenderOptions");
			new MercatorCoordinateSystem();
			string attribute = context.reader.GetAttribute("MinZoom");
			if (attribute != null)
			{
				this._minZoom = MercatorCoordinateSystem.theInstance.GetZoomRange().Parse(context, "MinZoom", attribute);
			}
			else
			{
				this._minZoom = MercatorCoordinateSystem.theInstance.GetZoomRange().min;
			}
			this._maxZoom = MercatorCoordinateSystem.theInstance.GetZoomRange().ParseAllowUndefinedZoom(context, "MaxZoom", context.reader.GetAttribute("MaxZoom"));
			if (this._minZoom > this._maxZoom)
			{
				throw new InvalidMashupFile(context, string.Format("MinZoom {0} > MaxZoom {1}", this._minZoom, this._maxZoom));
			}
			xMLTagReader.SkipAllSubTags();
		}
Exemplo n.º 59
0
		public FadeOptions(MashupParseContext context, DirtyEvent dirty)
		{
			this.dirty = dirty;
			XMLTagReader xMLTagReader = context.NewTagReader("FadeOptions");
			this._fadeBase = FadeOptions.FadeRange.Parse(context, "DefaultValue");
			while (xMLTagReader.FindNextStartTag())
			{
				if (xMLTagReader.TagIs("FadeAtZoom"))
				{
					XMLTagReader xMLTagReader2 = context.NewTagReader("FadeAtZoom");
					int requiredAttributeInt = context.GetRequiredAttributeInt("ZoomLevel");
					double value = FadeOptions.FadeRange.Parse(context, "FadeValue");
					if (this._zoomToFadeMap.ContainsKey(requiredAttributeInt))
					{
						throw new InvalidMashupFile(context, string.Format("Fade specified twice for zoom level {0}", requiredAttributeInt));
					}
					this._zoomToFadeMap[requiredAttributeInt] = value;
					xMLTagReader2.SkipAllSubTags();
				}
			}
		}
Exemplo n.º 60
0
		public LegendView(Legend legend, MashupParseContext context)
		{
			this._legend = legend;
			object obj = null;
			XMLTagReader xMLTagReader = context.NewTagReader(LegendView.GetXMLTag());
			this._showingPreview = context.GetRequiredAttributeBoolean(LegendView.previewAttr);
			while (xMLTagReader.FindNextStartTag())
			{
				if (xMLTagReader.TagIs(LegendView.sourceMapViewTag))
				{
					XMLTagReader xMLTagReader2 = context.NewTagReader(LegendView.sourceMapViewTag);
					while (xMLTagReader2.FindNextStartTag())
					{
						if (xMLTagReader2.TagIs(LatLonZoom.GetXMLTag()))
						{
							this.sourceMapView = new LatLonZoom(context, ContinuousCoordinateSystem.theInstance);
							context.AssertUnique(obj);
							obj = new object();
						}
					}
				}
				else
				{
					if (xMLTagReader.TagIs(LegendView.referenceMapViewTag))
					{
						context.AssertUnique(this.referenceMapView);
						XMLTagReader xMLTagReader3 = context.NewTagReader(LegendView.referenceMapViewTag);
						while (xMLTagReader3.FindNextStartTag())
						{
							if (xMLTagReader3.TagIs(MapPosition.GetXMLTag(context.version)))
							{
								this.referenceMapView = new MapPosition(context, null, MercatorCoordinateSystem.theInstance);
							}
						}
					}
				}
			}
			context.AssertPresent(obj, LegendView.sourceMapViewTag);
			context.AssertPresent(this.referenceMapView, LegendView.referenceMapViewTag);
		}