Esempio n. 1
0
        public PointD GetPixelPoint(GeoPoint geoPoint)
        {
            // get a bearing to the point from our known point
            double geoBearing  = EarthGeo.GetBearing(this.GeoPoint, geoPoint);
            double geoDistance = EarthGeo.GetDistance(this.GeoPoint, geoPoint);

            double pixBearing  = FlatGeo.Radians(((geoBearing + 360) - this.BearingDelta) % 360);
            double pixDistance = geoDistance * this.PixelsPerMeter;

            PointD ret = new PointD(this.PixPoint.X + (Math.Sin(pixBearing) * pixDistance), this.PixPoint.Y - (Math.Cos(pixBearing) * pixDistance));

            return(ret);
        }
Esempio n. 2
0
        void Initialize(PointDList pixPointList, GeoPointList geoPointList)
        {
            // Get and store the difference in pixel orientation to north (Rotation from north)
            double geoBearing = EarthGeo.GetBearing(geoPointList[0], geoPointList[1]);
            double pixBearing = GetPixelBearing(pixPointList[0], pixPointList[1]);

            this.BearingDelta = geoBearing - pixBearing;


            // Get and store the pixel to meter ratio (Scale to meters)
            double geoDistance = EarthGeo.GetDistance(geoPointList[0], geoPointList[1]);
            double pixDistance = new Line(pixPointList[0], pixPointList[1]).Length;

            _pixelsPerMeter = pixDistance / geoDistance;

            // Store a pixel cross reference point, from which all other conversions can happen
            this.PixPoint = new PointD(pixPointList[0].X, pixPointList[0].Y);
            this.GeoPoint = new GeoPoint(geoPointList[0].Y, geoPointList[0].X);
        }