public void Serialize(object obj, Altaxo.Serialization.Xml.IXmlSerializationInfo info) { PlotGroupStyleCollection s = (PlotGroupStyleCollection)obj; info.AddBaseValueEmbedded(obj, obj.GetType().BaseType); info.AddValue("TransformingStyle", s._coordinateTransformingStyle); }
public object Deserialize(object o, Altaxo.Serialization.Xml.IXmlDeserializationInfo info, object parent) { PlotGroupStyleCollection s = null != o ? (PlotGroupStyleCollection)o : new PlotGroupStyleCollection(); info.GetBaseValueEmbedded(s, s.GetType().BaseType, parent); s._coordinateTransformingStyle = (ICoordinateTransformingGroupStyle)info.GetValue("TransformingStyle", s); return(s); }
public override void CopyFrom(PlotGroupStyleCollectionBase fromb) { base.CopyFrom(fromb); if (fromb is PlotGroupStyleCollection) { PlotGroupStyleCollection from = (PlotGroupStyleCollection)fromb; _coordinateTransformingStyle = null == from._coordinateTransformingStyle ? null : (ICoordinateTransformingGroupStyle)from._coordinateTransformingStyle.Clone(); } }
public PlotGroupStyleCollection(PlotGroupStyleCollection from) { CopyFrom(from); }
public bool InitializeDocument(params object[] args) { if (args == null || args.Length == 0) return false; if (!(args[0] is G2DPlotItem)) return false; else _doc = _tempdoc = (G2DPlotItem)args[0]; if (args.Length >= 2 && args[1] != null) { if (!(args[1] is PlotGroupStyleCollection)) return false; else _groupStyles = (PlotGroupStyleCollection)args[1]; } else { if(_doc.ParentCollection!=null) _groupStyles = _doc.ParentCollection.GroupStyles; } if(_useDocument==UseDocument.Copy) _tempdoc = (G2DPlotItem)_doc.Clone(); InitializeCollectionAndData(); InitializeStyles(); BringTabToFront(2); return true; }
public G2DPlotItemController(G2DPlotItem doc, PlotGroupStyleCollection parent) { if (!InitializeDocument(doc, parent)) throw new ArgumentException(); }
void Initialize(bool initDoc) { if (initDoc) { // available Update modes _availableUpdateModes = new SelectableListNodeList(); foreach (object obj in Enum.GetValues(typeof(PlotGroupStrictness))) _availableUpdateModes.Add(new SelectableListNode(obj.ToString(), obj, ((PlotGroupStrictness)obj) == PlotGroupStrictness.Normal)); Type[] types; // Transfo-Styles _currentTransfoStyle = _doc.CoordinateTransformingStyle == null ? null : _doc.CoordinateTransformingStyle.GetType(); _availableTransfoStyles = new SelectableListNodeList(); _availableTransfoStyles.Add(new SelectableListNode("None",null,null==_currentTransfoStyle)); types = ReflectionService.GetNonAbstractSubclassesOf(typeof(ICoordinateTransformingGroupStyle)); foreach (Type t in types) { _availableTransfoStyles.Add(new SelectableListNode(Current.Gui.GetUserFriendlyClassName(t), t, t==_currentTransfoStyle)); } // Normal Styles _availableNormalStyles = new SelectableListNodeList(); if (_parent != null) // if possible, collect only those styles that are applicable { PlotGroupStyleCollection avstyles = new PlotGroupStyleCollection(); _parent.CollectStyles(avstyles); foreach(IPlotGroupStyle style in avstyles) { if(!_doc.ContainsType(style.GetType())) _availableNormalStyles.Add(new SelectableListNode(Current.Gui.GetUserFriendlyClassName(style.GetType()),style.GetType(),false)); } } else // or else, find all available styles { types = ReflectionService.GetNonAbstractSubclassesOf(typeof(IPlotGroupStyle)); foreach (Type t in types) { if (!_doc.ContainsType(t)) _availableNormalStyles.Add(new SelectableListNode(Current.Gui.GetUserFriendlyClassName(t), t, false)); } } _currentNormalStyles = new CheckableSelectableListNodeList(); _currentStepItems = 0; // first those items that have no childs foreach (IPlotGroupStyle s in _doc) { CheckableSelectableListNode node = new CheckableSelectableListNode(Current.Gui.GetUserFriendlyClassName(s.GetType()), s.GetType(), false, false); if (s.CanHaveChilds()) { node.Checked = s.IsStepEnabled; _currentNormalStyles.Insert(_currentStepItems, node); _currentStepItems++; } else { node.Checked = s.IsStepEnabled; _currentNormalStyles.Add(node); } } UpdateCurrentNormalOrder(); // bring the items in the right order } if (_view != null) { _view.InitializeAvailableCoordinateTransformingGroupStyles(_availableTransfoStyles); _view.InitializeAvailableNormalGroupStyles(_availableNormalStyles); _view.InitializeCurrentNormalGroupStyles(_currentNormalStyles); _view.InitializeUpdateMode(_availableUpdateModes, _doc.InheritFromParentGroups, _doc.DistributeToChildGroups); } }
public bool InitializeDocument(params object[] args) { if (args == null || args.Length == 0 || !(args[0] is PlotGroupStyleCollection)) return false; _origdoc = (PlotGroupStyleCollection)args[0]; _doc = _useDocument == UseDocument.Directly ? _origdoc : _origdoc.Clone(); if (args.Length >= 2 && args[1] is IGPlotItem) _parent = (IGPlotItem)args[1]; Initialize(true); return true; }
/// <summary> /// Plots selected data columns of a table. /// </summary> /// <param name="table">The source table.</param> /// <param name="selectedColumns">The data columns of the table that should be plotted.</param> /// <param name="graph">The graph document to plot into.</param> /// <param name="templatePlotStyle">The plot style which is the template for all plot items.</param> /// <param name="groupStyles">The group styles for the newly built plot item collection.</param> public static Altaxo.Gui.Graph.Gdi.Viewing.IGraphController Plot( DataTable table, IAscendingIntegerCollection selectedColumns, Graph.Gdi.GraphDocument graph, G2DPlotStyleCollection templatePlotStyle, PlotGroupStyleCollection groupStyles) { List<IGPlotItem> pilist = CreatePlotItems(table, selectedColumns, templatePlotStyle); // now create a new Graph with this plot associations var gc = Current.ProjectService.CreateNewGraph(graph); var xylayer = gc.Doc.RootLayer.Layers.OfType<Altaxo.Graph.Gdi.XYPlotLayer>().First(); // Set x and y axes according to the first plot item in the list if (pilist.Count > 0 && (pilist[0] is XYColumnPlotItem)) { XYColumnPlotItem firstitem = (XYColumnPlotItem)pilist[0]; if (firstitem.Data.XColumn is TextColumn) xylayer.Scales[0] = new TextScale(); else if (firstitem.Data.XColumn is DateTimeColumn) xylayer.Scales[0] = new DateTimeScale(); if (firstitem.Data.YColumn is TextColumn) xylayer.Scales[1] = new TextScale(); else if (firstitem.Data.YColumn is DateTimeColumn) xylayer.Scales[1] = new DateTimeScale(); } PlotItemCollection newPlotGroup = new PlotItemCollection(xylayer.PlotItems); foreach (IGPlotItem pi in pilist) { newPlotGroup.Add(pi); } if (groupStyles != null) newPlotGroup.GroupStyles = groupStyles; else newPlotGroup.CollectStyles(newPlotGroup.GroupStyles); xylayer.PlotItems.Add(newPlotGroup); return gc; }