/// <summary> /// Gets the property context of the document node. If the provided node is not implementing <see cref="IPropertyBagOwner"/>, the parent nodes of this node are searched, /// until a node which implements <see cref="IPropertyBagOwner"/> is found. /// </summary> /// <param name="node">The node for which the property context is retrieved.</param> /// <returns>A <see cref="PropertyHierarchy"/> instance representing the property context of the provided document node.</returns> public static PropertyHierarchy GetPropertyContext(this Altaxo.Main.IDocumentLeafNode node) { var owner = node as IPropertyBagOwner; if (null == owner) { owner = Altaxo.Main.AbsoluteDocumentPath.GetRootNodeImplementing <IPropertyBagOwner>(node); } return(new PropertyHierarchy(GetPropertyBags(owner))); }
public static Altaxo.Graph.Plot.Groups.ColorGroupStyle GetColorGroupStyle(Altaxo.Main.IDocumentLeafNode doc) { var plotItemCollection = Altaxo.Main.AbsoluteDocumentPath.GetRootNodeImplementing <Altaxo.Graph.Gdi.Plot.PlotItemCollection>(doc); if (null == plotItemCollection) { return(null); } if (plotItemCollection.GroupStyles.ContainsType(typeof(Altaxo.Graph.Plot.Groups.ColorGroupStyle))) { return((Altaxo.Graph.Plot.Groups.ColorGroupStyle)plotItemCollection.GroupStyles.GetPlotGroupStyle(typeof(Altaxo.Graph.Plot.Groups.ColorGroupStyle))); } else { return(null); } }
/// <summary> /// Initializes a new instance of the <see cref="ColorGroupStylePresenceTracker"/> class. /// </summary> /// <param name="plotStyle">The plot style.</param> /// <param name="actionIfGroupStyleRemovedOrAdded">The action to do if the group style is removed or added to the group style collection.</param> public ColorGroupStylePresenceTracker(Altaxo.Main.IDocumentLeafNode plotStyle, Action actionIfGroupStyleRemovedOrAdded) { _colorGroupStyle = GetColorGroupStyle(plotStyle); _actionIfGroupStyleRemovedOrAdded = actionIfGroupStyleRemovedOrAdded; }