예제 #1
0
		public void Flush()
		{
			this.cachedCoordSys = null;
			this.cachedRendererCredit = null;
			this.cachedUserBounds = null;
			this.cachedImageRequest = null;
		}
예제 #2
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())
            {
            }
        }
예제 #3
0
 public void Flush()
 {
     cachedCoordSys       = null;
     cachedRendererCredit = null;
     cachedUserBounds     = null;
     cachedImageRequest   = null;
 }
예제 #4
0
        public static LatLon ReadFromAttributes(MashupParseContext context, CoordinateSystemIfc coordSys)
        {
            double lat = coordSys.GetLatRange().Parse(context, "lat");
            double lon = coordSys.GetLonRange().Parse(context, "lon");

            return(new LatLon(lat, lon));
        }
        public static MapRectangle GetBounds(CoordinateSystemIfc coordinateSystem, LatLonZoom center, Size size)
        {
            LatLon latlon  = coordinateSystem.GetTranslationInLatLon(center, new Point(size.Width / 2, size.Height / 2)).latlon;
            LatLon latlon2 = coordinateSystem.GetTranslationInLatLon(center, new Point(-size.Width / 2, -size.Height / 2)).latlon;

            return(new MapRectangle(latlon, latlon2));
        }
예제 #6
0
        public static LatLonZoom ReadFromAttributes(MashupParseContext context, CoordinateSystemIfc coordSys)
        {
            int    zoom   = coordSys.GetZoomRange().ParseAllowUndefinedZoom(context, "zoom", context.GetRequiredAttribute("zoom"));
            LatLon latLon = LatLon.ReadFromAttributes(context, coordSys);

            return(new LatLonZoom(latLon.lat, latLon.lon, zoom));
        }
예제 #7
0
        public Region GetClipRegion(MapRectangle mapWindow, int zoom, CoordinateSystemIfc csi)
        {
            if (csi is MercatorCoordinateSystem)
            {
                Region region = null;
                for (int i = -360; i <= 0; i += 360)
                {
                    MapRectangle clippedMapWindow = new MapRectangle(mapWindow.lat0,
                                                                     mapWindow.lon0 + i,
                                                                     mapWindow.lat1,
                                                                     mapWindow.lon1 + i);
                    Region clipRegionComponent = GetClipRegionComponent(clippedMapWindow, zoom, csi);
                    if (region == null)
                    {
                        region = clipRegionComponent;
                    }
                    else
                    {
                        region.Union(clipRegionComponent);
                    }
                }

                return(region);
            }

            return(GetClipRegionComponent(mapWindow, zoom, csi));
        }
예제 #8
0
 public static MapRectangle GetRangeAsMapRectangle(CoordinateSystemIfc coordSys)
 {
     return(new MapRectangle(coordSys.GetLatRange().min,
                             coordSys.GetLonRange().min,
                             coordSys.GetLatRange().max,
                             coordSys.GetLonRange().max));
 }
        public static LatLonZoom GetZoomedView(CoordinateSystemIfc coordinateSystem, LatLonZoom oldCenterPosition, int steps)
        {
            int num = oldCenterPosition.zoom + steps;

            num = coordinateSystem.GetZoomRange().Constrain(num);
            return(new LatLonZoom(oldCenterPosition.lat, oldCenterPosition.lon, num));
        }
		public ImageParameterFromTileAddress(CoordinateSystemIfc coordSys, Size outputSize)
		{
			this.boundsParameter = new ApplyPrototype(new TileAddressToImageRegion(coordSys), new IFuturePrototype[]
			{
				new UnevaluatedTerm(TermName.TileAddress)
			});
			this.sizeParameter = new ConstantFuture(new SizeParameter(outputSize));
		}
예제 #11
0
 public ImageParameterFromTileAddress(CoordinateSystemIfc coordSys, Size outputSize)
 {
     this.boundsParameter = new ApplyPrototype(new TileAddressToImageRegion(coordSys), new IFuturePrototype[]
     {
         new UnevaluatedTerm(TermName.TileAddress)
     });
     this.sizeParameter = new ConstantFuture(new SizeParameter(outputSize));
 }
