예제 #1
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())
            {
            }
        }
예제 #2
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");
        }
예제 #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);
                            }
                        }
                    }
                }
            }
        }
예제 #4
0
파일: Legend.cs 프로젝트: gabilic/Oplan
        public Legend(SourceMap sourceMap, MashupParseContext context, DirtyEvent parentEvent, DirtyEvent parentBoundsChangedEvent)
        {
            this._sourceMap          = sourceMap;
            this.dirtyEvent          = new DirtyEvent(parentEvent);
            this._latentRegionHolder = new LatentRegionHolder(this.dirtyEvent, parentBoundsChangedEvent);
            this._displayName        = context.GetRequiredAttribute("DisplayName");
            string attribute = context.reader.GetAttribute("RenderedSize");

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

            context.ExpectIdentity(this);
            while (xMLTagReader.FindNextStartTag())
            {
                if (xMLTagReader.TagIs(RenderRegion.GetXMLTag()))
                {
                    context.AssertUnique(this._latentRegionHolder.renderRegion);
                    this._latentRegionHolder.renderRegion = new RenderRegion(context, this.dirtyEvent, ContinuousCoordinateSystem.theInstance);
                }
                else
                {
                    if (xMLTagReader.TagIs(LegendView.GetXMLTag()))
                    {
                        this._lastView = new LegendView(this, context);
                    }
                }
            }
        }
예제 #5
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);
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #6
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())
            {
            }
        }
예제 #7
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);
                }
            }
        }
예제 #8
0
파일: LayerList.cs 프로젝트: gabilic/Oplan
        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));
                }
            }
        }
예제 #9
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));
                }
            }
        }
예제 #10
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));
                    }
                }
            }
예제 #11
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));
                }
            }
        }
예제 #12
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));
            }
        }
예제 #13
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.");
            }
        }
예제 #14
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));
                }
            }
        }
예제 #15
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");
        }
예제 #16
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");
                        }
                    }
                }
            }
        }
예제 #17
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));
                        }
                    }
                }
            }
        }
예제 #18
0
파일: LayerView.cs 프로젝트: gabilic/Oplan
        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.");
            }
        }
예제 #19
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");
        }
예제 #20
0
        public LegendView(Legend legend, MashupParseContext context)
        {
            this.legend = legend;
            object       obj          = null;
            XMLTagReader xMLTagReader = context.NewTagReader(GetXMLTag());

            showingPreview = context.GetRequiredAttributeBoolean(previewAttr);
            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);
                            context.AssertUnique(obj);
                            obj = new object();
                        }
                    }
                }
                else
                {
                    if (xMLTagReader.TagIs(referenceMapViewTag))
                    {
                        context.AssertUnique(referenceMapView);
                        XMLTagReader xMLTagReader3 = context.NewTagReader(referenceMapViewTag);
                        while (xMLTagReader3.FindNextStartTag())
                        {
                            if (xMLTagReader3.TagIs(MapPosition.GetXMLTag(context.version)))
                            {
                                referenceMapView =
                                    new MapPosition(context, null, MercatorCoordinateSystem.theInstance);
                            }
                        }
                    }
                }
            }

            context.AssertPresent(obj, sourceMapViewTag);
            context.AssertPresent(referenceMapView, referenceMapViewTag);
        }
예제 #21
0
        public LatLonZoom(MashupParseContext context, CoordinateSystemIfc coordSys)
        {
            XMLTagReader xMLTagReader = context.NewTagReader("LatLonZoom");

            try
            {
                if (context.reader.GetAttribute("zoom") == null)
                {
                    throw new InvalidLLZ(context, "Missing zoom attribute");
                }

                try
                {
                    _zoom = coordSys.GetZoomRange()
                            .ParseAllowUndefinedZoom(context, "zoom", context.reader.GetAttribute("zoom"));
                }
                catch (InvalidMashupFile invalidMashupFile)
                {
                    throw new InvalidLLZ(context, invalidMashupFile.Message);
                }

                bool flag = false;
                _latlon = default(LatLon);
                while (xMLTagReader.FindNextStartTag())
                {
                    if (xMLTagReader.TagIs(LatLon.GetXMLTag()))
                    {
                        _latlon = new LatLon(context, coordSys);
                        flag    = true;
                    }
                }

                if (!flag)
                {
                    throw new InvalidLLZ(context, "Missing LatLong Tag");
                }
            }
            finally
            {
                xMLTagReader.SkipAllSubTags();
            }
        }
예제 #22
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();
        }
예제 #23
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();
                }
            }
        }
예제 #24
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()));
            }
        }
