Example #1
0
        /// <summary>
        /// Adding a feature state sets the drawing state of the item to be
        /// </summary>
        /// <param name="item">The item to add to this category</param>
        /// <exception cref="Serialization.ReadOnlyException">Occurs if this list is set to read-only in the constructor</exception>
        public void Add(IFeature item)
        {
            if (_isReadOnly)
            {
                throw new ReadOnlyException();
            }
            IDrawnState      previousState = _filter[item];
            IFeatureCategory cat           = previousState.SchemeCategory;

            if (_useCategory)
            {
                cat = _category;
            }
            bool sel = previousState.IsSelected;

            if (_useSelection)
            {
                sel = _selected;
            }
            int chunk = previousState.Chunk;

            if (_useChunks)
            {
                chunk = _chunk;
            }
            bool vis = previousState.IsVisible;

            if (_useVisibility)
            {
                vis = _visible;
            }

            _filter[item] = new DrawnState(cat, sel, chunk, vis);
            OnChanged();
        }
Example #2
0
        /// <summary>
        /// Removes the specified item from the subset of this classification if that category is used.
        /// Selected -> !Selected
        /// Category[>0] -> Category[0]
        /// Category[0] -> Null
        /// Visible -> !Visible
        /// Chunk -> -1  or basically a chunk index that is never drawn.
        /// </summary>
        /// <param name="item">The item to change the drawing state of.</param>
        /// <returns>Boolean, false if the item does not match the current grouping.</returns>
        /// <exception cref="ReadOnlyException">Occurs if this list is set to read-only in the constructor.</exception>
        public bool Remove(IFeature item)
        {
            if (IsReadOnly)
            {
                throw new ReadOnlyException();
            }

            if (Contains(item) == false)
            {
                return(false);
            }

            IDrawnState      previousState = Filter[item];
            IFeatureCategory cat           = previousState.SchemeCategory;
            int  chunk = previousState.Chunk;
            bool sel   = previousState.IsSelected;
            bool vis   = previousState.IsVisible;

            if (ActiveType == FilterType.Category)
            {
                cat = Category != Filter.DefaultCategory ? Filter.DefaultCategory : null;
            }

            if (ActiveType == FilterType.Chunk)
            {
                // removing from a chunk effectively means setting to -1 so that it will not get drawn
                // until it is added to a chunk again.
                chunk = -1;
            }

            if (ActiveType == FilterType.Selection)
            {
                sel = !Selected;
            }

            if (ActiveType == FilterType.Visible)
            {
                vis = !Visible;
            }

            Filter[item] = new DrawnState(cat, sel, chunk, vis);
            _envelope    = null; //reset the envelope so it will be calculated from the selected features the next time the property is accessed
            OnChanged();
            return(true);
        }
Example #3
0
        /// <summary>
        /// Removes the specified item from the subset of this classification if that category is used.
        /// Selected -> !Selected
        /// Category[>0] -> Category[0]
        /// Category[0] -> Null
        /// Visible -> !Visible
        /// Chunk -> -1  or basically a chunk index that is never drawn.
        /// </summary>
        /// <param name="item">The item to change the drawing state of</param>
        /// <returns>Boolean, false if the item does not match the current grouping</returns>
        /// <exception cref="ReadOnlyException">Occurs if this list is set to read-only in the constructor</exception>
        public bool Remove(IFeature item)
        {
            if (_isReadOnly)
            {
                throw new ReadOnlyException();
            }
            if (Contains(item) == false)
            {
                return(false);
            }

            IDrawnState      previousState = _filter[item];
            IFeatureCategory cat           = previousState.SchemeCategory;
            int  chunk = previousState.Chunk;
            bool sel   = previousState.IsSelected;
            bool vis   = previousState.IsVisible;

            if (_activeType == FilterType.Category)
            {
                cat = _category != _filter.DefaultCategory ? _filter.DefaultCategory : null;
            }
            if (_activeType == FilterType.Chunk)
            {
                // removing from a chunk effectively means setting to -1 so that it will not get drawn
                // until it is added to a chunk again.
                chunk = -1;
            }
            if (_activeType == FilterType.Selection)
            {
                sel = !_selected;
            }
            if (_activeType == FilterType.Visible)
            {
                vis = !_visible;
            }
            _filter[item] = new DrawnState(cat, sel, chunk, vis);
            OnChanged();
            return(true);
        }
