Example #1
0
        virtual internal bool AddFeature(long n, int l, FeatureEnvelope featEnv)
        {
            List <FeatureEnvelope> list;

            //
            // Überprüfen, ob Key schon vorhanden ist
            //
            if (!_nodes.TryGetValue(n, out list))
            {
                return(false);
            }

            if (l < _maxLevels)
            {
                //
                //  Kindknoten
                //
                long c1, c2;
                this.ChildNodeNumbers(n, l, out c1, out c2);

                List <FeatureEnvelope> cList;
                if (_nodes.TryGetValue(c1, out cList) &&
                    _nodes.TryGetValue(c2, out cList))
                {
                    //
                    // Bounds des Knoten berechen
                    //
                    IEnvelope bound1 = this[c1];
                    IEnvelope bound2 = this[c2];
                    if (bound1 != null && bound1.Contains(featEnv.Envelope))
                    {
                        return(AddFeature(c1, l + 1, featEnv));
                    }
                    else if (bound2 != null && bound2.Contains(featEnv.Envelope))
                    {
                        return(AddFeature(c2, l + 1, featEnv));
                    }
                }
            }
            list.Add(featEnv);
            if (l < _maxLevels)
            {
                if (list.Count > _maxPerNode)
                {
                    SplitNode(n, l);
                }
                else if (_maxVerticesPerNode > 0 && list.Sum(e => e.VertexCount) > _maxVerticesPerNode)
                {
                    SplitNode(n, l);
                }
            }

            return(true);
        }
Example #2
0
        override internal bool AddFeature(long n, int l, FeatureEnvelope featEnv)
        {
            n = _searchTree.InsertSINode(featEnv.Envelope);

            List <FeatureEnvelope> list;

            if (!_nodes.TryGetValue(n, out list))
            {
                list = new List <FeatureEnvelope>();
                _nodes.Add(n, list);
            }
            list.Add(featEnv);

            return(true);
        }