Beispiel #1
0
        public void CalculateDistance(double latFrom, double longFrom, double latTo, double longTo, double expectedMeters)
        {
            Wgs84Location from   = new Wgs84Location(latFrom, longFrom);
            double        meters = from.DistanceTo(new Wgs84Location(latTo, longTo));

            Assert.AreEqual(expectedMeters, meters, 0.1);
        }
Beispiel #2
0
        public void CanRoundtrip(int x, int y)
        {
            SwissGridLocation expected = new SwissGridLocation(x, y);
            Wgs84Location     location = SwissGridHelper.ToWgs84(expected);
            SwissGridLocation actual   = location.ToSwissGrid();

            Assert.AreEqual(expected.X, actual.X);
            Assert.AreEqual(expected.Y, actual.Y);
        }
Beispiel #3
0
        private void UpdateMovingTarget(object sender, object e)
        {
            double lon = MovingTarget.Longitude + 0.01;

            if (lon > 180)
            {
                lon = -180;
            }
            MovingTarget = new Wgs84Location(MovingTarget.Latitude, lon);
        }
        private EditLogViewModel(BatNodeLog batLog)
        {
            BatLog = batLog;

            SaveCommand       = new RelayCommand(async() => await SaveAction());
            CancelCommand     = new RelayCommand(GoBack);
            UpdateDataCommand = new RelayCommand(async() => await RebuildData());

            StartDate = new DateTimeOffset(BatLog.LogStart.Date);
            StartTime = batLog.LogStart.TimeOfDay;

            CallDetailsPivotModel = new CallDetailsPivotModel(this);
            Location = new Wgs84Location(BatLog.Longitude, BatLog.Latitude);
        }
Beispiel #5
0
        public void CanConvertToLocation(int x, int y, double latitude, double longitude)
        {
            SwissGridLocation sg       = new SwissGridLocation(x, y);
            Wgs84Location     location = SwissGridHelper.ToWgs84(sg);

            if (Math.Abs(latitude - location.Latitude) > 0.0000001)
            {
                Assert.Fail("Expected Value {0} for Latitude is not Eual to actual Value {1}. (Diff: {2})", latitude, location.Latitude, Math.Abs(latitude - location.Latitude));
            }
            if (Math.Abs(longitude - location.Longitude) > 0.0000001)
            {
                Assert.Fail("Expected Value {0} for Longitude is not Eual to actual Value {1}. (Diff: {2})", longitude, location.Longitude, Math.Abs(longitude - location.Longitude));
            }
        }
        public static SwissGridLocation ToSwissGrid(this Wgs84Location wgs84)
        {
            Reframe reframe = new Reframe();

            double height    = 555;
            double longitude = wgs84.Longitude;
            double latitude  = wgs84.Latitude;

            try
            {
                reframe.ComputeGpsref(ref longitude, ref latitude, ref height, Reframe.ProjectionChange.ETRF93GeographicToLV95);
                bool outsideSwitzerland = reframe.ComputeReframe(ref longitude, ref latitude, ref height, Reframe.PlanimetricFrame.LV95, Reframe.PlanimetricFrame.LV03_Military, Reframe.AltimetricFrame.Ellipsoid, Reframe.AltimetricFrame.LN02);
                return(new SwissGridLocation((int)Math.Round(longitude), (int)Math.Round(latitude)));
            }
            catch (Exception ex)
            {
                return(new SwissGridLocation());
            }
        }
Beispiel #7
0
        public Map()
        {
            _viewPortProjection = new Wgs84WebMercatorProjection();
            ViewPortTransform   = new MatrixTransform();

            ScaleTransform       = new MatrixTransform();
            RotateTransform      = new MatrixTransform();
            TranslationTransform = new MatrixTransform();
            ScaleRotateTransform = new MatrixTransform();

            MinZoomLevel = 0;
            MaxZoomLevel = 25;

            ZoomLevel    = 1;
            SizeChanged += Map_SizeChanged;

            Background       = new SolidColorBrush(Colors.Transparent);
            ManipulationMode = ManipulationModes.Rotate | ManipulationModes.Scale | ManipulationModes.TranslateX | ManipulationModes.TranslateY;

            MapCenter = new Wgs84Location(0, 0);
        }
Beispiel #8
0
        public DemoModel()
        {
            Cities = new Collection <CityMarker>();
            Cities.Add(new CityMarker {
                Location = new Wgs84Location(48.8567, 2.3508), Label = "Paris"
            });
            Cities.Add(new CityMarker {
                Location = new Wgs84Location(47.4000, 8.0500), Label = "Aarau"
            });
            Cities.Add(new CityMarker {
                Location = new Wgs84Location(41.9000, 12.5000), Label = "Rome"
            });
            Cities.Add(new CityMarker {
                Location = new Wgs84Location(52.5167, 13.3833), Label = "Berlin"
            });

            Peaks = new Collection <PeakMarker>();
            Peaks.Add(new PeakMarker {
                PeakLocation = new Wgs84Location(42.6322, 0.6578), PeakName = "Aneto"
            });
            Peaks.Add(new PeakMarker {
                PeakLocation = new Wgs84Location(46.4870, 9.5617), PeakName = "Piz Platta"
            });
            Peaks.Add(new PeakMarker {
                PeakLocation = new Wgs84Location(40.8167, 14.4333), PeakName = "Monte Vesuvio"
            });
            Peaks.Add(new PeakMarker {
                PeakLocation = new Wgs84Location(37.05, -3.3167), PeakName = "Pico de Mulhacén"
            });

            MovingTarget = new Wgs84Location(47, 15);

            _timer          = new DispatcherTimer();
            _timer.Interval = TimeSpan.FromSeconds(0.01);
            _timer.Tick    += UpdateMovingTarget;
            _timer.Start();
        }