public QAException FindException(DataQualityError error) { if (error == null) return null; if (this._exceptions == null || error.ErrorType.Equals(this._currentErrorType) == false) { // Need to load exceptions in this operationalDSName of this type this.LoadExceptions(error.ErrorType); } // Find an exception at the same lat and long // This might need optimization // Possible to have nulls in the array // SJB added description to discrimination. If tests start writing unique // strings in the descriptions of the errors, that will make a difference. for (int i = 0; i < this._exceptions.Length; i++) { if (this._exceptions[i] != null) { if (Math.Round(this._exceptions[i].Latitude, 5) == Math.Round(error.Location.Y, 5) && Math.Round(this._exceptions[i].Longitude, 5) == Math.Round(error.Location.X, 5) && this._exceptions[i].Description.Equals(error.Description)) return this._exceptions[i]; } } return null; }
private void WriteToFeature(DataQualityError error, IFeature feature, string operationalDSName) { // Shape feature.Shape = error.Location; // Attributes int idx; idx = feature.Fields.FindField("ATTACHMENT"); feature.set_Value(idx, error.ExtendedData); idx = feature.Fields.FindField("DESCRIPTION"); feature.set_Value(idx, error.Description); idx = feature.Fields.FindField("DATA_EXCEPTION_STATUS"); feature.set_Value(idx, error.Status); idx = feature.Fields.FindField("LATITUDE"); feature.set_Value(idx, error.Location.Y); idx = feature.Fields.FindField("LONGITUDE"); feature.set_Value(idx, error.Location.X); idx = feature.Fields.FindField("OPERATIONAL_DATASET_NAME"); feature.set_Value(idx, operationalDSName); idx = feature.Fields.FindField("QA_TEST_NAME"); feature.set_Value(idx, error.ErrorType); idx = feature.Fields.FindField("SEVERITY"); feature.set_Value(idx, error.Severity); idx = feature.Fields.FindField("CAN_DEFER"); feature.set_Value(idx, error.CanDefer ? "YES" : "NO"); idx = feature.Fields.FindField("CAN_EXCEPT"); feature.set_Value(idx, error.CanExcept ? "YES" : "NO"); feature.Store(); }
private dao.QAError ReadFromFeature(IFeature feature) { int idx; idx = feature.Fields.FindField("QA_TEST_NAME"); string theType = (string)feature.get_Value(idx); idx = feature.Fields.FindField("CAN_DEFER"); bool canDefer = feature.get_Value(idx).ToString().Equals("YES"); idx = feature.Fields.FindField("CAN_EXCEPT"); bool canExcept = feature.get_Value(idx).ToString().Equals("YES"); DataQualityError theDQError = new DataQualityError(theType, canDefer, canExcept); // Shape theDQError.Location = (IPoint)feature.ShapeCopy; // Attributes idx = feature.Fields.FindField("ATTACHMENT"); theDQError.ExtendedData = (string)feature.get_Value(idx); idx = feature.Fields.FindField("DESCRIPTION"); theDQError.Description = (string)feature.get_Value(idx); idx = feature.Fields.FindField("DATA_EXCEPTION_STATUS"); theDQError.Status = (string)feature.get_Value(idx); idx = feature.Fields.FindField("SEVERITY"); theDQError.Severity = (int)feature.get_Value(idx); idx = feature.Fields.FindField("OPERATIONAL_DATASET_NAME"); string operDSName = (string)feature.get_Value(idx); dao.QAError theError = new QAError(feature.OID, theDQError, operDSName); return theError; }
public void SetNewErrors(DataQualityError[] errors, string operationalDSName) { this.ClearErrors(); if (errors == null) return; this._errors = new dao.QAError[errors.Length]; for (int i = 0; i < errors.Length; i++) { if (errors[i] != null) this._errors[i] = new dao.QAError(-1, errors[i], operationalDSName); } this.FilterNulls(); try { IGeoDataset theGeoDS = (IGeoDataset)this._errorFC; for (int i = 0; i < this._errors.Length; i++) { IFeature theFeature = this._errorFC.CreateFeature(); dao.QAError theError = this._errors[i]; theError.Error.Location.Project(theGeoDS.SpatialReference); try { this.WriteToFeature(theError.Error, theFeature, operationalDSName); theError.ObjectID = theFeature.OID; } catch (Exception ex) { if (ex.Message.IndexOf("out of bounds") >= 0) { util.Logger.Write("Recorded an error out of bounds at (" + theError.Latitude + ", " + theError.Longitude + ")" + Environment.NewLine + theError.Error.ExtendedData); this._errors[i] = null; } else throw ex; } } this.FilterNulls(); this._isValid = true; } catch (Exception ex) { throw new ErrorStorageException("Error raised when storing all errors in personal geodatabase", ex); } }
public void SetNewErrors(ArrayList errors, string operationalDSName) { DataQualityError[] theErrorArray = null; if (errors != null) { theErrorArray = new DataQualityError[errors.Count]; for (int i = 0; i < errors.Count; i++) { if (errors[i] is DataQualityError) theErrorArray[i] = (DataQualityError)errors[i]; } } this.SetNewErrors(theErrorArray, operationalDSName); }
public QAError(int objectId, DataQualityError error, string operationalDSname) { this._oid = objectId; this._error = error; this._operationalDSName = operationalDSname; }