From 380a20fc064c6c10f830ffa3fb34b2aeee6791d4 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 16 Oct 2024 15:13:32 +0300 Subject: [PATCH] Refactor id propagate --- .../main/java/net/osmand/NativeLibrary.java | 16 ++- .../java/net/osmand/binary/ObfConstants.java | 126 +++++++++++++++++- .../main/java/net/osmand/util/OsmUtils.java | 126 ------------------ .../core/android/MapRendererContext.java | 1 - .../builders/RenderedObjectMenuBuilder.java | 6 +- .../plugins/osmedit/OsmEditingPlugin.java | 8 +- .../helpers/OpenstreetmapLocalUtil.java | 6 +- .../helpers/OpenstreetmapRemoteUtil.java | 6 +- .../plus/views/layers/MapSelectionHelper.java | 10 +- 9 files changed, 155 insertions(+), 150 deletions(-) delete mode 100644 OsmAnd-java/src/main/java/net/osmand/util/OsmUtils.java diff --git a/OsmAnd-java/src/main/java/net/osmand/NativeLibrary.java b/OsmAnd-java/src/main/java/net/osmand/NativeLibrary.java index 8b9d34c91b5..49f08c1372c 100644 --- a/OsmAnd-java/src/main/java/net/osmand/NativeLibrary.java +++ b/OsmAnd-java/src/main/java/net/osmand/NativeLibrary.java @@ -18,7 +18,6 @@ import java.util.Map; import java.util.TreeMap; -import net.osmand.router.*; import org.apache.commons.logging.Log; import com.google.gson.JsonObject; @@ -27,17 +26,26 @@ import net.osmand.binary.BinaryMapIndexReader; import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteRegion; import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteSubregion; +import net.osmand.binary.ObfConstants; import net.osmand.binary.RouteDataObject; import net.osmand.data.LatLon; import net.osmand.data.MapObject; import net.osmand.data.QuadRect; import net.osmand.render.RenderingRuleSearchRequest; import net.osmand.render.RenderingRulesStorage; +import net.osmand.router.GeneralRouter; +import net.osmand.router.GpxRouteApproximation; import net.osmand.router.HHRouteDataStructure.HHRoutingConfig; +import net.osmand.router.HHRoutePlanner; +import net.osmand.router.NativeTransportRoutingResult; +import net.osmand.router.RouteCalculationProgress; import net.osmand.router.RoutePlannerFrontEnd.GpxPoint; +import net.osmand.router.RouteResultPreparation; +import net.osmand.router.RouteSegmentResult; +import net.osmand.router.RoutingContext; +import net.osmand.router.TransportRoutingConfiguration; import net.osmand.util.Algorithms; import net.osmand.util.MapUtils; -import net.osmand.util.OsmUtils; public class NativeLibrary { @@ -707,8 +715,8 @@ public String getGpxFileName() { @Override public String toString() { String s = getClass().getSimpleName() + " " + name; - String link = OsmUtils.getOsmUrlForId(this); - String tags = OsmUtils.getPrintTags(this); + String link = ObfConstants.getOsmUrlForId(this); + String tags = ObfConstants.getPrintTags(this); s += s.contains(link) ? "" : " " + link; s += s.contains(tags) ? "" : " " + tags; return s; diff --git a/OsmAnd-java/src/main/java/net/osmand/binary/ObfConstants.java b/OsmAnd-java/src/main/java/net/osmand/binary/ObfConstants.java index 352133f3095..d8f126095c2 100644 --- a/OsmAnd-java/src/main/java/net/osmand/binary/ObfConstants.java +++ b/OsmAnd-java/src/main/java/net/osmand/binary/ObfConstants.java @@ -1,5 +1,17 @@ package net.osmand.binary; +import static net.osmand.data.MapObject.AMENITY_ID_RIGHT_SHIFT; +import static net.osmand.router.RouteResultPreparation.SHIFT_ID; + +import java.util.Locale; +import java.util.Map; + +import net.osmand.NativeLibrary.RenderedObject; +import net.osmand.data.Amenity; +import net.osmand.data.MapObject; +import net.osmand.osm.edit.Entity.EntityType; +import net.osmand.util.Algorithms; + public class ObfConstants { public static final int SHIFT_MULTIPOLYGON_IDS = 43; @@ -7,5 +19,117 @@ public class ObfConstants { public static final int SHIFT_PROPAGATED_NODE_IDS = 50; public static final int SHIFT_PROPAGATED_NODES_BITS = 11; - public static final long MAX_COUNT_PROPAGATED_NODES = (1L << SHIFT_PROPAGATED_NODES_BITS) - 1;//2047 + public static final long MAX_ID_PROPAGATED_NODES = (1L << SHIFT_PROPAGATED_NODES_BITS) - 1;//2047 + + + public static final long RELATION_BIT = 1L << (ObfConstants.SHIFT_MULTIPOLYGON_IDS - 1); // 1L << 42 + public static final long PROPAGATE_NODE_BIT = 1L << (ObfConstants.SHIFT_PROPAGATED_NODE_IDS - 1); // 1L << 41 + public static final long SPLIT_BIT = 1L << (ObfConstants.SHIFT_NON_SPLIT_EXISTING_IDS - 1); // 1L << 40 + + public static final int DUPLICATE_SPLIT = 5; //According IndexPoiCreator DUPLICATE_SPLIT + + + public static String getOsmUrlForId(MapObject mapObject) { + EntityType type = getOsmEntityType(mapObject); + if (type != null) { + long osmId = getOsmObjectId(mapObject); + return "https://www.openstreetmap.org/" + type.name().toLowerCase(Locale.US) + "/" + osmId; + } + return ""; + } + + public static long getOsmObjectId(MapObject object) { + long originalId = -1; + Long id = object.getId(); + if (id != null) { + if (object instanceof RenderedObject) { + id >>= 1; + } + if (isIdFromPropagatedNode(id)) { + long shifted = id & ~PROPAGATE_NODE_BIT; + originalId = shifted >> ObfConstants.SHIFT_PROPAGATED_NODES_BITS; + } else { + if (isShiftedID(id)) { + originalId = getOsmId(id); + } else { + int shift = object instanceof Amenity ? AMENITY_ID_RIGHT_SHIFT : SHIFT_ID; + originalId = id >> shift; + } + } + } + return originalId; + } + + public static EntityType getOsmEntityType(MapObject object) { + if (isOsmUrlAvailable(object)) { + Long id = object.getId(); + long originalId = id >> 1; + if (object instanceof RenderedObject && isIdFromPropagatedNode(originalId)) { + return EntityType.WAY; + } + if (isIdFromPropagatedNode(id)) { + return EntityType.WAY; + } + long relationShift = 1L << 41; + if (originalId > relationShift) { + return EntityType.RELATION; + } else { + return id % 2 == MapObject.WAY_MODULO_REMAINDER ? EntityType.WAY : EntityType.NODE; + } + } + return null; + } + + public static String getPrintTags(RenderedObject renderedObject) { + StringBuilder s = new StringBuilder(); + for (Map.Entry entry : renderedObject.getTags().entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + boolean keyEmpty = Algorithms.isEmpty(key); + boolean valueEmpty = Algorithms.isEmpty(value); + boolean bothPresent = !keyEmpty && !valueEmpty; + boolean anyPresent = !keyEmpty || !valueEmpty; + if (!keyEmpty) { + s.append(key); + } + if (bothPresent) { + s.append(":"); + } + if (!valueEmpty) { + s.append(value); + } + if (anyPresent) { + s.append(" "); + } + } + return s.toString().trim(); + } + + public static boolean isOsmUrlAvailable(MapObject object) { + Long id = object.getId(); + return id != null && id > 0; + } + + public static long getOsmId(long id) { + //According methods assignIdForMultipolygon and genId in IndexPoiCreator + long clearBits = RELATION_BIT | SPLIT_BIT; + id = isShiftedID(id) ? (id & ~clearBits) >> DUPLICATE_SPLIT : id; + return id >> SHIFT_ID; + } + + public static boolean isShiftedID(long id) { + return isIdFromRelation(id) || isIdFromSplit(id); + } + + public static boolean isIdFromRelation(long id) { + return id > 0 && (id & RELATION_BIT) == RELATION_BIT; + } + + public static boolean isIdFromPropagatedNode(long id) { + return id > 0 && (id & PROPAGATE_NODE_BIT) == PROPAGATE_NODE_BIT; + } + + public static boolean isIdFromSplit(long id) { + return id > 0 && (id & SPLIT_BIT) == SPLIT_BIT; + } } diff --git a/OsmAnd-java/src/main/java/net/osmand/util/OsmUtils.java b/OsmAnd-java/src/main/java/net/osmand/util/OsmUtils.java deleted file mode 100644 index 7b6a7b0a5cc..00000000000 --- a/OsmAnd-java/src/main/java/net/osmand/util/OsmUtils.java +++ /dev/null @@ -1,126 +0,0 @@ -package net.osmand.util; - -import net.osmand.NativeLibrary.RenderedObject; -import net.osmand.binary.ObfConstants; -import net.osmand.data.Amenity; -import net.osmand.data.MapObject; -import net.osmand.osm.edit.Entity.EntityType; - -import java.util.Locale; -import java.util.Map; - -import static net.osmand.data.MapObject.AMENITY_ID_RIGHT_SHIFT; -import static net.osmand.router.RouteResultPreparation.SHIFT_ID; - -public class OsmUtils { - - public static final long RELATION_BIT = 1L << ObfConstants.SHIFT_MULTIPOLYGON_IDS - 1; // 1L << 42 - public static final long PROPAGATE_NODE_BIT = 1L << ObfConstants.SHIFT_PROPAGATED_NODE_IDS - 1; // 1L << 41 - public static final long SPLIT_BIT = 1L << ObfConstants.SHIFT_NON_SPLIT_EXISTING_IDS - 1; // 1L << 40 - - public static final int DUPLICATE_SPLIT = 5; //According IndexPoiCreator DUPLICATE_SPLIT - - public static String getOsmUrlForId(MapObject mapObject) { - EntityType type = getOsmEntityType(mapObject); - if (type != null) { - long osmId = getOsmObjectId(mapObject); - return "https://www.openstreetmap.org/" + type.name().toLowerCase(Locale.US) + "/" + osmId; - } - return ""; - } - - public static long getOsmObjectId(MapObject object) { - long originalId = -1; - Long id = object.getId(); - if (id != null) { - if (object instanceof RenderedObject) { - id >>= 1; - } - if (isIdFromPropagatedNode(id)) { - long shifted = id & ~PROPAGATE_NODE_BIT; - originalId = shifted >> ObfConstants.SHIFT_PROPAGATED_NODES_BITS; - } else { - if (isShiftedID(id)) { - originalId = getOsmId(id); - } else { - int shift = object instanceof Amenity ? AMENITY_ID_RIGHT_SHIFT : SHIFT_ID; - originalId = id >> shift; - } - } - } - return originalId; - } - - public static EntityType getOsmEntityType(MapObject object) { - if (isOsmUrlAvailable(object)) { - Long id = object.getId(); - long originalId = id >> 1; - if (object instanceof RenderedObject && isIdFromPropagatedNode(originalId)) { - return EntityType.WAY; - } - if (isIdFromPropagatedNode(id)) { - return EntityType.WAY; - } - long relationShift = 1L << 41; - if (originalId > relationShift) { - return EntityType.RELATION; - } else { - return id % 2 == MapObject.WAY_MODULO_REMAINDER ? EntityType.WAY : EntityType.NODE; - } - } - return null; - } - - public static String getPrintTags(RenderedObject renderedObject) { - StringBuilder s = new StringBuilder(); - for (Map.Entry entry : renderedObject.getTags().entrySet()) { - String key = entry.getKey(); - String value = entry.getValue(); - boolean keyEmpty = Algorithms.isEmpty(key); - boolean valueEmpty = Algorithms.isEmpty(value); - boolean bothPresent = !keyEmpty && !valueEmpty; - boolean anyPresent = !keyEmpty || !valueEmpty; - if (!keyEmpty) { - s.append(key); - } - if (bothPresent) { - s.append(":"); - } - if (!valueEmpty) { - s.append(value); - } - if (anyPresent) { - s.append(" "); - } - } - return s.toString().trim(); - } - - public static boolean isOsmUrlAvailable(MapObject object) { - Long id = object.getId(); - return id != null && id > 0; - } - - public static long getOsmId(long id) { - //According methods assignIdForMultipolygon and genId in IndexPoiCreator - long clearBits = RELATION_BIT | SPLIT_BIT; - id = isShiftedID(id) ? (id & ~clearBits) >> DUPLICATE_SPLIT : id; - return id >> SHIFT_ID; - } - - public static boolean isShiftedID(long id) { - return isIdFromRelation(id) || isIdFromSplit(id); - } - - public static boolean isIdFromRelation(long id) { - return id > 0 && (id & RELATION_BIT) == RELATION_BIT; - } - - public static boolean isIdFromPropagatedNode(long id) { - return id > 0 && (id & PROPAGATE_NODE_BIT) == PROPAGATE_NODE_BIT; - } - - public static boolean isIdFromSplit(long id) { - return id > 0 && (id & SPLIT_BIT) == SPLIT_BIT; - } -} diff --git a/OsmAnd/src/net/osmand/core/android/MapRendererContext.java b/OsmAnd/src/net/osmand/core/android/MapRendererContext.java index 04c78d32224..36e9a7f90be 100644 --- a/OsmAnd/src/net/osmand/core/android/MapRendererContext.java +++ b/OsmAnd/src/net/osmand/core/android/MapRendererContext.java @@ -64,7 +64,6 @@ import net.osmand.render.RenderingRulesStorage; import net.osmand.util.Algorithms; import net.osmand.util.MapUtils; -import net.osmand.util.OsmUtils; import java.io.ByteArrayOutputStream; import java.io.File; diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/RenderedObjectMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/RenderedObjectMenuBuilder.java index f1fa72eb4d3..a59c0aa771f 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/RenderedObjectMenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/RenderedObjectMenuBuilder.java @@ -11,6 +11,7 @@ import net.osmand.CallbackWithObject; import net.osmand.ResultMatcher; import net.osmand.binary.BinaryMapIndexReader; +import net.osmand.binary.ObfConstants; import net.osmand.data.Amenity; import net.osmand.data.QuadRect; import net.osmand.osm.MapPoiTypes; @@ -19,7 +20,6 @@ import net.osmand.plus.activities.MapActivity; import net.osmand.util.Algorithms; import net.osmand.util.MapUtils; -import net.osmand.util.OsmUtils; import java.lang.ref.WeakReference; import java.util.HashMap; @@ -147,7 +147,7 @@ private SearchAmenitiesTask(OsmandApplication application, RenderedObject render double lat = MapUtils.get31LatitudeY(renderedObject.getLabelY()); double lon = MapUtils.get31LongitudeX(renderedObject.getLabelX()); rect = MapUtils.calculateLatLonBbox(lat, lon, SEARCH_POI_RADIUS); - osmId = OsmUtils.getOsmObjectId(renderedObject); + osmId = ObfConstants.getOsmObjectId(renderedObject); app = application; } @@ -160,7 +160,7 @@ protected Amenity doInBackground(Void... params) { new ResultMatcher<>() { @Override public boolean publish(Amenity amenity) { - long id = OsmUtils.getOsmObjectId(amenity); + long id = ObfConstants.getOsmObjectId(amenity); return id == osmId; } diff --git a/OsmAnd/src/net/osmand/plus/plugins/osmedit/OsmEditingPlugin.java b/OsmAnd/src/net/osmand/plus/plugins/osmedit/OsmEditingPlugin.java index f29b33c495f..846eae7d33a 100644 --- a/OsmAnd/src/net/osmand/plus/plugins/osmedit/OsmEditingPlugin.java +++ b/OsmAnd/src/net/osmand/plus/plugins/osmedit/OsmEditingPlugin.java @@ -28,6 +28,7 @@ import net.osmand.NativeLibrary.RenderedObject; import net.osmand.PlatformUtil; +import net.osmand.binary.ObfConstants; import net.osmand.plus.plugins.osmedit.quickactions.ShowHideOSMEditsAction; import net.osmand.plus.shared.SharedUtil; import net.osmand.data.Amenity; @@ -88,7 +89,6 @@ import net.osmand.render.RenderingRuleProperty; import net.osmand.shared.io.KFile; import net.osmand.util.Algorithms; -import net.osmand.util.OsmUtils; import org.apache.commons.logging.Log; import org.jetbrains.annotations.NotNull; @@ -346,7 +346,7 @@ public void registerMapContextMenuActions(@NonNull MapActivity mapActivity, PoiType poiType = amenity.getType().getPoiTypeByKeyName(amenity.getSubType()); isEditable = !amenity.getType().isWiki() && poiType != null && !poiType.isNotEditableOsm(); } else if (selectedObj instanceof MapObject) { - isEditable = OsmUtils.isOsmUrlAvailable((MapObject) selectedObj); + isEditable = ObfConstants.isOsmUrlAvailable((MapObject) selectedObj); } if (isEditable) { adapter.addItem(new ContextMenuItem(MAP_CONTEXT_MENU_CREATE_POI) @@ -602,13 +602,13 @@ public boolean isMenuControllerSupported(Class menuCon @Override public void buildContextMenuRows(@NonNull MenuBuilder menuBuilder, @NonNull View view, Object object) { if (object instanceof Amenity amenity) { - String link = OsmUtils.getOsmUrlForId(amenity); + String link = ObfConstants.getOsmUrlForId(amenity); if (!Algorithms.isEmpty(link)) { menuBuilder.buildRow(view, R.drawable.ic_action_openstreetmap_logo, null, link, 0, false, null, true, 0, true, null, false); } } else if (object instanceof RenderedObject renderedObject) { - String link = OsmUtils.getOsmUrlForId(renderedObject); + String link = ObfConstants.getOsmUrlForId(renderedObject); if (!Algorithms.isEmpty(link)) { menuBuilder.buildRow(view, R.drawable.ic_action_info_dark, null, link, 0, false, null, true, 0, true, null, false); diff --git a/OsmAnd/src/net/osmand/plus/plugins/osmedit/helpers/OpenstreetmapLocalUtil.java b/OsmAnd/src/net/osmand/plus/plugins/osmedit/helpers/OpenstreetmapLocalUtil.java index 74b935dc663..d6ad9df98ad 100644 --- a/OsmAnd/src/net/osmand/plus/plugins/osmedit/helpers/OpenstreetmapLocalUtil.java +++ b/OsmAnd/src/net/osmand/plus/plugins/osmedit/helpers/OpenstreetmapLocalUtil.java @@ -6,6 +6,7 @@ import net.osmand.NativeLibrary.RenderedObject; import net.osmand.PlatformUtil; +import net.osmand.binary.ObfConstants; import net.osmand.data.Amenity; import net.osmand.data.Building; import net.osmand.data.LatLon; @@ -25,7 +26,6 @@ import net.osmand.plus.plugins.osmedit.data.OsmPoint.Action; import net.osmand.util.Algorithms; import net.osmand.util.MapUtils; -import net.osmand.util.OsmUtils; import org.apache.commons.logging.Log; @@ -87,12 +87,12 @@ public Entity commitEntityImpl(@NonNull Action action, Entity entity, EntityInfo @Override public Entity loadEntity(@NonNull MapObject mapObject) { - EntityType type = OsmUtils.getOsmEntityType(mapObject); + EntityType type = ObfConstants.getOsmEntityType(mapObject); if (type == null || type == EntityType.RELATION) { return null; } boolean isWay = type == EntityType.WAY; - long entityId = OsmUtils.getOsmObjectId(mapObject); + long entityId = ObfConstants.getOsmObjectId(mapObject); Amenity amenity = null; if (mapObject instanceof Amenity) { diff --git a/OsmAnd/src/net/osmand/plus/plugins/osmedit/helpers/OpenstreetmapRemoteUtil.java b/OsmAnd/src/net/osmand/plus/plugins/osmedit/helpers/OpenstreetmapRemoteUtil.java index ee7ce2e78ef..d600fa54143 100644 --- a/OsmAnd/src/net/osmand/plus/plugins/osmedit/helpers/OpenstreetmapRemoteUtil.java +++ b/OsmAnd/src/net/osmand/plus/plugins/osmedit/helpers/OpenstreetmapRemoteUtil.java @@ -12,6 +12,7 @@ import net.osmand.NativeLibrary; import net.osmand.PlatformUtil; +import net.osmand.binary.ObfConstants; import net.osmand.data.Amenity; import net.osmand.data.Building; import net.osmand.data.LatLon; @@ -37,7 +38,6 @@ import net.osmand.plus.plugins.osmedit.oauth.OsmOAuthAuthorizationAdapter; import net.osmand.plus.utils.AndroidNetworkUtils; import net.osmand.util.MapUtils; -import net.osmand.util.OsmUtils; import org.apache.commons.logging.Log; import org.xmlpull.v1.XmlPullParserException; @@ -460,12 +460,12 @@ public static boolean isDeletedTag(@NonNull Entity entity, @NonNull String tag) @Override public Entity loadEntity(@NonNull MapObject object) { - EntityType type = OsmUtils.getOsmEntityType(object); + EntityType type = ObfConstants.getOsmEntityType(object); if (type == null || type == EntityType.RELATION) { return null; } boolean isWay = type == EntityType.WAY; - long entityId = OsmUtils.getOsmObjectId(object); + long entityId = ObfConstants.getOsmObjectId(object); try { String api = isWay ? "api/0.6/way/" : "api/0.6/node/"; String res = sendRequest(getSiteApi() + api + entityId, "GET", null, diff --git a/OsmAnd/src/net/osmand/plus/views/layers/MapSelectionHelper.java b/OsmAnd/src/net/osmand/plus/views/layers/MapSelectionHelper.java index 4d1badc8e9f..58ac11bc5f1 100644 --- a/OsmAnd/src/net/osmand/plus/views/layers/MapSelectionHelper.java +++ b/OsmAnd/src/net/osmand/plus/views/layers/MapSelectionHelper.java @@ -23,6 +23,7 @@ import net.osmand.PlatformUtil; import net.osmand.RenderingContext; import net.osmand.binary.BinaryMapIndexReader; +import net.osmand.binary.ObfConstants; import net.osmand.core.android.MapRendererView; import net.osmand.core.jni.AmenitySymbolsProvider.AmenitySymbolsGroup; import net.osmand.core.jni.AreaI; @@ -72,7 +73,6 @@ import net.osmand.shared.gpx.primitives.WptPt; import net.osmand.util.Algorithms; import net.osmand.util.MapUtils; -import net.osmand.util.OsmUtils; import org.apache.commons.logging.Log; @@ -632,7 +632,7 @@ private static Map getTags(@Nullable QStringStringHash set) { public static Amenity findAmenity(@NonNull OsmandApplication app, @NonNull LatLon latLon, @Nullable List names, long id) { - int searchRadius = OsmUtils.isIdFromRelation(id >> AMENITY_ID_RIGHT_SHIFT) + int searchRadius = ObfConstants.isIdFromRelation(id >> AMENITY_ID_RIGHT_SHIFT) ? AMENITY_SEARCH_RADIUS_FOR_RELATION : AMENITY_SEARCH_RADIUS; return findAmenity(app, latLon, names, id, searchRadius); @@ -641,7 +641,7 @@ public static Amenity findAmenity(@NonNull OsmandApplication app, @NonNull LatLo @Nullable public static Amenity findAmenity(@NonNull OsmandApplication app, @NonNull LatLon latLon, @Nullable List names, long id, int radius) { - id = OsmUtils.getOsmId(id >> AMENITY_ID_RIGHT_SHIFT); + id = ObfConstants.getOsmId(id >> AMENITY_ID_RIGHT_SHIFT); QuadRect rect = MapUtils.calculateLatLonBbox(latLon.getLatitude(), latLon.getLongitude(), radius); List amenities = app.getResourceManager().searchAmenities(ACCEPT_ALL_POI_TYPE_FILTER, rect, true); @@ -666,8 +666,8 @@ public static Amenity findAmenityByOsmId(@NonNull List amenities, long Long initAmenityId = amenity.getId(); if (initAmenityId != null) { long amenityId; - if (OsmUtils.isShiftedID(initAmenityId)) { - amenityId = OsmUtils.getOsmId(initAmenityId); + if (ObfConstants.isShiftedID(initAmenityId)) { + amenityId = ObfConstants.getOsmId(initAmenityId); } else { amenityId = initAmenityId >> AMENITY_ID_RIGHT_SHIFT; }