Example #4
0
        /// <summary>
        /// Adding a feature state sets the drawing state of the item to be.
        /// </summary>
        /// <param name="item">The item to add to this category.</param>
        /// <exception cref="Serialization.ReadOnlyException">Occurs if this list is set to read-only in the constructor.</exception>
        public void Add(IFeature item)
        {
            if (IsReadOnly)
            {
                throw new ReadOnlyException();
            }

            IDrawnState      previousState = Filter[item];
            IFeatureCategory cat           = previousState.SchemeCategory;

            if (UseCategory)
            {
                cat = Category;
            }
            bool sel = previousState.IsSelected;

            if (UseSelection)
            {
                sel = Selected;
            }
            int chunk = previousState.Chunk;

            if (UseChunks)
            {
                chunk = Chunk;
            }
            bool vis = previousState.IsVisible;

            if (UseVisibility)
            {
                vis = Visible;
            }

            Filter[item] = new DrawnState(cat, sel, chunk, vis);
            _envelope    = null; //reset the envelope so it will be calculated from the selected features the next time the property is accessed
            OnChanged();
        }
        /// <summary>
        /// Removes the specified item from the subset of this classification if that category is used.
        /// Selected -> !Selected
        /// Category[>0] -> Category[0]
        /// Category[0] -> Null
        /// Visible -> !Visible
        /// Chunk -> -1  or basically a chunk index that is never drawn.
        /// </summary>
        /// <param name="item">The item to change the drawing state of</param>
        /// <returns>Boolean, false if the item does not match the current grouping</returns>
        /// <exception cref="ReadOnlyException">Occurs if this list is set to read-only in the constructor</exception>
        public bool Remove(IFeature item)
        {
            if (_isReadOnly) throw new ReadOnlyException();
            if (Contains(item) == false) return false;

            IDrawnState previousState = _filter[item];
            IFeatureCategory cat = previousState.SchemeCategory;
            int chunk = previousState.Chunk;
            bool sel = previousState.IsSelected;
            bool vis = previousState.IsVisible;
            if (_activeType == FilterType.Category)
            {
                cat = _category != _filter.DefaultCategory ? _filter.DefaultCategory : null;
            }
            if (_activeType == FilterType.Chunk)
            {
                // removing from a chunk effectively means setting to -1 so that it will not get drawn
                // until it is added to a chunk again.
                chunk = -1;
            }
            if (_activeType == FilterType.Selection)
            {
                sel = !_selected;
            }
            if (_activeType == FilterType.Visible)
            {
                vis = !_visible;
            }
            _filter[item] = new DrawnState(cat, sel, chunk, vis);
            OnChanged();
            return true;
        }
        /// <summary>
        /// Adding a feature state sets the drawing state of the item to be
        /// </summary>
        /// <param name="item">The item to add to this category</param>
        /// <exception cref="Serialization.ReadOnlyException">Occurs if this list is set to read-only in the constructor</exception>
        public void Add(IFeature item)
        {
            if (_isReadOnly) throw new ReadOnlyException();
            IDrawnState previousState = _filter[item];
            IFeatureCategory cat = previousState.SchemeCategory;
            if (_useCategory) cat = _category;
            bool sel = previousState.IsSelected;
            if (_useSelection) sel = _selected;
            int chunk = previousState.Chunk;
            if (_useChunks) chunk = _chunk;
            bool vis = previousState.IsVisible;
            if (_useVisibility) vis = _visible;

            _filter[item] = new DrawnState(cat, sel, chunk, vis);
            OnChanged();
        }