Esempio n. 1
0
        void ITestContainer.CompleteTile(TileState state,
                                         IEnvelope tileEnvelope,
                                         IEnvelope testRunEnvelope,
                                         OverlappingFeatures overlappingFeatures)
        {
            Assert.ArgumentNotNull(tileEnvelope, nameof(tileEnvelope));

            _currentCache = overlappingFeatures;

            var parameters = new TileInfo(state, tileEnvelope, testRunEnvelope);

            if (_containerTests == null)
            {
                return;
            }

            var testIndex = 0;
            int testCount = _containerTests.Count;

            foreach (ContainerTest test in _containerTests)
            {
                try
                {
                    using (UseProgressWatch(
                               Step.TileCompleting, Step.TileCompleted, testIndex, testCount, test))
                    {
                        int origErrorEventCount = _errorEventCount;

                        int testErrorCount = test.CompleteTile(parameters);

                        int testErrorEventCount = _errorEventCount - origErrorEventCount;
                        _totalErrorCount += testErrorCount;

                        if (_totalErrorCount != _errorEventCount)
                        {
                            Assert.Fail(
                                "Test '{0}' has inconsistent error count during tile completion: " +
                                "returned count is {1:N0}, raised errors count is {2:N0}",
                                test.GetType(), testErrorCount, testErrorEventCount);
                        }

                        _totalErrorCount = _errorEventCount;
                    }

                    testIndex++;
                }
                catch (Exception e)
                {
                    throw new TestContainerException(test, tileEnvelope, e);
                }
            }
        }
Esempio n. 2
0
        public TileCache([NotNull] IList <ITable> cachedTables, [NotNull] IBox testRunBox,
                         [NotNull] ITestContainer container,
                         [NotNull] IDictionary <ITable, IList <ContainerTest> > testsPerTable)
        {
            _cachedTables  = cachedTables;
            _testRunBox    = testRunBox;
            _container     = container;
            _testsPerTable = testsPerTable;

            _cachedTableCount         = cachedTables.Count;
            _rowBoxTrees              = new RowBoxTree[_cachedTables.Count];
            _xyToleranceByTableIndex  = GetXYTolerancePerTable(_testsPerTable.Keys);
            IgnoredRowsByTableAndTest = new List <IList <BaseRow> > [_cachedTableCount];
            OverlappingFeatures       = new OverlappingFeatures(_container.MaxCachedPointCount);

            CollectSearchTolerances();
        }
Esempio n. 3
0
        private void CollectSearchTolerances()
        {
            _maximumSearchTolerance = 0;
            _searchToleranceFromTo  = new double[_cachedTableCount][];

            for (var queriedTableIndex = 0;
                 queriedTableIndex < _cachedTables.Count;
                 queriedTableIndex++)
            {
                var searchToleranceByTable = new double[_cachedTableCount];

                _searchToleranceFromTo[queriedTableIndex] = searchToleranceByTable;

                ITable table = GetCachedTable(queriedTableIndex);
                IList <ContainerTest> pTestList = _testsPerTable[table];

                foreach (ContainerTest containerTest in pTestList)
                {
                    if (Math.Abs(containerTest.SearchDistance) < double.Epsilon)
                    {
                        continue;
                    }

                    _maximumSearchTolerance = Math.Max(_maximumSearchTolerance,
                                                       containerTest.SearchDistance);

                    foreach (ITable involvedTable in containerTest.InvolvedTables)
                    {
                        int involvedTableIndex = _cachedTables.IndexOf(involvedTable);

                        if (involvedTableIndex < 0)
                        {
                            continue;
                        }

                        searchToleranceByTable[involvedTableIndex] =
                            Math.Max(searchToleranceByTable[involvedTableIndex],
                                     containerTest.SearchDistance);

                        OverlappingFeatures.AdaptSearchTolerance(
                            involvedTable, containerTest.SearchDistance);
                    }
                }
            }
        }