public Present Evaluate(Present[] paramList)
        {
            D.Assert(paramList.Length == 1);
            TileAddress tileAddress = (TileAddress)paramList[0];

            if (tileAddress.ZoomLevel < 1)
            {
                return(new PresentFailureCode(new Exception("zoomlevel 0")));
            }

            ITileAddressLayout tileAddressLayout = coordinateSystem.GetTileAddressLayout();
            TileAddress        tileAddress2      = new TileAddress(tileAddressLayout.XValueOneTileEast(tileAddress),
                                                                   tileAddressLayout.YValueOneTileSouth(tileAddress),
                                                                   tileAddress.ZoomLevel);
            LatLon latLonOfTileNW  = coordinateSystem.GetLatLonOfTileNW(tileAddress);
            LatLon latLonOfTileNW2 = coordinateSystem.GetLatLonOfTileNW(tileAddress2);

            if (latLonOfTileNW2.lon <= latLonOfTileNW.lon)
            {
                latLonOfTileNW2 = new LatLon(latLonOfTileNW2.lat, latLonOfTileNW2.lon + 360.0);
            }

            D.Assert(latLonOfTileNW2.lon > latLonOfTileNW.lon);
            return(new MapRectangleParameter(new MapRectangle(latLonOfTileNW, latLonOfTileNW2)));
        }
		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);
		}
        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));
        }