Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
ed7213a55d
3 changed files with 85 additions and 48 deletions
|
@ -191,9 +191,15 @@ public class TrackDetailsMenu {
|
|||
}
|
||||
} else {
|
||||
float distance = pos * dataSet.getDivX();
|
||||
for (WptPt p : segment.points) {
|
||||
if (p.distance >= distance) {
|
||||
wpt = p;
|
||||
double previousSplitDistance = 0;
|
||||
for (int i = 0; i < segment.points.size(); i++) {
|
||||
if (i != 0) {
|
||||
if (segment.points.get(i).distance < segment.points.get(i - 1).distance) {
|
||||
previousSplitDistance += segment.points.get(i - 1).distance;
|
||||
}
|
||||
}
|
||||
if (previousSplitDistance + segment.points.get(i).distance >= distance) {
|
||||
wpt = segment.points.get(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -231,18 +237,24 @@ public class TrackDetailsMenu {
|
|||
} else {
|
||||
float startDistance = startPos * dataSet.getDivX();
|
||||
float endDistance = endPos * dataSet.getDivX();
|
||||
for (WptPt p : segment.points) {
|
||||
if (p.distance >= startDistance && p.distance <= endDistance) {
|
||||
double previousSplitDistance = 0;
|
||||
for (int i = 0; i < segment.points.size(); i++) {
|
||||
if (i != 0) {
|
||||
if (segment.points.get(i).distance < segment.points.get(i - 1).distance) {
|
||||
previousSplitDistance += segment.points.get(i - 1).distance;
|
||||
}
|
||||
}
|
||||
if (previousSplitDistance + segment.points.get(i).distance >= startDistance && previousSplitDistance + segment.points.get(i).distance <= endDistance) {
|
||||
if (left == 0 && right == 0) {
|
||||
left = p.getLongitude();
|
||||
right = p.getLongitude();
|
||||
top = p.getLatitude();
|
||||
bottom = p.getLatitude();
|
||||
left = segment.points.get(i).getLongitude();
|
||||
right = segment.points.get(i).getLongitude();
|
||||
top = segment.points.get(i).getLatitude();
|
||||
bottom = segment.points.get(i).getLatitude();
|
||||
} else {
|
||||
left = Math.min(left, p.getLongitude());
|
||||
right = Math.max(right, p.getLongitude());
|
||||
top = Math.max(top, p.getLatitude());
|
||||
bottom = Math.min(bottom, p.getLatitude());
|
||||
left = Math.min(left, segment.points.get(i).getLongitude());
|
||||
right = Math.max(right, segment.points.get(i).getLongitude());
|
||||
top = Math.max(top, segment.points.get(i).getLatitude());
|
||||
bottom = Math.min(bottom, segment.points.get(i).getLatitude());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -287,6 +299,13 @@ public class TrackDetailsMenu {
|
|||
Highlight[] highlights = chart.getHighlighted();
|
||||
LatLon location = null;
|
||||
|
||||
if (trackChartPoints == null) {
|
||||
trackChartPoints = new TrackChartPoints();
|
||||
int segmentColor = getTrackSegment(chart).getColor(0);
|
||||
trackChartPoints.setSegmentColor(segmentColor);
|
||||
trackChartPoints.setGpx(getGpxItem().group.getGpx());
|
||||
}
|
||||
|
||||
float minimumVisibleXValue = chart.getLowestVisibleX();
|
||||
float maximumVisibleXValue = chart.getHighestVisibleX();
|
||||
|
||||
|
@ -304,24 +323,18 @@ public class TrackDetailsMenu {
|
|||
}
|
||||
WptPt wpt = getPoint(chart, gpxItem.chartHighlightPos);
|
||||
if (wpt != null) {
|
||||
if (trackChartPoints == null) {
|
||||
trackChartPoints = new TrackChartPoints();
|
||||
int segmentColor = getTrackSegment(chart).getColor(0);
|
||||
trackChartPoints.setSegmentColor(segmentColor);
|
||||
trackChartPoints.setGpx(getGpxItem().group.getGpx());
|
||||
}
|
||||
location = new LatLon(wpt.lat, wpt.lon);
|
||||
trackChartPoints.setHighlightedPoint(location);
|
||||
trackChartPoints.setXAxisPoints(getXAxisPoints(chart));
|
||||
if (gpxItem.route) {
|
||||
mapActivity.getMapLayers().getMapInfoLayer().setTrackChartPoints(trackChartPoints);
|
||||
} else {
|
||||
mapActivity.getMapLayers().getGpxLayer().setTrackChartPoints(trackChartPoints);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
gpxItem.chartHighlightPos = -1;
|
||||
}
|
||||
trackChartPoints.setXAxisPoints(getXAxisPoints(chart));
|
||||
if (gpxItem.route) {
|
||||
mapActivity.getMapLayers().getMapInfoLayer().setTrackChartPoints(trackChartPoints);
|
||||
} else {
|
||||
mapActivity.getMapLayers().getGpxLayer().setTrackChartPoints(trackChartPoints);
|
||||
}
|
||||
fitTrackOnMap(chart, location, forceFit);
|
||||
}
|
||||
|
||||
|
@ -575,14 +588,15 @@ public class TrackDetailsMenu {
|
|||
}
|
||||
|
||||
private void updateChart(LineChart chart) {
|
||||
chart.notifyDataSetChanged();
|
||||
chart.invalidate();
|
||||
if (gpxItem.chartMatrix != null) {
|
||||
chart.getViewPortHandler().refresh(new Matrix(gpxItem.chartMatrix), chart, true);
|
||||
}
|
||||
if (gpxItem.chartHighlightPos != -1) {
|
||||
chart.highlightValue(gpxItem.chartHighlightPos, 0);
|
||||
} else {
|
||||
gpxItem.chartHighlightPos = chart.getLowestVisibleX();
|
||||
chart.highlightValue(chart.getLowestVisibleX(), 0);
|
||||
chart.highlightValue(null);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -133,6 +133,7 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
private int defPointColor;
|
||||
private Paint paintIcon;
|
||||
private Bitmap pointSmall;
|
||||
private GpxDisplayItem generalDisplayItem;
|
||||
|
||||
private ImageView imageView;
|
||||
private RotatedTileBox rotatedTileBox;
|
||||
|
@ -273,6 +274,17 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
}
|
||||
|
||||
private void updateHeader() {
|
||||
headerView.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
LatLon location = new LatLon(generalDisplayItem.locationStart.lat, generalDisplayItem.locationStart.lon);
|
||||
final OsmandSettings settings = app.getSettings();
|
||||
settings.setMapLocationToShow(location.getLatitude(), location.getLongitude(),
|
||||
settings.getLastKnownMapZoom());
|
||||
|
||||
MapActivity.launchMapActivityMoveToTop(getActivity());
|
||||
}
|
||||
});
|
||||
imageView = (ImageView) headerView.findViewById(R.id.imageView);
|
||||
final View splitColorView = headerView.findViewById(R.id.split_color_view);
|
||||
final View divider = headerView.findViewById(R.id.divider);
|
||||
|
@ -802,6 +814,9 @@ public class TrackSegmentFragment extends OsmAndListFragment {
|
|||
pager = (WrapContentHeightViewPager) row.findViewById(R.id.pager);
|
||||
}
|
||||
GpxDisplayItem item = getItem(position);
|
||||
if (position == 0) {
|
||||
generalDisplayItem = item;
|
||||
}
|
||||
if (item != null) {
|
||||
pager.setAdapter(new GPXItemPagerAdapter(tabLayout, item));
|
||||
if (create) {
|
||||
|
|
|
@ -334,8 +334,10 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
|||
y + nmHeight / 2 + 3 * (float) Math.ceil(tileBox.getDensity()),
|
||||
x + nmWidth / 2 + 3 * (float) Math.ceil(tileBox.getDensity()),
|
||||
y - nmHeight / 2 - 2 * (float) Math.ceil(tileBox.getDensity()));
|
||||
canvas.drawRoundRect(rect, 5, 5, paintInnerRect);
|
||||
canvas.drawRoundRect(rect, 5, 5, paintOuterRect);
|
||||
canvas.drawRoundRect(rect, 0, 0, paintInnerRect);
|
||||
canvas.drawRoundRect(rect, 0, 0, paintOuterRect);
|
||||
// canvas.drawRect(rect, paintInnerRect);
|
||||
// canvas.drawRect(rect, paintOuterRect);
|
||||
canvas.drawText(nm, x, y + nmHeight / 2, paintTextIcon);
|
||||
}
|
||||
}
|
||||
|
@ -386,14 +388,16 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
|||
}
|
||||
if (trackChartPoints != null) {
|
||||
LatLon highlightedPoint = trackChartPoints.getHighlightedPoint();
|
||||
if (highlightedPoint.getLatitude() >= latLonBounds.bottom
|
||||
&& highlightedPoint.getLatitude() <= latLonBounds.top
|
||||
&& highlightedPoint.getLongitude() >= latLonBounds.left
|
||||
&& highlightedPoint.getLongitude() <= latLonBounds.right) {
|
||||
float x = tileBox.getPixXFromLatLon(highlightedPoint.getLatitude(), highlightedPoint.getLongitude());
|
||||
float y = tileBox.getPixYFromLatLon(highlightedPoint.getLatitude(), highlightedPoint.getLongitude());
|
||||
paintIcon.setColorFilter(null);
|
||||
canvas.drawBitmap(selectedPoint, x - selectedPoint.getWidth() / 2, y - selectedPoint.getHeight() / 2, paintIcon);
|
||||
if (highlightedPoint != null) {
|
||||
if (highlightedPoint.getLatitude() >= latLonBounds.bottom
|
||||
&& highlightedPoint.getLatitude() <= latLonBounds.top
|
||||
&& highlightedPoint.getLongitude() >= latLonBounds.left
|
||||
&& highlightedPoint.getLongitude() <= latLonBounds.right) {
|
||||
float x = tileBox.getPixXFromLatLon(highlightedPoint.getLatitude(), highlightedPoint.getLongitude());
|
||||
float y = tileBox.getPixYFromLatLon(highlightedPoint.getLatitude(), highlightedPoint.getLongitude());
|
||||
paintIcon.setColorFilter(null);
|
||||
canvas.drawBitmap(selectedPoint, x - selectedPoint.getWidth() / 2, y - selectedPoint.getHeight() / 2, paintIcon);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.fullObjectsLatLon = fullObjectsLatLon;
|
||||
|
@ -420,18 +424,22 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
|||
paintGridCircle.setColor(color);
|
||||
paintGridCircle.setAlpha(255);
|
||||
QuadRect latLonBounds = tileBox.getLatLonBounds();
|
||||
List<WptPt> xAxisPoints = trackChartPoints.getXAxisPoints();
|
||||
float r = 3 * tileBox.getDensity();
|
||||
for (int i = 0; i < xAxisPoints.size(); i++) {
|
||||
WptPt axisPoint = xAxisPoints.get(i);
|
||||
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);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue