Visualizing and Editing Graphs
Visualizing and Editing Graphs (Under Construction)
STEM uses color providers to determine the colors used for painting the map that appears during a simulation. The system goes through the graph elements that need to be painted and adapts each one of them into a color. This color is then used as the color for painting that element. If the element is the geographic nodes, then the color is used to fill the polygons that visually represent those nodes.
A dropdown box below the painted map allows the user running the simulation to choose the type of color provider to be used. STEM comes with a small set of color providers that can be used (like the Intensity and the SEIR). Developers can add new colors by using an extension point mechanism that allows them to plug in their customized color provider.
Follow the steps below to develop and deploy a customized color provider.
Step 1. Create the provider interface
Create a new interface that extends the org.eclipse.stem.ui.adapters.color.ColorProvider interface. This interface declares the methods that should be implemented by the color provider.
For example, org.eclipse.stem.ui.adapters.color.IntensityColorsLabelsMappingColorProvider indirectly extends the above interface and does not declare any additional methods on top of those already existing in the ColorProvider interface.
Step 2. Create the adapter
This class is where the actual work of choosing and providing the right color is done. It should implement the provider interface created in step 1 and the methods declared by it (including the methods declared by the ColorProvider interface). The adapter should also extend the ColorProviderAdapter class.