Merge pull request #8381 from osmandapp/poi_search_fix

fix for #6497
This commit is contained in:
vshcherb 2020-02-03 15:24:30 +01:00 committed by GitHub
commit 911f4788b1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 10 deletions

View file

@ -364,6 +364,8 @@ public class NativeLibrary {
private int order;
private boolean visible;
private LatLon labelLatLon;
private int labelX = 0;
private int labelY = 0;
public Map<String, String> getTags() {
return tags;
@ -434,6 +436,21 @@ public class NativeLibrary {
tags.put(t, v);
}
public int getLabelX() {
return labelX;
}
public int getLabelY() {
return labelY;
}
public void setLabelX(int labelX) {
this.labelX = labelX;
}
public void setLabelY(int labelY) {
this.labelY = labelY;
}
}
}

View file

@ -48,6 +48,7 @@ import net.osmand.data.TransportStop;
import net.osmand.osm.PoiCategory;
import net.osmand.osm.PoiFilter;
import net.osmand.osm.PoiType;
import net.osmand.osm.edit.OsmMapUtils;
import net.osmand.plus.ContextMenuAdapter;
import net.osmand.plus.ContextMenuItem;
import net.osmand.plus.OsmandApplication;
@ -686,6 +687,9 @@ public class ContextMenuLayer extends OsmandMapLayer {
double cosRotateTileSize = Math.cos(Math.toRadians(rc.rotate)) * TILE_SIZE;
double sinRotateTileSize = Math.sin(Math.toRadians(rc.rotate)) * TILE_SIZE;
for (RenderedObject r : renderedObjects) {
if (r.getLabelX() != 0 && r.getLabelY() != 0) {
r.setLabelLatLon(new LatLon(MapUtils.get31LatitudeY(r.getLabelY()), MapUtils.get31LongitudeX(r.getLabelX())));
} else {
double cx = r.getBbox().centerX();
double cy = r.getBbox().centerY();
double dTileX = (cx * cosRotateTileSize + cy * sinRotateTileSize) / (TILE_SIZE * TILE_SIZE);
@ -696,6 +700,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
double lon = MapUtils.get31LongitudeX(x31);
r.setLabelLatLon(new LatLon(lat, lon));
}
}
for (RenderedObject renderedObject : renderedObjects) {
if (renderedObject.getX() != null && renderedObject.getX().size() == 1
&& renderedObject.getY() != null && renderedObject.getY().size() == 1) {