Exemplo n.º 1
0
 private void MouseMove(Map map, MouseEventArgs args)
 {
     if (isMouseDown)
     {
         isMouseDrag = true;
     }
 }
Exemplo n.º 2
0
 void Events_MapLoaded(Map map, DeepEarth.Events.MapEventArgs args)
 {
     _SourceControl = (MapSourceControl)map.Navigation.Toolbar;
     List<MapSourceControl.TileSourceIds> srcList = new List<MapSourceControl.TileSourceIds>();
     srcList.Add(MapSourceControl.TileSourceIds.Osmarend);
     srcList.Add(MapSourceControl.TileSourceIds.Mapnik);
     _SourceControl.TileSources = srcList;
 }
Exemplo n.º 3
0
 void MapLoaded(Map map, DeepEarth.Events.MapEventArgs args)
 {
     _SourceControl = (MapSourceControl)map.Navigation.Toolbar;
     List<MapSourceControl.TileSourceIds> srcList = new List<MapSourceControl.TileSourceIds>();
     srcList.Add(MapSourceControl.TileSourceIds.BlueMarbleLocal);
     srcList.Add(MapSourceControl.TileSourceIds.BlueMarbleWeb);
     _SourceControl.TileSources = srcList;
 }
Exemplo n.º 4
0
 private void MouseDown(Map map, MouseButtonEventArgs args)
 {
     if (Keyboard.Modifiers == ModifierKeys.Shift)
     {
         args.Handled = true;
         isMouseDown = true;
         isMouseDrag = false;
     }
 }
Exemplo n.º 5
0
 public Prototype(Map map)
 {
     _Map = map;
     map.Events.MapMouseUp += this.MouseUp;
     map.Events.MapMouseDown += this.MouseDown;
     map.Events.MapMouseMove += this.MouseMove;
     map.Events.MapKeyDown += Events_MapKeyDown;
     map.Events.MapKeyUp += Events_MapKeyUp;
 }
Exemplo n.º 6
0
 private void MapKeyDown(Map _map, KeyEventArgs args)
 {
     switch (args.Key)
     {
         case Key.A:if (_IsCtrlDown) SetMapSource(VeMapModes.VeAerial);break;
         case Key.R: if (_IsCtrlDown) SetMapSource(VeMapModes.VeRoad); break;
         case Key.H: if (_IsCtrlDown) SetMapSource(VeMapModes.VeHybrid); break;
         case Key.Ctrl:_IsCtrlDown = true;break;
     }
 }
Exemplo n.º 7
0
        void MapLoaded(Map map, DeepEarth.Events.MapEventArgs args)
        {
            _SourceControl = (MapSourceControl)map.Navigation.Toolbar;
            List<MapSourceControl.TileSourceIds> srcList = new List<MapSourceControl.TileSourceIds>();
            srcList.Add(MapSourceControl.TileSourceIds.VeAerial);
            srcList.Add(MapSourceControl.TileSourceIds.VeHybrid);
            srcList.Add(MapSourceControl.TileSourceIds.VeRoad);
            _SourceControl.TileSources = srcList;

            map.BaseLayer.Source = new VeTileSource(VeMapModes.VeHybrid);
            //SetMapSource(VeMapModes.VeHybrid);
        }
Exemplo n.º 8
0
        public MapSourceControl()
        {
            InitializeComponent();

            _Map = Map.DefaultInstance;

            if (_TileSources != null)
            {
                _Toolbar.SelectionChanged += SelectionChanged;
                _Map = MapInstance;
                _Map.Events.MapTileSourceChanged += OnTileSourceChanged;
                InitializeList();
            }
        }
Exemplo n.º 9
0
        public GeoFind()
        {
            InitializeComponent();

            // Test for DesignTime for display in Blend
            if (HtmlPage.IsEnabled)
            {
                _Map = MapInstance;

                GeocodeService = new Geocode();
                Find.Click += Find_Click;
                Clear.Click += Clear_Click;
            }
        }
Exemplo n.º 10
0
 private void MapKeyDown(Map _map, KeyEventArgs args)
 {
     switch (args.Key)
     {
         case Key.M:
             if (_IsCtrlDown) SetMapSource(OsmMapModes.Mapnik);
             break;
         case Key.D:
             if (_IsCtrlDown) SetMapSource(OsmMapModes.Osmarend);
             break;
         case Key.Ctrl:
             _IsCtrlDown = true;
             break;
     }
 }
