Wiki source code of HTTP-based Service
Version 4.1 by uru on 2013/11/27 02:49
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | A simple HTTP GET request is used to retrieve the layouted version of the passed graph. You can just perform your own request to the correct URL and pass all required information as URL parameters. However, as we might change internal APIs we recommend you to use the (very small) wrapper implementations we provide for a specific language. We do not provide a wrapper for each language, feel free to write your own and contact us so we can add it to the list below. | ||
2 | |||
3 | == Language Bindings == | ||
4 | |||
5 | Each zip archive contains the wrapper class you can use to call our service as well as a small example illustrating the usage pattern for the specific language. | ||
6 | |||
7 | * [[JavaScript>>attach:Java-0.1.0.zip]] | ||
8 | * [[Java>>attach:Java-0.1.0.zip]] | ||
9 | * [[C#>>attach:C#-0.1.0.zip]] | ||
10 | |||
11 | == Examples == | ||
12 | |||
13 | The graph is passed in serialized form of either graph format. In this example we use the JSON format (for JavaScript also native JSON can be passed). | ||
14 | |||
15 | {{code title="graph"}} | ||
16 | "{id:\"root\",children:[{id:\"n1\",labels:[{text:\"n1\"}],width:100,height:100}," | ||
17 | + "{id:\"n2\",labels:[{text:\"n2\"}],width:100,height:50,children:[{id:\"n3\"," | ||
18 | + "labels:[{text:\"n3\"}],width:20,height:20},{id:\"n4\",labels:[{text:\"n4\"}],width:20," | ||
19 | + "height:20}],edges:[{id:\"e4\",source:\"n3\",target:\"n4\"}]}]," | ||
20 | + "edges:[{id:\"e1\",source:\"n1\",target:\"n2\"}]}"; | ||
21 | {{/code}} | ||
22 | |||
23 | {{code title="options"}} | ||
24 | spacing: 100 | ||
25 | algorithm: "de.cau.cs.kieler.klay.layered" | ||
26 | edgeRouting: ORTHOGONAL | ||
27 | {{/code}} | ||
28 | |||
29 | === JavaScript === | ||
30 | |||
31 | {{code language="js"}} | ||
32 | var graph = "[graph]"; | ||
33 | var options = { opt1: val1 }; | ||
34 | $.kielerLayout({graph: graph, options: options, | ||
35 | iFormat: 'org.json', oFormat: 'org.json', | ||
36 | success : function (data) { | ||
37 | console.log(data); | ||
38 | } | ||
39 | }); | ||
40 | {{/code}} | ||
41 | |||
42 | === Java === | ||
43 | |||
44 | {{code language="java"}} | ||
45 | String graph = "[graph]"; | ||
46 | Map<String, Object> opts = new HashMap<String, Object>(); | ||
47 | String layouted = KIELERLayout.layout(server, "org.json", "org.json", options, graph); | ||
48 | {{/code}} | ||
49 | |||
50 | === C# === | ||
51 | |||
52 | {{code language="c#"}} | ||
53 | String graph = "[graph]"; | ||
54 | Dictionary<String, Object> options = new Dictionary<String, Object>(); | ||
55 | String layouted = KIELER.KIELERLayout.layout(server, "org.json", "org.json", options, graph); | ||
56 | {{/code}} | ||
57 | |||
58 | |||
59 | |||
60 |