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 android.widget.TextView;
|
||||||
|
|
||||||
import com.github.mikephil.charting.charts.LineChart;
|
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.Entry;
|
||||||
import com.github.mikephil.charting.data.LineData;
|
import com.github.mikephil.charting.data.LineData;
|
||||||
import com.github.mikephil.charting.highlight.Highlight;
|
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.ChartTouchListener.ChartGesture;
|
||||||
import com.github.mikephil.charting.listener.OnChartGestureListener;
|
import com.github.mikephil.charting.listener.OnChartGestureListener;
|
||||||
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
|
import com.github.mikephil.charting.listener.OnChartValueSelectedListener;
|
||||||
import com.github.mikephil.charting.utils.ViewPortHandler;
|
|
||||||
|
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.QuadRect;
|
import net.osmand.data.QuadRect;
|
||||||
|
@ -288,19 +286,14 @@ public class TrackDetailsMenu {
|
||||||
Highlight[] highlights = chart.getHighlighted();
|
Highlight[] highlights = chart.getHighlighted();
|
||||||
LatLon location = null;
|
LatLon location = null;
|
||||||
|
|
||||||
ViewPortHandler handler = chart.getViewPortHandler();
|
float minimumVisibleXValue = chart.getLowestVisibleX();
|
||||||
float minimumVisibleXValue = (float) chart.getValuesByTouchPoint(handler.contentLeft(), handler.contentBottom(), YAxis.AxisDependency.LEFT).x;
|
float maximumVisibleXValue = chart.getHighestVisibleX();
|
||||||
float maximumVisibleXValue = (float) chart.getValuesByTouchPoint(handler.contentRight(), handler.contentBottom(), YAxis.AxisDependency.LEFT).x;
|
|
||||||
|
|
||||||
if (highlights != null && highlights.length > 0) {
|
if (highlights != null && highlights.length > 0) {
|
||||||
if (minimumVisibleXValue != 0 && maximumVisibleXValue != 0) {
|
if (minimumVisibleXValue != 0 && maximumVisibleXValue != 0) {
|
||||||
if (highlights[0].getX() < minimumVisibleXValue) {
|
if (highlights[0].getX() < minimumVisibleXValue) {
|
||||||
Highlight h = chart.getHighlightByTouchPoint(minimumVisibleXValue, 0f);
|
|
||||||
chart.highlightValue(h);
|
|
||||||
gpxItem.chartHighlightPos = minimumVisibleXValue;
|
gpxItem.chartHighlightPos = minimumVisibleXValue;
|
||||||
} else if (highlights[0].getX() > maximumVisibleXValue) {
|
} else if (highlights[0].getX() > maximumVisibleXValue) {
|
||||||
Highlight h = chart.getHighlightByTouchPoint(maximumVisibleXValue, 0f);
|
|
||||||
chart.highlightValue(h);
|
|
||||||
gpxItem.chartHighlightPos = maximumVisibleXValue;
|
gpxItem.chartHighlightPos = maximumVisibleXValue;
|
||||||
} else {
|
} else {
|
||||||
gpxItem.chartHighlightPos = highlights[0].getX();
|
gpxItem.chartHighlightPos = highlights[0].getX();
|
||||||
|
@ -580,7 +573,8 @@ public class TrackDetailsMenu {
|
||||||
if (gpxItem.chartHighlightPos != -1) {
|
if (gpxItem.chartHighlightPos != -1) {
|
||||||
chart.highlightValue(gpxItem.chartHighlightPos, 0);
|
chart.highlightValue(gpxItem.chartHighlightPos, 0);
|
||||||
} else {
|
} 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 Map<WptPt, SelectedGpxFile> pointFileMap = new HashMap<>();
|
||||||
private MapTextLayer textLayer;
|
private MapTextLayer textLayer;
|
||||||
|
|
||||||
|
private Paint paintOuterRect;
|
||||||
private Paint paintInnerRect;
|
private Paint paintInnerRect;
|
||||||
|
|
||||||
private Paint paintGridOuterCircle;
|
private Paint paintGridOuterCircle;
|
||||||
|
@ -142,8 +143,14 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
||||||
textLayer = view.getLayerByClass(MapTextLayer.class);
|
textLayer = view.getLayerByClass(MapTextLayer.class);
|
||||||
|
|
||||||
paintInnerRect = new Paint();
|
paintInnerRect = new Paint();
|
||||||
paintInnerRect.setStyle(Style.FILL_AND_STROKE);
|
paintInnerRect.setStyle(Style.FILL);
|
||||||
paintInnerRect.setAntiAlias(true);
|
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 = new Paint();
|
||||||
paintGridCircle.setStyle(Style.FILL_AND_STROKE);
|
paintGridCircle.setStyle(Style.FILL_AND_STROKE);
|
||||||
paintGridCircle.setAntiAlias(true);
|
paintGridCircle.setAntiAlias(true);
|
||||||
|
@ -320,10 +327,11 @@ public class GPXLayer extends OsmandMapLayer implements ContextMenuLayer.IContex
|
||||||
int nmWidth = bounds.width();
|
int nmWidth = bounds.width();
|
||||||
int nmHeight = bounds.height();
|
int nmHeight = bounds.height();
|
||||||
RectF rect = new RectF(x - nmWidth / 2 - 2 * (float) Math.ceil(tileBox.getDensity()),
|
RectF rect = new RectF(x - nmWidth / 2 - 2 * (float) Math.ceil(tileBox.getDensity()),
|
||||||
y - nmHeight / 2 - 2 * (float) Math.ceil(tileBox.getDensity()),
|
y + nmHeight / 2 + 3 * (float) Math.ceil(tileBox.getDensity()),
|
||||||
x + nmWidth / 2 + 2 * (float) Math.ceil(tileBox.getDensity()),
|
x + nmWidth / 2 + 3 * (float) Math.ceil(tileBox.getDensity()),
|
||||||
y + (float) Math.ceil((float)nmHeight / 2) + 2 * (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, paintInnerRect);
|
||||||
|
canvas.drawRoundRect(rect, 5, 5, paintOuterRect);
|
||||||
canvas.drawText(nm, x, y + nmHeight / 2, paintTextIcon);
|
canvas.drawText(nm, x, y + nmHeight / 2, paintTextIcon);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue