Skip to content
Alexander Nyßen edited this page Jun 7, 2017 · 16 revisions

Note to non-wiki readers: This documentation is generated from the Eclipse wiki - if you have corrections or additions it would be awesome if you added them in the original wiki page.

Introduction

The DOT component provides support for Graphviz DOT, in terms of

  • an Xtext-based *.dot file editor
  • support for Graphviz-based generation of different image formats (such as PDF, PNG, ...) for *.dot files
  • a Zest-based DOT Graph Viewer

It is internally decomposed into two modules, namely DOT and DOT.UI. There are also a couple of undeployed DOT Examples that demonstrate usage of the (still internal) API. The user documentation is provided in terms of the DOT User Guide.


DOT

  • feature: org.eclipse.gef.dot
  • bundle: org.eclipse.gef.dot

The DOT module of DOT realizes the serializer and parser for the DOT Editor as well as import/export functionality used by the DOT Graph View and the Sync Graphviz Export end-user features, as outlined in the DOT User Guide. It does not provide any public API (yet), but exposes its internal API (guarded by an x-friends directive).

{Root}

  • package: org.eclipse.gef.dot.internal

The {Root} package provides an importer (DotImport) and exporter (DotExport) between a Graphviz DOT and a related Graph representation. The imported or to be exported graph has to make use of the attributes defined in DotAttributes.

DotImport

DotImport provides support for importing a Graphviz DOT into a Graph data model, using the attributes defined in DotAttributes.

/* Create Graphs based on Graphviz Dot strings */
DotImport dotImport = new DotImport();
Graph graph = dotImport.importDot("graph { 1--2 ; 1--3 }");
Graph digraph = dotImport.importDot("digraph { 1->2 ; 1->3 }");

System.out.println(graph);
System.out.println(digraph);

Internally, DotImport is based on an Xtext-based parser and uses the Xtend dispatch functionality to dynamically create Graph graphs from the DOT abstract syntax tree (represented as an EMF model).

DotExport

DotExport can be used to serialize a Graph-model, which uses the attributes defined in DotAttributes to a Graphviz DOT.

/* Set up a directed graph with a single connection */
Graph graph = new Graph.Builder()
	.attr(DotAttributes::_setType, GraphType.DIGRAPH)
	.node("n1")
	.attr(DotAttributes::_setName, "1")
	.attr(DotAttributes::setLabel, "Node 1")
	.node("n2")
	.attr(DotAttributes::_setName, "2")
	.attr(DotAttributes::setLabel, "Node 2")
	.edge("n1", "n2")
	.attr(DotAttributes::setLabel, "A dotted edge")
	.attr(DotAttributes::setStyle, EdgeStyle.DOTTED.toString())
.build();

/* Export the graph to a DOT string */
System.out.println(new DotExport().exportDot(graph));

Internally, DotExport is based on Xtend to keep its runtime dependencies minimal.

DotAttributes

DotAttributes defines the (currently) supported Graphviz attributes. It supports validation and parsing of all attribute values, using a dedicated attribute parser and validator where the attributes follow a specific grammar.

DotExecutableUtils

DotExecutableUtils is a utility class that can be used to execute the native Graphviz DOT executable, which is internally used by the DOT Graph View and by the Sync Graphviz Export functionality. In combination with DotAttributes, DotExecutableUtils provides support for using the native Graphviz DOT executable for layouting, as depicted in the DotLayoutExample.


DOT.UI

  • feature: org.eclipse.gef.dot.internal.ui
  • bundle: org.eclipse.gef.dot.internal.ui

The DOT.UI module of DOT realizes the DOT Editor as well as the DOT Graph View as end-user features, as outlined in the DOT User Guide. It does not provide any public API (yet), but exposes its internal API (guarded by an x-friends directive).

{Root}

  • package: org.eclipse.gef.dot.internal.ui

The {Root} package provides org.eclipse.gef.common.attributes.IAttributeCopier implementations that can be used to transfer attributes defined by DotAttributes into those defined by org.eclipse.gef.zest.fx.ZestProperties, as well as other utility classes that are used to render DOT artifacts within a Zest viewer.

Dot2ZestAttributesConverter, Zest2DotAttributesConverter

Dot2ZestAttributesConverter and Zest2DotAttributesConverter are org.eclipse.gef.common.attributes.IAttributeCopier implementations that allow to convert between attributes defined by DotAttributes and org.eclipse.gef.zest.fx.ZestProperties. This is internally used by the DOT Graph View to render a DOT input based on Zest.

DotBSplineInterpolator

The DotBSplineInterpolator is a specific IConnectionInterpolator that can be used to properly render B-Splines as DOT specifies them for edge positions.

DotArrowShapeDecorations

The DotArrowShapeDecorations utility class provides implementations for the different arrow shape edge decorations supported by DOT.

Clone this wiki locally