Exemplo n.º 1
0
 public override void OnMouseDoubleClick(MapMouseEventArgs e)
 {
     if (this.bCanZoom && (this.ZoomLevel < this.MapZoomRange.To))
     {
         base.OnMouseDoubleClick(e);
         if (this.ZoomLevel < this.MapZoomRange.To)
         {
             this.bCanZoomIn = true;
         }
         else
         {
             this.bCanZoomIn = false;
         }
         if (this.ZoomLevel > this.MapZoomRange.From)
         {
             this.bCanZoomOut = true;
         }
         else
         {
             this.bCanZoomOut = false;
         }
         if (this.airDataContext != null)
         {
             this.airDataContext.bCanZoomIn = this.bCanZoomIn;
             this.airDataContext.bCanZoomOut = this.bCanZoomOut;
         }
     }
     else
     {
         e.Handled = true;
     }
 }
Exemplo n.º 2
0
		private void OnMouseClick(object sender, MapMouseEventArgs e)
		{
			Point clickLocation = e.ViewportPoint;
			Microsoft.Maps.MapControl.Location location = m_Map.ViewportPointToLocation(clickLocation);

#if NOTUSED //j
			AddPushpin(location.Latitude, location.Longitude);
#endif

#if NOTUSED //j
	       // move map to last location 
			m_Map.View = new MapViewSpecification(location, 3);
#endif
		}
Exemplo n.º 3
0
 public void onClick(MainPage mainPage, object sender, MapMouseEventArgs e)
 {
     Location location = new Location();
     if (mainPage.mainMap.TryViewportPointToLocation(e.ViewportPoint, out location))
     {
         /* Success */
         this.locationCollection.Add(location);
         Debug.WriteLine("Point (" + location.Longitude + "," + location.Latitude + ")");
     }
     else
     {
         /* Fails */
         Debug.WriteLine("Something wrong has happened in converting viewport to location.");
     }
 }
Exemplo n.º 4
0
    void TheMap_MouseDoubleClick(object sender, MapMouseEventArgs e)
    {
      Pushpin p = new Pushpin();
      Location loc;
      if (TheMap.TryViewportPointToLocation(e.ViewportPoint, out loc))
      {
        
      }
      p.Location = loc;
      var ts = new HydroNumerics.Time.Web.TimeSeriesService.GeoXYPointTime();

      var val = new HydroNumerics.Time.Web.TimeSeriesService.TimestampValue();
      val.Time = DateTime.Now;
      val.Value = 0;
      ts.items = new System.Collections.ObjectModel.ObservableCollection<HydroNumerics.Time.Web.TimeSeriesService.TimestampValue>();
      ts.items.Add(val);

      p.Tag = ts;

      TheMap.Children.Add(p);
      TheMap.MouseDoubleClick -= TheMap_MouseDoubleClick;
      p_MouseLeftButtonUp(p, null);
    }
Exemplo n.º 5
0
 public void onClick(MainPage mainPage, object sender, MapMouseEventArgs e)
 {
     this.mainPage = mainPage;
     this.mouseEvent = e;
     window.Show(); 
 }
Exemplo n.º 6
0
		private void OnMouseClick(object sender, MapMouseEventArgs e)
		{
			Point clickLocation = e.ViewportPoint;
			Location location = m_Map.ViewportPointToLocation(clickLocation);
#if NOTUSED //j
			AddPushpin(location.Latitude, location.Longitude);
#endif
		}
