示例#1
0
        /// <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());
            }
        }
示例#2
0
        /// <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());
            }
        }
示例#3
0
            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);
            }
示例#4
0
            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);
            }
示例#5
0
		/// <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;
		}
示例#6
0
		/// <summary>
		/// Creates a default linear axis with org=0 and end=1.
		/// </summary>
		public LinearScale()
		{
			_dataBounds = new FiniteNumericalBoundaries();
			_dataBounds.ParentObject = this;
		}
示例#7
0
		/// <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();
		}
示例#8
0
    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();
    }
示例#9
0
		/// <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();
		}
示例#10
0
		/// <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 };
		}
示例#11
0
		/// <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());
      }
    }
示例#14
0
    /// <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();

    }
示例#15
0
 /// <summary>
 /// Creates a default logarithmic axis with org=1 and end=10.
 /// </summary>
 public Log10Scale()
 {
   _dataBounds = new PositiveFiniteNumericalBoundaries();
   _dataBounds.BoundaryChanged += new BoundaryChangedHandler(this.OnBoundariesChanged);
 }
示例#16
0
 public NumericalBoundaries(NumericalBoundaries x)
     : base(x)
 {
     _minValue = x._minValue;
     _maxValue = x._maxValue;
 }
示例#17
0
		/// <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;
		}
示例#18
0
		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");
		}
示例#19
0
 /// <summary>
 /// Creates a default linear axis with org=0 and end=1.
 /// </summary>
 public LinearScale()
 {
   _dataBounds = new FiniteNumericalBoundaries();
   _dataBounds.BoundaryChanged += new BoundaryChangedHandler(this.OnBoundariesChanged);
 }