Esempio n. 1
0
        private void HandleSelection(Envelope tolerant, Envelope strict)
        {
            Keys key = Control.ModifierKeys;

            if ((key & Keys.Shift) != Keys.Shift && (key & Keys.Control) != Keys.Control)
            {
#if DEBUG
                var sw = new Stopwatch();
                sw.Start();
#endif

                // If they are not pressing shift or control, clear the selection before adding new members to it.
                Map.ClearSelection();

#if DEBUG
                sw.Stop();
                Debug.WriteLine("Clear: " + sw.ElapsedMilliseconds);
#endif
            }

            if (!Map.MapFrame.GetAllLayers().Any(_ => _.SelectionEnabled && _.IsVisible))
            {
                MessageBox.Show(MessageStrings.MapFunctionSelect_NoSelectableLayer);
            }
            else if ((key & Keys.Control) == Keys.Control)
            {
                Map.InvertSelection(tolerant, strict);
            }
            else
            {
                Map.Select(tolerant, strict);
            }
        }
Esempio n. 2
0
        private void HandleSelection(Envelope tolerant, Envelope strict)
        {
            Keys key = Control.ModifierKeys;

            if ((((key & Keys.Shift) == Keys.Shift) == false) && (((key & Keys.Control) == Keys.Control) == false))
            {
                // If they are not pressing shift, then first clear the selection before adding new members to it.
                Envelope region;
#if DEBUG
                var sw = new Stopwatch();
                sw.Start();
#endif
                Map.ClearSelection(out region);
#if DEBUG
                sw.Stop();
                Debug.WriteLine("Clear: " + sw.ElapsedMilliseconds);
#endif
            }

            if ((key & Keys.Control) == Keys.Control)
            {
                Envelope region;
                Map.InvertSelection(tolerant, strict, SelectionMode.Intersects, out region);
            }
            else
            {
                bool selectable = false;
                foreach (ILayer layer in Map.MapFrame.GetAllLayers())
                {
                    if ((layer.IsVisible && layer.IsWithinLegendSelection()) || layer.IsSelected)
                    {
                        selectable = true;
                        break;
                    }
                }

                if (selectable == false)
                {
                    MessageBox.Show(MessageStrings.MapFunctionSelect_NoSelectableLayer);
                }

                Envelope region;
                Map.Select(tolerant, strict, SelectionMode.Intersects, out region);
            }
        }