ArcStrabo10.ArcStraboObject.GetXY C# (CSharp) Метод

GetXY() публичный Метод

/////////////Converting pixels to Lat/Long
public GetXY ( double lat, double lng, double &pixelX, double &pixelY ) : void
lat double
lng double
pixelX double
pixelY double
Результат void
        public void GetXY(double lat, double lng, out double pixelX, out double pixelY)
        {
            int MAP_HEIGHT = _rasterInfo.rasterHeight;
            int MAP_WIDTH = _rasterInfo.rasterWidth;

            //extents of bounding box
            double e = _rasterInfo.rasterDownRightX; //eastern boundary latitude
            double w = _rasterInfo.rasterTopLeftX;//western boundary latitude
            double n = _rasterInfo.rasterTopLeftY;//north boundary longitude
            double s = _rasterInfo.rasterDownRightY;//south boundary longitude

            //int MAP_HEIGHT = 2615; // 5952;
            //int MAP_WIDTH = 5103;// 8568;

            ////extents of bounding box
            //double e = 44.4491887;// 44.5273990; //eastern boundary latitude
            //double w = 44.385351;//44.273999; //western boundary latitude
            //double n = 33.335706;// 33.404047; //north boundary longitude
            //double s = 33.303235;//33.251287; //south boundary longitude

            //calculate extents based on differences, convert to positive values
            double nsspan = Math.Abs(n - s);
            double ewspan = Math.Abs(w - e);

            double nspix = MAP_HEIGHT / nsspan; //gives you how many pixels in a lng point
            double ewpix = MAP_WIDTH / ewspan; //gives you how many pixels in a lat point

            pixelX = (Math.Abs(w - lat)) * ewpix; //the difference between the western (left) edge of the box and the point in question, multiplied by pixels per point
            pixelY = (Math.Abs(n - lng)) * nspix; //the difference between the northern (top) edge of the box and the point in question, multiplied by pixels per point
        }