+ // Paint the track points on top
+ int pointsPainted = 1;
+ try
+ {
+ pointsPainted = paintPoints(g);
+ }
+ catch (NullPointerException npe) { // ignore, probably due to data being changed during drawing
+ }
+
+ // free g
+ g.dispose();
+
+ // Zoom to fit if no points found
+ if (pointsPainted <= 0 && _checkBounds) {
+ zoomToFit();
+ _recalculate = true;
+ repaint();
+ }
+ _checkBounds = false;
+ // enable / disable transparency slider
+ _transparencySlider.setEnabled(showMap);
+ }
+
+
+ /**
+ * Paint the points using the given graphics object
+ * @param inG Graphics object to use for painting
+ * @return number of points painted, if any
+ */
+ private int paintPoints(Graphics inG)
+ {
+ // Set up colours
+ final ColourScheme cs = Config.getColourScheme();
+ final int[] opacities = {255, 190, 130, 80, 40, 0};
+ int opacity = 255;
+ if (_transparencySlider.getValue() < 0)
+ opacity = opacities[-1 - _transparencySlider.getValue()];
+ final Color pointColour = makeTransparentColour(cs.getColour(ColourScheme.IDX_POINT), opacity);
+ final Color rangeColour = makeTransparentColour(cs.getColour(ColourScheme.IDX_SELECTION), opacity);
+ final Color currentColour = makeTransparentColour(cs.getColour(ColourScheme.IDX_PRIMARY), opacity);
+ final Color secondColour = makeTransparentColour(cs.getColour(ColourScheme.IDX_SECONDARY), opacity);
+ final Color textColour = makeTransparentColour(cs.getColour(ColourScheme.IDX_TEXT), opacity);
+
+ // try to set line width for painting
+ if (inG instanceof Graphics2D)
+ {
+ int lineWidth = Config.getConfigInt(Config.KEY_LINE_WIDTH);
+ if (lineWidth < 1 || lineWidth > 4) {lineWidth = 2;}
+ ((Graphics2D) inG).setStroke(new BasicStroke(lineWidth));
+ }