...
Info | |||||
---|---|---|---|---|---|
| |||||
The following tips might come in handy...
|
Now your workspace should look similar to this
Before you can test your layout code, you will have to register your new layout provider with KIML.
- Open the
META-INF/MANIFEST.MF
file again and switch to the Extensions tab. - Add an extension for
de.cau.cs.kieler.kiml.layout.layoutProviders
. - Right-click the extension and click New > layoutAlgorithm.
- Set the name to
Simple Test Layouter
and the class to your layout provider class name (use the browse button and enterSimpleLayoutProvider
). - Right-click the new layoutAlgorithm and click New > knownOption. Set option to
de.cau.cs.kieler.spacing
. - Add another knownOption for
de.cau.cs.kieler.borderSpacing
. - Save the editor.
- Your workspace should look similar to this
We will now have to add a new run configuration that will start an Eclipse instance with your layout code loaded into the application, ready to be used.
- Click Run > Debug Configurations...
- Right-click Eclipse Application and click New. Set the configuration's name to
Layout Test
. - In the Arguments tab, make sure the the program arguments include
-debug
and-consoleLog
. - On the Plug-ins tab, set Launch with to plug-ins selected below only.
- Click Deselect All
- .
- Check the Workspace item in the tree.
- Check the
de.cau.cs.kieler.core.kgraph.text.ui,
-
de.cau.cs.kieler.klighd.xtext
andorg.eclipse.ui.ide.application
plugins under Target Platform - Click Add Required Plug-ins. Press it twice (just to be sure!).
- Click Apply to save your changes and then Debug to start an Eclipse instance to test with.
Test the layouter in your new Eclipse instance:
...
- Click the green button with the yellow thunderbold and check the Enable view management and all other checkboxes.
- Click New > Project... > General > Project and set the project name to something like
Test
. - Right-click the new project and click New > Empty KEG Graph Other > KGraph > Random KGraph. Enter a meaningful name and click Finish.
- Put a few nodes into Open the diagram. To properly test your code, you will want to vary the sizes of the nodes. It may also be a good idea to get into the habit of giving each node a different name, such as N1, N2, etc. This will help you later if you have to debug your algorithmAnother view with graphical representations of the nodes should pop up.
- Open the Layout view through Window > Show View > Other... > KIELER Layout > Layout.
- With your KEG diagram selected, set the Layout Algorithm option in the Layout view to your new algorithm.
- Save your KEG diagram.
- Trigger automatic layout by clicking the layout button in the toolbar, or by hitting Ctrl+R L (first Ctrl+R, then L).
...
title | Tip |
---|
- Move the view somewhere such that you can see the view and the diagram simultaneously.
- Chose your Simple Test Layouter in the Layout Algorithm section of the Layout View.
- You should see something similar to this
Once you're satisfied with your node placement code, it's time to take care of edge routing.
...