Commit acffd768 authored by Christian Cabrera's avatar Christian Cabrera
Browse files

Adding service provider visualization

parent 176ded37
......@@ -29,6 +29,7 @@ import java.awt.Font;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Polygon;
import java.awt.RenderingHints;
import java.awt.Stroke;
import java.awt.Toolkit;
......@@ -391,12 +392,14 @@ public class VisualizationTopologyView extends JFrame
protected HashMap<INodeID, VisNodeInformation> staticGwNodeInformation = new HashMap<INodeID, VisNodeInformation>();
protected HashMap<INodeID, VisNodeInformation> mobileGwNodeInformation = new HashMap<INodeID, VisNodeInformation>();
protected HashMap<INodeID, VisNodeInformation> citizenNodeInformation = new HashMap<INodeID, VisNodeInformation>();
protected HashMap<INodeID, VisNodeInformation> providerNodeInformation = new HashMap<INodeID, VisNodeInformation>();
protected final static int PADDING = 16;
protected final static int NODE_PAD = 2;
protected final static int STATIC_GW_NODE_PAD = 3;
protected final static int MOBILE_GW_NODE_PAD = 2;
protected final static int PROVIDER_NODE_PAD = 2;
protected final static int CITIZEN_NODE_PAD = 2;
private static final long serialVersionUID = -3023020559483652110L;
......@@ -470,11 +473,20 @@ public class VisualizationTopologyView extends JFrame
}
}
else{
if (!nodeInformation.containsKey(comp.getHost().getId())) {
VisNodeInformation tVis = new VisNodeInformation(comp);
comp.requestLocationUpdates(null, tVis);
System.out.println("HERE: "+comp.getHost().toString());
nodeInformation.put(comp.getHost().getId(), tVis);
if(comp.getHost().toString().contains("Provider")){
if (!providerNodeInformation.containsKey(comp.getHost().getId())) {
VisNodeInformation tVis = new VisNodeInformation(comp);
comp.requestLocationUpdates(null, tVis);
providerNodeInformation.put(comp.getHost().getId(), tVis);
}
}
else{
if (!nodeInformation.containsKey(comp.getHost().getId())) {
VisNodeInformation tVis = new VisNodeInformation(comp);
comp.requestLocationUpdates(null, tVis);
System.out.println("HERE: "+comp.getHost().toString());
nodeInformation.put(comp.getHost().getId(), tVis);
}
}
}
}
......@@ -586,6 +598,31 @@ public class VisualizationTopologyView extends JFrame
}
}
}
for (VisNodeInformation node : providerNodeInformation.values()) {
if (node.clicked) {
g2.setColor(Color.MAGENTA);
g2.fillRect((int) node.position.getX() - PROVIDER_NODE_PAD,
(int) node.position.getY() - PROVIDER_NODE_PAD,
PROVIDER_NODE_PAD * 2 + 5, PROVIDER_NODE_PAD * 2);
g2.setColor(Color.BLACK);
Font font = new Font("Helvetica", Font.BOLD, 10);
g2.setFont(font);
g2.drawString("P"+node.hostId, (int) node.position.getX()- PROVIDER_NODE_PAD,(int) node.position.getY()- PROVIDER_NODE_PAD);
} else {
if (showNodes) {
// Draw nodes
Color col = new Color(255, 204, 51);
g2.setColor(col);
g2.fillRect((int) node.position.getX() - PROVIDER_NODE_PAD,
(int) node.position.getY() - PROVIDER_NODE_PAD,
PROVIDER_NODE_PAD * 2 + 5, PROVIDER_NODE_PAD * 2);
g2.setColor(Color.BLACK);
Font font = new Font("Helvetica", Font.BOLD, 10);
g2.setFont(font);
g2.drawString("P"+node.hostId, (int) node.position.getX()- PROVIDER_NODE_PAD,(int) node.position.getY()- PROVIDER_NODE_PAD);
}
}
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment