Example #1
0
        protected IEnumerable <IRow> Search(
            int involvedTableIndex,
            [NotNull] IGeometry geometry,
            esriSpatialRelEnum spatialRelation = esriSpatialRelEnum.esriSpatialRelIntersects,
            [CanBeNull] string where           = null)
        {
            EnsureDefaultFilters();

            ITable            table         = InvolvedTables[involvedTableIndex];
            ISpatialFilter    filter        = _defaultFilters[involvedTableIndex];
            QueryFilterHelper defaultHelper = _defaultFilterHelpers[involvedTableIndex];

            QueryFilterHelper whereHelper = (string.IsNullOrWhiteSpace(where))
                                                                ? new QueryFilterHelper(
                table, where, GetSqlCaseSensitivity(table))
                                                                : null;

            filter.Geometry   = geometry;
            filter.SpatialRel = spatialRelation;
            foreach (var row in Search(table, filter, defaultHelper))
            {
                if (whereHelper == null || whereHelper.MatchesConstraint(row))
                {
                    yield return(row);
                }
            }
        }
Example #2
0
        /// <summary>
        /// Checks if the specified row fulfils the test constraints
        /// </summary>
        /// <returns></returns>
        internal bool CheckConstraint(IRow row, int tableIndex)
        {
            if (row.Table == null)
            {
                // Mock Row (TerrainRow or RasterRow
                Assert.True(row is IMockRow, "table is null for regular row");

                return(true);
            }

            if (row.Table != InvolvedTables[tableIndex])
            {
                throw new InvalidProgramException("row does not correspond to table index");
            }

            QueryFilterHelper filterHelper = _filterHelpers[tableIndex];

            return(filterHelper == null || filterHelper.MatchesConstraint(row));
        }