Example #1
0
        private void InitDockLayout()
        {
            _legendForm = new LegendDockForm();
            _legendForm.Show(dockPanel1, DockState.DockLeft);

            _mapForm = new MapForm();
            _mapForm.Show(dockPanel1, DockState.Document);
            _mapForm.SelectionChanged += (s, e) => RefreshUI();
            _mapForm.CloseButton       = false;


            var form = new DonationForm();

            form.Show(dockPanel1, DockState.Document);
            form.CloseButton = false;

            _mapForm.Activate();
        }
Example #2
0
        public void RefreshUI()
        {
            Text = WINDOW_TITLE;
            if (!App.Project.IsEmpty)
            {
                Text += " - " + App.Project.GetPath();
            }

            toolSetProjection.Enabled = App.Map.NumLayers == 0;
            toolSetProjection.Text    = App.Map.NumLayers == 0
                ? "Set coordinate system and projection"
                : "It's not allowed to change projection when layers are already added to the map.";

            toolSearch.Enabled = true;
            toolSearch.Text    = "Find location";
            if (App.Map.NumLayers > 0 && !App.Map.Measuring.IsUsingEllipsoid)
            {
                toolSearch.Enabled = false;
                toolSearch.Text    = "Unsupported projection. Search isn't allowed.";
            }

            toolZoomIn.Checked          = Map.CursorMode == tkCursorMode.cmZoomIn;
            toolZoomOut.Checked         = Map.CursorMode == tkCursorMode.cmZoomOut;
            toolPan.Checked             = Map.CursorMode == tkCursorMode.cmPan;
            toolSelect.Checked          = Map.CursorMode == tkCursorMode.cmSelection;
            toolSelectByPolygon.Checked = Map.CursorMode == tkCursorMode.cmSelectByPolygon;
            toolIdentify.Checked        = Map.CursorMode == tkCursorMode.cmIdentify;

            bool distance = Map.Measuring.MeasuringType == tkMeasuringType.MeasureDistance;

            toolMeasure.Checked     = Map.CursorMode == tkCursorMode.cmMeasure && distance;
            toolMeasureArea.Checked = Map.CursorMode == tkCursorMode.cmMeasure && !distance;

            if (Map.CursorMode != tkCursorMode.cmIdentify)
            {
                MapForm.HideTooltip();
            }

            bool hasShapefile = false;
            int  layerHandle  = App.Legend.SelectedLayer;
            bool hasLayer     = layerHandle != -1;

            if (hasLayer)
            {
                var sf = App.Map.get_Shapefile(layerHandle);
                if (sf != null)
                {
                    statusSelectedCount.Text   = string.Format("Shapes: {0}; selected: {1}", sf.NumShapes, sf.NumSelected);
                    toolClearSelection.Enabled = sf.NumSelected > 0;
                    toolZoomToSelected.Enabled = sf.NumSelected > 0;
                    hasShapefile = true;
                }
            }

            if (!hasShapefile)
            {
                statusSelectedCount.Text   = "";
                toolClearSelection.Enabled = false;
                toolZoomToSelected.Enabled = false;
            }

            toolRemoveLayer.Enabled = hasLayer;
            Editor.RefreshUI();

            Map.Focus();
        }