예제 #12
0
		public CoordinateSystemIfc GetDefaultCoordinateSystem()
		{
			if (this.cachedCoordSys == null)
			{
				this.cachedCoordSys = this.backingSource.GetDefaultCoordinateSystem();
			}
			return this.cachedCoordSys;
		}
예제 #13
0
 public CoordinateSystemIfc GetDefaultCoordinateSystem()
 {
     if (this.cachedCoordSys == null)
     {
         this.cachedCoordSys = this.backingSource.GetDefaultCoordinateSystem();
     }
     return(this.cachedCoordSys);
 }
예제 #14
0
		public LatLon(MashupParseContext context, CoordinateSystemIfc coordSys)
		{
			XMLTagReader xMLTagReader = context.NewTagReader("LatLon");
			this._lat = coordSys.GetLatRange().Parse(context, "lat");
			this._lon = coordSys.GetLonRange().Parse(context, "lon");
			while (xMLTagReader.FindNextStartTag())
			{
			}
		}
예제 #15
0
        public CoordinateSystemIfc GetDefaultCoordinateSystem()
        {
            if (cachedCoordSys == null)
            {
                cachedCoordSys = backingSource.GetDefaultCoordinateSystem();
            }

            return(cachedCoordSys);
        }
예제 #16
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())
            {
            }
        }
예제 #17
0
 public UserRegionViewController(CoordinateSystemIfc csi, SVDisplayParams svdp, LatentRegionHolder latentRegionHolder, IDisplayableSource unwarpedMapTileSource)
 {
     this.csi = csi;
     this.svdp = svdp;
     this.latentRegionHolder = latentRegionHolder;
     this.displayableSource = unwarpedMapTileSource;
     this.vertexFillBrush = new SolidBrush(Color.LightBlue);
     this.vertexStrokePen = new Pen(Color.DarkBlue, 1f);
     this.segmentFillBrush = new SolidBrush(Color.DarkBlue);
 }
예제 #18
0
		public DisplayablePosition(MashupParseContext context, CoordinateSystemIfc coordSys)
		{
			if (context.version == MonolithicMapPositionsSchema.schema)
			{
				MapPosition mapPosition = new MapPosition(context, null, coordSys);
				this._pinPosition = mapPosition.llz;
				return;
			}
			this._pinPosition = new LatLonZoom(context, coordSys);
		}
예제 #19
0
 public UserRegionViewController(CoordinateSystemIfc csi, SVDisplayParams svdp, LatentRegionHolder latentRegionHolder, IDisplayableSource unwarpedMapTileSource)
 {
     this.csi  = csi;
     this.svdp = svdp;
     this.latentRegionHolder = latentRegionHolder;
     this.displayableSource  = unwarpedMapTileSource;
     this.vertexFillBrush    = new SolidBrush(Color.LightBlue);
     this.vertexStrokePen    = new Pen(Color.DarkBlue, 1f);
     this.segmentFillBrush   = new SolidBrush(Color.DarkBlue);
 }
예제 #20
0
 public DisplayablePosition(MashupParseContext context, CoordinateSystemIfc coordSys)
 {
     if (context.version == MonolithicMapPositionsSchema.schema)
     {
         MapPosition mapPosition = new MapPosition(context, null, coordSys);
         this._pinPosition = mapPosition.llz;
         return;
     }
     this._pinPosition = new LatLonZoom(context, coordSys);
 }
예제 #21
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));
                }
            }
        }
예제 #22
0
        public TracedScreenPoint[] GetPath(MapRectangle mapWindow, int zoom, CoordinateSystemIfc csi)
        {
            MapRectangle        mapWindow2 = mapWindow.GrowFraction(0.1);
            List <TracedVertex> list       = this.IntersectWithRectangle(mapWindow2);

            TracedScreenPoint[] array = new TracedScreenPoint[list.Count];
            int num = 0;

            foreach (TracedVertex current in list)
            {
                array[num] = new TracedScreenPoint(current.originalIndex, csi.GetTranslationInPixels(new LatLonZoom(mapWindow.GetNW().lat, mapWindow.GetNW().lon, zoom), current.position));
                num++;
            }
            return(array);
        }
