revert
This commit is contained in:
parent
4c0abd6918
commit
8febf17ea4
2 changed files with 11 additions and 39 deletions
|
@ -10,7 +10,6 @@ import android.graphics.Paint;
|
|||
import android.graphics.PointF;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.util.Linkify;
|
||||
import android.util.TypedValue;
|
||||
|
@ -66,7 +65,6 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
|||
private Bitmap poiBackground;
|
||||
private Bitmap poiBackgroundSmall;
|
||||
private PorterDuffColorFilter poiColorFilter;
|
||||
private float textScale;
|
||||
private int poiSize;
|
||||
|
||||
private OsmandMapTileView view;
|
||||
|
@ -86,7 +84,6 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
|||
routingHelper = activity.getRoutingHelper();
|
||||
routingHelper.addListener(this);
|
||||
app = activity.getMyApplication();
|
||||
textScale = app.getSettings().TEXT_SCALE.get();
|
||||
data = new OsmandMapLayer.MapLayerData<List<Amenity>>() {
|
||||
|
||||
Set<PoiUIFilter> calculatedFilters;
|
||||
|
@ -223,8 +220,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
|||
data.queryNewData(tileBox);
|
||||
objects = data.getResults();
|
||||
if (objects != null) {
|
||||
textScale = app.getSettings().TEXT_SCALE.get();
|
||||
float iconSize = poiBackground.getWidth() * 3 / 2 * textScale;
|
||||
float iconSize = poiBackground.getWidth() * 3 / 2;
|
||||
QuadTree<QuadRect> boundIntersections = initBoundIntersections(tileBox);
|
||||
WaypointHelper wph = app.getWaypointHelper();
|
||||
|
||||
|
@ -237,11 +233,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
|||
if (tileBox.containsPoint(x, y, iconSize)) {
|
||||
if (intersects(boundIntersections, x, y, iconSize, iconSize) ||
|
||||
(app.getSettings().SHOW_NEARBY_POI.get() && wph.isRouteCalculated() && !wph.isAmenityNoPassed(o))) {
|
||||
float scaledWidth = poiBackgroundSmall.getWidth() * textScale;
|
||||
float scaledHeight = poiBackgroundSmall.getHeight() * textScale;
|
||||
RectF rct = new RectF(0, 0, scaledWidth, scaledHeight);
|
||||
rct.offset(x - scaledWidth / 2f, y - scaledHeight / 2f);
|
||||
canvas.drawBitmap(poiBackgroundSmall, null, rct, paintIconBackground);
|
||||
canvas.drawBitmap(poiBackgroundSmall, x - poiBackgroundSmall.getWidth() / 2, y - poiBackgroundSmall.getHeight() / 2, paintIconBackground);
|
||||
smallObjectsLatLon.add(new LatLon(o.getLocation().getLatitude(),
|
||||
o.getLocation().getLongitude()));
|
||||
} else {
|
||||
|
@ -257,11 +249,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
|||
int y = (int) tileBox.getPixYFromLatLon(o.getLocation().getLatitude(), o.getLocation()
|
||||
.getLongitude());
|
||||
if (tileBox.containsPoint(x, y, iconSize)) {
|
||||
float scaledWidth = poiBackground.getWidth() * textScale;
|
||||
float scaledHeight = poiBackground.getHeight() * textScale;
|
||||
RectF rct = new RectF(0, 0, scaledWidth, scaledHeight);
|
||||
rct.offset(x - scaledWidth / 2f, y - scaledHeight / 2f);
|
||||
canvas.drawBitmap(poiBackground, null, rct, paintIconBackground);
|
||||
canvas.drawBitmap(poiBackground, x - poiBackground.getWidth() / 2, y - poiBackground.getHeight() / 2, paintIconBackground);
|
||||
String id = null;
|
||||
PoiType st = o.getType().getPoiTypeByKeyName(o.getSubType());
|
||||
if (st != null) {
|
||||
|
@ -274,10 +262,9 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
|||
if (id != null) {
|
||||
Drawable img = RenderingIcons.getDrawableIcon(view.getContext(), id, false);
|
||||
if (img != null) {
|
||||
int scaledPoiSize = (int) (poiSize * textScale);
|
||||
canvas.save();
|
||||
canvas.translate(x - scaledPoiSize / 2f, y - scaledPoiSize / 2f);
|
||||
img.setBounds(0, 0, scaledPoiSize, scaledPoiSize);
|
||||
canvas.translate(x - poiSize / 2f, y - poiSize / 2f);
|
||||
img.setBounds(0, 0, poiSize, poiSize);
|
||||
img.setColorFilter(poiColorFilter);
|
||||
img.draw(canvas);
|
||||
canvas.restore();
|
||||
|
|
|
@ -10,8 +10,6 @@ import android.graphics.Path;
|
|||
import android.graphics.PointF;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffColorFilter;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.RectF;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.WindowManager;
|
||||
|
@ -27,7 +25,7 @@ import net.osmand.data.RotatedTileBox;
|
|||
import net.osmand.data.TransportStop;
|
||||
import net.osmand.osm.edit.Node;
|
||||
import net.osmand.osm.edit.Way;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.render.RenderingIcons;
|
||||
|
@ -67,13 +65,11 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
|
|||
private Path path;
|
||||
private float backgroundIconHalfWidth;
|
||||
private float backgroundIconHalfHeight;
|
||||
private float textScale;
|
||||
|
||||
public TransportStopsLayer(MapActivity mapActivity) {
|
||||
this.mapActivity = mapActivity;
|
||||
OsmandSettings settings = mapActivity.getMyApplication().getSettings();
|
||||
showTransportStops = settings.getCustomRenderBooleanProperty(TRANSPORT_STOPS_OVER_MAP).cache();
|
||||
textScale = settings.TEXT_SCALE.get();
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
@ -237,8 +233,7 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
|
|||
}
|
||||
|
||||
if (objects != null) {
|
||||
textScale = mapActivity.getMyApplication().getSettings().TEXT_SCALE.get();
|
||||
float iconSize = stopBus.getWidth() * 3 / 2.5f * textScale;
|
||||
float iconSize = stopBus.getWidth() * 3 / 2.5f;
|
||||
QuadTree<QuadRect> boundIntersections = initBoundIntersections(tb);
|
||||
List<TransportStop> fullObjects = new ArrayList<>();
|
||||
for (TransportStop o : objects) {
|
||||
|
@ -259,27 +254,17 @@ public class TransportStopsLayer extends OsmandMapLayer implements ContextMenuLa
|
|||
TransportStopType type = TransportStopType.findType(stopRoute.route.getType());
|
||||
if (type != null) {
|
||||
Drawable foregroundIcon = RenderingIcons.getDrawableIcon(mapActivity, type.getResName(), false);
|
||||
float scaledWidth = backgroundIcon.getWidth() * textScale;
|
||||
float scaledHeight = backgroundIcon.getHeight() * textScale;
|
||||
RectF rct = new RectF(0, 0, scaledWidth, scaledHeight);
|
||||
rct.offset(x - scaledWidth / 2f, y - scaledHeight / 2f);
|
||||
canvas.drawBitmap(backgroundIcon, null, rct, paintIcon);
|
||||
canvas.drawBitmap(backgroundIcon, x - backgroundIconHalfWidth, y - backgroundIconHalfHeight, paintIcon);
|
||||
canvas.save();
|
||||
scaledWidth = foregroundIcon.getIntrinsicWidth() * textScale;
|
||||
scaledHeight = foregroundIcon.getIntrinsicHeight() * textScale;
|
||||
canvas.translate(x - scaledWidth / 2f, y - scaledHeight / 2f);
|
||||
foregroundIcon.setBounds(0, 0, (int) scaledWidth, (int) scaledHeight);
|
||||
canvas.translate(x - foregroundIcon.getIntrinsicWidth() / 2f, y - foregroundIcon.getIntrinsicHeight() / 2f);
|
||||
foregroundIcon.setBounds(0, 0, foregroundIcon.getIntrinsicWidth(), foregroundIcon.getIntrinsicHeight());
|
||||
foregroundIcon.setColorFilter(nightMode ? paintDarkIconFilter : paintLightIconFilter);
|
||||
foregroundIcon.draw(canvas);
|
||||
canvas.restore();
|
||||
}
|
||||
} else {
|
||||
Bitmap b = stopBus;
|
||||
float scaledWidth = b.getWidth() * textScale;
|
||||
float scaledHeight = b.getHeight() * textScale;
|
||||
RectF rct = new RectF(0, 0, scaledWidth, scaledHeight);
|
||||
rct.offset(x - scaledWidth / 2f, y - scaledHeight / 2f);
|
||||
canvas.drawBitmap(b, null, rct, paintIcon);
|
||||
canvas.drawBitmap(b, x - b.getWidth() / 2f, y - b.getHeight() / 2f, paintIcon);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue