Exemplo n.º 1
0
            public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
            {
                XYZMeshedColumnPlotData s = null != o ? (XYZMeshedColumnPlotData)o : new XYZMeshedColumnPlotData();

                var _xColumn = (IReadableColumnProxy)info.GetValue("XColumn", s);
                var _yColumn = (IReadableColumnProxy)info.GetValue("YColumn", s);

                int count        = info.OpenArray();
                var _dataColumns = new IReadableColumnProxy[count];

                for (int i = 0; i < count; i++)
                {
                    _dataColumns[i] = (IReadableColumnProxy)info.GetValue("e", s);
                }
                info.CloseArray(count);

#pragma warning disable 618
                s._matrixProxy = new DataTableMatrixProxy(_xColumn, _yColumn, _dataColumns);
#pragma warning restore 618

                s._xBoundaries = (IPhysicalBoundaries)info.GetValue("XBoundaries", s);
                s._yBoundaries = (IPhysicalBoundaries)info.GetValue("YBoundaries", s);
                s._vBoundaries = (IPhysicalBoundaries)info.GetValue("VBoundaries", s);

                s._matrixProxy.ParentObject = s;
                s._xBoundaries.ParentObject = s;
                s._yBoundaries.ParentObject = s;
                s._vBoundaries.ParentObject = s;

                s._isCachedDataValid = false;

                return(s);
            }
Exemplo n.º 2
0
        /// <summary>
        /// Copy constructor.
        /// </summary>
        /// <param name="from">The object to copy from.</param>
        /// <remarks>Only clones the references to the data columns, not the columns itself.</remarks>
        public XYZMeshedColumnPlotData(XYZMeshedColumnPlotData from)
        {
            CopyHelper.Copy(ref _matrixProxy, from._matrixProxy);
            _matrixProxy.ParentObject = this;

            SetXBoundsFromTemplate(new FiniteNumericalBoundaries());
            SetYBoundsFromTemplate(new FiniteNumericalBoundaries());
            SetVBoundsFromTemplate(new FiniteNumericalBoundaries());
        }
            /// <summary>
            /// Serializes XYZEquidistantMeshColumnPlotData Version 0.
            /// </summary>
            /// <param name="obj">The XYZEquidistantMeshColumnPlotData 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)
            {
                XYZMeshedColumnPlotData s = (XYZMeshedColumnPlotData)obj;

                info.AddValue("XColumn", s.m_XColumn);
                info.AddValue("YColumn", s.m_YColumn);
                info.AddValue("DataColumns", s.m_DataColumns);

                info.AddValue("XBoundaries", s.m_xBoundaries);
                info.AddValue("YBoundaries", s.m_yBoundaries);
                info.AddValue("VBoundaries", s.m_vBoundaries);
            }
            /// <summary>
            /// Deserializes theD2EquidistantMeshDataAssociation Version 0.
            /// </summary>
            /// <param name="obj">The empty XYZEquidistantMeshColumnPlotData 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 XYZEquidistantMeshColumnPlotData.</returns>
            public object SetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.ISurrogateSelector selector)
            {
                XYZMeshedColumnPlotData s = (XYZMeshedColumnPlotData)obj;


                s.m_XColumn     = (Altaxo.Data.INumericColumn)info.GetValue("XColumn", typeof(Altaxo.Data.INumericColumn));
                s.m_YColumn     = (Altaxo.Data.INumericColumn)info.GetValue("YColumn", typeof(Altaxo.Data.INumericColumn));
                s.m_DataColumns = (Altaxo.Data.IReadableColumn[])info.GetValue("DataColumns", typeof(Altaxo.Data.IReadableColumn[]));

                s.m_xBoundaries = (NumericalBoundaries)info.GetValue("XBoundaries", typeof(NumericalBoundaries));
                s.m_yBoundaries = (NumericalBoundaries)info.GetValue("YBoundaries", typeof(NumericalBoundaries));
                s.m_vBoundaries = (NumericalBoundaries)info.GetValue("VBoundaries", typeof(NumericalBoundaries));

                return(s);
            }
