|
|
@ -9,56 +9,72 @@ using LogicWorld.Outlines;
|
|
|
|
namespace CriticalPathAnalyzer.Client.Tool {
|
|
|
|
namespace CriticalPathAnalyzer.Client.Tool {
|
|
|
|
public class PathHighLighter {
|
|
|
|
public class PathHighLighter {
|
|
|
|
private static readonly OutlineData Color = new OutlineData(new Color24(0xff0000));
|
|
|
|
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<ClusterDetails> _clusters = new List<ClusterDetails>();
|
|
|
|
|
|
|
|
private static List<ComponentAddress> _highlightedComponents = new List<ComponentAddress>();
|
|
|
|
private static List<WireAddress> _highlightedWires = new List<WireAddress>();
|
|
|
|
private static List<WireAddress> _highlightedWires = new List<WireAddress>();
|
|
|
|
|
|
|
|
|
|
|
|
public static void HighlightWires(AnalyzePathResponse response) {
|
|
|
|
public static void HighlightWires(AnalyzePathResponse response) {
|
|
|
|
_clusters = response.Clusters;
|
|
|
|
_clusters = response.Clusters;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (ClusterDetails clusterDetails in _clusters) {
|
|
|
|
|
|
|
|
HighlightCluster(clusterDetails);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
IWorldData world = Instances.MainWorld.Data;
|
|
|
|
IWorldData world = Instances.MainWorld.Data;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (ComponentAddress componentAddress in response.PerimeterComponents) {
|
|
|
|
|
|
|
|
if (!world.Contains(componentAddress)) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Outliner.Outline(componentAddress, PerimeterColor);
|
|
|
|
|
|
|
|
_highlightedComponents.Add(componentAddress);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (ClusterDetails clusterDetails in _clusters) {
|
|
|
|
private static void HighlightCluster(ClusterDetails cluster) {
|
|
|
|
foreach (ComponentAddress address in clusterDetails.ConnectingComponents) {
|
|
|
|
IWorldData world = Instances.MainWorld.Data;
|
|
|
|
if (!world.Contains(address)) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Outliner.Outline(address, Color);
|
|
|
|
foreach (ComponentAddress address in cluster.ConnectingComponents) {
|
|
|
|
|
|
|
|
if (!world.Contains(address)) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (ComponentAddress address in clusterDetails.LinkingComponents) {
|
|
|
|
Outliner.Outline(address, Color);
|
|
|
|
if (!world.Contains(address)) {
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Outliner.Outline(address, Color);
|
|
|
|
foreach (ComponentAddress address in cluster.LinkingComponents) {
|
|
|
|
|
|
|
|
if (!world.Contains(address)) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (PegAddress pegAddress in clusterDetails.Pegs) {
|
|
|
|
Outliner.Outline(address, Color);
|
|
|
|
if (!world.Contains(pegAddress.ComponentAddress)) {
|
|
|
|
}
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
foreach (PegAddress pegAddress in cluster.Pegs) {
|
|
|
|
|
|
|
|
if (!world.Contains(pegAddress.ComponentAddress)) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Outliner.Outline(pegAddress, Color);
|
|
|
|
|
|
|
|
|
|
|
|
Outliner.Outline(pegAddress, Color);
|
|
|
|
HashSet<WireAddress> wires = Instances.MainWorld.Data.LookupPegWires(pegAddress);
|
|
|
|
|
|
|
|
if (wires == null) {
|
|
|
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
HashSet<WireAddress> wires = Instances.MainWorld.Data.LookupPegWires(pegAddress);
|
|
|
|
foreach (WireAddress wireAddress in wires) {
|
|
|
|
if (wires == null) {
|
|
|
|
Wire wire = Instances.MainWorld.Data.Lookup(wireAddress);
|
|
|
|
continue;
|
|
|
|
if (wire == null) {
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (WireAddress wireAddress in wires) {
|
|
|
|
// We do not collect wires from output pegs. So if the first is an output peg, the other side must be an input -> collect.
|
|
|
|
Wire wire = Instances.MainWorld.Data.Lookup(wireAddress);
|
|
|
|
if (wire.Point1 == pegAddress || !wire.Point1.IsInputAddress()) {
|
|
|
|
if (wire == null) {
|
|
|
|
_highlightedWires.Add(wireAddress);
|
|
|
|
return;
|
|
|
|
Outliner.Outline(wireAddress, Color);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// We do not collect wires from output pegs. So if the first is an output peg, the other side must be an input -> collect.
|
|
|
|
|
|
|
|
if (wire.Point1 == pegAddress || !wire.Point1.IsInputAddress()) {
|
|
|
|
|
|
|
|
_highlightedWires.Add(wireAddress);
|
|
|
|
|
|
|
|
Outliner.Outline(wireAddress, Color);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -69,6 +85,7 @@ namespace CriticalPathAnalyzer.Client.Tool {
|
|
|
|
CriticalPathAnalyzerClient.LoggerInstance.Warn("Ignoring remove highlighting, clusters is null");
|
|
|
|
CriticalPathAnalyzerClient.LoggerInstance.Warn("Ignoring remove highlighting, clusters is null");
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach (ClusterDetails cluster in _clusters) {
|
|
|
|
foreach (ClusterDetails cluster in _clusters) {
|
|
|
|
UnhighlightCluster(cluster);
|
|
|
|
UnhighlightCluster(cluster);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -76,9 +93,14 @@ namespace CriticalPathAnalyzer.Client.Tool {
|
|
|
|
foreach (WireAddress wireAddress in _highlightedWires) {
|
|
|
|
foreach (WireAddress wireAddress in _highlightedWires) {
|
|
|
|
Outliner.RemoveOutline(wireAddress);
|
|
|
|
Outliner.RemoveOutline(wireAddress);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach (ComponentAddress componentAddress in _highlightedComponents) {
|
|
|
|
|
|
|
|
Outliner.RemoveOutline(componentAddress);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_clusters = null;
|
|
|
|
_clusters = null;
|
|
|
|
_highlightedWires.Clear();
|
|
|
|
_highlightedWires.Clear();
|
|
|
|
|
|
|
|
_highlightedComponents.Clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private static void UnhighlightCluster(ClusterDetails cluster) {
|
|
|
|
private static void UnhighlightCluster(ClusterDetails cluster) {
|
|
|
|