Beispiel #1
0
 public void CleanUp()
 {
     MapLayerCollection.Clear();
     MapLayerCollection             = null;
     MaplayersHandler.LayerRead    -= MaplayersHandler_LayerRead;
     MaplayersHandler.LayerRemoved -= MaplayersHandler_LayerRemoved;
     MaplayersHandler = null;
 }
Beispiel #2
0
        private void MaplayersHandler_LayerRead(MapLayersHandler s, LayerEventArg e)
        {
            MapLayerCollection.Insert(0, s.CurrentMapLayer);

            if (LayerRead != null)
            {
                var item = MaplayersHandler.MapLayerDictionary[e.LayerHandle];


                LayerEventArg lp = new LayerEventArg(item.Handle, item.Name, item.Visible, item.VisibleInLayersUI, item.LayerType);
                LayerRead(this, lp);
            }
        }
Beispiel #3
0
        private void MaplayersHandler_LayerRemoved(MapLayersHandler s, LayerEventArg e)
        {
            int index = 0;

            while (index < MapLayerCollection.Count)
            {
                if (MapLayerCollection[index].Handle == e.LayerHandle)
                {
                    MapLayerCollection.RemoveAt(index);

                    if (LayerRemoved != null)
                    {
                        LayerEventArg lp = new LayerEventArg(e.LayerHandle, layerRemoved: true);
                        LayerRemoved(this, lp);
                    }
                    break;
                }
                index++;
            }
        }
Beispiel #4
0
 public GDIMapFrame()
 {
     Layers = new MapLayerCollection();
 }
        void DisplayWorldMap()
        {
            string appPath;
            if (EnvironmentTabMapLayers == null)
            {
                appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
#if false
                EnvironmentTabMapLayers = new MapLayerCollection();
                EnvironmentTabMapLayers.DisplayShapeFile("Base Map",
                                                         Path.Combine(appPath, @"Sample GIS Data\Countries02.shp"),
                                                         Colors.Beige, AreaStyles.Country2, true, 1, false);
#else
                EnvironmentTabMapLayers = new MapLayerCollection
                {
                        new ShapefileMapLayer
                        {
                                LayerType = LayerType.BaseMap,
                                LineColor = Colors.Beige,
                                AreaStyle = AreaStyles.Country2,
                                CanBeRemoved = false,
                                CanBeReordered = true,
                                CanChangeAreaColor = true,
                                CanChangeLineColor = true,
                                ShapefileName = Path.Combine(appPath, @"Sample GIS Data\Countries02.shp"),
                                Name = "Base Map",
                        }
                };
#endif
                ZoomToWorldMap();
            }
            if (HomeTabMapLayers != null) return;
            appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            HomeTabMapLayers = new MapLayerCollection
            {
                    new ShapefileMapLayer
                    {
                            LayerType = LayerType.BaseMap,
                            LineColor = Colors.Beige,
                            AreaStyle = AreaStyles.Country2,
                            CanBeRemoved = false,
                            CanBeReordered = true,
                            CanChangeAreaColor = true,
                            CanChangeLineColor = true,
                            ShapefileName = Path.Combine(appPath, @"Sample GIS Data\Countries02.shp"),
                            Name = "Base Map",
                    },
            };
        }