Пример #1
0
        private Area createMapViewAreaForCenterImg(MapView mapView)
        {
            Point centerImgLocation = mapView.getCenterImgPosition();
            GpsLocation gpsLoc = mapView.getGpsLocation();

            int pixelsToLeftEdge = centerImgLocation.X;
            int pixelsToTopEdge = centerImgLocation.Y;
            Image centerPart = mapView.getImgByPoint(new Point(1, 1));
            int pixelsToRightEdge = centerPart.Width - centerImgLocation.X;
            int pixelsToBottomEdge = centerPart.Height - centerImgLocation.Y;

            double latitudePerPixel = this.currentMapPkg.getLatitudePerPixel();
            double longitudePerPixel = this.currentMapPkg.getLongitudePerPixel();

            double topLeftLatitude = gpsLoc.getLatitude() + pixelsToTopEdge * latitudePerPixel;
            double topLeftLongitude = gpsLoc.getLongitude() - pixelsToLeftEdge * longitudePerPixel;
            double bottomRightLatitude = gpsLoc.getLatitude() - pixelsToBottomEdge * latitudePerPixel;
            double bottomRightLongitude = gpsLoc.getLongitude() + pixelsToRightEdge * longitudePerPixel;

            return new Area(topLeftLatitude, topLeftLongitude, bottomRightLatitude, bottomRightLongitude);
        }