import tim.prune.gui.BaseImageDefinitionPanel;
import tim.prune.gui.GuiGridLayout;
import tim.prune.gui.WholeNumberField;
+import tim.prune.gui.colour.PointColourer;
import tim.prune.gui.map.MapSource;
import tim.prune.gui.map.MapSourceLibrary;
import tim.prune.gui.map.MapUtils;
+import tim.prune.gui.map.WpIconDefinition;
+import tim.prune.gui.map.WpIconLibrary;
import tim.prune.load.GenericFileFilter;
import tim.prune.threedee.ImageDefinition;
final int zoomFactor = 1 << _baseImagePanel.getImageDefinition().getZoom();
Graphics g = inImage.getImage().getGraphics();
// TODO: Set line width, style etc
- g.setColor(Config.getColourScheme().getColour(ColourScheme.IDX_POINT));
+ final PointColourer pointColourer = _app.getPointColourer();
+ final Color defaultPointColour = Config.getColourScheme().getColour(ColourScheme.IDX_POINT);
+ g.setColor(defaultPointColour);
- // Loop over points
+ // Loop to draw all track points
final Track track = _app.getTrackInfo().getTrack();
final int numPoints = track.getNumPoints();
int prevX = 0, prevY = 0;
DataPoint point = track.getPoint(i);
if (!point.isWaypoint())
{
+ // Determine what colour to use to draw the track point
+ if (pointColourer != null)
+ {
+ Color c = pointColourer.getColour(i);
+ g.setColor(c == null ? defaultPointColour : c);
+ }
double x = track.getX(i) - xRange.getMinimum();
double y = track.getY(i) - yRange.getMinimum();
// use zoom level to calculate pixel coords on image
prevX = px; prevY = py;
}
}
- // Draw waypoints
+
+ // Now the waypoints
final Color textColour = Config.getColourScheme().getColour(ColourScheme.IDX_TEXT);
g.setColor(textColour);
- // Loop over points
+ WpIconDefinition wpIconDefinition = null;
+ final int wpType = Config.getConfigInt(Config.KEY_WAYPOINT_ICONS);
+ if (wpType != WpIconLibrary.WAYPT_DEFAULT)
+ {
+ wpIconDefinition = WpIconLibrary.getIconDefinition(wpType, WpIconLibrary.SIZE_MEDIUM);
+ }
+ // Loop again to draw waypoints
for (int i=0; i<numPoints; i++)
{
DataPoint point = track.getPoint(i);
if (point.isWaypoint())
{
- // draw blob for each waypoint
+ // use zoom level to calculate pixel coords on image
double x = track.getX(i) - xRange.getMinimum();
double y = track.getY(i) - yRange.getMinimum();
- // use zoom level to calculate pixel coords on image
int px = (int) (x * zoomFactor * 256), py = (int) (y * zoomFactor * 256);
+ // Fill Rect or draw icon image?
g.fillRect(px-3, py-3, 6, 6);
+ if (wpIconDefinition == null)
+ {
+ g.fillRect(px-3, py-3, 6, 6);
+ }
+ else
+ {
+ g.drawImage(wpIconDefinition.getImageIcon().getImage(), px-wpIconDefinition.getXOffset(),
+ py-wpIconDefinition.getYOffset(), null);
+ }
}
}
// Set text size according to input