Ejemplo n.º 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;
            }
        }
Ejemplo n.º 2
0
        private void OnCellClick(object sender, DataGridViewCellEventArgs e)
        {
            _layerHandle = (int)layerGrid[0, e.RowIndex].Tag;
            if (e.ColumnIndex == 0)
            {
                bool isVisible = (bool)layerGrid[0, e.RowIndex].Value;
                layerGrid[0, e.RowIndex].Value = !isVisible;
                var layerName = layerGrid[e.ColumnIndex + 1, e.RowIndex].Value.ToString();
                _mapLayersHandler.EditLayer(_layerHandle, layerName, !isVisible);
            }

            if (e.ColumnIndex == 1)
            {
                MarkCurrentLayerName(e.RowIndex);
                _mapLayersHandler.set_MapLayer(_layerHandle);
                //itemConvertToGrid25.Enabled = false;
                //itemAlwaysKeepOnTop.Checked = _mapLayersHandler.CurrentMapLayer.KeepOnTop;
                if (global.MappingMode == fad3MappingMode.grid25Mode)
                {
                    if (_mapLayersHandler.CurrentMapLayer.LayerType == "ShapefileClass")
                    {
                        var sf = _mapLayersHandler.CurrentMapLayer.LayerObject as Shapefile;
                        //itemConvertToGrid25.Enabled = sf.ShapefileType == ShpfileType.SHP_POINT;
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void DataGridLayers_MouseUp(object sender, MouseButtonEventArgs e)
        {
            DependencyObject dep = (DependencyObject)e.OriginalSource;

            while ((dep != null) && !(dep is DataGridCell) && !(dep is DataGridColumnHeader))
            {
                dep = VisualTreeHelper.GetParent(dep);
            }

            if (dep == null)
            {
                return;
            }
            else if (dep is DataGridColumnHeader)
            {
                DataGridColumnHeader columnHeader = dep as DataGridColumnHeader;
                string boundPropertyName          = FindBoundProperty(columnHeader.Column);

                int columnIndex = columnHeader.Column.DisplayIndex;

                //Title = string.Format(
                //    "Header clicked [{0}] = {1}",
                //    columnIndex, boundPropertyName);
            }
            else if (dep is DataGridCell)
            {
                DataGridCell cell = dep as DataGridCell;

                // navigate further up the tree
                while ((dep != null) && !(dep is DataGridRow))
                {
                    dep = VisualTreeHelper.GetParent(dep);
                }

                if (dep == null)
                {
                    return;
                }

                DataGridRow row = dep as DataGridRow;

                object value = ExtractBoundValue(row, cell);

                int columnIndex = cell.Column.DisplayIndex;
                int rowIndex    = FindRowIndex(row);


                if (columnIndex == 0)
                {
                    MapLayersHandler.EditLayer(CurrentLayer.Handle, CurrentLayer.Name, !(bool)value);


                    RefreshCurrentLayer();
                    dataGridLayers.Focus();
                }
            }
        }
Ejemplo n.º 4
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;
            }
        }