Exemple #1
0
        public void ReadXML(MashupParseContext context)
        {
            XMLTagReader xMLTagReader = context.NewTagReader("MapGrinderMashupFile");

            context.version = MashupXMLSchemaVersion.ReadXMLAttribute(context.reader);
            SingleMaxZoomForEntireMashupCompatibilityBlob singleMaxZoomForEntireMashupCompatibilityBlob = null;
            string text = null;

            while (xMLTagReader.FindNextStartTag())
            {
                if (context.version != MonolithicMapPositionsSchema.schema && xMLTagReader.TagIs(LayerList.GetXMLTag()))
                {
                    layerList = new LayerList(context,
                                              GetFilenameContext,
                                              dirtyEvent,
                                              readyToLockEvent);
                }
                else
                {
                    if (context.version == MonolithicMapPositionsSchema.schema &&
                        xMLTagReader.TagIs(SourceMap.GetXMLTag()))
                    {
                        if (layerList != null && layerList.Count > 0)
                        {
                            throw new InvalidMashupFile(context,
                                                        string.Format("Multiple SourceMaps in Version {0} file.",
                                                                      context.version.versionNumberString));
                        }

                        SourceMap sourceMap = new SourceMap(context,
                                                            GetFilenameContext,
                                                            dirtyEvent,
                                                            readyToLockEvent);
                        layerList = new LayerList(dirtyEvent);
                        layerList.AddNewLayer();
                        layerList.First.Add(sourceMap);
                    }
                    else
                    {
                        if (xMLTagReader.TagIs(RenderOptions.GetXMLTag()))
                        {
                            renderOptions = new RenderOptions(context,
                                                              dirtyEvent,
                                                              ref singleMaxZoomForEntireMashupCompatibilityBlob);
                        }
                        else
                        {
                            if (xMLTagReader.TagIs(LastViewTag))
                            {
                                XMLTagReader xMLTagReader2 = context.NewTagReader(LastViewTag);
                                text = context.reader.GetAttribute(LastView_TargetIdAttr);
                                xMLTagReader2.SkipAllSubTags();
                            }
                        }
                    }
                }
            }

            lastView = new NoView();
            if (text != null)
            {
                object obj = context.FetchObjectByIdentity(text);
                if (obj != null && obj is LastViewIfc)
                {
                    lastView = ((LastViewIfc)obj).lastView;
                }
            }

            if (renderOptions == null)
            {
                if (context.version != MonolithicMapPositionsSchema.schema)
                {
                    context.warnings.Add(new MashupFileWarning("RenderOptions tag absent."));
                }

                renderOptions = new RenderOptions(dirtyEvent);
            }

            if (singleMaxZoomForEntireMashupCompatibilityBlob != null)
            {
                D.Assert(context.version == SingleMaxZoomForEntireMashupSchema.schema);
                foreach (Layer current in layerList)
                {
                    foreach (SourceMap current2 in current)
                    {
                        current2.sourceMapRenderOptions.maxZoom = singleMaxZoomForEntireMashupCompatibilityBlob.maxZoom;
                    }
                }
            }
        }