예제 #23
0
		public static MapRectangle TileAddressToMapRectangle(CoordinateSystemIfc coordinateSystem, TileAddress tileAddress)
		{
			TileAddress tileAddress2 = new TileAddress(coordinateSystem.GetTileAddressLayout().XValueOneTileEast(tileAddress), coordinateSystem.GetTileAddressLayout().YValueOneTileSouth(tileAddress), tileAddress.ZoomLevel);
			LatLon latLonOfTileNW = coordinateSystem.GetLatLonOfTileNW(tileAddress);
			LatLon latLonOfTileNW2 = coordinateSystem.GetLatLonOfTileNW(tileAddress2);
			if (tileAddress2.TileX < tileAddress.TileX)
			{
				latLonOfTileNW2 = new LatLon(latLonOfTileNW2.lat, latLonOfTileNW2.lon + 360.0);
			}
			if (tileAddress2.TileY < tileAddress.TileY)
			{
				D.Assert(false, "study this case");
				latLonOfTileNW2 = new LatLon(latLonOfTileNW2.lat - 180.0, latLonOfTileNW2.lon);
			}
			return new MapRectangle(latLonOfTileNW, latLonOfTileNW2);
		}
예제 #24
0
        public static MapRectangle TileAddressToMapRectangle(CoordinateSystemIfc coordinateSystem, TileAddress tileAddress)
        {
            TileAddress tileAddress2    = new TileAddress(coordinateSystem.GetTileAddressLayout().XValueOneTileEast(tileAddress), coordinateSystem.GetTileAddressLayout().YValueOneTileSouth(tileAddress), tileAddress.ZoomLevel);
            LatLon      latLonOfTileNW  = coordinateSystem.GetLatLonOfTileNW(tileAddress);
            LatLon      latLonOfTileNW2 = coordinateSystem.GetLatLonOfTileNW(tileAddress2);

            if (tileAddress2.TileX < tileAddress.TileX)
            {
                latLonOfTileNW2 = new LatLon(latLonOfTileNW2.lat, latLonOfTileNW2.lon + 360.0);
            }
            if (tileAddress2.TileY < tileAddress.TileY)
            {
                D.Assert(false, "study this case");
                latLonOfTileNW2 = new LatLon(latLonOfTileNW2.lat - 180.0, latLonOfTileNW2.lon);
            }
            return(new MapRectangle(latLonOfTileNW, latLonOfTileNW2));
        }
예제 #25
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();
            }
        }
예제 #26
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();
 }
예제 #27
0
        public MapRectangle(MashupParseContext context, CoordinateSystemIfc coordSys)
        {
            XMLTagReader  reader = context.NewTagReader("MapRectangle");
            List <LatLon> list   = new List <LatLon>();

            while (reader.FindNextStartTag())
            {
                if (reader.TagIs(LatLon.GetXMLTag()))
                {
                    list.Add(new LatLon(context, coordSys));
                }
            }
            reader.SkipAllSubTags();
            if (list.Count != 2)
            {
                throw new InvalidMashupFile(context, string.Format("{0} should contain exactly 2 {1} subtags", "MapRectangle", LatLon.GetXMLTag()));
            }
            this.ll0 = list[0];
            this.ll1 = list[1];
            this.AssertOrder();
        }
		public ImageParameterFromTileAddress(CoordinateSystemIfc coordSys) : this(coordSys, coordSys.GetTileSize())
		{
		}
예제 #29
0
		public static LatLonZoom ReadFromAttributes(MashupParseContext context, CoordinateSystemIfc coordSys)
		{
			int zoom = coordSys.GetZoomRange().ParseAllowUndefinedZoom(context, "zoom", context.GetRequiredAttribute("zoom"));
			LatLon latLon = LatLon.ReadFromAttributes(context, coordSys);
			return new LatLonZoom(latLon.lat, latLon.lon, zoom);
		}
예제 #30
0
 internal static LatLonZoom ConstrainLLZ(CoordinateSystemIfc coordSys, LatLonZoom src)
 {
     return(new LatLonZoom(coordSys.GetLatRange().Constrain(src.lat), coordSys.GetLonRange().Constrain(src.lon), coordSys.GetZoomRange().Constrain(src.zoom)));
 }
