예제 #1
0
            /// <summary>
            /// Deserializes the XYPlotLayerCollection Version 0.
            /// </summary>
            /// <param name="obj">The empty GraphDocument object to deserialize into.</param>
            /// <param name="info">The serialization info.</param>
            /// <param name="context">The streaming context.</param>
            /// <param name="selector">The deserialization surrogate selector.</param>
            /// <returns>The deserialized GraphDocument.</returns>
            public object SetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.ISurrogateSelector selector)
            {
                XYPlotLayerCollection s = (XYPlotLayerCollection)obj;

                s.myList = (System.Collections.ArrayList)info.GetValue("Data", typeof(System.Collections.ArrayList));
                return(s);
            }
예제 #2
0
        public GraphDocument(GraphDocument from)
        {
            this._changedEventSuppressor = new EventSuppressor(this.EhChangedEventResumes);
            this._pageBounds             = from._pageBounds;
            this._printableBounds        = from._printableBounds;
            _creationTime = _lastChangeTime = DateTime.UtcNow;
            this._notes   = from._notes;


            // Clone also the table properties (deep copy)
            if (from._graphProperties != null)
            {
                foreach (string key in from._graphProperties.Keys)
                {
                    ICloneable val = from._graphProperties[key] as ICloneable;
                    if (null != val)
                    {
                        this.SetGraphProperty(key, val.Clone());
                    }
                }
            }

            // the order is important here: clone the layers only before setting the printable graph bounds and other
            // properties, otherwise some errors will happen
            this._layers = (XYPlotLayerCollection)from._layers.Clone();
            this._layers.ParentObject = this;
        }
예제 #3
0
 /// <summary>
 /// Creates a empty GraphDocument with no layers and a standard size of A4 landscape.
 /// </summary>
 public GraphDocument()
 {
     this._changedEventSuppressor = new EventSuppressor(this.EhChangedEventResumes);
     this._layers = new XYPlotLayerCollection();
     this._layers.ParentObject = this;
     SetGraphPageBoundsToPrinterSettings();
     this._layers.SetPrintableGraphBounds(_printableBounds, false);
     _creationTime = _lastChangeTime = DateTime.UtcNow;
 }
예제 #4
0
            public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                XYPlotLayerCollection s = (XYPlotLayerCollection)obj;

                info.CreateArray("LayerArray", s.Count);
                for (int i = 0; i < s.Count; i++)
                {
                    info.AddValue("XYPlotLayer", s[i]);
                }
                info.CommitArray();
            }
예제 #5
0
                public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
                {
                    XYPlotLayerCollection s = null != o ? (XYPlotLayerCollection)o : new XYPlotLayerCollection();

                    int count = info.OpenArray();

                    for (int i = 0; i < count; i++)
                    {
                        var l = (XYPlotLayer)info.GetValue("XYPlotLayer", s);
                        s.Add(l);
                    }
                    info.CloseArray(count);

                    return(s);
                }
예제 #6
0
        /// <summary>
        /// Copy constructor. Clones all objects in this collection.
        /// </summary>
        /// <param name="from">The collection to clone from.</param>
        public XYPlotLayerCollection(XYPlotLayerCollection from)
        {
            _changeEventSuppressor = new Altaxo.Main.EventSuppressor(this.EhChangeEventResumed);
            this.m_PrintableBounds = from.m_PrintableBounds;

            for (int i = 0; i < from.Count; i++)
            {
                this.Add((XYPlotLayer)from[i].Clone());
            }

            // now we have to fix the linked layer list, since the LinkedLayer property of the Layers point to the original layers
            // and not to the cloned layers!
            for (int i = 0; i < Count; i++)
            {
                if (null != from[i].LinkedLayer)
                {
                    this[i].LinkedLayer = this[from[i].LinkedLayer.Number];
                }
            }
        }
예제 #7
0
    /// <summary>
    ///  Only intended to use by XYPlotLayerCollection! Sets the parent layer collection for this layer.
    /// </summary>
    /// <param name="lc">The layer collection this layer belongs to.</param>
    /// <param name="number">The layer number assigned to this layer.</param>
    protected internal void SetParentAndNumber(XYPlotLayerCollection lc, int number)
    {
      _parent = lc;
      _layerNumber = number;

      if (_parent == null)
        _linkedLayer = null;
    }
예제 #8
0
    public GraphDocument(GraphDocument from)
    {
      this._changedEventSuppressor = new EventSuppressor(this.EhChangedEventResumes);
      this._pageBounds = from._pageBounds;
      this._printableBounds = from._printableBounds;
      _creationTime = _lastChangeTime = DateTime.UtcNow;
      this._notes = from._notes;


      // Clone also the table properties (deep copy)
      if(from._graphProperties!=null)
      {
        foreach(string key in from._graphProperties.Keys)
        {
          ICloneable val = from._graphProperties[key] as ICloneable;
          if(null!=val)
            this.SetGraphProperty(key,val.Clone());
        }
      }

      // the order is important here: clone the layers only before setting the printable graph bounds and other
      // properties, otherwise some errors will happen
      this._layers = (XYPlotLayerCollection)from._layers.Clone();
      this._layers.ParentObject = this;

    }
예제 #9
0
 /// <summary>
 /// Creates a empty GraphDocument with no layers and a standard size of A4 landscape.
 /// </summary>
 public GraphDocument()
 {
   this._changedEventSuppressor = new EventSuppressor(this.EhChangedEventResumes);
   this._layers = new XYPlotLayerCollection();
   this._layers.ParentObject = this;
   SetGraphPageBoundsToPrinterSettings();
   this._layers.SetPrintableGraphBounds(_printableBounds, false);
   _creationTime = _lastChangeTime = DateTime.UtcNow;
 }
    /// <summary>
    /// Copy constructor. Clones all objects in this collection.
    /// </summary>
    /// <param name="from">The collection to clone from.</param>
    public XYPlotLayerCollection(XYPlotLayerCollection from)
    {
      _changeEventSuppressor = new Altaxo.Main.EventSuppressor(this.EhChangeEventResumed);
      this.m_PrintableBounds = from.m_PrintableBounds;

      for(int i=0;i<from.Count;i++)
        this.Add((XYPlotLayer)from[i].Clone());
  
      // now we have to fix the linked layer list, since the LinkedLayer property of the Layers point to the original layers
      // and not to the cloned layers!
      for(int i=0;i<Count;i++)
      {
        if(null!=from[i].LinkedLayer)
        {
          this[i].LinkedLayer = this[from[i].LinkedLayer.Number];
        }
      }
    }
예제 #11
0
            /// <summary>
            /// Serializes XYPlotLayerCollection Version 0.
            /// </summary>
            /// <param name="obj">The XYPlotLayerCollection to serialize.</param>
            /// <param name="info">The serialization info.</param>
            /// <param name="context">The streaming context.</param>
            public void GetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
            {
                XYPlotLayerCollection s = (XYPlotLayerCollection)obj;

                info.AddValue("Data", s.myList);
            }