public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { var s = null != o ? (WorksheetViewLayout)o : new WorksheetViewLayout(); XmlSerializationSurrogate0 surr = new XmlSerializationSurrogate0(); surr._TableController = s; if (info.CurrentElementName == "Controller") { info.OpenElement(); surr._PathToLayout = (AbsoluteDocumentPath)info.GetValue("Layout", s); info.CloseElement(); } else if (info.CurrentElementName == "BaseType") { info.GetString("BaseType"); surr._PathToLayout = (AbsoluteDocumentPath)info.GetValue("Layout", s); } else { surr._PathToLayout = (AbsoluteDocumentPath)info.GetValue("Layout", s); } info.DeserializationFinished += new Altaxo.Serialization.Xml.XmlDeserializationCallbackEventHandler(surr.EhDeserializationFinished); return s; }
public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { XYColumnPlotData pa = (XYColumnPlotData)info.GetValue("Data", null); XYLineScatterPlotStyle lsps = (XYLineScatterPlotStyle)info.GetValue("Style", null); if (lsps.XYPlotLineStyle != null) lsps.XYPlotLineStyle.UseSymbolGap = lsps.LineSymbolGap; // this has changed and is now hosted in the LineStyle itself G2DPlotStyleCollection ps = new G2DPlotStyleCollection(new IG2DPlotStyle[] { lsps.XYPlotLineStyle, lsps.ScatterStyle, lsps.XYPlotLabelStyle }); if (lsps.XYPlotLabelStyle != null) { XmlSerializationSurrogate0 surr = new XmlSerializationSurrogate0(); surr._item = pa; surr._label = lsps.XYPlotLabelStyle; info.DeserializationFinished += new Altaxo.Serialization.Xml.XmlDeserializationCallbackEventHandler(surr.info_DeserializationFinished); } if (null == o) { return new XYColumnPlotItem(pa, ps); } else { XYColumnPlotItem s = (XYColumnPlotItem)o; s.Data = pa; s.Style = ps; return s; } }
public virtual object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { bool bNeedsCallback = false; XYColumnPlotData s = null != o ? (XYColumnPlotData)o : new XYColumnPlotData(info); object xColumn = info.GetValue("XColumn", s); object yColumn = info.GetValue("YColumn", s); if (xColumn is Altaxo.Data.IReadableColumn) s.XColumn = (Altaxo.Data.IReadableColumn)xColumn; else if (xColumn is Main.AbsoluteDocumentPath) bNeedsCallback = true; if (yColumn is Altaxo.Data.IReadableColumn) s.YColumn = (Altaxo.Data.IReadableColumn)yColumn; else if (yColumn is Main.AbsoluteDocumentPath) bNeedsCallback = true; s._xBoundaries = (IPhysicalBoundaries)info.GetValue("XBoundaries", s); if (null != s._xBoundaries) s._xBoundaries.ParentObject = s; s._yBoundaries = (IPhysicalBoundaries)info.GetValue("YBoundaries", s); if (null != s._yBoundaries) s._yBoundaries.ParentObject = s; if (bNeedsCallback) { XmlSerializationSurrogate0 surr = new XmlSerializationSurrogate0(); surr._xColumn = xColumn as Main.AbsoluteDocumentPath; surr._yColumn = yColumn as Main.AbsoluteDocumentPath; surr._plotAssociation = s; info.DeserializationFinished += new Altaxo.Serialization.Xml.XmlDeserializationCallbackEventHandler(surr.EhDeserializationFinished); } return s; }
protected virtual XYPlotLayer SDeserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { XYPlotLayer s = null != o ? (XYPlotLayer)o : new XYPlotLayer(); bool fillLayerArea = info.GetBoolean("FillLayerArea"); BrushX layerAreaFillBrush = (BrushX)info.GetValue("LayerAreaFillBrush", typeof(BrushX)); if (fillLayerArea) { if(!s.GridPlanes.Contains(CSPlaneID.Front)) s.GridPlanes.Add(new GridPlane(CSPlaneID.Front)); s.GridPlanes[CSPlaneID.Front].Background = layerAreaFillBrush; } // size, position, rotation and scale s._location.WidthType = (XYPlotLayerSizeType)info.GetValue("WidthType", typeof(XYPlotLayerSizeType)); s._location.HeightType = (XYPlotLayerSizeType)info.GetValue("HeightType", typeof(XYPlotLayerSizeType)); s._location.Width = info.GetDouble("Width"); s._location.Height = info.GetDouble("Height"); s._cachedLayerSize = (SizeF)info.GetValue("CachedSize", typeof(SizeF)); s._coordinateSystem.UpdateAreaSize(s._cachedLayerSize); s._location.XPositionType = (XYPlotLayerPositionType)info.GetValue("XPositionType", typeof(XYPlotLayerPositionType)); s._location.YPositionType = (XYPlotLayerPositionType)info.GetValue("YPositionType", typeof(XYPlotLayerPositionType)); s._location.XPosition = info.GetDouble("XPosition"); s._location.YPosition = info.GetDouble("YPosition"); s._cachedLayerPosition = (PointF)info.GetValue("CachedPosition", typeof(PointF)); s._location.Angle = info.GetSingle("Rotation"); s._location.Scale = info.GetSingle("Scale"); // axis related s._linkedScales.X.Scale = (Scale)info.GetValue("XAxis", typeof(Scale)); s._linkedScales.Y.Scale = (Scale)info.GetValue("YAxis", typeof(Scale)); s._linkedScales.X.IsLinked = info.GetBoolean("LinkXAxis"); s._linkedScales.Y.IsLinked = info.GetBoolean("LinkYAxis"); s._linkedScales.X.LinkOrgA = info.GetDouble("LinkXAxisOrgA"); s._linkedScales.X.LinkOrgB = info.GetDouble("LinkXAxisOrgB"); s._linkedScales.X.LinkEndA = info.GetDouble("LinkXAxisEndA"); s._linkedScales.X.LinkEndB = info.GetDouble("LinkXAxisEndB"); s._linkedScales.Y.LinkOrgA = info.GetDouble("LinkYAxisOrgA"); s._linkedScales.Y.LinkOrgB = info.GetDouble("LinkYAxisOrgB"); s._linkedScales.Y.LinkEndA = info.GetDouble("LinkYAxisEndA"); s._linkedScales.Y.LinkEndB = info.GetDouble("LinkYAxisEndB"); // Styles bool showLeft = info.GetBoolean("ShowLeftAxis"); bool showBottom = info.GetBoolean("ShowBottomAxis"); bool showRight = info.GetBoolean("ShowRightAxis"); bool showTop = info.GetBoolean("ShowTopAxis"); s._axisStyles.AxisStyleEnsured(CSLineID.Y0).AxisLineStyle = (AxisLineStyle)info.GetValue("LeftAxisStyle", typeof(AxisLineStyle)); s._axisStyles.AxisStyleEnsured(CSLineID.X0).AxisLineStyle = (AxisLineStyle)info.GetValue("BottomAxisStyle", typeof(AxisLineStyle)); s._axisStyles.AxisStyleEnsured(CSLineID.Y1).AxisLineStyle = (AxisLineStyle)info.GetValue("RightAxisStyle", typeof(AxisLineStyle)); s._axisStyles.AxisStyleEnsured(CSLineID.X1).AxisLineStyle = (AxisLineStyle)info.GetValue("TopAxisStyle", typeof(AxisLineStyle)); s._axisStyles[CSLineID.Y0].MajorLabelStyle = (AxisLabelStyleBase)info.GetValue("LeftLabelStyle", typeof(AxisLabelStyleBase)); s._axisStyles[CSLineID.X0].MajorLabelStyle = (AxisLabelStyleBase)info.GetValue("BottomLabelStyle", typeof(AxisLabelStyleBase)); s._axisStyles[CSLineID.Y1].MajorLabelStyle = (AxisLabelStyleBase)info.GetValue("RightLabelStyle", typeof(AxisLabelStyleBase)); s._axisStyles[CSLineID.X1].MajorLabelStyle = (AxisLabelStyleBase)info.GetValue("TopLabelStyle", typeof(AxisLabelStyleBase)); // Titles and legend s._axisStyles[CSLineID.Y0].Title = (TextGraphic)info.GetValue("LeftAxisTitle", typeof(TextGraphic)); s._axisStyles[CSLineID.X0].Title = (TextGraphic)info.GetValue("BottomAxisTitle", typeof(TextGraphic)); s._axisStyles[CSLineID.Y1].Title = (TextGraphic)info.GetValue("RightAxisTitle", typeof(TextGraphic)); s._axisStyles[CSLineID.X1].Title = (TextGraphic)info.GetValue("TopAxisTitle", typeof(TextGraphic)); if (!showLeft) s._axisStyles.Remove(CSLineID.Y0); if (!showRight) s._axisStyles.Remove(CSLineID.Y1); if (!showBottom) s._axisStyles.Remove(CSLineID.X0); if (!showTop) s._axisStyles.Remove(CSLineID.X1); s.Legend = (TextGraphic)info.GetValue("Legend", typeof(TextGraphic)); // XYPlotLayer specific Main.DocumentPath linkedLayer = (Main.DocumentPath)info.GetValue("LinkedLayer", typeof(XYPlotLayer)); if (linkedLayer != null) { XmlSerializationSurrogate0 surr = new XmlSerializationSurrogate0(); surr._Layer = s; surr._LinkedLayerPath = linkedLayer; info.DeserializationFinished += new Altaxo.Serialization.Xml.XmlDeserializationCallbackEventHandler(surr.EhDeserializationFinished); } s._graphObjects = (GraphicCollection)info.GetValue("GraphObjects", typeof(GraphicCollection)); s._plotItems = (PlotItemCollection)info.GetValue("Plots", typeof(PlotItemCollection)); return s; }
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(); #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; }
protected virtual void Deserialize(WorksheetLayout s, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { XmlSerializationSurrogate0 surr = new XmlSerializationSurrogate0(); surr.m_ColStyles = new System.Collections.Hashtable(); surr.m_TableLayout = s; info.DeserializationFinished += new Altaxo.Serialization.Xml.XmlDeserializationCallbackEventHandler(surr.EhDeserializationFinished); s.m_Guid = System.Xml.XmlConvert.ToGuid(info.GetString("Guid")); surr.m_PathToTable = (Main.DocumentPath)info.GetValue("Table",s); s.m_RowHeaderStyle = (RowHeaderStyle)info.GetValue("RowHeaderStyle" , s); s.m_ColumnHeaderStyle = (ColumnHeaderStyle)info.GetValue("ColumnHeaderStyle",s); s.m_PropertyColumnHeaderStyle = (ColumnHeaderStyle)info.GetValue("PropertyColumnHeaderStyle",s); int count; count = info.OpenArray(); // DefaultColumnStyles for(int i=0;i<count;i++) { object defstyle = info.GetValue("DefaultColumnStyle",s); s.DefaultColumnStyles.Add(defstyle.GetType(), defstyle); } info.CloseArray(count); // deserialize the columnstyles // this must be deserialized in a new instance of this surrogate, since we can not resolve it immediately count = info.OpenArray(); if(count>0) { for(int i=0;i<count;i++) { info.OpenElement(); // "e" Main.DocumentPath key = (Main.DocumentPath)info.GetValue("Column",s); object val = info.GetValue("Style",s); surr.m_ColStyles.Add(key,val); info.CloseElement(); } } info.CloseArray(count); }
public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { WorksheetController s = null!=o ? (WorksheetController)o : new WorksheetController(null,true); XmlSerializationSurrogate0 surr = new XmlSerializationSurrogate0(); surr._TableController = s; surr._PathToLayout = (Main.DocumentPath)info.GetValue("Layout",s); info.DeserializationFinished += new Altaxo.Serialization.Xml.XmlDeserializationCallbackEventHandler(surr.EhDeserializationFinished); return s; }
public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { GraphController s = null!=o ? (GraphController)o : new GraphController(null,true); s.m_AutoZoom = info.GetBoolean("AutoZoom"); s.m_Zoom = info.GetSingle("Zoom"); s.m_Graph = null; XmlSerializationSurrogate0 surr = new XmlSerializationSurrogate0(); surr._GraphController = s; surr._PathToGraph = (Main.DocumentPath)info.GetValue("Graph",s); info.DeserializationFinished += new Altaxo.Serialization.Xml.XmlDeserializationCallbackEventHandler(surr.EhDeserializationFinished); return s; }
public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { FitFunctionScript s = null != o ? (FitFunctionScript)o : new FitFunctionScript(); // deserialize the base class info.GetBaseValueEmbedded(s, typeof(AbstractScript), parent); XmlSerializationSurrogate0 surr = new XmlSerializationSurrogate0(); surr._deserializedObject = s; info.DeserializationFinished += new Altaxo.Serialization.Xml.XmlDeserializationCallbackEventHandler(surr.info_DeserializationFinished); return s; }