-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathHierarchicalDataContext.cs
More file actions
63 lines (54 loc) · 2.01 KB
/
Copy pathHierarchicalDataContext.cs
File metadata and controls
63 lines (54 loc) · 2.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using CSharpCodeAnalyst.Contracts;
using CSharpCodeAnalyst.TreeMap.Interfaces;
namespace CSharpCodeAnalyst.TreeMap
{
/// <summary>
/// Data context that is bound to the TreeMapView or CirclePackingView
/// </summary>
public sealed class HierarchicalDataContext
{
public HierarchicalDataContext(IHierarchicalData data, IBrushFactory brushFactory, HierarchicalDataCommands? commands = null)
{
Data = data;
BrushFactory = brushFactory;
Commands = commands;
}
public HierarchicalDataContext Clone()
{
// Layout info is lost!
var clone = new HierarchicalDataContext(Data.Clone(), BrushFactory!)
{
WeightSemantic = WeightSemantic,
AreaSemantic = AreaSemantic,
CreateNoData = CreateNoData
};
return clone;
}
/// <summary>
/// Factory for the placeholder shown when a filter removes every node. The data producer
/// supplies it because the tree-map control only knows the interface, not a concrete node
/// type it could instantiate itself.
/// </summary>
public Func<IHierarchicalData>? CreateNoData { get; init; }
public HierarchicalDataContext(IHierarchicalData data)
{
Data = data;
BrushFactory = null;
}
/// <summary>
/// Only needed if we use a color key.
/// Otherwise, a gradient is used.
/// </summary>
public IBrushFactory? BrushFactory { get; }
public HierarchicalDataCommands? Commands { get; init; }
public IHierarchicalData Data { get; }
/// <summary>
/// User hint what the area means (file size)
/// </summary>
public string? AreaSemantic { get; set; }
/// <summary>
/// User hint what the weight means (modifications)
/// </summary>
public string? WeightSemantic { get; set; }
}
}