Exemplo n.º 5
0
            public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
            {
                XYZMeshedColumnPlotData s = null != o ? (XYZMeshedColumnPlotData)o : new XYZMeshedColumnPlotData();

                s._matrixProxy = (DataTableMatrixProxy)info.GetValue("MatrixProxy", s);

                s._xBoundaries = (IPhysicalBoundaries)info.GetValue("XBoundaries", s);
                s._yBoundaries = (IPhysicalBoundaries)info.GetValue("YBoundaries", s);
                s._vBoundaries = (IPhysicalBoundaries)info.GetValue("VBoundaries", s);

                s._matrixProxy.ParentObject = s;
                s._xBoundaries.ParentObject = s;
                s._yBoundaries.ParentObject = s;
                s._vBoundaries.ParentObject = s;

                s._isCachedDataValid = false;

                return(s);
            }
            public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                XYZMeshedColumnPlotData s = (XYZMeshedColumnPlotData)obj;

                if (s.m_XColumn is Main.IDocumentNode && !s.Equals(((Main.IDocumentNode)s.m_XColumn).ParentObject))
                {
                    info.AddValue("XColumn", Main.DocumentPath.GetAbsolutePath((Main.IDocumentNode)s.m_XColumn));
                }
                else
                {
                    info.AddValue("XColumn", s.m_XColumn);
                }

                if (s.m_YColumn is Main.IDocumentNode && !s.Equals(((Main.IDocumentNode)s.m_YColumn).ParentObject))
                {
                    info.AddValue("YColumn", Main.DocumentPath.GetAbsolutePath((Main.IDocumentNode)s.m_YColumn));
                }
                else
                {
                    info.AddValue("YColumn", s.m_YColumn);
                }

                info.CreateArray("DataColumns", s.m_DataColumns.Length);
                for (int i = 0; i < s.m_DataColumns.Length; i++)
                {
                    Altaxo.Data.IReadableColumn col = s.m_DataColumns[i];
                    if (col is Main.IDocumentNode && !s.Equals(((Main.IDocumentNode)col).ParentObject))
                    {
                        info.AddValue("e", Main.DocumentPath.GetAbsolutePath((Main.IDocumentNode)col));
                    }
                    else
                    {
                        info.AddValue("e", col);
                    }
                }
                info.CommitArray();

                info.AddValue("XBoundaries", s.m_xBoundaries);
                info.AddValue("YBoundaries", s.m_yBoundaries);
                info.AddValue("VBoundaries", s.m_vBoundaries);
            }
        /// <summary>
        /// Copy constructor.
        /// </summary>
        /// <param name="from">The object to copy from.</param>
        /// <remarks>Only clones the references to the data columns, not the columns itself.</remarks>
        public XYZMeshedColumnPlotData(XYZMeshedColumnPlotData from)
        {
            if (from.m_XColumn is Altaxo.Data.DataColumn && ((Altaxo.Data.DataColumn)from.m_XColumn).ParentObject != null)
            {
                m_XColumn = from.m_XColumn;
            }
            else
            {
                m_XColumn = (Altaxo.Data.INumericColumn)from.m_XColumn.Clone();
            }

            if (from.m_YColumn is Altaxo.Data.DataColumn && ((Altaxo.Data.DataColumn)from.m_YColumn).ParentObject != null)
            {
                m_YColumn = from.m_YColumn;
            }
            else
            {
                m_YColumn = (Altaxo.Data.INumericColumn)from.m_YColumn.Clone();
            }

            int len = from.m_DataColumns.Length;

            m_DataColumns = new Altaxo.Data.IReadableColumn[len];

            for (int i = 0; i < len; i++)
            {
                m_DataColumns[i] = from.m_DataColumns[i]; // do not clone the data columns!

                // set the event chain
                if (m_DataColumns[i] is Altaxo.Data.DataColumn)
                {
                    ((Altaxo.Data.DataColumn)m_DataColumns[i]).Changed += new EventHandler(EhColumnDataChangedEventHandler);
                }
            }


            this.SetXBoundsFromTemplate(new FiniteNumericalBoundaries());
            this.SetYBoundsFromTemplate(new FiniteNumericalBoundaries());
            this.SetVBoundsFromTemplate(new FiniteNumericalBoundaries());
        }
