Пример #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);
        }
Пример #2
0
        private Area createMapViewArea(MapView mapView)
        {
            Area afci = createMapViewAreaForCenterImg(mapView);

            Image topLeftPart = mapView.getImgByPoint(new Point(0, 0));
            double latitudeTopEdgeFix = topLeftPart.Size.Height * this.currentMapPkg.getLatitudePerPixel();
            double longitudeLeftEdgeFix = topLeftPart.Size.Width * this.currentMapPkg.getLongitudePerPixel();

            Image bottomRightPart = mapView.getImgByPoint(new Point(2, 2));
            double latitudeBottomEdgeFix = bottomRightPart.Height * this.currentMapPkg.getLatitudePerPixel();
            double longitudeRghtEdgeFix = bottomRightPart.Width * this.currentMapPkg.getLongitudePerPixel();

            return new Area(afci.getTopLeftLatitude() + latitudeTopEdgeFix,
                            afci.getTopLeftLongitude() - longitudeLeftEdgeFix,
                            afci.getBottomRightLatitude() - latitudeBottomEdgeFix,
                            afci.getBottomRightLongitude() + longitudeRghtEdgeFix);
        }