예제 #25
0
        public TransparencyOptions(MashupParseContext context, DirtyEvent dirty)
        {
            this.Initialize(dirty);
            XMLTagReader xMLTagReader = context.NewTagReader("TransparencyOptions");

            this._useDocumentTransparency = true;
            context.GetAttributeBoolean("UseDocumentTransparency", ref this._useDocumentTransparency);
            this._enabled  = context.GetRequiredAttributeBoolean("Enabled");
            this._inverted = context.GetRequiredAttributeBoolean("Inverted");
            while (xMLTagReader.FindNextStartTag())
            {
                if (xMLTagReader.TagIs(TransparencyColor.GetXMLTag()))
                {
                    this._colorList.Add(new TransparencyColor(context));
                }
                else
                {
                    if (xMLTagReader.TagIs(FadeOptions.GetXMLTag()))
                    {
                        this._fadeOptions = new FadeOptions(context, dirty);
                    }
                }
            }
        }
예제 #26
0
        public Layer(MashupParseContext context, SourceMap.GetFilenameContext filenameContextDelegate,
                     DirtyEvent parentDirty, DirtyEvent parentReadyToLockEvent)
        {
            dirtyEvent = new DirtyEvent(parentDirty);
            XMLTagReader xMLTagReader = context.NewTagReader("Layer");

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

            if (attribute != null)
            {
                _displayName = attribute;
                context.GetAttributeBoolean("Expanded", ref _expanded);
                string attribute2 = context.reader.GetAttribute("SimulateTransparencyWithVEBackingLayer");
                if (attribute2 != null)
                {
                    _simulateTransparencyWithVEBackingLayer = attribute2;
                }

                while (xMLTagReader.FindNextStartTag())
                {
                    if (xMLTagReader.TagIs(SourceMap.GetXMLTag()))
                    {
                        Add(new SourceMap(context,
                                          filenameContextDelegate,
                                          dirtyEvent,
                                          parentReadyToLockEvent));
                    }
                    else
                    {
                        if (xMLTagReader.TagIs(LayerView.GetXMLTag()))
                        {
                            _lastView = new LayerView(this, context);
                        }
                        else
                        {
                            if (xMLTagReader.TagIs("LastLayerViewPosition"))
                            {
                                XMLTagReader xMLTagReader2 = context.NewTagReader("LastLayerViewPosition");
                                MapPosition  mapPosition   = null;
                                while (xMLTagReader2.FindNextStartTag())
                                {
                                    if (xMLTagReader2.TagIs(MapPosition.GetXMLTag(context.version)))
                                    {
                                        mapPosition = new MapPosition(context,
                                                                      null,
                                                                      MercatorCoordinateSystem.theInstance);
                                    }
                                }

                                if (mapPosition != null)
                                {
                                    _lastView = new LayerView(this, mapPosition);
                                }
                            }
                            else
                            {
                                if (xMLTagReader.TagIs(RenderClip.GetXMLTag()))
                                {
                                    _renderClip = new RenderClip(context);
                                }
                            }
                        }
                    }
                }

                return;
            }

            throw new InvalidMashupFile(context, "Expected displayName attribute");
        }
예제 #27
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();
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #28
0
파일: Mashup.cs 프로젝트: ymx0627/GMap.NET
        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;
                    }
                }
            }
        }