Exemple #2
0
        public RenderOptions(MashupParseContext context, DirtyEvent parentDirtyEvent,
                             ref SingleMaxZoomForEntireMashupCompatibilityBlob blob)
        {
            dirtyEvent = new DirtyEvent(parentDirtyEvent);
            XMLTagReader xMLTagReader = context.NewTagReader(RenderOptionsTag);

            while (xMLTagReader.FindNextStartTag())
            {
                if (context.version == SingleMaxZoomForEntireMashupSchema.schema &&
                    xMLTagReader.TagIs(SingleMaxZoomForEntireMashupSchema.ZoomLevelsTag))
                {
                    blob = new SingleMaxZoomForEntireMashupCompatibilityBlob();
                    XMLTagReader xMLTagReader2 = context.NewTagReader(SingleMaxZoomForEntireMashupSchema.ZoomLevelsTag);
                    string       attribute;
                    if ((attribute = context.reader.GetAttribute(SingleMaxZoomForEntireMashupSchema.MinZoomTag)) !=
                        null)
                    {
                        blob.minZoom = MercatorCoordinateSystem.theInstance.GetZoomRange().Parse(context,
                                                                                                 SingleMaxZoomForEntireMashupSchema.MinZoomTag,
                                                                                                 attribute);
                    }

                    if ((attribute = context.reader.GetAttribute(SingleMaxZoomForEntireMashupSchema.MaxZoomTag)) !=
                        null)
                    {
                        blob.maxZoom = MercatorCoordinateSystem.theInstance.GetZoomRange().Parse(context,
                                                                                                 SingleMaxZoomForEntireMashupSchema.MaxZoomTag,
                                                                                                 attribute);
                    }

                    xMLTagReader2.SkipAllSubTags();
                }
                else
                {
                    if (xMLTagReader.TagIs(RenderToFileOptions.xmlTag))
                    {
                        _renderToOptions = new RenderToFileOptions(context, dirtyEvent);
                    }
                    else
                    {
                        if (xMLTagReader.TagIs(compatibility_RenderToFileOutputTag))
                        {
                            _renderToOptions = new RenderToFileOptions(context,
                                                                       dirtyEvent,
                                                                       compatibility_RenderToFileOutputTag);
                        }
                        else
                        {
                            if (xMLTagReader.TagIs(RenderToS3Options.xmlTag))
                            {
                                _renderToOptions = new RenderToS3Options(context, dirtyEvent);
                            }
                            else
                            {
                                if (xMLTagReader.TagIs(OutputTileTypeTag))
                                {
                                    XMLTagReader xMLTagReader3 = context.NewTagReader(OutputTileTypeTag);
                                    outputTileType =
                                        OutputTileType.Parse(context.reader.GetAttribute(OutputTileTypeAttr));
                                    xMLTagReader3.SkipAllSubTags();
                                }
                                else
                                {
                                    if (xMLTagReader.TagIs(PublishSourceDataTag))
                                    {
                                        XMLTagReader xMLTagReader4 = context.NewTagReader(PublishSourceDataTag);
                                        publishSourceData =
                                            context.GetRequiredAttributeBoolean(PublishSourceDataValueAttr);
                                        xMLTagReader4.SkipAllSubTags();
                                    }
                                    else
                                    {
                                        if (xMLTagReader.TagIs(PermitCompositionTag))
                                        {
                                            XMLTagReader xMLTagReader5 = context.NewTagReader(PermitCompositionTag);
                                            permitComposition =
                                                context.GetRequiredAttributeBoolean(PermitCompositionValueAttr);
                                            xMLTagReader5.SkipAllSubTags();
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
		public RenderOptions(MashupParseContext context, DirtyEvent parentDirtyEvent, ref SingleMaxZoomForEntireMashupCompatibilityBlob blob)
		{
			this.dirtyEvent = new DirtyEvent(parentDirtyEvent);
			XMLTagReader xMLTagReader = context.NewTagReader(RenderOptions.RenderOptionsTag);
			while (xMLTagReader.FindNextStartTag())
			{
				if (context.version == SingleMaxZoomForEntireMashupSchema.schema && xMLTagReader.TagIs(SingleMaxZoomForEntireMashupSchema.ZoomLevelsTag))
				{
					blob = new SingleMaxZoomForEntireMashupCompatibilityBlob();
					XMLTagReader xMLTagReader2 = context.NewTagReader(SingleMaxZoomForEntireMashupSchema.ZoomLevelsTag);
					string attribute;
					if ((attribute = context.reader.GetAttribute(SingleMaxZoomForEntireMashupSchema.MinZoomTag)) != null)
					{
						blob.minZoom = MercatorCoordinateSystem.theInstance.GetZoomRange().Parse(context, SingleMaxZoomForEntireMashupSchema.MinZoomTag, attribute);
					}
					if ((attribute = context.reader.GetAttribute(SingleMaxZoomForEntireMashupSchema.MaxZoomTag)) != null)
					{
						blob.maxZoom = MercatorCoordinateSystem.theInstance.GetZoomRange().Parse(context, SingleMaxZoomForEntireMashupSchema.MaxZoomTag, attribute);
					}
					xMLTagReader2.SkipAllSubTags();
				}
				else
				{
					if (xMLTagReader.TagIs(RenderToFileOptions.xmlTag))
					{
						this._renderToOptions = new RenderToFileOptions(context, this.dirtyEvent);
					}
					else
					{
						if (xMLTagReader.TagIs(RenderOptions.compatibility_RenderToFileOutputTag))
						{
							this._renderToOptions = new RenderToFileOptions(context, this.dirtyEvent, RenderOptions.compatibility_RenderToFileOutputTag);
						}
						else
						{
							if (xMLTagReader.TagIs(RenderToS3Options.xmlTag))
							{
								this._renderToOptions = new RenderToS3Options(context, this.dirtyEvent);
							}
							else
							{
								if (xMLTagReader.TagIs(RenderOptions.OutputTileTypeTag))
								{
									XMLTagReader xMLTagReader3 = context.NewTagReader(RenderOptions.OutputTileTypeTag);
									this._outputTileType = OutputTileType.Parse(context.reader.GetAttribute(RenderOptions.OutputTileTypeAttr));
									xMLTagReader3.SkipAllSubTags();
								}
								else
								{
									if (xMLTagReader.TagIs(RenderOptions.PublishSourceDataTag))
									{
										XMLTagReader xMLTagReader4 = context.NewTagReader(RenderOptions.PublishSourceDataTag);
										this.publishSourceData = context.GetRequiredAttributeBoolean(RenderOptions.PublishSourceDataValueAttr);
										xMLTagReader4.SkipAllSubTags();
									}
									else
									{
										if (xMLTagReader.TagIs(RenderOptions.PermitCompositionTag))
										{
											XMLTagReader xMLTagReader5 = context.NewTagReader(RenderOptions.PermitCompositionTag);
											this.permitComposition = context.GetRequiredAttributeBoolean(RenderOptions.PermitCompositionValueAttr);
											xMLTagReader5.SkipAllSubTags();
										}
									}
								}
							}
						}
					}
				}
			}
		}