예제 #31
0
		public static MapRectangle GetBounds(CoordinateSystemIfc coordinateSystem, LatLonZoom center, Size size)
		{
			LatLon latlon = coordinateSystem.GetTranslationInLatLon(center, new Point(size.Width / 2, size.Height / 2)).latlon;
			LatLon latlon2 = coordinateSystem.GetTranslationInLatLon(center, new Point(-size.Width / 2, -size.Height / 2)).latlon;
			return new MapRectangle(latlon, latlon2);
		}
예제 #32
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);
            }
        }
예제 #33
0
 public RenderedTileSource(CachePackage cachePackage, RenderedTileNamingScheme namingScheme)
 {
     this.cachePackage = cachePackage;
     this.namingScheme = namingScheme;
     coordinateSystem  = new MercatorCoordinateSystem();
 }
예제 #34
0
        public Pixel GetBaseLayerCenterPixel()
        {
            IDisplayableSource         displayableSource       = this.baseLayer;
            CoordinateSystemIfc        defaultCoordinateSystem = displayableSource.GetDefaultCoordinateSystem();
            TileDisplayDescriptorArray tileArrayDescriptor     = defaultCoordinateSystem.GetTileArrayDescriptor(this.center().llz, base.Size);
            int num  = base.Size.Width / 2;
            int num2 = base.Size.Height / 2;

            foreach (TileDisplayDescriptor current in tileArrayDescriptor)
            {
                Rectangle paintLocation = current.paintLocation;
                if (paintLocation.Left <= num)
                {
                    Rectangle paintLocation2 = current.paintLocation;
                    if (paintLocation2.Right > num)
                    {
                        Rectangle paintLocation3 = current.paintLocation;
                        if (paintLocation3.Top <= num2)
                        {
                            Rectangle paintLocation4 = current.paintLocation;
                            if (paintLocation4.Bottom > num2)
                            {
                                int       arg_D1_0       = num;
                                Rectangle paintLocation5 = current.paintLocation;
                                int       x              = arg_D1_0 - paintLocation5.Left;
                                int       arg_E6_0       = num2;
                                Rectangle paintLocation6 = current.paintLocation;
                                int       y              = arg_E6_0 - paintLocation6.Top;
                                Present   present        = displayableSource.GetImagePrototype(null, (FutureFeatures)19).Curry(new ParamDict(new object[]
                                {
                                    TermName.TileAddress,
                                    current.tileAddress
                                })).Realize("ViewerControl.GetBaseLayerCenterPixel imageRef");
                                Pixel result;
                                if (!(present is ImageRef))
                                {
                                    result = new UndefinedPixel();
                                    return(result);
                                }
                                ImageRef          imageRef = (ImageRef)present;
                                GDIBigLockedImage image;
                                Monitor.Enter(image = imageRef.image);
                                Pixel pixel2;
                                try
                                {
                                    Image  image2 = imageRef.image.IPromiseIAmHoldingGDISLockSoPleaseGiveMeTheImage();
                                    Bitmap bitmap = (Bitmap)image2;
                                    Color  pixel  = bitmap.GetPixel(x, y);
                                    pixel2 = new Pixel(pixel);
                                }
                                finally
                                {
                                    Monitor.Exit(image);
                                }
                                imageRef.Dispose();
                                result = pixel2;
                                return(result);
                            }
                        }
                    }
                }
            }
            return(new UndefinedPixel());
        }
