public TreeMapItem(string subDir, string toolTip, Rect newRectStruct, int nDepth, TreeMap treeMap) { _treeMap = treeMap; var newColor = Color.FromArgb( (byte)(0xff), //opaque (byte)(curColor & 0xff), //red (byte)((curColor >> 4) & 0xff), //green (byte)((curColor >> 8) & 0xff) //blue ); curColor -= 100; // change the color some way Background = new SolidColorBrush(newColor); HorizontalAlignment = System.Windows.HorizontalAlignment.Left; VerticalAlignment = System.Windows.VerticalAlignment.Top; if (newRectStruct.Height > newRectStruct.Width) { // let's rotate the text for tall skinny rects var trans = new RotateTransform(-90); this.LayoutTransform = trans; Height = newRectStruct.Width; Width = newRectStruct.Height; } else { Height = newRectStruct.Height; Width = newRectStruct.Width; } treeMap._mainWindow._DataDict[subDir].rect = newRectStruct; Canvas.SetTop(this, newRectStruct.Top); Canvas.SetLeft(this, newRectStruct.Left); Text = subDir; ToolTip = toolTip; this.ContextMenu = _ContextMenu; // all share the same menu }
/// <summary> /// Gets all elements that are greater of equal to the specified element /// </summary> /// <param name="from">key to start from</param> /// <returns>map of elements</returns> public SortedMap <K, V> TailMap(K from) { if (ReferenceEquals(from, null)) { throw new ArgumentException("Parameter from cannot be null at TailMap(K from)"); } TreeMap <K, V> map = new TreeMap <K, V>(); AddNodesRecursive(from, Root, map, true, false); return(map); }
/// <summary> /// Gets all emenents ranging from fromKey (inclusive) and toKey (exclusive) /// </summary> /// <param name="fromKey">key to start from</param> /// <param name="toKey">key to stop at</param> /// <returns>map of elements</returns> public SortedMap <K, V> SubMap(K fromKey, K toKey) { if (ReferenceEquals(fromKey, null) || ReferenceEquals(toKey, null)) { throw new ArgumentException("No parameter can be null at SubMap(K fromKey, K toKey)"); } TreeMap <K, V> map = new TreeMap <K, V>(); AddNodesRecursiveSubMap(fromKey, toKey, Root, map); return(map); }
/// <summary> /// Gets all the elements that are strictly less than the specified key /// </summary> /// <param name="to">key up to which elements will be added</param> /// <returns>map of elements</returns> public SortedMap <K, V> HeadMap(K to) { if (ReferenceEquals(to, null)) { throw new ArgumentException("Parameter to cannot be null at HeadMap(K to)"); } TreeMap <K, V> map = new TreeMap <K, V>(); AddNodesRecursive(to, Root, map, false, true); return(map); }
public static void Main(string[] args) { Application.Init(); var window = new Gtk.Window(Gtk.WindowType.Toplevel) { Title = "Treemap Example", BorderWidth = 0, //12, }; window.SetDefaultSize(640, 480); window.DeleteEvent += delegate { Gtk.Application.Quit(); }; window.Show(); var vbox = new Gtk.VBox(false, 6); window.Add(vbox); vbox.Show(); var treemap = new TreeMap.TreeMap() { Model = BuildModel(), TextColumn = 0, WeightColumn = 1, Title = "Treemap Example", }; vbox.PackStart(treemap, true, true, 0); treemap.Show(); var buttonbox = new Gtk.HButtonBox(); buttonbox.BorderWidth = 12; buttonbox.Layout = Gtk.ButtonBoxStyle.End; vbox.PackStart(buttonbox, false, true, 0); buttonbox.Show(); var close = new Gtk.Button(Gtk.Stock.Close); close.CanDefault = true; close.Clicked += delegate { Gtk.Application.Quit(); }; buttonbox.PackStart(close, false, true, 0); window.Default = close; close.Show(); Application.Run(); }
public static void Main(string[] args) { Application.Init (); var window = new Gtk.Window (Gtk.WindowType.Toplevel) { Title = "Treemap Example", BorderWidth = 0,//12, }; window.SetDefaultSize (640, 480); window.DeleteEvent += delegate { Gtk.Application.Quit (); }; window.Show (); var vbox = new Gtk.VBox (false, 6); window.Add (vbox); vbox.Show (); var treemap = new TreeMap.TreeMap () { Model = BuildModel (), TextColumn = 0, WeightColumn = 1, Title = "Treemap Example", }; vbox.PackStart (treemap, true, true, 0); treemap.Show (); var buttonbox = new Gtk.HButtonBox (); buttonbox.BorderWidth = 12; buttonbox.Layout = Gtk.ButtonBoxStyle.End; vbox.PackStart (buttonbox, false, true, 0); buttonbox.Show (); var close = new Gtk.Button (Gtk.Stock.Close); close.CanDefault = true; close.Clicked += delegate { Gtk.Application.Quit (); }; buttonbox.PackStart (close, false, true, 0); window.Default = close; close.Show (); Application.Run (); }