public void Activate()
        {
            ViewerControlIfc  sMViewerControl   = viewControl.GetSMViewerControl();
            UIPositionManager uIPositionManager = viewControl.GetUIPositionManager();

            foreach (SourceMap current in layer.GetBackToFront())
            {
                IDisplayableSource displayableSource = mapTileSourceFactory.CreateDisplayableWarpedSource(current);
                if (displayableSource != null)
                {
                    sMViewerControl.AddLayer(displayableSource);
                }
            }

            uIPositionManager.SetPositionMemory(layer);
            LayerView layerView = (LayerView)layer.lastView;

            viewControl.GetUIPositionManager().switchSlaved();
            if (layerView != null)
            {
                uIPositionManager.GetVEPos().setPosition(layerView.GetReferenceMapView());
                uIPositionManager.GetVEPos().setStyle(layerView.GetReferenceMapView().style);
                return;
            }

            MapRectangle mapRectangle = null;

            try
            {
                mapRectangle = layer.GetUserBoundingBox(mapTileSourceFactory);
            }
            catch (CorrespondencesAreSingularException)
            {
            }
            catch (InsufficientCorrespondencesException)
            {
            }

            LatLonZoom position;

            if (mapRectangle != null)
            {
                Size size = new Size(600, 600);
                position = viewControl.GetVEViewerControl().GetCoordinateSystem()
                           .GetBestViewContaining(mapRectangle, size);
            }
            else
            {
                position = viewControl.GetVEViewerControl().GetCoordinateSystem().GetDefaultView();
            }

            uIPositionManager.GetVEPos().setPosition(position);
        }
Exemple #2
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.");
            }
        }
Exemple #3
0
		public Layer(MashupParseContext context, SourceMap.GetFilenameContext filenameContextDelegate, DirtyEvent parentDirty, DirtyEvent parentReadyToLockEvent)
		{
			this.dirtyEvent = new DirtyEvent(parentDirty);
			XMLTagReader xMLTagReader = context.NewTagReader("Layer");
			context.ExpectIdentity(this);
			string attribute = context.reader.GetAttribute("DisplayName");
			if (attribute != null)
			{
				this._displayName = attribute;
				context.GetAttributeBoolean("Expanded", ref this._expanded);
				string attribute2 = context.reader.GetAttribute("SimulateTransparencyWithVEBackingLayer");
				if (attribute2 != null)
				{
					this._simulateTransparencyWithVEBackingLayer = attribute2;
				}
				while (xMLTagReader.FindNextStartTag())
				{
					if (xMLTagReader.TagIs(SourceMap.GetXMLTag()))
					{
						this.Add(new SourceMap(context, filenameContextDelegate, this.dirtyEvent, parentReadyToLockEvent));
					}
					else
					{
						if (xMLTagReader.TagIs(LayerView.GetXMLTag()))
						{
							this._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)
								{
									this._lastView = new LayerView(this, mapPosition);
								}
							}
							else
							{
								if (xMLTagReader.TagIs(RenderClip.GetXMLTag()))
								{
									this._renderClip = new RenderClip(context);
								}
							}
						}
					}
				}
				return;
			}
			throw new InvalidMashupFile(context, "Expected displayName attribute");
		}
Exemple #4
0
		public void NotePositionLocked(MapPosition referenceMapPosition)
		{
			this._lastView = new LayerView(this, referenceMapPosition);
		}
Exemple #5
0
 public void WriteXML(XmlTextWriter writer)
 {
     writer.WriteStartElement(LayerView.GetXMLTag());
     this.lockedView.WriteXML(writer);
     writer.WriteEndElement();
 }
Exemple #6
0
 public void NotePositionLocked(MapPosition referenceMapPosition)
 {
     _lastView = new LayerView(this, referenceMapPosition);
 }
Exemple #7
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");
        }