MapAgent

Björn Bringert, bringert@cs.chalmers.se

Introduction

MapAgent is an OAA agent which displays a map showing a graph on top of a bakground image. The agent has solvables for drawing labelled edges on the map and for getting user clicks on nodes.

Download

MapAgent is currently distributed as part of the tramdemo system.

Configuration

MapAgent is currently geared towards transport networks and other systems which can be represented by a graph.

The agent is configured by a properties file. Here is an example of such a file:

graph: /gbg.dot
clickThreshold: 20.0
backgroundImage: /mapbg.png

These are the properties used by MapAgent:

graph
Java resource name for a file with the graph description. The graph description uses a subset of the DOT language. The file should be UTF-8 encoded. Example of a graph description:
digraph
{
  Harlanda [label = "Härlanda", pos = "900,720"];
  Harlanda -> Redbergsplatsen [label = "1", dist = 2.0];
  Harlanda -> OstraSjukhuset [label = "1", dist = 6.0];

  Redbergsplatsen [label = "Redbergsplatsen", pos = "750,680"];
  Redbergsplatsen -> Centralstationen [label = "1", dist = 6.0];
  Redbergsplatsen -> Harlanda [label = "1", dist = 2.0];

  ...
}
clickThreshold
The radius of the clickable circles around nodes, in map units (i.e. the same units as the coordinates used for node placment).
backgroundImage
Java resource name for an image file containing a background image for the map. The image is scaled to fit the map display size.

NOTE: The path names in the properties file are Java resource names, so leading slashes mean to look in the root of the package hierarchy to find the file in the current directory.

Running

If the map properties file is gbg.properties and the facilitator is running on $FAC_HOST, port $FAC_PORT, MapAgent is started with:

$ java -cp $CLASSPATH:tramdemo.jar se.chalmers.cs.gf.tramdemo.MapAgent /gbg.properties -oaa_connect "tcp('${FAC_HOST}',${FAC_PORT})"

Notes

Solvables

MapAgent declares these solvables:

draw

draw(Instrs)

Parameters

Instrs
A string which consists of a number of drawing instructions. Must be instantiated. Each drawing instruction is terminated by a semicolon. The supported instructions are:
clear
Clear all old drawings.
drawEdge(label, [node_label, node_label, ...])
Draw some edges with a common label.

Examples

clicks

clicks(Clicks)

Parameters

Clicks
A cronologically ordered list of clicks that have occured since the last time this solvable was called. Must not be instantiated. Each click is represented by a struct: click(Nodes), where Nodes is a list of node labels that the click was close to.

Examples