예제 #35
0
        private List <ViewerControl.PaintKit> AssembleLayer(PaintSpecification e, LatLonZoom llz, IDisplayableSource tileSource, int stackOrder)
        {
            List <ViewerControl.PaintKit> list = new List <ViewerControl.PaintKit>();
            CoordinateSystemIfc           defaultCoordinateSystem = tileSource.GetDefaultCoordinateSystem();
            TileDisplayDescriptorArray    tileArrayDescriptor     = defaultCoordinateSystem.GetTileArrayDescriptor(llz, e.Size);
            AsyncRef asyncRef;

            try
            {
                asyncRef = (AsyncRef)tileSource.GetUserBounds(null, (FutureFeatures)7).Realize("ViewerControl.PaintLayer boundsRef");
            }
            catch (Exception ex)
            {
                ViewerControl.MessagePainter item = new ViewerControl.MessagePainter(stackOrder * 12, BigDebugKnob.theKnob.debugFeaturesEnabled ? ex.ToString() : "X", stackOrder == 0);
                foreach (TileDisplayDescriptor current in tileArrayDescriptor)
                {
                    list.Add(new ViewerControl.PaintKit(current.paintLocation)
                    {
                        annotations =
                        {
                            item
                        }
                    });
                }
                return(list);
            }
            Region clipRegion = null;

            if (asyncRef.present == null)
            {
                asyncRef.AddCallback(new AsyncRecord.CompleteCallback(this.BoundsRefAvailable));
                asyncRef.SetInterest(524290);
            }
            if ((this.ShowSourceCrop == null || this.ShowSourceCrop.Enabled) && asyncRef.present is IBoundsProvider)
            {
                clipRegion = ((IBoundsProvider)asyncRef.present).GetRenderRegion().GetClipRegion(defaultCoordinateSystem.GetUnclippedMapWindow(this.center().llz, e.Size), this.center().llz.zoom, defaultCoordinateSystem);
                this.UpdateUserRegion();
            }
            new PersistentInterest(asyncRef);
            int num = 0;

            foreach (TileDisplayDescriptor current2 in tileArrayDescriptor)
            {
                ViewerControl.PaintKit paintKit = new ViewerControl.PaintKit(current2.paintLocation);
                D.Sayf(10, "count {0} tdd {1}", new object[]
                {
                    num,
                    current2.tileAddress
                });
                num++;
                if (e.SynchronousTiles)
                {
                    D.Sayf(0, "PaintLayer({0}, tdd.ta={1})", new object[]
                    {
                        tileSource.GetHashCode(),
                        current2.tileAddress
                    });
                }
                bool    arg_1F5_0 = e.SynchronousTiles;
                Present present   = tileSource.GetImagePrototype(null, (FutureFeatures)15).Curry(new ParamDict(new object[]
                {
                    TermName.TileAddress,
                    current2.tileAddress
                })).Realize("ViewerControl.PaintLayer imageAsyncRef");
                AsyncRef  asyncRef2 = (AsyncRef)present;
                Rectangle rectangle = Rectangle.Intersect(e.ClipRectangle, current2.paintLocation);
                int       interest  = rectangle.Height * rectangle.Width + 524296;
                asyncRef2.SetInterest(interest);
                if (asyncRef2.present == null)
                {
                    ViewerControl.AsyncNotifier @object = new ViewerControl.AsyncNotifier(this);
                    asyncRef2.AddCallback(new AsyncRecord.CompleteCallback(@object.AsyncRecordComplete));
                }
                this.activeTiles.Add(asyncRef2);
                asyncRef2 = (AsyncRef)asyncRef2.Duplicate("ViewerControl.PaintLayer");
                if (e.SynchronousTiles)
                {
                    D.Assert(false, "unimpl");
                }
                if (asyncRef2.present == null)
                {
                    D.Assert(!e.SynchronousTiles);
                }
                bool flag;
                if (asyncRef2.present != null && asyncRef2.present is ImageRef)
                {
                    flag = false;
                    ImageRef imageRef = (ImageRef)asyncRef2.present.Duplicate("tpc");
                    paintKit.meatyParts.Add(new ViewerControl.ImagePainter(imageRef, clipRegion));
                }
                else
                {
                    if (asyncRef2.present != null && asyncRef2.present is BeyondImageBounds)
                    {
                        flag = false;
                    }
                    else
                    {
                        if (asyncRef2.present != null && asyncRef2.present is PresentFailureCode)
                        {
                            flag = false;
                            PresentFailureCode           presentFailureCode = (PresentFailureCode)asyncRef2.present;
                            ViewerControl.MessagePainter item2 = new ViewerControl.MessagePainter(stackOrder * 12, BigDebugKnob.theKnob.debugFeaturesEnabled ? StringUtils.breakLines(presentFailureCode.ToString()) : "X", stackOrder == 0);
                            paintKit.annotations.Add(item2);
                        }
                        else
                        {
                            flag = true;
                            ViewerControl.MessagePainter item3 = new ViewerControl.MessagePainter(stackOrder * 12, stackOrder.ToString(), stackOrder == 0);
                            if (stackOrder == 0)
                            {
                                paintKit.meatyParts.Add(item3);
                            }
                            else
                            {
                                paintKit.annotations.Add(item3);
                            }
                        }
                    }
                }
                this.tilesRequired++;
                if (!flag)
                {
                    this.tilesAvailable++;
                }
                if ((flag && stackOrder == 0) || MapDrawingOption.IsEnabled(this.ShowTileBoundaries))
                {
                    paintKit.annotations.Add(new ViewerControl.TileBoundaryPainter());
                }
                if (MapDrawingOption.IsEnabled(this.ShowTileNames))
                {
                    paintKit.annotations.Add(new ViewerControl.TileNamePainter(current2.tileAddress.ToString()));
                }
                asyncRef2.Dispose();
                list.Add(paintKit);
            }
            return(list);
        }
