PolyLabel default disabled #402
This commit is contained in:
@@ -10,6 +10,7 @@
|
|||||||
- Core utilities [#396](https://github.com/mapsforge/vtm/issues/396)
|
- Core utilities [#396](https://github.com/mapsforge/vtm/issues/396)
|
||||||
- Map scaling improvements [#401](https://github.com/mapsforge/vtm/issues/401)
|
- Map scaling improvements [#401](https://github.com/mapsforge/vtm/issues/401)
|
||||||
- Mapsforge fix artifacts zoom > 17 [#231](https://github.com/mapsforge/vtm/issues/231)
|
- Mapsforge fix artifacts zoom > 17 [#231](https://github.com/mapsforge/vtm/issues/231)
|
||||||
|
- PolyLabel default disabled [#402](https://github.com/mapsforge/vtm/issues/402)
|
||||||
- vtm-theme-comparator module [#387](https://github.com/mapsforge/vtm/issues/387)
|
- vtm-theme-comparator module [#387](https://github.com/mapsforge/vtm/issues/387)
|
||||||
- Internal render themes various improvements [#41](https://github.com/mapsforge/vtm/issues/41)
|
- Internal render themes various improvements [#41](https://github.com/mapsforge/vtm/issues/41)
|
||||||
- Many other minor improvements and bug fixes
|
- Many other minor improvements and bug fixes
|
||||||
|
|||||||
@@ -59,6 +59,8 @@ public class MapsforgeMapActivity extends MapActivity {
|
|||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
//LabelLayer.POLY_LABEL = true;
|
||||||
|
|
||||||
startActivityForResult(new Intent(this, MapFilePicker.class),
|
startActivityForResult(new Intent(this, MapFilePicker.class),
|
||||||
SELECT_MAP_FILE);
|
SELECT_MAP_FILE);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,10 @@ public class MapsforgeTest extends GdxMap {
|
|||||||
|
|
||||||
private static File mapFile;
|
private static File mapFile;
|
||||||
|
|
||||||
|
private MapsforgeTest() {
|
||||||
|
//LabelLayer.POLY_LABEL = true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createLayers() {
|
public void createLayers() {
|
||||||
MapFileTileSource tileSource = new MapFileTileSource();
|
MapFileTileSource tileSource = new MapFileTileSource();
|
||||||
|
|||||||
@@ -34,9 +34,11 @@ public class LabelLayer extends Layer implements Map.UpdateListener, TileManager
|
|||||||
|
|
||||||
static final Logger log = LoggerFactory.getLogger(LabelLayer.class);
|
static final Logger log = LoggerFactory.getLogger(LabelLayer.class);
|
||||||
|
|
||||||
public final static String LABEL_DATA = LabelLayer.class.getName();
|
static final String LABEL_DATA = LabelLayer.class.getName();
|
||||||
|
|
||||||
private final static long MAX_RELABEL_DELAY = 100;
|
private static final long MAX_RELABEL_DELAY = 100;
|
||||||
|
|
||||||
|
public static boolean POLY_LABEL;
|
||||||
|
|
||||||
private final LabelPlacement mLabelPlacer;
|
private final LabelPlacement mLabelPlacer;
|
||||||
private final Worker mWorker;
|
private final Worker mWorker;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2013 Hannes Janetzek
|
* Copyright 2013 Hannes Janetzek
|
||||||
* Copyright 2016 devemux86
|
* Copyright 2016-2017 devemux86
|
||||||
* Copyright 2016 Andrey Novikov
|
* Copyright 2016 Andrey Novikov
|
||||||
*
|
*
|
||||||
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
* This file is part of the OpenScienceMap project (http://www.opensciencemap.org).
|
||||||
@@ -90,10 +90,28 @@ public class LabelTileLoaderHook implements TileLoaderThemeHook {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (label == null)
|
float x = 0;
|
||||||
label = PolyLabel.get(element);
|
float y = 0;
|
||||||
|
if (label == null) {
|
||||||
|
if (LabelLayer.POLY_LABEL) {
|
||||||
|
label = PolyLabel.get(element);
|
||||||
|
x = label.x;
|
||||||
|
y = label.y;
|
||||||
|
} else {
|
||||||
|
int n = element.index[0];
|
||||||
|
for (int i = 0; i < n; ) {
|
||||||
|
x += element.points[i++];
|
||||||
|
y += element.points[i++];
|
||||||
|
}
|
||||||
|
x /= (n / 2);
|
||||||
|
y /= (n / 2);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
x = label.x;
|
||||||
|
y = label.y;
|
||||||
|
}
|
||||||
|
|
||||||
ld.labels.push(TextItem.pool.get().set(label.x, label.y, value, text));
|
ld.labels.push(TextItem.pool.get().set(x, y, value, text));
|
||||||
} else if (element.type == POINT) {
|
} else if (element.type == POINT) {
|
||||||
String value = element.tags.getValue(text.textKey);
|
String value = element.tags.getValue(text.textKey);
|
||||||
if (value == null || value.length() == 0)
|
if (value == null || value.length() == 0)
|
||||||
|
|||||||
Reference in New Issue
Block a user