Esempio n. 1
0
        public TileDisplayDescriptorArray GetTileArrayDescriptor(LatLonZoom center, Size windowSize)
        {
            TileDisplayDescriptorArray tileDisplayDescriptorArray = new TileDisplayDescriptorArray();
            MapRectangle mapWindow = this.GetMapWindow(center, windowSize);

            tileDisplayDescriptorArray.topLeftTile = this.GetTileContainingLatLonZoom(new LatLonZoom(mapWindow.GetNW(), center.zoom));
            TileAddress tileContainingLatLonZoom = this.GetTileContainingLatLonZoom(new LatLonZoom(mapWindow.GetSE(), center.zoom));

            tileDisplayDescriptorArray.tileCountX = tileContainingLatLonZoom.TileX - tileDisplayDescriptorArray.topLeftTile.TileX + 1;
            tileDisplayDescriptorArray.tileCountY = tileContainingLatLonZoom.TileY - tileDisplayDescriptorArray.topLeftTile.TileY + 1;
            int x    = this.GetTranslationInPixels(center, this.GetLatLonOfTileNW(tileDisplayDescriptorArray.topLeftTile)).X;
            int x2   = this.GetTranslationInPixels(center, this.GetLatLonOfTileNW(new TileAddress(tileDisplayDescriptorArray.topLeftTile.TileX + tileDisplayDescriptorArray.tileCountX, tileDisplayDescriptorArray.topLeftTile.TileY, tileDisplayDescriptorArray.topLeftTile.ZoomLevel))).X;
            int num  = x2 - x;
            int num2 = windowSize.Width + 512;

            if (num > num2)
            {
                D.Sayf(0, "break", new object[0]);
            }
            tileDisplayDescriptorArray.layout   = this.addressLayout;
            tileDisplayDescriptorArray.tileSize = this.GetTileSize();
            Point64 point = this.LatLongZoomToPixel(new LatLonZoom(mapWindow.GetNW(), center.zoom));

            tileDisplayDescriptorArray.topLeftTileOffset = new Point64((long)tileDisplayDescriptorArray.topLeftTile.TileX * 256L - point.X, (long)tileDisplayDescriptorArray.topLeftTile.TileY * 256L - point.Y).ToPoint();
            tileDisplayDescriptorArray.topLeftTile.TileX = VEAddressLayout.WrapLongitude(tileDisplayDescriptorArray.topLeftTile.TileX, tileDisplayDescriptorArray.topLeftTile.ZoomLevel);
            return(tileDisplayDescriptorArray);
        }
Esempio n. 2
0
        public RenderBounds MakeRenderBounds(MapRectangle imageBounds)
        {
            RenderBounds renderBounds = new RenderBounds();

            renderBounds.MinZoom       = this.ZoomRange.min;
            renderBounds.MaxZoom       = this.ZoomRange.max;
            renderBounds.TileSize      = this.GetTileSize();
            renderBounds.imageBounds   = imageBounds;
            renderBounds.tileRectangle = new TileRectangle[renderBounds.MaxZoom + 1];
            for (int i = renderBounds.MinZoom; i <= renderBounds.MaxZoom; i++)
            {
                renderBounds.tileRectangle[i]      = new TileRectangle();
                renderBounds.tileRectangle[i].zoom = i;
                LatLonZoom llz = new LatLonZoom(imageBounds.GetNW().lat, imageBounds.GetNW().lon, i);
                renderBounds.tileRectangle[i].TopLeft = this.GetTileContainingLatLonZoom(llz);
                llz = new LatLonZoom(imageBounds.GetSE().lat, imageBounds.GetSE().lon, i);
                renderBounds.tileRectangle[i].BottomRight = this.GetTileContainingLatLonZoom(llz);
                renderBounds.tileRectangle[i].StrideX     = 1;
                renderBounds.tileRectangle[i].StrideY     = 1;
            }
            return(renderBounds);
        }
		internal override void doTransformImage(GDIBigLockedImage sourceImage, MapRectangle sourceBounds, GDIBigLockedImage destImage, MapRectangle destBounds)
		{
			MapRectangle inr = new MapRectangle(-0.5, -0.5, (double)destImage.Height - 0.5, (double)destImage.Width - 0.5);
			MapRectangle outr = MapRectangle.MapRectangleIgnoreOrder(MercatorCoordinateSystem.LatLonToMercator(destBounds.GetNW()), MercatorCoordinateSystem.LatLonToMercator(destBounds.GetSE()));
			JamaMatrix matrix = PolynomialImageTransformer.FindAffineMatrix(inr, outr);
			MapRectangle outr2 = new MapRectangle(-0.5, -0.5, (double)sourceImage.Height - 0.5, (double)sourceImage.Width - 0.5);
			JamaMatrix matrix2 = PolynomialImageTransformer.FindAffineMatrix(sourceBounds, outr2);
			FastImageWarper.doWarp(destImage, sourceImage, new IPointTransformer[]
			{
				new Affine2DPointTransformer(matrix),
				this.destMercatorToSourceTransformer,
				new Affine2DPointTransformer(matrix2)
			}, this.interpolationMode);
		}
        public TileDisplayDescriptorArray GetTileArrayDescriptor(LatLonZoom center, Size windowSize)
        {
            TileDisplayDescriptorArray tileDisplayDescriptorArray = new TileDisplayDescriptorArray();
            MapRectangle unclippedMapWindow = GetUnclippedMapWindow(center, windowSize);

            tileDisplayDescriptorArray.topLeftTile =
                GetTileContainingLatLonZoom(new LatLonZoom(unclippedMapWindow.GetNW(), center.zoom));
            TileAddress tileContainingLatLonZoom =
                GetTileContainingLatLonZoom(new LatLonZoom(unclippedMapWindow.GetSE(), center.zoom));

            tileDisplayDescriptorArray.tileCountX =
                tileContainingLatLonZoom.TileX - tileDisplayDescriptorArray.topLeftTile.TileX + 1;
            tileDisplayDescriptorArray.tileCountY =
                -(tileContainingLatLonZoom.TileY - tileDisplayDescriptorArray.topLeftTile.TileY) + 1;
            Point64 point = new Point64(degreesToPixels(unclippedMapWindow.GetNW().lon, center.zoom),
                                        degreesToPixels(unclippedMapWindow.GetNW().lat, center.zoom));

            tileDisplayDescriptorArray.topLeftTileOffset = new Point(
                (int)(tileDisplayDescriptorArray.topLeftTile.TileX * 512 - point.X),
                (int)(point.Y - (tileDisplayDescriptorArray.topLeftTile.TileY + 1) * 512));
            tileDisplayDescriptorArray.layout   = addressLayout;
            tileDisplayDescriptorArray.tileSize = GetTileSize();
            return(tileDisplayDescriptorArray);
        }
Esempio n. 5
0
        internal override void doTransformImage(GDIBigLockedImage sourceImage, MapRectangle sourceBounds,
                                                GDIBigLockedImage destImage, MapRectangle destBounds)
        {
            MapRectangle inr =
                new MapRectangle(-0.5, -0.5, destImage.Height - 0.5, destImage.Width - 0.5);
            MapRectangle outr = MapRectangle.MapRectangleIgnoreOrder(
                MercatorCoordinateSystem.LatLonToMercator(destBounds.GetNW()),
                MercatorCoordinateSystem.LatLonToMercator(destBounds.GetSE()));
            JamaMatrix   matrix = FindAffineMatrix(inr, outr);
            MapRectangle outr2  = new MapRectangle(-0.5,
                                                   -0.5,
                                                   sourceImage.Height - 0.5,
                                                   sourceImage.Width - 0.5);
            JamaMatrix matrix2 = FindAffineMatrix(sourceBounds, outr2);

            FastImageWarper.doWarp(destImage,
                                   sourceImage,
                                   new[]
            {
                new Affine2DPointTransformer(matrix), destMercatorToSourceTransformer,
                new Affine2DPointTransformer(matrix2)
            },
                                   interpolationMode);
        }
		public RenderBounds MakeRenderBounds(MapRectangle imageBounds)
		{
			RenderBounds renderBounds = new RenderBounds();
			renderBounds.MinZoom = this.ZoomRange.min;
			renderBounds.MaxZoom = this.ZoomRange.max;
			renderBounds.TileSize = this.GetTileSize();
			renderBounds.imageBounds = imageBounds;
			renderBounds.tileRectangle = new TileRectangle[renderBounds.MaxZoom + 1];
			for (int i = renderBounds.MinZoom; i <= renderBounds.MaxZoom; i++)
			{
				renderBounds.tileRectangle[i] = new TileRectangle();
				renderBounds.tileRectangle[i].zoom = i;
				LatLonZoom llz = new LatLonZoom(imageBounds.GetNW().lat, imageBounds.GetNW().lon, i);
				renderBounds.tileRectangle[i].TopLeft = this.GetTileContainingLatLonZoom(llz);
				llz = new LatLonZoom(imageBounds.GetSE().lat, imageBounds.GetSE().lon, i);
				renderBounds.tileRectangle[i].BottomRight = this.GetTileContainingLatLonZoom(llz);
				renderBounds.tileRectangle[i].StrideX = 1;
				renderBounds.tileRectangle[i].StrideY = 1;
			}
			return renderBounds;
		}