Beispiel #1
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);
                    }
                }
            }
        }
Beispiel #2
0
        public static string ReadStringXml(MashupParseContext context, string TagName)
        {
            XMLTagReader xMLTagReader = context.NewTagReader(TagName);

            xMLTagReader.SkipAllSubTags();
            return(xMLTagReader.GetContent());
        }
Beispiel #3
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())
            {
            }
        }
Beispiel #4
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");
        }
Beispiel #5
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();
        }
Beispiel #6
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);
                            }
                        }
                    }
                }
            }
        }
Beispiel #7
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);
                                }
                            }
                        }
                    }
                }
            }
        }
Beispiel #8
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);
        }
Beispiel #9
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();
        }
Beispiel #10
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();
            }
Beispiel #11
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();
        }
        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();
        }
Beispiel #13
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())
            {
            }
        }
Beispiel #14
0
        public bool FindNextStartTag()
        {
            if (done)
            {
                return(false);
            }

            if (empty)
            {
                done = true;
                return(false);
            }

            if (reader.NodeType == XmlNodeType.Element && lastStart != null &&
                lastStart == reader.Name)
            {
                ignoredTags.Add(lastStart);
                XMLTagReader xMLTagReader =
                    new XMLTagReader(reader, lastStart, ignoredTags, context);
                xMLTagReader.SkipAllSubTags();
            }

            while (reader.Read())
            {
                if (reader.NodeType == XmlNodeType.Element)
                {
                    lastStart = reader.Name;
                    context.mostRecentXTRTagIs = null;
                    return(true);
                }

                if (reader.NodeType == XmlNodeType.EndElement)
                {
                    if (reader.Name == tag)
                    {
                        done = true;
                        return(false);
                    }

                    throw new InvalidMashupFile(reader,
                                                string.Format("Bad Mashup file!  XML tag {0} improperly closed with </{1}> (line {2})",
                                                              tag,
                                                              reader.Name,
                                                              reader.LineNumber));
                }
                else
                {
                    string value = reader.Value;
                    content.Append(value);
                }
            }

            throw new InvalidMashupFile(reader, "Unexpected end of file");
        }
Beispiel #15
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();
            }
Beispiel #16
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();
        }
Beispiel #17
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));
                }
            }
        }
Beispiel #18
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));
                }
            }
        }
Beispiel #19
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);
                }
            }
        }
Beispiel #20
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));
                    }
                }
            }
Beispiel #21
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));
                }
            }
        }
Beispiel #22
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));
            }
        }
Beispiel #23
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();
        }
Beispiel #24
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.");
            }
        }
Beispiel #25
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));
                }
            }
        }
Beispiel #26
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");
        }
Beispiel #27
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 });
            }
        }
Beispiel #28
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 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);
        }
Beispiel #30
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.");
            }
        }
Beispiel #31
0
 public bool FindNextStartTag()
 {
     if (this.done)
     {
         return false;
     }
     if (this.empty)
     {
         this.done = true;
         return false;
     }
     if (this.reader.NodeType == XmlNodeType.Element && this.lastStart != null && this.lastStart == this.reader.Name)
     {
         this.ignoredTags.Add(this.lastStart);
         XMLTagReader xMLTagReader = new XMLTagReader(this.reader, this.lastStart, this.ignoredTags, this.context);
         xMLTagReader.SkipAllSubTags();
     }
     while (this.reader.Read())
     {
         if (this.reader.NodeType == XmlNodeType.Element)
         {
             this.lastStart = this.reader.Name;
             this.context.mostRecentXTRTagIs = null;
             return true;
         }
         if (this.reader.NodeType == XmlNodeType.EndElement)
         {
             if (this.reader.Name == this.tag)
             {
                 this.done = true;
                 return false;
             }
             throw new InvalidMashupFile(this.reader, string.Format("Bad Mashup file!  XML tag {0} improperly closed with </{1}> (line {2})", this.tag, this.reader.Name, this.reader.LineNumber));
         }
         else
         {
             string value = this.reader.Value;
             this.content.Append(value);
         }
     }
     throw new InvalidMashupFile(this.reader, "Unexpected end of file");
 }