/** Displays this marker's name in a box. */ public void draw(PGraphics pg, float x, float y) { pg.pushStyle(); pg.pushMatrix(); if (selected) { pg.translate(0, 0, 1); } pg.strokeWeight(strokeWeight); if (selected) { pg.fill(highlightColor); pg.stroke(highlightStrokeColor); } else { pg.fill(color); pg.stroke(strokeColor); } pg.ellipse(x, y, size, size); // TODO use radius in km and convert to px // label if (selected && name != null) { if (font != null) { pg.textFont(font); } pg.fill(highlightColor); pg.stroke(highlightStrokeColor); pg.rect( x + strokeWeight / 2, y - fontSize + strokeWeight / 2 - space, pg.textWidth(name) + space * 1.5f, fontSize + space); pg.fill(255, 255, 255); pg.text( name, Math.round(x + space * 0.75f + strokeWeight / 2), Math.round(y + strokeWeight / 2 - space * 0.75f)); } pg.popMatrix(); pg.popStyle(); }