MarkerRenderer: sort option

This commit is contained in:
Emux 2020-03-17 11:34:53 +02:00
parent e0efff50a8
commit c28aec5f59
No known key found for this signature in database
GPG Key ID: 64ED9980896038C3
3 changed files with 13 additions and 4 deletions

View File

@ -2,6 +2,8 @@
## New since 0.13.0 ## New since 0.13.0
- Marker renderer sort option
- `Parameters.MARKER_SORT`
- Many other minor improvements and bug fixes - Many other minor improvements and bug fixes
- [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.14.0) - [Solved issues](https://github.com/mapsforge/vtm/issues?q=is%3Aclosed+milestone%3A0.14.0)

View File

@ -2,7 +2,7 @@
* Copyright 2013 Hannes Janetzek * Copyright 2013 Hannes Janetzek
* Copyright 2016 Izumi Kawashima * Copyright 2016 Izumi Kawashima
* Copyright 2017 Longri * Copyright 2017 Longri
* Copyright 2017-2018 devemux86 * Copyright 2017-2020 devemux86
* Copyright 2017 nebular * Copyright 2017 nebular
* *
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org). * This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
@ -27,6 +27,7 @@ import org.oscim.renderer.BucketRenderer;
import org.oscim.renderer.GLViewport; import org.oscim.renderer.GLViewport;
import org.oscim.renderer.bucket.SymbolBucket; import org.oscim.renderer.bucket.SymbolBucket;
import org.oscim.renderer.bucket.SymbolItem; import org.oscim.renderer.bucket.SymbolItem;
import org.oscim.utils.Parameters;
import org.oscim.utils.TimSort; import org.oscim.utils.TimSort;
import org.oscim.utils.geom.GeometryUtils; import org.oscim.utils.geom.GeometryUtils;
@ -187,13 +188,14 @@ public class MarkerRenderer extends BucketRenderer {
static TimSort<InternalItem> ZSORT = new TimSort<InternalItem>(); static TimSort<InternalItem> ZSORT = new TimSort<InternalItem>();
public static void sort(InternalItem[] a, int lo, int hi) { protected void sort(InternalItem[] a, int lo, int hi) {
int nRemaining = hi - lo; int nRemaining = hi - lo;
if (nRemaining < 2) { if (nRemaining < 2) {
return; return;
} }
ZSORT.doSort(a, zComparator, lo, hi); if (Parameters.MARKER_SORT)
ZSORT.doSort(a, zComparator, lo, hi);
} }
static final Comparator<InternalItem> zComparator = new Comparator<InternalItem>() { static final Comparator<InternalItem> zComparator = new Comparator<InternalItem>() {

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2017-2019 devemux86 * Copyright 2017-2020 devemux86
* *
* This program is free software: you can redistribute it and/or modify it under the * This program is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software * terms of the GNU Lesser General Public License as published by the Free Software
@ -36,6 +36,11 @@ public final class Parameters {
*/ */
public static boolean MAP_EVENT_LAYER2 = false; public static boolean MAP_EVENT_LAYER2 = false;
/**
* If true the markers are sorted in y-axis.
*/
public static boolean MARKER_SORT = true;
/** /**
* Maximum buffer size for map files. * Maximum buffer size for map files.
*/ */