public static EditShapeAttributeForm GetInstance(MapperForm parent, MapInterActionHandler mapInterActionHandler) { if (_instance == null) { _instance = new EditShapeAttributeForm(parent, mapInterActionHandler); } return(_instance); }
public static ShapeFileAttributesWindow GetInstance(MapInterActionHandler mapInterActionHandler) { if (_instance == null) { _instance = new ShapeFileAttributesWindow(mapInterActionHandler); } return(_instance); }
private void CleanUp() { _mapInterActionHandler.ShapesSelected -= _mapInterActionHandler_ShapesSelected; _mapInterActionHandler.SelectionCleared -= _mapInterActionHandler_SelectionCleared; _mapInterActionHandler.MapLayersHandler.CurrentLayer -= MapLayersHandler_CurrentLayer; _mapInterActionHandler.MapLayersHandler.AllSelectionsCleared -= MapLayersHandler_AllSelectionsCleared; _mapInterActionHandler = null; }
public static ShapefileAttributesForm GetInstance(MainWindowForm parentForm, MapInterActionHandler mapInterActionHandler) { if (_instance == null) { _instance = new ShapefileAttributesForm(parentForm, mapInterActionHandler); } return(_instance); }
public EditShapeAttributeForm(MapperForm parent, MapInterActionHandler mapInterActionHandler) { InitializeComponent(); MapInterActionHandler = mapInterActionHandler; MapInterActionHandler.Selection += OnLayerSelection; MapInterActionHandler.MapLayersHandler.CurrentLayer += OnCurrentLayer; _parentForm = parent; _currentMapLayer = MapInterActionHandler.MapLayersHandler.CurrentMapLayer; }
private void _mapInterActionHandler_ShapesSelected(MapInterActionHandler s, LayerEventArg e) { if (((Shapefile)MapWindowManager.MapLayersHandler[e.LayerHandle].LayerObject).FieldIndexByName["MWShapeID"] >= 0) { _gridWaslClicked = false; if (e.SelectedIndexes.Count() == 1) { _gridWaslClicked = true; if (dataGridAttributes.Items.Count == 1) { dataGridAttributes.DataContext = ShapefileAttributeTableManager.SetupAttributeTable(ShapeFile, true); for (int x = 0; x < e.SelectedIndexes.Count(); x++) { foreach (DataRowView item in dataGridAttributes.Items) { if (item.Row.Field <int>("MWShapeID") == e.SelectedIndexes[0]) { //dataGridAttributes.SelectedItem = item; dataGridAttributes.SelectedItems.Add(item); //break; } } } var t = dataGridAttributes.LayoutTransform; } else { foreach (DataRowView item in dataGridAttributes.Items) { if (item.Row.Field <int>("MWShapeID") == e.SelectedIndexes[0]) { dataGridAttributes.SelectedItem = item; dataGridAttributes.ScrollIntoView(dataGridAttributes.SelectedItem); } } } } else { //dataGridAttributes.DataContext = ShapefileAttributeTableManager.SetupAttributeTable(ShapeFile,true); ShowShapeFileAttribute(); for (int x = 0; x < e.SelectedIndexes.Count(); x++) { foreach (DataRowView item in dataGridAttributes.Items) { if (item.Row.Field <int>("MWShapeID") == e.SelectedIndexes[0]) { //dataGridAttributes.SelectedItem = item; dataGridAttributes.SelectedItems.Add(item); //break; } } } } } }
private void _mapInterActionHandler_ShapesSelected(MapInterActionHandler s, LayerEventArg e) { foreach (DataRowView item in dataGridAttributes.Items) { if (item.Row.Field <int>("MWShapeID") == e.SelectedIndexes[0]) { dataGridAttributes.SelectedItem = item; } } }
public ShapeFileAttributesWindow(MapInterActionHandler mapInterActionHandler) { InitializeComponent(); Closing += OnWindowClosing; Loaded += ShapeFileAttributesWindow_Loaded; _mapInterActionHandler = mapInterActionHandler; _mapInterActionHandler.ShapesSelected += _mapInterActionHandler_ShapesSelected; _mapInterActionHandler.SelectionCleared += _mapInterActionHandler_SelectionCleared; _mapInterActionHandler.MapLayersHandler.CurrentLayer += MapLayersHandler_CurrentLayer; _mapInterActionHandler.MapLayersHandler.AllSelectionsCleared += MapLayersHandler_AllSelectionsCleared; }
public ShapeFileAttributesWindow(MapInterActionHandler mapInterActionHandler) { InitializeComponent(); Closing += OnWindowClosing; Closed += OnWindowClosed; Loaded += ShapeFileAttributesWindow_Loaded; _mapInterActionHandler = mapInterActionHandler; _mapInterActionHandler.ShapesSelected += _mapInterActionHandler_ShapesSelected; _mapInterActionHandler.SelectionCleared += _mapInterActionHandler_SelectionCleared; _mapInterActionHandler.MapLayersHandler.CurrentLayer += MapLayersHandler_CurrentLayer; _mapInterActionHandler.MapLayersHandler.OnVisibilityExpressionSet += MapLayersHandler_OnVisibilityExpressionSet; _mapInterActionHandler.MapLayersHandler.AllSelectionsCleared += MapLayersHandler_AllSelectionsCleared; //dataGridAttributes.SelectionChanged += OnDataGridAttributes_SelectionChanged; }
private void OnMapShapeSelected(MapInterActionHandler s, LayerEventArg e) { if (CurrentLayer != null && CurrentLayer.LayerType == "ShapefileClass" && LayerSelector != null) { SelectedShapeIndexes = e.SelectedIndexes.ToList(); if (SelectedShapeIndexes.Count > 0) { var sf = (Shapefile)CurrentLayer.LayerObject; int fileNameField = sf.FieldIndexByName["Filename"]; int gpsField = sf.FieldIndexByName["GPS"]; switch (LayerSelector.GetType().Name) { case "DataGrid": var dataGrid = (System.Windows.Controls.DataGrid)LayerSelector; string fileName = sf.CellValue[fileNameField, SelectedShapeIndexes[0]]; string gps = sf.CellValue[gpsField, SelectedShapeIndexes[0]]; string itemGPS = ""; string itemFilename = ""; foreach (var item in dataGrid.Items) { switch (dataGrid.Name) { case "dataGridTrips": Trip trip = (Trip)item; itemGPS = trip.GPS.DeviceName; itemFilename = trip.Track.FileName; break; case "dataGridGPXFiles": GPXFile gpxFile = (GPXFile)item; itemGPS = gpxFile.GPS.DeviceName; itemFilename = gpxFile.FileName; break; } if (itemGPS == gps && itemFilename == fileName) { dataGrid.SelectedItem = item; dataGrid.ScrollIntoView(item); break; } } break; } } } }
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(); }
private void OnFormLoad(object sender, EventArgs e) { _mapLayersHandler = new MapLayersHandler(mapControl); _mapLayersHandler.TilesVisible = false; _mapInterActionHandler = new MapInterActionHandler(mapControl, _mapLayersHandler); }