Skip to content

Commit 51045b4

Browse files
Merge pull request #391 from heremaps/esd/42320
Update example apps for release 4.23.2.0
2 parents b90af56 + e3c4e6f commit 51045b4

File tree

70 files changed

+534
-175
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+534
-175
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ For an overview of the existing features, please check the _Developer Guide_ for
2626

2727
> For now, the _Navigate Edition_ is only available upon request. Please contact your HERE representative to receive access including a set of evaluation credentials.
2828
29-
## List of Available Example Apps (Version 4.23.1.0)
29+
## List of Available Example Apps (Version 4.23.2.0)
3030

3131
- **HelloMap**: Shows the classic 'Hello World'.
3232
- **HelloMapWithStoryboard**: Shows the classic 'Hello World' using a Storyboard (iOS only).

examples/latest/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
This folder contains the HERE SDK examples apps for version: 4.23.1.0
1+
This folder contains the HERE SDK examples apps for version: 4.23.2.0
22

33
- HERE SDK for Android ([Lite Edition](lite/android/), [Explore Edition](explore/android/), [Navigate Edition](navigate/android/))
44
- HERE SDK for iOS ([Lite Edition](lite/ios/), [Explore Edition](explore/ios/), [Navigate Edition](navigate/ios/))

examples/latest/explore/android/MapItemsKotlin/app/src/main/java/com/here/mapitemskotlin/MainActivity.kt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package com.here.mapitemskotlin
2020

2121
import android.os.Bundle
2222
import android.util.Log
23+
import android.widget.Toast
2324
import androidx.activity.ComponentActivity
2425
import androidx.activity.compose.setContent
2526
import androidx.activity.enableEdgeToEdge
@@ -151,6 +152,14 @@ class MainActivity : ComponentActivity() {
151152
"Arrow" -> mapObjectsExample?.showMapArrow()
152153
"Polygon" -> mapObjectsExample?.showMapPolygon()
153154
"Circle" -> mapObjectsExample?.showMapCircle()
155+
"Enable visibility ranges" -> {
156+
Toast.makeText(
157+
this,
158+
"Enabled visibility ranges for MapPolyLine",
159+
Toast.LENGTH_SHORT
160+
).show()
161+
mapObjectsExample?.enableVisibilityRangesForPolyline()
162+
}
154163
"Clear Items" -> mapObjectsExample?.clearMapButtonClicked()
155164
}
156165
},

examples/latest/explore/android/MapItemsKotlin/app/src/main/java/com/here/mapitemskotlin/MapObjectsExample.kt

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,27 @@
1818
*/
1919
package com.here.mapitemskotlin
2020

21-
import android.util.Log;
22-
23-
import com.here.sdk.core.Color;
24-
import com.here.sdk.core.GeoCircle;
25-
import com.here.sdk.core.GeoCoordinates;
26-
import com.here.sdk.core.GeoCoordinatesUpdate;
27-
import com.here.sdk.core.GeoPolygon;
28-
import com.here.sdk.core.GeoPolyline;
29-
import com.here.sdk.core.errors.InstantiationErrorException;
30-
import com.here.sdk.mapview.LineCap;
31-
import com.here.sdk.mapview.MapArrow;
32-
import com.here.sdk.mapview.MapCamera;
33-
import com.here.sdk.mapview.MapCameraAnimationFactory;
34-
import com.here.sdk.mapview.MapMeasure;
35-
import com.here.sdk.mapview.MapMeasureDependentRenderSize;
36-
import com.here.sdk.mapview.MapPolygon;
37-
import com.here.sdk.mapview.MapPolyline;
38-
import com.here.sdk.mapview.MapScene;
39-
import com.here.sdk.mapview.MapView;
40-
import com.here.sdk.mapview.RenderSize;
41-
import com.here.time.Duration;
42-
43-
import java.util.ArrayList;
21+
import android.util.Log
22+
import com.here.sdk.core.Color
23+
import com.here.sdk.core.GeoCircle
24+
import com.here.sdk.core.GeoCoordinates
25+
import com.here.sdk.core.GeoCoordinatesUpdate
26+
import com.here.sdk.core.GeoPolygon
27+
import com.here.sdk.core.GeoPolyline
28+
import com.here.sdk.core.errors.InstantiationErrorException
29+
import com.here.sdk.mapview.LineCap
30+
import com.here.sdk.mapview.MapArrow
31+
import com.here.sdk.mapview.MapCamera
32+
import com.here.sdk.mapview.MapCameraAnimationFactory
33+
import com.here.sdk.mapview.MapMeasure
34+
import com.here.sdk.mapview.MapMeasureDependentRenderSize
35+
import com.here.sdk.mapview.MapMeasureRange
36+
import com.here.sdk.mapview.MapPolygon
37+
import com.here.sdk.mapview.MapPolyline
38+
import com.here.sdk.mapview.MapScene
39+
import com.here.sdk.mapview.MapView
40+
import com.here.sdk.mapview.RenderSize
41+
import com.here.time.Duration
4442

