Changing graph layout and vertices #4441
Replies: 2 comments 1 reply
-
Hello and welcome to the aspiring graph API. Most of the above classes are my creation and are likely in a state of stale nascency, waiting to be fully developed. Some of the classes you mentioned above were created as a simplified entry point into the API. Further, the You should be able to use the The basic method used by the Sample Graph Plugin and the other graphs in the system is to offload layout position calculation to a background thread. The background thread will use the active layout to calculate vertex and edge positions via a call to If you really wanted to manipulate the vertex positions manually without using the above framework, then you should be able to do that via |
Beta Was this translation helpful? Give feedback.
-
The question regarding changing colors and shapes has a more nuanced answer. The basic vertex rendering in this system is done in a 'simplified' way that is meant to emulate Java's 'renderer' concept. The graph painting will ask each vertex for it's component and then paint that component into the UI. The benefit of this is that you can make very complicated vertices in your graph; the downside of this approach is that simple things, such as painting shapes and colors, have become more complicated. I do not think we have a simple example that shows how to use this API to create simple shape/color vertex painting. That being said, it is easily doable if you have some basic image painting knowledge. There is a test vertex that will create custom shapes and colors for use in painting. That can be seen here: https://github.com/NationalSecurityAgency/ghidra/blob/master/Ghidra/Framework/Graph/src/test/java/ghidra/graph/algo/viewer/AlgorithmTestSteppingVertex.java You can see
To emulate this behavior, you can override |
Beta Was this translation helpful? Give feedback.
-
I've been trying to figure out how to set a specific layout for my nodes in a plugin I'm working on. The issue I keep running into is that first, my nodes location is always set to null and I can'f figure out a way to edit them that works with the layout provider, or how to just set them using one of the Jung layouts. I also was wondering how to set a specific color/ shape for specific nodes. For example, if I wanted the initial node to be a green circle and the terminal node to be a red triangle.
My nodes extend DockingVisualVertex
my edges extend AbstractVisualEdge
and my graph extends FilteringVisualGraph
if those help any.
Beta Was this translation helpful? Give feedback.
All reactions