Beispiel #1
0
        internal Matrix CreateTileLayerTransform(double tileGridScale, Point tileGridTopLeft, Point tileGridOrigin)
        {
            var scale  = ViewportScale / tileGridScale;
            var matrix = new Matrix(scale, 0d, 0d, scale, 0d, 0d);

            matrix.Rotate(ViewportRotation);

            // tile grid origin in map cordinates
            //
            var mapOrigin = new Point(
                tileGridTopLeft.X + tileGridOrigin.X / tileGridScale,
                tileGridTopLeft.Y - tileGridOrigin.Y / tileGridScale);

            // tile grid origin in viewport cordinates
            //
            var viewOrigin = ViewportTransform.Transform(mapOrigin);

            matrix.Translate(viewOrigin.X, viewOrigin.Y);

            return(matrix);
        }
Beispiel #2
0
 /// <summary>
 /// Transforms a Location in geographic coordinates to a Point in viewport coordinates.
 /// </summary>
 public Point LocationToViewportPoint(Location location)
 {
     return(ViewportTransform.Transform(LocationToPoint(location)));
 }