Beispiel #1
0
 public static LayerPropertyForm GetInstance(MapLayersForm parent, int layerHandle)
 {
     if (_instance == null)
     {
         _instance = new LayerPropertyForm(parent, layerHandle);
     }
     return(_instance);
 }
Beispiel #2
0
 public static MapLayersForm GetInstance(MapLayersHandler mapLayers, MapperForm parent)
 {
     if (_instance == null)
     {
         _instance = new MapLayersForm(mapLayers, parent);
     }
     return(_instance);
 }
Beispiel #3
0
 public LayerPropertyForm(MapLayersForm parent, int layerHandle)
 {
     InitializeComponent();
     _parentForm  = parent;
     _layerHandle = layerHandle;
     _mapLayers   = _parentForm.MapLayers;
     _mapLayers.OnVisibilityExpressionSet += OnVisibilityExpression;
     _mapLayer       = _parentForm.MapLayers.get_MapLayer(_layerHandle);
     _shapefileLayer = _mapLayer.LayerObject as Shapefile;
 }
Beispiel #4
0
        private void OnToolbarClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            axMap.UDCursorHandle = -1;
            ToolStripItem tsi = e.ClickedItem;

            switch (tsi.Name)
            {
            case "tsButtonSave":
                _mapLayersHandler.SaveMapState();
                break;

            case "tsButtonLayers":
                var mlf = MapLayersForm.GetInstance(_mapLayersHandler, this);
                if (!mlf.Visible)
                {
                    mlf.Show(this);
                }
                else
                {
                    mlf.BringToFront();
                    mlf.Focus();
                }

                break;

            case "tsButtonLayerAdd":
                OpenFileDialog();
                break;

            case "tsButtonAttributes":

                if (MapLayersHandler.CurrentMapLayer != null)
                {
                    EditShapeAttributeForm esaf = EditShapeAttributeForm.GetInstance(this, _mapInterActionHandler);
                    if (esaf.Visible)
                    {
                        esaf.BringToFront();
                    }
                    else
                    {
                        esaf.Show(this);
                    }
                }
                else
                {
                    MessageBox.Show("Please select a layer", "No selected layer", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                break;

            case "tsButtonZoomIn":
                axMap.MapCursor      = tkCursor.crsrUserDefined;
                axMap.UDCursorHandle = (int)((Bitmap)e.ClickedItem.Image).GetHicon();
                axMap.CursorMode     = tkCursorMode.cmZoomIn;
                break;

            case "tsButtonZoomOut":
                axMap.MapCursor      = tkCursor.crsrUserDefined;
                axMap.UDCursorHandle = (int)((Bitmap)e.ClickedItem.Image).GetHicon();
                axMap.CursorMode     = tkCursorMode.cmZoomOut;
                break;

            case "tsButtonZoomAll":
                axMap.ZoomToMaxExtents();
                break;

            case "tsButtonFitMap":
                break;

            case "tsButtonZoomPrevious":
                axMap.ZoomToPrev();
                break;

            case "tsButtonPan":
                SetCursor(tkCursorMode.cmPan);
                break;

            case "tsButtonBlackArrow":
                SetCursor(tkCursorMode.cmSelection);
                break;

            case "tsButtonMeasure":
                axMap.CursorMode = tkCursorMode.cmMeasure;
                axMap.MapCursor  = tkCursor.crsrMapDefault;
                break;

            case "tsButtonClearSelection":
                if (_currentMapLayer != null && _currentMapLayer.LayerType == "ShapefileClass")
                {
                    _mapLayersHandler.ClearSelection(_currentMapLayer.Handle);
                }
                break;

            case "tsButtonClearAllSelection":
                _mapLayersHandler.ClearAllSelections();
                break;

            case "tsButtonGraticule":
                ShowGraticuleForm();
                break;

            case "tsButtonSaveImage":
                var saveForm = new SaveMapForm();
                saveForm.SaveType(SaveAsShapefile: false);
                saveForm.ShowDialog(this);
                break;

            case "tsButtonCloseMap":
                Close();
                return;
            }

            switch (axMap.CursorMode)
            {
            case tkCursorMode.cmSelection:
                SetCursor(tkCursorMode.cmSelection);
                break;

            case tkCursorMode.cmPan:
                SetCursor(tkCursorMode.cmPan);
                break;

            default:

                break;
            }
        }
Beispiel #5
0
 private void OnFormClosed(object sender, FormClosedEventArgs e)
 {
     _instance = null;
     _mapLayersHandler.LayerRead -= OnLayerRead;
     global.SaveFormSettings(this);
 }