Esempio n. 1
0
        public void Apply()
        {
            var vertices     = PolygonVertices.Select(v => WgsUtmConverter.LatLonToUTMXY(v.Location, 0)).ToList();
            var needToRemove = _waypointsService.Waypoints.Where(wpt => !WgsUtmConverter.LatLonToUTMXY(wpt.Location, 0).IsInsidePolygon(vertices)).ToList();

            foreach (var wpt in needToRemove)
            {
                _waypointsService.Waypoints.Remove(wpt);
            }
        }
Esempio n. 2
0
        public void SetupWithGridFrame(GridFrame frame)
        {
            Corner        = new Waypoint("", frame.Corner);
            GridWidth     = frame.GetGridWidthMeters();
            ProfileLength = frame.GetProfileLengthMeters();

            var c  = WgsUtmConverter.LatLonToUTMXY(frame.Corner, 0);
            var a1 = WgsUtmConverter.LatLonToUTMXY(frame.P1, 0);
            var a2 = WgsUtmConverter.LatLonToUTMXY(frame.P2, 0);

            GridAngleDeg    = CalculateAngleDeg(c, a1);
            ProfileAngleDeg = CalculateAngleDeg(c, a2);
        }
Esempio n. 3
0
        public List <Waypoint> ApplyTo(Waypoint waypoint)
        {
            var layout = new List <Waypoint>();

            var xyBase = WgsUtmConverter.LatLonToUTMXY(waypoint.Location, 0);

            foreach (var element in Elements)
            {
                var xy       = xyBase.Shift(element.Offset);
                var location = WgsUtmConverter.UTMXYToLatLon(xy, waypoint.Location.Latitude < 0);
                layout.Add(new Waypoint($"{waypoint.Name}-{element.Name}", location));
            }

            return(layout);
        }
        private bool TrySetLocationFromMeters()
        {
            if (!int.TryParse(X, out int x) || !int.TryParse(Y, out int y) || !int.TryParse(Zone, out int zone))
            {
                return(false);
            }

            if (zone < 1 || zone > 60)
            {
                return(false);
            }

            Location = WgsUtmConverter.UTMXYToLatLon(new GeoLocationXY(zone, x, y, 0), Location.Latitude < 0);

            return(true);
        }
        private void SetMetersRepresentation()
        {
            var utm = WgsUtmConverter.LatLonToUTMXY(Location, 0);

            SetXYRepresentation(utm.X.ToString("F0"), utm.Y.ToString("F0"), utm.Zone.ToString());
        }