예제 #29
0
        public SourceMap(MashupParseContext context, SourceMap.GetFilenameContext filenameContextDelegate, DirtyEvent parentDirty, DirtyEvent parentReadyToLockEvent)
        {
            this.dirtyEvent = new DirtyEvent(parentDirty);
            this.readyToLockChangedEvent = new DirtyEvent(parentReadyToLockEvent);
            this.filenameContextDelegate = filenameContextDelegate;
            this.latentRegionHolder      = new LatentRegionHolder(this.dirtyEvent, this.readyToLockChangedEvent);
            XMLTagReader xMLTagReader = context.NewTagReader("SourceMap");

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

            if (attribute != null)
            {
                string path       = Path.Combine(filenameContextDelegate(), attribute);
                int    pageNumber = 0;
                context.GetAttributeInt("PageNumber", ref pageNumber);
                this._documentFuture = new GeneralDocumentFuture(new FutureDocumentFromFilesystem(path, pageNumber));
            }
            context.GetAttributeBoolean("Expanded", ref this._expanded);
            string      attribute2   = context.reader.GetAttribute("DisplayName");
            MapPosition mapPosition  = null;
            MapPosition mapPosition2 = null;

            while (xMLTagReader.FindNextStartTag())
            {
                if (xMLTagReader.TagIs(RegistrationDefinition.GetXMLTag()))
                {
                    context.AssertUnique(this.registration);
                    this.registration = new RegistrationDefinition(context, this.dirtyEvent);
                }
                else
                {
                    if (xMLTagReader.TagIs(GeneralDocumentFuture.GetXMLTag()))
                    {
                        context.AssertUnique(this._documentFuture);
                        this._documentFuture = new GeneralDocumentFuture(context, filenameContextDelegate());
                    }
                    else
                    {
                        if (xMLTagReader.TagIs(LocalDocumentDescriptor.GetXMLTag()))
                        {
                            context.AssertUnique(this._documentFuture);
                            LocalDocumentDescriptor localDocumentDescriptor = new LocalDocumentDescriptor(context, filenameContextDelegate());
                            this._documentFuture = new GeneralDocumentFuture(new FutureDocumentFromFilesystem(localDocumentDescriptor.GetFilesystemAbsolutePath(), localDocumentDescriptor.GetPageNumber()));
                        }
                        else
                        {
                            if (xMLTagReader.TagIs("LastSourceMapPosition"))
                            {
                                XMLTagReader xMLTagReader2 = context.NewTagReader("LastSourceMapPosition");
                                while (xMLTagReader2.FindNextStartTag())
                                {
                                    if (xMLTagReader2.TagIs(MapPosition.GetXMLTag(context.version)))
                                    {
                                        mapPosition = new MapPosition(context, null, ContinuousCoordinateSystem.theInstance);
                                    }
                                }
                            }
                            else
                            {
                                if (xMLTagReader.TagIs("LastVEPosition"))
                                {
                                    XMLTagReader xMLTagReader3 = context.NewTagReader("LastVEPosition");
                                    while (xMLTagReader3.FindNextStartTag())
                                    {
                                        if (xMLTagReader3.TagIs(MapPosition.GetXMLTag(context.version)))
                                        {
                                            mapPosition2 = new MapPosition(context, null, MercatorCoordinateSystem.theInstance);
                                        }
                                    }
                                }
                                else
                                {
                                    if (xMLTagReader.TagIs(RenderRegion.GetXMLTag()))
                                    {
                                        context.AssertUnique(this.renderRegion);
                                        this.renderRegion = new RenderRegion(context, this.dirtyEvent, ContinuousCoordinateSystem.theInstance);
                                    }
                                    else
                                    {
                                        if (xMLTagReader.TagIs(SourceMapInfo.GetXMLTag()))
                                        {
                                            context.AssertUnique(this._sourceMapInfo);
                                            this._sourceMapInfo = new SourceMapInfo(context, this.dirtyEvent);
                                        }
                                        else
                                        {
                                            if (xMLTagReader.TagIs(SourceMapRenderOptions.GetXMLTag()))
                                            {
                                                context.AssertUnique(this._sourceMapRenderOptions);
                                                this._sourceMapRenderOptions = new SourceMapRenderOptions(context, this.dirtyEvent);
                                            }
                                            else
                                            {
                                                if (xMLTagReader.TagIs(TransparencyOptions.GetXMLTag()))
                                                {
                                                    this._transparencyOptions = new TransparencyOptions(context, this.dirtyEvent);
                                                }
                                                else
                                                {
                                                    if (xMLTagReader.TagIs(SourceMapRegistrationView.GetXMLTag()))
                                                    {
                                                        context.AssertUnique(this._lastView);
                                                        this._lastView = new SourceMapRegistrationView(this, context);
                                                    }
                                                    else
                                                    {
                                                        if (xMLTagReader.TagIs(LegendList.GetXMLTag()))
                                                        {
                                                            context.AssertUnique(this.legendList);
                                                            this.legendList = new LegendList(this, context, this.dirtyEvent);
                                                        }
                                                        else
                                                        {
                                                            if (xMLTagReader.TagIs("SnapView"))
                                                            {
                                                                XMLTagReader        xMLTagReader4     = context.NewTagReader("SnapView");
                                                                string              requiredAttribute = context.GetRequiredAttribute("Context");
                                                                LatLonZoom          latLonZoom        = default(LatLonZoom);
                                                                bool                flag     = false;
                                                                bool                flag2    = true;
                                                                CoordinateSystemIfc coordSys = null;
                                                                if (requiredAttribute == "Source")
                                                                {
                                                                    coordSys = ContinuousCoordinateSystem.theInstance;
                                                                }
                                                                else
                                                                {
                                                                    if (!(requiredAttribute == "Reference"))
                                                                    {
                                                                        throw new InvalidMashupFile(context, string.Format("Invalid {0} value {1}", "Context", requiredAttribute));
                                                                    }
                                                                    coordSys = MercatorCoordinateSystem.theInstance;
                                                                }
                                                                while (xMLTagReader4.FindNextStartTag())
                                                                {
                                                                    if (xMLTagReader4.TagIs(LatLonZoom.GetXMLTag()))
                                                                    {
                                                                        if (flag)
                                                                        {
                                                                            context.ThrowUnique();
                                                                        }
                                                                        try
                                                                        {
                                                                            latLonZoom = new LatLonZoom(context, coordSys);
                                                                        }
                                                                        catch (InvalidLLZ)
                                                                        {
                                                                            flag2 = false;
                                                                        }
                                                                        flag = true;
                                                                    }
                                                                }
                                                                if (flag2)
                                                                {
                                                                    if (!flag)
                                                                    {
                                                                        context.AssertPresent(null, LatLonZoom.GetXMLTag());
                                                                    }
                                                                    if (requiredAttribute == "Source")
                                                                    {
                                                                        this.sourceSnap = latLonZoom;
                                                                    }
                                                                    else
                                                                    {
                                                                        if (requiredAttribute == "Reference")
                                                                        {
                                                                            this.referenceSnap = latLonZoom;
                                                                        }
                                                                        else
                                                                        {
                                                                            D.Assert(false, "handled above.");
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                            else
                                                            {
                                                                if (xMLTagReader.TagIs("SnapZoom"))
                                                                {
                                                                    context.NewTagReader("SnapZoom");
                                                                    string requiredAttribute2 = context.GetRequiredAttribute("Context");
                                                                    bool   flag3 = false;
                                                                    CoordinateSystemIfc theInstance;
                                                                    if (requiredAttribute2 == "Source")
                                                                    {
                                                                        theInstance = ContinuousCoordinateSystem.theInstance;
                                                                    }
                                                                    else
                                                                    {
                                                                        if (!(requiredAttribute2 == "Reference"))
                                                                        {
                                                                            throw new InvalidMashupFile(context, string.Format("Invalid {0} value {1}", "Context", requiredAttribute2));
                                                                        }
                                                                        theInstance = MercatorCoordinateSystem.theInstance;
                                                                    }
                                                                    int num = 0;
                                                                    try
                                                                    {
                                                                        theInstance.GetZoomRange().Parse(context, "Zoom");
                                                                        flag3 = true;
                                                                    }
                                                                    catch (InvalidMashupFile)
                                                                    {
                                                                    }
                                                                    if (flag3)
                                                                    {
                                                                        if (requiredAttribute2 == "Source")
                                                                        {
                                                                            this.sourceSnapZoom = num;
                                                                        }
                                                                        else
                                                                        {
                                                                            if (requiredAttribute2 == "Reference")
                                                                            {
                                                                                this.referenceSnapZoom = num;
                                                                            }
                                                                        }
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                if (context.version == InlineSourceMapInfoSchema.schema)
                {
                    if (xMLTagReader.TagIs("MapFileURL"))
                    {
                        this._sourceMapInfo.mapFileURL = XMLUtils.ReadStringXml(context, "MapFileURL");
                    }
                    else
                    {
                        if (xMLTagReader.TagIs("MapHomePage"))
                        {
                            this._sourceMapInfo.mapHomePage = XMLUtils.ReadStringXml(context, "MapHomePage");
                        }
                        else
                        {
                            if (xMLTagReader.TagIs("MapDescription"))
                            {
                                this._sourceMapInfo.mapDescription = XMLUtils.ReadStringXml(context, "MapDescription");
                            }
                        }
                    }
                }
            }
            if (attribute2 != null)
            {
                this._displayName = attribute2;
            }
            else
            {
                this._displayName = this._documentFuture.documentFuture.GetDefaultDisplayName();
            }
            if (this._lastView == null && mapPosition != null && mapPosition2 != null)
            {
                this._lastView = new SourceMapRegistrationView(this, mapPosition.llz, mapPosition2);
            }
            if (this._documentFuture == null)
            {
                throw new Exception("Source Map element missing document descriptor tag");
            }
            if (this.registration == null)
            {
                this.registration = new RegistrationDefinition(this.dirtyEvent);
            }
            this.registration.dirtyEvent.Add(this.readyToLockChangedEvent);
            if (this.legendList == null)
            {
                this.legendList = new LegendList(this, this.dirtyEvent, this.readyToLockChangedEvent);
            }
            if (this._sourceMapInfo == null)
            {
                this._sourceMapInfo = new SourceMapInfo(this.dirtyEvent);
            }
            if (this._sourceMapRenderOptions == null)
            {
                this._sourceMapRenderOptions = new SourceMapRenderOptions(this.dirtyEvent);
            }
            if (this._transparencyOptions == null)
            {
                this._transparencyOptions = new TransparencyOptions(this.dirtyEvent);
            }
        }