コード例 #1
0
        private void OnMenuChecked(object sender, RoutedEventArgs e)
        {
            var menuItem = (WindowMenuItem)sender;

            switch (menuItem.Name)
            {
            case "menuMapCoastlineVisible":

                var coast = MapLayersHandler.get_MapLayer("Coastline");
                if (coast == null)
                {
                    MapWindowManager.LoadCoastline(MapWindowManager.CoastLineFile);
                    coast = MapLayersHandler.get_MapLayer("Coastline");
                }
                MapLayersHandler.EditLayer(coast.Handle, coast.Name, menuItem.IsChecked);

                break;

            case "menuMapTilesVisible":
                if (menuItem.IsChecked)
                {
                    menuMapTilesSelectProvider.IsEnabled = true;
                    if (MapControl.TileProvider == tkTileProvider.ProviderNone)
                    {
                        SelectTileProvider();
                    }
                }
                else
                {
                    MapControl.TileProvider = tkTileProvider.ProviderNone;
                    menuMapTilesSelectProvider.IsEnabled = false;
                }
                break;
            }
        }
コード例 #2
0
        private void OnWindowLoaded(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.Integration.WindowsFormsHost host = new System.Windows.Forms.Integration.WindowsFormsHost();

            MapControl = new AxMapWinGIS.AxMap();
            host.Child = MapControl;
            MapGrid.Children.Add(host);

            MapLayersHandler        = new MapLayersHandler(MapControl);
            MapInterActionHandler   = new MapInterActionHandler(MapControl, MapLayersHandler);
            MapControl.ZoomBehavior = tkZoomBehavior.zbDefault;

            if (MapWindowManager.MapStateFileExists)
            {
                MapWindowManager.RestoreMapState(this);
                menuMapTilesVisible.IsChecked        = MapControl.TileProvider != tkTileProvider.ProviderNone;
                menuMapTilesSelectProvider.IsEnabled = MapControl.TileProvider != tkTileProvider.ProviderNone;
            }
            else
            {
                menuMapTilesSelectProvider.IsEnabled = false;
            }

            if (MapLayersHandler.get_MapLayer("Coastline") != null)
            {
                menuMapCoastlineVisible.IsChecked = MapLayersHandler.get_MapLayer("Coastline").Visible;
            }


            MapWindowManager.ResetCursor();

            MapInterActionHandler.ShapesSelected      += OnMapShapeSelected;
            MapLayersHandler.CurrentLayer             += OnMapCurrentLayer;
            MapLayersHandler.OnLayerVisibilityChanged += MapLayersHandler_OnLayerVisibilityChanged;
            GPXMappingManager.MapInteractionHandler    = MapInterActionHandler;
            TripMappingManager.MapInteractionHandler   = MapInterActionHandler;

            SetButtonEnabled();
        }
コード例 #3
0
        private void OnMenuChecked(object sender, RoutedEventArgs e)
        {
            var menuItem = (WindowMenuItem)sender;

            switch (menuItem.Name)
            {
            case "menuMapCoastlineVisible":

                var coast = MapLayersHandler.get_MapLayer("Coastline");
                if (coast == null)
                {
                    MapWindowManager.LoadCoastline(MapWindowManager.CoastLineFile);
                    coast = MapLayersHandler.get_MapLayer("Coastline");
                }
                if (coast != null)
                {
                    MapLayersHandler.EditLayer(coast.Handle, coast.Name, menuItem.IsChecked);
                }
                else
                {
                    if (File.Exists(MapWindowManager.CoastLineFile))
                    {
                        System.Windows.MessageBox.Show("Coastline file could not be loaded as a GIS Shapefile", "GPX Manager", MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                    else
                    {
                        System.Windows.MessageBox.Show("Coastline file could not be found", "GPX Manager", MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                }

                break;

            case "menuMapTilesVisible":
                if (menuItem.IsChecked)
                {
                    menuMapTilesSelectProvider.IsEnabled = true;
                    if (MapControl.TileProvider == tkTileProvider.ProviderNone)
                    {
                        SelectTileProvider();
                    }
                }
                else
                {
                    MapControl.TileProvider = tkTileProvider.ProviderNone;
                    menuMapTilesSelectProvider.IsEnabled = false;
                }
                break;
            }
        }
コード例 #4
0
 private void OnCurrentMapLayer(MapLayersHandler s, LayerEventArg e)
 {
     _currentMapLayer = _mapLayersHandler.get_MapLayer(e.LayerHandle);
 }