4543
class MapObjectsExample(private val mapView: MapView) {
4644

@@ -66,6 +64,21 @@ class MapObjectsExample(private val mapView: MapView) {
6664
mapScene!!.addMapPolyline(mapPolyline!!)
6765
}
6866

67+
fun enableVisibilityRangesForPolyline() {
68+
val visibilityRanges = ArrayList<MapMeasureRange>()
69+
70+
// At present, only MapMeasure.Kind.ZOOM_LEVEL is supported for visibility ranges.
71+
// Other kinds will be ignored.
72+
visibilityRanges.add(MapMeasureRange(MapMeasure.Kind.ZOOM_LEVEL, 1.0, 10.0))
73+
visibilityRanges.add(MapMeasureRange(MapMeasure.Kind.ZOOM_LEVEL, 11.0, 22.0))
74+
75+
// Sets the visibility ranges for this map polyline based on zoom levels.
76+
// Each range is half-open: [minimumZoomLevel, maximumZoomLevel],
77+
// meaning the polyline is visible at minimumZoomLevel but not at maximumZoomLevel.
78+
// The polyline is rendered only when the map zoom level falls within any of the defined ranges.
79+
mapPolyline?.visibilityRanges = visibilityRanges
80+
}
81+
6982
fun showMapArrow() {
7083
clearMap()
7184
// Move map to expected location.

examples/latest/explore/android/Routing/app/src/main/java/com/here/routing/RoutingExample.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,15 @@ private CarOptions getCarOptions() {
391391
carOptions.allowOptions.allowHov = true;
392392
carOptions.allowOptions.allowHot = true;
393393

394+
// In some cities (e.g., Bogotá, Mexico City, Jakarta), the last digit of the
395+
// license plate is used intentionally to control traffic in low-emission zones.
396+
// When you calculate a route, the HERE SDK may avoid roads or areas where entry
397+
// would be restricted based on your individual license plate's last character,
398+
// for example, on certain week days.
399+
// Make sure to update this value to the actual last character of your license
400+
// attached to your vehicle!
401+
carOptions.lastCharacterOfLicensePlate = "7";
402+
394403
// When occupantsNumber is greater than 1, it enables the vehicle to use HOV/HOT lanes.
395404
carOptions.occupantsNumber = 4;
396405

@@ -415,6 +424,7 @@ private void clearWaypointMapMarker() {
415424
}
416425

417426
private void clearRoute() {
427+
this.currentRoute = null;
418428
for (MapPolyline mapPolyline : mapPolylines) {
419429
mapView.getMapScene().removeMapPolyline(mapPolyline);
420430
}

examples/latest/explore/android/TrafficKotlin/app/src/main/java/com/here/traffickotlin/TrafficExample.kt

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,14 @@ class TrafficExample(private val context: Context, private val mapView: MapView)
187187
TAG, "Fetched TrafficIncident from lookup request." +
188188
" Description: " + trafficIncident!!.description.text
189189
)
190-
addTrafficIncidentsMapPolyline(trafficIncident!!.location.polyline)
190+
191+
val incidentLocation = trafficIncident.location
192+
addTrafficIncidentsMapPolyline(incidentLocation.polyline)
193+
194+
// If the polyline contains any gaps, they are available as additionalPolylines in TrafficLocation.
195+
for (additionalPolyLine in incidentLocation.additionalPolylines) {
196+
addTrafficIncidentsMapPolyline(additionalPolyLine!!)
197+
}
191198
} else {
192199
showDialog("TrafficLookupError:", trafficQueryError.toString())
193200
}
@@ -257,13 +264,22 @@ class TrafficExample(private val context: Context, private val mapView: MapView)
257264
var nearestDistance = Double.MAX_VALUE
258265
var nearestTrafficIncident: TrafficIncident? = null
259266
for (trafficIncident in trafficIncidentsList) {
260-
// In case lengthInMeters == 0 then the polyline consistes of two equal coordinates.
267+
val trafficIncidentPolyLines: MutableList<GeoPolyline> = java.util.ArrayList()
268+
269+
// In case lengthInMeters == 0 then the polyline consists of two equal coordinates.
261270
// It is guaranteed that each incident has a valid polyline.
262-
for (geoCoords in trafficIncident.location.polyline.vertices) {
263-
val currentDistance = currentGeoCoords.distanceTo(geoCoords)
264-
if (currentDistance < nearestDistance) {
265-
nearestDistance = currentDistance
266-
nearestTrafficIncident = trafficIncident
271+
trafficIncidentPolyLines.add(trafficIncident.location.polyline)
272+
273+
// If the polyline contains any gaps, they are available as additionalPolylines in TrafficLocation.
274+
trafficIncidentPolyLines.addAll(trafficIncident.location.additionalPolylines)
275+
276+
for (trafficIncidentPolyline in trafficIncidentPolyLines) {
277+
for (geoCoords in trafficIncidentPolyline.vertices) {
278+
val currentDistance = currentGeoCoords.distanceTo(geoCoords)
279+
if (currentDistance < nearestDistance) {
280+
nearestDistance = currentDistance
281+
nearestTrafficIncident = trafficIncident
282+
}
267283
}
268284
}
269285
}

examples/latest/explore/flutter/map_items_app/lib/MapObjectsExample.dart

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,19 @@ class MapObjectsExample {
5050
_mapScene.addMapPolyline(_mapPolyline!);
5151
}
5252

53+
void enableVisibilityRangesForPolyline() {
54+
final visibilityRanges = <MapMeasureRange>[
55+
MapMeasureRange(MapMeasureKind.zoomLevel, 1, 10),
56+
MapMeasureRange(MapMeasureKind.zoomLevel, 11, 22),
57+
];
58+
59+
// Sets the visibility ranges for this map polyline based on zoom levels.
60+
// Each range is half-open: [minimumZoomLevel, maximumZoomLevel),
61+
// meaning the polyline is visible at minimumZoomLevel but not at maximumZoomLevel.
62+
// The polyline is rendered only when the map zoom level falls within any of the defined ranges.
63+
_mapPolyline?.visibilityRanges = visibilityRanges;
64+
}
65+
5366
void showMapArrow() {
5467
clearMap();
5568
// Move map to expected location.

examples/latest/explore/flutter/map_items_app/lib/main.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ class _MyAppState extends State<MyApp> {
137137
_mapObjectsExample?.showMapPolyline();
138138
}
139139

140+
void _enableVisibilityRangesForMapPolyLine(){
141+
_showDialog("Visibility Range","Enabled visibility ranges for MapPolyline.");
142+
_mapObjectsExample?.enableVisibilityRangesForPolyline();
143+
}
144+
140145
void _mapObjectPolygonButtonClicked() {
141146
_mapObjectsExample?.showMapPolygon();
142147
}
@@ -241,6 +246,7 @@ class _MyAppState extends State<MyApp> {
241246
MenuSectionItem("Polygon", _mapObjectPolygonButtonClicked),
242247
MenuSectionItem("Arrow", _mapObjectArrowButtonClicked),
243248
MenuSectionItem("Circle", _mapObjectCircleButtonClicked),
249+
MenuSectionItem("Enable visibility ranges", _enableVisibilityRangesForMapPolyLine),
244250
];
245251

246252
return MenuSectionExpansionTile("MapObject", menuItems);

examples/latest/explore/flutter/routing_app/lib/routing_example.dart

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,15 @@ class RoutingExample {
143143
carOptions.allowOptions.allowHov = true;
144144
carOptions.allowOptions.allowHot = true;
145145

146+
// In some cities (e.g., Bogotá, Mexico City, Jakarta), the last digit of the
147+
// license plate is used intentionally to control traffic in low-emission zones.
148+
// When you calculate a route, the HERE SDK may avoid roads or areas where entry
149+
// would be restricted based on your individual license plate's last character,
150+
// for example, on certain week days.
151+
// Make sure to update this value to the actual last character of your license
152+
// attached to your vehicle!
153+
carOptions.lastCharacterOfLicensePlate = "7";
154+
146155
// When occupantsNumber is greater than 1, it enables the vehicle to use HOV/HOT lanes.
147156
carOptions.occupantsNumber = 4;
148157

@@ -154,7 +163,7 @@ class RoutingExample {
154163

155164
_routingEngine.calculateCarRoute(waypoints, carOptions,
156165
(RoutingError? routingError, List<here.Route>? routeList) async {
157-
if (routingError == null && _currentRoute != null) {
166+
if (routingError == null) {
158167
// When error is null, then the list guaranteed to be not null.
159168
_currentRoute = routeList!.first;
160169
_showRouteDetails(_currentRoute!);
@@ -236,6 +245,7 @@ class RoutingExample {
236245
}
237246

238247
void _clearRoute() {
248+
_currentRoute = null;
239249
for (var mapPolyline in _mapPolylines) {
240250
_hereMapController.mapScene.removeMapPolyline(mapPolyline);
241251
}

examples/latest/explore/flutter/routing_app/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ dependencies:
3333
flutter:
3434
sdk: flutter
3535

36-
intl: ^0.19.0
36+
intl: '>=0.19.0 <0.21.0'
3737

3838
# The following adds the Cupertino Icons font to your application.
3939
# Use with the CupertinoIcons class for iOS style icons.

0 commit comments

Comments
 (0)