Esempio n. 1
0
            public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                var s = (ScatterSymbolList)obj;

                info.SetProperty(GetSerializationRegistrationKey(s), "True"); // Register a property to note that this color set is already serialized.

                info.AddValue("Name", s._name);
                info.CreateArray("Elements", s._list.Count);
                foreach (var ele in s)
                {
                    info.AddValue("e", ele.Clone()); // Trick here: by cloning the value, it is a new instance that is not registered in the list manager, thus it has no parent, so that neither parent set nor parent name are serialized
                }
                info.CommitArray();
            }
Esempio n. 2
0
            public virtual void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                var s = (Custom)obj;

                info.AddValue("DashOffset", s._dashOffset);
                info.CreateArray("Pattern", s._customDashPattern.Length);
                foreach (var v in s._customDashPattern)
                {
                    info.AddValue("e", v);
                }
                info.CommitArray();

                SerializeV0(s, info);
            }
Esempio n. 3
0
                public virtual void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
                {
                    var s = (ProjectItemClipboardList)obj;

                    info.AddValue("BaseFolder", s.BaseFolder);
                    info.AddValue("RelocateReferences", s.RelocateReferences);
                    info.AddValue("TryToKeepInternalReferences", s.TryToKeepInternalReferences);
                    info.CreateArray("Items", s._projectItems.Count);
                    foreach (var item in s._projectItems)
                    {
                        info.AddValue("e", item);
                    }
                    info.CommitArray();
                }
Esempio n. 4
0
            public virtual void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                var s = (UnionOfRowSelections)obj;

                info.CreateArray("RowSelections", s._rowSelections.Count);

                for (int i = 0; i < s._rowSelections.Count; ++i)
                {
                    info.AddValue("e", s._rowSelections[i]);
                }

                info.CommitArray();

                info.AddValue("MergeAdjoiningSegments", s._mergeAdjoiningSegments);
            }
Esempio n. 5
0
            public virtual void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                var s = (ColumnStyleDictionary)obj;

                info.CreateArray("DefaultColumnStyles", s._defaultColumnStyles.Count);
                foreach (var style in s._defaultColumnStyles)
                {
                    info.CreateElement("e");
                    info.AddValue("Type", style.Key.FullName);
                    info.AddValue("Style", style.Value);
                    info.CommitElement(); // "e"
                }
                info.CommitArray();

                info.CreateArray("ColumnStyles", s._columnStyles.Count);
                foreach (var dictentry in s._columnStyles)
                {
                    info.CreateElement("e");
                    info.AddValue("Column", Main.AbsoluteDocumentPath.GetAbsolutePath(dictentry.Key));
                    info.AddValue("Style", dictentry.Value);
                    info.CommitElement(); // "e"
                }
                info.CommitArray();
            }
Esempio n. 6
0
            public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                var s = (ColorSetBag)obj;

                info.CreateArray("ColorSets", s._colorSets.Length);

                foreach (var c in s._colorSets)
                {
                    info.CreateElement("e");
                    info.AddValue("ColorSet", c.Item1);
                    info.AddValue("IsPlotColorSet", c.Item2);
                    info.CommitElement();
                }

                info.CommitArray();
            }
            public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                AscendingIntegerCollection s = (AscendingIntegerCollection)obj;
                int count = s.GetRangeCount();

                info.CreateArray("Ranges", count);
                int currentpos = 0, rangestart = 0, rangecount = 0;

                while (s.GetNextRangeAscending(ref currentpos, ref rangestart, ref rangecount))
                {
                    info.CreateElement("e");
                    info.AddValue("Start", rangestart);
                    info.AddValue("Count", rangecount);
                    info.CommitElement();
                }
                info.CommitArray();
            }
Esempio n. 8
0
            public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                var s = (ColorSet)obj;

                info.SetProperty(GetSerializationRegistrationKey(s), "True"); // Register a property to note that this color set is already serialized.

                info.AddValue("Name", s._name);

                info.CreateArray("Colors", s._innerList.Length);

                foreach (NamedColor c in s)
                {
                    info.CreateElement("e");
                    info.AddAttributeValue("Name", c.Name);
                    info.SetNodeContent(c.Color.ToInvariantString());
                    info.CommitElement();
                }

                info.CommitArray();
            }
            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);
            }
Esempio n. 10
0
            public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                var s       = (PropertyBag)obj;
                var keyList = new List <string>(s._properties.Count);

                foreach (var entry in s._properties)
                {
                    if (entry.Key.StartsWith(TemporaryPropertyPrefixString))
                    {
                        continue;
                    }
                    if (!info.IsSerializable(entry.Value))
                    {
                        continue;
                    }
                    keyList.Add(entry.Key);
                }

                info.CreateArray("Properties", keyList.Count);
                info.AddAttributeValue("AssemblyVersion", s.GetType().Assembly.GetName().Version.ToString());
                foreach (var key in keyList)
                {
                    var value = s._properties[key];

                    info.CreateElement("e");
                    info.AddValue("Key", key);

                    if (s._propertiesLazyLoaded.Contains(key) && value is string rawXml)
                    {
                        info.WriteRaw(rawXml);
                    }
                    else
                    {
                        info.AddValue("Value", value);
                    }

                    info.CommitElement();
                }
                info.CommitArray();
            }
Esempio n. 11
0
            public virtual void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info)
            {
                var s = (PlotGroupStyleCollectionBase)obj;

                int savedStyles = 0; // for test of consistency

                info.CreateArray("Styles", s.Count);

                foreach (System.Type t in s._typeToInstance.Keys)
                {
                    if (s._typeToInfo[t].ParentGroupType != null)
                    {
                        continue;
                    }

                    info.AddValue("Style", s._typeToInstance[t]);
                    info.AddValue("HasChild", null != s._typeToInfo[t].ChildGroupType);
                    savedStyles++;

                    System.Type childtype = t;
                    while (null != (childtype = s._typeToInfo[childtype].ChildGroupType))
                    {
                        info.AddValue("Style", s._typeToInstance[childtype]);
                        info.AddValue("HasChild", null != s._typeToInfo[childtype].ChildGroupType);
                        savedStyles++;
                    }
                }

                info.CommitArray();

                if (s.Count != savedStyles)
                {
                    throw new ApplicationException("Inconsistency in parent-child relationship in this PlotGroupStyleCollection. Please inform the author");
                }

                info.AddEnum("Strictness", s._plotGroupStrictness);
            }