Exemplo n.º 7
0
        private void ctlMap_MouseClick(object sender, MapMouseEventArgs e)
        {
            if (isbegin==true)
            {
                BaseGeometry bg = GetItemByID("routing", "begin");

                if (bg != null)
                {
                    LayerReset();
                }

                    var data = new ObservableCollection<VectorLayerData>();
                    var point = new Point(ctlMap.ViewportPointToLocation(e.ViewportPoint).Longitude, ctlMap.ViewportPointToLocation(e.ViewportPoint).Latitude);
                    data.Add(new VectorLayerData
                    {
                        Geo = point.AsBinary(),
                        ID = "begin",
                        Label = "起点",

                    });

                    layer.Add(data);

                isbegin = false;
            }

            if (islast==true)
            {
                 var data = new ObservableCollection<VectorLayerData>();
                var point = new Point(ctlMap.ViewportPointToLocation(e.ViewportPoint).Longitude, ctlMap.ViewportPointToLocation(e.ViewportPoint).Latitude);
                data.Add(new VectorLayerData
                {
                    Geo = point.AsBinary(),
                    ID = "last",
                    Label = "终点",

                });

                layer.Add(data);

                DraggablePushpin dp = GetDCarByMSID("drapcar", carml);
                if (dp != null)
                {
                    GetBegionRoad(dp.Location.Latitude, dp.Location.Longitude, 100);
                }
                Dtimer.Begin();
                Ltimer.Begin();
                islast = false;
            }

            if (isbarrier==true)
            {
                 //初始化一个图标

                var data = new ObservableCollection<VectorLayerData>();
                var point = new Point(ctlMap.ViewportPointToLocation(e.ViewportPoint).Longitude, ctlMap.ViewportPointToLocation(e.ViewportPoint).Latitude);
                GetBarrier(point.X, point.Y, 30);
                data.Add(new VectorLayerData
                {
                    Geo = point.AsBinary(),
                    ID = "barrier",
                    Label = "障碍"+bn.ToString(),
                  });

                layer.Add(data);

                isbarrier = false;
                bn++;

            }
        }
        void MyMap_MouseClick(object sender, MapMouseEventArgs e)
        {
            //If the map is accepting polygon points, create a point.
            if (inCreatePolygonMode)
            {
                // Creates a location for a single polygon point and adds it to
                // the polygon's point location list.
                Bing.Maps.Location polygonPointLocation = MyMap.ViewportPointToLocation(
                    e.ViewportPoint);
                newPolygon.Locations.Add(polygonPointLocation);

                // A visual representation of a polygon point.
                Windows.UI.Xaml.Shapes.Rectangle r = new Windows.UI.Xaml.Shapes.Rectangle();
                r.Fill = new SolidColorBrush(Colors.Red);
                r.Stroke = new SolidColorBrush(Colors.Yellow);
                r.StrokeThickness = 1;
                r.Width = 8;
                r.Height = 8;

                // Adds a small square where the user clicked, to mark the polygon point.
                polygonPointLayer.AddChild(r, polygonPointLocation);
            }
        }
Exemplo n.º 9
0
 private void mainMap_MouseClick(object sender, MapMouseEventArgs e)
 {
     this.currentMapMode.onClick(this, sender, e);
 }
Exemplo n.º 10
0
 /// <summary>
 /// Double click finishes buffer polyline draw
 /// </summary>
 private void DrawPolyline_MouseDoubleClick(object sender, MapMouseEventArgs e)
 {
         if (!startdraw)
         {
             draw = false;
             e.Handled = true;
             Location loc = _map.ViewportPointToLocation(e.ViewportPoint);
             drawbuffer.Locations[drawbuffer.Locations.Count - 1] = loc;
             drawline.Locations[drawline.Locations.Count - 1] = loc;
             startdraw = true;
             //initiate a map ViewChange event
             _map.SetView(_map.Center, _map.ZoomLevel);
         }
 }
Exemplo n.º 11
0
 private void MaskPan(object sender, MapMouseEventArgs e)
 {
     //mask map pan events
     e.Handled = true;
 }