Exemplo n.º 8
0
		/// <summary>
		/// Copy constructor.
		/// </summary>
		/// <param name="from">The object to copy from.</param>
		/// <remarks>Only clones the references to the data columns, not the columns itself.</remarks>
		public XYZMeshedColumnPlotData(XYZMeshedColumnPlotData from)
		{
			CopyHelper.Copy(ref _matrixProxy, from._matrixProxy);
			_matrixProxy.ParentObject = this;

			this.SetXBoundsFromTemplate(new FiniteNumericalBoundaries());
			this.SetYBoundsFromTemplate(new FiniteNumericalBoundaries());
			this.SetVBoundsFromTemplate(new FiniteNumericalBoundaries());
		}
Exemplo n.º 9
0
            public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
            {
                bool bSurrogateUsed = false;

                XYZMeshedColumnPlotData s = null != o ? (XYZMeshedColumnPlotData)o : new XYZMeshedColumnPlotData();

                var surr = new XmlSerializationSurrogate0();

#pragma warning disable 618
                s._matrixProxy = DataTableMatrixProxy.CreateEmptyInstance(); // this instance is replaced later in the deserialization callback function and is intended to avoid null reference errors
#pragma warning restore 618

                object deserobj;
                deserobj = info.GetValue("XColumn", s);
                if (deserobj is Main.AbsoluteDocumentPath)
                {
                    surr._xColumnPath = (Main.AbsoluteDocumentPath)deserobj;
                    bSurrogateUsed    = true;
                }
                else
                {
                    surr._xColumnProxy = ReadableColumnProxyBase.FromColumn((Altaxo.Data.INumericColumn)deserobj);
                }

                deserobj = info.GetValue("YColumn", s);
                if (deserobj is Main.AbsoluteDocumentPath)
                {
                    surr._yColumnPath = (Main.AbsoluteDocumentPath)deserobj;
                    bSurrogateUsed    = true;
                }
                else
                {
                    surr._yColumnProxy = ReadableColumnProxyBase.FromColumn((Altaxo.Data.INumericColumn)deserobj);
                }

                int count = info.OpenArray();
                surr._vColumnPaths   = new Main.AbsoluteDocumentPath[count];
                surr._vColumnProxies = new IReadableColumnProxy[count];
                for (int i = 0; i < count; i++)
                {
                    deserobj = info.GetValue("e", s);
                    if (deserobj is Main.AbsoluteDocumentPath)
                    {
                        surr._vColumnPaths[i] = (Main.AbsoluteDocumentPath)deserobj;
                        bSurrogateUsed        = true;
                    }
                    else
                    {
                        surr._vColumnProxies[i] = ReadableColumnProxyBase.FromColumn((Altaxo.Data.IReadableColumn)deserobj);
                    }
                }
                info.CloseArray(count);

                s._xBoundaries = (IPhysicalBoundaries)info.GetValue("XBoundaries", s);
                s._yBoundaries = (IPhysicalBoundaries)info.GetValue("YBoundaries", s);
                s._vBoundaries = (IPhysicalBoundaries)info.GetValue("VBoundaries", s);

                s._xBoundaries.ParentObject = s;
                s._yBoundaries.ParentObject = s;
                s._vBoundaries.ParentObject = s;

                if (bSurrogateUsed)
                {
                    surr._plotAssociation         = s;
                    info.DeserializationFinished += new Altaxo.Serialization.Xml.XmlDeserializationCallbackEventHandler(surr.EhDeserializationFinished);
                }

                return(s);
            }
