Example #1
0
        /// <inheritdoc />
        public override bool InvertSelection(Envelope tolerant, Envelope strict, SelectionMode mode, out Envelope affectedArea)
        {
            affectedArea = new Envelope();
            if (!_selectionEnabled)
            {
                return(false);
            }
            bool somethingChanged = false;

            MapFrame.SuspendEvents();
            foreach (ILayer s in GetLayers())
            {
                if (s.SelectionEnabled == false)
                {
                    continue;
                }
                Envelope layerArea;
                if (s.InvertSelection(tolerant, strict, mode, out layerArea))
                {
                    somethingChanged = true;
                    affectedArea.ExpandToInclude(layerArea);
                }
            }
            MapFrame.ResumeEvents();
            OnSelectionChanged(); // fires only AFTER the individual layers have fired their events.
            return(somethingChanged);
        }
Example #2
0
        /// <inheritdoc />
        public override bool Select(Envelope tolerant, Envelope strict, SelectionMode mode, out Envelope affectedArea)
        {
            affectedArea = new Envelope();
            if (!_selectionEnabled)
            {
                return(false);
            }
            bool somethingChanged = false;

            MapFrame.SuspendEvents();

            foreach (var s in GetLayers()
                     .Reverse()
                     .Where(_ => _.SelectionEnabled && _.IsVisible))
            {
                Envelope layerArea;
                if (s.Select(tolerant, strict, mode, out layerArea))
                {
                    somethingChanged = true;
                    affectedArea.ExpandToInclude(layerArea);
                }
                // removed by jany_: this selected only features of the first layer with features in the selected area, if user wanted to select features of another layer too they get ignored
                // added SelectPlugin enables user to choose the layers in which he wants to select features
                //if (somethingChanged)
                //{
                //    MapFrame.ResumeEvents();
                //    OnSelectionChanged(); // fires only AFTER the individual layers have fired their events.
                //    return somethingChanged;
                //}
            }
            MapFrame.ResumeEvents();
            OnSelectionChanged(); // fires only AFTER the individual layers have fired their events.
            return(somethingChanged);
        }
Example #3
0
        /// <inheritdoc />
        public override bool ClearSelection(out Envelope affectedAreas)
        {
            affectedAreas = new Envelope();
            bool changed = false;

            if (!_selectionEnabled)
            {
                return(false);
            }
            MapFrame.SuspendEvents();
            foreach (ILayer layer in GetLayers())
            {
                Envelope layerArea;
                if (layer.ClearSelection(out layerArea))
                {
                    changed = true;
                    affectedAreas.ExpandToInclude(layerArea);
                }
            }
            MapFrame.ResumeEvents();

            OnSelectionChanged(); // fires only AFTER the individual layers have fired their events.

            return(changed);
        }
Example #4
0
        /// <inheritdoc />
        public override bool Select(IEnvelope tolerant, IEnvelope strict, SelectionMode mode, out IEnvelope affectedArea)
        {
            affectedArea = new Envelope();
            if (!_selectionEnabled)
            {
                return(false);
            }
            bool somethingChanged = false;

            MapFrame.SuspendEvents();

            foreach (var s in GetLayers()
                     .Reverse()
                     .Where(_ => _.SelectionEnabled && _.IsVisible))
            {
                IEnvelope layerArea;
                if (s.Select(tolerant, strict, mode, out layerArea))
                {
                    somethingChanged = true;
                }
                affectedArea.ExpandToInclude(layerArea);
                if (somethingChanged)
                {
                    MapFrame.ResumeEvents();
                    OnSelectionChanged(); // fires only AFTER the individual layers have fired their events.
                    return(somethingChanged);
                }
            }
            MapFrame.ResumeEvents();
            OnSelectionChanged(); // fires only AFTER the individual layers have fired their events.
            return(somethingChanged);
        }
Example #5
0
 /// <inheritdoc />
 public override bool Select(IEnvelope tolerant, IEnvelope strict, SelectionMode mode, out IEnvelope affectedArea)
 {
     affectedArea = new Envelope();
     if (!_selectionEnabled) return false;
     bool somethingChanged = false;
     MapFrame.SuspendEvents();
     foreach (ILayer s in GetLayers())
     {
         if (s.SelectionEnabled == false) continue;
         if (s.IsVisible == false) continue;
         IEnvelope layerArea;
         if (s.Select(tolerant, strict, mode, out layerArea)) somethingChanged = true;
         affectedArea.ExpandToInclude(layerArea);
     }
     MapFrame.ResumeEvents();
     OnSelectionChanged(); // fires only AFTER the individual layers have fired their events.
     return somethingChanged;
 }
Example #6
0
        /// <inheritdoc />
        public override bool Select(Envelope tolerant, Envelope strict, SelectionMode mode, out Envelope affectedArea, ClearStates clear)
        {
            affectedArea = new Envelope();
            bool somethingChanged = false;

            MapFrame.SuspendEvents();

            foreach (var s in GetAllLayers().Where(_ => _.SelectionEnabled && _.IsVisible))
            {
                if (s.Select(tolerant, strict, mode, out Envelope layerArea, clear))
                {
                    somethingChanged = true;
                    affectedArea.ExpandToInclude(layerArea);
                }
            }

            MapFrame.ResumeEvents();
            OnSelectionChanged(); // fires only AFTER the individual layers have fired their events.
            return(somethingChanged);
        }