Skip to content

Commit 7104e4f

Browse files
author
Christoph Daniel Schulze
committed
Docs: New website.
1 parent 9e73244 commit 7104e4f

File tree

80 files changed

+5044
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

80 files changed

+5044
-0
lines changed

docs/config.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
languageCode = "en-us"
2+
title = "Eclipse Layout Kernel"
3+
baseurl = "https://www.eclipse.org/elk/"
4+
canonifyURLs = true
5+

docs/content/_index.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
---
2+
title: "Bla bla bla"
3+
description: "Blupp blupp blupp"
4+
---
5+
6+
# Eclipse Layout Kernel
7+
8+
This is the content of the main page.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
title: "Algorithm Developers"
3+
menu:
4+
main:
5+
identifier: "AlgorithmDevelopers"
6+
parent: Documentation
7+
weight: 30
8+
---
9+
10+
While the layout algorithms implemented in ELK already cover a wide range of layout styles, your particular application may have more specific requirements. In these cases, it may become necessary to implement your own layout algorithm, which is what this part of the documentation is all about.
11+
12+
Implementing your own layout algorithm basically consists of the following steps:
13+
14+
1. Install the _Eclipse Layout Kernel SDK_ into your Eclipse development environment.
15+
1. Create and configure a new Eclipse plug-in project.
16+
1. Create and register a `melk` file that describes your algorithm and its support of layout properties.
17+
1. Implement your algorithm, updating the `melk` file along the way.
18+
1. Debug your algorithm.
19+
20+
Note that we have deliberately left out the part of "pulling your hair out while trying to understand which wretched detail of your complicated algorithm causes it to fail spectacularly" (we've been there...).
21+
22+
**Before you start:**
23+
This section assumes that you have basic knowledge of how the _Eclipse Layout Kernel_ works. You should at least have worked through the [Graph Data Structure]({{< ref "documentation/ToolDevelopers/GraphDataStructure.md" >}}) and [Using Algorithms Directly]({{< ref "documentation/ToolDevelopers/UsingAlgorithmsDirectly.md" >}}) sections.
24+
25+
**Once you are ready to start:**
26+
Use the navigation bar to the right to work your way through each of those steps.
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
---
2+
title: "Algorithm Debugging"
3+
menu:
4+
main:
5+
identifier: "AlgorithmDebugging"
6+
parent: "AlgorithmDevelopers"
7+
weight: 50
8+
---
9+
10+
The Eclipse Layout Kernel SDK provides two views built specifically for debugging your layout algorithm: the layout graph view and the execution time view.
11+
12+
13+
# Layout Graph View
14+
15+
{{< image src="layout_graph_view.png" alt="Layout Graph View" >}}
16+
17+
The layout graph view registers with the `DiagramLayoutEngine` to be notified whenever a layout run finishes and displays the layout graph exactly as it comes out of the layout algorithm, without any modifications applied. Use this view to check if your algorithm works and if you got the coordinate system right.
18+
19+
Note that the layout graph view allows you to export the displayed graph as a PNG image file. It also allows you to display debug graph files (see below).
20+
21+
Open the layout graph view by clicking _Window_ -> _Show View_ -> _Other_ and select _Layout Graph_ from the _Eclipse Diagram Layout_ category.
22+
23+
24+
# Layout Time View
25+
26+
{{< image src="layout_time_view.png" alt="Layout Time View" >}}
27+
28+
The layout time view registers with the `DiagramLayoutEngine` to be notified whenever a layout run finishes and displays which steps the layout run consisted of and, if enabled, how much time each step took to run. Measuring these execution times has to be explicitly enabled in the preferences:
29+
30+
{{< image src="layout_time_view_enable.png" alt="Enabling layout time measurements" >}}
31+
32+
Once enabled, the view displays two values for each item: the _time_ and the _local time_. The former is the amount of time spent for an item and all of its sub-items. Local time is the time spent on the item alone, without any sub-items (this value is omitted for items that do not have any sub-items, since it would be equal to the normal time value anyway).
33+
34+
To take advantage of the layout time view, your algorithm must make proper use of the `IElkProgressMonitor` passed to it. The tree of progress monitors (and sub-monitors) is what gets displayed in the layout time view. Be sure to do something like this:
35+
36+
```java
37+
monitor.begin("My rather good layout algorithm", 2);
38+
39+
executePhase1(monitor.subTask(1));
40+
executePhase2(monitor.subTask(1));
41+
42+
monitor.done();
43+
```
44+
45+
Open the layout graph view by clicking _Window_ -> _Show View_ -> _Other_ and select _Layout Time_ from the _Eclipse Diagram Layout_ category.
46+
47+
48+
# Debug Files
49+
50+
The ELK preference page (see above) contains another setting: _Debug graph output_. Enabling this will cause the `DiagramLayoutEngine` to save the layout graph just before automatic layout is run. The graphs are placed in your user folder, in a subfolder called `elk/diagram_layout_engine`. The graph files can be displayed by the layout graph view, even though that usually is not very helpful since they may not contain any valid layout data yet.
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
title: "Algorithm Implementation"
3+
menu:
4+
main:
5+
identifier: "AlgorithmImplementation"
6+
parent: "AlgorithmDevelopers"
7+
weight: 40
8+
---
9+
10+
Once everything is set up, it is time to actually implement your algorithm. The problem your layout algorithm has to solve can be summarized as follows: given an input graph (possibly with existing coordinates), compute coordinates for all graph elements and routings for all edges (subject to layout properties the graph is annotated with) and annotate the layout graph accordingly. Note that the input graph defines the layout problem, but also carries the resulting coordinate assignment after your algorithm has executed.
11+
12+
While developing your algorithm, you will regularly switch back and forth between doing that and changing [your metadata]({{< ref "documentation/AlgorithmDevelopers/MetadataLanguage.md">}}).
13+
14+
15+
## Your Algorithm's Main Class
16+
17+
However many classes a layout algorithm consists of, it always provides one entry class that inherits from `AbstractLayoutProvider` and implements the single most important method for your algorithm:
18+
19+
```java
20+
void layout(KNode layoutGraph, IElkProgressMonitor progressMonitor);
21+
```
22+
23+
Let's go through the parameters in reverse order (because of reasons). The `progressMonitor` parameter should be used to track progress and check if the user wants to cancel the layout operation. Actually canceling when the user wants to cancel is one of those features that will help your software stand out from many other programs, so take this opportunity to shine!
24+
25+
The `layoutGraph` parameter is more important, however. It defines the layout problem your algorithm should solve, in several ways. First, it defines the structure of the graph to be laid out: which nodes exist, how are they connected, and so on. Second, each graph element can have [layout options]({{< ref "documentation/ToolDevelopers/GraphDataStructure/LayoutOptions.md">}}) attached to it that are supposed to influence what your layout algorithm does with them. And third, each element may have pre-existing [coordinates or bend points]({{< ref "documentation/ToolDevelopers/GraphDataStructure/CoordinateSystem.md">}}) associated with it that your algorithm may want to make use of. Those existing coordinates will be overwritten by your algorithm to hold the new, computed coordinates.
26+
27+
Note that the layout graph may contain nodes that themselves contain further nodes. By default, layout algorithms are only supposed to compute coordinates for the direct children of the `layoutGraph` and then set the size for the `layoutGraph` itself. However, if your layout algorithm supports hierarchical layout, and if hierarchical layout is requested (which is done through the `CoreOptions.HIERARCHY_HANDLING` layout option), you will also compute coordinates for children of children.
28+
29+
There are two more methods your algorithm can, but does not have to implement:
30+
31+
* `void initialize(String parameter);`
32+
33+
This method can be used to initialize data structures and prepare things. This method is called exactly once when an instance of your `AbstractLayoutProvider` subclass is created. Note that a single instance of your class can be used for multiple layout runs.
34+
35+
The `parameter` parameter is a bit tricky. Most layout algorithms won't have any need for it, but some may adjust their behavior depending on its value. One example is our interface to the [Graphviz](http://www.graphviz.org/) library that provides different layout algorithms. We only implement a single subclass of `AbstractLayoutProvider`, but each instance is passed a parameter value that indicates which of the Graphviz algorithms it will execute when the `layout(...)` method is called. Of course, which parameter to pass must be defined in [your metadata file]({{< ref "documentation/AlgorithmDevelopers/MetadataLanguage.md">}}).
36+
37+
* `void dispose();`
38+
39+
Called before your `AbstractLayoutProvider` subclass is thrown towards the garbage collector.
40+
41+
42+
## Layout Options
43+
44+
It is worth reiterating here that it is important which `IProperty` instance your algorithm uses to retrieve the value of a layout option set on a graph element. Since the [ELK metadata tooling]({{< ref "documentation/AlgorithmDevelopers/MetadataLanguage.md">}}) generates a separate class with a complete set of `IProperty` instances for each algorithm, it makes sense to use these instances. The reason is that using them ensures that you get the correct default values configured for your layout algorithm when accessing layout options that were not set on a graph element.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
title: "Creating a New Project"
3+
menu:
4+
main:
5+
identifier: "CreatingANewProject"
6+
parent: "AlgorithmDevelopers"
7+
weight: 20
8+
---
9+
10+
Layout algorithms are developed as _Eclipse Plug-in Projects_. There's a few things to setup to get your project ready, which is what we will work through here.
11+
12+
{{% note title="If you have nothing better to do&hellip;" mode="info" %}}
13+
[This ticket](https://github.com/eclipse/elk/issues/29) is all about adding an _ELK Project Wizard_ to the ELK SDK that will help people create new layout algorithm projects that are already perfectly setup. If you want to make people's lifes better but don't know how, here's your chance!
14+
{{% /note %}}
15+
16+
17+
## Creating a New Plug-in
18+
19+
Follow these steps to create a new plug-in:
20+
21+
1. From the _File_ menu, select _New - Project..._.
22+
1. From the _Plug-in Development_ category, select _Plug-in Project_ and click _Next_.
23+
1. Configure your project's basic settings, in particular its name, and click _Next_.
24+
1. Configure your project's content. The _Properties_ should be somewhat sensible, but don't really matter all that much. In the _Options_ section, uncheck everything. Layout algorithm projects normally don't need an activator class, and don't normally make contributions to the UI. Also, don't create a rich client application. Click _Finish_.
25+
26+
The _Package Explorer_ now shows a new project for your plug-in which we will configure in the next section.
27+
28+
29+
## Setting Up Your Plug-in
30+
31+
Your plug-in needs to declare dependencies to ELK's most important plug-ins: `org.eclipse.elk.graph` (which contains the graph model that will be the input to your layout algorithm) and `org.eclipse.elk.core` (which contains the core ELK code). Follow these steps to add the dependencies:
32+
33+
1. Open the `MANIFEST.MF` file, located in your plug-in's `META_INF` folder. The _Plug-in Manifest Editor_ will open up, which is divided into several pages that you can switch between using the controls at the bottom of the editor.
34+
1. Open the editor's _Dependencies_ tab.
35+
1. Click the left _Add..._ button to add a dependency. In the dialog that pops up, search for the `org.eclipse.elk.graph` plug-in and click _OK_.
36+
1. Repeat for ELK's core plug-in, `org.eclipse.elk.core`.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: "Getting Eclipse Ready"
3+
menu:
4+
main:
5+
identifier: "GettingEclipseReady"
6+
parent: "AlgorithmDevelopers"
7+
weight: 10
8+
---
9+
10+
Developing layout algorithms requires you to have the _Eclipse Layout Kernel SDK_ installed in your Eclipse installation. Follow these steps to install it:
11+
12+
1. Start Eclipse and select _Help - Install New Software..._ from the menu.
13+
1. In the _Work with:_ field, enter the address of our release or nightly update site, which you can find [on our Downloads page]({{< sectionref "downloads" >}}).
14+
1. From the _Eclipse Layout Kernel_ category, check _Eclipse Layout Kernel (Incubation) - SDK_ as well as _Eclipse Layout Kernel (Incubation) - SDK (sources)_ and click _Next_.
15+
1. Follow the instructions of the installation wizard, accepting all of the license agreements.
16+
1. Restart Eclipse.
17+
18+
After the restart, there won't seem to be much of a difference. Because there isn't. But rest assured that your development environment is now perfectly prepared for what is about to come.

0 commit comments

Comments
 (0)