From ccaf1fea59e99e1ff5e50c884b636a1e984979f7 Mon Sep 17 00:00:00 2001 From: Tom Nelson Date: Wed, 3 Mar 2021 19:51:52 +0000 Subject: [PATCH 1/3] update layout names and help text. --- .../topics/GraphServices/GraphDisplay.htm | 58 ++++++++++--------- .../graph/visualization/LayoutFunction.java | 24 ++++---- 2 files changed, 42 insertions(+), 40 deletions(-) diff --git a/Ghidra/Features/GraphServices/src/main/help/help/topics/GraphServices/GraphDisplay.htm b/Ghidra/Features/GraphServices/src/main/help/help/topics/GraphServices/GraphDisplay.htm index ae6bf805d0..30810d250d 100644 --- a/Ghidra/Features/GraphServices/src/main/help/help/topics/GraphServices/GraphDisplay.htm +++ b/Ghidra/Features/GraphServices/src/main/help/help/topics/GraphServices/GraphDisplay.htm @@ -111,63 +111,65 @@
diff --git a/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/LayoutFunction.java b/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/LayoutFunction.java index 00690e8436..a08296ff63 100644 --- a/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/LayoutFunction.java +++ b/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/LayoutFunction.java @@ -45,10 +45,10 @@ class LayoutFunction static final String MIN_CROSS_LONGEST_PATH = "Hierarchical MinCross Longest Path"; static final String MIN_CROSS_NETWORK_SIMPLEX = "Hierarchical MinCross Network Simplex"; static final String MIN_CROSS_COFFMAN_GRAHAM = "Hierarchical MinCross Coffman Graham"; - static final String EXP_MIN_CROSS_TOP_DOWN = "Experimental Hierarchical MinCross Top Down"; - static final String EXP_MIN_CROSS_LONGEST_PATH = "Experimental Hierarchical MinCross Longest Path"; - static final String EXP_MIN_CROSS_NETWORK_SIMPLEX = "Experimental Hierarchical MinCross Network Simplex"; - static final String EXP_MIN_CROSS_COFFMAN_GRAHAM = "Experimental Hierarchical MinCross Coffman Graham"; + static final String VERT_MIN_CROSS_TOP_DOWN = "Vertical Hierarchical MinCross Top Down"; + static final String VERT_MIN_CROSS_LONGEST_PATH = "Vertical Hierarchical MinCross Longest Path"; + static final String VERT_MIN_CROSS_NETWORK_SIMPLEX = "Vertical Hierarchical MinCross Network Simplex"; + static final String VERT_MIN_CROSS_COFFMAN_GRAHAM = "Vertical Hierarchical MinCross Coffman Graham"; static final String TREE = "Hierarchical"; static final String RADIAL = "Radial"; static final String BALLOON = "Balloon"; @@ -66,10 +66,10 @@ class LayoutFunction return new String[] { TIDIER_TREE, TREE, TIDIER_RADIAL_TREE, MIN_CROSS_TOP_DOWN, MIN_CROSS_LONGEST_PATH, MIN_CROSS_NETWORK_SIMPLEX, MIN_CROSS_COFFMAN_GRAHAM, CIRCLE, - EXP_MIN_CROSS_TOP_DOWN, - EXP_MIN_CROSS_LONGEST_PATH, - EXP_MIN_CROSS_NETWORK_SIMPLEX, - EXP_MIN_CROSS_COFFMAN_GRAHAM, + VERT_MIN_CROSS_TOP_DOWN, + VERT_MIN_CROSS_LONGEST_PATH, + VERT_MIN_CROSS_NETWORK_SIMPLEX, + VERT_MIN_CROSS_COFFMAN_GRAHAM, KAMADA_KAWAI, FRUCTERMAN_REINGOLD, RADIAL, BALLOON, GEM }; } @@ -112,25 +112,25 @@ class LayoutFunction . edgeAwareBuilder() .edgeComparator(edgeTypeComparator) .layering(Layering.COFFMAN_GRAHAM); - case EXP_MIN_CROSS_TOP_DOWN: + case VERT_MIN_CROSS_TOP_DOWN: return EiglspergerLayoutAlgorithm . edgeAwareBuilder() .edgeComparator(edgeTypeComparator) .favoredEdgePredicate(favoredEdgePredicate) .layering(Layering.TOP_DOWN); - case EXP_MIN_CROSS_LONGEST_PATH: + case VERT_MIN_CROSS_LONGEST_PATH: return EiglspergerLayoutAlgorithm . edgeAwareBuilder() .edgeComparator(edgeTypeComparator) .favoredEdgePredicate(favoredEdgePredicate) .layering(Layering.LONGEST_PATH); - case EXP_MIN_CROSS_NETWORK_SIMPLEX: + case VERT_MIN_CROSS_NETWORK_SIMPLEX: return EiglspergerLayoutAlgorithm . edgeAwareBuilder() .edgeComparator(edgeTypeComparator) .favoredEdgePredicate(favoredEdgePredicate) .layering(Layering.NETWORK_SIMPLEX); - case EXP_MIN_CROSS_COFFMAN_GRAHAM: + case VERT_MIN_CROSS_COFFMAN_GRAHAM: return EiglspergerLayoutAlgorithm . edgeAwareBuilder() .edgeComparator(edgeTypeComparator) From bdcf82e3e130d1ee701886d9958b450e33d9a2b1 Mon Sep 17 00:00:00 2001 From: ghidra007 Date: Fri, 7 May 2021 17:09:17 +0000 Subject: [PATCH 2/3] GP-737 new graph layout branch - added hack to get help working right for algs with subitems. --- .../main/help/help/topics/GraphServices/GraphDisplay.htm | 6 ++++-- .../ghidra/graph/visualization/DefaultGraphDisplay.java | 9 ++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/Ghidra/Features/GraphServices/src/main/help/help/topics/GraphServices/GraphDisplay.htm b/Ghidra/Features/GraphServices/src/main/help/help/topics/GraphServices/GraphDisplay.htm index 30810d250d..d42661be77 100644 --- a/Ghidra/Features/GraphServices/src/main/help/help/topics/GraphServices/GraphDisplay.htm +++ b/Ghidra/Features/GraphServices/src/main/help/help/topics/GraphServices/GraphDisplay.htm @@ -122,11 +122,13 @@ Compact Radial is the TidierTree Layout Algorithm with the root(s) at the center and child vertices radiating outwards. -
  • Hierarchical MinCross is the Sugiyama Layout Algorithm with optimizations. It attempts to +
  • + Hierarchical MinCross is the Sugiyama Layout Algorithm with optimizations. It attempts to route edges around vertices in order to reduce crossing. There are four layering algorithms (below)
  • -
  • Vertical Hierarchical MinCross is the Sugiyama Layout Algorithm with optimizations. It attempts to +
  • + Vertical Hierarchical MinCross is the Sugiyama Layout Algorithm with optimizations. It attempts to route edges around vertices in order to reduce crossing. If there is a favored EdgeType, an attempt is made to line up those favored edges so they are vertical in the presentation. There are four layering algorithms:
  • diff --git a/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/DefaultGraphDisplay.java b/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/DefaultGraphDisplay.java index de890a5582..e062bd8dac 100644 --- a/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/DefaultGraphDisplay.java +++ b/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/DefaultGraphDisplay.java @@ -51,7 +51,6 @@ import org.jungrapht.visualization.renderers.Renderer; import org.jungrapht.visualization.renderers.Renderer.VertexLabel; import org.jungrapht.visualization.renderers.Renderer.VertexLabel.Position; import org.jungrapht.visualization.selection.MutableSelectedState; -import org.jungrapht.visualization.selection.VertexEndpointsSelectedEdgeSelectedState; import org.jungrapht.visualization.transform.*; import org.jungrapht.visualization.transform.shape.MagnifyImageLensSupport; import org.jungrapht.visualization.transform.shape.MagnifyShapeTransformer; @@ -755,6 +754,14 @@ public class DefaultGraphDisplay implements GraphDisplay { for (String layoutName : names) { ActionState state = new ActionState<>(layoutName, DefaultDisplayGraphIcons.LAYOUT_ALGORITHM_ICON, layoutName); + + if (layoutName.contains("Vertical Hierarchical MinCross")) { + layoutName = "Vertical Hierarchical MinCross"; + } + else if (layoutName.contains("Hierarchical MinCross")) { + layoutName = "Hierarchical MinCross"; + } + state.setHelpLocation(new HelpLocation(ACTION_OWNER, layoutName)); actionStates.add(state); } From 43b940e0a9e184c15b28b56be3842a2d4b8ad8a5 Mon Sep 17 00:00:00 2001 From: ghidra007 Date: Fri, 7 May 2021 21:06:42 +0000 Subject: [PATCH 3/3] GP-737 new graph layout branch - fixed help anchor issues and finished review suggestions. --- .../topics/GraphServices/GraphDisplay.htm | 26 ++++++++----------- .../visualization/DefaultGraphDisplay.java | 12 +++++---- .../graph/visualization/LayoutFunction.java | 4 ++- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Ghidra/Features/GraphServices/src/main/help/help/topics/GraphServices/GraphDisplay.htm b/Ghidra/Features/GraphServices/src/main/help/help/topics/GraphServices/GraphDisplay.htm index d42661be77..fc4b513635 100644 --- a/Ghidra/Features/GraphServices/src/main/help/help/topics/GraphServices/GraphDisplay.htm +++ b/Ghidra/Features/GraphServices/src/main/help/help/topics/GraphServices/GraphDisplay.htm @@ -111,7 +111,7 @@
    diff --git a/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/DefaultGraphDisplay.java b/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/DefaultGraphDisplay.java index e062bd8dac..3cb3d8c91a 100644 --- a/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/DefaultGraphDisplay.java +++ b/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/DefaultGraphDisplay.java @@ -755,14 +755,16 @@ public class DefaultGraphDisplay implements GraphDisplay { ActionState state = new ActionState<>(layoutName, DefaultDisplayGraphIcons.LAYOUT_ALGORITHM_ICON, layoutName); - if (layoutName.contains("Vertical Hierarchical MinCross")) { - layoutName = "Vertical Hierarchical MinCross"; + // condense hierarchical action help to the top-level help description + String anchor = layoutName; + if (layoutName.contains(LayoutFunction.VERT_MIN_CROSS)) { + anchor = LayoutFunction.VERT_MIN_CROSS; } - else if (layoutName.contains("Hierarchical MinCross")) { - layoutName = "Hierarchical MinCross"; + else if (layoutName.contains(LayoutFunction.MIN_CROSS)) { + anchor = LayoutFunction.MIN_CROSS; } - state.setHelpLocation(new HelpLocation(ACTION_OWNER, layoutName)); + state.setHelpLocation(new HelpLocation(ACTION_OWNER, anchor)); actionStates.add(state); } return actionStates; diff --git a/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/LayoutFunction.java b/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/LayoutFunction.java index a08296ff63..5c015856bf 100644 --- a/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/LayoutFunction.java +++ b/Ghidra/Features/GraphServices/src/main/java/ghidra/graph/visualization/LayoutFunction.java @@ -41,10 +41,12 @@ class LayoutFunction static final String CIRCLE = "Circle"; static final String TIDIER_TREE = "Compact Hierarchical"; static final String TIDIER_RADIAL_TREE = "Compact Radial"; + static final String MIN_CROSS = "Hierarchical MinCross"; //not an alg, just a parent category static final String MIN_CROSS_TOP_DOWN = "Hierarchical MinCross Top Down"; static final String MIN_CROSS_LONGEST_PATH = "Hierarchical MinCross Longest Path"; static final String MIN_CROSS_NETWORK_SIMPLEX = "Hierarchical MinCross Network Simplex"; static final String MIN_CROSS_COFFMAN_GRAHAM = "Hierarchical MinCross Coffman Graham"; + static final String VERT_MIN_CROSS = "Vertical Hierarchical MinCross"; //not an alg, just a parent category static final String VERT_MIN_CROSS_TOP_DOWN = "Vertical Hierarchical MinCross Top Down"; static final String VERT_MIN_CROSS_LONGEST_PATH = "Vertical Hierarchical MinCross Longest Path"; static final String VERT_MIN_CROSS_NETWORK_SIMPLEX = "Vertical Hierarchical MinCross Network Simplex"; @@ -52,7 +54,7 @@ class LayoutFunction static final String TREE = "Hierarchical"; static final String RADIAL = "Radial"; static final String BALLOON = "Balloon"; - static final String GEM = "Gem (Graph Embedder)"; + static final String GEM = "GEM"; Predicate favoredEdgePredicate; Comparator edgeTypeComparator;