Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "GEF/GEF4/DOT"

< GEF‎ | GEF4
(rename DotProperties to DotAttributes within the description text)
Line 23: Line 23:
 
*'''bundle: org.eclipse.gef4.dot'''
 
*'''bundle: org.eclipse.gef4.dot'''
  
The [[#DOT|DOT]] module of [[GEF/GEF4/DOT|GEF4 DOT]] provides support for importing ([[#DotImport|DotImport]]) and exporting ([[#DotExport|DotExport]]) Graphviz DOT to/from a [[GEF/GEF4/Graph|GEF4 Graph]]-based model. The [[GEF/GEF4/Graph|GEF4 Graph]]-based model uses Graphviz specific attributes, which are defined in [[#DotAttributes|DotAttributes]].
+
The [[#DOT|DOT]] module of [[GEF/GEF4/DOT|GEF4 DOT]] realizes the serializer and parser for the DOT editor as well as the importer/exporter for the DOT Graph view and Graphviz export sync end-user features, as outlined in the [[GEF/GEF4/DOT/User Guide | GEF4 DOT User Guide]]. It does not provide any public API.
 
+
<div id="DOT:Root"></div>
+
=== {Root} ===
+
 
+
*'''package: org.eclipse.gef4.dot'''
+
 
+
The [[#DOT:Root|{Root}]] package provides an importer ([[#DotImport|DotImport]]) and exporter ([[#DotExport|DotExport]]) between a Graphviz DOT and a related [[GEF/GEF4/Graph|GEF4 Graph]] representation. The imported or to be exported graph has to make use of the attributes defined in [[#DotAttributes|DotAttributes]].
+
 
+
[[File:GEF4-DOT-root.png|818px]]
+
 
+
==== DotImport ====
+
<code>DotImport</code> provides support for importing a Graphviz DOT into a [[GEF/GEF4/Graph|GEF4 Graph]] data model, using the attributes defined in [[#DotAttributes|DotAttributes]].
+
 
+
<source lang="java" style="border-style:solid;border-color:#f2f2f2;border-width:1px;padding:10px;margin-bottom:10px">
+
/* We can create Graphs based on Graphviz Dot files and strings */
+
Graph graph = new DotImport().importDot("graph { 1--2 ; 1--3 }");
+
Graph digraph = new DotImport().importDot("digraph { 1->2 ; 1->3 }");
+
</source>
+
<small>The complete sample usage is available in the [http://git.eclipse.org/c/gef/org.eclipse.gef4.git/tree/org.eclipse.gef4.dot.examples/src/org/eclipse/gef4/dot/examples/ repository], more input samples can be found [http://git.eclipse.org/c/gef/org.eclipse.gef4.git/tree/org.eclipse.gef4.dot.tests/resources/ here].</small>
+
 
+
Internally, <code>DotImport</code> is based on an [http://wiki.eclipse.org/Xtext Xtext]-based parser. It uses the generated Xtext switch API to dynamically create [[GEF/GEF4/Graph | GEF4 Graph]] graphs from the DOT abstract syntax tree (represented as an EMF model).
+
 
+
==== DotExport ====
+
<code>DotExport</code> can be used to serialize a [[GEF/GEF4/Graph|GEF4 Graph]]-model, which uses the attributes defined in [[#DotAttributes|DotAttributes]] to a Graphviz DOT as follows:
+
 
+
<source lang="java" style="border-style:solid;border-color:#f2f2f2;border-width:1px;padding:10px;margin-bottom:10px">
+
/* Set up a directed graph with a single connection: */
+
Graph graph = new Graph.Builder()
+
.attr(DotAttributes._TYPE__G, DotAttributes._TYPE__G__GRAPH)
+
.node("n1")
+
.attr(DotAttributes._NAME__GNE, "1")
+
.attr(DotAttributes.LABEL__GNE, "Node 1")
+
.node("n2")
+
.attr(DotAttributes._NAME__GNE, "2")
+
.attr(DotAttributes.LABEL__GNE, "Node 2")
+
.edge("n1", "n2")
+
.attr(DotAttributes.LABEL__GNE, "A dotted edge")
+
.attr(DotAttributes.STYLE__GNE, EdgeStyle.DOTTED.toString())
+
.build();
+
 
+
/* Export the graph to a DOT string or a DOT file: */
+
System.out.println(new DotExport().exportDot(graph));
+
</source>
+
 
+
Internally, <code>DotExport</code> is based on [https://www.eclipse.org/xtend/ Xtend] to keep its runtime dependencies minimal.
+
 
+
==== DotAttributes ====
+
<code>DotAttributes</code> defines the (currently) supported [http://www.graphviz.org/doc/info/attrs.html Graphviz attributes].
+
  
 
----
 
----
Line 80: Line 32:
 
*'''bundle: org.eclipse.gef4.dot.ui'''
 
*'''bundle: org.eclipse.gef4.dot.ui'''
  
The [[#DOT.UI|DOT.UI]] module of [[GEF/GEF4/DOT|GEF4 DOT]] realizes the DOT editor as well as the DOT Graph viewer as end-user features. It does not provide any public API.
+
The [[#DOT.UI|DOT.UI]] module of [[GEF/GEF4/DOT|GEF4 DOT]] realizes the DOT editor as well as the DOT Graph viewer as end-user features, as outlined in the [[GEF/GEF4/DOT/User Guide | GEF4 DOT User Guide]]. It does not provide any public API.
  
 
[[Category:GEF]]
 
[[Category:GEF]]

Revision as of 12:17, 20 May 2016

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 GEF4 DOT component provides support for Graphviz DOT, in terms of

  • an Xtext-based .dot file editor
  • support for Graphviz-based generation of PDF-output for .dot files
  • a GEF4 Zest-based DOT Graph Viewer
  • API to import/export DOT to/from GEF4 Graph representations (which can be visualized with GEF4 Zest)

It is internally decomposed into two modules, namely DOT and DOT.UI. There are also a couple of undeployed DOT Examples. The user documentation is provided in terms of the GEF4 DOT User Guide.

GEF4-Components-DOT.png

This component was started as a project in the Google Summer of Code 2009 by Fabian Steeg, mentored by Ian Bull, for Zest. It was initially included in Zest 2 and has finally been migrated to GEF4 DOT, being now based on GEF4 Graph, GEF4 Layout, and GEF4 Zest.


DOT

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

The DOT module of GEF4 DOT realizes the serializer and parser for the DOT editor as well as the importer/exporter for the DOT Graph view and Graphviz export sync end-user features, as outlined in the GEF4 DOT User Guide. It does not provide any public API.


DOT.UI

  • feature: org.eclipse.gef4.dot.ui
  • bundle: org.eclipse.gef4.dot.ui

The DOT.UI module of GEF4 DOT realizes the DOT editor as well as the DOT Graph viewer as end-user features, as outlined in the GEF4 DOT User Guide. It does not provide any public API.

Back to the top