// TODO document/private? public QaConnections( IList <IFeatureClass> featureClasses, IList <QaConnectionRule> rules, double tolerance) : base( CastToTables((IEnumerable <IFeatureClass>)featureClasses), tolerance, false, null) { _ruleHelpers = QaConnectionRuleHelper.CreateList(rules, out _tableFilterHelpers); }
private int GetMatchingRowsCount(int tableIndex, [NotNull] QaConnectionRuleHelper ruleHelper) { TableView helper = ruleHelper.MainRuleFilterHelpers[tableIndex]; return(helper == null ? _tableFilterHelpers[tableIndex].FilteredRowCount : helper.FilteredRowCount); }
private void Init([NotNull] ICollection <string[]> rules) { var ruleList = new List <QaConnectionRule>(rules.Count); foreach (string[] rule in rules) { ruleList.Add(new QaConnectionRule(InvolvedTables, rule)); } _ruleHelpers = QaConnectionRuleHelper.CreateList(ruleList, out _tableFilterHelpers); }
private bool HandleAsFlat(NeighboredSegmentsSubpart segmentPart, double fullFraction, ContinuationFinder continuationFinder) { var p = new FeaturePoint(segmentPart.BaseFeature, segmentPart.TableIndex, segmentPart.PartIndex, fullFraction); List <NeighboredSegmentsSubpart> continuations = continuationFinder.GetContinuations(p, new List <SegmentsSubpart>(), false); if (continuations == null) { return(AdaptUnconnected); } var junctionSegments = new List <NeighboredSegmentsSubpart>(); foreach (NeighboredSegmentsSubpart continuation in continuations) { if (p.Feature == continuation.BaseFeature && p.TableIndex == continuation.TableIndex && p.Part == continuation.PartIndex && Math.Abs(p.FullFraction - continuation.FullStartFraction) < 0.01) { junctionSegments.Add(continuation); continue; } if (NotReportedCondition != null && NotReportedCondition.IsFulfilled(segmentPart.BaseFeature, segmentPart.TableIndex, continuation.BaseFeature, continuation.TableIndex)) { continue; } if (string.IsNullOrEmpty(JunctionIsEndExpression)) { return(false); } junctionSegments.Add(continuation); } if (junctionSegments.Count > 0) { var rule = new QaConnectionRule(new[] { junctionSegments[0].BaseFeature.Table }, new List <string> { JunctionIsEndExpression }); TableView[] tableFilterHelpers; IList <QaConnectionRuleHelper> helpers = QaConnectionRuleHelper.CreateList( new[] { rule }, out tableFilterHelpers); foreach (NeighboredSegmentsSubpart junctionSegment in junctionSegments) { int tableIndex = junctionSegment.TableIndex; TableView baseHelper = tableFilterHelpers[tableIndex]; DataRow helperRow = baseHelper.Add(junctionSegment.BaseFeature); Assert.NotNull(helperRow, "no row returned"); { helperRow[QaConnections.StartsIn] = segmentPart.FullStartFraction < segmentPart.FullEndFraction; } } foreach (QaConnectionRuleHelper ruleHelper in helpers) { // check if all rows comply to the current rule int connectedElementsCount = junctionSegments.Count; var matchingRowsCount = 0; for (var tableIndex = 0; tableIndex < 1; tableIndex++) { matchingRowsCount += ruleHelper .MainRuleFilterHelpers[tableIndex] .FilteredRowCount; } Assert.True(matchingRowsCount <= connectedElementsCount, "Unexpected matching rows count: {0}; total connected rows: {1}", matchingRowsCount, connectedElementsCount); if (matchingRowsCount == connectedElementsCount && ruleHelper.VerifyCountRules()) { // all rows comply to the current rule, // so one rule if fulfilled and no further checking needed return(true); } } } return(AdaptUnconnected); }