Exemplo n.º 12
0
        protected internal override bool MouseDownCore(MapMouseEventArgs e)
        {
            IsAddingTarget = false;
            if (e.Village != null)
            {
                AttackPlan       existingPlan    = GetExistingPlan(e.Village, true);
                AttackPlanFrom[] existingAttacks = GetAttackers(e.Village).ToArray();

                if (e.MouseEventArgs.Button == MouseButtons.Left)
                {
                    if (existingPlan == null)
                    {
                        if (!existingAttacks.Any())
                        {
                            _map.EventPublisher.AttackAddTarget(this, e.Village);
                        }
                        else
                        {
                            if (!existingAttacks.Contains(ActiveAttacker))
                            {
                                _map.EventPublisher.AttackSelect(this, existingAttacks.First());
                            }
                            else
                            {
                                // Already selected village is perhaps used in multiple plans
                                if (existingAttacks.Length == 1)
                                {
                                    return(false);
                                }
                                else
                                {
                                    // Cycle through the attackers
                                    AttackPlanFrom selectAttacker;
                                    if (ActiveAttacker == null || !existingAttacks.Contains(ActiveAttacker) || existingAttacks.Last() == ActiveAttacker)
                                    {
                                        selectAttacker = existingAttacks.First();
                                    }
                                    else
                                    {
                                        selectAttacker = existingAttacks.SkipWhile(x => x != ActiveAttacker).Take(2).Last();
                                    }
                                    _map.EventPublisher.AttackSelect(this, selectAttacker);
                                }
                            }
                        }
                    }
                    else
                    {
                        if (existingPlan == ActivePlan && ActivePlan != null)
                        {
                            var existingAttack = existingAttacks.FirstOrDefault();
                            if (existingAttack != ActiveAttacker)
                            {
                                if (existingAttack == null)
                                {
                                    _map.EventPublisher.AttackSelect(this, ActivePlan);
                                }
                                else
                                {
                                    _map.EventPublisher.AttackSelect(this, existingAttack);
                                }
                            }
                            else
                            {
                                return(false);
                            }
                        }
                        else
                        {
                            _map.EventPublisher.AttackSelect(this, existingPlan);
                        }
                    }
                    return(true);
                }
                else if (e.MouseEventArgs.Button == MouseButtons.Right)
                {
                    if (e.Village.Player == World.Default.You && ActivePlan != null)
                    {
                        if (e.Village == ActivePlan.Target)
                        {
                            // Can't add attacker to target
                            return(false);
                        }
                        else
                        {
                            if (existingAttacks.Any())
                            {
                                // Show contextmenu instead
                                return(false);
                            }
                            else
                            {
                                // Add new attacker
                                var attackEventArgs = AttackUpdateEventArgs.AddAttackFrom(new AttackPlanFrom(ActivePlan, e.Village, WorldUnits.Default[World.Default.Map.Manipulators.AttackManipulator.DefaultSpeed]));
                                _map.EventPublisher.AttackUpdateTarget(this, attackEventArgs);
                                IsAddingTarget = true;
                                return(true);
                            }
                        }
                    }
                }
            }
            return(false);
        }
Exemplo n.º 13
0
        /// <summary>
        /// Double click finishes buffer polyline draw
        /// </summary>
        private void DrawPolyline_MouseDoubleClick(object sender, MapMouseEventArgs e)
        {
            if (!startdraw)
                {
                    draw = false;
                    e.Handled = true;
                    Location loc = _map.ViewportPointToLocation(e.ViewportPoint);
                    drawbuffer.Locations[drawbuffer.Locations.Count - 1] = loc;
                    drawline.Locations[drawline.Locations.Count - 1] = loc;
                    startdraw = true;

                }
        }
 /// <summary>
 /// If we leave the map, make sure we reset any button down events
 /// </summary>
 protected override void OnMouseLeave(MapViewModel map, MapMouseEventArgs args)
 {
     _mapButtonDownArgs = null;
     base.OnMouseLeave(map, args);
 }
        /// <summary>
        /// Override for the leftButtonDown event on the Map
        /// </summary>
        protected override void OnMouseLeftButtonDown(MapViewModel map, MapMouseEventArgs args)
        {
            _mapButtonDownArgs = args;

            base.OnMouseLeftButtonDown(map, args);
        }
Exemplo n.º 16
0
 /// <summary>
 /// On mouse rmc handler
 /// </summary>
 protected override void OnMouseRightButtonDown(MapViewModel sender, MapMouseEventArgs args)
 {
     Owner.OpenPopupMenu(args);
 }