Beispiel #1
0
        static void Main()
        {
            // Sample point
            // Lat: 52.237049; Lng: 21.017532
            // Compared with:
            // https://www.latlong.net/place/warsaw-poland-2003.html
            // Expected output:
            // Easting: 501197.21
            // Northing: 5787404.16

            var coords = new LatLngCoords(52.237049, 21.017532);

            // Convert from LatLng to UTM
            var utm = CoordsConverter.ToUTM(coords);

            Console.WriteLine("LatLng to UTM");
            Console.WriteLine($"Easting: {utm.Easting} (501197.21)");
            Console.WriteLine($"Northing: {utm.Northing} (5787404.16)");
            Console.WriteLine($"Zone: {utm.ZoneNumber}{utm.ZoneLetter}\n");

            // Convert from UTM to LatLng
            var latLng = CoordsConverter.ToLatLng(utm);

            Console.WriteLine("UTM to LatLng");
            Console.WriteLine($"Latitude: {latLng.Latitude} (52.237049)");
            Console.WriteLine($"Longitude: {latLng.Longitude} (21.017532)");

            Console.Read();
        }
Beispiel #2
0
        /// <summary> Устанавливает привязки </summary>
        private void InitBindings()
        {
            var radiusToWidthHeightConverter = new RadiusToWidthHeightConverter();
            var radiusPath = new PropertyPath("Radius");

            SetBinding(WidthProperty, new Binding
            {
                Path      = radiusPath,
                Source    = this,
                Mode      = BindingMode.TwoWay,
                Converter = radiusToWidthHeightConverter
            });
            SetBinding(HeightProperty, new Binding
            {
                Path      = radiusPath,
                Source    = this,
                Mode      = BindingMode.TwoWay,
                Converter = radiusToWidthHeightConverter
            });

            var coordsConverter = new CoordsConverter(() => Radius);

            SetBinding(Canvas.LeftProperty, new Binding
            {
                Path      = new PropertyPath("X"),
                Source    = this,
                Mode      = BindingMode.TwoWay,
                Converter = coordsConverter,
            });
            SetBinding(Canvas.TopProperty, new Binding
            {
                Path      = new PropertyPath("Y"),
                Source    = this,
                Mode      = BindingMode.TwoWay,
                Converter = coordsConverter,
            });

            var modelCoordsConverter = new ModelCoordsConverter(() => ScaleFactor);

            SetBinding(XProperty, new Binding
            {
                Path      = new PropertyPath("ModelX"),
                Source    = this,
                Mode      = BindingMode.TwoWay,
                Converter = modelCoordsConverter,
            });
            SetBinding(YProperty, new Binding
            {
                Path      = new PropertyPath("ModelY"),
                Source    = this,
                Mode      = BindingMode.TwoWay,
                Converter = modelCoordsConverter,
            });
        }