Created the concept of graph types and display options for those graph types.

This commit is contained in:
ghidravore 2021-08-09 13:18:23 -04:00
parent cf293853e8
commit 210cc0bca0
84 changed files with 4102 additions and 1822 deletions

View file

@ -139,33 +139,6 @@ public interface GraphDisplay {
*/
public void close();
/**
* Defines a vertex attribute type for this graph window
*
* @param name the name of the attribute which may be attached to vertices
*/
public void defineVertexAttribute(String name);
/**
* Defines an edge attribute type for this graph window
*
* @param name the name of the attribute which may be attached to edges.
*/
public void defineEdgeAttribute(String name);
/**
* Sets the name of the attribute which should be used as the primary vertex label
*
* @param attributeName the name of the attribute to use as the display label for vertices
* @param alignment (ALIGN_LEFT, ALIGN_RIGHT, or ALIGN_CENTER)
* @param size the font size to use for the display label
* @param monospace true if the font should be monospaced
* @param maxLines the maximum number lines to display in the vertex labels
*/
public void setVertexLabelAttribute(String attributeName, int alignment, int size,
boolean monospace,
int maxLines);
/**
* Sets the graph to be displayed or consumed by this graph display
*
@ -174,10 +147,25 @@ public interface GraphDisplay {
* @param monitor a {@link TaskMonitor} which can be used to cancel the graphing operation
* @param append if true, append the new graph to any existing graph
* @throws CancelledException thrown if the graphing operation was cancelled
* @deprecated You should now use the form that takes in a {@link GraphDisplayOptions}
*/
public void setGraph(AttributedGraph graph, String title, boolean append,
TaskMonitor monitor)
throws CancelledException;
public default void setGraph(AttributedGraph graph, String title, boolean append,
TaskMonitor monitor) throws CancelledException {
setGraph(graph, new GraphDisplayOptions(graph.getGraphType()), title, append, monitor);
}
/**
* Sets the graph to be displayed or consumed by this graph display
*
* @param graph the graph to display or consume
* @param options {@link GraphDisplayOptions} for configuring how the display will
* render vertices and edges based on there vertex type and edge type respectively.
* @param title a title for the graph
* @param monitor a {@link TaskMonitor} which can be used to cancel the graphing operation
* @param append if true, append the new graph to any existing graph
* @throws CancelledException thrown if the graphing operation was cancelled
*/
public void setGraph(AttributedGraph graph, GraphDisplayOptions options, String title,
boolean append, TaskMonitor monitor) throws CancelledException;
/**
* Clears all graph vertices and edges from this graph display

View file

@ -22,9 +22,6 @@ import ghidra.util.classfinder.ExtensionPoint;
import ghidra.util.exception.GraphException;
import ghidra.util.task.TaskMonitor;
import java.util.Collections;
import java.util.Map;
/**
* Basic interface for objects that can display or otherwise consume a generic graph
*/
@ -46,19 +43,6 @@ public interface GraphDisplayProvider extends ExtensionPoint {
*/
public GraphDisplay getGraphDisplay(boolean reuseGraph, TaskMonitor monitor) throws GraphException;
/**
* Returns a GraphDisplay that can be used to "display" a graph
*
* @param reuseGraph if true, this provider will attempt to re-use an existing GraphDisplay
* @param properties a {@code Map} of property key/values that can be used to customize the display
* @param monitor the {@link TaskMonitor} that can be used to monitor and cancel the operation
* @return A GraphDisplay that can be used to display (or otherwise consume - e.g. export) the graph
* @throws GraphException thrown if there is a problem creating a GraphDisplay
*/
default GraphDisplay getGraphDisplay(boolean reuseGraph, Map<String, String> properties,
TaskMonitor monitor) throws GraphException {
return getGraphDisplay(reuseGraph, monitor);
}
/**
* Provides an opportunity for this provider to register and read tool options