Ejemplo n.º 1
0
        public void RegisterTestedFeature([NotNull] BaseRow row,
                                          [CanBeNull] IList <ContainerTest> reducedTests)
        {
            double searchTolerance = GetSearchTolerance(row.Table);

            RegisterTestedFeature(row, searchTolerance, reducedTests);
        }
Ejemplo n.º 2
0
        private void ValidateCache([NotNull] BaseRow baseRow,
                                   [NotNull] IBox currentSearchBox)
        {
            if (MaxCachedPointCount < 0)
            {
                return;
            }

            var cachedRow = baseRow as CachedRow;

            if (cachedRow == null)
            {
                return;
            }

            if (cachedRow.Extent.Intersects(currentSearchBox))
            {
                // row is needed in currentSearchBox,
                // if we would uncache it now it will be cached again during the next loading of features
                return;
            }

            _currentUncachableRows.Add(cachedRow);
            int pointCount = cachedRow.CachedPointCount;

            if (_currentCachedPointCount + pointCount < MaxCachedPointCount)
            {
                _currentCachedPointCount += pointCount;
            }
            else
            {
                cachedRow.ReleaseFeature();
            }
        }
Ejemplo n.º 3
0
        private static void Register(
            [NotNull] ITable table,
            [NotNull] IDictionary <ITable, IDictionary <BaseRow, TestedRow> > overlapping,
            [NotNull] BaseRow cachedRow,
            [CanBeNull] IList <ContainerTest> reducedTests)
        {
            IDictionary <BaseRow, TestedRow> testedRows;

            if (!overlapping.TryGetValue(table, out testedRows))
            {
                //testedRows = new Dictionary<BaseRow, TestedRow>(_comparer);
                testedRows = LargeDictionaryFactory.CreateDictionary <BaseRow, TestedRow>(
                    equalityComparer: _comparer);
                overlapping.Add(table, testedRows);
            }

            TestedRow testedRow;

            if (testedRows.TryGetValue(cachedRow, out testedRow))
            {
                testedRow.RegisterTested(reducedTests);
            }
            else
            {
                testedRows.Add(cachedRow, new TestedRow(cachedRow, reducedTests));
            }
        }
Ejemplo n.º 4
0
        private void RemoveObsoleteRows(IDictionary <BaseRow, TestedRow> testedRows,
                                        [NotNull] IBox searchBox)
        {
            List <BaseRow> toBeRemoved = null;

            foreach (KeyValuePair <BaseRow, TestedRow> pair in testedRows)
            {
                BaseRow   baseRow   = pair.Key;
                TestedRow testedRow = pair.Value;

                if (!testedRow.HasNoRemainingOccurrence(searchBox))
                {
                    ValidateCache(baseRow, searchBox);

                    continue;
                }

                if (toBeRemoved == null)
                {
                    toBeRemoved = new List <BaseRow>();
                }

                toBeRemoved.Add(baseRow);
            }

            if (toBeRemoved != null)
            {
                foreach (BaseRow oidToRemove in toBeRemoved)
                {
                    testedRows.Remove(oidToRemove);

                    oidToRemove.UniqueId?.Drop();
                }
            }
        }
Ejemplo n.º 5
0
            /// <summary>
            /// Initializes a new instance of the <see cref="TestedRow"/> class.
            /// </summary>
            /// <param name="cachedRow">The cached row.</param>
            /// <param name="reducedTests">The reduced tests.</param>
            public TestedRow([NotNull] BaseRow cachedRow,
                             [CanBeNull] IList <ContainerTest> reducedTests)
            {
                _reducedTests = reducedTests;

                BaseRow = cachedRow;
                //_occurrence = 1;
            }
Ejemplo n.º 6
0
        internal void RegisterTestedFeature([NotNull] BaseRow row,
                                            double searchTolerance,
                                            [CanBeNull] IList <ContainerTest> reducedTests)
        {
            ITable table = row.Table;

            if (table == null)
            {
                return;
            }

            if (_currentTileBox != null)
            {
                if (row.Extent.Max.Y + searchTolerance <= _currentTileBox.Max.Y &&
                    row.Extent.Max.X + searchTolerance <= _currentTileBox.Max.X)
                {
                    // the feature is not needed in the untested tiles
                    return;
                }
            }

            Register(table, _overlappingRows, row, reducedTests);
        }