예제 #36
0
		public void CheckValid(CoordinateSystemIfc coordSys)
		{
			coordSys.GetLatRange().CheckValid(this.lat);
			coordSys.GetLonRange().CheckValid(this.lon);
		}
예제 #37
0
		public static LatLon ReadFromAttributes(MashupParseContext context, CoordinateSystemIfc coordSys)
		{
			double lat = coordSys.GetLatRange().Parse(context, "lat");
			double lon = coordSys.GetLonRange().Parse(context, "lon");
			return new LatLon(lat, lon);
		}
예제 #38
0
        private Region GetClipRegionComponent(MapRectangle clippedMapWindow, int zoom, CoordinateSystemIfc csi)
        {
            TracedScreenPoint[] path  = GetPath(clippedMapWindow, zoom, csi);
            PointF[]            array = new PointF[path.GetLength(0)];
            for (int i = 0; i < path.GetLength(0); i++)
            {
                array[i] = path[i].pointf;
            }

            GraphicsPath graphicsPath = new GraphicsPath();

            graphicsPath.AddLines(array);
            graphicsPath.CloseFigure();
            return(new Region(graphicsPath));
        }
예제 #39
0
		public VETileSource(CachePackage cachePackage, string veStyle)
		{
			this.cachePackage = cachePackage;
			this.veStyle = veStyle;
			this.coordinateSystem = new MercatorCoordinateSystem();
		}
예제 #40
0
 public TileAddressToImageRegion(CoordinateSystemIfc coordinateSystem)
 {
     this.coordinateSystem = coordinateSystem;
 }
예제 #41
0
		public static MapRectangle GetRangeAsMapRectangle(CoordinateSystemIfc coordSys)
		{
			return new MapRectangle(coordSys.GetLatRange().min, coordSys.GetLonRange().min, coordSys.GetLatRange().max, coordSys.GetLonRange().max);
		}
예제 #42
0
		public TracedScreenPoint[] GetPath(MapRectangle mapWindow, int zoom, CoordinateSystemIfc csi)
		{
			MapRectangle mapWindow2 = mapWindow.GrowFraction(0.1);
			List<TracedVertex> list = this.IntersectWithRectangle(mapWindow2);
			TracedScreenPoint[] array = new TracedScreenPoint[list.Count];
			int num = 0;
			foreach (TracedVertex current in list)
			{
				array[num] = new TracedScreenPoint(current.originalIndex, csi.GetTranslationInPixels(new LatLonZoom(mapWindow.GetNW().lat, mapWindow.GetNW().lon, zoom), current.position));
				num++;
			}
			return array;
		}
예제 #43
0
		public RenderRegion(MashupParseContext context, DirtyEvent parentDirty, CoordinateSystemIfc coordSys)
		{
			this.dirtyEvent = new DirtyEvent(parentDirty);
			XMLTagReader xMLTagReader = context.NewTagReader("RenderRegion");
			while (xMLTagReader.FindNextStartTag())
			{
				if (xMLTagReader.TagIs(LatLon.GetXMLTag()))
				{
					this.vertexList.Add(new LatLon(context, coordSys));
				}
			}
		}
		public TileAddressToImageRegion(CoordinateSystemIfc coordinateSystem)
		{
			this.coordinateSystem = coordinateSystem;
		}
 public ImageParameterFromTileAddress(CoordinateSystemIfc coordSys) : this(coordSys, coordSys.GetTileSize())
 {
 }
