|
|
|
@ -9,18 +9,35 @@ using LogicWorld.Outlines;
|
|
|
|
|
namespace CriticalPathAnalyzer.Client.Tool {
|
|
|
|
|
public class PathHighLighter {
|
|
|
|
|
private static readonly OutlineData Color = new OutlineData(new Color24(0xff0000));
|
|
|
|
|
private static readonly OutlineData PerimeterColor = new OutlineData(new Color24(0xffff00));
|
|
|
|
|
|
|
|
|
|
private static List<ClusterDetails> _clusters = new List<ClusterDetails>();
|
|
|
|
|
private static List<ComponentAddress> _highlightedComponents = new List<ComponentAddress>();
|
|
|
|
|
private static List<WireAddress> _highlightedWires = new List<WireAddress>();
|
|
|
|
|
|
|
|
|
|
public static void HighlightWires(AnalyzePathResponse response) {
|
|
|
|
|
_clusters = response.Clusters;
|
|
|
|
|
|
|
|
|
|
foreach (ClusterDetails clusterDetails in _clusters) {
|
|
|
|
|
HighlightCluster(clusterDetails);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IWorldData world = Instances.MainWorld.Data;
|
|
|
|
|
|
|
|
|
|
foreach (ComponentAddress componentAddress in response.PerimeterComponents) {
|
|
|
|
|
if (!world.Contains(componentAddress)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (ClusterDetails clusterDetails in _clusters) {
|
|
|
|
|
foreach (ComponentAddress address in clusterDetails.ConnectingComponents) {
|
|
|
|
|
Outliner.Outline(componentAddress, PerimeterColor);
|
|
|
|
|
_highlightedComponents.Add(componentAddress);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void HighlightCluster(ClusterDetails cluster) {
|
|
|
|
|
IWorldData world = Instances.MainWorld.Data;
|
|
|
|
|
|
|
|
|
|
foreach (ComponentAddress address in cluster.ConnectingComponents) {
|
|
|
|
|
if (!world.Contains(address)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
@ -28,7 +45,7 @@ namespace CriticalPathAnalyzer.Client.Tool {
|
|
|
|
|
Outliner.Outline(address, Color);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (ComponentAddress address in clusterDetails.LinkingComponents) {
|
|
|
|
|
foreach (ComponentAddress address in cluster.LinkingComponents) {
|
|
|
|
|
if (!world.Contains(address)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
@ -36,7 +53,7 @@ namespace CriticalPathAnalyzer.Client.Tool {
|
|
|
|
|
Outliner.Outline(address, Color);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (PegAddress pegAddress in clusterDetails.Pegs) {
|
|
|
|
|
foreach (PegAddress pegAddress in cluster.Pegs) {
|
|
|
|
|
if (!world.Contains(pegAddress.ComponentAddress)) {
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
@ -62,13 +79,13 @@ namespace CriticalPathAnalyzer.Client.Tool {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void RemoveHighLighting() {
|
|
|
|
|
if (_clusters == null) {
|
|
|
|
|
CriticalPathAnalyzerClient.LoggerInstance.Warn("Ignoring remove highlighting, clusters is null");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (ClusterDetails cluster in _clusters) {
|
|
|
|
|
UnhighlightCluster(cluster);
|
|
|
|
|
}
|
|
|
|
@ -77,8 +94,13 @@ namespace CriticalPathAnalyzer.Client.Tool {
|
|
|
|
|
Outliner.RemoveOutline(wireAddress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (ComponentAddress componentAddress in _highlightedComponents) {
|
|
|
|
|
Outliner.RemoveOutline(componentAddress);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
_clusters = null;
|
|
|
|
|
_highlightedWires.Clear();
|
|
|
|
|
_highlightedComponents.Clear();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void UnhighlightCluster(ClusterDetails cluster) {
|
|
|
|
|