view Postarc/Postarc/Geodatabase/SelectionSet.cs @ 0:1aca3d413885 tip

Initial import of Postarc
author Christian Lins <christian.lins@intevation.de>
date Fri, 05 Oct 2012 23:55:06 +0200
parents
children
line wrap: on
line source
/*
 * Postarc
 *
 * Author:
 * Christian Lins <christian.lins@intevation.de>
 *
 * Copyright:
 * Copyright (C) 2012 Intevation GmbH <http://www.intevation.de/>
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ESRI.ArcGIS.Geodatabase;

namespace Postarc.Geodatabase
{
    public class SelectionSet : ISelectionSet
    {
        protected Postarc.Feature.FeatureClass featureClass;
        protected List<int> list = new List<int>();

        internal List<int> List
        {
            get
            {
                return this.list;
            }
        }

        public SelectionSet(Postarc.Feature.FeatureClass featureClass)
        {
            this.featureClass = featureClass;
        }

        public void Add(int oid)
        {
            this.list.Add(oid);
        }

        /// <summary>
        /// Do not call this method, says API... okay...
        /// </summary>
        /// <param name="Count"></param>
        /// <param name="OIDList"></param>
        public void AddList(int Count, ref int OIDList)
        {
            // Does nothing
        }

        public void Combine(ISelectionSet otherSet, esriSetOperation setOp, out ISelectionSet resultSet)
        {
            SelectionSet newSet = new SelectionSet(featureClass);
            newSet.list.AddRange(list);
            newSet.list.AddRange(((SelectionSet)otherSet).list);
            resultSet = newSet as ISelectionSet;
        }

        public int Count
        {
            get
            {
                return this.list.Count;
            }
        }

        /// <summary>
        /// Always returns null.
        /// </summary>
        public ESRI.ArcGIS.esriSystem.IName FullName
        {
            get
            {
                return null;
            }
        }

        public IEnumIDs IDs
        {
            get
            {
                return new SelectionSetEnumerator(this);
            }
        }

        /// <summary>
        /// Not implemented.
        /// </summary>
        public void MakePermanent()
        {
            throw new NotImplementedException();
        }

        public void Refresh()
        {
            
        }

        /// <summary>
        /// Do not call
        /// </summary>
        /// <param name="Count"></param>
        /// <param name="OIDList"></param>
        public void RemoveList(int count, ref int oidList)
        {
            
        }

        public void Search(IQueryFilter queryFilter, bool recycling, out ICursor cursor)
        {
            // TODO: Merge queryFilter with this SelectionSet
            cursor = featureClass.Search(queryFilter, recycling) as ICursor;
        }

        public ISelectionSet Select(
            IQueryFilter queryFilter, 
            esriSelectionType selType, 
            esriSelectionOption selOption, 
            IWorkspace selectionContainer)
        {
            throw new NotImplementedException();
        }

        public ITable Target
        {
            get
            {
                return this.featureClass; 
            }
        }
    }
}
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)