예제 #46
0
		public Region GetClipRegion(MapRectangle mapWindow, int zoom, CoordinateSystemIfc csi)
		{
			if (csi is MercatorCoordinateSystem)
			{
				Region region = null;
				for (int i = -360; i <= 0; i += 360)
				{
					MapRectangle clippedMapWindow = new MapRectangle(mapWindow.lat0, mapWindow.lon0 + (double)i, mapWindow.lat1, mapWindow.lon1 + (double)i);
					Region clipRegionComponent = this.GetClipRegionComponent(clippedMapWindow, zoom, csi);
					if (region == null)
					{
						region = clipRegionComponent;
					}
					else
					{
						region.Union(clipRegionComponent);
					}
				}
				return region;
			}
			return this.GetClipRegionComponent(mapWindow, zoom, csi);
		}
예제 #47
0
 public void CheckValid(CoordinateSystemIfc coordSys)
 {
     coordSys.GetLatRange().CheckValid(lat);
     coordSys.GetLonRange().CheckValid(lon);
 }
예제 #48
0
		internal static LatLonZoom ConstrainLLZ(CoordinateSystemIfc coordSys, LatLonZoom src)
		{
			return new LatLonZoom(coordSys.GetLatRange().Constrain(src.lat), coordSys.GetLonRange().Constrain(src.lon), coordSys.GetZoomRange().Constrain(src.zoom));
		}
예제 #49
0
		private Region GetClipRegionComponent(MapRectangle clippedMapWindow, int zoom, CoordinateSystemIfc csi)
		{
			TracedScreenPoint[] path = this.GetPath(clippedMapWindow, zoom, csi);
			PointF[] array = new PointF[path.GetLength(0)];
			for (int i = 0; i < path.GetLength(0); i++)
			{
				array[i] = path[i].pointf;
			}
			GraphicsPath graphicsPath = new GraphicsPath();
			graphicsPath.AddLines(array);
			graphicsPath.CloseFigure();
			return new Region(graphicsPath);
		}
예제 #50
0
		public RenderedTileSource(CachePackage cachePackage, RenderedTileNamingScheme namingScheme)
		{
			this.cachePackage = cachePackage;
			this.namingScheme = namingScheme;
			this.coordinateSystem = new MercatorCoordinateSystem();
		}
예제 #51
0
 public VETileSource(CachePackage cachePackage, string veStyle)
 {
     this.cachePackage = cachePackage;
     this.veStyle      = veStyle;
     coordinateSystem  = new MercatorCoordinateSystem();
 }
예제 #52
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
				{
					this._zoom = coordSys.GetZoomRange().ParseAllowUndefinedZoom(context, "zoom", context.reader.GetAttribute("zoom"));
				}
				catch (InvalidMashupFile invalidMashupFile)
				{
					throw new InvalidLLZ(context, invalidMashupFile.Message);
				}
				bool flag = false;
				this._latlon = default(LatLon);
				while (xMLTagReader.FindNextStartTag())
				{
					if (xMLTagReader.TagIs(LatLon.GetXMLTag()))
					{
						this._latlon = new LatLon(context, coordSys);
						flag = true;
					}
				}
				if (!flag)
				{
					throw new InvalidLLZ(context, "Missing LatLong Tag");
				}
			}
			finally
			{
				xMLTagReader.SkipAllSubTags();
			}
		}
예제 #53
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())
			{
			}
		}
예제 #54
0
		public static LatLonZoom GetZoomedView(CoordinateSystemIfc coordinateSystem, LatLonZoom oldCenterPosition, int steps)
		{
			int num = oldCenterPosition.zoom + steps;
			num = coordinateSystem.GetZoomRange().Constrain(num);
			return new LatLonZoom(oldCenterPosition.lat, oldCenterPosition.lon, num);
		}