Description of OpenAlea-Interface in GroIMP
-------------------------------------------
- GroIMP provides an HTTP-server on a arbitrary port (standard: 58070)
- data is transmitted via HTTP-POST
- variables for POST are:
- "graph": the scene graph to operate on
- "xlcode": the xl program
- "command": the command(s) of the xl program to execute
- response of the HTTP-request depends on the status code:
- status code 200 is transmitted when GroIMP run successfully
-> the response string is the new scene graph
- status code 400 is transmitted in an error case
-> the response string is an error message
- the Webserver requires you to use the content-type application/x-www-form-urlencoded
to transfer the data to the server. But curl uses multipart/form-data if you use the -F option.
You have to use --data or --data-urlencode instead.
curl -X POST http://localhost:58070 --data "command=init;2run" --data-urlencode graph@sample.xeg --data-urlencode xlcode@sample.xl
With that command line curl produces the transformed graph as output.
graph
-----
- based on a new scene graph language called xeg (xml exchange graph)
- a xsd specification is avaiable
- basic configuration:
type definitions for unknown node types (not in the standard)
root node
nodes
edges
- type definition:
- root node:
- node:
- edge:
- complete example:
xlcode
------
- a standard xl program as used in GroIMP
- to use own defined node types, use an equivalent definition as in xeg string
- example:
module XY extends Node {
float z;
}
protected void init() [
Axiom ==> XY;
]
public void run() [
a:XY ==> a Cylinder;
]
command
-------
- sequence of one ore more methods of the xl program
- methods must be public (except the "init"-method, which can be protected) and without parameters
- methods are separeted with semicolons
- to execute one method repeatedly, declare a number in front of the method name
- example: "init;3run" => execute one time the init-method, three times the run method