/// <summary> /// merged boundaries of another object into this object /// </summary> /// <param name="b">another physical boundary object of the same type as this</param> public virtual void Add(NumericalBoundaries b) { if (GetType() == b.GetType()) { if (b._numberOfItems > 0) { BoundariesChangedData data = BoundariesChangedData.NumberOfItemsChanged; _numberOfItems += b._numberOfItems; if (b._minValue < _minValue) { _minValue = b._minValue; data |= BoundariesChangedData.LowerBoundChanged; } if (b._maxValue > _maxValue) { _maxValue = b._maxValue; data |= BoundariesChangedData.UpperBoundChanged; } if (!IsSuspended) // performance tweak, see overrides OnSuspended and OnResume for details (if suspended, we have saved the state of the instance for comparison when we resume). { EhSelfChanged(new BoundariesChangedEventArgs(data)); } } } else { throw new ArgumentException("Argument has not the same type as this, argument type: " + b.GetType().ToString() + ", this type: " + GetType().ToString()); } }
/// <summary> /// merged boundaries of another object into this object /// </summary> /// <param name="b">another physical boundary object of the same type as this</param> public virtual void Add(NumericalBoundaries b) { if (this.GetType() == b.GetType()) { if (b._numberOfItems > 0) { bool bLower = false, bUpper = false; _numberOfItems += b._numberOfItems; if (b._minValue < _minValue) { _minValue = b._minValue; bLower = true; } if (b._maxValue > _maxValue) { _maxValue = b._maxValue; bUpper = true; } if (EventsEnabled) { OnNumberOfItemsChanged(); // fire item number event if (bLower || bUpper) { OnBoundaryChanged(bLower, bUpper); } } } } else { throw new ArgumentException("Argument has not the same type as this, argument type: " + b.GetType().ToString() + ", this type: " + this.GetType().ToString()); } }
public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info) { NumericalBoundaries s = (NumericalBoundaries)obj; info.AddValue("NumberOfItems", s._numberOfItems); info.AddValue("MinValue", s._minValue); info.AddValue("MaxValue", s._maxValue); }
public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { NumericalBoundaries s = (NumericalBoundaries)o; s._numberOfItems = info.GetInt32("NumberOfItems"); s._minValue = info.GetDouble("MinValue"); s._maxValue = info.GetDouble("MaxValue"); return(s); }
/// <summary> /// Copy constructor. /// </summary> /// <param name="from">A other linear axis from which to copy from.</param> public LinearScale(LinearScale from) { this.IsLinked = from.IsLinked; this._cachedAxisEnd = from._cachedAxisEnd; this._axisEndByMajor = from._axisEndByMajor; this._cachedAxisOrg = from._cachedAxisOrg; this._axisOrgByMajor = from._axisOrgByMajor; this._cachedAxisSpan = from._cachedAxisSpan; this._baseEnd = from._baseEnd; this._baseOrg = from._baseOrg; this._dataBounds = null == from._dataBounds ? new FiniteNumericalBoundaries() : (NumericalBoundaries)from._dataBounds.Clone(); _dataBounds.ParentObject = this; this._majorSpan = from._majorSpan; this._minorTicks = from._minorTicks; this._cachedOneByAxisSpan = from._cachedOneByAxisSpan; this._rescaling = null == from.Rescaling ? new LinearScaleRescaleConditions() : (LinearScaleRescaleConditions)from.Rescaling.Clone(); this._rescaling.ParentObject = this; }
/// <summary> /// Creates a default linear axis with org=0 and end=1. /// </summary> public LinearScale() { _dataBounds = new FiniteNumericalBoundaries(); _dataBounds.ParentObject = this; }
/// <summary> /// Creates a default logarithmic axis with org=1 and end=10. /// </summary> public Log10Scale() { _dataBounds = new PositiveFiniteNumericalBoundaries() { ParentObject = this }; _rescaling = new LogarithmicScaleRescaleConditions() { ParentObject = this }; _tickSpacing = new Ticks.Log10TickSpacing() { ParentObject = this }; UpdateTicksAndOrgEndUsingRescalingObject(); }
public virtual void CopyFrom(LinearScale from) { this._cachedAxisEnd = from._cachedAxisEnd; this._axisEndByMajor = from._axisEndByMajor; this._cachedAxisOrg = from._cachedAxisOrg; this._axisOrgByMajor = from._axisOrgByMajor; this._cachedAxisSpan = from._cachedAxisSpan; this._baseEnd = from._baseEnd; this._baseOrg = from._baseOrg; if(null!=_dataBounds) _dataBounds.BoundaryChanged -= new BoundaryChangedHandler(this.OnBoundariesChanged); this._dataBounds = null==from._dataBounds ? new FiniteNumericalBoundaries() : (NumericalBoundaries)from._dataBounds.Clone(); _dataBounds.BoundaryChanged += new BoundaryChangedHandler(this.OnBoundariesChanged); this._majorSpan = from._majorSpan; this._minorTicks = from._minorTicks; this._cachedOneByAxisSpan = from._cachedOneByAxisSpan; this._rescaling = null==from.Rescaling ? new NumericAxisRescaleConditions() : (NumericAxisRescaleConditions)from.Rescaling.Clone(); }
/// <summary> /// Creates a default linear axis with org=0 and end=1. /// </summary> public LinearScale() { _dataBounds = new FiniteNumericalBoundaries() { ParentObject = this }; _rescaling = new LinearScaleRescaleConditions() { ParentObject = this }; _tickSpacing = new Ticks.LinearTickSpacing() { ParentObject = this }; UpdateTicksAndOrgEndUsingRescalingObject(); }
/// <summary> /// Creates a default logarithmic axis with org=1 and end=10. /// </summary> public Log10Scale() { _rescaling = new LogarithmicScaleRescaleConditions() { ParentObject = this }; _dataBounds = new PositiveFiniteNumericalBoundaries() { ParentObject = this }; }
/// <summary> /// Creates a default linear axis with org=0 and end=1. /// </summary> public InverseScale() { _dataBounds = new InverseNumericalBoundaries() { ParentObject = this }; _rescaling = new InverseScaleRescaleConditions() { ParentObject = this }; _tickSpacing = new Ticks.InverseTickSpacing() { ParentObject = this }; UpdateTicksAndOrgEndUsingRescalingObject(); }
public NumericalBoundaries(NumericalBoundaries x) : base(x) { _minValue = x._minValue; _maxValue = x._maxValue; }
/// <summary> /// merged boundaries of another object into this object /// </summary> /// <param name="b">another physical boundary object of the same type as this</param> public virtual void Add(NumericalBoundaries b) { if(this.GetType()==b.GetType()) { if(b._numberOfItems>0) { bool bLower=false,bUpper=false; _numberOfItems += b._numberOfItems; if(b._minValue < _minValue) { _minValue = b._minValue; bLower=true; } if(b._maxValue > _maxValue) { _maxValue = b._maxValue; bUpper=true; } if(EventsEnabled) { OnNumberOfItemsChanged(); // fire item number event if(bLower||bUpper) OnBoundaryChanged(bLower,bUpper); } } } else { throw new ArgumentException("Argument has not the same type as this, argument type: " + b.GetType().ToString() + ", this type: " +this.GetType().ToString()); } }
/// <summary> /// Copy constructor. /// </summary> /// <param name="from">The axis to copy from.</param> public Log10Scale(Log10Scale from) { this.IsLinked = from.IsLinked; this._dataBounds = null==from._dataBounds ? new PositiveFiniteNumericalBoundaries() : (NumericalBoundaries)from._dataBounds.Clone(); _dataBounds.BoundaryChanged += new BoundaryChangedHandler(this.OnBoundariesChanged); this._decadesPerMajorTick = from._decadesPerMajorTick; this._log10End = from._log10End; this._log10Org = from._log10Org; this._rescaling = null==from.Rescaling ? new LogarithmicAxisRescaleConditions() : (LogarithmicAxisRescaleConditions)from.Rescaling.Clone(); }
/// <summary> /// Creates a default logarithmic axis with org=1 and end=10. /// </summary> public Log10Scale() { _dataBounds = new PositiveFiniteNumericalBoundaries(); _dataBounds.BoundaryChanged += new BoundaryChangedHandler(this.OnBoundariesChanged); }
/// <summary> /// Copy constructor. /// </summary> /// <param name="from">The axis to copy from.</param> public Log10Scale(Log10Scale from) { this.IsLinked = from.IsLinked; this._dataBounds = null == from._dataBounds ? new PositiveFiniteNumericalBoundaries() { ParentObject = this } : (NumericalBoundaries)from._dataBounds.Clone(); this._dataBounds.ParentObject = this; this._decadesPerMajorTick = from._decadesPerMajorTick; this._log10End = from._log10End; this._log10Org = from._log10Org; this._rescaling = null == from.Rescaling ? new LogarithmicScaleRescaleConditions() { ParentObject = this } : (LogarithmicScaleRescaleConditions)from.Rescaling.Clone(); this._rescaling.ParentObject = this; }
protected override System.Collections.Generic.IEnumerable<Main.DocumentNodeAndName> GetDocumentNodeChildrenWithName() { if (null != _dataBounds) yield return new Main.DocumentNodeAndName(_dataBounds, () => _dataBounds = null, "DataBounds"); if (null != _rescaling) yield return new Main.DocumentNodeAndName(_rescaling, () => _rescaling = null, "Rescaling"); if (null != _tickSpacing) yield return new Main.DocumentNodeAndName(_tickSpacing, () => _tickSpacing = null, "TickSpacing"); }
/// <summary> /// Creates a default linear axis with org=0 and end=1. /// </summary> public LinearScale() { _dataBounds = new FiniteNumericalBoundaries(); _dataBounds.BoundaryChanged += new BoundaryChangedHandler(this.OnBoundariesChanged); }