Наследование: AGeometry
Пример #1
0
        void RainRadarUpdate_Tick(object sender, EventArgs e)
        {

            WebMercator w = new WebMercator();
            //WebClient wc = new WebClient();
            var topleft = new KmlPoint(-14.9515, 59.9934);
            var bottomright = new KmlPoint(20.4106, 41.4389);
            var fname = "http://www2.buienradar.nl/euradar/latlon_0.gif";//"rainradar.gif";
//            File.Delete(fname);
//            wc.DownloadFile("http://www2.buienradar.nl/euradar/latlon_0.gif", fname);

//            var gwrap = new GdalWrapper();
//            var f = gwrap.WarpImage(fname, topleft.Latitude, topleft.Longitude, bottomright.Latitude, bottomright.Longitude, 4326, 3857, 5000);
//            fname = Directory.GetCurrentDirectory() + "\\" + f;
            //var f = WarpImage(fname, topleft, bottomright, 4326, 3857, 5000);
            var i = new Image
            {
                //Source = new BitmapImage(new Uri("file://" + fname)),
                Source = new BitmapImage(new Uri(fname)),
                IsHitTestVisible = false,
                Stretch = Stretch.Fill
            };

            //<LatLonBox><north>59.9934</north><south>41.4389</south><east>20.4106</east><west>-14.9515</west></LatLonBox>
            var mpa = new MapPoint(topleft.Longitude, topleft.Latitude);
            var mpb = new MapPoint(bottomright.Longitude, bottomright.Latitude);
            mpa = w.FromGeographic(mpa) as MapPoint;
            mpb = w.FromGeographic(mpb) as MapPoint;
            var envelope = new Envelope(mpa, mpb);
            ElementLayer.SetEnvelope(i, envelope);
            this.Children.Clear();
            this.Children.Add(i);

            if (Notifications)
            {
                AppStateSettings.Instance.TriggerNotification(new NotificationEventArgs()
                {
                    Duration = new TimeSpan(0, 0, 0, 3),
                    Text = "Updated Rain Radar Image at"+ ":" + DateTime.Now
                });

            }
        }
Пример #2
0
 public Point MapPoint(KmlPoint p)
 {
   Point world = SphericalMercator.FromLonLat(p.Longitude, p.Latitude);
   return WorldToMap(world.X, world.Y);
 }
Пример #3
0
 public bool Contains(KmlPoint p)
 {
   return Extent.Contains(SphericalMercator.FromKmlPoint(p));
 }
Пример #4
0
        public void OpenPoiPopup(BaseContent poI)
        {
            if (poI.Data.ContainsKey("FloatingElement") && AppState.FloatingItems.Contains((FloatingElement)poI.Data["FloatingElement"]))
                return;
            var pp = new PoiPopupViewModel { PoI = poI, Layer = this, Service = poI.Service as PoiService };
            var s = new Size(300, 500);
            var kmlpoint = new KmlPoint(poI.Position.Longitude, poI.Position.Latitude);
            var p = AppState.ViewDef.MapPoint(kmlpoint);

            if (p.X <= AppState.MainBorder.ActualWidth / 2)
                p.X += s.Width / 2 + 25;
            else
                p.X -= s.Width / 2 + 25;

            var fe = FloatingHelpers.CreateFloatingElement(poI.Name, p, s, pp);
            fe.AssociatedPoint = kmlpoint;
            poI.Data["FloatingElement"] = fe;

            AppState.FloatingItems.AddFloatingElement(fe);
        }
Пример #5
0
 public static double Distance(KmlPoint point1, KmlPoint point2)
 {
   return Distance(point1.Latitude, point1.Longitude, point2.Latitude, point2.Longitude, 'K');
 }
Пример #6
0
 public static Point FromKmlPoint(KmlPoint p)
 {
   return FromLonLat(p.Longitude, p.Latitude);
 }