Jump to: navigation, search

Difference between revisions of "Visualizing and Editing Graphs"

(New page: = 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 throu...)
 
Line 1: Line 1:
 
= Visualizing and Editing Graphs (Under Construction) =
 
= 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.
+
STEM uses graphs as data structure to save information concerning population sizes, areas, spatial information, neighborhood of areas etc. When you start a scenario, you get the information of its appendent graphs in a visual form, e.g. when you see the outlines of the countries you included into you scenario.  
  
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.
+
The Graph Editor offers the possibility to visualize graphs without starting a scenario. You can get an overview of the data and edit titles, the size of the area, add populations or adjust geographic information of a node.
 +
   
  
Follow the steps below to develop and deploy a customized color provider.
+
==Step 1. Open the Editor ==
  
==Step 1. Create the provider interface==
+
When you right-click on the item "Models" within a project of the STEM Explorer, you'll see a context-menu that offers you to display the canonical graph of all graphs that are contained in your project models. When you right click on a specific model, you can display the canonical graph of all graphs that belong to your selected model.
 +
When you right-click on a selected graph under your models or the graphs folder, you'll be able to open the graph editor for this graph file.
  
Create a new interface that extends the ''org.eclipse.stem.ui.adapters.color.ColorProvider'' interface.
+
==Step 2. Editing the graph ==
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.
+
The nodes of the graph are small circles, where the color shows the affiliation to one subgraph, i.e. when you have opened a canonical graph consisting of several countries, the country nodes will have different colors. When you click on a node (provided the graph contains nodes) you get information about its title, its URI and all labels that are assigned to this node. You can move the nodes by keeping the left mouse button pressed and drag the node to your desired location.
 +
When you want to add a label to a node (e.g. add information about population size or area of the node) you must select one node by left-clicking on it and open the context menu with a right click. You can then add a population or area label and edit the values in the bottom part of the editor.
  
==Step 2. Create the adapter==
+
Edges can also be selected. Information about the class of edge and potential edge values are shown in the bottom part of the display.
  
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).
+
==Step 3. Saving the graph ==
The adapter should also extend the ''ColorProviderAdapter'' class.
+
 
 +
When you want to save

Revision as of 03:52, 1 April 2011

Visualizing and Editing Graphs (Under Construction)

STEM uses graphs as data structure to save information concerning population sizes, areas, spatial information, neighborhood of areas etc. When you start a scenario, you get the information of its appendent graphs in a visual form, e.g. when you see the outlines of the countries you included into you scenario.

The Graph Editor offers the possibility to visualize graphs without starting a scenario. You can get an overview of the data and edit titles, the size of the area, add populations or adjust geographic information of a node.


Step 1. Open the Editor

When you right-click on the item "Models" within a project of the STEM Explorer, you'll see a context-menu that offers you to display the canonical graph of all graphs that are contained in your project models. When you right click on a specific model, you can display the canonical graph of all graphs that belong to your selected model. When you right-click on a selected graph under your models or the graphs folder, you'll be able to open the graph editor for this graph file.

Step 2. Editing the graph

The nodes of the graph are small circles, where the color shows the affiliation to one subgraph, i.e. when you have opened a canonical graph consisting of several countries, the country nodes will have different colors. When you click on a node (provided the graph contains nodes) you get information about its title, its URI and all labels that are assigned to this node. You can move the nodes by keeping the left mouse button pressed and drag the node to your desired location. When you want to add a label to a node (e.g. add information about population size or area of the node) you must select one node by left-clicking on it and open the context menu with a right click. You can then add a population or area label and edit the values in the bottom part of the editor.

Edges can also be selected. Information about the class of edge and potential edge values are shown in the bottom part of the display.


Step 3. Saving the graph

When you want to save