Exemplo n.º 11
0
 private void Events_MapKeyDown(Map _map, KeyEventArgs args)
 {
     switch (args.Key)
     {
         case Key.M:
             if (_IsCtrlDown) SetMapSource(BmMapModes.BlueMarbleWeb);
             break;
         case Key.D:
             if (_IsCtrlDown) SetMapSource(BmMapModes.BlueMarbleLocal);
             break;
         case Key.Ctrl:
             _IsCtrlDown = true;
             break;
     }
 }
Exemplo n.º 12
0
        private void MouseUp(Map map, MouseButtonEventArgs args)
        {
            if (isMouseDown && !isMouseDrag)
            {
                Point coord = map.CoordHelper.PixelToGeo(args.GetPosition(map));

                if (shapeLayer == null)
                {
                    ///TODO: RoadWarrior, to demo this, create a subclass of ShapeLayer for specialty behavior.
                    //shapeLayer = new ShapeLayer(map)
                    //{
                    //    ID = "PROTOTYPE",
                    //    InfoBoxOffset = new Point(-20, 0),
                    //    InfoBoxContentProvider = (shape, callback) =>
                    //    {
                    //        var pin = (PointBase)shape;
                    //        var point = pin.Point;
                    //        var description = string.Format("Created point at {0:N6}, {1:N6}", point.X, point.Y);
                    //        callback(description);
                    //    }
                    //};
                    shapeLayer = new GeometryLayer(map){ID = "PROTOTYPE"};

                    map.Layers.Add(shapeLayer);

                    //create the info box
                    //infoBox = new InfoBox();
                    //shapeLayer.Shapes.Add(infoBox);
                    //infoBox.HideInfoBox();  // initially hide the infobox
                }

                // create the pushpin if the "A" key is held down;  We don't want this behaviour with normal clicks.

                if (_IsAKeyDown)
                {
                    //var pushpin = new Pushpin(shapeLayer) { Point = coord };
                    var pushpin = new Pushpin() { Point = coord };
                    //pushpin.MouseLeftButtonDown += OnPushpinMouseDown;
                    shapeLayer.Add(pushpin);

                    args.Handled = true;
                }
            }

            isMouseDown = false;
            isMouseDrag = false;
        }
Exemplo n.º 13
0
        public void MouseDown(Map map, MouseButtonEventArgs args)
        {
            if (Keyboard.Modifiers == ModifierKeys.Alt)
            {
                args.Handled = true;

                Point location = map.CoordHelper.PixelToGeo(args.GetPosition(map));
                GeocodeService.Find(location, (o, ev) =>
                                                  {
                                                      List<GeocodeResult> results = ((GeocodeResultArgs) ev).Results;
                                                      if (results.Count > 0)
                                                      {
                                                          MessageBox.Show(results[0].DisplayName);
                                                      }
                                                  });
            }
        }
Exemplo n.º 14
0
        public GeoServices()
        {
            // Required to initialize variables
            InitializeComponent();

            // Test for DesignTime for display in Blend
            if (HtmlPage.IsEnabled)
            {
                _Map = MapInstance;

                GeocodeService = new Geocode();
                RouteService = new Route();

                AddPolygon.Click += AddPolygon_Click;
                Rotate.Click += Rotate_Click;
                ZoomToLocation.Click += ZoomToLocation_Click;
                ToggleDevPins.Click += ToggleDevPins_Click;

                MapInstance.Events.MapLoaded += (o, e) => ConfigureDevPins();
            }
        }
Exemplo n.º 15
0
 private void MapKeyUp(Map _map, KeyEventArgs args)
 {
     if (args.Key == Key.Ctrl) _IsCtrlDown = false;
 }
Exemplo n.º 16
0
 void Events_MapKeyUp(Map map, KeyEventArgs args)
 {
     if (args.Key == Key.A) _IsAKeyDown = false;
 }
