Example #1
0
        private static IEnumerable <IRow> GetJoinedRows(
            [NotNull] IObject obj,
            [NotNull] IList <IRelationshipClass> relationshipChainToFeatureClass)
        {
            string whereClause = string.Format(
                "{0} = {1}",
                DatasetUtils.QualifyFieldName(obj.Class, obj.Class.OIDFieldName),
                obj.OID);

            const IGeometry intersectedGeometry  = null;
            string          postfixClause        = null;
            string          subfields            = null;
            const bool      includeOnlyOIDFields = true;
            const bool      recycle = false;

            foreach (FieldMappingRowProxy rowProxy in GdbQueryUtils.GetRowProxys(
                         obj.Class,
                         intersectedGeometry,
                         whereClause,
                         relationshipChainToFeatureClass,
                         postfixClause,
                         subfields, includeOnlyOIDFields, recycle))
            {
                yield return(rowProxy.BaseRow);
            }
        }
Example #2
0
        internal static HashSet <int> GetOidsByRelatedGeometry(
            [NotNull] ITable table,
            [NotNull] IEnumerable <IList <IRelationshipClass> > relClassChains,
            [NotNull] IGeometry testPerimeter,
            [NotNull] ITest testWithTable)
        {
            Assert.ArgumentNotNull(table, nameof(table));
            Assert.ArgumentNotNull(relClassChains, nameof(relClassChains));
            Assert.ArgumentNotNull(testPerimeter, nameof(testPerimeter));

            string whereClause   = string.Empty;
            string postfixClause = string.Empty;
            string tableName     = DatasetUtils.GetName(table);

            Stopwatch watch =
                _msg.DebugStartTiming("Getting row OIDs by related geometry for {0}",
                                      tableName);

            var result = new HashSet <int>();

            foreach (IList <IRelationshipClass> relClassChain in relClassChains)
            {
                // NOTE:
                // - if only the OID is in the subfields, then ArcMap crashes without
                //   catchable exception in RARE cases
                // - if only the OID plus the Shape field of the involved feature class are in the subfields, then
                //   in those same cases a "Shape Integrity Error" exception is thrown.
                foreach (FieldMappingRowProxy row in
                         GdbQueryUtils.GetRowProxys((IObjectClass)table,
                                                    testPerimeter,
                                                    whereClause,
                                                    relClassChain,
                                                    postfixClause,
                                                    subfields: null, includeOnlyOIDFields: true,
                                                    recycle: true))
                {
                    result.Add(row.OID);
                }
            }

            _msg.DebugStopTiming(watch, "GetOIDsByRelatedGeometry() table: {0} test: {1}",
                                 tableName, testWithTable);

            return(result);
        }
Example #3
0
        public void CanGetProxiesNonSpatial1()
        {
            IFeatureWorkspace  ws = OpenTestWorkspace();
            IRelationshipClass rc =
                ws.OpenRelationshipClass("TOPGIS_TLM.TLM_STRASSEN_NAMENSTEIL_NAME");

            NUnit.Framework.Assert.AreEqual(rc.Cardinality,
                                            esriRelCardinality.esriRelCardinalityOneToMany);

            foreach (
                IRow row in
                GdbQueryUtils.GetRowProxys(rc.OriginClass, null,
                                           new[] { rc }))
            {
                NUnit.Framework.Assert.AreEqual(row.Table, rc.OriginClass);
                NUnit.Framework.Assert.Greater(row.OID, 0);
            }
        }
Example #4
0
        public void CanGetProxiesSpatial()
        {
            IFeatureWorkspace  ws = OpenTestWorkspace();
            IRelationshipClass rc =
                ws.OpenRelationshipClass("TOPGIS_TLM.TLM_STRASSE_NAME");

            NUnit.Framework.Assert.AreEqual(rc.Cardinality,
                                            esriRelCardinality.esriRelCardinalityOneToMany);

            foreach (IRow row in GdbQueryUtils.GetRowProxys(rc.OriginClass,
                                                            GeometryFactory.CreatePolygon(
                                                                2696300, 1264100, 2696400,
                                                                1264130),
                                                            new[] { rc }))
            {
                NUnit.Framework.Assert.AreEqual(row.Table, rc.OriginClass);
                NUnit.Framework.Assert.Greater(row.OID, 0);
            }
        }