/**
* Represents roads by lines and locations by name-labeled points.
*/
protected void paintMap(java.awt.Graphics2D g2) {
Map envMap = getMapEnv().getMap();
Map aMap = (agentMap != null) ? agentMap : envMap;
List<Roadblock> roadblocks = new ArrayList<Roadblock>();
for (String l1 : envMap.getLocations()) {
Point2D pt1 = envMap.getPosition(l1);
List<String> linkedLocs = envMap.getLocationsLinkedTo(l1);
for (String l2 : aMap.getLocationsLinkedTo(l1))
if (!linkedLocs.contains(l2))
linkedLocs.add(l2);
for (String l2 : linkedLocs) {
Point2D pt2 = envMap.getPosition(l2);
g2.setColor(Color.lightGray);
g2.drawLine(x(pt1), y(pt1), x(pt2), y(pt2));
boolean blockedInEnv = !envMap.getLocationsLinkedTo(l2)
.contains(l1);
boolean blockedInAgent = !aMap.getLocationsLinkedTo(l2)
.contains(l1);
roadblocks.add(new Roadblock(pt1, pt2, blockedInEnv,
blockedInAgent));
if (blockedInEnv && blockedInAgent) {
boolean blockedInEnvOtherDir = !envMap
.getLocationsLinkedTo(l1).contains(l2);
boolean blockedInAgentOtherDir = !aMap
.getLocationsLinkedTo(l1).contains(l2);
roadblocks.add(new Roadblock(pt2, pt1,
blockedInEnvOtherDir, blockedInAgentOtherDir));
}
}