use of net.osmand.plus.GPXDatabase.GpxDataItem in project Osmand by osmandapp.
the class GPXLayer method drawXAxisPoints.
private void drawXAxisPoints(Canvas canvas, RotatedTileBox tileBox) {
int color = trackChartPoints.getSegmentColor();
if (color == 0) {
GpxDataItem gpxDataItem = null;
if (!trackChartPoints.getGpx().showCurrentTrack) {
gpxDataItem = view.getApplication().getGpxDatabase().getItem(new File(trackChartPoints.getGpx().path));
}
color = gpxDataItem != null ? gpxDataItem.getColor() : 0;
if (trackChartPoints.getGpx().showCurrentTrack) {
color = currentTrackColor;
}
if (color == 0) {
color = cachedColor;
}
trackChartPoints.setSegmentColor(color);
}
paintGridCircle.setColor(color);
paintGridCircle.setAlpha(255);
QuadRect latLonBounds = tileBox.getLatLonBounds();
float r = 3 * tileBox.getDensity();
List<WptPt> xAxisPoints = trackChartPoints.getXAxisPoints();
if (xAxisPoints != null) {
for (int i = 0; i < xAxisPoints.size(); i++) {
WptPt axisPoint = xAxisPoints.get(i);
if (axisPoint != null) {
if (axisPoint.getLatitude() >= latLonBounds.bottom && axisPoint.getLatitude() <= latLonBounds.top && axisPoint.getLongitude() >= latLonBounds.left && axisPoint.getLongitude() <= latLonBounds.right) {
float x = tileBox.getPixXFromLatLon(axisPoint.getLatitude(), axisPoint.getLongitude());
float y = tileBox.getPixYFromLatLon(axisPoint.getLatitude(), axisPoint.getLongitude());
canvas.drawCircle(x, y, r + 2 * (float) Math.ceil(tileBox.getDensity()), paintGridOuterCircle);
canvas.drawCircle(x, y, r + (float) Math.ceil(tileBox.getDensity()), paintGridCircle);
}
}
}
}
}
use of net.osmand.plus.GPXDatabase.GpxDataItem in project Osmand by osmandapp.
the class GPXLayer method drawSelectedFileSegments.
private void drawSelectedFileSegments(SelectedGpxFile selectedGpxFile, boolean currentTrack, Canvas canvas, RotatedTileBox tileBox, DrawSettings settings) {
GpxDataItem gpxDataItem = null;
if (!currentTrack) {
gpxDataItem = view.getApplication().getGpxDatabase().getItem(new File(selectedGpxFile.getGpxFile().path));
}
List<TrkSegment> segments = selectedGpxFile.getPointsToDisplay();
for (TrkSegment ts : segments) {
int color = gpxDataItem != null ? gpxDataItem.getColor() : 0;
if (currentTrack) {
color = currentTrackColor;
}
if (color == 0) {
color = ts.getColor(cachedColor);
}
if (// only do once (CODE HERE NEEDS TO BE UI INSTEAD)
ts.renders.isEmpty() && !ts.points.isEmpty()) {
// hmmm. 0-point tracks happen, but.... how?
if (currentTrack) {
ts.renders.add(new Renderable.CurrentTrack(ts.points));
} else {
ts.renders.add(new Renderable.StandardTrack(ts.points, 17.2));
}
}
updatePaints(color, selectedGpxFile.isRoutePoints(), currentTrack, settings, tileBox);
ts.drawRenderers(view.getZoom(), paint, canvas, tileBox);
}
}
Aggregations