Exemplo n.º 17
0
 private void MapKeyDown(Map _map, KeyEventArgs args)
 {
     switch (args.Key)
     {
         case Key.A: if (_IsCtrlDown) mapSourceControl.SelectedSource = MapSourceControl.TileSourceIds.VeAerial; break;
         case Key.R: if (_IsCtrlDown) mapSourceControl.SelectedSource = MapSourceControl.TileSourceIds.VeRoad; break;
         case Key.H:if (_IsCtrlDown) mapSourceControl.SelectedSource = MapSourceControl.TileSourceIds.VeHybrid; break;
         case Key.M:if (_IsCtrlDown) mapSourceControl.SelectedSource = MapSourceControl.TileSourceIds.Mapnik; break;
         case Key.D:if (_IsCtrlDown) mapSourceControl.SelectedSource = MapSourceControl.TileSourceIds.Osmarend; break;
         case Key.O:if (_IsCtrlDown) mapSourceControl.SelectedSource = MapSourceControl.TileSourceIds.OAM; break;
         case Key.W:if (_IsCtrlDown) mapSourceControl.SelectedSource = MapSourceControl.TileSourceIds.CmWeb; break;
         case Key.B:if (_IsCtrlDown) mapSourceControl.SelectedSource = MapSourceControl.TileSourceIds.CmMobile; break;
         case Key.N:if (_IsCtrlDown) mapSourceControl.SelectedSource = MapSourceControl.TileSourceIds.CmNoNames; break;
         case Key.C:if (_IsCtrlDown) mapSourceControl.SelectedSource = MapSourceControl.TileSourceIds.CmCycle; break;
         case Key.Ctrl:_IsCtrlDown = true;
             break;
     }
 }
Exemplo n.º 18
0
 public ReverseGeocode(Map map, Geocode geocodeService)
 {
     GeocodeService = geocodeService;
     _Map = map;
     map.Events.MapMouseDown += this.MouseDown;
 }
Exemplo n.º 19
0
 private void ViewChanged(Map map, MapEventArgs args)
 {
     ///RoadWarrior:  This is so breaking encapsulation.
     //base.ViewChanged(map, args);
     infoBox.Hide(true);
 }
Exemplo n.º 20
0
 public static void AttachToMap(Map map, InfoBox infoBox)
 {
     var behavior = _InfoBoxEventBehavior;
     //var behavior = map.EventBehavior.List[BehaviorName] as InfoBoxEventBehavior;
     if (behavior != null)
     {
         if (!ReferenceEquals(behavior.infoBox, infoBox))
         {
             behavior.infoBox.Hide(true);
         }
         behavior.infoBox = infoBox;
     }
     else
     {
         _InfoBoxEventBehavior = new InfoBoxEventBehavior(map, infoBox);
         //behavior = new InfoBoxEventBehavior(map, infoBox);
         //map.EventBehavior.List.Add(behavior);
     }
 }
Exemplo n.º 21
0
 //: base(BehaviorName)
 public InfoBoxEventBehavior(Map map, InfoBox infoBox)
 {
     _Map = map;
     this.infoBox = infoBox;
 }
Exemplo n.º 22
0
 void Events_MapKeyDown(Map map, KeyEventArgs args)
 {
     if (args.Key == Key.A) _IsAKeyDown = true;
 }
Exemplo n.º 23
0
        /// <summary>
        /// Create an instance of the DeepEarth Map Control
        /// </summary>
        public Map()
        {
            DefaultInstance = this;

            _SpatialReference = new MercatorProjection();
            _TileLayer = new TileLayer(this);
            _MouseControl = new MouseControl(this);
            _Layers = new ObservableCollection<ILayer>();
            _Layers.CollectionChanged += Layers_CollectionChanged;

            DefaultStyleKey = typeof (Map);
            DisplayUnit = Unit.Meter;
            DragMode = DragBehavior.Pan;

            //Wire up the keyboard events.
            TabNavigation = KeyboardNavigationMode.Once;
            IsTabStop = true;
            KeyDown += (o, e) => Events.KeyDown(this, e);
            KeyUp += (o, e) => Events.KeyUp(this, e);

            //Create event handlers for default map behavior
            Events.MapDoubleClick += MapDoubleClick;
            Events.MapZoomEnded += (o, e) => _TargetZoom = 0;
            Events.MapLoaded += (o, e) => UpdateCenterPoint();
            Events.MapTileSourceChanged += (o, e) => UpdateCopyrights();
        }
Exemplo n.º 24
0
        private static void MapDoubleClick(Map map, MouseButtonEventArgs args)
        {
            bool isShiftDown = (Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift;
            int adjustment = isShiftDown ? -1 : 1;

            Point pixel = args.GetPosition(map);
            map.ZoomOnPixelPoint(pixel, adjustment);
        }