Complete gpx improvements
This commit is contained in:
parent
0350dbe1d0
commit
bc26a0ee1a
2 changed files with 16 additions and 14 deletions
|
@ -10,7 +10,6 @@ import android.widget.ImageView;
|
|||
import android.widget.TextView;
|
||||
|
||||
import com.github.mikephil.charting.charts.LineChart;
|
||||
import com.github.mikephil.charting.components.YAxis;
|
||||
import com.github.mikephil.charting.data.Entry;
|
||||
import com.github.mikephil.charting.data.LineData;
|
||||
import com.github.mikephil.charting.highlight.Highlight;
|
||||
|
@ -18,7 +17,6 @@ import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;
|
|||
import com.github.mikephil.charting.listener.ChartTouchListener.ChartGesture;
|
||||
import com.github.mikephil.charting.listener.OnChartGestureListener;
|
||||
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
|
||||
import com.github.mikephil.charting.utils.ViewPortHandler;
|
||||
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.QuadRect;
|
||||
|
@ -288,19 +286,14 @@ public class TrackDetailsMenu {
|
|||
Highlight[] highlights = chart.getHighlighted();
|
||||
LatLon location = null;
|
||||
|
||||
ViewPortHandler handler = chart.getViewPortHandler();
|
||||
float minimumVisibleXValue = (float) chart.getValuesByTouchPoint(handler.contentLeft(), handler.contentBottom(), YAxis.AxisDependency.LEFT).x;
|
||||
float maximumVisibleXValue = (float) chart.getValuesByTouchPoint(handler.contentRight(), handler.contentBottom(), YAxis.AxisDependency.LEFT).x;
|
||||
float minimumVisibleXValue = chart.getLowestVisibleX();
|
||||
float maximumVisibleXValue = chart.getHighestVisibleX();
|
||||
|
||||
if (highlights != null && highlights.length > 0) {
|
||||
if (minimumVisibleXValue != 0 && maximumVisibleXValue != 0) {
|
||||
if (highlights[0].getX() < minimumVisibleXValue) {
|
||||
Highlight h = chart.getHighlightByTouchPoint(minimumVisibleXValue, 0f);
|
||||
chart.highlightValue(h);
|
||||
gpxItem.chartHighlightPos = minimumVisibleXValue;
|
||||
} else if (highlights[0].getX() > maximumVisibleXValue) {
|
||||
Highlight h = chart.getHighlightByTouchPoint(maximumVisibleXValue, 0f);
|
||||
chart.highlightValue(h);
|
||||
gpxItem.chartHighlightPos = maximumVisibleXValue;
|
||||
} else {
|
||||
gpxItem.chartHighlightPos = highlights[0].getX();
|
||||
|
@ -580,7 +573,8 @@ public class TrackDetailsMenu {
|
|||
if (gpxItem.chartHighlightPos != -1) {
|
||||
chart.highlightValue(gpxItem.chartHighlightPos, 0);
|
||||
} else {
|
||||
chart.highlightValue(0, 0);
|
||||
gpxItem.chartHighlightPos = chart.getLowestVisibleX();
|
||||
chart.highlightValue(chart.getLowestVisibleX(), 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -83,6 +83,7 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
|||
private Map<WptPt, SelectedGpxFile> pointFileMap = new HashMap<>();
|
||||
private MapTextLayer textLayer;
|
||||
|
||||
private Paint paintOuterRect;
|
||||
private Paint paintInnerRect;
|
||||
|
||||
private Paint paintGridOuterCircle;
|
||||
|
@ -142,8 +143,14 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
|||
textLayer = view.getLayerByClass(MapTextLayer.class);
|
||||
|
||||
paintInnerRect = new Paint();
|
||||
paintInnerRect.setStyle(Style.FILL_AND_STROKE);
|
||||
paintInnerRect.setStyle(Style.FILL);
|
||||
paintInnerRect.setAntiAlias(true);
|
||||
paintOuterRect = new Paint();
|
||||
paintOuterRect.setStyle(Style.STROKE);
|
||||
paintOuterRect.setAntiAlias(true);
|
||||
paintOuterRect.setColor(Color.WHITE);
|
||||
paintOuterRect.setStrokeWidth(3);
|
||||
paintOuterRect.setAlpha(255);
|
||||
paintGridCircle = new Paint();
|
||||
paintGridCircle.setStyle(Style.FILL_AND_STROKE);
|
||||
paintGridCircle.setAntiAlias(true);
|
||||
|
@ -320,10 +327,11 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
|||
int nmWidth = bounds.width();
|
||||
int nmHeight = bounds.height();
|
||||
RectF rect = new RectF(x - nmWidth / 2 - 2 * (float) Math.ceil(tileBox.getDensity()),
|
||||
y - nmHeight / 2 - 2 * (float) Math.ceil(tileBox.getDensity()),
|
||||
x + nmWidth / 2 + 2 * (float) Math.ceil(tileBox.getDensity()),
|
||||
y + (float) Math.ceil((float)nmHeight / 2) + 2 * (float) Math.ceil(tileBox.getDensity()));
|
||||
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.drawText(nm, x, y + nmHeight / 2, paintTextIcon);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue