// Path: src/main/java/se/oru/coordination/coordination_oru/RobotReport.java
// public class RobotReport {
// 	
// 	private Pose pose = null;
// 	private int pathIndex = -1;
// 	private double velocity = 0.0;
// 	private double distanceTraveled = 0.0;
// 	private int criticalPoint = -1;
// 	private int robotID = -1;
// 	
// 	/**
// 	 * Create a {@link RobotReport} with given current state of the robot.
// 	 * @param pose The current pose of the robot.
// 	 * @param pathIndex The index of the last pose passed by the robot. 
// 	 * @param velocity The current speed of the robot.
// 	 * @param distanceTraveled The distance traveled so far along the current current path.
// 	 * @param criticalPoint The current active critical point of the robot (-1 if no critical point).
// 	 */
// 	public RobotReport(int robotID, Pose pose, int pathIndex, double velocity, double distanceTraveled, int criticalPoint) {
// 		this.robotID = robotID;
// 		this.pose = pose;
// 		this.velocity = velocity;
// 		this.pathIndex = pathIndex;
// 		this.distanceTraveled = distanceTraveled;
// 		this.criticalPoint = criticalPoint;
// 	}
// 	
// 	/**
// 	 * Get the ID of the robot to which this report refers to.
// 	 * @return The ID of the robot.
// 	 */
// 	public int getRobotID() {
// 		return this.robotID;
// 	}
// 
// 	/**
// 	 * Get the current pose of the robot.
// 	 * @return The current pose of the robot.
// 	 */
// 	public Pose getPose() {
// 		return pose;
// 	}
// 
// 	/**
// 	 * Get the index of the last pose passed by the robot. 
// 	 * @return The index of the last pose passed by the robot.
// 	 */
// 	public int getPathIndex() {
// 		return pathIndex;
// 	}
// 
// 	/**
// 	 * Get the current speed of the robot.
// 	 * @return The current speed of the robot.
// 	 */
// 	public double getVelocity() {
// 		return velocity;
// 	}
// 
// 	/**
// 	 * Get the distance traveled so far along the current current path.
// 	 * @return The distance traveled so far along the current current path.
// 	 */
// 	public double getDistanceTraveled() {
// 		return distanceTraveled;
// 	}
// 
// 	/**
// 	 * Get the current active critical point of the robot (-1 if no critical point).
// 	 * @return The current active critical point of the robot (-1 if no critical point).
// 	 */
// 	public int getCriticalPoint() {
// 		return criticalPoint;
// 	}
// 
// 	@Override
// 	public String toString() {
// 		return "Distance: " + MetaCSPLogging.printDouble(this.distanceTraveled,4) +  "  Pose: " + this.pose + "  Index: " + this.pathIndex + "  Velocity: " + MetaCSPLogging.printDouble(velocity,4);
// 	}
// 
// }


import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.image.BufferedImage;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import javax.imageio.ImageIO;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.websocket.api.RemoteEndpoint;
import org.metacsp.multi.spatial.DE9IM.GeometricShapeDomain;
import org.metacsp.multi.spatioTemporal.paths.Pose;
import org.metacsp.multi.spatioTemporal.paths.TrajectoryEnvelope;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.Polygon;
import com.vividsolutions.jts.geom.util.AffineTransformation;
import se.oru.coordination.coordination_oru.RobotReport;
				this.msgQueue.add(message);
			}
		}
	}
	
	private void sendMessages() {
		if (BrowserVisualizationSocket.ENDPOINTS != null && BrowserVisualizationSocket.ENDPOINTS.size() > 0) {
			synchronized (BrowserVisualizationSocket.ENDPOINTS) {
				for (String message : this.msgQueue) {
					sendMessage(message);
				}
				msgQueue.clear();
				updateOverlayText();
				sendUpdate();
			}
		}
	}
	
	private void sendMessage(String text) {
		if (BrowserVisualizationSocket.ENDPOINTS != null) {
			for (RemoteEndpoint rep : BrowserVisualizationSocket.ENDPOINTS) {
				try {
					rep.sendString(text);
				}
				catch(IOException e) { e.printStackTrace(); }
			}
		}
	}

	@Override
// Path: src/main/java/se/oru/coordination/coordination_oru/RobotReport.java
// public class RobotReport {
// 	
// 	private Pose pose = null;
// 	private int pathIndex = -1;
// 	private double velocity = 0.0;
// 	private double distanceTraveled = 0.0;
// 	private int criticalPoint = -1;
// 	private int robotID = -1;
// 	
// 	/**
// 	 * Create a {@link RobotReport} with given current state of the robot.
// 	 * @param pose The current pose of the robot.
// 	 * @param pathIndex The index of the last pose passed by the robot. 
// 	 * @param velocity The current speed of the robot.
// 	 * @param distanceTraveled The distance traveled so far along the current current path.
// 	 * @param criticalPoint The current active critical point of the robot (-1 if no critical point).
// 	 */
// 	public RobotReport(int robotID, Pose pose, int pathIndex, double velocity, double distanceTraveled, int criticalPoint) {
// 		this.robotID = robotID;
// 		this.pose = pose;
// 		this.velocity = velocity;
// 		this.pathIndex = pathIndex;
// 		this.distanceTraveled = distanceTraveled;
// 		this.criticalPoint = criticalPoint;
// 	}
// 	
// 	/**
// 	 * Get the ID of the robot to which this report refers to.
// 	 * @return The ID of the robot.
// 	 */
// 	public int getRobotID() {
// 		return this.robotID;
// 	}
// 
// 	/**
// 	 * Get the current pose of the robot.
// 	 * @return The current pose of the robot.
// 	 */
// 	public Pose getPose() {
// 		return pose;
// 	}
// 
// 	/**
// 	 * Get the index of the last pose passed by the robot. 
// 	 * @return The index of the last pose passed by the robot.
// 	 */
// 	public int getPathIndex() {
// 		return pathIndex;
// 	}
// 
// 	/**
// 	 * Get the current speed of the robot.
// 	 * @return The current speed of the robot.
// 	 */
// 	public double getVelocity() {
// 		return velocity;
// 	}
// 
// 	/**
// 	 * Get the distance traveled so far along the current current path.
// 	 * @return The distance traveled so far along the current current path.
// 	 */
// 	public double getDistanceTraveled() {
// 		return distanceTraveled;
// 	}
// 
// 	/**
// 	 * Get the current active critical point of the robot (-1 if no critical point).
// 	 * @return The current active critical point of the robot (-1 if no critical point).
// 	 */
// 	public int getCriticalPoint() {
// 		return criticalPoint;
// 	}
// 
// 	@Override
// 	public String toString() {
// 		return "Distance: " + MetaCSPLogging.printDouble(this.distanceTraveled,4) +  "  Pose: " + this.pose + "  Index: " + this.pathIndex + "  Velocity: " + MetaCSPLogging.printDouble(velocity,4);
// 	}
// 
// }


// Path: src/main/java/se/oru/coordination/coordination_oru/util/BrowserVisualization.java
import java.awt.Desktop;
import java.awt.Dimension;
import java.awt.image.BufferedImage;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.util.ArrayList;
import javax.imageio.ImageIO;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.ServerConnector;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
import org.eclipse.jetty.websocket.api.RemoteEndpoint;
import org.metacsp.multi.spatial.DE9IM.GeometricShapeDomain;
import org.metacsp.multi.spatioTemporal.paths.Pose;
import org.metacsp.multi.spatioTemporal.paths.TrajectoryEnvelope;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.GeometryFactory;
import com.vividsolutions.jts.geom.Polygon;
import com.vividsolutions.jts.geom.util.AffineTransformation;
import se.oru.coordination.coordination_oru.RobotReport;

				this.msgQueue.add(message);
			}
		}
	}
	
	private void sendMessages() {
		if (BrowserVisualizationSocket.ENDPOINTS != null && BrowserVisualizationSocket.ENDPOINTS.size() > 0) {
			synchronized (BrowserVisualizationSocket.ENDPOINTS) {
				for (String message : this.msgQueue) {
					sendMessage(message);
				}
				msgQueue.clear();
				updateOverlayText();
				sendUpdate();
			}
		}
	}
	
	private void sendMessage(String text) {
		if (BrowserVisualizationSocket.ENDPOINTS != null) {
			for (RemoteEndpoint rep : BrowserVisualizationSocket.ENDPOINTS) {
				try {
					rep.sendString(text);
				}
				catch(IOException e) { e.printStackTrace(); }
			}
		}
	}

	@Override
	public void displayRobotState(TrajectoryEnvelope te, RobotReport rr, String... extraStatusInfo) {