From 963d2686f30e8ae9b48ae7a58667b1d5002aa990 Mon Sep 17 00:00:00 2001 From: Enrico Joerns Date: Fri, 11 Jul 2014 00:26:00 +0200 Subject: [PATCH] [cooja] plugins/Visualizer: Fix: Always highlight selected motes. Motes were highlighted only by the UDGMVisualizerSkin before. Now highlighting moved from individual VisualizerSkin to Visualizer. A selected mote is highlighted with a blue circle and a semi-transparent gray overlay. --- .../contikios/cooja/plugins/Visualizer.java | 19 ++++++++++++++++--- .../plugins/skins/UDGMVisualizerSkin.java | 3 --- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/tools/cooja/java/org/contikios/cooja/plugins/Visualizer.java b/tools/cooja/java/org/contikios/cooja/plugins/Visualizer.java index 733bafa6f..5d139eb7e 100644 --- a/tools/cooja/java/org/contikios/cooja/plugins/Visualizer.java +++ b/tools/cooja/java/org/contikios/cooja/plugins/Visualizer.java @@ -1209,9 +1209,22 @@ public class Visualizer extends VisPlugin implements HasQuickHelp { 2 * MOTE_RADIUS); } - g.setColor(Color.BLACK); - g.drawOval(x - MOTE_RADIUS, y - MOTE_RADIUS, 2 * MOTE_RADIUS, - 2 * MOTE_RADIUS); + if (getSelectedMotes().contains(mote)) { + /* If mote is selected, highlight with red circle + and semitransparent gray overlay */ + g.setColor(new Color(51, 102, 255)); + g.drawOval(x - MOTE_RADIUS, y - MOTE_RADIUS, 2 * MOTE_RADIUS, + 2 * MOTE_RADIUS); + g.drawOval(x - MOTE_RADIUS - 1, y - MOTE_RADIUS - 1, 2 * MOTE_RADIUS + 2, + 2 * MOTE_RADIUS + 2); + g.setColor(new Color(128, 128, 128, 128)); + g.fillOval(x - MOTE_RADIUS, y - MOTE_RADIUS, 2 * MOTE_RADIUS, + 2 * MOTE_RADIUS); + } else { + g.setColor(Color.BLACK); + g.drawOval(x - MOTE_RADIUS, y - MOTE_RADIUS, 2 * MOTE_RADIUS, + 2 * MOTE_RADIUS); + } } } diff --git a/tools/cooja/java/org/contikios/cooja/plugins/skins/UDGMVisualizerSkin.java b/tools/cooja/java/org/contikios/cooja/plugins/skins/UDGMVisualizerSkin.java index 45f7a826a..144760405 100644 --- a/tools/cooja/java/org/contikios/cooja/plugins/skins/UDGMVisualizerSkin.java +++ b/tools/cooja/java/org/contikios/cooja/plugins/skins/UDGMVisualizerSkin.java @@ -263,9 +263,6 @@ public class UDGMVisualizerSkin implements VisualizerSkin { @Override public Color[] getColorOf(Mote mote) { - if (visualizer.getSelectedMotes().contains(mote)) { - return new Color[]{Color.CYAN}; - } return null; }