/// <summary> /// Adds the specified SimpleCurve to the SimpleMeasurement. /// </summary> /// <param name="simpleCurve">The SimpleCurve.</param> /// <param name="silent">if set to <c>true</c> [silent] the SimpleCurveAdded event is not raised.</param> /// <exception cref="System.ArgumentNullException">The specified SimpleCurve is null.</exception> /// <exception cref="System.ArgumentException">This measurement allready contains the specified SimpleCurve.</exception> public void AddSimpleCurve(SimpleCurve simpleCurve, bool silent = false) { if (simpleCurve == null) { throw new ArgumentNullException("The specified SimpleCurve is null."); } if (ContainsSimpleCurve(simpleCurve)) { throw new ArgumentException("This SimpleMeasurement allready contains the specified SimpleCurve."); } SimpleCurveCollection.Add(simpleCurve); //Add the SimpleCurve to this SimpleMeasurement. if (!Measurement.ContainsCurve(simpleCurve.Curve)) { if (!silent) { Measurement.AddCurve(simpleCurve.Curve); //Add the original Curve to the orginal Measurement. } else { Measurement.AddCurveSilent(simpleCurve.Curve); //Add the original Curve to the orginal Measurement without raising the curve added event. } } if (!silent) { OnSimpleCurveAdded(simpleCurve); } }
/// <summary> /// Removes the specified SimpleCurves from the SimpleMeasurement. /// </summary> /// <param name="simpleCurve">The simple curve.</param> /// <param name="silent">if set to <c>true</c> [silent] the SimpleCurveRemoved even is not raised.</param> /// <exception cref="System.ArgumentNullException">The specified SimpleCurve is null.</exception> /// <exception cref="System.ArgumentException">This SimpleMeasurement does not contain the specified SimpleCurve</exception> public void RemoveSimpleCurve(SimpleCurve simpleCurve, bool silent = false) { if (simpleCurve == null) { throw new ArgumentNullException("The specified SimpleCurve is null."); } if (!ContainsSimpleCurve(simpleCurve)) { throw new ArgumentException("This SimpleMeasurement does not contain the specified SimpleCurve"); } Measurement.RemoveCurve(simpleCurve.Curve); //Removes the original curve from the original measurement SimpleCurveCollection.Remove(simpleCurve); //Removes the SimpleCurve from the SimpleMeasurement if (!silent) { OnSimpleCurveRemoved(simpleCurve); } }
/// <summary> /// Determines whether this SimpleMeasurement contains [the specified simple curve]. /// </summary> /// <param name="simpleCurve">The simple curve.</param> /// <returns> /// <c>true</c> if the measurement contains [the specified simple curve]; otherwise, <c>false</c>. /// </returns> public bool ContainsSimpleCurve(SimpleCurve simpleCurve) { return(SimpleCurveCollection.Contains(simpleCurve)); }