コード例 #1
0
        public void MapEvents()
        {
            InitializeComponent();
            //Set focus on map
            MapTileOverlay.Focus();

            // Fires every animated frame from one location to another.
            MapTileOverlay.ViewChangeOnFrame +=
                new EventHandler <MapEventArgs>(MapWithEvents_ViewChangeOnFrame);
            // Fires when the map view location has changed.
            MapTileOverlay.TargetViewChanged +=
                new EventHandler <MapEventArgs>(MapWithEvents_TargetViewChanged);
            // Fires when the map view starts to move to its new target view.
            MapTileOverlay.ViewChangeStart +=
                new EventHandler <MapEventArgs>(MapWithEvents_ViewChangeStart);
            // Fires when the map view has reached its new target view.
            MapTileOverlay.ViewChangeEnd +=
                new EventHandler <MapEventArgs>(MapWithEvents_ViewChangeEnd);
            // Fires when a different mode button on the navigation bar is selected.
            MapTileOverlay.ModeChanged +=
                new EventHandler <MapEventArgs>(MapWithEvents_ModeChanged);
            // Fires when the mouse is double clicked
            MapTileOverlay.MouseDoubleClick +=
                new MouseButtonEventHandler(MapWithEvents_MouseDoubleClick);
            // Fires when the mouse wheel is used to scroll the map
            MapTileOverlay.MouseWheel +=
                new MouseWheelEventHandler(MapWithEvents_MouseWheel);
            // Fires when the left mouse button is depressed
            MapTileOverlay.MouseLeftButtonDown +=
                new MouseButtonEventHandler(MapWithEvents_MouseLeftButtonDown);
            // Fires when the left mouse button is released
            MapTileOverlay.MouseLeftButtonUp +=
                new MouseButtonEventHandler(MapWithEvents_MouseLeftButtonUp);
        }
コード例 #2
0
        private void MapWithPushpins_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            // Disables the default mouse double-click action.
            e.Handled = true;

            // Determin the location to place the pushpin at on the map.

            //Get the mouse click coordinates
            Point mousePosition = e.GetPosition(this);
            //Convert the mouse coordinates to a locatoin on the map
            Location pinLocation = MapTileOverlay.ViewportPointToLocation(mousePosition);

            // The pushpin to add to the map.
            Pushpin pin = new Pushpin();

            pin.Location = pinLocation;

            // Adds the pushpin to the map.
            MapTileOverlay.Children.Add(pin);
        }
コード例 #3
0
        public GISMainMap(SurfaceWindow1 ProgramWindow)
        {
            InitializeComponent();
            //Set focus on the map
            MapTileOverlay.Focus();

            //  SetUpNewPolygon();
            // Adds location points to the polygon for every single mouse click
            MapTileOverlay.MouseDoubleClick += new MouseButtonEventHandler(
                MapWithPolygon_MouseDoubleClick);

            // Adds the layer that contains the polygon points
            // NewPolygonLayer.Children.Add(polygonPointLayer);

            // Displays the current latitude and longitude as the map animates.
            MapTileOverlay.ViewChangeOnFrame += new EventHandler <MapEventArgs>(viewMap_ViewChangeOnFrame);
            // The default animation level: navigate between different map locations.
            //viewMap.AnimationLevel = AnimationLevel.Full;

            // surfacewindow is a global handle back to the main program.
            surfaceWindow = ProgramWindow;
        }