public static EditShapeAttributeForm GetInstance(MapperForm parent, MapInterActionHandler mapInterActionHandler)
 {
     if (_instance == null)
     {
         _instance = new EditShapeAttributeForm(parent, mapInterActionHandler);
     }
     return(_instance);
 }
示例#2
0
 public static ShapeFileAttributesWindow GetInstance(MapInterActionHandler mapInterActionHandler)
 {
     if (_instance == null)
     {
         _instance = new ShapeFileAttributesWindow(mapInterActionHandler);
     }
     return(_instance);
 }
示例#3
0
 private void CleanUp()
 {
     _mapInterActionHandler.ShapesSelected   -= _mapInterActionHandler_ShapesSelected;
     _mapInterActionHandler.SelectionCleared -= _mapInterActionHandler_SelectionCleared;
     _mapInterActionHandler.MapLayersHandler.CurrentLayer         -= MapLayersHandler_CurrentLayer;
     _mapInterActionHandler.MapLayersHandler.AllSelectionsCleared -= MapLayersHandler_AllSelectionsCleared;
     _mapInterActionHandler = null;
 }
示例#4
0
 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;
 }
示例#6
0
 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;
                     }
                 }
             }
         }
     }
 }
示例#7
0
 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;
         }
     }
 }
示例#8
0
 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;
 }
示例#9
0
        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;
        }
示例#10
0
        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;
                    }
                }
            }
        }
示例#11
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();
        }
示例#12
0
 private void OnFormLoad(object sender, EventArgs e)
 {
     _mapLayersHandler = new MapLayersHandler(mapControl);
     _mapLayersHandler.TilesVisible = false;
     _mapInterActionHandler         = new MapInterActionHandler(mapControl, _mapLayersHandler);
 }