Fix segment color

This commit is contained in:
PavelRatushny 2017-06-12 17:37:55 +03:00
parent dbd5da99ab
commit b1630e017f
2 changed files with 24 additions and 22 deletions

View file

@ -290,7 +290,7 @@ public class TrackDetailsMenu {
if (wpt != null) {
location = new LatLon(wpt.lat, wpt.lon);
List<Pair<String, WptPt>> xAxisPoints = getXAxisPoints(chart);
TrackChartPoints trackChartPoints = new TrackChartPoints(xAxisPoints, location, getGpxItem().group.getGpx());
TrackChartPoints trackChartPoints = new TrackChartPoints(xAxisPoints, location, getTrackSegment(chart), getGpxItem().group.getGpx().path);
if (gpxItem.route) {
mapActivity.getMapLayers().getMapInfoLayer().setTrackChartPoints(trackChartPoints);
} else {
@ -579,12 +579,14 @@ public class TrackDetailsMenu {
public class TrackChartPoints {
private List<Pair<String, WptPt>> xAxisPoints;
private LatLon highlightedPoint;
private GPXFile gpx;
private TrkSegment chartSegment;
private String gpxPath;
public TrackChartPoints(List<Pair<String, WptPt>> xAxisPoints, LatLon highlightedPoint, GPXFile gpx) {
public TrackChartPoints(List<Pair<String, WptPt>> xAxisPoints, LatLon highlightedPoint, TrkSegment chartSegment, String gpxPath) {
this.xAxisPoints = xAxisPoints;
this.highlightedPoint = highlightedPoint;
this.gpx = gpx;
this.chartSegment = chartSegment;
this.gpxPath = gpxPath;
}
public List<Pair<String, WptPt>> getXAxisPoints() {
@ -595,8 +597,12 @@ public class TrackDetailsMenu {
return highlightedPoint;
}
public GPXFile getGpx() {
return gpx;
public TrkSegment getChartSegment() {
return chartSegment;
}
public String getGpxPath() {
return gpxPath;
}
}
}

View file

@ -379,8 +379,6 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
paintIcon.setColorFilter(null);
canvas.drawBitmap(selectedPoint, x - selectedPoint.getWidth() / 2, y - selectedPoint.getHeight() / 2, paintIcon);
}
} else if (paintInnerRect.getColor() != 0){
paintInnerRect.setColor(0);
}
this.fullObjectsLatLon = fullObjectsLatLon;
this.smallObjectsLatLon = smallObjectsLatLon;
@ -388,21 +386,19 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
}
private void drawXAxisPoints(Canvas canvas, RotatedTileBox tileBox) {
if (paintInnerRect.getColor() == 0) {
SelectedGpxFile selectedGpxFile = selectedGpxHelper.getSelectedFileByPath((trackChartPoints.getGpx().path));
GpxDataItem gpxDataItem = null;
if (!selectedGpxFile.isShowCurrentTrack()) {
gpxDataItem = view.getApplication().getGpxDatabase().getItem(new File(selectedGpxFile.getGpxFile().path));
}
int color = gpxDataItem != null ? gpxDataItem.getColor() : 0;
if (selectedGpxFile.isShowCurrentTrack()) {
color = currentTrackColor;
}
if (color == 0) {
color = cachedColor;
}
paintInnerRect.setColor(color);
SelectedGpxFile selectedGpxFile = selectedGpxHelper.getSelectedFileByPath((trackChartPoints.getGpxPath()));
GpxDataItem gpxDataItem = null;
if (!selectedGpxFile.isShowCurrentTrack()) {
gpxDataItem = view.getApplication().getGpxDatabase().getItem(new File(selectedGpxFile.getGpxFile().path));
}
int color = gpxDataItem != null ? gpxDataItem.getColor() : 0;
if (selectedGpxFile.isShowCurrentTrack()) {
color = currentTrackColor;
}
if (color == 0) {
color = trackChartPoints.getChartSegment().getColor(cachedColor);
}
paintInnerRect.setColor(color);
QuadRect latLonBounds = tileBox.getLatLonBounds();
List<Pair<String, WptPt>> xAxisPoints = trackChartPoints.getXAxisPoints();
float r = 12 * tileBox.getDensity();