Skip to content

Commit

Permalink
Merge branch 'osmandapp:master' into hardy_Afa
Browse files Browse the repository at this point in the history
  • Loading branch information
sonora authored Apr 18, 2024
2 parents 5a1ba8d + 92bded5 commit fcd5d9d
Show file tree
Hide file tree
Showing 100 changed files with 2,838 additions and 585 deletions.
4 changes: 4 additions & 0 deletions OsmAnd-java/src/main/java/net/osmand/IndexConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ public class IndexConstants {

public static final String AVOID_ROADS_FILE_EXT = ".geojson";

public static final String OBJ_FILE_EXT = ".obj";

public static final String POI_TABLE = "poi";

public static final String INDEX_DOWNLOAD_DOMAIN = "download.osmand.net";
Expand Down Expand Up @@ -105,6 +107,8 @@ public class IndexConstants {
public static final String GEOTIFF_DIR = "geotiff/";
public static final String WEATHER_INDEX_DIR = "weather/";
public static final String WEATHER_FORECAST_DIR = "weather_forecast/";
public static final String MODEL_3D_DIR = "models/";

public static final String VOICE_PROVIDER_SUFFIX = "-tts";
public static final String MODEL_NAME_PREFIX = "model_";
}
59 changes: 49 additions & 10 deletions OsmAnd-java/src/main/java/net/osmand/data/Amenity.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,13 @@
import net.osmand.osm.MapPoiTypes;
import net.osmand.osm.PoiCategory;
import net.osmand.osm.PoiType;
import net.osmand.search.SearchUICore;
import net.osmand.util.Algorithms;

import org.json.JSONObject;

import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.Map.Entry;
import java.util.Set;
import java.util.TreeSet;

import gnu.trove.list.array.TIntArrayList;

Expand Down Expand Up @@ -63,6 +55,9 @@ public class Amenity extends MapObject {
public static final String NAME = "name";
public static final String SEPARATOR = ";";
public static final String ALT_NAME_WITH_LANG_PREFIX = "alt_name:";
private static final String COLLAPSABLE_PREFIX = "collapsable_";
public static final String AMENITY_PREFIX = "amenity_";
private static final List<String> HIDING_EXTENSIONS_AMENITY_TAGS = Arrays.asList(PHONE, WEBSITE);

private String subType;
private PoiCategory type;
Expand Down Expand Up @@ -556,4 +551,48 @@ public static Amenity parseJSON(JSONObject json) {
}
return a;
}

public Map<String, String> getAmenityExtensions() {
Map<String, String> result = new HashMap<>();
Map<String, List<PoiType>> collectedPoiAdditionalCategories = new HashMap<>();

String name = this.name;
if (name != null) {
result.put(AMENITY_PREFIX + NAME, name);
}

if (subType != null) {
result.put(AMENITY_PREFIX + SUBTYPE, subType);
}

if (type != null) {
result.put(AMENITY_PREFIX + TYPE, type.getKeyName());
}

if (openingHours != null) {
result.put(AMENITY_PREFIX + OPENING_HOURS, openingHours);
}
if (hasAdditionalInfo()) {
SearchUICore searchUICore = new SearchUICore(MapPoiTypes.getDefault(), "en", false);
result.putAll(getAdditionalInfoAndCollectCategories(searchUICore.getPoiTypes(),
HIDING_EXTENSIONS_AMENITY_TAGS, collectedPoiAdditionalCategories, null));

//join collected tags by category into one string
for (Map.Entry<String, List<PoiType>> entry : collectedPoiAdditionalCategories.entrySet()) {
String categoryName = COLLAPSABLE_PREFIX + entry.getKey();
List<PoiType> categoryTypes = entry.getValue();
if (!categoryTypes.isEmpty()) {
StringBuilder builder = new StringBuilder();
for (PoiType poiType : categoryTypes) {
if (builder.length() > 0) {
builder.append(SEPARATOR);
}
builder.append(poiType.getKeyName());
}
result.put(categoryName, builder.toString());
}
}
}
return result;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ public static class HHRoutingConfig {
int FULL_DIJKSTRA_NETWORK_RECALC = 10;
int MAX_START_END_REITERATIONS = 50;
double MAX_INC_COST_CF = 1.25;
double MAX_COUNT_REITERATION = 500;

int MAX_COUNT_REITERATION = 100;
///////////
Double INITIAL_DIRECTION = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public HHNetworkRouteRes runRouting(LatLon start, LatLon end, HHRoutingConfig co
hctx.stats.routingTime += time / 1e6;
if (recalc) {
if (calcCount > hctx.config.MAX_COUNT_REITERATION) {
return new HHNetworkRouteRes(" Too many route recalculations (maps are outdated).");
return new HHNetworkRouteRes("Too many recalculations (outdated maps or unsupported parameters).");
}
hctx.clearVisited(stPoints, endPoints);
route = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1779,7 +1779,7 @@ protected TurnType createSimpleKeepLeftRightTurn(boolean leftSide, RouteSegmentR
lanes = createCombinedTurnTypeForSingleLane(rs, deviation);
t.setLanes(lanes);
int active = t.getActiveCommonLaneTurn();
if (!TurnType.isKeepDirectionTurn(active)) {
if (!TurnType.isKeepDirectionTurn(active) || !TurnType.isKeepDirectionTurn(t.getValue())) {
t = TurnType.valueOf(t.getActiveCommonLaneTurn(), leftSide);
}
} else {
Expand Down
1 change: 1 addition & 0 deletions OsmAnd/res/layout-v26/simple_map_widget_medium.xml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
android:autoSizeMinTextSize="@dimen/simple_widget_value_minimum_size"
android:autoSizeStepGranularity="2sp"
android:autoSizeTextType="uniform"
android:includeFontPadding="false"
android:ellipsize="none"
android:gravity="center_vertical|start"
android:letterSpacing="0.04"
Expand Down
12 changes: 6 additions & 6 deletions OsmAnd/res/layout-v26/simple_map_widget_small.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@
android:layout_marginEnd="@dimen/content_padding_small"
osmand:srcCompat="@drawable/ic_action_remove_dark" />

<TextView
<net.osmand.plus.widgets.AutoScaleTextView
android:id="@+id/widget_text"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:autoSizeMaxTextSize="@dimen/simple_widget_value_small_size"
android:autoSizeMinTextSize="@dimen/simple_widget_value_minimum_size"
android:autoSizeStepGranularity="2sp"
android:autoSizeTextType="uniform"
android:layout_gravity="center_vertical|start"
android:gravity="center_vertical|start"
android:includeFontPadding="false"
android:lines="1"
android:maxLines="1"
android:textColor="@color/text_color_primary_light"
android:textSize="@dimen/simple_widget_value_small_size"
osmand:maxTextSize="@dimen/simple_widget_value_small_size"
osmand:minTextSize="@dimen/simple_widget_value_minimum_size"
tools:text="155" />

<LinearLayout
Expand Down
58 changes: 58 additions & 0 deletions OsmAnd/res/layout/download_maps_card.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/download_maps_card"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical">

<include
android:id="@+id/download_container_top_divider"
layout="@layout/card_top_divider" />

<LinearLayout
android:id="@+id/download_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:orientation="vertical">

<net.osmand.plus.widgets.TextViewEx
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/content_padding"
android:paddingTop="@dimen/list_header_settings_top_margin"
android:paddingEnd="@dimen/content_padding"
android:text="@string/welmode_download_maps"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_medium" />

<net.osmand.plus.widgets.TextViewEx
android:id="@+id/download_description_tv"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginTop="@dimen/content_padding_half"
android:layout_marginEnd="@dimen/content_padding"
android:lineSpacingExtra="@dimen/line_spacing_extra_description"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
tools:text="@string/relief_3d_download_description" />

<com.github.ksoichiro.android.observablescrollview.ObservableListView
android:id="@+id/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:divider="@null"
android:fadeScrollbars="true" />

</LinearLayout>

<include
android:id="@+id/download_container_bottom_divider"
layout="@layout/card_bottom_divider" />

</LinearLayout>

108 changes: 108 additions & 0 deletions OsmAnd/res/layout/fragment_relief_3d.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:descendantFocusability="blocksDescendants"
android:orientation="vertical">

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/shadow_on_map"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"
osmand:srcCompat="@drawable/bg_shadow_onmap" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/activity_background_basic"
android:orientation="vertical">

<include layout="@layout/item_title_with_description_icon_switch" />

<include
android:id="@+id/titleBottomDivider"
layout="@layout/card_bottom_divider"
tools:visibility="gone" />

<LinearLayout
android:id="@+id/content_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">

<include layout="@layout/card_bottom_divider" />

<include layout="@layout/card_top_divider" />

<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/bg_color"
android:orientation="vertical">

<LinearLayout
android:id="@+id/vertical_exaggeration_button"
android:layout_width="match_parent"
android:layout_height="@dimen/setting_list_item_large_height"
android:background="?attr/selectableItemBackground"
android:gravity="center_vertical"
android:orientation="horizontal">

<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="@dimen/content_padding"
android:src="@drawable/ic_action_terrain_scale"
android:tint="?attr/default_icon_color" />

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingHorizontal="@dimen/content_padding"
android:text="@string/vertical_exaggeration"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular" />

<TextView
android:id="@+id/exaggeration_value"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="end"
android:paddingHorizontal="@dimen/content_padding"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size"
tools:text="None" />

</LinearLayout>

</LinearLayout>

<include layout="@layout/card_bottom_divider" />

<include layout="@layout/download_maps_card" />

</LinearLayout>

<View
android:id="@+id/bottom_empty_space"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:focusable="false"
android:minHeight="@dimen/toolbar_height" />

</LinearLayout>

</LinearLayout>

</LinearLayout>
Loading

0 comments on commit fcd5d9d

Please sign in to comment.