private AreaSpecification GetDefaultAreaSpecification( [CanBeNull] string datasetName) { if (_areaSpecifications.Count == 0) { return(null); } // TODO make this more explicit AreaSpecification candidate = _areaSpecifications[0]; if (candidate.HasPerimeter) { // it's not a default specification return(null); } // TODO REFACTORMODEL invalid use of class name if (datasetName != null && !candidate.IsVerifiedDataset(datasetName)) { return(null); } // the first non-polygon area spec is used as default // if either the dataset name is not specified or if the // first area spec involves the specified dataset name. return(candidate); }
private List <AreaSpecification> CalculateAreaSpecifications( [NotNull] IFeature feature, bool ignoreTestPerimeter) { if (_areaSpecifications.Count == 0) { return(null); } var result = new List <AreaSpecification>(); var featurePerimeterRelation = new FeaturePerimeterRelation( feature, _envelopeTemplate, !ignoreTestPerimeter ? _currentTile : null, ignoreCurrentTileRelation: ignoreTestPerimeter); // TODO REFACTORMODEL invalid use of class name string datasetName = GetDatasetName(feature).ToUpper(); bool belongsToVerifiedDataset = IsVerifiedDataset(datasetName); var containingPrimaryAreaSpecificationFound = false; int areaSpecCount = _areaSpecifications.Count; for (int index = areaSpecCount - 1; index >= 0; index--) { AreaSpecification areaSpecification = _areaSpecifications[index]; if (belongsToVerifiedDataset && areaSpecification.HasVerifiedDatasets() && !areaSpecification.IsVerifiedDataset(datasetName)) { // the area specification has involved datasets, but the (verified) // dataset is not part of it --> skip this area specification // BUT: the area specification may still be the primary specification, if // the dataset is editable in the area specification (and the feature intersects) // -> rearrange logic continue; } // either the dataset is not (directly) involved in any quality condition (of all qspecs involved in the run) // (could be indirect, e.g. feature class involved in topology or geometric network) // OR it IS involved (generally) AND it is involved in this area specification // OR the area specification has no involved datasets (??) if (featurePerimeterRelation.Intersects(areaSpecification)) { if (areaSpecification.IsEditableDataset(datasetName) && featurePerimeterRelation.IsWithin(areaSpecification)) { containingPrimaryAreaSpecificationFound = true; } // the shape intersects the (defined) area specification polygon result.Add(areaSpecification); } } if (!containingPrimaryAreaSpecificationFound) { AreaSpecification defaultAreaSpecification = GetDefaultAreaSpecification(datasetName); if (defaultAreaSpecification != null) { result.Add(defaultAreaSpecification); } } return(result); }