Fix split color, add points for whole track, fix switch in header
This commit is contained in:
parent
bc26a0ee1a
commit
955a69b9d1
3 changed files with 31 additions and 11 deletions
|
@ -53,6 +53,7 @@ public class TrackDetailsMenu {
|
||||||
private TrackDetailsBarController toolbarController;
|
private TrackDetailsBarController toolbarController;
|
||||||
private TrkSegment segment;
|
private TrkSegment segment;
|
||||||
private TrackChartPoints trackChartPoints;
|
private TrackChartPoints trackChartPoints;
|
||||||
|
private List<WptPt> xAxisPoints;
|
||||||
|
|
||||||
private static boolean VISIBLE;
|
private static boolean VISIBLE;
|
||||||
|
|
||||||
|
@ -310,9 +311,8 @@ public class TrackDetailsMenu {
|
||||||
trackChartPoints.setGpx(getGpxItem().group.getGpx());
|
trackChartPoints.setGpx(getGpxItem().group.getGpx());
|
||||||
}
|
}
|
||||||
location = new LatLon(wpt.lat, wpt.lon);
|
location = new LatLon(wpt.lat, wpt.lon);
|
||||||
List<WptPt> xAxisPoints = getXAxisPoints(chart);
|
|
||||||
trackChartPoints.setHighlightedPoint(location);
|
trackChartPoints.setHighlightedPoint(location);
|
||||||
trackChartPoints.setXAxisPoints(xAxisPoints);
|
trackChartPoints.setXAxisPoints(getXAxisPoints(chart));
|
||||||
if (gpxItem.route) {
|
if (gpxItem.route) {
|
||||||
mapActivity.getMapLayers().getMapInfoLayer().setTrackChartPoints(trackChartPoints);
|
mapActivity.getMapLayers().getMapInfoLayer().setTrackChartPoints(trackChartPoints);
|
||||||
} else {
|
} else {
|
||||||
|
@ -326,11 +326,19 @@ public class TrackDetailsMenu {
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<WptPt> getXAxisPoints(LineChart chart) {
|
private List<WptPt> getXAxisPoints(LineChart chart) {
|
||||||
List<WptPt> xAxisPoints = new ArrayList<>();
|
|
||||||
float[] entries = chart.getXAxis().mEntries;
|
float[] entries = chart.getXAxis().mEntries;
|
||||||
for (int i = 0; i < entries.length; i++) {
|
float maxXValue = chart.getLineData().getXMax();
|
||||||
WptPt pointToAdd = getPoint(chart, entries[i]);
|
if (entries.length >= 2) {
|
||||||
|
float interval = entries[1] - entries[0];
|
||||||
|
if (interval > 0) {
|
||||||
|
xAxisPoints = new ArrayList<>();
|
||||||
|
float currentPointEntry = interval;
|
||||||
|
while (currentPointEntry < maxXValue) {
|
||||||
|
WptPt pointToAdd = getPoint(chart, currentPointEntry);
|
||||||
xAxisPoints.add(pointToAdd);
|
xAxisPoints.add(pointToAdd);
|
||||||
|
currentPointEntry += interval;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return xAxisPoints;
|
return xAxisPoints;
|
||||||
}
|
}
|
||||||
|
|
|
@ -287,7 +287,15 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
||||||
vis.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
vis.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||||
app.getSelectedGpxHelper().selectGpxFile(getGpx(), vis.isChecked(), false);
|
if (!isChecked) {
|
||||||
|
selectedSplitInterval = 0;
|
||||||
|
}
|
||||||
|
SelectedGpxFile sf = app.getSelectedGpxHelper().selectGpxFile(getGpx(), vis.isChecked(), false);
|
||||||
|
final List<GpxDisplayGroup> groups = getDisplayGroups();
|
||||||
|
if (groups.size() > 0) {
|
||||||
|
updateSplit(groups, vis.isChecked() ? sf : null);
|
||||||
|
}
|
||||||
|
updateSplitIntervalView(splitIntervalView);
|
||||||
updateColorView(colorView);
|
updateColorView(colorView);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -280,11 +280,15 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
||||||
List<GpxDisplayGroup> groups = g.getDisplayGroups();
|
List<GpxDisplayGroup> groups = g.getDisplayGroups();
|
||||||
if (groups != null) {
|
if (groups != null) {
|
||||||
for (GpxDisplayGroup group : groups) {
|
for (GpxDisplayGroup group : groups) {
|
||||||
int color = g.getModifiableGpxFile().getColor(0);
|
|
||||||
if (color == 0 || color == Color.RED) {
|
|
||||||
GpxDataItem gpxDataItem = view.getApplication().getGpxDatabase().getItem(new File(g.getGpxFile().path));
|
GpxDataItem gpxDataItem = view.getApplication().getGpxDatabase().getItem(new File(g.getGpxFile().path));
|
||||||
color = gpxDataItem.getColor();
|
int color = gpxDataItem.getColor();
|
||||||
|
if (color == 0) {
|
||||||
|
color = g.getModifiableGpxFile().getColor(0);
|
||||||
}
|
}
|
||||||
|
if (color == 0) {
|
||||||
|
color = cachedColor;
|
||||||
|
}
|
||||||
|
|
||||||
paintInnerRect.setColor(color);
|
paintInnerRect.setColor(color);
|
||||||
paintInnerRect.setAlpha(179);
|
paintInnerRect.setAlpha(179);
|
||||||
List<GpxDisplayItem> items = group.getModifiableList();
|
List<GpxDisplayItem> items = group.getModifiableList();
|
||||||
|
|
Loading…
Reference in a new issue