|
|
@ -9,26 +9,26 @@ using LogicWorld.Outlines;
|
|
|
|
|
|
|
|
|
|
|
|
namespace CriticalPathAnalyzer.Client.Tool {
|
|
|
|
namespace CriticalPathAnalyzer.Client.Tool {
|
|
|
|
public class PathHighlighter {
|
|
|
|
public class PathHighlighter {
|
|
|
|
private static List<ClusterDetails> _clusters = new List<ClusterDetails>();
|
|
|
|
private static List<Node> _nodes = new List<Node>();
|
|
|
|
private static List<WireAddress> _highlightedWires = new List<WireAddress>();
|
|
|
|
private static List<WireAddress> _highlightedWires = new List<WireAddress>();
|
|
|
|
|
|
|
|
|
|
|
|
public static void HighlightWires(List<ClusterDetails> clusters) {
|
|
|
|
public static void HighlightClusterNodes(List<Node> nodes) {
|
|
|
|
_clusters = clusters;
|
|
|
|
_nodes = nodes;
|
|
|
|
|
|
|
|
|
|
|
|
foreach (ClusterDetails clusterDetails in _clusters) {
|
|
|
|
foreach (Node node in _nodes) {
|
|
|
|
HighlightCluster(clusterDetails);
|
|
|
|
HighlightNode(node);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Highlight all pegs and wires of the given cluster.
|
|
|
|
/// Highlight all pegs and wires of the given cluster.
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
private static void HighlightCluster(ClusterDetails cluster) {
|
|
|
|
private static void HighlightNode(Node node) {
|
|
|
|
IWorldData world = Instances.MainWorld.Data;
|
|
|
|
IWorldData world = Instances.MainWorld.Data;
|
|
|
|
|
|
|
|
|
|
|
|
var outline = new OutlineData(new Color24(HsvToRgb(cluster.Time * 20, 1.0f, 1.0f)));
|
|
|
|
var outline = new OutlineData(new Color24(HsvToRgb(node.Time * 20, 1.0f, 1.0f)));
|
|
|
|
|
|
|
|
|
|
|
|
foreach (ComponentAddress address in cluster.ConnectingComponents) {
|
|
|
|
foreach (ComponentAddress address in node.ConnectingComponents) {
|
|
|
|
if (!world.Contains(address)) {
|
|
|
|
if (!world.Contains(address)) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -36,7 +36,7 @@ namespace CriticalPathAnalyzer.Client.Tool {
|
|
|
|
Outliner.Outline(address, outline);
|
|
|
|
Outliner.Outline(address, outline);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (PegAddress pegAddress in cluster.Pegs) {
|
|
|
|
foreach (PegAddress pegAddress in node.Pegs) {
|
|
|
|
if (!world.Contains(pegAddress.ComponentAddress)) {
|
|
|
|
if (!world.Contains(pegAddress.ComponentAddress)) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -64,28 +64,28 @@ namespace CriticalPathAnalyzer.Client.Tool {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static void RemoveHighlighting() {
|
|
|
|
public static void RemoveHighlighting() {
|
|
|
|
if (_clusters == null) {
|
|
|
|
if (_nodes == null) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (ClusterDetails cluster in _clusters) {
|
|
|
|
foreach (Node cluster in _nodes) {
|
|
|
|
UnhighlightCluster(cluster);
|
|
|
|
UnhighlightNode(cluster);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (WireAddress wireAddress in _highlightedWires) {
|
|
|
|
foreach (WireAddress wireAddress in _highlightedWires) {
|
|
|
|
Outliner.RemoveOutline(wireAddress);
|
|
|
|
Outliner.RemoveOutline(wireAddress);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_clusters = null;
|
|
|
|
_nodes = null;
|
|
|
|
_highlightedWires.Clear();
|
|
|
|
_highlightedWires.Clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static void UnhighlightCluster(ClusterDetails cluster) {
|
|
|
|
private static void UnhighlightNode(Node node) {
|
|
|
|
foreach (PegAddress address in cluster.Pegs) {
|
|
|
|
foreach (PegAddress address in node.Pegs) {
|
|
|
|
Outliner.RemoveOutline(address);
|
|
|
|
Outliner.RemoveOutline(address);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (ComponentAddress address in cluster.ConnectingComponents) {
|
|
|
|
foreach (ComponentAddress address in node.ConnectingComponents) {
|
|
|
|
Outliner.RemoveOutline(address);
|
|
|
|
Outliner.RemoveOutline(address);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|