Exemplo n.º 10
0
            public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent)
            {
                bool bSurrogateUsed = false;

                XYZMeshedColumnPlotData s = null != o ? (XYZMeshedColumnPlotData)o : new XYZMeshedColumnPlotData();

                XmlSerializationSurrogate0 surr = new XmlSerializationSurrogate0();

                object deserobj;

                deserobj = info.GetValue("XColumn", s);
                if (deserobj is Main.DocumentPath)
                {
                    surr._xColumn  = (Main.DocumentPath)deserobj;
                    bSurrogateUsed = true;
                }
                else
                {
                    s.m_XColumn = (Altaxo.Data.INumericColumn)deserobj;
                    if (deserobj is Altaxo.Data.DataColumn)
                    {
                        ((Altaxo.Data.DataColumn)deserobj).Changed += new EventHandler(s.EhColumnDataChangedEventHandler);
                    }
                }


                deserobj = info.GetValue("YColumn", s);
                if (deserobj is Main.DocumentPath)
                {
                    surr._yColumn  = (Main.DocumentPath)deserobj;
                    bSurrogateUsed = true;
                }
                else
                {
                    s.m_YColumn = (Altaxo.Data.INumericColumn)deserobj;
                    if (deserobj is Altaxo.Data.DataColumn)
                    {
                        ((Altaxo.Data.DataColumn)deserobj).Changed += new EventHandler(s.EhColumnDataChangedEventHandler);
                    }
                }

                int count = info.OpenArray();

                surr._vColumns  = new Main.DocumentPath[count];
                s.m_DataColumns = new Altaxo.Data.IReadableColumn[count];
                for (int i = 0; i < count; i++)
                {
                    deserobj = info.GetValue("YColumn", s);
                    if (deserobj is Main.DocumentPath)
                    {
                        surr._vColumns[i] = (Main.DocumentPath)deserobj;
                        bSurrogateUsed    = true;
                    }
                    else
                    {
                        s.m_DataColumns[i] = (Altaxo.Data.IReadableColumn)deserobj;
                        if (deserobj is Altaxo.Data.DataColumn)
                        {
                            ((Altaxo.Data.DataColumn)deserobj).Changed += new EventHandler(s.EhColumnDataChangedEventHandler);
                        }
                    }
                }
                info.CloseArray(count);


                s.m_xBoundaries = (NumericalBoundaries)info.GetValue("XBoundaries", typeof(NumericalBoundaries));
                s.m_yBoundaries = (NumericalBoundaries)info.GetValue("YBoundaries", typeof(NumericalBoundaries));
                s.m_vBoundaries = (NumericalBoundaries)info.GetValue("VBoundaries", typeof(NumericalBoundaries));

                s.m_xBoundaries.BoundaryChanged += new BoundaryChangedHandler(s.OnXBoundariesChangedEventHandler);
                s.m_yBoundaries.BoundaryChanged += new BoundaryChangedHandler(s.OnYBoundariesChangedEventHandler);
                s.m_vBoundaries.BoundaryChanged += new BoundaryChangedHandler(s.OnVBoundariesChangedEventHandler);


                if (bSurrogateUsed)
                {
                    surr._plotAssociation         = s;
                    info.DeserializationFinished += new Altaxo.Serialization.Xml.XmlDeserializationCallbackEventHandler(surr.EhDeserializationFinished);
                }

                return(s);
            }
Exemplo n.º 11
0
		/// <summary>
		/// Plots a density image of the selected columns.
		/// </summary>
		/// <param name="dg"></param>
		/// <param name="bLine"></param>
		/// <param name="bScatter"></param>
		public static void PlotDensityImage(IWorksheetController dg, bool bLine, bool bScatter)
		{
			var graph = Altaxo.Graph.Gdi.GraphTemplates.TemplateWithXYPlotLayerWithG2DCartesicCoordinateSystem.CreateGraph(dg.DataTable.GetPropertyContext(), null, dg.DataTable.Name, true);
			var xylayer = graph.RootLayer.Layers.OfType<XYPlotLayer>().First();
			var context = graph.GetPropertyContext();

			DensityImagePlotStyle plotStyle = new DensityImagePlotStyle();

			XYZMeshedColumnPlotData assoc = new XYZMeshedColumnPlotData(dg.DataTable, dg.SelectedDataRows, dg.SelectedDataColumns, dg.SelectedPropertyColumns);
			if (assoc.DataTableMatrix.RowHeaderColumn == null)
				assoc.DataTableMatrix.RowHeaderColumn = new IndexerColumn();
			if (assoc.DataTableMatrix.ColumnHeaderColumn == null)
				assoc.DataTableMatrix.ColumnHeaderColumn = new IndexerColumn();

			IGPlotItem pi = new DensityImagePlotItem(assoc, plotStyle);
			xylayer.PlotItems.Add(pi);
			Current.ProjectService.CreateNewGraph(graph);
		}