示例#1
0
 public void AddBulk(IEnumerable <TObject> points, int threadLevel = 0)
 {
     QuadTreePointRoot.AddBulk(points.ToArray(), (a) =>
     {
         var qto = new QuadTreeObject <TObject, TNode>(a);
         WrappedDictionary.Add(a, qto);
         return(qto);
     }, threadLevel);
     Debug.Assert(WrappedDictionary.Count == QuadTreePointRoot.Count);
     Debug.Assert(WrappedDictionary.Count == points.Count());
 }
示例#2
0
        ///<summary>
        ///Adds an item to the <see cref="T:System.Collections.Generic.ICollection`1" />.
        ///</summary>
        ///
        ///<param name="item">The object to add to the <see cref="T:System.Collections.Generic.ICollection`1" />.</param>
        ///<exception cref="T:System.NotSupportedException">The <see cref="T:System.Collections.Generic.ICollection`1" /> is read-only.</exception>
        public void Add(TObject item)
        {
            var wrappedObject = new QuadTreeObject <TObject, TNode>(item);

            if (WrappedDictionary.ContainsKey(item))
            {
                throw new ArgumentException("Object already exists in index");
            }
            Debug.Assert(WrappedDictionary.Count == QuadTreePointRoot.Count);
            WrappedDictionary.Add(item, wrappedObject);
            QuadTreePointRoot.Insert(wrappedObject, true);
            //Debug.Assert(WrappedDictionary.Values.Distinct().Count() == WrappedDictionary.Count);
            Debug.Assert(WrappedDictionary.Count == QuadTreePointRoot.Count);
        }