diff --git a/README.md b/README.md index da399cbe..077e32bb 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ For an overview of the existing features, please check the _Developer Guide_ for > For now, the _Navigate Edition_ is only available upon request. Please contact your HERE representative to receive access including a set of evaluation credentials. -## List of Available Example Apps (Version 4.16.1.0) +## List of Available Example Apps (Version 4.16.2.0) - **HelloMap**: Shows the classic 'Hello World'. - **HelloMapKotlin**: Shows the classic 'Hello World' using Kotlin language (Android only). diff --git a/examples/latest/README.md b/examples/latest/README.md index a7b48d1f..ec143f08 100644 --- a/examples/latest/README.md +++ b/examples/latest/README.md @@ -1,4 +1,4 @@ -This folder contains the HERE SDK examples apps for version: 4.16.1.0 +This folder contains the HERE SDK examples apps for version: 4.16.2.0 - HERE SDK for Android ([Lite Edition](lite/android/), [Explore Edition](explore/android/), [Navigate Edition](navigate/android/)) - HERE SDK for iOS ([Lite Edition](lite/ios/), [Explore Edition](explore/ios/), [Navigate Edition](navigate/ios/)) diff --git a/examples/latest/explore/android/CameraKeyframeTracks/app/src/main/java/com/here/camerakeyframetracks/RouteCalculator.java b/examples/latest/explore/android/CameraKeyframeTracks/app/src/main/java/com/here/camerakeyframetracks/RouteCalculator.java index 3ce15a5c..d2c39abf 100644 --- a/examples/latest/explore/android/CameraKeyframeTracks/app/src/main/java/com/here/camerakeyframetracks/RouteCalculator.java +++ b/examples/latest/explore/android/CameraKeyframeTracks/app/src/main/java/com/here/camerakeyframetracks/RouteCalculator.java @@ -27,8 +27,11 @@ import com.here.sdk.core.GeoCoordinates; import com.here.sdk.core.GeoPolyline; import com.here.sdk.core.errors.InstantiationErrorException; +import com.here.sdk.mapview.LineCap; +import com.here.sdk.mapview.MapMeasureDependentRenderSize; import com.here.sdk.mapview.MapPolyline; import com.here.sdk.mapview.MapView; +import com.here.sdk.mapview.RenderSize; import com.here.sdk.routing.CarOptions; import com.here.sdk.routing.Route; import com.here.sdk.routing.RoutingEngine; @@ -76,9 +79,18 @@ private void showRouteOnMap(Route route) { // Show route as polyline. GeoPolyline routeGeoPolyline = route.getGeometry(); float widthInPixels = 20; - MapPolyline routeMapPolyline = new MapPolyline(routeGeoPolyline, - widthInPixels, - Color.valueOf(0, 0.56f, 0.54f, 0.63f)); // RGBA + Color polylineColor = Color.valueOf(0, 0.56f, 0.54f, 0.63f); + MapPolyline routeMapPolyline = null; + try { + routeMapPolyline = new MapPolyline(routeGeoPolyline, new MapPolyline.SolidRepresentation( + new MapMeasureDependentRenderSize(RenderSize.Unit.PIXELS, widthInPixels), + polylineColor, + LineCap.ROUND)); + } catch (MapPolyline.Representation.InstantiationException e) { + Log.e("MapPolyline Representation Exception:", e.error.name()); + } catch (MapMeasureDependentRenderSize.InstantiationException e) { + Log.e("MapMeasureDependentRenderSize Exception:", e.error.name()); + } mapView.getMapScene().addMapPolyline(routeMapPolyline); } } diff --git a/examples/latest/explore/android/EVRouting/app/src/main/java/com/here/evrouting/EVRoutingExample.java b/examples/latest/explore/android/EVRouting/app/src/main/java/com/here/evrouting/EVRoutingExample.java index 0be8e0a5..80d95f24 100644 --- a/examples/latest/explore/android/EVRouting/app/src/main/java/com/here/evrouting/EVRoutingExample.java +++ b/examples/latest/explore/android/EVRouting/app/src/main/java/com/here/evrouting/EVRoutingExample.java @@ -32,14 +32,17 @@ import com.here.sdk.core.GeoPolyline; import com.here.sdk.core.LanguageCode; import com.here.sdk.core.errors.InstantiationErrorException; +import com.here.sdk.mapview.LineCap; import com.here.sdk.mapview.MapCamera; import com.here.sdk.mapview.MapImage; import com.here.sdk.mapview.MapImageFactory; import com.here.sdk.mapview.MapMarker; import com.here.sdk.mapview.MapMeasure; +import com.here.sdk.mapview.MapMeasureDependentRenderSize; import com.here.sdk.mapview.MapPolygon; import com.here.sdk.mapview.MapPolyline; import com.here.sdk.mapview.MapView; +import com.here.sdk.mapview.RenderSize; import com.here.sdk.routing.AvoidanceOptions; import com.here.sdk.routing.CalculateIsolineCallback; import com.here.sdk.routing.CalculateRouteCallback; @@ -256,9 +259,18 @@ private void showRouteOnMap(Route route) { // Show route as polyline. GeoPolyline routeGeoPolyline = route.getGeometry(); float widthInPixels = 20; - MapPolyline routeMapPolyline = new MapPolyline(routeGeoPolyline, - widthInPixels, - Color.valueOf(0, 0.56f, 0.54f, 0.63f)); // RGBA + Color polylineColor = Color.valueOf(0, 0.56f, 0.54f, 0.63f); + MapPolyline routeMapPolyline = null; // RGBA + try { + routeMapPolyline = new MapPolyline(routeGeoPolyline, new MapPolyline.SolidRepresentation( + new MapMeasureDependentRenderSize(RenderSize.Unit.PIXELS, widthInPixels), + polylineColor, + LineCap.ROUND)); + } catch (MapPolyline.Representation.InstantiationException e) { + Log.e("MapPolyline Representation Exception:", e.error.name()); + } catch (MapMeasureDependentRenderSize.InstantiationException e) { + Log.e("MapMeasureDependentRenderSize Exception:", e.error.name()); + } mapView.getMapScene().addMapPolyline(routeMapPolyline); mapPolylines.add(routeMapPolyline); diff --git a/examples/latest/explore/android/MapItems/app/src/main/java/com/here/mapitems/MapObjectsExample.java b/examples/latest/explore/android/MapItems/app/src/main/java/com/here/mapitems/MapObjectsExample.java index 068d2921..715c52d4 100644 --- a/examples/latest/explore/android/MapItems/app/src/main/java/com/here/mapitems/MapObjectsExample.java +++ b/examples/latest/explore/android/MapItems/app/src/main/java/com/here/mapitems/MapObjectsExample.java @@ -19,6 +19,8 @@ package com.here.mapitems; +import android.util.Log; + import com.here.sdk.core.Color; import com.here.sdk.core.GeoCircle; import com.here.sdk.core.GeoCoordinates; @@ -26,15 +28,18 @@ import com.here.sdk.core.GeoPolygon; import com.here.sdk.core.GeoPolyline; import com.here.sdk.core.errors.InstantiationErrorException; +import com.here.sdk.mapview.LineCap; import com.here.sdk.mapview.MapArrow; import com.here.sdk.mapview.MapCamera; import com.here.sdk.mapview.MapCameraAnimation; import com.here.sdk.mapview.MapCameraAnimationFactory; import com.here.sdk.mapview.MapMeasure; +import com.here.sdk.mapview.MapMeasureDependentRenderSize; import com.here.sdk.mapview.MapPolygon; import com.here.sdk.mapview.MapPolyline; import com.here.sdk.mapview.MapScene; import com.here.sdk.mapview.MapView; +import com.here.sdk.mapview.RenderSize; import com.here.time.Duration; import java.util.ArrayList; @@ -111,8 +116,18 @@ private MapPolyline createPolyline() { } float widthInPixels = 20; - Color lineColor = Color.valueOf(0, 0.56f, 0.54f, 0.63f); // RGBA - MapPolyline mapPolyline = new MapPolyline(geoPolyline, widthInPixels, lineColor); + Color lineColor = new Color(0, (float) 0.56, (float) 0.54, (float) 0.63); + MapPolyline mapPolyline = null; + try { + mapPolyline = new MapPolyline(geoPolyline, new MapPolyline.SolidRepresentation( + new MapMeasureDependentRenderSize(RenderSize.Unit.PIXELS, widthInPixels), + lineColor, + LineCap.ROUND)); + } catch (MapPolyline.Representation.InstantiationException e) { + Log.e("MapPolyline Representation Exception:", e.error.name()); + } catch (MapMeasureDependentRenderSize.InstantiationException e) { + Log.e("MapMeasureDependentRenderSize Exception:", e.error.name()); + } return mapPolyline; } diff --git a/examples/latest/explore/android/PublicTransit/app/src/main/java/com/here/routing/PublicTransportRoutingExample.java b/examples/latest/explore/android/PublicTransit/app/src/main/java/com/here/routing/PublicTransportRoutingExample.java index 3668339c..521cee5c 100644 --- a/examples/latest/explore/android/PublicTransit/app/src/main/java/com/here/routing/PublicTransportRoutingExample.java +++ b/examples/latest/explore/android/PublicTransit/app/src/main/java/com/here/routing/PublicTransportRoutingExample.java @@ -30,13 +30,16 @@ import com.here.sdk.core.GeoPolyline; import com.here.sdk.core.Point2D; import com.here.sdk.core.errors.InstantiationErrorException; +import com.here.sdk.mapview.LineCap; import com.here.sdk.mapview.MapCamera; import com.here.sdk.mapview.MapImage; import com.here.sdk.mapview.MapImageFactory; import com.here.sdk.mapview.MapMarker; import com.here.sdk.mapview.MapMeasure; +import com.here.sdk.mapview.MapMeasureDependentRenderSize; import com.here.sdk.mapview.MapPolyline; import com.here.sdk.mapview.MapView; +import com.here.sdk.mapview.RenderSize; import com.here.sdk.routing.CalculateRouteCallback; import com.here.sdk.routing.Maneuver; import com.here.sdk.routing.ManeuverAction; @@ -145,10 +148,18 @@ private void showRouteOnMap(Route route) { // Show route as polyline. GeoPolyline routeGeoPolyline = route.getGeometry(); float widthInPixels = 20; - MapPolyline routeMapPolyline = new MapPolyline(routeGeoPolyline, - widthInPixels, - Color.valueOf(0, 0.56f, 0.54f, 0.63f)); // RGBA - + Color polylineColor = Color.valueOf(0, 0.56f, 0.54f, 0.63f); + MapPolyline routeMapPolyline = null; + try { + routeMapPolyline = new MapPolyline(routeGeoPolyline, new MapPolyline.SolidRepresentation( + new MapMeasureDependentRenderSize(RenderSize.Unit.PIXELS, widthInPixels), + polylineColor, + LineCap.ROUND)); + } catch (MapPolyline.Representation.InstantiationException e) { + Log.e("MapPolyline Representation Exception:", e.error.name()); + } catch (MapMeasureDependentRenderSize.InstantiationException e) { + Log.e("MapMeasureDependentRenderSize Exception:", e.error.name()); + } mapView.getMapScene().addMapPolyline(routeMapPolyline); mapPolylines.add(routeMapPolyline); diff --git a/examples/latest/explore/android/Routing/app/src/main/java/com/here/routing/RoutingExample.java b/examples/latest/explore/android/Routing/app/src/main/java/com/here/routing/RoutingExample.java index c26bccf3..2576e76e 100644 --- a/examples/latest/explore/android/Routing/app/src/main/java/com/here/routing/RoutingExample.java +++ b/examples/latest/explore/android/Routing/app/src/main/java/com/here/routing/RoutingExample.java @@ -30,13 +30,16 @@ import com.here.sdk.core.GeoPolyline; import com.here.sdk.core.Point2D; import com.here.sdk.core.errors.InstantiationErrorException; +import com.here.sdk.mapview.LineCap; import com.here.sdk.mapview.MapCamera; import com.here.sdk.mapview.MapImage; import com.here.sdk.mapview.MapImageFactory; import com.here.sdk.mapview.MapMarker; import com.here.sdk.mapview.MapMeasure; +import com.here.sdk.mapview.MapMeasureDependentRenderSize; import com.here.sdk.mapview.MapPolyline; import com.here.sdk.mapview.MapView; +import com.here.sdk.mapview.RenderSize; import com.here.sdk.routing.CalculateRouteCallback; import com.here.sdk.routing.CarOptions; import com.here.sdk.routing.Maneuver; @@ -206,9 +209,19 @@ private void showRouteOnMap(Route route) { // Show route as polyline. GeoPolyline routeGeoPolyline = route.getGeometry(); float widthInPixels = 20; - MapPolyline routeMapPolyline = new MapPolyline(routeGeoPolyline, - widthInPixels, - Color.valueOf(0, 0.56f, 0.54f, 0.63f)); // RGBA + Color polylineColor = new Color(0, (float) 0.56, (float) 0.54, (float) 0.63); + MapPolyline routeMapPolyline = null; + + try { + routeMapPolyline = new MapPolyline(routeGeoPolyline, new MapPolyline.SolidRepresentation( + new MapMeasureDependentRenderSize(RenderSize.Unit.PIXELS, widthInPixels), + polylineColor, + LineCap.ROUND)); + } catch (MapPolyline.Representation.InstantiationException e) { + Log.e("MapPolyline Representation Exception:", e.error.name()); + } catch (MapMeasureDependentRenderSize.InstantiationException e) { + Log.e("MapMeasureDependentRenderSize Exception:", e.error.name()); + } mapView.getMapScene().addMapPolyline(routeMapPolyline); mapPolylines.add(routeMapPolyline); @@ -314,7 +327,18 @@ private void showTrafficOnRoute(Route route) { continue; } float widthInPixels = 10; - MapPolyline trafficSpanMapPolyline = new MapPolyline(span.getGeometry(), widthInPixels, lineColor); + MapPolyline trafficSpanMapPolyline = null; + try { + trafficSpanMapPolyline = new MapPolyline(span.getGeometry(), new MapPolyline.SolidRepresentation( + new MapMeasureDependentRenderSize(RenderSize.Unit.PIXELS, widthInPixels), + lineColor, + LineCap.ROUND)); + } catch (MapPolyline.Representation.InstantiationException e) { + Log.e("MapPolyline Representation Exception:", e.error.name()); + } catch (MapMeasureDependentRenderSize.InstantiationException e) { + Log.e("MapMeasureDependentRenderSize Exception:", e.error.name()); + } + mapView.getMapScene().addMapPolyline(trafficSpanMapPolyline); mapPolylines.add(trafficSpanMapPolyline); } diff --git a/examples/latest/explore/android/Traffic/app/src/main/java/com/here/traffic/TrafficExample.java b/examples/latest/explore/android/Traffic/app/src/main/java/com/here/traffic/TrafficExample.java index e53ca302..0aa75cb4 100644 --- a/examples/latest/explore/android/Traffic/app/src/main/java/com/here/traffic/TrafficExample.java +++ b/examples/latest/explore/android/Traffic/app/src/main/java/com/here/traffic/TrafficExample.java @@ -33,14 +33,17 @@ import com.here.sdk.core.Rectangle2D; import com.here.sdk.core.Size2D; import com.here.sdk.core.errors.InstantiationErrorException; +import com.here.sdk.mapview.LineCap; import com.here.sdk.mapview.MapCamera; import com.here.sdk.mapview.MapFeatureModes; import com.here.sdk.mapview.MapFeatures; import com.here.sdk.mapview.MapMeasure; +import com.here.sdk.mapview.MapMeasureDependentRenderSize; import com.here.sdk.mapview.MapPolyline; import com.here.sdk.mapview.MapView; import com.here.sdk.mapview.MapViewBase; import com.here.sdk.mapview.PickMapContentResult; +import com.here.sdk.mapview.RenderSize; import com.here.sdk.traffic.TrafficEngine; import com.here.sdk.traffic.TrafficIncident; import com.here.sdk.traffic.TrafficIncidentLookupCallback; @@ -182,9 +185,18 @@ public void onTrafficIncidentFetched(@Nullable TrafficQueryError trafficQueryErr private void addTrafficIncidentsMapPolyline(GeoPolyline geoPolyline) { // Show traffic incident as polyline. float widthInPixels = 20; - MapPolyline routeMapPolyline = new MapPolyline(geoPolyline, - widthInPixels, - Color.valueOf(0, 0, 0, 0.5f)); // RGBA + Color polylineColor = Color.valueOf(0, 0, 0, 0.5f); + MapPolyline routeMapPolyline = null; + try { + routeMapPolyline = new MapPolyline(geoPolyline, new MapPolyline.SolidRepresentation( + new MapMeasureDependentRenderSize(RenderSize.Unit.PIXELS, widthInPixels), + polylineColor, + LineCap.ROUND)); + } catch (MapPolyline.Representation.InstantiationException e) { + Log.e("MapPolyline Representation Exception:", e.error.name()); + } catch (MapMeasureDependentRenderSize.InstantiationException e) { + Log.e("MapMeasureDependentRenderSize Exception:", e.error.name()); + } mapView.getMapScene().addMapPolyline(routeMapPolyline); mapPolylines.add(routeMapPolyline); diff --git a/examples/latest/explore/flutter/camera_app/lib/main.dart b/examples/latest/explore/flutter/camera_app/lib/main.dart index 0bc62675..76e66fb5 100644 --- a/examples/latest/explore/flutter/camera_app/lib/main.dart +++ b/examples/latest/explore/flutter/camera_app/lib/main.dart @@ -109,8 +109,8 @@ class _MyAppState extends State with TickerProviderStateMixin { alignment: Alignment.topCenter, child: ElevatedButton( style: ElevatedButton.styleFrom( - primary: Colors.lightBlueAccent, - onPrimary: Colors.white, + foregroundColor: Colors.white, + backgroundColor: Colors.lightBlueAccent, ), onPressed: () => callbackFunction(), child: Text(buttonLabel, style: TextStyle(fontSize: 20)), diff --git a/examples/latest/explore/flutter/camera_keyframe_tracks_app/lib/helper/RouteCalculator.dart b/examples/latest/explore/flutter/camera_keyframe_tracks_app/lib/helper/RouteCalculator.dart index 0b041afc..93de6e39 100644 --- a/examples/latest/explore/flutter/camera_keyframe_tracks_app/lib/helper/RouteCalculator.dart +++ b/examples/latest/explore/flutter/camera_keyframe_tracks_app/lib/helper/RouteCalculator.dart @@ -56,9 +56,12 @@ class RouteCalculator { void _showRouteOnMap(routes.Route route) { // Show route as polyline. GeoPolyline routeGeoPolyline = route.geometry; - double widthInPixels = 20; - MapPolyline routeMapPolyline = - MapPolyline(routeGeoPolyline, widthInPixels, const Color.fromARGB(160, 0, 144, 138)); // RGBA + double widthInPixels = 20.0; + Color polylineColor = const Color.fromARGB(160, 0, 144, 138); + MapPolyline routeMapPolyline = MapPolyline.withRepresentation(routeGeoPolyline, MapPolylineSolidRepresentation( + MapMeasureDependentRenderSize.withSingleSize(RenderSizeUnit.pixels, widthInPixels), + polylineColor, + LineCap.round)); _hereMapController.mapScene.addMapPolyline(routeMapPolyline); } } diff --git a/examples/latest/explore/flutter/ev_routing_app/lib/EVRoutingExample.dart b/examples/latest/explore/flutter/ev_routing_app/lib/EVRoutingExample.dart index 3326291b..dbabed49 100644 --- a/examples/latest/explore/flutter/ev_routing_app/lib/EVRoutingExample.dart +++ b/examples/latest/explore/flutter/ev_routing_app/lib/EVRoutingExample.dart @@ -339,7 +339,13 @@ class EVRoutingExample { // Show route as polyline. GeoPolyline routeGeoPolyline = route.geometry; double widthInPixels = 20; - MapPolyline routeMapPolyline = MapPolyline(routeGeoPolyline, widthInPixels, Color.fromARGB(160, 0, 144, 138)); + Color polylineColor = const Color.fromARGB(160, 0, 144, 138); + MapPolyline routeMapPolyline = MapPolyline.withRepresentation( + routeGeoPolyline, + MapPolylineSolidRepresentation( + MapMeasureDependentRenderSize.withSingleSize(RenderSizeUnit.pixels, widthInPixels), + polylineColor, + LineCap.round)); _hereMapController.mapScene.addMapPolyline(routeMapPolyline); _mapPolylines.add(routeMapPolyline); diff --git a/examples/latest/explore/flutter/ev_routing_app/lib/main.dart b/examples/latest/explore/flutter/ev_routing_app/lib/main.dart index d09f2082..7ae7295d 100644 --- a/examples/latest/explore/flutter/ev_routing_app/lib/main.dart +++ b/examples/latest/explore/flutter/ev_routing_app/lib/main.dart @@ -115,8 +115,8 @@ class _EVRoutingAppState extends State { alignment: Alignment.topCenter, child: ElevatedButton( style: ElevatedButton.styleFrom( - primary: Colors.lightBlueAccent, - onPrimary: Colors.white, + foregroundColor: Colors.white, + backgroundColor: Colors.lightBlueAccent, ), onPressed: () => callbackFunction(), child: Text(buttonLabel, style: TextStyle(fontSize: 20)), diff --git a/examples/latest/explore/flutter/map_items_app/lib/MapObjectsExample.dart b/examples/latest/explore/flutter/map_items_app/lib/MapObjectsExample.dart index bf40fb6b..77d6ab24 100644 --- a/examples/latest/explore/flutter/map_items_app/lib/MapObjectsExample.dart +++ b/examples/latest/explore/flutter/map_items_app/lib/MapObjectsExample.dart @@ -112,7 +112,12 @@ class MapObjectsExample { double widthInPixels = 20; Color lineColor = Color.fromARGB(160, 0, 144, 138); - MapPolyline mapPolyline = MapPolyline(geoPolyline, widthInPixels, lineColor); + MapPolyline mapPolyline = MapPolyline.withRepresentation( + geoPolyline, + MapPolylineSolidRepresentation( + MapMeasureDependentRenderSize.withSingleSize(RenderSizeUnit.pixels, widthInPixels), + lineColor, + LineCap.round)); return mapPolyline; } diff --git a/examples/latest/explore/flutter/map_items_app/lib/main.dart b/examples/latest/explore/flutter/map_items_app/lib/main.dart index 9bb00c57..1da9cfb4 100644 --- a/examples/latest/explore/flutter/map_items_app/lib/main.dart +++ b/examples/latest/explore/flutter/map_items_app/lib/main.dart @@ -273,8 +273,8 @@ class _MyAppState extends State { alignment: Alignment.topCenter, child: ElevatedButton( style: ElevatedButton.styleFrom( - primary: Colors.lightBlueAccent, - onPrimary: Colors.white, + foregroundColor: Colors.white, + backgroundColor: Colors.lightBlueAccent, ), onPressed: () => callbackFunction(), child: Text(buttonLabel, style: TextStyle(fontSize: 20)), diff --git a/examples/latest/explore/flutter/public_transit_app/lib/PublicTransportRoutingExample.dart b/examples/latest/explore/flutter/public_transit_app/lib/PublicTransportRoutingExample.dart index 3e62e9df..fddc2bc1 100644 --- a/examples/latest/explore/flutter/public_transit_app/lib/PublicTransportRoutingExample.dart +++ b/examples/latest/explore/flutter/public_transit_app/lib/PublicTransportRoutingExample.dart @@ -135,7 +135,13 @@ class PublicTransportRoutingExample { // Show route as polyline. GeoPolyline routeGeoPolyline = route.geometry; double widthInPixels = 20; - MapPolyline routeMapPolyline = MapPolyline(routeGeoPolyline, widthInPixels, Color.fromARGB(160, 0, 144, 138)); + Color polylineColor = const Color.fromARGB(160, 0, 144, 138); + MapPolyline routeMapPolyline = MapPolyline.withRepresentation( + routeGeoPolyline, + MapPolylineSolidRepresentation( + MapMeasureDependentRenderSize.withSingleSize(RenderSizeUnit.pixels, widthInPixels), + polylineColor, + LineCap.round)); _hereMapController.mapScene.addMapPolyline(routeMapPolyline); _mapPolylines.add(routeMapPolyline); } @@ -172,13 +178,13 @@ class PublicTransportRoutingExample { double tilt = 0; // We want to show the route fitting in the map view with an additional padding of 50 pixels. Point2D origin = Point2D(50, 50); - Size2D sizeInPixels = Size2D(_hereMapController.viewportSize.width - 100, _hereMapController.viewportSize.height - 100); + Size2D sizeInPixels = + Size2D(_hereMapController.viewportSize.width - 100, _hereMapController.viewportSize.height - 100); Rectangle2D mapViewport = Rectangle2D(origin, sizeInPixels); // Animate to the route within a duration of 3 seconds. - MapCameraUpdate update = MapCameraUpdateFactory.lookAtAreaWithGeoOrientationAndViewRectangle(route!.boundingBox, - GeoOrientationUpdate(bearing, tilt), - mapViewport); + MapCameraUpdate update = MapCameraUpdateFactory.lookAtAreaWithGeoOrientationAndViewRectangle( + route!.boundingBox, GeoOrientationUpdate(bearing, tilt), mapViewport); MapCameraAnimation animation = MapCameraAnimationFactory.createAnimationFromUpdate( update, const Duration(milliseconds: 3000), EasingFunction.inCubic); _hereMapController.camera.startAnimation(animation); diff --git a/examples/latest/explore/flutter/public_transit_app/lib/main.dart b/examples/latest/explore/flutter/public_transit_app/lib/main.dart index 057713d8..1723c840 100644 --- a/examples/latest/explore/flutter/public_transit_app/lib/main.dart +++ b/examples/latest/explore/flutter/public_transit_app/lib/main.dart @@ -110,8 +110,8 @@ class _MyAppState extends State { alignment: Alignment.topCenter, child: ElevatedButton( style: ElevatedButton.styleFrom( - primary: Colors.lightBlueAccent, - onPrimary: Colors.white, + foregroundColor: Colors.white, + backgroundColor: Colors.lightBlueAccent, ), onPressed: () => callbackFunction(), child: Text(buttonLabel, style: TextStyle(fontSize: 20)), diff --git a/examples/latest/explore/flutter/routing_app/lib/RoutingExample.dart b/examples/latest/explore/flutter/routing_app/lib/RoutingExample.dart index 7f76ccb0..e1ea75c9 100644 --- a/examples/latest/explore/flutter/routing_app/lib/RoutingExample.dart +++ b/examples/latest/explore/flutter/routing_app/lib/RoutingExample.dart @@ -173,7 +173,13 @@ class RoutingExample { // Show route as polyline. GeoPolyline routeGeoPolyline = route.geometry; double widthInPixels = 20; - MapPolyline routeMapPolyline = MapPolyline(routeGeoPolyline, widthInPixels, Color.fromARGB(160, 0, 144, 138)); + Color polylineColor = const Color.fromARGB(160, 0, 144, 138); + MapPolyline routeMapPolyline = MapPolyline.withRepresentation( + routeGeoPolyline, + MapPolylineSolidRepresentation( + MapMeasureDependentRenderSize.withSingleSize(RenderSizeUnit.pixels, widthInPixels), + polylineColor, + LineCap.round)); _hereMapController.mapScene.addMapPolyline(routeMapPolyline); _mapPolylines.add(routeMapPolyline); @@ -197,7 +203,13 @@ class RoutingExample { continue; } double widthInPixels = 10; - MapPolyline trafficSpanMapPolyline = new MapPolyline(span.geometry, widthInPixels, lineColor); + MapPolyline trafficSpanMapPolyline = new MapPolyline.withRepresentation( + span.geometry, + MapPolylineSolidRepresentation( + MapMeasureDependentRenderSize.withSingleSize(RenderSizeUnit.pixels, widthInPixels), + lineColor, + LineCap.round)); + _hereMapController.mapScene.addMapPolyline(trafficSpanMapPolyline); _mapPolylines.add(trafficSpanMapPolyline); } diff --git a/examples/latest/explore/flutter/routing_app/lib/main.dart b/examples/latest/explore/flutter/routing_app/lib/main.dart index fa593fb7..c77b687c 100644 --- a/examples/latest/explore/flutter/routing_app/lib/main.dart +++ b/examples/latest/explore/flutter/routing_app/lib/main.dart @@ -110,8 +110,8 @@ class _MyAppState extends State { alignment: Alignment.topCenter, child: ElevatedButton( style: ElevatedButton.styleFrom( - primary: Colors.lightBlueAccent, - onPrimary: Colors.white, + foregroundColor: Colors.white, + backgroundColor: Colors.lightBlueAccent, ), onPressed: () => callbackFunction(), child: Text(buttonLabel, style: TextStyle(fontSize: 20)), diff --git a/examples/latest/explore/flutter/traffic_app/lib/TrafficExample.dart b/examples/latest/explore/flutter/traffic_app/lib/TrafficExample.dart index fdd2b9e1..4e069f63 100644 --- a/examples/latest/explore/flutter/traffic_app/lib/TrafficExample.dart +++ b/examples/latest/explore/flutter/traffic_app/lib/TrafficExample.dart @@ -80,14 +80,14 @@ class TrafficExample { void _setTapGestureHandler() { _hereMapController.gestures.tapListener = TapListener((Point2D touchPoint) { - GeoCoordinates? touchGeoCoords = _hereMapController.viewToGeoCoordinates(touchPoint); + GeoCoordinates? touchGeoCoordinates = _hereMapController.viewToGeoCoordinates(touchPoint); // Can be null when the map was tilted and the sky was tapped. - if (touchGeoCoords != null) { + if (touchGeoCoordinates != null) { // Pick incidents that are shown in MapSceneLayers.trafficIncidents. _pickTrafficIncident(touchPoint); // Query for incidents independent of MapSceneLayers.trafficIncidents. - _queryForIncidents(touchGeoCoords); + _queryForIncidents(touchGeoCoordinates); } }); } @@ -125,8 +125,7 @@ class TrafficExample { // Optionally, specify a language: // the language of the country where the incident occurs is used. // trafficIncidentsLookupOptions.languageCode = LanguageCode.EN_US; - _trafficEngine.lookupIncident(originalId, trafficIncidentsLookupOptions, - (trafficQueryError, trafficIncident) { + _trafficEngine.lookupIncident(originalId, trafficIncidentsLookupOptions, (trafficQueryError, trafficIncident) { if (trafficQueryError == null) { print("Fetched TrafficIncident from lookup request." + " Description: " + trafficIncident!.description.text); _addTrafficIncidentsMapPolyline(trafficIncident.location.polyline); @@ -139,15 +138,21 @@ class TrafficExample { void _addTrafficIncidentsMapPolyline(GeoPolyline geoPolyline) { // Show traffic incident as polyline. double widthInPixels = 20; - MapPolyline routeMapPolyline = MapPolyline(geoPolyline, widthInPixels, Color.fromARGB(120, 0, 0, 0)); + Color polylineColor = const Color.fromARGB(120, 0, 0, 0); + MapPolyline routeMapPolyline = MapPolyline.withRepresentation( + geoPolyline, + MapPolylineSolidRepresentation( + MapMeasureDependentRenderSize.withSingleSize(RenderSizeUnit.pixels, widthInPixels), + polylineColor, + LineCap.round)); _hereMapController.mapScene.addMapPolyline(routeMapPolyline); _mapPolylineList.add(routeMapPolyline); } - void _queryForIncidents(GeoCoordinates centerCoords) { + void _queryForIncidents(GeoCoordinates centerCoordinates) { double radiusInMeters = 1000; - GeoCircle geoCircle = GeoCircle(centerCoords, radiusInMeters); + GeoCircle geoCircle = GeoCircle(centerCoordinates, radiusInMeters); TrafficIncidentsQueryOptions trafficIncidentsQueryOptions = TrafficIncidentsQueryOptions(); // Optionally, specify a language: // the language of the country where the incident occurs is used. @@ -161,7 +166,7 @@ class TrafficExample { // If error is null, list is guaranteed to be not empty. String trafficMessage = "Found ${trafficIncidentsList!.length} result(s)."; - TrafficIncident? nearestIncident = _getNearestTrafficIncident(centerCoords, trafficIncidentsList); + TrafficIncident? nearestIncident = _getNearestTrafficIncident(centerCoordinates, trafficIncidentsList); if (nearestIncident != null) { trafficMessage += " Nearest incident: " + nearestIncident.description.text; } @@ -175,7 +180,7 @@ class TrafficExample { } TrafficIncident? _getNearestTrafficIncident( - GeoCoordinates currentGeoCoords, List trafficIncidentsList) { + GeoCoordinates currentGeoCoordinates, List trafficIncidentsList) { if (trafficIncidentsList.length == 0) { return null; } @@ -184,10 +189,10 @@ class TrafficExample { double nearestDistance = double.maxFinite; TrafficIncident? nearestTrafficIncident; for (TrafficIncident trafficIncident in trafficIncidentsList) { - // In case lengthInMeters == 0 then the polyline consistes of two equal coordinates. + // In case lengthInMeters == 0 then the polyline consists of two equal coordinates. // It is guaranteed that each incident has a valid polyline. - for (GeoCoordinates geoCoords in trafficIncident.location.polyline.vertices) { - double currentDistance = currentGeoCoords.distanceTo(geoCoords); + for (GeoCoordinates geoCoordinates in trafficIncident.location.polyline.vertices) { + double currentDistance = currentGeoCoordinates.distanceTo(geoCoordinates); if (currentDistance < nearestDistance) { nearestDistance = currentDistance; nearestTrafficIncident = trafficIncident; diff --git a/examples/latest/explore/flutter/traffic_app/lib/main.dart b/examples/latest/explore/flutter/traffic_app/lib/main.dart index da858253..c1c6c79a 100644 --- a/examples/latest/explore/flutter/traffic_app/lib/main.dart +++ b/examples/latest/explore/flutter/traffic_app/lib/main.dart @@ -111,8 +111,8 @@ class _MyAppState extends State { alignment: Alignment.topCenter, child: ElevatedButton( style: ElevatedButton.styleFrom( - primary: Colors.lightBlueAccent, - onPrimary: Colors.white, + foregroundColor: Colors.white, + backgroundColor: Colors.lightBlueAccent, ), onPressed: () => callbackFunction(), child: Text(buttonLabel, style: TextStyle(fontSize: 20)), diff --git a/examples/latest/explore/ios/CameraKeyframeTracks/CameraKeyframeTracks/RouteCalculator.swift b/examples/latest/explore/ios/CameraKeyframeTracks/CameraKeyframeTracks/RouteCalculator.swift index 1e4d121d..035fd580 100644 --- a/examples/latest/explore/ios/CameraKeyframeTracks/CameraKeyframeTracks/RouteCalculator.swift +++ b/examples/latest/explore/ios/CameraKeyframeTracks/CameraKeyframeTracks/RouteCalculator.swift @@ -58,12 +58,20 @@ public class RouteCalculator { private func showRouteOnMap(route: Route) { // Show route as polyline. let routeGeoPolyline = route.geometry - let routeMapPolyline = MapPolyline(geometry: routeGeoPolyline, - widthInPixels: 20, - color: UIColor(red: 0, - green: 0.56, - blue: 0.54, - alpha: 0.63)) - mapView.mapScene.addMapPolyline(routeMapPolyline) + let widthInPixels = 20.0 + let polylineColor = UIColor(red: 0, green: 0.56, blue: 0.54, alpha: 0.63) + do { + let routeMapPolyline = try MapPolyline(geometry: routeGeoPolyline, + representation: MapPolyline.SolidRepresentation( + lineWidth: MapMeasureDependentRenderSize( + sizeUnit: RenderSize.Unit.pixels, + size: widthInPixels), + color: polylineColor, + capShape: LineCap.round)) + + mapView.mapScene.addMapPolyline(routeMapPolyline) + } catch let error { + fatalError("Failed to render MapPolyline. Cause: \(error)") + } } } diff --git a/examples/latest/explore/ios/EVRouting/EVRouting/RoutingExample.swift b/examples/latest/explore/ios/EVRouting/EVRouting/RoutingExample.swift index 61d951f9..dd29dfba 100644 --- a/examples/latest/explore/ios/EVRouting/EVRouting/RoutingExample.swift +++ b/examples/latest/explore/ios/EVRouting/EVRouting/RoutingExample.swift @@ -190,14 +190,22 @@ class RoutingExample { // Show route as polyline. let routeGeoPolyline = route.geometry - let routeMapPolyline = MapPolyline(geometry: routeGeoPolyline, - widthInPixels: 20, - color: UIColor(red: 0, - green: 0.56, - blue: 0.54, - alpha: 0.63)) - mapView.mapScene.addMapPolyline(routeMapPolyline) - mapPolylineList.append(routeMapPolyline) + let widthInPixels = 20.0 + let polylineColor = UIColor(red: 0, green: 0.56, blue: 0.54, alpha: 0.63) + do { + let routeMapPolyline = try MapPolyline(geometry: routeGeoPolyline, + representation: MapPolyline.SolidRepresentation( + lineWidth: MapMeasureDependentRenderSize( + sizeUnit: RenderSize.Unit.pixels, + size: widthInPixels), + color: polylineColor, + capShape: LineCap.round)) + + mapView.mapScene.addMapPolyline(routeMapPolyline) + mapPolylineList.append(routeMapPolyline) + } catch let error { + fatalError("Failed to render MapPolyline. Cause: \(error)") + } let startPoint = route.sections.first!.departurePlace.mapMatchedCoordinates let destination = route.sections.last!.arrivalPlace.mapMatchedCoordinates diff --git a/examples/latest/explore/ios/MapItems/MapItems/MapObjectsExample.swift b/examples/latest/explore/ios/MapItems/MapItems/MapObjectsExample.swift index 9557b9cb..c9973749 100644 --- a/examples/latest/explore/ios/MapItems/MapItems/MapObjectsExample.swift +++ b/examples/latest/explore/ios/MapItems/MapItems/MapObjectsExample.swift @@ -91,10 +91,20 @@ class MapObjectsExample { // We are sure that the number of vertices is greater than two, so it will not crash. let geoPolyline = try! GeoPolyline(vertices: coordinates) let lineColor = UIColor(red: 0, green: 0.56, blue: 0.54, alpha: 0.63) - let mapPolyline = MapPolyline(geometry: geoPolyline, - widthInPixels: 30, - color: lineColor) - return mapPolyline + let widthInPixels = 30.0 + do { + let mapPolyline = try MapPolyline(geometry: geoPolyline, + representation: MapPolyline.SolidRepresentation( + lineWidth: MapMeasureDependentRenderSize( + sizeUnit: RenderSize.Unit.pixels, + size: widthInPixels), + color: lineColor, + capShape: LineCap.round)) + + return mapPolyline + } catch let error { + fatalError("Failed to render MapPolyline. Cause: \(error)") + } } private func createMapPolygon() -> MapPolygon { diff --git a/examples/latest/explore/ios/PublicTransit/PublicTransit/PublicTransportRoutingExample.swift b/examples/latest/explore/ios/PublicTransit/PublicTransit/PublicTransportRoutingExample.swift index e10d67e5..cbae9315 100644 --- a/examples/latest/explore/ios/PublicTransit/PublicTransit/PublicTransportRoutingExample.swift +++ b/examples/latest/explore/ios/PublicTransit/PublicTransit/PublicTransportRoutingExample.swift @@ -111,14 +111,22 @@ class PublicTranportRoutingExample { // Show route as polyline. let routeGeoPolyline = route.geometry - let routeMapPolyline = MapPolyline(geometry: routeGeoPolyline, - widthInPixels: 20, - color: UIColor(red: 0, - green: 0.56, - blue: 0.54, - alpha: 0.63)) - mapView.mapScene.addMapPolyline(routeMapPolyline) - mapPolylineList.append(routeMapPolyline) + let widthInPixels = 20.0 + let polylineColor = UIColor(red: 0, green: 0.56, blue: 0.54, alpha: 0.63) + do { + let routeMapPolyline = try MapPolyline(geometry: routeGeoPolyline, + representation: MapPolyline.SolidRepresentation( + lineWidth: MapMeasureDependentRenderSize( + sizeUnit: RenderSize.Unit.pixels, + size: widthInPixels), + color: polylineColor, + capShape: LineCap.round)) + + mapView.mapScene.addMapPolyline(routeMapPolyline) + mapPolylineList.append(routeMapPolyline) + } catch let error { + fatalError("Failed to render MapPolyline. Cause: \(error)") + } let startPoint = route.sections.first!.departurePlace.mapMatchedCoordinates let destination = route.sections.last!.arrivalPlace.mapMatchedCoordinates diff --git a/examples/latest/explore/ios/Routing/Routing/RoutingExample.swift b/examples/latest/explore/ios/Routing/Routing/RoutingExample.swift index 5775ed5d..36d81269 100644 --- a/examples/latest/explore/ios/Routing/Routing/RoutingExample.swift +++ b/examples/latest/explore/ios/Routing/Routing/RoutingExample.swift @@ -155,14 +155,22 @@ class RoutingExample { // Show route as polyline. let routeGeoPolyline = route.geometry - let routeMapPolyline = MapPolyline(geometry: routeGeoPolyline, - widthInPixels: 20, - color: UIColor(red: 0, - green: 0.56, - blue: 0.54, - alpha: 0.63)) - mapView.mapScene.addMapPolyline(routeMapPolyline) - mapPolylineList.append(routeMapPolyline) + let widthInPixels = 20.0 + let polylineColor = UIColor(red: 0, green: 0.56, blue: 0.54, alpha: 0.63) + do { + let routeMapPolyline = try MapPolyline(geometry: routeGeoPolyline, + representation: MapPolyline.SolidRepresentation( + lineWidth: MapMeasureDependentRenderSize( + sizeUnit: RenderSize.Unit.pixels, + size: widthInPixels), + color: polylineColor, + capShape: LineCap.round)) + + mapView.mapScene.addMapPolyline(routeMapPolyline) + mapPolylineList.append(routeMapPolyline) + } catch let error { + fatalError("Failed to render MapPolyline. Cause: \(error)") + } // Optionally, render traffic on route. showTrafficOnRoute(route) @@ -233,10 +241,10 @@ class RoutingExample { // This renders the traffic jam factor on top of the route as multiple MapPolylines per span. private func showTrafficOnRoute(_ route: Route) { if route.lengthInMeters / 1000 > 5000 { - print("Skip showing traffic-on-route for longer routes."); - return + print("Skip showing traffic-on-route for longer routes."); + return } - + for section in route.sections { for span in section.spans { let trafficSpeed = span.trafficSpeed @@ -244,13 +252,24 @@ class RoutingExample { // Skip rendering low traffic. continue } - let trafficSpanMapPolyline = MapPolyline(geometry: span.geometry, - widthInPixels: 10, - color: lineColor) - mapView.mapScene.addMapPolyline(trafficSpanMapPolyline) - mapPolylineList.append(trafficSpanMapPolyline) + let widthInPixels = 10.0 + let polylineColor = UIColor(red: 0, green: 0.56, blue: 0.54, alpha: 0.63) + do { + let trafficSpanMapPolyline = try MapPolyline(geometry: span.geometry, + representation: MapPolyline.SolidRepresentation( + lineWidth: MapMeasureDependentRenderSize( + sizeUnit: RenderSize.Unit.pixels, + size: widthInPixels), + color: polylineColor, + capShape: LineCap.round)) + + mapView.mapScene.addMapPolyline(trafficSpanMapPolyline) + mapPolylineList.append(trafficSpanMapPolyline) + } catch let error { + fatalError("Failed to render MapPolyline. Cause: \(error)") + } + } } - } } // Define a traffic color scheme based on the route's jam factor. diff --git a/examples/latest/explore/ios/Traffic/Traffic/TrafficExample.swift b/examples/latest/explore/ios/Traffic/Traffic/TrafficExample.swift index e663ab7b..a5757102 100644 --- a/examples/latest/explore/ios/Traffic/Traffic/TrafficExample.swift +++ b/examples/latest/explore/ios/Traffic/Traffic/TrafficExample.swift @@ -141,14 +141,22 @@ class TrafficExample: TapDelegate { private func addTrafficIncidentsMapPolyline(geoPolyline: GeoPolyline) { // Show traffic incident as polyline. - let mapPolyline = MapPolyline(geometry: geoPolyline, - widthInPixels: 20, - color: UIColor(red: 0, - green: 0, - blue: 0, - alpha: 0.5)) - mapView.mapScene.addMapPolyline(mapPolyline) - mapPolylineList.append(mapPolyline) + let widthInPixels = 20.0 + let polylineColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.5) + do { + let mapPolyline = try MapPolyline(geometry: geoPolyline, + representation: MapPolyline.SolidRepresentation( + lineWidth: MapMeasureDependentRenderSize( + sizeUnit: RenderSize.Unit.pixels, + size: widthInPixels), + color: polylineColor, + capShape: LineCap.round)) + + mapView.mapScene.addMapPolyline(mapPolyline) + mapPolylineList.append(mapPolyline) + } catch let error { + fatalError("Failed to render MapPolyline. Cause: \(error)") + } } private func queryForIncidents(centerCoords: GeoCoordinates) { diff --git a/examples/latest/navigate/android/CameraKeyframeTracks/app/src/main/java/com/here/camerakeyframetracks/RouteCalculator.java b/examples/latest/navigate/android/CameraKeyframeTracks/app/src/main/java/com/here/camerakeyframetracks/RouteCalculator.java index 3ce15a5c..d2c39abf 100644 --- a/examples/latest/navigate/android/CameraKeyframeTracks/app/src/main/java/com/here/camerakeyframetracks/RouteCalculator.java +++ b/examples/latest/navigate/android/CameraKeyframeTracks/app/src/main/java/com/here/camerakeyframetracks/RouteCalculator.java @@ -27,8 +27,11 @@ import com.here.sdk.core.GeoCoordinates; import com.here.sdk.core.GeoPolyline; import com.here.sdk.core.errors.InstantiationErrorException; +import com.here.sdk.mapview.LineCap; +import com.here.sdk.mapview.MapMeasureDependentRenderSize; import com.here.sdk.mapview.MapPolyline; import com.here.sdk.mapview.MapView; +import com.here.sdk.mapview.RenderSize; import com.here.sdk.routing.CarOptions; import com.here.sdk.routing.Route; import com.here.sdk.routing.RoutingEngine; @@ -76,9 +79,18 @@ private void showRouteOnMap(Route route) { // Show route as polyline. GeoPolyline routeGeoPolyline = route.getGeometry(); float widthInPixels = 20; - MapPolyline routeMapPolyline = new MapPolyline(routeGeoPolyline, - widthInPixels, - Color.valueOf(0, 0.56f, 0.54f, 0.63f)); // RGBA + Color polylineColor = Color.valueOf(0, 0.56f, 0.54f, 0.63f); + MapPolyline routeMapPolyline = null; + try { + routeMapPolyline = new MapPolyline(routeGeoPolyline, new MapPolyline.SolidRepresentation( + new MapMeasureDependentRenderSize(RenderSize.Unit.PIXELS, widthInPixels), + polylineColor, + LineCap.ROUND)); + } catch (MapPolyline.Representation.InstantiationException e) { + Log.e("MapPolyline Representation Exception:", e.error.name()); + } catch (MapMeasureDependentRenderSize.InstantiationException e) { + Log.e("MapMeasureDependentRenderSize Exception:", e.error.name()); + } mapView.getMapScene().addMapPolyline(routeMapPolyline); } } diff --git a/examples/latest/navigate/android/EVRouting/app/src/main/java/com/here/evrouting/EVRoutingExample.java b/examples/latest/navigate/android/EVRouting/app/src/main/java/com/here/evrouting/EVRoutingExample.java index 0be8e0a5..80d95f24 100644 --- a/examples/latest/navigate/android/EVRouting/app/src/main/java/com/here/evrouting/EVRoutingExample.java +++ b/examples/latest/navigate/android/EVRouting/app/src/main/java/com/here/evrouting/EVRoutingExample.java @@ -32,14 +32,17 @@ import com.here.sdk.core.GeoPolyline; import com.here.sdk.core.LanguageCode; import com.here.sdk.core.errors.InstantiationErrorException; +import com.here.sdk.mapview.LineCap; import com.here.sdk.mapview.MapCamera; import com.here.sdk.mapview.MapImage; import com.here.sdk.mapview.MapImageFactory; import com.here.sdk.mapview.MapMarker; import com.here.sdk.mapview.MapMeasure; +import com.here.sdk.mapview.MapMeasureDependentRenderSize; import com.here.sdk.mapview.MapPolygon; import com.here.sdk.mapview.MapPolyline; import com.here.sdk.mapview.MapView; +import com.here.sdk.mapview.RenderSize; import com.here.sdk.routing.AvoidanceOptions; import com.here.sdk.routing.CalculateIsolineCallback; import com.here.sdk.routing.CalculateRouteCallback; @@ -256,9 +259,18 @@ private void showRouteOnMap(Route route) { // Show route as polyline. GeoPolyline routeGeoPolyline = route.getGeometry(); float widthInPixels = 20; - MapPolyline routeMapPolyline = new MapPolyline(routeGeoPolyline, - widthInPixels, - Color.valueOf(0, 0.56f, 0.54f, 0.63f)); // RGBA + Color polylineColor = Color.valueOf(0, 0.56f, 0.54f, 0.63f); + MapPolyline routeMapPolyline = null; // RGBA + try { + routeMapPolyline = new MapPolyline(routeGeoPolyline, new MapPolyline.SolidRepresentation( + new MapMeasureDependentRenderSize(RenderSize.Unit.PIXELS, widthInPixels), + polylineColor, + LineCap.ROUND)); + } catch (MapPolyline.Representation.InstantiationException e) { + Log.e("MapPolyline Representation Exception:", e.error.name()); + } catch (MapMeasureDependentRenderSize.InstantiationException e) { + Log.e("MapMeasureDependentRenderSize Exception:", e.error.name()); + } mapView.getMapScene().addMapPolyline(routeMapPolyline); mapPolylines.add(routeMapPolyline); diff --git a/examples/latest/navigate/android/HikingDiary/app/src/main/AndroidManifest.xml b/examples/latest/navigate/android/HikingDiary/app/src/main/AndroidManifest.xml index 54542169..72c62387 100644 --- a/examples/latest/navigate/android/HikingDiary/app/src/main/AndroidManifest.xml +++ b/examples/latest/navigate/android/HikingDiary/app/src/main/AndroidManifest.xml @@ -9,7 +9,6 @@ - diff --git a/examples/latest/navigate/android/HikingDiary/app/src/main/java/com/here/hikingdiary/HikingApp.java b/examples/latest/navigate/android/HikingDiary/app/src/main/java/com/here/hikingdiary/HikingApp.java index d3f5441a..ea4d0c7e 100644 --- a/examples/latest/navigate/android/HikingDiary/app/src/main/java/com/here/hikingdiary/HikingApp.java +++ b/examples/latest/navigate/android/HikingDiary/app/src/main/java/com/here/hikingdiary/HikingApp.java @@ -22,6 +22,7 @@ import android.app.Activity; import android.content.Context; import android.graphics.drawable.GradientDrawable; +import android.util.Log; import android.view.Gravity; import android.widget.FrameLayout; import android.widget.TextView; @@ -43,13 +44,17 @@ import com.here.sdk.core.Rectangle2D; import com.here.sdk.core.Size2D; import com.here.sdk.core.errors.InstantiationErrorException; +import com.here.sdk.mapview.LineCap; import com.here.sdk.mapview.MapCameraAnimation; import com.here.sdk.mapview.MapCameraAnimationFactory; import com.here.sdk.mapview.MapCameraUpdate; import com.here.sdk.mapview.MapCameraUpdateFactory; import com.here.sdk.mapview.MapMeasure; +import com.here.sdk.mapview.MapMeasureDependentRenderSize; import com.here.sdk.mapview.MapPolyline; +import com.here.sdk.mapview.MapPolyline.SolidRepresentation; import com.here.sdk.mapview.MapView; +import com.here.sdk.mapview.RenderSize; import com.here.sdk.navigation.GPXTrack; import com.here.sdk.navigation.GPXTrackWriter; import com.here.time.Duration; @@ -58,7 +63,6 @@ import java.util.List; public class HikingApp { - public HEREBackgroundPositioningServiceProvider hereBackgroundPositioningServiceProvider; private MapView mapView; private Context context; @@ -164,11 +168,21 @@ private int getLengthOfGeoPolylineInMeters(GeoPolyline geoPolyline) { } return length; } + private void addMapPolyline(GeoPolyline geoPolyline) { clearMap(); - myPathMapPolyline = new MapPolyline(geoPolyline, - 20, - new Color(0, (float) 0.56, (float) 0.54, (float) 0.63)); + try { + float widthInPixels = 20; + Color polylineColor = new Color(0, (float) 0.56, (float) 0.54, (float) 0.63); + myPathMapPolyline = new MapPolyline(geoPolyline, new MapPolyline.SolidRepresentation( + new MapMeasureDependentRenderSize(RenderSize.Unit.PIXELS, widthInPixels), + polylineColor, + LineCap.ROUND)); + } catch (MapPolyline.Representation.InstantiationException e) { + Log.e("MapPolyline Representation Exception:", e.error.name()); + } catch (MapMeasureDependentRenderSize.InstantiationException e) { + Log.e("MapMeasureDependentRenderSize Exception:", e.error.name()); + } mapView.getMapScene().addMapPolyline(myPathMapPolyline); } diff --git a/examples/latest/navigate/android/HikingDiary/app/src/main/java/com/here/hikingdiary/positioning/HEREPositioningVisualizer.java b/examples/latest/navigate/android/HikingDiary/app/src/main/java/com/here/hikingdiary/positioning/HEREPositioningVisualizer.java index d6a633da..bdaeb73d 100644 --- a/examples/latest/navigate/android/HikingDiary/app/src/main/java/com/here/hikingdiary/positioning/HEREPositioningVisualizer.java +++ b/examples/latest/navigate/android/HikingDiary/app/src/main/java/com/here/hikingdiary/positioning/HEREPositioningVisualizer.java @@ -10,10 +10,13 @@ import com.here.sdk.core.GeoPolyline; import com.here.sdk.core.Location; import com.here.sdk.core.errors.InstantiationErrorException; +import com.here.sdk.mapview.LineCap; import com.here.sdk.mapview.LocationIndicator; +import com.here.sdk.mapview.MapMeasureDependentRenderSize; import com.here.sdk.mapview.MapPolygon; import com.here.sdk.mapview.MapPolyline; import com.here.sdk.mapview.MapView; +import com.here.sdk.mapview.RenderSize; import java.util.ArrayList; import java.util.List; @@ -122,9 +125,16 @@ private void updateMapPolyline(Location location) { } private void addMapPolyline(GeoPolyline geoPolyline) { - mapPolyline = new MapPolyline(geoPolyline, - 5, // widthInPixels - Color.valueOf(android.graphics.Color.BLACK)); + try { + mapPolyline = new MapPolyline(geoPolyline, new MapPolyline.SolidRepresentation( + new MapMeasureDependentRenderSize(RenderSize.Unit.METERS, 5), + Color.valueOf(android.graphics.Color.BLACK), + LineCap.ROUND)); + } catch (MapPolyline.Representation.InstantiationException e) { + Log.e("MapPolyline Representation Exception:", e.error.name()); + } catch (MapMeasureDependentRenderSize.InstantiationException e) { + Log.e("MapMeasureDependentRenderSize Exception:", e.error.name()); + } mapView.getMapScene().addMapPolyline(mapPolyline); } diff --git a/examples/latest/navigate/android/MapItems/app/src/main/java/com/here/mapitems/MapObjectsExample.java b/examples/latest/navigate/android/MapItems/app/src/main/java/com/here/mapitems/MapObjectsExample.java index 068d2921..715c52d4 100644 --- a/examples/latest/navigate/android/MapItems/app/src/main/java/com/here/mapitems/MapObjectsExample.java +++ b/examples/latest/navigate/android/MapItems/app/src/main/java/com/here/mapitems/MapObjectsExample.java @@ -19,6 +19,8 @@ package com.here.mapitems; +import android.util.Log; + import com.here.sdk.core.Color; import com.here.sdk.core.GeoCircle; import com.here.sdk.core.GeoCoordinates; @@ -26,15 +28,18 @@ import com.here.sdk.core.GeoPolygon; import com.here.sdk.core.GeoPolyline; import com.here.sdk.core.errors.InstantiationErrorException; +import com.here.sdk.mapview.LineCap; import com.here.sdk.mapview.MapArrow; import com.here.sdk.mapview.MapCamera; import com.here.sdk.mapview.MapCameraAnimation; import com.here.sdk.mapview.MapCameraAnimationFactory; import com.here.sdk.mapview.MapMeasure; +import com.here.sdk.mapview.MapMeasureDependentRenderSize; import com.here.sdk.mapview.MapPolygon; import com.here.sdk.mapview.MapPolyline; import com.here.sdk.mapview.MapScene; import com.here.sdk.mapview.MapView; +import com.here.sdk.mapview.RenderSize; import com.here.time.Duration; import java.util.ArrayList; @@ -111,8 +116,18 @@ private MapPolyline createPolyline() { } float widthInPixels = 20; - Color lineColor = Color.valueOf(0, 0.56f, 0.54f, 0.63f); // RGBA - MapPolyline mapPolyline = new MapPolyline(geoPolyline, widthInPixels, lineColor); + Color lineColor = new Color(0, (float) 0.56, (float) 0.54, (float) 0.63); + MapPolyline mapPolyline = null; + try { + mapPolyline = new MapPolyline(geoPolyline, new MapPolyline.SolidRepresentation( + new MapMeasureDependentRenderSize(RenderSize.Unit.PIXELS, widthInPixels), + lineColor, + LineCap.ROUND)); + } catch (MapPolyline.Representation.InstantiationException e) { + Log.e("MapPolyline Representation Exception:", e.error.name()); + } catch (MapMeasureDependentRenderSize.InstantiationException e) { + Log.e("MapMeasureDependentRenderSize Exception:", e.error.name()); + } return mapPolyline; } diff --git a/examples/latest/navigate/android/Navigation/app/src/main/java/com/here/navigation/App.java b/examples/latest/navigate/android/Navigation/app/src/main/java/com/here/navigation/App.java index 36d4fb5d..cdcd1c44 100644 --- a/examples/latest/navigate/android/Navigation/app/src/main/java/com/here/navigation/App.java +++ b/examples/latest/navigate/android/Navigation/app/src/main/java/com/here/navigation/App.java @@ -20,6 +20,7 @@ package com.here.navigation; import android.content.Context; +import android.util.Log; import android.widget.TextView; import androidx.appcompat.app.AlertDialog; @@ -29,12 +30,15 @@ import com.here.sdk.core.GeoPolyline; import com.here.sdk.core.Location; import com.here.sdk.gestures.GestureState; +import com.here.sdk.mapview.LineCap; import com.here.sdk.mapview.MapImage; import com.here.sdk.mapview.MapImageFactory; import com.here.sdk.mapview.MapMarker; import com.here.sdk.mapview.MapMeasure; +import com.here.sdk.mapview.MapMeasureDependentRenderSize; import com.here.sdk.mapview.MapPolyline; import com.here.sdk.mapview.MapView; +import com.here.sdk.mapview.RenderSize; import com.here.sdk.routing.Route; import com.here.sdk.routing.Waypoint; @@ -178,9 +182,19 @@ private void showRouteOnMap(Route route) { // Show route as polyline. GeoPolyline routeGeoPolyline = route.getGeometry(); float widthInPixels = 20; - MapPolyline routeMapPolyline = new MapPolyline(routeGeoPolyline, - widthInPixels, - Color.valueOf(0, 0.56f, 0.54f, 0.63f)); // RGBA + Color polylineColor = Color.valueOf(0, 0.56f, 0.54f, 0.63f); + MapPolyline routeMapPolyline = null; + try { + routeMapPolyline = new MapPolyline(routeGeoPolyline, new MapPolyline.SolidRepresentation( + new MapMeasureDependentRenderSize(RenderSize.Unit.PIXELS, widthInPixels), + polylineColor, + LineCap.ROUND)); + } catch (MapPolyline.Representation.InstantiationException e) { + Log.e("MapPolyline Representation Exception:", e.error.name()); + } catch (MapMeasureDependentRenderSize.InstantiationException e) { + Log.e("MapMeasureDependentRenderSize Exception:", e.error.name()); + } + mapView.getMapScene().addMapPolyline(routeMapPolyline); mapPolylines.add(routeMapPolyline); } diff --git a/examples/latest/navigate/android/Navigation/app/src/main/java/com/here/navigation/NavigationExample.java b/examples/latest/navigate/android/Navigation/app/src/main/java/com/here/navigation/NavigationExample.java index 14242b29..9cc42af9 100644 --- a/examples/latest/navigate/android/Navigation/app/src/main/java/com/here/navigation/NavigationExample.java +++ b/examples/latest/navigate/android/Navigation/app/src/main/java/com/here/navigation/NavigationExample.java @@ -98,7 +98,8 @@ public void startLocationProvider() { private void prefetchMapData(GeoCoordinates currentGeoCoordinates) { // Prefetches map data around the provided location with a radius of 2 km into the map cache. // For the best experience, prefetchAroundLocation() should be called as early as possible. - routePrefetcher.prefetchAroundLocation(currentGeoCoordinates); + double radiusInMeters = 10.0; + routePrefetcher.prefetchAroundLocationWithRadius(currentGeoCoordinates, radiusInMeters); // Prefetches map data within a corridor along the route that is currently set to the provided Navigator instance. // This happens continuously in discrete intervals. // If no route is set, no data will be prefetched. diff --git a/examples/latest/navigate/android/OfflineMaps/app/src/main/java/com/here/offlinemaps/OfflineMapsExample.java b/examples/latest/navigate/android/OfflineMaps/app/src/main/java/com/here/offlinemaps/OfflineMapsExample.java index 5cbb8f6d..191acd00 100644 --- a/examples/latest/navigate/android/OfflineMaps/app/src/main/java/com/here/offlinemaps/OfflineMapsExample.java +++ b/examples/latest/navigate/android/OfflineMaps/app/src/main/java/com/here/offlinemaps/OfflineMapsExample.java @@ -25,10 +25,10 @@ import androidx.annotation.Nullable; import com.google.android.material.snackbar.Snackbar; -import com.here.sdk.BuildConfig; import com.here.sdk.core.GeoBox; import com.here.sdk.core.GeoCoordinates; import com.here.sdk.core.LanguageCode; +import com.here.sdk.core.engine.SDKBuildInformation; import com.here.sdk.core.engine.SDKNativeEngine; import com.here.sdk.core.errors.InstantiationErrorException; import com.here.sdk.maploader.CatalogUpdateInfo; @@ -495,7 +495,7 @@ public void onCompleted(@Nullable PersistentMapRepairError persistentMapRepairEr } private void logHERESDKVersion() { - Log.d("HERE SDK version: ", BuildConfig.VERSION_NAME); + Log.d("HERE SDK version: ", SDKBuildInformation.sdkVersion().versionName); } private void logCurrentMapVersion() { diff --git a/examples/latest/navigate/android/PositioningWithBackgroundUpdates/app/src/main/AndroidManifest.xml b/examples/latest/navigate/android/PositioningWithBackgroundUpdates/app/src/main/AndroidManifest.xml index 1db866a7..99e66bce 100644 --- a/examples/latest/navigate/android/PositioningWithBackgroundUpdates/app/src/main/AndroidManifest.xml +++ b/examples/latest/navigate/android/PositioningWithBackgroundUpdates/app/src/main/AndroidManifest.xml @@ -22,7 +22,8 @@ + android:configChanges="orientation|screenSize|screenLayout|keyboardHidden" + android:launchMode="singleTask"> diff --git a/examples/latest/navigate/android/PositioningWithBackgroundUpdates/app/src/main/java/com/here/examples/positioningwithbackgroundupdates/MainActivity.java b/examples/latest/navigate/android/PositioningWithBackgroundUpdates/app/src/main/java/com/here/examples/positioningwithbackgroundupdates/MainActivity.java index e405b45c..13ed012d 100644 --- a/examples/latest/navigate/android/PositioningWithBackgroundUpdates/app/src/main/java/com/here/examples/positioningwithbackgroundupdates/MainActivity.java +++ b/examples/latest/navigate/android/PositioningWithBackgroundUpdates/app/src/main/java/com/here/examples/positioningwithbackgroundupdates/MainActivity.java @@ -127,7 +127,14 @@ public void permissionsGranted() { @Override public void permissionsDenied() { Log.v(TAG, "checkPermissions: Permissions denied"); - showDialog(R.string.error, R.string.dialog_msg_cannot_start_app_text); + if (permissionsRequestor.isLocationAccessDenied()) { + showDialog(R.string.error, R.string.dialog_msg_cannot_start_app_text); + } else if (permissionsRequestor.isPostNotificationsAccessDenied()) { + showDialog(R.string.error, R.string.post_notifications_access_missing_text); + } else if (!permissionsRequestor.isBackgroundLocationAccessInProgress() && + permissionsRequestor.isBackgroundLocationAccessDenied()) { + showDialog(R.string.error, R.string.background_access_missing_text); + } } }); } diff --git a/examples/latest/navigate/android/PositioningWithBackgroundUpdates/app/src/main/java/com/here/examples/positioningwithbackgroundupdates/PermissionsRequestor.java b/examples/latest/navigate/android/PositioningWithBackgroundUpdates/app/src/main/java/com/here/examples/positioningwithbackgroundupdates/PermissionsRequestor.java index c0f07762..46f6b32c 100644 --- a/examples/latest/navigate/android/PositioningWithBackgroundUpdates/app/src/main/java/com/here/examples/positioningwithbackgroundupdates/PermissionsRequestor.java +++ b/examples/latest/navigate/android/PositioningWithBackgroundUpdates/app/src/main/java/com/here/examples/positioningwithbackgroundupdates/PermissionsRequestor.java @@ -45,6 +45,7 @@ public class PermissionsRequestor { private ResultListener resultListener; private final Activity activity; private static boolean requestBackgroundLocation = false; + private boolean backgroundLocationRequestInProgress = false; public PermissionsRequestor(Activity activity) { this.activity = activity; @@ -163,9 +164,13 @@ public void onRequestPermissionsResult( result &= grantResult == PackageManager.PERMISSION_GRANTED; } - if (requestBackgroundLocationAccess()) { - // Signal that not all permissions have been granted yet. - result = false; + if (!backgroundLocationRequestInProgress) { + if (requestBackgroundLocationAccess()) { + // Signal that not all permissions have been granted yet. + result = false; + } + } else { + backgroundLocationRequestInProgress = false; } if (result) { @@ -194,6 +199,7 @@ public void onClick(DialogInterface dialog, int which) { requestBackgroundLocation = false; } }); + backgroundLocationRequestInProgress = true; AlertDialog dialog = builder.create(); dialog.show(); return true; @@ -201,4 +207,31 @@ public void onClick(DialogInterface dialog, int which) { return false; } } + + public boolean isBackgroundLocationAccessInProgress() { + return backgroundLocationRequestInProgress; + } + + public boolean isBackgroundLocationAccessDenied() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { + return ContextCompat.checkSelfPermission(activity, Manifest.permission.ACCESS_BACKGROUND_LOCATION) + == PackageManager.PERMISSION_DENIED; + } + return false; + } + + public boolean isPostNotificationsAccessDenied() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) { + return ContextCompat.checkSelfPermission(activity, Manifest.permission.POST_NOTIFICATIONS) + == PackageManager.PERMISSION_DENIED; + } + return false; + } + + public boolean isLocationAccessDenied() { + return ContextCompat.checkSelfPermission(activity, Manifest.permission.ACCESS_FINE_LOCATION) + == PackageManager.PERMISSION_DENIED || + ContextCompat.checkSelfPermission(activity, Manifest.permission.ACCESS_COARSE_LOCATION) + == PackageManager.PERMISSION_DENIED; + } } diff --git a/examples/latest/navigate/android/PositioningWithBackgroundUpdates/app/src/main/res/values/strings.xml b/examples/latest/navigate/android/PositioningWithBackgroundUpdates/app/src/main/res/values/strings.xml index 70199d57..a022abf1 100644 --- a/examples/latest/navigate/android/PositioningWithBackgroundUpdates/app/src/main/res/values/strings.xml +++ b/examples/latest/navigate/android/PositioningWithBackgroundUpdates/app/src/main/res/values/strings.xml @@ -25,6 +25,9 @@ Cannot start app: Location service and permissions are needed for this app. Enable background location - Please enable \'(%1$s)\' location access. + This app collects location data to visualize your current location on a map even when the app is not in use. Please enable \'(%1$s)\' location access. Settings + Background location permission is missing. Please enable it from app settings. + + Notifications permission is missing. Please enable it from app settings. \ No newline at end of file diff --git a/examples/latest/navigate/android/PublicTransit/app/src/main/java/com/here/routing/PublicTransportRoutingExample.java b/examples/latest/navigate/android/PublicTransit/app/src/main/java/com/here/routing/PublicTransportRoutingExample.java index 3668339c..521cee5c 100644 --- a/examples/latest/navigate/android/PublicTransit/app/src/main/java/com/here/routing/PublicTransportRoutingExample.java +++ b/examples/latest/navigate/android/PublicTransit/app/src/main/java/com/here/routing/PublicTransportRoutingExample.java @@ -30,13 +30,16 @@ import com.here.sdk.core.GeoPolyline; import com.here.sdk.core.Point2D; import com.here.sdk.core.errors.InstantiationErrorException; +import com.here.sdk.mapview.LineCap; import com.here.sdk.mapview.MapCamera; import com.here.sdk.mapview.MapImage; import com.here.sdk.mapview.MapImageFactory; import com.here.sdk.mapview.MapMarker; import com.here.sdk.mapview.MapMeasure; +import com.here.sdk.mapview.MapMeasureDependentRenderSize; import com.here.sdk.mapview.MapPolyline; import com.here.sdk.mapview.MapView; +import com.here.sdk.mapview.RenderSize; import com.here.sdk.routing.CalculateRouteCallback; import com.here.sdk.routing.Maneuver; import com.here.sdk.routing.ManeuverAction; @@ -145,10 +148,18 @@ private void showRouteOnMap(Route route) { // Show route as polyline. GeoPolyline routeGeoPolyline = route.getGeometry(); float widthInPixels = 20; - MapPolyline routeMapPolyline = new MapPolyline(routeGeoPolyline, - widthInPixels, - Color.valueOf(0, 0.56f, 0.54f, 0.63f)); // RGBA - + Color polylineColor = Color.valueOf(0, 0.56f, 0.54f, 0.63f); + MapPolyline routeMapPolyline = null; + try { + routeMapPolyline = new MapPolyline(routeGeoPolyline, new MapPolyline.SolidRepresentation( + new MapMeasureDependentRenderSize(RenderSize.Unit.PIXELS, widthInPixels), + polylineColor, + LineCap.ROUND)); + } catch (MapPolyline.Representation.InstantiationException e) { + Log.e("MapPolyline Representation Exception:", e.error.name()); + } catch (MapMeasureDependentRenderSize.InstantiationException e) { + Log.e("MapMeasureDependentRenderSize Exception:", e.error.name()); + } mapView.getMapScene().addMapPolyline(routeMapPolyline); mapPolylines.add(routeMapPolyline); diff --git a/examples/latest/navigate/android/Rerouting/app/src/main/java/com/here/rerouting/ReroutingExample.java b/examples/latest/navigate/android/Rerouting/app/src/main/java/com/here/rerouting/ReroutingExample.java index a4e5be31..ae53c313 100644 --- a/examples/latest/navigate/android/Rerouting/app/src/main/java/com/here/rerouting/ReroutingExample.java +++ b/examples/latest/navigate/android/Rerouting/app/src/main/java/com/here/rerouting/ReroutingExample.java @@ -41,6 +41,7 @@ import com.here.sdk.gestures.GestureState; import com.here.sdk.mapview.IconProvider; import com.here.sdk.mapview.IconProviderError; +import com.here.sdk.mapview.LineCap; import com.here.sdk.mapview.MapCamera; import com.here.sdk.mapview.MapCameraAnimation; import com.here.sdk.mapview.MapCameraAnimationFactory; @@ -50,9 +51,11 @@ import com.here.sdk.mapview.MapImageFactory; import com.here.sdk.mapview.MapMarker; import com.here.sdk.mapview.MapMeasure; +import com.here.sdk.mapview.MapMeasureDependentRenderSize; import com.here.sdk.mapview.MapPolyline; import com.here.sdk.mapview.MapScheme; import com.here.sdk.mapview.MapView; +import com.here.sdk.mapview.RenderSize; import com.here.sdk.mapview.RoadShieldIconProperties; import com.here.sdk.navigation.DestinationReachedListener; import com.here.sdk.navigation.ManeuverProgress; @@ -704,7 +707,17 @@ private void handleDeviationRouteResults(RoutingError routingError, List private void showRouteOnMap(Route route, Color color, int widthInPixels) { GeoPolyline routeGeoPolyline = route.getGeometry(); - MapPolyline routeMapPolyline = new MapPolyline(routeGeoPolyline, widthInPixels, color); + MapPolyline routeMapPolyline = null; + try { + routeMapPolyline = new MapPolyline(routeGeoPolyline, new MapPolyline.SolidRepresentation( + new MapMeasureDependentRenderSize(RenderSize.Unit.PIXELS, widthInPixels), + color, + LineCap.ROUND)); + } catch (MapPolyline.Representation.InstantiationException e) { + Log.e("MapPolyline Representation Exception:", e.error.name()); + } catch (MapMeasureDependentRenderSize.InstantiationException e) { + Log.e("MapMeasureDependentRenderSize Exception:", e.error.name()); + } mapView.getMapScene().addMapPolyline(routeMapPolyline); mapPolylines.add(routeMapPolyline); animateToRoute(route); diff --git a/examples/latest/navigate/android/Routing/app/src/main/java/com/here/routing/RoutingExample.java b/examples/latest/navigate/android/Routing/app/src/main/java/com/here/routing/RoutingExample.java index c26bccf3..2576e76e 100644 --- a/examples/latest/navigate/android/Routing/app/src/main/java/com/here/routing/RoutingExample.java +++ b/examples/latest/navigate/android/Routing/app/src/main/java/com/here/routing/RoutingExample.java @@ -30,13 +30,16 @@ import com.here.sdk.core.GeoPolyline; import com.here.sdk.core.Point2D; import com.here.sdk.core.errors.InstantiationErrorException; +import com.here.sdk.mapview.LineCap; import com.here.sdk.mapview.MapCamera; import com.here.sdk.mapview.MapImage; import com.here.sdk.mapview.MapImageFactory; import com.here.sdk.mapview.MapMarker; import com.here.sdk.mapview.MapMeasure; +import com.here.sdk.mapview.MapMeasureDependentRenderSize; import com.here.sdk.mapview.MapPolyline; import com.here.sdk.mapview.MapView; +import com.here.sdk.mapview.RenderSize; import com.here.sdk.routing.CalculateRouteCallback; import com.here.sdk.routing.CarOptions; import com.here.sdk.routing.Maneuver; @@ -206,9 +209,19 @@ private void showRouteOnMap(Route route) { // Show route as polyline. GeoPolyline routeGeoPolyline = route.getGeometry(); float widthInPixels = 20; - MapPolyline routeMapPolyline = new MapPolyline(routeGeoPolyline, - widthInPixels, - Color.valueOf(0, 0.56f, 0.54f, 0.63f)); // RGBA + Color polylineColor = new Color(0, (float) 0.56, (float) 0.54, (float) 0.63); + MapPolyline routeMapPolyline = null; + + try { + routeMapPolyline = new MapPolyline(routeGeoPolyline, new MapPolyline.SolidRepresentation( + new MapMeasureDependentRenderSize(RenderSize.Unit.PIXELS, widthInPixels), + polylineColor, + LineCap.ROUND)); + } catch (MapPolyline.Representation.InstantiationException e) { + Log.e("MapPolyline Representation Exception:", e.error.name()); + } catch (MapMeasureDependentRenderSize.InstantiationException e) { + Log.e("MapMeasureDependentRenderSize Exception:", e.error.name()); + } mapView.getMapScene().addMapPolyline(routeMapPolyline); mapPolylines.add(routeMapPolyline); @@ -314,7 +327,18 @@ private void showTrafficOnRoute(Route route) { continue; } float widthInPixels = 10; - MapPolyline trafficSpanMapPolyline = new MapPolyline(span.getGeometry(), widthInPixels, lineColor); + MapPolyline trafficSpanMapPolyline = null; + try { + trafficSpanMapPolyline = new MapPolyline(span.getGeometry(), new MapPolyline.SolidRepresentation( + new MapMeasureDependentRenderSize(RenderSize.Unit.PIXELS, widthInPixels), + lineColor, + LineCap.ROUND)); + } catch (MapPolyline.Representation.InstantiationException e) { + Log.e("MapPolyline Representation Exception:", e.error.name()); + } catch (MapMeasureDependentRenderSize.InstantiationException e) { + Log.e("MapMeasureDependentRenderSize Exception:", e.error.name()); + } + mapView.getMapScene().addMapPolyline(trafficSpanMapPolyline); mapPolylines.add(trafficSpanMapPolyline); } diff --git a/examples/latest/navigate/android/RoutingHybrid/app/src/main/java/com/here/routinghybrid/RoutingExample.java b/examples/latest/navigate/android/RoutingHybrid/app/src/main/java/com/here/routinghybrid/RoutingExample.java index 208b690a..d708b709 100644 --- a/examples/latest/navigate/android/RoutingHybrid/app/src/main/java/com/here/routinghybrid/RoutingExample.java +++ b/examples/latest/navigate/android/RoutingHybrid/app/src/main/java/com/here/routinghybrid/RoutingExample.java @@ -31,13 +31,16 @@ import com.here.sdk.core.GeoPolyline; import com.here.sdk.core.Point2D; import com.here.sdk.core.errors.InstantiationErrorException; +import com.here.sdk.mapview.LineCap; import com.here.sdk.mapview.MapCamera; import com.here.sdk.mapview.MapImage; import com.here.sdk.mapview.MapImageFactory; import com.here.sdk.mapview.MapMarker; import com.here.sdk.mapview.MapMeasure; +import com.here.sdk.mapview.MapMeasureDependentRenderSize; import com.here.sdk.mapview.MapPolyline; import com.here.sdk.mapview.MapView; +import com.here.sdk.mapview.RenderSize; import com.here.sdk.routing.CalculateRouteCallback; import com.here.sdk.routing.CarOptions; import com.here.sdk.routing.Maneuver; @@ -169,10 +172,18 @@ private void showRouteOnMap(Route route) { // Show route as polyline. GeoPolyline routeGeoPolyline = route.getGeometry(); float widthInPixels = 20; - MapPolyline routeMapPolyline = new MapPolyline(routeGeoPolyline, - widthInPixels, - Color.valueOf(0, 0.56f, 0.54f, 0.63f)); // RGBA - + Color polylineColor = Color.valueOf(0, 0.56f, 0.54f, 0.63f); + MapPolyline routeMapPolyline = null; + try { + routeMapPolyline = new MapPolyline(routeGeoPolyline, new MapPolyline.SolidRepresentation( + new MapMeasureDependentRenderSize(RenderSize.Unit.PIXELS, widthInPixels), + polylineColor, + LineCap.ROUND)); + } catch (MapPolyline.Representation.InstantiationException e) { + Log.e("MapPolyline Representation Exception:", e.error.name()); + } catch (MapMeasureDependentRenderSize.InstantiationException e) { + Log.e("MapMeasureDependentRenderSize Exception:", e.error.name()); + } mapView.getMapScene().addMapPolyline(routeMapPolyline); mapPolylines.add(routeMapPolyline); diff --git a/examples/latest/navigate/android/Traffic/app/src/main/java/com/here/traffic/TrafficExample.java b/examples/latest/navigate/android/Traffic/app/src/main/java/com/here/traffic/TrafficExample.java index e53ca302..0aa75cb4 100644 --- a/examples/latest/navigate/android/Traffic/app/src/main/java/com/here/traffic/TrafficExample.java +++ b/examples/latest/navigate/android/Traffic/app/src/main/java/com/here/traffic/TrafficExample.java @@ -33,14 +33,17 @@ import com.here.sdk.core.Rectangle2D; import com.here.sdk.core.Size2D; import com.here.sdk.core.errors.InstantiationErrorException; +import com.here.sdk.mapview.LineCap; import com.here.sdk.mapview.MapCamera; import com.here.sdk.mapview.MapFeatureModes; import com.here.sdk.mapview.MapFeatures; import com.here.sdk.mapview.MapMeasure; +import com.here.sdk.mapview.MapMeasureDependentRenderSize; import com.here.sdk.mapview.MapPolyline; import com.here.sdk.mapview.MapView; import com.here.sdk.mapview.MapViewBase; import com.here.sdk.mapview.PickMapContentResult; +import com.here.sdk.mapview.RenderSize; import com.here.sdk.traffic.TrafficEngine; import com.here.sdk.traffic.TrafficIncident; import com.here.sdk.traffic.TrafficIncidentLookupCallback; @@ -182,9 +185,18 @@ public void onTrafficIncidentFetched(@Nullable TrafficQueryError trafficQueryErr private void addTrafficIncidentsMapPolyline(GeoPolyline geoPolyline) { // Show traffic incident as polyline. float widthInPixels = 20; - MapPolyline routeMapPolyline = new MapPolyline(geoPolyline, - widthInPixels, - Color.valueOf(0, 0, 0, 0.5f)); // RGBA + Color polylineColor = Color.valueOf(0, 0, 0, 0.5f); + MapPolyline routeMapPolyline = null; + try { + routeMapPolyline = new MapPolyline(geoPolyline, new MapPolyline.SolidRepresentation( + new MapMeasureDependentRenderSize(RenderSize.Unit.PIXELS, widthInPixels), + polylineColor, + LineCap.ROUND)); + } catch (MapPolyline.Representation.InstantiationException e) { + Log.e("MapPolyline Representation Exception:", e.error.name()); + } catch (MapMeasureDependentRenderSize.InstantiationException e) { + Log.e("MapMeasureDependentRenderSize Exception:", e.error.name()); + } mapView.getMapScene().addMapPolyline(routeMapPolyline); mapPolylines.add(routeMapPolyline); diff --git a/examples/latest/navigate/android/TruckGuidance/app/src/main/java/com/here/truckguidance/TruckGuidanceExample.java b/examples/latest/navigate/android/TruckGuidance/app/src/main/java/com/here/truckguidance/TruckGuidanceExample.java index 1b6050d3..2c1190ec 100644 --- a/examples/latest/navigate/android/TruckGuidance/app/src/main/java/com/here/truckguidance/TruckGuidanceExample.java +++ b/examples/latest/navigate/android/TruckGuidance/app/src/main/java/com/here/truckguidance/TruckGuidanceExample.java @@ -41,6 +41,7 @@ import com.here.sdk.core.TransportProfile; import com.here.sdk.core.errors.InstantiationErrorException; import com.here.sdk.gestures.GestureState; +import com.here.sdk.mapview.LineCap; import com.here.sdk.mapview.MapCamera; import com.here.sdk.mapview.MapCameraAnimation; import com.here.sdk.mapview.MapCameraAnimationFactory; @@ -52,9 +53,11 @@ import com.here.sdk.mapview.MapImageFactory; import com.here.sdk.mapview.MapMarker; import com.here.sdk.mapview.MapMeasure; +import com.here.sdk.mapview.MapMeasureDependentRenderSize; import com.here.sdk.mapview.MapPolyline; import com.here.sdk.mapview.MapView; import com.here.sdk.mapview.PickMapContentResult; +import com.here.sdk.mapview.RenderSize; import com.here.sdk.navigation.DimensionRestriction; import com.here.sdk.navigation.DimensionRestrictionType; import com.here.sdk.navigation.DistanceType; @@ -893,7 +896,17 @@ private void logPlaceAmenities(Place place) { private void showRouteOnMap(Route route, Color color, int widthInPixels) { // Show route as polyline. GeoPolyline routeGeoPolyline = route.getGeometry(); - MapPolyline routeMapPolyline = new MapPolyline(routeGeoPolyline, widthInPixels, color); + MapPolyline routeMapPolyline = null; + try { + routeMapPolyline = new MapPolyline(routeGeoPolyline, new MapPolyline.SolidRepresentation( + new MapMeasureDependentRenderSize(RenderSize.Unit.PIXELS, widthInPixels), + color, + LineCap.ROUND)); + } catch (MapPolyline.Representation.InstantiationException e) { + Log.e("MapPolyline Representation Exception:", e.error.name()); + } catch (MapMeasureDependentRenderSize.InstantiationException e) { + Log.e("MapMeasureDependentRenderSize Exception:", e.error.name()); + } // Optionally, hide irrelevant icons from the vehicle restriction layer that cross our route. If the route crosses // such icons, then they are not applicable based on the provided TruckSpecifications. diff --git a/examples/latest/navigate/flutter/camera_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/examples/latest/navigate/flutter/camera_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 00000000..20dee7a8 --- /dev/null +++ b/examples/latest/navigate/flutter/camera_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,29 @@ +package io.flutter.plugins; + +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. + */ +@Keep +public final class GeneratedPluginRegistrant { + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { + try { + flutterEngine.getPlugins().add(new com.here.here_sdk.HereSdkPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin here_sdk, com.here.here_sdk.HereSdkPlugin", e); + } + try { + flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin url_launcher_android, io.flutter.plugins.urllauncher.UrlLauncherPlugin", e); + } + } +} diff --git a/examples/latest/navigate/flutter/camera_app/lib/main.dart b/examples/latest/navigate/flutter/camera_app/lib/main.dart index 0bc62675..76e66fb5 100644 --- a/examples/latest/navigate/flutter/camera_app/lib/main.dart +++ b/examples/latest/navigate/flutter/camera_app/lib/main.dart @@ -109,8 +109,8 @@ class _MyAppState extends State with TickerProviderStateMixin { alignment: Alignment.topCenter, child: ElevatedButton( style: ElevatedButton.styleFrom( - primary: Colors.lightBlueAccent, - onPrimary: Colors.white, + foregroundColor: Colors.white, + backgroundColor: Colors.lightBlueAccent, ), onPressed: () => callbackFunction(), child: Text(buttonLabel, style: TextStyle(fontSize: 20)), diff --git a/examples/latest/navigate/flutter/camera_keyframe_tracks_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/examples/latest/navigate/flutter/camera_keyframe_tracks_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 00000000..20dee7a8 --- /dev/null +++ b/examples/latest/navigate/flutter/camera_keyframe_tracks_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,29 @@ +package io.flutter.plugins; + +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. + */ +@Keep +public final class GeneratedPluginRegistrant { + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { + try { + flutterEngine.getPlugins().add(new com.here.here_sdk.HereSdkPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin here_sdk, com.here.here_sdk.HereSdkPlugin", e); + } + try { + flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin url_launcher_android, io.flutter.plugins.urllauncher.UrlLauncherPlugin", e); + } + } +} diff --git a/examples/latest/navigate/flutter/camera_keyframe_tracks_app/lib/helper/RouteCalculator.dart b/examples/latest/navigate/flutter/camera_keyframe_tracks_app/lib/helper/RouteCalculator.dart index 0b041afc..93de6e39 100644 --- a/examples/latest/navigate/flutter/camera_keyframe_tracks_app/lib/helper/RouteCalculator.dart +++ b/examples/latest/navigate/flutter/camera_keyframe_tracks_app/lib/helper/RouteCalculator.dart @@ -56,9 +56,12 @@ class RouteCalculator { void _showRouteOnMap(routes.Route route) { // Show route as polyline. GeoPolyline routeGeoPolyline = route.geometry; - double widthInPixels = 20; - MapPolyline routeMapPolyline = - MapPolyline(routeGeoPolyline, widthInPixels, const Color.fromARGB(160, 0, 144, 138)); // RGBA + double widthInPixels = 20.0; + Color polylineColor = const Color.fromARGB(160, 0, 144, 138); + MapPolyline routeMapPolyline = MapPolyline.withRepresentation(routeGeoPolyline, MapPolylineSolidRepresentation( + MapMeasureDependentRenderSize.withSingleSize(RenderSizeUnit.pixels, widthInPixels), + polylineColor, + LineCap.round)); _hereMapController.mapScene.addMapPolyline(routeMapPolyline); } } diff --git a/examples/latest/navigate/flutter/carto_poi_picking_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/examples/latest/navigate/flutter/carto_poi_picking_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 00000000..20dee7a8 --- /dev/null +++ b/examples/latest/navigate/flutter/carto_poi_picking_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,29 @@ +package io.flutter.plugins; + +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. + */ +@Keep +public final class GeneratedPluginRegistrant { + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { + try { + flutterEngine.getPlugins().add(new com.here.here_sdk.HereSdkPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin here_sdk, com.here.here_sdk.HereSdkPlugin", e); + } + try { + flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin url_launcher_android, io.flutter.plugins.urllauncher.UrlLauncherPlugin", e); + } + } +} diff --git a/examples/latest/navigate/flutter/custom_map_styles_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/examples/latest/navigate/flutter/custom_map_styles_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 00000000..20dee7a8 --- /dev/null +++ b/examples/latest/navigate/flutter/custom_map_styles_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,29 @@ +package io.flutter.plugins; + +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. + */ +@Keep +public final class GeneratedPluginRegistrant { + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { + try { + flutterEngine.getPlugins().add(new com.here.here_sdk.HereSdkPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin here_sdk, com.here.here_sdk.HereSdkPlugin", e); + } + try { + flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin url_launcher_android, io.flutter.plugins.urllauncher.UrlLauncherPlugin", e); + } + } +} diff --git a/examples/latest/navigate/flutter/custom_raster_layers_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/examples/latest/navigate/flutter/custom_raster_layers_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 00000000..20dee7a8 --- /dev/null +++ b/examples/latest/navigate/flutter/custom_raster_layers_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,29 @@ +package io.flutter.plugins; + +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. + */ +@Keep +public final class GeneratedPluginRegistrant { + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { + try { + flutterEngine.getPlugins().add(new com.here.here_sdk.HereSdkPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin here_sdk, com.here.here_sdk.HereSdkPlugin", e); + } + try { + flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin url_launcher_android, io.flutter.plugins.urllauncher.UrlLauncherPlugin", e); + } + } +} diff --git a/examples/latest/navigate/flutter/ev_routing_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/examples/latest/navigate/flutter/ev_routing_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 00000000..20dee7a8 --- /dev/null +++ b/examples/latest/navigate/flutter/ev_routing_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,29 @@ +package io.flutter.plugins; + +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. + */ +@Keep +public final class GeneratedPluginRegistrant { + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { + try { + flutterEngine.getPlugins().add(new com.here.here_sdk.HereSdkPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin here_sdk, com.here.here_sdk.HereSdkPlugin", e); + } + try { + flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin url_launcher_android, io.flutter.plugins.urllauncher.UrlLauncherPlugin", e); + } + } +} diff --git a/examples/latest/navigate/flutter/ev_routing_app/lib/EVRoutingExample.dart b/examples/latest/navigate/flutter/ev_routing_app/lib/EVRoutingExample.dart index 3326291b..dbabed49 100644 --- a/examples/latest/navigate/flutter/ev_routing_app/lib/EVRoutingExample.dart +++ b/examples/latest/navigate/flutter/ev_routing_app/lib/EVRoutingExample.dart @@ -339,7 +339,13 @@ class EVRoutingExample { // Show route as polyline. GeoPolyline routeGeoPolyline = route.geometry; double widthInPixels = 20; - MapPolyline routeMapPolyline = MapPolyline(routeGeoPolyline, widthInPixels, Color.fromARGB(160, 0, 144, 138)); + Color polylineColor = const Color.fromARGB(160, 0, 144, 138); + MapPolyline routeMapPolyline = MapPolyline.withRepresentation( + routeGeoPolyline, + MapPolylineSolidRepresentation( + MapMeasureDependentRenderSize.withSingleSize(RenderSizeUnit.pixels, widthInPixels), + polylineColor, + LineCap.round)); _hereMapController.mapScene.addMapPolyline(routeMapPolyline); _mapPolylines.add(routeMapPolyline); diff --git a/examples/latest/navigate/flutter/ev_routing_app/lib/main.dart b/examples/latest/navigate/flutter/ev_routing_app/lib/main.dart index d09f2082..7ae7295d 100644 --- a/examples/latest/navigate/flutter/ev_routing_app/lib/main.dart +++ b/examples/latest/navigate/flutter/ev_routing_app/lib/main.dart @@ -115,8 +115,8 @@ class _EVRoutingAppState extends State { alignment: Alignment.topCenter, child: ElevatedButton( style: ElevatedButton.styleFrom( - primary: Colors.lightBlueAccent, - onPrimary: Colors.white, + foregroundColor: Colors.white, + backgroundColor: Colors.lightBlueAccent, ), onPressed: () => callbackFunction(), child: Text(buttonLabel, style: TextStyle(fontSize: 20)), diff --git a/examples/latest/navigate/flutter/gestures_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/examples/latest/navigate/flutter/gestures_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 00000000..20dee7a8 --- /dev/null +++ b/examples/latest/navigate/flutter/gestures_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,29 @@ +package io.flutter.plugins; + +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. + */ +@Keep +public final class GeneratedPluginRegistrant { + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { + try { + flutterEngine.getPlugins().add(new com.here.here_sdk.HereSdkPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin here_sdk, com.here.here_sdk.HereSdkPlugin", e); + } + try { + flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin url_launcher_android, io.flutter.plugins.urllauncher.UrlLauncherPlugin", e); + } + } +} diff --git a/examples/latest/navigate/flutter/hello_map_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/examples/latest/navigate/flutter/hello_map_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 00000000..20dee7a8 --- /dev/null +++ b/examples/latest/navigate/flutter/hello_map_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,29 @@ +package io.flutter.plugins; + +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. + */ +@Keep +public final class GeneratedPluginRegistrant { + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { + try { + flutterEngine.getPlugins().add(new com.here.here_sdk.HereSdkPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin here_sdk, com.here.here_sdk.HereSdkPlugin", e); + } + try { + flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin url_launcher_android, io.flutter.plugins.urllauncher.UrlLauncherPlugin", e); + } + } +} diff --git a/examples/latest/navigate/flutter/hiking_diary_app/README.md b/examples/latest/navigate/flutter/hiking_diary_app/README.md index c634b1d1..8ce1d7f8 100644 --- a/examples/latest/navigate/flutter/hiking_diary_app/README.md +++ b/examples/latest/navigate/flutter/hiking_diary_app/README.md @@ -1,12 +1,12 @@ -The hiking_diary_app shows how to use positioning to calculate the distance travelled by a user. - -Build instructions: -------------------- - -1) Set your HERE SDK credentials programmatically in `lib/main.dart`. - -2) Unzip the HERE SDK plugin to the plugins folder inside this project. Name the folder 'here_sdk': `hello_map/plugins/here_sdk`. - -3) Start an emulator or simulator and execute `flutter run` from the app's directory - or run the app from within your IDE. - -More information can be found in the _Get Started_ section of the _Developer Guide_. +The hiking_diary_app shows how to use positioning to calculate the distance travelled by a user. + +Build instructions: +------------------- + +1) Set your HERE SDK credentials programmatically in `lib/main.dart`. + +2) Unzip the HERE SDK plugin to the plugins folder inside this project. Name the folder 'here_sdk': `hello_map/plugins/here_sdk`. + +3) Start an emulator or simulator and execute `flutter run` from the app's directory - or run the app from within your IDE. + +More information can be found in the _Get Started_ section of the _Developer Guide_. diff --git a/examples/latest/navigate/flutter/hiking_diary_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/examples/latest/navigate/flutter/hiking_diary_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 00000000..24a833b2 --- /dev/null +++ b/examples/latest/navigate/flutter/hiking_diary_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,34 @@ +package io.flutter.plugins; + +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. + */ +@Keep +public final class GeneratedPluginRegistrant { + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { + try { + flutterEngine.getPlugins().add(new com.here.here_sdk.HereSdkPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin here_sdk, com.here.here_sdk.HereSdkPlugin", e); + } + try { + flutterEngine.getPlugins().add(new com.baseflow.permissionhandler.PermissionHandlerPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin permission_handler_android, com.baseflow.permissionhandler.PermissionHandlerPlugin", e); + } + try { + flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin url_launcher_android, io.flutter.plugins.urllauncher.UrlLauncherPlugin", e); + } + } +} diff --git a/examples/latest/navigate/flutter/hiking_diary_app/lib/HikingApp.dart b/examples/latest/navigate/flutter/hiking_diary_app/lib/HikingApp.dart index 164095d3..4ed08d79 100644 --- a/examples/latest/navigate/flutter/hiking_diary_app/lib/HikingApp.dart +++ b/examples/latest/navigate/flutter/hiking_diary_app/lib/HikingApp.dart @@ -212,14 +212,26 @@ class HikingApp implements LocationListener, LocationStatusListener { void _addMapPolyline(GeoPolyline geoPolyline) { clearMap(); - myPathMapPolyline = MapPolyline(geoPolyline, 20, Color.fromARGB(0, 56, 54, 63)); + double widthInPixels = 20.0; + Color polylineColor = const Color.fromARGB(0, 56, 54, 63); + MapPolyline myPathMapPolyline = MapPolyline.withRepresentation( + geoPolyline, + MapPolylineSolidRepresentation( + MapMeasureDependentRenderSize.withSingleSize(RenderSizeUnit.pixels, widthInPixels), + polylineColor, + LineCap.round)); mapView.mapScene.addMapPolyline(myPathMapPolyline!); } MapPolyline _updateTravelledPath() { List geoCoordinatesList = gpxManager.getGeoCoordinatesList(gpxTrackWriter.track); if (geoCoordinatesList.length < 2) { - return MapPolyline(GeoPolyline([]), 0, Colors.transparent); + return MapPolyline.withRepresentation( + GeoPolyline([]), + MapPolylineSolidRepresentation( + MapMeasureDependentRenderSize.withSingleSize(RenderSizeUnit.pixels, 0), + Colors.transparent, + LineCap.round)); } GeoPolyline geoPolyline; try { diff --git a/examples/latest/navigate/flutter/hiking_diary_app/lib/positioning/HEREPositioningVisualizer.dart b/examples/latest/navigate/flutter/hiking_diary_app/lib/positioning/HEREPositioningVisualizer.dart index 22ec4a71..49e221ee 100644 --- a/examples/latest/navigate/flutter/hiking_diary_app/lib/positioning/HEREPositioningVisualizer.dart +++ b/examples/latest/navigate/flutter/hiking_diary_app/lib/positioning/HEREPositioningVisualizer.dart @@ -97,10 +97,14 @@ class HerePositioningVisualizer { } void _addMapPolyline(GeoPolyline geoPolyline) { - mapPolyline = MapPolyline( + double widthInPixels = 5.0; + Color polylineColor = const Color.fromARGB(0, 56, 54, 63); + mapPolyline = MapPolyline.withRepresentation( geoPolyline, - 5, // widthInPixels - Colors.black); + MapPolylineSolidRepresentation( + MapMeasureDependentRenderSize.withSingleSize(RenderSizeUnit.densityIndependentPixels, widthInPixels), + polylineColor, + LineCap.round)); mapView.mapScene.addMapPolyline(mapPolyline!); } diff --git a/examples/latest/navigate/flutter/indoor_map_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/examples/latest/navigate/flutter/indoor_map_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 00000000..20dee7a8 --- /dev/null +++ b/examples/latest/navigate/flutter/indoor_map_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,29 @@ +package io.flutter.plugins; + +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. + */ +@Keep +public final class GeneratedPluginRegistrant { + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { + try { + flutterEngine.getPlugins().add(new com.here.here_sdk.HereSdkPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin here_sdk, com.here.here_sdk.HereSdkPlugin", e); + } + try { + flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin url_launcher_android, io.flutter.plugins.urllauncher.UrlLauncherPlugin", e); + } + } +} diff --git a/examples/latest/navigate/flutter/map_items_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/examples/latest/navigate/flutter/map_items_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 00000000..20dee7a8 --- /dev/null +++ b/examples/latest/navigate/flutter/map_items_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,29 @@ +package io.flutter.plugins; + +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. + */ +@Keep +public final class GeneratedPluginRegistrant { + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { + try { + flutterEngine.getPlugins().add(new com.here.here_sdk.HereSdkPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin here_sdk, com.here.here_sdk.HereSdkPlugin", e); + } + try { + flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin url_launcher_android, io.flutter.plugins.urllauncher.UrlLauncherPlugin", e); + } + } +} diff --git a/examples/latest/navigate/flutter/map_items_app/lib/MapObjectsExample.dart b/examples/latest/navigate/flutter/map_items_app/lib/MapObjectsExample.dart index bf40fb6b..77d6ab24 100644 --- a/examples/latest/navigate/flutter/map_items_app/lib/MapObjectsExample.dart +++ b/examples/latest/navigate/flutter/map_items_app/lib/MapObjectsExample.dart @@ -112,7 +112,12 @@ class MapObjectsExample { double widthInPixels = 20; Color lineColor = Color.fromARGB(160, 0, 144, 138); - MapPolyline mapPolyline = MapPolyline(geoPolyline, widthInPixels, lineColor); + MapPolyline mapPolyline = MapPolyline.withRepresentation( + geoPolyline, + MapPolylineSolidRepresentation( + MapMeasureDependentRenderSize.withSingleSize(RenderSizeUnit.pixels, widthInPixels), + lineColor, + LineCap.round)); return mapPolyline; } diff --git a/examples/latest/navigate/flutter/map_items_app/lib/main.dart b/examples/latest/navigate/flutter/map_items_app/lib/main.dart index 9bb00c57..1da9cfb4 100644 --- a/examples/latest/navigate/flutter/map_items_app/lib/main.dart +++ b/examples/latest/navigate/flutter/map_items_app/lib/main.dart @@ -273,8 +273,8 @@ class _MyAppState extends State { alignment: Alignment.topCenter, child: ElevatedButton( style: ElevatedButton.styleFrom( - primary: Colors.lightBlueAccent, - onPrimary: Colors.white, + foregroundColor: Colors.white, + backgroundColor: Colors.lightBlueAccent, ), onPressed: () => callbackFunction(), child: Text(buttonLabel, style: TextStyle(fontSize: 20)), diff --git a/examples/latest/navigate/flutter/navigation_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/examples/latest/navigate/flutter/navigation_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 00000000..24a833b2 --- /dev/null +++ b/examples/latest/navigate/flutter/navigation_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,34 @@ +package io.flutter.plugins; + +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. + */ +@Keep +public final class GeneratedPluginRegistrant { + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { + try { + flutterEngine.getPlugins().add(new com.here.here_sdk.HereSdkPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin here_sdk, com.here.here_sdk.HereSdkPlugin", e); + } + try { + flutterEngine.getPlugins().add(new com.baseflow.permissionhandler.PermissionHandlerPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin permission_handler_android, com.baseflow.permissionhandler.PermissionHandlerPlugin", e); + } + try { + flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin url_launcher_android, io.flutter.plugins.urllauncher.UrlLauncherPlugin", e); + } + } +} diff --git a/examples/latest/navigate/flutter/navigation_app/lib/AppLogic.dart b/examples/latest/navigate/flutter/navigation_app/lib/AppLogic.dart index 5f2f4085..6ee533db 100644 --- a/examples/latest/navigate/flutter/navigation_app/lib/AppLogic.dart +++ b/examples/latest/navigate/flutter/navigation_app/lib/AppLogic.dart @@ -183,12 +183,11 @@ class AppLogic { // Show route as polyline. GeoPolyline routeGeoPolyline = route.geometry; double widthInPixels = 20; - MapPolyline routeMapPolyline = MapPolyline( - routeGeoPolyline, - widthInPixels, - Color.fromARGB(160, 0, 144, 138), - ); - + Color polylineColor = const Color.fromARGB(160, 0, 144, 138); + MapPolyline routeMapPolyline = MapPolyline.withRepresentation(routeGeoPolyline, MapPolylineSolidRepresentation( + MapMeasureDependentRenderSize.withSingleSize(RenderSizeUnit.pixels, widthInPixels), + polylineColor, + LineCap.round)); _calculatedRouteMapPolyline = routeMapPolyline; _hereMapController.mapScene.addMapPolyline(_calculatedRouteMapPolyline!); } diff --git a/examples/latest/navigate/flutter/navigation_app/lib/NavigationExample.dart b/examples/latest/navigate/flutter/navigation_app/lib/NavigationExample.dart index 0f324536..ff60d0e8 100644 --- a/examples/latest/navigate/flutter/navigation_app/lib/NavigationExample.dart +++ b/examples/latest/navigate/flutter/navigation_app/lib/NavigationExample.dart @@ -84,7 +84,8 @@ class NavigationExample { void prefetchMapData(GeoCoordinates currentGeoCoordinates) { // Prefetches map data around the provided location with a radius of 2 km into the map cache. // For the best experience, prefetchAroundLocation() should be called as early as possible. - _routePrefetcher.prefetchAroundLocation(currentGeoCoordinates); + double radiusInMeters = 10.0; + _routePrefetcher.prefetchAroundLocationWithRadius(currentGeoCoordinates, radiusInMeters); // Prefetches map data within a corridor along the route that is currently set to the provided Navigator instance. // This happens continuously in discrete intervals. // If no route is set, no data will be prefetched. diff --git a/examples/latest/navigate/flutter/navigation_custom/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/examples/latest/navigate/flutter/navigation_custom/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 00000000..20dee7a8 --- /dev/null +++ b/examples/latest/navigate/flutter/navigation_custom/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,29 @@ +package io.flutter.plugins; + +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. + */ +@Keep +public final class GeneratedPluginRegistrant { + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { + try { + flutterEngine.getPlugins().add(new com.here.here_sdk.HereSdkPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin here_sdk, com.here.here_sdk.HereSdkPlugin", e); + } + try { + flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin url_launcher_android, io.flutter.plugins.urllauncher.UrlLauncherPlugin", e); + } + } +} diff --git a/examples/latest/navigate/flutter/navigation_quick_start_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/examples/latest/navigate/flutter/navigation_quick_start_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 00000000..20dee7a8 --- /dev/null +++ b/examples/latest/navigate/flutter/navigation_quick_start_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,29 @@ +package io.flutter.plugins; + +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. + */ +@Keep +public final class GeneratedPluginRegistrant { + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { + try { + flutterEngine.getPlugins().add(new com.here.here_sdk.HereSdkPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin here_sdk, com.here.here_sdk.HereSdkPlugin", e); + } + try { + flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin url_launcher_android, io.flutter.plugins.urllauncher.UrlLauncherPlugin", e); + } + } +} diff --git a/examples/latest/navigate/flutter/offline_maps_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/examples/latest/navigate/flutter/offline_maps_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 00000000..20dee7a8 --- /dev/null +++ b/examples/latest/navigate/flutter/offline_maps_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,29 @@ +package io.flutter.plugins; + +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. + */ +@Keep +public final class GeneratedPluginRegistrant { + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { + try { + flutterEngine.getPlugins().add(new com.here.here_sdk.HereSdkPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin here_sdk, com.here.here_sdk.HereSdkPlugin", e); + } + try { + flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin url_launcher_android, io.flutter.plugins.urllauncher.UrlLauncherPlugin", e); + } + } +} diff --git a/examples/latest/navigate/flutter/positioning_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/examples/latest/navigate/flutter/positioning_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 00000000..24a833b2 --- /dev/null +++ b/examples/latest/navigate/flutter/positioning_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,34 @@ +package io.flutter.plugins; + +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. + */ +@Keep +public final class GeneratedPluginRegistrant { + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { + try { + flutterEngine.getPlugins().add(new com.here.here_sdk.HereSdkPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin here_sdk, com.here.here_sdk.HereSdkPlugin", e); + } + try { + flutterEngine.getPlugins().add(new com.baseflow.permissionhandler.PermissionHandlerPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin permission_handler_android, com.baseflow.permissionhandler.PermissionHandlerPlugin", e); + } + try { + flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin url_launcher_android, io.flutter.plugins.urllauncher.UrlLauncherPlugin", e); + } + } +} diff --git a/examples/latest/navigate/flutter/public_transit_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/examples/latest/navigate/flutter/public_transit_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 00000000..20dee7a8 --- /dev/null +++ b/examples/latest/navigate/flutter/public_transit_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,29 @@ +package io.flutter.plugins; + +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. + */ +@Keep +public final class GeneratedPluginRegistrant { + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { + try { + flutterEngine.getPlugins().add(new com.here.here_sdk.HereSdkPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin here_sdk, com.here.here_sdk.HereSdkPlugin", e); + } + try { + flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin url_launcher_android, io.flutter.plugins.urllauncher.UrlLauncherPlugin", e); + } + } +} diff --git a/examples/latest/navigate/flutter/public_transit_app/lib/PublicTransportRoutingExample.dart b/examples/latest/navigate/flutter/public_transit_app/lib/PublicTransportRoutingExample.dart index 3e62e9df..fddc2bc1 100644 --- a/examples/latest/navigate/flutter/public_transit_app/lib/PublicTransportRoutingExample.dart +++ b/examples/latest/navigate/flutter/public_transit_app/lib/PublicTransportRoutingExample.dart @@ -135,7 +135,13 @@ class PublicTransportRoutingExample { // Show route as polyline. GeoPolyline routeGeoPolyline = route.geometry; double widthInPixels = 20; - MapPolyline routeMapPolyline = MapPolyline(routeGeoPolyline, widthInPixels, Color.fromARGB(160, 0, 144, 138)); + Color polylineColor = const Color.fromARGB(160, 0, 144, 138); + MapPolyline routeMapPolyline = MapPolyline.withRepresentation( + routeGeoPolyline, + MapPolylineSolidRepresentation( + MapMeasureDependentRenderSize.withSingleSize(RenderSizeUnit.pixels, widthInPixels), + polylineColor, + LineCap.round)); _hereMapController.mapScene.addMapPolyline(routeMapPolyline); _mapPolylines.add(routeMapPolyline); } @@ -172,13 +178,13 @@ class PublicTransportRoutingExample { double tilt = 0; // We want to show the route fitting in the map view with an additional padding of 50 pixels. Point2D origin = Point2D(50, 50); - Size2D sizeInPixels = Size2D(_hereMapController.viewportSize.width - 100, _hereMapController.viewportSize.height - 100); + Size2D sizeInPixels = + Size2D(_hereMapController.viewportSize.width - 100, _hereMapController.viewportSize.height - 100); Rectangle2D mapViewport = Rectangle2D(origin, sizeInPixels); // Animate to the route within a duration of 3 seconds. - MapCameraUpdate update = MapCameraUpdateFactory.lookAtAreaWithGeoOrientationAndViewRectangle(route!.boundingBox, - GeoOrientationUpdate(bearing, tilt), - mapViewport); + MapCameraUpdate update = MapCameraUpdateFactory.lookAtAreaWithGeoOrientationAndViewRectangle( + route!.boundingBox, GeoOrientationUpdate(bearing, tilt), mapViewport); MapCameraAnimation animation = MapCameraAnimationFactory.createAnimationFromUpdate( update, const Duration(milliseconds: 3000), EasingFunction.inCubic); _hereMapController.camera.startAnimation(animation); diff --git a/examples/latest/navigate/flutter/public_transit_app/lib/main.dart b/examples/latest/navigate/flutter/public_transit_app/lib/main.dart index 057713d8..1723c840 100644 --- a/examples/latest/navigate/flutter/public_transit_app/lib/main.dart +++ b/examples/latest/navigate/flutter/public_transit_app/lib/main.dart @@ -110,8 +110,8 @@ class _MyAppState extends State { alignment: Alignment.topCenter, child: ElevatedButton( style: ElevatedButton.styleFrom( - primary: Colors.lightBlueAccent, - onPrimary: Colors.white, + foregroundColor: Colors.white, + backgroundColor: Colors.lightBlueAccent, ), onPressed: () => callbackFunction(), child: Text(buttonLabel, style: TextStyle(fontSize: 20)), diff --git a/examples/latest/navigate/flutter/routing_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/examples/latest/navigate/flutter/routing_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 00000000..20dee7a8 --- /dev/null +++ b/examples/latest/navigate/flutter/routing_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,29 @@ +package io.flutter.plugins; + +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. + */ +@Keep +public final class GeneratedPluginRegistrant { + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { + try { + flutterEngine.getPlugins().add(new com.here.here_sdk.HereSdkPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin here_sdk, com.here.here_sdk.HereSdkPlugin", e); + } + try { + flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin url_launcher_android, io.flutter.plugins.urllauncher.UrlLauncherPlugin", e); + } + } +} diff --git a/examples/latest/navigate/flutter/routing_app/lib/RoutingExample.dart b/examples/latest/navigate/flutter/routing_app/lib/RoutingExample.dart index 7f76ccb0..e1ea75c9 100644 --- a/examples/latest/navigate/flutter/routing_app/lib/RoutingExample.dart +++ b/examples/latest/navigate/flutter/routing_app/lib/RoutingExample.dart @@ -173,7 +173,13 @@ class RoutingExample { // Show route as polyline. GeoPolyline routeGeoPolyline = route.geometry; double widthInPixels = 20; - MapPolyline routeMapPolyline = MapPolyline(routeGeoPolyline, widthInPixels, Color.fromARGB(160, 0, 144, 138)); + Color polylineColor = const Color.fromARGB(160, 0, 144, 138); + MapPolyline routeMapPolyline = MapPolyline.withRepresentation( + routeGeoPolyline, + MapPolylineSolidRepresentation( + MapMeasureDependentRenderSize.withSingleSize(RenderSizeUnit.pixels, widthInPixels), + polylineColor, + LineCap.round)); _hereMapController.mapScene.addMapPolyline(routeMapPolyline); _mapPolylines.add(routeMapPolyline); @@ -197,7 +203,13 @@ class RoutingExample { continue; } double widthInPixels = 10; - MapPolyline trafficSpanMapPolyline = new MapPolyline(span.geometry, widthInPixels, lineColor); + MapPolyline trafficSpanMapPolyline = new MapPolyline.withRepresentation( + span.geometry, + MapPolylineSolidRepresentation( + MapMeasureDependentRenderSize.withSingleSize(RenderSizeUnit.pixels, widthInPixels), + lineColor, + LineCap.round)); + _hereMapController.mapScene.addMapPolyline(trafficSpanMapPolyline); _mapPolylines.add(trafficSpanMapPolyline); } diff --git a/examples/latest/navigate/flutter/routing_app/lib/main.dart b/examples/latest/navigate/flutter/routing_app/lib/main.dart index fa593fb7..c77b687c 100644 --- a/examples/latest/navigate/flutter/routing_app/lib/main.dart +++ b/examples/latest/navigate/flutter/routing_app/lib/main.dart @@ -110,8 +110,8 @@ class _MyAppState extends State { alignment: Alignment.topCenter, child: ElevatedButton( style: ElevatedButton.styleFrom( - primary: Colors.lightBlueAccent, - onPrimary: Colors.white, + foregroundColor: Colors.white, + backgroundColor: Colors.lightBlueAccent, ), onPressed: () => callbackFunction(), child: Text(buttonLabel, style: TextStyle(fontSize: 20)), diff --git a/examples/latest/navigate/flutter/routing_hybrid_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/examples/latest/navigate/flutter/routing_hybrid_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 00000000..20dee7a8 --- /dev/null +++ b/examples/latest/navigate/flutter/routing_hybrid_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,29 @@ +package io.flutter.plugins; + +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. + */ +@Keep +public final class GeneratedPluginRegistrant { + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { + try { + flutterEngine.getPlugins().add(new com.here.here_sdk.HereSdkPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin here_sdk, com.here.here_sdk.HereSdkPlugin", e); + } + try { + flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin url_launcher_android, io.flutter.plugins.urllauncher.UrlLauncherPlugin", e); + } + } +} diff --git a/examples/latest/navigate/flutter/routing_hybrid_app/lib/RoutingExample.dart b/examples/latest/navigate/flutter/routing_hybrid_app/lib/RoutingExample.dart index 3ed10025..ed11646f 100644 --- a/examples/latest/navigate/flutter/routing_hybrid_app/lib/RoutingExample.dart +++ b/examples/latest/navigate/flutter/routing_hybrid_app/lib/RoutingExample.dart @@ -128,7 +128,6 @@ class RoutingExample { // Draw a circle to indicate the location of the waypoints. _addCircleMapMarker(waypoint1.coordinates, "assets/red_dot.png"); _addCircleMapMarker(waypoint2.coordinates, "assets/red_dot.png"); - } else { var error = routingError.toString(); _showDialog('Error', 'Error while calculating a route: $error'); @@ -205,7 +204,13 @@ class RoutingExample { // Show route as polyline. GeoPolyline routeGeoPolyline = route.geometry; double widthInPixels = 20; - MapPolyline routeMapPolyline = MapPolyline(routeGeoPolyline, widthInPixels, Color.fromARGB(160, 0, 144, 138)); + Color polylineColor = const Color.fromARGB(160, 0, 144, 138); + MapPolyline routeMapPolyline = MapPolyline.withRepresentation( + routeGeoPolyline, + MapPolylineSolidRepresentation( + MapMeasureDependentRenderSize.withSingleSize(RenderSizeUnit.pixels, widthInPixels), + polylineColor, + LineCap.round)); _hereMapController.mapScene.addMapPolyline(routeMapPolyline); _mapPolylines.add(routeMapPolyline); @@ -282,13 +287,13 @@ class RoutingExample { double tilt = 0; // We want to show the route fitting in the map view with an additional padding of 50 pixels. Point2D origin = Point2D(50, 50); - Size2D sizeInPixels = Size2D(_hereMapController.viewportSize.width - 100, _hereMapController.viewportSize.height - 100); + Size2D sizeInPixels = + Size2D(_hereMapController.viewportSize.width - 100, _hereMapController.viewportSize.height - 100); Rectangle2D mapViewport = Rectangle2D(origin, sizeInPixels); // Animate to the route within a duration of 3 seconds. - MapCameraUpdate update = MapCameraUpdateFactory.lookAtAreaWithGeoOrientationAndViewRectangle(route!.boundingBox, - GeoOrientationUpdate(bearing, tilt), - mapViewport); + MapCameraUpdate update = MapCameraUpdateFactory.lookAtAreaWithGeoOrientationAndViewRectangle( + route!.boundingBox, GeoOrientationUpdate(bearing, tilt), mapViewport); MapCameraAnimation animation = MapCameraAnimationFactory.createAnimationFromUpdate( update, const Duration(milliseconds: 3000), EasingFunction.inCubic); _hereMapController.camera.startAnimation(animation); diff --git a/examples/latest/navigate/flutter/routing_hybrid_app/lib/main.dart b/examples/latest/navigate/flutter/routing_hybrid_app/lib/main.dart index 7fbad3ea..d9d2ff7f 100644 --- a/examples/latest/navigate/flutter/routing_hybrid_app/lib/main.dart +++ b/examples/latest/navigate/flutter/routing_hybrid_app/lib/main.dart @@ -135,8 +135,8 @@ class _MyAppState extends State { alignment: Alignment.topCenter, child: ElevatedButton( style: ElevatedButton.styleFrom( - primary: Colors.lightBlueAccent, - onPrimary: Colors.white, + foregroundColor: Colors.white, + backgroundColor: Colors.lightBlueAccent, ), onPressed: () => callbackFunction(), child: Text(buttonLabel, style: TextStyle(fontSize: 20)), diff --git a/examples/latest/navigate/flutter/search_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/examples/latest/navigate/flutter/search_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 00000000..20dee7a8 --- /dev/null +++ b/examples/latest/navigate/flutter/search_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,29 @@ +package io.flutter.plugins; + +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. + */ +@Keep +public final class GeneratedPluginRegistrant { + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { + try { + flutterEngine.getPlugins().add(new com.here.here_sdk.HereSdkPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin here_sdk, com.here.here_sdk.HereSdkPlugin", e); + } + try { + flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin url_launcher_android, io.flutter.plugins.urllauncher.UrlLauncherPlugin", e); + } + } +} diff --git a/examples/latest/navigate/flutter/search_hybrid_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/examples/latest/navigate/flutter/search_hybrid_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 00000000..20dee7a8 --- /dev/null +++ b/examples/latest/navigate/flutter/search_hybrid_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,29 @@ +package io.flutter.plugins; + +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. + */ +@Keep +public final class GeneratedPluginRegistrant { + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { + try { + flutterEngine.getPlugins().add(new com.here.here_sdk.HereSdkPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin here_sdk, com.here.here_sdk.HereSdkPlugin", e); + } + try { + flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin url_launcher_android, io.flutter.plugins.urllauncher.UrlLauncherPlugin", e); + } + } +} diff --git a/examples/latest/navigate/flutter/spatial_audio_navigation/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/examples/latest/navigate/flutter/spatial_audio_navigation/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 00000000..20dee7a8 --- /dev/null +++ b/examples/latest/navigate/flutter/spatial_audio_navigation/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,29 @@ +package io.flutter.plugins; + +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. + */ +@Keep +public final class GeneratedPluginRegistrant { + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { + try { + flutterEngine.getPlugins().add(new com.here.here_sdk.HereSdkPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin here_sdk, com.here.here_sdk.HereSdkPlugin", e); + } + try { + flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin url_launcher_android, io.flutter.plugins.urllauncher.UrlLauncherPlugin", e); + } + } +} diff --git a/examples/latest/navigate/flutter/traffic_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/examples/latest/navigate/flutter/traffic_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 00000000..20dee7a8 --- /dev/null +++ b/examples/latest/navigate/flutter/traffic_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,29 @@ +package io.flutter.plugins; + +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. + */ +@Keep +public final class GeneratedPluginRegistrant { + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { + try { + flutterEngine.getPlugins().add(new com.here.here_sdk.HereSdkPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin here_sdk, com.here.here_sdk.HereSdkPlugin", e); + } + try { + flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin url_launcher_android, io.flutter.plugins.urllauncher.UrlLauncherPlugin", e); + } + } +} diff --git a/examples/latest/navigate/flutter/traffic_app/lib/TrafficExample.dart b/examples/latest/navigate/flutter/traffic_app/lib/TrafficExample.dart index fdd2b9e1..4e069f63 100644 --- a/examples/latest/navigate/flutter/traffic_app/lib/TrafficExample.dart +++ b/examples/latest/navigate/flutter/traffic_app/lib/TrafficExample.dart @@ -80,14 +80,14 @@ class TrafficExample { void _setTapGestureHandler() { _hereMapController.gestures.tapListener = TapListener((Point2D touchPoint) { - GeoCoordinates? touchGeoCoords = _hereMapController.viewToGeoCoordinates(touchPoint); + GeoCoordinates? touchGeoCoordinates = _hereMapController.viewToGeoCoordinates(touchPoint); // Can be null when the map was tilted and the sky was tapped. - if (touchGeoCoords != null) { + if (touchGeoCoordinates != null) { // Pick incidents that are shown in MapSceneLayers.trafficIncidents. _pickTrafficIncident(touchPoint); // Query for incidents independent of MapSceneLayers.trafficIncidents. - _queryForIncidents(touchGeoCoords); + _queryForIncidents(touchGeoCoordinates); } }); } @@ -125,8 +125,7 @@ class TrafficExample { // Optionally, specify a language: // the language of the country where the incident occurs is used. // trafficIncidentsLookupOptions.languageCode = LanguageCode.EN_US; - _trafficEngine.lookupIncident(originalId, trafficIncidentsLookupOptions, - (trafficQueryError, trafficIncident) { + _trafficEngine.lookupIncident(originalId, trafficIncidentsLookupOptions, (trafficQueryError, trafficIncident) { if (trafficQueryError == null) { print("Fetched TrafficIncident from lookup request." + " Description: " + trafficIncident!.description.text); _addTrafficIncidentsMapPolyline(trafficIncident.location.polyline); @@ -139,15 +138,21 @@ class TrafficExample { void _addTrafficIncidentsMapPolyline(GeoPolyline geoPolyline) { // Show traffic incident as polyline. double widthInPixels = 20; - MapPolyline routeMapPolyline = MapPolyline(geoPolyline, widthInPixels, Color.fromARGB(120, 0, 0, 0)); + Color polylineColor = const Color.fromARGB(120, 0, 0, 0); + MapPolyline routeMapPolyline = MapPolyline.withRepresentation( + geoPolyline, + MapPolylineSolidRepresentation( + MapMeasureDependentRenderSize.withSingleSize(RenderSizeUnit.pixels, widthInPixels), + polylineColor, + LineCap.round)); _hereMapController.mapScene.addMapPolyline(routeMapPolyline); _mapPolylineList.add(routeMapPolyline); } - void _queryForIncidents(GeoCoordinates centerCoords) { + void _queryForIncidents(GeoCoordinates centerCoordinates) { double radiusInMeters = 1000; - GeoCircle geoCircle = GeoCircle(centerCoords, radiusInMeters); + GeoCircle geoCircle = GeoCircle(centerCoordinates, radiusInMeters); TrafficIncidentsQueryOptions trafficIncidentsQueryOptions = TrafficIncidentsQueryOptions(); // Optionally, specify a language: // the language of the country where the incident occurs is used. @@ -161,7 +166,7 @@ class TrafficExample { // If error is null, list is guaranteed to be not empty. String trafficMessage = "Found ${trafficIncidentsList!.length} result(s)."; - TrafficIncident? nearestIncident = _getNearestTrafficIncident(centerCoords, trafficIncidentsList); + TrafficIncident? nearestIncident = _getNearestTrafficIncident(centerCoordinates, trafficIncidentsList); if (nearestIncident != null) { trafficMessage += " Nearest incident: " + nearestIncident.description.text; } @@ -175,7 +180,7 @@ class TrafficExample { } TrafficIncident? _getNearestTrafficIncident( - GeoCoordinates currentGeoCoords, List trafficIncidentsList) { + GeoCoordinates currentGeoCoordinates, List trafficIncidentsList) { if (trafficIncidentsList.length == 0) { return null; } @@ -184,10 +189,10 @@ class TrafficExample { double nearestDistance = double.maxFinite; TrafficIncident? nearestTrafficIncident; for (TrafficIncident trafficIncident in trafficIncidentsList) { - // In case lengthInMeters == 0 then the polyline consistes of two equal coordinates. + // In case lengthInMeters == 0 then the polyline consists of two equal coordinates. // It is guaranteed that each incident has a valid polyline. - for (GeoCoordinates geoCoords in trafficIncident.location.polyline.vertices) { - double currentDistance = currentGeoCoords.distanceTo(geoCoords); + for (GeoCoordinates geoCoordinates in trafficIncident.location.polyline.vertices) { + double currentDistance = currentGeoCoordinates.distanceTo(geoCoordinates); if (currentDistance < nearestDistance) { nearestDistance = currentDistance; nearestTrafficIncident = trafficIncident; diff --git a/examples/latest/navigate/flutter/traffic_app/lib/main.dart b/examples/latest/navigate/flutter/traffic_app/lib/main.dart index da858253..c1c6c79a 100644 --- a/examples/latest/navigate/flutter/traffic_app/lib/main.dart +++ b/examples/latest/navigate/flutter/traffic_app/lib/main.dart @@ -111,8 +111,8 @@ class _MyAppState extends State { alignment: Alignment.topCenter, child: ElevatedButton( style: ElevatedButton.styleFrom( - primary: Colors.lightBlueAccent, - onPrimary: Colors.white, + foregroundColor: Colors.white, + backgroundColor: Colors.lightBlueAccent, ), onPressed: () => callbackFunction(), child: Text(buttonLabel, style: TextStyle(fontSize: 20)), diff --git a/examples/latest/navigate/flutter/unit_testing_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/examples/latest/navigate/flutter/unit_testing_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 00000000..20dee7a8 --- /dev/null +++ b/examples/latest/navigate/flutter/unit_testing_app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,29 @@ +package io.flutter.plugins; + +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. + */ +@Keep +public final class GeneratedPluginRegistrant { + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { + try { + flutterEngine.getPlugins().add(new com.here.here_sdk.HereSdkPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin here_sdk, com.here.here_sdk.HereSdkPlugin", e); + } + try { + flutterEngine.getPlugins().add(new io.flutter.plugins.urllauncher.UrlLauncherPlugin()); + } catch(Exception e) { + Log.e(TAG, "Error registering plugin url_launcher_android, io.flutter.plugins.urllauncher.UrlLauncherPlugin", e); + } + } +} diff --git a/examples/latest/navigate/ios/CameraKeyframeTracks/CameraKeyframeTracks/RouteCalculator.swift b/examples/latest/navigate/ios/CameraKeyframeTracks/CameraKeyframeTracks/RouteCalculator.swift index 1e4d121d..035fd580 100644 --- a/examples/latest/navigate/ios/CameraKeyframeTracks/CameraKeyframeTracks/RouteCalculator.swift +++ b/examples/latest/navigate/ios/CameraKeyframeTracks/CameraKeyframeTracks/RouteCalculator.swift @@ -58,12 +58,20 @@ public class RouteCalculator { private func showRouteOnMap(route: Route) { // Show route as polyline. let routeGeoPolyline = route.geometry - let routeMapPolyline = MapPolyline(geometry: routeGeoPolyline, - widthInPixels: 20, - color: UIColor(red: 0, - green: 0.56, - blue: 0.54, - alpha: 0.63)) - mapView.mapScene.addMapPolyline(routeMapPolyline) + let widthInPixels = 20.0 + let polylineColor = UIColor(red: 0, green: 0.56, blue: 0.54, alpha: 0.63) + do { + let routeMapPolyline = try MapPolyline(geometry: routeGeoPolyline, + representation: MapPolyline.SolidRepresentation( + lineWidth: MapMeasureDependentRenderSize( + sizeUnit: RenderSize.Unit.pixels, + size: widthInPixels), + color: polylineColor, + capShape: LineCap.round)) + + mapView.mapScene.addMapPolyline(routeMapPolyline) + } catch let error { + fatalError("Failed to render MapPolyline. Cause: \(error)") + } } } diff --git a/examples/latest/navigate/ios/EVRouting/EVRouting/RoutingExample.swift b/examples/latest/navigate/ios/EVRouting/EVRouting/RoutingExample.swift index 61d951f9..dd29dfba 100644 --- a/examples/latest/navigate/ios/EVRouting/EVRouting/RoutingExample.swift +++ b/examples/latest/navigate/ios/EVRouting/EVRouting/RoutingExample.swift @@ -190,14 +190,22 @@ class RoutingExample { // Show route as polyline. let routeGeoPolyline = route.geometry - let routeMapPolyline = MapPolyline(geometry: routeGeoPolyline, - widthInPixels: 20, - color: UIColor(red: 0, - green: 0.56, - blue: 0.54, - alpha: 0.63)) - mapView.mapScene.addMapPolyline(routeMapPolyline) - mapPolylineList.append(routeMapPolyline) + let widthInPixels = 20.0 + let polylineColor = UIColor(red: 0, green: 0.56, blue: 0.54, alpha: 0.63) + do { + let routeMapPolyline = try MapPolyline(geometry: routeGeoPolyline, + representation: MapPolyline.SolidRepresentation( + lineWidth: MapMeasureDependentRenderSize( + sizeUnit: RenderSize.Unit.pixels, + size: widthInPixels), + color: polylineColor, + capShape: LineCap.round)) + + mapView.mapScene.addMapPolyline(routeMapPolyline) + mapPolylineList.append(routeMapPolyline) + } catch let error { + fatalError("Failed to render MapPolyline. Cause: \(error)") + } let startPoint = route.sections.first!.departurePlace.mapMatchedCoordinates let destination = route.sections.last!.arrivalPlace.mapMatchedCoordinates diff --git a/examples/latest/navigate/ios/HikingDiary/HikingDiary/HEREPositioningVisualizer.swift b/examples/latest/navigate/ios/HikingDiary/HikingDiary/HEREPositioningVisualizer.swift index a8a71ce6..ba8bf5de 100644 --- a/examples/latest/navigate/ios/HikingDiary/HikingDiary/HEREPositioningVisualizer.swift +++ b/examples/latest/navigate/ios/HikingDiary/HikingDiary/HEREPositioningVisualizer.swift @@ -121,9 +121,20 @@ class HEREPositioningVisualizer { } private func addMapPolyline(_ geoPolyline: GeoPolyline) { - mapPolyline = MapPolyline(geometry: geoPolyline, - widthInPixels: 5, - color: .black) - mapView.mapScene.addMapPolyline(mapPolyline!) + let widthInPixels = 5.0 + let polylineColor: UIColor = .black + do { + mapPolyline = try MapPolyline(geometry: geoPolyline, + representation: MapPolyline.SolidRepresentation( + lineWidth: MapMeasureDependentRenderSize( + sizeUnit: RenderSize.Unit.pixels, + size: widthInPixels), + color: polylineColor, + capShape: LineCap.round)) + + mapView.mapScene.addMapPolyline(mapPolyline!) + } catch let error { + fatalError("Failed to render MapPolyline. Cause: \(error)") + } } } diff --git a/examples/latest/navigate/ios/HikingDiary/HikingDiary/HikingApp.swift b/examples/latest/navigate/ios/HikingDiary/HikingDiary/HikingApp.swift index 5af3b236..d6588f11 100644 --- a/examples/latest/navigate/ios/HikingDiary/HikingDiary/HikingApp.swift +++ b/examples/latest/navigate/ios/HikingDiary/HikingDiary/HikingApp.swift @@ -148,10 +148,21 @@ class HikingApp: LocationDelegate { private func addMapPolyline(_ geoPolyline: GeoPolyline) { clearMap() - myPathMapPolyline = MapPolyline(geometry: geoPolyline, - widthInPixels: 20, - color: UIColor(red: 0, green: 0.56, blue: 0.54, alpha: 0.63)) - mapView.mapScene.addMapPolyline(myPathMapPolyline!) + let widthInPixels = 20.0 + let polylineColor = UIColor(red: 0, green: 0.56, blue: 0.54, alpha: 0.63) + do { + myPathMapPolyline = try MapPolyline(geometry: geoPolyline, + representation: MapPolyline.SolidRepresentation( + lineWidth: MapMeasureDependentRenderSize( + sizeUnit: RenderSize.Unit.pixels, + size: widthInPixels), + color: polylineColor, + capShape: LineCap.round)) + + mapView.mapScene.addMapPolyline(myPathMapPolyline!) + } catch let error { + fatalError("Failed to render MapPolyline. Cause: \(error)") + } } private func clearMap() { diff --git a/examples/latest/navigate/ios/MapItems/MapItems/MapObjectsExample.swift b/examples/latest/navigate/ios/MapItems/MapItems/MapObjectsExample.swift index 9557b9cb..c9973749 100644 --- a/examples/latest/navigate/ios/MapItems/MapItems/MapObjectsExample.swift +++ b/examples/latest/navigate/ios/MapItems/MapItems/MapObjectsExample.swift @@ -91,10 +91,20 @@ class MapObjectsExample { // We are sure that the number of vertices is greater than two, so it will not crash. let geoPolyline = try! GeoPolyline(vertices: coordinates) let lineColor = UIColor(red: 0, green: 0.56, blue: 0.54, alpha: 0.63) - let mapPolyline = MapPolyline(geometry: geoPolyline, - widthInPixels: 30, - color: lineColor) - return mapPolyline + let widthInPixels = 30.0 + do { + let mapPolyline = try MapPolyline(geometry: geoPolyline, + representation: MapPolyline.SolidRepresentation( + lineWidth: MapMeasureDependentRenderSize( + sizeUnit: RenderSize.Unit.pixels, + size: widthInPixels), + color: lineColor, + capShape: LineCap.round)) + + return mapPolyline + } catch let error { + fatalError("Failed to render MapPolyline. Cause: \(error)") + } } private func createMapPolygon() -> MapPolygon { diff --git a/examples/latest/navigate/ios/Navigation/Navigation/App.swift b/examples/latest/navigate/ios/Navigation/Navigation/App.swift index 090adc76..533ea816 100644 --- a/examples/latest/navigate/ios/Navigation/Navigation/App.swift +++ b/examples/latest/navigate/ios/Navigation/Navigation/App.swift @@ -165,14 +165,21 @@ class App : LongPressDelegate { private func showRouteOnMap(route: Route) { // Show route as polyline. let routeGeoPolyline = route.geometry - let routeMapPolyline = MapPolyline(geometry: routeGeoPolyline, - widthInPixels: 20, - color: UIColor(red: 0, - green: 0.56, - blue: 0.54, - alpha: 0.63)) - mapView.mapScene.addMapPolyline(routeMapPolyline) - mapPolylineList.append(routeMapPolyline) + let widthInPixels = 20.0 + let polylineColor = UIColor(red: 0, green: 0.56, blue: 0.54, alpha: 0.63) + do { + let routeMapPolyline = try MapPolyline(geometry: routeGeoPolyline, + representation: MapPolyline.SolidRepresentation( + lineWidth: MapMeasureDependentRenderSize( + sizeUnit: RenderSize.Unit.pixels, + size: widthInPixels), + color: polylineColor, + capShape: LineCap.round)) + mapView.mapScene.addMapPolyline(routeMapPolyline) + mapPolylineList.append(routeMapPolyline) + } catch let error { + fatalError("Failed to render MapPolyline. Cause: \(error)") + } } func clearMap() { diff --git a/examples/latest/navigate/ios/Navigation/Navigation/NavigationExample.swift b/examples/latest/navigate/ios/Navigation/Navigation/NavigationExample.swift index 187e9d16..6d50f136 100644 --- a/examples/latest/navigate/ios/Navigation/Navigation/NavigationExample.swift +++ b/examples/latest/navigate/ios/Navigation/Navigation/NavigationExample.swift @@ -76,8 +76,7 @@ class NavigationExample : DynamicRoutingDelegate { private func prefetchMapData(currentGeoCoordinates: GeoCoordinates) { // Prefetches map data around the provided location with a radius of 2 km into the map cache. - // For the best experience, prefetchAroundLocation() should be called as early as possible. - routePrefetcher.prefetchAroundLocation(currentLocation: currentGeoCoordinates) + routePrefetcher.prefetchAroundLocationWithRadius(currentLocation: currentGeoCoordinates, radiusInMeters: 20.0) // Prefetches map data within a corridor along the route that is currently set to the provided Navigator instance. // This happens continuously in discrete intervals. // If no route is set, no data will be prefetched. diff --git a/examples/latest/navigate/ios/PublicTransit/PublicTransit/PublicTransportRoutingExample.swift b/examples/latest/navigate/ios/PublicTransit/PublicTransit/PublicTransportRoutingExample.swift index e10d67e5..cbae9315 100644 --- a/examples/latest/navigate/ios/PublicTransit/PublicTransit/PublicTransportRoutingExample.swift +++ b/examples/latest/navigate/ios/PublicTransit/PublicTransit/PublicTransportRoutingExample.swift @@ -111,14 +111,22 @@ class PublicTranportRoutingExample { // Show route as polyline. let routeGeoPolyline = route.geometry - let routeMapPolyline = MapPolyline(geometry: routeGeoPolyline, - widthInPixels: 20, - color: UIColor(red: 0, - green: 0.56, - blue: 0.54, - alpha: 0.63)) - mapView.mapScene.addMapPolyline(routeMapPolyline) - mapPolylineList.append(routeMapPolyline) + let widthInPixels = 20.0 + let polylineColor = UIColor(red: 0, green: 0.56, blue: 0.54, alpha: 0.63) + do { + let routeMapPolyline = try MapPolyline(geometry: routeGeoPolyline, + representation: MapPolyline.SolidRepresentation( + lineWidth: MapMeasureDependentRenderSize( + sizeUnit: RenderSize.Unit.pixels, + size: widthInPixels), + color: polylineColor, + capShape: LineCap.round)) + + mapView.mapScene.addMapPolyline(routeMapPolyline) + mapPolylineList.append(routeMapPolyline) + } catch let error { + fatalError("Failed to render MapPolyline. Cause: \(error)") + } let startPoint = route.sections.first!.departurePlace.mapMatchedCoordinates let destination = route.sections.last!.arrivalPlace.mapMatchedCoordinates diff --git a/examples/latest/navigate/ios/Rerouting/Rerouting/ReroutingExample.swift b/examples/latest/navigate/ios/Rerouting/Rerouting/ReroutingExample.swift index e32e1afa..b0bceb00 100644 --- a/examples/latest/navigate/ios/Rerouting/Rerouting/ReroutingExample.swift +++ b/examples/latest/navigate/ios/Rerouting/Rerouting/ReroutingExample.swift @@ -264,11 +264,22 @@ class ReroutingExample: LongPressDelegate, private func showRouteOnMap(route: Route, color: UIColor, widthInPixels: Double) { let routeGeoPolyline = route.geometry - let routeMapPolyline = MapPolyline(geometry: routeGeoPolyline, - widthInPixels: widthInPixels, - color: color) - mapView.mapScene.addMapPolyline(routeMapPolyline) - mapPolylines.append(routeMapPolyline) + + do { + let routeMapPolyline = try MapPolyline(geometry: routeGeoPolyline, + representation: MapPolyline.SolidRepresentation( + lineWidth: MapMeasureDependentRenderSize( + sizeUnit: RenderSize.Unit.pixels, + size: widthInPixels), + color: color, + capShape: LineCap.round)) + + mapView.mapScene.addMapPolyline(routeMapPolyline) + mapPolylines.append(routeMapPolyline) + } catch let error { + fatalError("Failed to render MapPolyline. Cause: \(error)") + } + animateToRoute(route: route) } diff --git a/examples/latest/navigate/ios/Routing/Routing/RoutingExample.swift b/examples/latest/navigate/ios/Routing/Routing/RoutingExample.swift index 5775ed5d..36d81269 100644 --- a/examples/latest/navigate/ios/Routing/Routing/RoutingExample.swift +++ b/examples/latest/navigate/ios/Routing/Routing/RoutingExample.swift @@ -155,14 +155,22 @@ class RoutingExample { // Show route as polyline. let routeGeoPolyline = route.geometry - let routeMapPolyline = MapPolyline(geometry: routeGeoPolyline, - widthInPixels: 20, - color: UIColor(red: 0, - green: 0.56, - blue: 0.54, - alpha: 0.63)) - mapView.mapScene.addMapPolyline(routeMapPolyline) - mapPolylineList.append(routeMapPolyline) + let widthInPixels = 20.0 + let polylineColor = UIColor(red: 0, green: 0.56, blue: 0.54, alpha: 0.63) + do { + let routeMapPolyline = try MapPolyline(geometry: routeGeoPolyline, + representation: MapPolyline.SolidRepresentation( + lineWidth: MapMeasureDependentRenderSize( + sizeUnit: RenderSize.Unit.pixels, + size: widthInPixels), + color: polylineColor, + capShape: LineCap.round)) + + mapView.mapScene.addMapPolyline(routeMapPolyline) + mapPolylineList.append(routeMapPolyline) + } catch let error { + fatalError("Failed to render MapPolyline. Cause: \(error)") + } // Optionally, render traffic on route. showTrafficOnRoute(route) @@ -233,10 +241,10 @@ class RoutingExample { // This renders the traffic jam factor on top of the route as multiple MapPolylines per span. private func showTrafficOnRoute(_ route: Route) { if route.lengthInMeters / 1000 > 5000 { - print("Skip showing traffic-on-route for longer routes."); - return + print("Skip showing traffic-on-route for longer routes."); + return } - + for section in route.sections { for span in section.spans { let trafficSpeed = span.trafficSpeed @@ -244,13 +252,24 @@ class RoutingExample { // Skip rendering low traffic. continue } - let trafficSpanMapPolyline = MapPolyline(geometry: span.geometry, - widthInPixels: 10, - color: lineColor) - mapView.mapScene.addMapPolyline(trafficSpanMapPolyline) - mapPolylineList.append(trafficSpanMapPolyline) + let widthInPixels = 10.0 + let polylineColor = UIColor(red: 0, green: 0.56, blue: 0.54, alpha: 0.63) + do { + let trafficSpanMapPolyline = try MapPolyline(geometry: span.geometry, + representation: MapPolyline.SolidRepresentation( + lineWidth: MapMeasureDependentRenderSize( + sizeUnit: RenderSize.Unit.pixels, + size: widthInPixels), + color: polylineColor, + capShape: LineCap.round)) + + mapView.mapScene.addMapPolyline(trafficSpanMapPolyline) + mapPolylineList.append(trafficSpanMapPolyline) + } catch let error { + fatalError("Failed to render MapPolyline. Cause: \(error)") + } + } } - } } // Define a traffic color scheme based on the route's jam factor. diff --git a/examples/latest/navigate/ios/RoutingHybrid/RoutingHybrid/RoutingExample.swift b/examples/latest/navigate/ios/RoutingHybrid/RoutingHybrid/RoutingExample.swift index 23d3bd05..a73bde3a 100644 --- a/examples/latest/navigate/ios/RoutingHybrid/RoutingHybrid/RoutingExample.swift +++ b/examples/latest/navigate/ios/RoutingHybrid/RoutingHybrid/RoutingExample.swift @@ -131,22 +131,30 @@ class RoutingExample { // Show route as polyline. let routeGeoPolyline = route.geometry - let routeMapPolyline = MapPolyline(geometry: routeGeoPolyline, - widthInPixels: 20, - color: UIColor(red: 0, - green: 0.56, - blue: 0.54, - alpha: 0.63)) - mapView.mapScene.addMapPolyline(routeMapPolyline) - mapPolylineList.append(routeMapPolyline) - + let widthInPixels = 20.0 + let polylineColor = UIColor(red: 0, green: 0.56, blue: 0.54, alpha: 0.63) + do { + let routeMapPolyline = try MapPolyline(geometry: routeGeoPolyline, + representation: MapPolyline.SolidRepresentation( + lineWidth: MapMeasureDependentRenderSize( + sizeUnit: RenderSize.Unit.pixels, + size: widthInPixels), + color: polylineColor, + capShape: LineCap.round)) + + mapView.mapScene.addMapPolyline(routeMapPolyline) + mapPolylineList.append(routeMapPolyline) + } catch let error { + fatalError("Failed to render MapPolyline. Cause: \(error)") + } + let startPoint = route.sections.first!.departurePlace.mapMatchedCoordinates let destination = route.sections.last!.arrivalPlace.mapMatchedCoordinates // Draw a circle to indicate starting point and destination. addCircleMapMarker(geoCoordinates: startPoint, imageName: "green_dot.png") addCircleMapMarker(geoCoordinates: destination, imageName: "green_dot.png") - + // Log maneuver instructions per route leg / sections. let sections = route.sections for section in sections { diff --git a/examples/latest/navigate/ios/SpatialAudioNavigation/SpatialAudioNavigation/Base.lproj/Main.storyboard b/examples/latest/navigate/ios/SpatialAudioNavigation/SpatialAudioNavigation/Base.lproj/Main.storyboard index 3f55eb28..a5bf0bab 100644 --- a/examples/latest/navigate/ios/SpatialAudioNavigation/SpatialAudioNavigation/Base.lproj/Main.storyboard +++ b/examples/latest/navigate/ios/SpatialAudioNavigation/SpatialAudioNavigation/Base.lproj/Main.storyboard @@ -1,9 +1,9 @@ - + - + @@ -18,42 +18,12 @@ - + - - - - - + diff --git a/examples/latest/navigate/ios/SpatialAudioNavigation/SpatialAudioNavigation/SpatialNavigationExample.swift b/examples/latest/navigate/ios/SpatialAudioNavigation/SpatialAudioNavigation/SpatialNavigationExample.swift index 29c4fccb..7071202a 100644 --- a/examples/latest/navigate/ios/SpatialAudioNavigation/SpatialAudioNavigation/SpatialNavigationExample.swift +++ b/examples/latest/navigate/ios/SpatialAudioNavigation/SpatialAudioNavigation/SpatialNavigationExample.swift @@ -54,6 +54,7 @@ class SpatialNavigationExample: SpatialManeuverNotificationDelegate, SpatialMane } } + // Method to be called once navigation has finished or it is desired to finish it. public func stopNavigation() { if(spatialAudioExample?.isNavigating() == true) { spatialAudioExample?.stopNavigation() diff --git a/examples/latest/navigate/ios/SpatialAudioNavigation/SpatialAudioNavigation/ViewController.swift b/examples/latest/navigate/ios/SpatialAudioNavigation/SpatialAudioNavigation/ViewController.swift index 33337910..4f076397 100644 --- a/examples/latest/navigate/ios/SpatialAudioNavigation/SpatialAudioNavigation/ViewController.swift +++ b/examples/latest/navigate/ios/SpatialAudioNavigation/SpatialAudioNavigation/ViewController.swift @@ -34,6 +34,8 @@ class ViewController: UIViewController { // Init SpatialNavigationExample class. spatialNavigationExample = SpatialNavigationExample() spatialNavigationExample?.setMapView(mapView: mapView) + // Start Navigation + spatialNavigationExample?.calculateRoute() } private func onLoadScene(mapError: MapError?) { @@ -60,16 +62,4 @@ class ViewController: UIViewController { present(alertController, animated: true, completion: nil) } - // Starts navigation logging the data related to Spatial Audio - @IBAction func onClickStartSpatialAudioGuidanceClicked(_ sender: Any) { - showDialog(title: "Spatial Audio Navigation", - message: "This app routes to the HERE office in Berlin. Audio cues are played following spatial audio trajectories") - - // We start by calculating a car route. - spatialNavigationExample!.calculateRoute() - } - - @IBAction func onClickStopNavigationClicked(_ sender: Any) { - spatialNavigationExample!.stopNavigation() - } } diff --git a/examples/latest/navigate/ios/Traffic/Traffic/TrafficExample.swift b/examples/latest/navigate/ios/Traffic/Traffic/TrafficExample.swift index e663ab7b..a5757102 100644 --- a/examples/latest/navigate/ios/Traffic/Traffic/TrafficExample.swift +++ b/examples/latest/navigate/ios/Traffic/Traffic/TrafficExample.swift @@ -141,14 +141,22 @@ class TrafficExample: TapDelegate { private func addTrafficIncidentsMapPolyline(geoPolyline: GeoPolyline) { // Show traffic incident as polyline. - let mapPolyline = MapPolyline(geometry: geoPolyline, - widthInPixels: 20, - color: UIColor(red: 0, - green: 0, - blue: 0, - alpha: 0.5)) - mapView.mapScene.addMapPolyline(mapPolyline) - mapPolylineList.append(mapPolyline) + let widthInPixels = 20.0 + let polylineColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.5) + do { + let mapPolyline = try MapPolyline(geometry: geoPolyline, + representation: MapPolyline.SolidRepresentation( + lineWidth: MapMeasureDependentRenderSize( + sizeUnit: RenderSize.Unit.pixels, + size: widthInPixels), + color: polylineColor, + capShape: LineCap.round)) + + mapView.mapScene.addMapPolyline(mapPolyline) + mapPolylineList.append(mapPolyline) + } catch let error { + fatalError("Failed to render MapPolyline. Cause: \(error)") + } } private func queryForIncidents(centerCoords: GeoCoordinates) { diff --git a/examples/latest/navigate/ios/TruckGuidance/TruckGuidance/TruckGuidanceExample.swift b/examples/latest/navigate/ios/TruckGuidance/TruckGuidance/TruckGuidanceExample.swift index d8fff663..8c35b596 100644 --- a/examples/latest/navigate/ios/TruckGuidance/TruckGuidance/TruckGuidanceExample.swift +++ b/examples/latest/navigate/ios/TruckGuidance/TruckGuidance/TruckGuidanceExample.swift @@ -811,18 +811,26 @@ class TruckGuidanceExample: TapDelegate, private func showRouteOnMap(route: Route, color: UIColor, widthInPixels: Double) { let routeGeoPolyline = route.geometry - let routeMapPolyline = MapPolyline(geometry: routeGeoPolyline, - widthInPixels: widthInPixels, - color: color) - + do { + let routeMapPolyline = try MapPolyline(geometry: routeGeoPolyline, + representation: MapPolyline.SolidRepresentation( + lineWidth: MapMeasureDependentRenderSize( + sizeUnit: RenderSize.Unit.pixels, + size: widthInPixels), + color: color, + capShape: LineCap.round)) + + mapView.mapScene.addMapPolyline(routeMapPolyline) + mapPolylines.append(routeMapPolyline) + } catch let error { + fatalError("Failed to render MapPolyline. Cause: \(error)") + } // Optionally, hide irrelevant icons from the vehicle restriction layer that cross our route. // If needed, you can block specific map content categories to customize the map view. // For example, to hide vehicle restriction icons, you can uncomment the following line: // routeMapPolyline.mapContentCategoriesToBlock = Set([MapContentCategory.vehicleRestrictionIcons]) - mapView.mapScene.addMapPolyline(routeMapPolyline) - mapPolylines.append(routeMapPolyline) animateToRoute(route) }