From 9c3d69bc3779a8c393b5942d90d8540b2e5990b2 Mon Sep 17 00:00:00 2001 From: abkumar Date: Fri, 5 Aug 2022 10:35:45 +0530 Subject: [PATCH] Update example apps for release 4.12.3.0 Signed-off-by: abkumar --- README.md | 2 +- examples/latest/README.md | 2 +- .../CustomRasterLayersExample.java | 2 +- .../hellomapandroidauto/MainActivity.java | 1 - .../com/here/mapitems/MapItemsExample.java | 47 ++++++++++++++-- .../main/res/drawable-nodpi/blue_square.png | Bin 1513 -> 0 bytes .../lib/CustomRasterLayersExample.dart | 2 +- .../android/app/src/main/AndroidManifest.xml | 4 ++ .../hello_map_app/ios/Runner/Info.plist | 7 +++ .../flutter/hello_map_app/lib/main.dart | 21 +------ .../map_items_app/assets/blue_square.png | Bin 1513 -> 0 bytes .../map_items_app/lib/MapItemsExample.dart | 53 +++++++++++++++--- .../CustomRasterLayersExample.swift | 2 +- .../CarPlayViewController.swift | 3 - .../blue_square.imageset/Contents.json | 12 ---- .../blue_square.imageset/blue_square.png | Bin 1513 -> 0 bytes .../MapItems/MapItems/MapItemsExample.swift | 42 ++++++++++++-- .../CustomRasterLayersExample.java | 2 +- .../hellomapandroidauto/MainActivity.java | 1 - .../sdk/examples/venues/MainActivity.java | 15 ++++- .../com/here/mapitems/MapItemsExample.java | 47 ++++++++++++++-- .../main/res/drawable-nodpi/blue_square.png | Bin 1513 -> 0 bytes .../here/navigationcustom/MainActivity.java | 10 ++-- .../lib/CustomRasterLayersExample.dart | 2 +- .../android/app/src/main/AndroidManifest.xml | 4 ++ .../hello_map_app/ios/Runner/Info.plist | 7 +++ .../flutter/hello_map_app/lib/main.dart | 21 +------ .../lib/venue_engine_widget.dart | 6 ++ .../map_items_app/assets/blue_square.png | Bin 1513 -> 0 bytes .../map_items_app/lib/MapItemsExample.dart | 53 +++++++++++++++--- .../CustomRasterLayersExample.swift | 2 +- .../CarPlayViewController.swift | 3 - .../ios/IndoorMap/IndoorMap/AppDelegate.swift | 4 +- .../IndoorMap/IndoorMap/ViewController.swift | 14 +++-- .../blue_square.imageset/Contents.json | 12 ---- .../blue_square.imageset/blue_square.png | Bin 1513 -> 0 bytes .../MapItems/MapItems/MapItemsExample.swift | 42 ++++++++++++-- 37 files changed, 310 insertions(+), 135 deletions(-) delete mode 100644 examples/latest/explore/android/MapItems/app/src/main/res/drawable-nodpi/blue_square.png delete mode 100644 examples/latest/explore/flutter/map_items_app/assets/blue_square.png delete mode 100644 examples/latest/explore/ios/MapItems/MapItems/Assets.xcassets/blue_square.imageset/Contents.json delete mode 100644 examples/latest/explore/ios/MapItems/MapItems/Assets.xcassets/blue_square.imageset/blue_square.png delete mode 100644 examples/latest/navigate/android/MapItems/app/src/main/res/drawable-nodpi/blue_square.png delete mode 100644 examples/latest/navigate/flutter/map_items_app/assets/blue_square.png delete mode 100644 examples/latest/navigate/ios/MapItems/MapItems/Assets.xcassets/blue_square.imageset/Contents.json delete mode 100644 examples/latest/navigate/ios/MapItems/MapItems/Assets.xcassets/blue_square.imageset/blue_square.png diff --git a/README.md b/README.md index 061f5b92..0235e727 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,7 @@ For an overview of the existing features, please check the _Developer's Guide_ f > 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.12.2.0) +## List of Available Example Apps (Version 4.12.3.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 45fdd3fc..380bb3a4 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.12.2.0 +This folder contains the HERE SDK examples apps for version: 4.12.3.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/CustomRasterLayers/app/src/main/java/com/here/sdk/customrasterlayers/CustomRasterLayersExample.java b/examples/latest/explore/android/CustomRasterLayers/app/src/main/java/com/here/sdk/customrasterlayers/CustomRasterLayersExample.java index 7c4c6c38..834845e1 100644 --- a/examples/latest/explore/android/CustomRasterLayers/app/src/main/java/com/here/sdk/customrasterlayers/CustomRasterLayersExample.java +++ b/examples/latest/explore/android/CustomRasterLayers/app/src/main/java/com/here/sdk/customrasterlayers/CustomRasterLayersExample.java @@ -98,7 +98,7 @@ private RasterDataSource createRasterDataSource(String dataSourceName) { // Raster tiles are stored in a separate cache on the device. String path = "cache/raster/toner"; - long maxDiskSizeInBytes = 1024 * 1024 * 32; + long maxDiskSizeInBytes = 1024 * 1024 * 128; // 128 RasterDataSourceConfiguration.Cache cacheConfig = new RasterDataSourceConfiguration.Cache(path, maxDiskSizeInBytes); // Note that this will make the raster source already known to the passed map view. diff --git a/examples/latest/explore/android/HelloMapAndroidAuto/app/src/main/java/com/here/hellomapandroidauto/MainActivity.java b/examples/latest/explore/android/HelloMapAndroidAuto/app/src/main/java/com/here/hellomapandroidauto/MainActivity.java index 230acd8f..8b12297e 100644 --- a/examples/latest/explore/android/HelloMapAndroidAuto/app/src/main/java/com/here/hellomapandroidauto/MainActivity.java +++ b/examples/latest/explore/android/HelloMapAndroidAuto/app/src/main/java/com/here/hellomapandroidauto/MainActivity.java @@ -36,7 +36,6 @@ import com.here.sdk.mapview.MapScene; import com.here.sdk.mapview.MapScheme; import com.here.sdk.mapview.MapView; -import com.here.sdk.mapview.VisibilityState; public class MainActivity extends AppCompatActivity { diff --git a/examples/latest/explore/android/MapItems/app/src/main/java/com/here/mapitems/MapItemsExample.java b/examples/latest/explore/android/MapItems/app/src/main/java/com/here/mapitems/MapItemsExample.java index c220bcb3..d75e7b5c 100644 --- a/examples/latest/explore/android/MapItems/app/src/main/java/com/here/mapitems/MapItemsExample.java +++ b/examples/latest/explore/android/MapItems/app/src/main/java/com/here/mapitems/MapItemsExample.java @@ -29,6 +29,7 @@ import androidx.appcompat.app.AlertDialog; import com.here.sdk.core.Anchor2D; +import com.here.sdk.core.Color; import com.here.sdk.core.GeoCoordinates; import com.here.sdk.core.GeoOrientationUpdate; import com.here.sdk.core.Location; @@ -101,20 +102,36 @@ public void showCenteredMapMarkers() { } public void showMapMarkerCluster() { - MapImage clusterMapImage = MapImageFactory.fromResource(context.getResources(), R.drawable.blue_square); - MapMarkerCluster mapMarkerCluster = new MapMarkerCluster(new MapMarkerCluster.ImageStyle(clusterMapImage)); + MapImage clusterMapImage = MapImageFactory.fromResource(context.getResources(), R.drawable.green_square); + + // Defines a text that indicates how many markers are included in the cluster. + MapMarkerCluster.CounterStyle counterStyle = new MapMarkerCluster.CounterStyle(); + counterStyle.textColor = new Color(0, 0, 0, 1); // Black + counterStyle.fontSize = 40; + counterStyle.maxCountNumber = 9; + counterStyle.aboveMaxText = "+9"; + + MapMarkerCluster mapMarkerCluster = new MapMarkerCluster( + new MapMarkerCluster.ImageStyle(clusterMapImage), counterStyle); mapView.getMapScene().addMapMarkerCluster(mapMarkerCluster); mapMarkerClusterList.add(mapMarkerCluster); for (int i = 0; i < 10; i++) { - mapMarkerCluster.addMapMarker(createRandomMapMarkerInViewport()); + mapMarkerCluster.addMapMarker(createRandomMapMarkerInViewport("" + i)); } } - private MapMarker createRandomMapMarkerInViewport() { + private MapMarker createRandomMapMarkerInViewport(String metaDataText) { GeoCoordinates geoCoordinates = createRandomGeoCoordinatesAroundMapCenter(); MapImage mapImage = MapImageFactory.fromResource(context.getResources(), R.drawable.green_square); - return new MapMarker(geoCoordinates, mapImage); + + MapMarker mapMarker = new MapMarker(geoCoordinates, mapImage); + + Metadata metadata = new Metadata(); + metadata.setString("key_cluster", metaDataText); + mapMarker.setMetadata(metadata); + + return mapMarker; } public void showLocationIndicatorPedestrian() { @@ -403,14 +420,32 @@ private void handlePickedMapMarkerClusters(PickMapItemsResult pickMapItemsResult } if (clusterSize == 1) { showDialog("Map marker picked", - "This MapMarker belongs to a cluster."); + "This MapMarker belongs to a cluster. Metadata: " + getClusterMetadata(topmostGrouping.markers.get(0))); } else { + String metadata = ""; + for (MapMarker mapMarker: topmostGrouping.markers) { + metadata += getClusterMetadata(mapMarker); + metadata += " "; + } showDialog("Map marker cluster picked", "Number of contained markers in this cluster: " + clusterSize + ". " + + "Contained Metadata: " + metadata + ". " + "Total number of markers in this MapMarkerCluster: " + topmostGrouping.parent.getMarkers().size()); } } + private String getClusterMetadata(MapMarker mapMarker) { + Metadata metadata = mapMarker.getMetadata(); + String message = "No metadata."; + if (metadata != null) { + String string = metadata.getString("key_cluster"); + if (string != null) { + message = string; + } + } + return message; + } + private void tiltMap() { double bearing = mapView.getCamera().getState().orientationAtTarget.bearing; double tilt = 60; diff --git a/examples/latest/explore/android/MapItems/app/src/main/res/drawable-nodpi/blue_square.png b/examples/latest/explore/android/MapItems/app/src/main/res/drawable-nodpi/blue_square.png deleted file mode 100644 index 544d343c3f9567c989b021209772cadad86577cf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1513 zcmVBE1ZQLxAY_vg;$?V;oX(lt{{G@3qJ`_O^!KmPq;Qw2}Cn0L9?Tam?khm;cmfj@-EE=vY<#k5o0f^m&*sM6pBI0EL{uRZtU4R5Z z`^X8`V)zNfJ8YaF;u6EP09P2E5Ad?jnUOMxUqvh^s*L``+lU9}BlcPZ2XpY-jyyG} zttleQMaed+noc9ry@UIIwng1*#M^^UkFzj+6yF25_LnMhmf?pGpH<}CbcnAmX|u%; z|7E#p3GpKUUAw%6atiT2#A8)^yd3Cssj4^8z$>TJnP(8+gLrkpJj%xIMEtceUz`ec zeo~wa<_{hK;NmJRuzL3+9o0iVC08s$)vACv7|KExH6jmbd4gn8^0FkllzkRT6fd|P0n zrwSVAXrbt(XrcJk;OyVRDf#{Yw^VBW$m{6QFhZvPBk<6w!tZERBfJcLd1$M3&)TehHS09YRtkN(Z(GDi^F2;vKBX;HY+Q*UEnTqUvgh@A9J5aYSek}G;8j! zqp=F+X_rylpF&#LEj%b>g+0Q~5^H*5N-?MwSLAe5T{?GXqX;9WfX;*4pXw6&V*io?m|<6;W0GAb4f<-njQ>$>Q>9MPr@ zwU=n+0I+*9IKpp9{{0u*d8K7@p9VPmCp-6AwmA>rtOL;dXv;Q$XXCx^0IWWyc=l3w zC&Xgk0yx!!!@*Zi8qcdA>-AfBZYACT*nGWS|NH%Vee(m<-vGFv{{#Oecnig2*2@3@ z061k>NoGw=04e|g00;m9hiL!=000010000Q0000000N)_00aO40096106d@r00aO4 z0096106YKy005{L%Vq!o0a8gsK~!i3?U-Q>!XONVH{(f6y#Ikryb1m7|=`(31^lp79iopfM#;;Sp*0? z!t=1|y}u6Qy}^IZt3J}w@F+^lwTjkyYB_0Mm0)B5QX?(%8%KH}HEG`}!Rd=$pDEZY zIdpFlMxF9nS49~4<CaSx7IWCY@I$IKHS2&~oX}nrE%2mXl`eyrz|`StMS4q`m8= zVDAJ=`;&0VA@6w-_D-<0KM9u{@}9pO;ig;59?H@kRLdWMmOX|Nmc+)zwOorZ>78MM z5kW|eBm|8Q6O1loT}Q#z4xinhgwG~mJ%1Qs1_LR01`3utkg%n@GxR3m87NrpK*E;p&d{5LXP{uY0|{HYJ45deyVf&wR?o_| P00000NkvXXu0mjf^T^Mn diff --git a/examples/latest/explore/flutter/custom_raster_layers_app/lib/CustomRasterLayersExample.dart b/examples/latest/explore/flutter/custom_raster_layers_app/lib/CustomRasterLayersExample.dart index 9e73c4da..936cc3b9 100644 --- a/examples/latest/explore/flutter/custom_raster_layers_app/lib/CustomRasterLayersExample.dart +++ b/examples/latest/explore/flutter/custom_raster_layers_app/lib/CustomRasterLayersExample.dart @@ -70,7 +70,7 @@ class CustomRasterLayersExample { // Raster tiles are stored in a separate cache on the device. String path = "cache/raster/toner"; - int maxDiskSizeInBytes = 1024 * 1024 * 32; + int maxDiskSizeInBytes = 1024 * 1024 * 128; // 128 MB RasterDataSourceCacheConfiguration cacheConfig = RasterDataSourceCacheConfiguration(path, maxDiskSizeInBytes); // Note that this will make the raster source already known to the passed map view. diff --git a/examples/latest/explore/flutter/hello_map_app/android/app/src/main/AndroidManifest.xml b/examples/latest/explore/flutter/hello_map_app/android/app/src/main/AndroidManifest.xml index 681c2d01..30269a34 100644 --- a/examples/latest/explore/flutter/hello_map_app/android/app/src/main/AndroidManifest.xml +++ b/examples/latest/explore/flutter/hello_map_app/android/app/src/main/AndroidManifest.xml @@ -6,6 +6,10 @@ android:label="Hello Map" android:icon="@mipmap/ic_launcher"> + + + + LaunchScreen UIMainStoryboardFile Main + HERECredentials + + AccessKeyId + YOUR_ACCESS_KEY_ID + AccessKeySecret + YOUR_ACCESS_KEY_SECRET + UISupportedInterfaceOrientations UIInterfaceOrientationPortrait diff --git a/examples/latest/explore/flutter/hello_map_app/lib/main.dart b/examples/latest/explore/flutter/hello_map_app/lib/main.dart index f84a60f8..d073e40c 100644 --- a/examples/latest/explore/flutter/hello_map_app/lib/main.dart +++ b/examples/latest/explore/flutter/hello_map_app/lib/main.dart @@ -19,30 +19,11 @@ import 'package:flutter/material.dart'; import 'package:here_sdk/core.dart'; -import 'package:here_sdk/core.engine.dart'; -import 'package:here_sdk/core.errors.dart'; import 'package:here_sdk/mapview.dart'; void main() async { - // Usually, you need to initialize the HERE SDK only once during the lifetime of an application. - _initializeHERESDK(); - runApp(MyApp()); -} - -void _initializeHERESDK() async { - // Needs to be called before accessing SDKOptions to load necessary libraries. SdkContext.init(IsolateOrigin.main); - - // Set your credentials for the HERE SDK. - String accessKeyId = "YOUR_ACCESS_KEY_ID"; - String accessKeySecret = "YOUR_ACCESS_KEY_SECRET"; - SDKOptions sdkOptions = SDKOptions.withAccessKeySecret(accessKeyId, accessKeySecret); - - try { - await SDKNativeEngine.makeSharedInstance(sdkOptions); - } on InstantiationException { - throw Exception("Failed to initialize the HERE SDK."); - } + runApp(MyApp()); } class MyApp extends StatelessWidget { diff --git a/examples/latest/explore/flutter/map_items_app/assets/blue_square.png b/examples/latest/explore/flutter/map_items_app/assets/blue_square.png deleted file mode 100644 index 544d343c3f9567c989b021209772cadad86577cf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1513 zcmVBE1ZQLxAY_vg;$?V;oX(lt{{G@3qJ`_O^!KmPq;Qw2}Cn0L9?Tam?khm;cmfj@-EE=vY<#k5o0f^m&*sM6pBI0EL{uRZtU4R5Z z`^X8`V)zNfJ8YaF;u6EP09P2E5Ad?jnUOMxUqvh^s*L``+lU9}BlcPZ2XpY-jyyG} zttleQMaed+noc9ry@UIIwng1*#M^^UkFzj+6yF25_LnMhmf?pGpH<}CbcnAmX|u%; z|7E#p3GpKUUAw%6atiT2#A8)^yd3Cssj4^8z$>TJnP(8+gLrkpJj%xIMEtceUz`ec zeo~wa<_{hK;NmJRuzL3+9o0iVC08s$)vACv7|KExH6jmbd4gn8^0FkllzkRT6fd|P0n zrwSVAXrbt(XrcJk;OyVRDf#{Yw^VBW$m{6QFhZvPBk<6w!tZERBfJcLd1$M3&)TehHS09YRtkN(Z(GDi^F2;vKBX;HY+Q*UEnTqUvgh@A9J5aYSek}G;8j! zqp=F+X_rylpF&#LEj%b>g+0Q~5^H*5N-?MwSLAe5T{?GXqX;9WfX;*4pXw6&V*io?m|<6;W0GAb4f<-njQ>$>Q>9MPr@ zwU=n+0I+*9IKpp9{{0u*d8K7@p9VPmCp-6AwmA>rtOL;dXv;Q$XXCx^0IWWyc=l3w zC&Xgk0yx!!!@*Zi8qcdA>-AfBZYACT*nGWS|NH%Vee(m<-vGFv{{#Oecnig2*2@3@ z061k>NoGw=04e|g00;m9hiL!=000010000Q0000000N)_00aO40096106d@r00aO4 z0096106YKy005{L%Vq!o0a8gsK~!i3?U-Q>!XONVH{(f6y#Ikryb1m7|=`(31^lp79iopfM#;;Sp*0? z!t=1|y}u6Qy}^IZt3J}w@F+^lwTjkyYB_0Mm0)B5QX?(%8%KH}HEG`}!Rd=$pDEZY zIdpFlMxF9nS49~4<CaSx7IWCY@I$IKHS2&~oX}nrE%2mXl`eyrz|`StMS4q`m8= zVDAJ=`;&0VA@6w-_D-<0KM9u{@}9pO;ig;59?H@kRLdWMmOX|Nmc+)zwOorZ>78MM z5kW|eBm|8Q6O1loT}Q#z4xinhgwG~mJ%1Qs1_LR01`3utkg%n@GxR3m87NrpK*E;p&d{5LXP{uY0|{HYJ45deyVf&wR?o_| P00000NkvXXu0mjf^T^Mn diff --git a/examples/latest/explore/flutter/map_items_app/lib/MapItemsExample.dart b/examples/latest/explore/flutter/map_items_app/lib/MapItemsExample.dart index 300c02ec..992e2b20 100644 --- a/examples/latest/explore/flutter/map_items_app/lib/MapItemsExample.dart +++ b/examples/latest/explore/flutter/map_items_app/lib/MapItemsExample.dart @@ -17,10 +17,10 @@ * License-Filename: LICENSE */ -import 'dart:io'; import 'dart:math'; import 'dart:typed_data'; +import 'package:flutter/material.dart'; import 'package:flutter/services.dart' show rootBundle; import 'package:here_sdk/core.dart'; import 'package:here_sdk/gestures.dart'; @@ -86,20 +86,28 @@ class MapItemsExample { Future showMapMarkerCluster() async { // Reuse existing MapImage for new map markers. if (_blueSquareMapImage == null) { - Uint8List imagePixelData = await _loadFileAsUint8List('assets/blue_square.png'); + Uint8List imagePixelData = await _loadFileAsUint8List('assets/green_square.png'); _blueSquareMapImage = MapImage.withPixelDataAndImageFormat(imagePixelData, ImageFormat.png); } - MapMarkerCluster mapMarkerCluster = MapMarkerCluster(MapMarkerClusterImageStyle(_blueSquareMapImage!)); + // Defines a text that indicates how many markers are included in the cluster. + MapMarkerClusterCounterStyle counterStyle = MapMarkerClusterCounterStyle(); + counterStyle.textColor = Colors.black; + counterStyle.fontSize = 40; + counterStyle.maxCountNumber = 9; + counterStyle.aboveMaxText = "+9"; + + MapMarkerCluster mapMarkerCluster = + MapMarkerCluster.WithCounter(MapMarkerClusterImageStyle(_blueSquareMapImage!), counterStyle); _hereMapController.mapScene.addMapMarkerCluster(mapMarkerCluster); _mapMarkerClusterList.add(mapMarkerCluster); for (int i = 0; i < 10; i++) { - mapMarkerCluster.addMapMarker(await _createRandomMapMarkerInViewport()); + mapMarkerCluster.addMapMarker(await _createRandomMapMarkerInViewport(i.toString())); } } - Future _createRandomMapMarkerInViewport() async { + Future _createRandomMapMarkerInViewport(String metaDataText) async { // Reuse existing MapImage for new map markers. if (_greenSquareMapImage == null) { Uint8List imagePixelData = await _loadFileAsUint8List('assets/green_square.png'); @@ -107,6 +115,11 @@ class MapItemsExample { } MapMarker mapMarker = MapMarker(_createRandomGeoCoordinatesAroundMapCenter(), _greenSquareMapImage!); + + Metadata metadata = new Metadata(); + metadata.setString("key_cluster", metaDataText); + mapMarker.metadata = metadata; + return mapMarker; } @@ -259,7 +272,6 @@ class MapItemsExample { } void _addFlatMarker(GeoCoordinates geoCoordinates) async { - Uint8List imagePixelData = await _loadFileAsUint8List('assets/poi.png'); MapImage mapImage = MapImage.withPixelDataAndImageFormat(imagePixelData, ImageFormat.png); @@ -268,7 +280,8 @@ class MapItemsExample { double scaleFactor = 0.5; // With DENSITY_INDEPENDENT_PIXELS the map marker will have a constant size on the screen regardless if the map is zoomed in or out. - MapMarker3D mapMarker3D = MapMarker3D.fromImage(geoCoordinates,mapImage, scaleFactor, RenderSizeUnit.densityIndependentPixels); + MapMarker3D mapMarker3D = + MapMarker3D.fromImage(geoCoordinates, mapImage, scaleFactor, RenderSizeUnit.densityIndependentPixels); _hereMapController.mapScene.addMapMarker3d(mapMarker3D); _mapMarker3DList.add(mapMarker3D); @@ -316,7 +329,8 @@ class MapItemsExample { // Therefore, a 3D object becomes visible when the altitude of its location is 0 or higher. // By default, without setting a scale factor, 1 unit in 3D coordinate space equals 1 meter. var altitude = 18.0; - GeoCoordinates geoCoordinatesWithAltitude = GeoCoordinates.withAltitude(geoCoordinates.latitude, geoCoordinates.longitude, altitude); + GeoCoordinates geoCoordinatesWithAltitude = + GeoCoordinates.withAltitude(geoCoordinates.latitude, geoCoordinates.longitude, altitude); // Optionally, consider to store the model for reuse (like we showed for MapImages above). MapMarker3DModel mapMarker3DModel = MapMarker3DModel.withTextureFilePath(geometryFilePath, textureFilePath); @@ -385,16 +399,37 @@ class MapItemsExample { return; } if (clusterSize == 1) { - _showDialog("Map marker picked", "This MapMarker belongs to a cluster."); + _showDialog("Map marker picked", + "This MapMarker belongs to a cluster. Metadata: " + _getClusterMetadata(topmostGrouping.markers.first)); } else { + String metadata = ""; + topmostGrouping.markers.forEach((element) { + metadata += _getClusterMetadata(element); + metadata += " "; + }); int totalSize = topmostGrouping.parent.markers.length; _showDialog( "Map marker cluster picked", "Number of contained markers in this cluster: $clusterSize." + + "Contained Metadata: " + + metadata + + ". " + "Total number of markers in this MapMarkerCluster: $totalSize."); } } + String _getClusterMetadata(MapMarker mapMarker) { + Metadata? metadata = mapMarker.metadata; + String message = "No metadata."; + if (metadata != null) { + String? string = metadata.getString("key_cluster"); + if (string != null) { + message = string; + } + } + return message; + } + void _tiltMap() { double bearing = _hereMapController.camera.state.orientationAtTarget.bearing; double tilt = 60; diff --git a/examples/latest/explore/ios/CustomRasterLayers/CustomRasterLayers/CustomRasterLayersExample.swift b/examples/latest/explore/ios/CustomRasterLayers/CustomRasterLayers/CustomRasterLayersExample.swift index bb927064..12ae9311 100644 --- a/examples/latest/explore/ios/CustomRasterLayers/CustomRasterLayers/CustomRasterLayersExample.swift +++ b/examples/latest/explore/ios/CustomRasterLayers/CustomRasterLayers/CustomRasterLayersExample.swift @@ -73,7 +73,7 @@ class CustomRasterLayersExample { // Raster tiles are stored in a separate cache on the device. let path = "cache/raster/toner" - let maxDiskSizeInBytes: Int64 = 1024 * 1024 * 32 + let maxDiskSizeInBytes: Int64 = 1024 * 1024 * 128 // 128 MB let cacheConfig = RasterDataSourceConfiguration.Cache(path: path, diskSize: maxDiskSizeInBytes) diff --git a/examples/latest/explore/ios/HelloMapCarPlay/HelloMapCarPlay/CarPlayViewController.swift b/examples/latest/explore/ios/HelloMapCarPlay/HelloMapCarPlay/CarPlayViewController.swift index 8693d76c..256595cc 100644 --- a/examples/latest/explore/ios/HelloMapCarPlay/HelloMapCarPlay/CarPlayViewController.swift +++ b/examples/latest/explore/ios/HelloMapCarPlay/HelloMapCarPlay/CarPlayViewController.swift @@ -47,9 +47,6 @@ class CarPlayViewController: UIViewController { let camera = mapView.camera let distanceInMeters = MapMeasure(kind: .distance, value: 1000 * 10) camera.lookAt(point: GeoCoordinates(latitude: 52.518043, longitude: 13.405991), zoom: distanceInMeters) - - // Optionally enable textured 3D landmarks. - mapView.mapScene.setLayerVisibility(layerName: MapScene.Layers.landmarks, visibility: VisibilityState.visible) } public func zoomIn() { diff --git a/examples/latest/explore/ios/MapItems/MapItems/Assets.xcassets/blue_square.imageset/Contents.json b/examples/latest/explore/ios/MapItems/MapItems/Assets.xcassets/blue_square.imageset/Contents.json deleted file mode 100644 index 8612dc0f..00000000 --- a/examples/latest/explore/ios/MapItems/MapItems/Assets.xcassets/blue_square.imageset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "images" : [ - { - "filename" : "blue_square.png", - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/examples/latest/explore/ios/MapItems/MapItems/Assets.xcassets/blue_square.imageset/blue_square.png b/examples/latest/explore/ios/MapItems/MapItems/Assets.xcassets/blue_square.imageset/blue_square.png deleted file mode 100644 index 544d343c3f9567c989b021209772cadad86577cf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1513 zcmVBE1ZQLxAY_vg;$?V;oX(lt{{G@3qJ`_O^!KmPq;Qw2}Cn0L9?Tam?khm;cmfj@-EE=vY<#k5o0f^m&*sM6pBI0EL{uRZtU4R5Z z`^X8`V)zNfJ8YaF;u6EP09P2E5Ad?jnUOMxUqvh^s*L``+lU9}BlcPZ2XpY-jyyG} zttleQMaed+noc9ry@UIIwng1*#M^^UkFzj+6yF25_LnMhmf?pGpH<}CbcnAmX|u%; z|7E#p3GpKUUAw%6atiT2#A8)^yd3Cssj4^8z$>TJnP(8+gLrkpJj%xIMEtceUz`ec zeo~wa<_{hK;NmJRuzL3+9o0iVC08s$)vACv7|KExH6jmbd4gn8^0FkllzkRT6fd|P0n zrwSVAXrbt(XrcJk;OyVRDf#{Yw^VBW$m{6QFhZvPBk<6w!tZERBfJcLd1$M3&)TehHS09YRtkN(Z(GDi^F2;vKBX;HY+Q*UEnTqUvgh@A9J5aYSek}G;8j! zqp=F+X_rylpF&#LEj%b>g+0Q~5^H*5N-?MwSLAe5T{?GXqX;9WfX;*4pXw6&V*io?m|<6;W0GAb4f<-njQ>$>Q>9MPr@ zwU=n+0I+*9IKpp9{{0u*d8K7@p9VPmCp-6AwmA>rtOL;dXv;Q$XXCx^0IWWyc=l3w zC&Xgk0yx!!!@*Zi8qcdA>-AfBZYACT*nGWS|NH%Vee(m<-vGFv{{#Oecnig2*2@3@ z061k>NoGw=04e|g00;m9hiL!=000010000Q0000000N)_00aO40096106d@r00aO4 z0096106YKy005{L%Vq!o0a8gsK~!i3?U-Q>!XONVH{(f6y#Ikryb1m7|=`(31^lp79iopfM#;;Sp*0? z!t=1|y}u6Qy}^IZt3J}w@F+^lwTjkyYB_0Mm0)B5QX?(%8%KH}HEG`}!Rd=$pDEZY zIdpFlMxF9nS49~4<CaSx7IWCY@I$IKHS2&~oX}nrE%2mXl`eyrz|`StMS4q`m8= zVDAJ=`;&0VA@6w-_D-<0KM9u{@}9pO;ig;59?H@kRLdWMmOX|Nmc+)zwOorZ>78MM z5kW|eBm|8Q6O1loT}Q#z4xinhgwG~mJ%1Qs1_LR01`3utkg%n@GxR3m87NrpK*E;p&d{5LXP{uY0|{HYJ45deyVf&wR?o_| P00000NkvXXu0mjf^T^Mn diff --git a/examples/latest/explore/ios/MapItems/MapItems/MapItemsExample.swift b/examples/latest/explore/ios/MapItems/MapItems/MapItemsExample.swift index 379da062..17bf0a87 100644 --- a/examples/latest/explore/ios/MapItems/MapItems/MapItemsExample.swift +++ b/examples/latest/explore/ios/MapItems/MapItems/MapItemsExample.swift @@ -72,7 +72,7 @@ class MapItemsExample: TapDelegate { func onMapMarkerClusterButtonClicked() { guard - let image = UIImage(named: "blue_square.png"), + let image = UIImage(named: "green_square.png"), let imageData = image.pngData() else { print("Error: Image not found.") return @@ -81,16 +81,27 @@ class MapItemsExample: TapDelegate { let clusterMapImage = MapImage(pixelData: imageData, imageFormat: ImageFormat.png) - let mapMarkerCluster = MapMarkerCluster(imageStyle: MapMarkerCluster.ImageStyle(image: clusterMapImage)) + // Defines a text that indicates how many markers are included in the cluster. + var counterStyle = MapMarkerCluster.CounterStyle() + counterStyle.textColor = UIColor.black + counterStyle.fontSize = 40 + counterStyle.maxCountNumber = 9 + counterStyle.aboveMaxText = "+9" + + let mapMarkerCluster = MapMarkerCluster(imageStyle: MapMarkerCluster.ImageStyle(image: clusterMapImage), + counterStyle: counterStyle) mapView.mapScene.addMapMarkerCluster(mapMarkerCluster) mapMarkerClusters.append(mapMarkerCluster) + var index = 1 for _ in 1...10 { - mapMarkerCluster.addMapMarker(marker: createRandomMapMarkerInViewport()) + let indexString = String(index) + mapMarkerCluster.addMapMarker(marker: createRandomMapMarkerInViewport(indexString)) + index = index + 1 } } - func createRandomMapMarkerInViewport() -> MapMarker { + func createRandomMapMarkerInViewport(_ metaDataText: String) -> MapMarker { let geoCoordinates = createRandomGeoCoordinatesAroundMapCenter() guard let image = UIImage(named: "green_square.png"), @@ -101,6 +112,11 @@ class MapItemsExample: TapDelegate { let mapImage = MapImage(pixelData: imageData, imageFormat: ImageFormat.png) let mapMarker = MapMarker(at: geoCoordinates, image: mapImage) + + let metadata = Metadata() + metadata.setString(key: "key_cluster", value: metaDataText) + mapMarker.metadata = metadata + return mapMarker } @@ -390,13 +406,27 @@ class MapItemsExample: TapDelegate { return } if (clusterSize == 1) { - showDialog(title: "Map Marker picked", message: "This MapMarker belongs to a cluster.") + let metadata = getClusterMetadata(topmostGrouping.markers.first!) + showDialog(title: "Map Marker picked", message: "This MapMarker belongs to a cluster. Metadata: \(metadata)") } else { + var metadata = "" + for mapMarker in topmostGrouping.markers { + metadata += getClusterMetadata(mapMarker) + metadata += " " + } + let metadataMessage = "Contained Metadata: " + metadata + ". " showDialog(title: "Map marker cluster picked", - message: "Number of contained markers in this cluster: \(clusterSize). Total number of markers in this MapMarkerCluster: \(topmostGrouping.parent.markers.count)") + message: "Number of contained markers in this cluster: \(clusterSize). \(metadataMessage) Total number of markers in this MapMarkerCluster: \(topmostGrouping.parent.markers.count)") } } + private func getClusterMetadata(_ mapMarker: MapMarker) -> String { + if let message = mapMarker.metadata?.getString(key: "key_cluster") { + return message + } + return "No metadata." + } + private func createRandomGeoCoordinatesAroundMapCenter() -> GeoCoordinates { let scaleFactor = UIScreen.main.scale let mapViewWidthInPixels = Double(mapView.bounds.width * scaleFactor) diff --git a/examples/latest/navigate/android/CustomRasterLayers/app/src/main/java/com/here/sdk/customrasterlayers/CustomRasterLayersExample.java b/examples/latest/navigate/android/CustomRasterLayers/app/src/main/java/com/here/sdk/customrasterlayers/CustomRasterLayersExample.java index 7c4c6c38..834845e1 100644 --- a/examples/latest/navigate/android/CustomRasterLayers/app/src/main/java/com/here/sdk/customrasterlayers/CustomRasterLayersExample.java +++ b/examples/latest/navigate/android/CustomRasterLayers/app/src/main/java/com/here/sdk/customrasterlayers/CustomRasterLayersExample.java @@ -98,7 +98,7 @@ private RasterDataSource createRasterDataSource(String dataSourceName) { // Raster tiles are stored in a separate cache on the device. String path = "cache/raster/toner"; - long maxDiskSizeInBytes = 1024 * 1024 * 32; + long maxDiskSizeInBytes = 1024 * 1024 * 128; // 128 RasterDataSourceConfiguration.Cache cacheConfig = new RasterDataSourceConfiguration.Cache(path, maxDiskSizeInBytes); // Note that this will make the raster source already known to the passed map view. diff --git a/examples/latest/navigate/android/HelloMapAndroidAuto/app/src/main/java/com/here/hellomapandroidauto/MainActivity.java b/examples/latest/navigate/android/HelloMapAndroidAuto/app/src/main/java/com/here/hellomapandroidauto/MainActivity.java index 230acd8f..8b12297e 100644 --- a/examples/latest/navigate/android/HelloMapAndroidAuto/app/src/main/java/com/here/hellomapandroidauto/MainActivity.java +++ b/examples/latest/navigate/android/HelloMapAndroidAuto/app/src/main/java/com/here/hellomapandroidauto/MainActivity.java @@ -36,7 +36,6 @@ import com.here.sdk.mapview.MapScene; import com.here.sdk.mapview.MapScheme; import com.here.sdk.mapview.MapView; -import com.here.sdk.mapview.VisibilityState; public class MainActivity extends AppCompatActivity { diff --git a/examples/latest/navigate/android/IndoorMap/app/src/main/java/com/here/sdk/examples/venues/MainActivity.java b/examples/latest/navigate/android/IndoorMap/app/src/main/java/com/here/sdk/examples/venues/MainActivity.java index b529aed0..390ef72f 100644 --- a/examples/latest/navigate/android/IndoorMap/app/src/main/java/com/here/sdk/examples/venues/MainActivity.java +++ b/examples/latest/navigate/android/IndoorMap/app/src/main/java/com/here/sdk/examples/venues/MainActivity.java @@ -50,6 +50,7 @@ import com.here.sdk.venue.service.VenueServiceListener; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; public class MainActivity extends AppCompatActivity { @@ -68,6 +69,9 @@ public class MainActivity extends AppCompatActivity { // Replace "CATALOG_HRN" with your platform catalog HRN value. private final String HRN = "CATALOG_HRN"; + //Label text preference as per user choice + private final List labelPref = Arrays.asList("OCCUPANT_NAMES", "SPACE_NAME", "INTERNAL_ADDRESS"); + @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -94,8 +98,8 @@ protected void onCreate(Bundle savedInstanceState) { private void initializeHERESDK() { // Set your credentials for the HERE SDK. - String accessKeyID = "YOUR_ACCESS_KEY_ID"; - String accessKeySecret = "YOUR_ACCESS_KEY_SECRET"; + String accessKeyID = "VENUE_ACCESS_KEY_ID"; + String accessKeySecret = "VENUE_ACCESS_KEY_SECRET"; SDKOptions options = new SDKOptions(accessKeyID, accessKeySecret); try { Context context = this; @@ -189,6 +193,9 @@ private void onVenueEngineInitCompleted() { // Set platform catalog HRN service.setHrn(HRN); + + // Set label text preference + service.setLabeltextPreference(labelPref); } // Listener for the VenueService event. @@ -304,7 +311,9 @@ protected void onDestroy() { mapView.getGestures().setTapListener(null); mapView.getGestures().setLongPressListener(null); } - venueEngine.destroy(); + if(venueEngine != null) { + venueEngine.destroy(); + } mapView.onDestroy(); disposeHERESDK(); super.onDestroy(); diff --git a/examples/latest/navigate/android/MapItems/app/src/main/java/com/here/mapitems/MapItemsExample.java b/examples/latest/navigate/android/MapItems/app/src/main/java/com/here/mapitems/MapItemsExample.java index c220bcb3..d75e7b5c 100644 --- a/examples/latest/navigate/android/MapItems/app/src/main/java/com/here/mapitems/MapItemsExample.java +++ b/examples/latest/navigate/android/MapItems/app/src/main/java/com/here/mapitems/MapItemsExample.java @@ -29,6 +29,7 @@ import androidx.appcompat.app.AlertDialog; import com.here.sdk.core.Anchor2D; +import com.here.sdk.core.Color; import com.here.sdk.core.GeoCoordinates; import com.here.sdk.core.GeoOrientationUpdate; import com.here.sdk.core.Location; @@ -101,20 +102,36 @@ public void showCenteredMapMarkers() { } public void showMapMarkerCluster() { - MapImage clusterMapImage = MapImageFactory.fromResource(context.getResources(), R.drawable.blue_square); - MapMarkerCluster mapMarkerCluster = new MapMarkerCluster(new MapMarkerCluster.ImageStyle(clusterMapImage)); + MapImage clusterMapImage = MapImageFactory.fromResource(context.getResources(), R.drawable.green_square); + + // Defines a text that indicates how many markers are included in the cluster. + MapMarkerCluster.CounterStyle counterStyle = new MapMarkerCluster.CounterStyle(); + counterStyle.textColor = new Color(0, 0, 0, 1); // Black + counterStyle.fontSize = 40; + counterStyle.maxCountNumber = 9; + counterStyle.aboveMaxText = "+9"; + + MapMarkerCluster mapMarkerCluster = new MapMarkerCluster( + new MapMarkerCluster.ImageStyle(clusterMapImage), counterStyle); mapView.getMapScene().addMapMarkerCluster(mapMarkerCluster); mapMarkerClusterList.add(mapMarkerCluster); for (int i = 0; i < 10; i++) { - mapMarkerCluster.addMapMarker(createRandomMapMarkerInViewport()); + mapMarkerCluster.addMapMarker(createRandomMapMarkerInViewport("" + i)); } } - private MapMarker createRandomMapMarkerInViewport() { + private MapMarker createRandomMapMarkerInViewport(String metaDataText) { GeoCoordinates geoCoordinates = createRandomGeoCoordinatesAroundMapCenter(); MapImage mapImage = MapImageFactory.fromResource(context.getResources(), R.drawable.green_square); - return new MapMarker(geoCoordinates, mapImage); + + MapMarker mapMarker = new MapMarker(geoCoordinates, mapImage); + + Metadata metadata = new Metadata(); + metadata.setString("key_cluster", metaDataText); + mapMarker.setMetadata(metadata); + + return mapMarker; } public void showLocationIndicatorPedestrian() { @@ -403,14 +420,32 @@ private void handlePickedMapMarkerClusters(PickMapItemsResult pickMapItemsResult } if (clusterSize == 1) { showDialog("Map marker picked", - "This MapMarker belongs to a cluster."); + "This MapMarker belongs to a cluster. Metadata: " + getClusterMetadata(topmostGrouping.markers.get(0))); } else { + String metadata = ""; + for (MapMarker mapMarker: topmostGrouping.markers) { + metadata += getClusterMetadata(mapMarker); + metadata += " "; + } showDialog("Map marker cluster picked", "Number of contained markers in this cluster: " + clusterSize + ". " + + "Contained Metadata: " + metadata + ". " + "Total number of markers in this MapMarkerCluster: " + topmostGrouping.parent.getMarkers().size()); } } + private String getClusterMetadata(MapMarker mapMarker) { + Metadata metadata = mapMarker.getMetadata(); + String message = "No metadata."; + if (metadata != null) { + String string = metadata.getString("key_cluster"); + if (string != null) { + message = string; + } + } + return message; + } + private void tiltMap() { double bearing = mapView.getCamera().getState().orientationAtTarget.bearing; double tilt = 60; diff --git a/examples/latest/navigate/android/MapItems/app/src/main/res/drawable-nodpi/blue_square.png b/examples/latest/navigate/android/MapItems/app/src/main/res/drawable-nodpi/blue_square.png deleted file mode 100644 index 544d343c3f9567c989b021209772cadad86577cf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1513 zcmVBE1ZQLxAY_vg;$?V;oX(lt{{G@3qJ`_O^!KmPq;Qw2}Cn0L9?Tam?khm;cmfj@-EE=vY<#k5o0f^m&*sM6pBI0EL{uRZtU4R5Z z`^X8`V)zNfJ8YaF;u6EP09P2E5Ad?jnUOMxUqvh^s*L``+lU9}BlcPZ2XpY-jyyG} zttleQMaed+noc9ry@UIIwng1*#M^^UkFzj+6yF25_LnMhmf?pGpH<}CbcnAmX|u%; z|7E#p3GpKUUAw%6atiT2#A8)^yd3Cssj4^8z$>TJnP(8+gLrkpJj%xIMEtceUz`ec zeo~wa<_{hK;NmJRuzL3+9o0iVC08s$)vACv7|KExH6jmbd4gn8^0FkllzkRT6fd|P0n zrwSVAXrbt(XrcJk;OyVRDf#{Yw^VBW$m{6QFhZvPBk<6w!tZERBfJcLd1$M3&)TehHS09YRtkN(Z(GDi^F2;vKBX;HY+Q*UEnTqUvgh@A9J5aYSek}G;8j! zqp=F+X_rylpF&#LEj%b>g+0Q~5^H*5N-?MwSLAe5T{?GXqX;9WfX;*4pXw6&V*io?m|<6;W0GAb4f<-njQ>$>Q>9MPr@ zwU=n+0I+*9IKpp9{{0u*d8K7@p9VPmCp-6AwmA>rtOL;dXv;Q$XXCx^0IWWyc=l3w zC&Xgk0yx!!!@*Zi8qcdA>-AfBZYACT*nGWS|NH%Vee(m<-vGFv{{#Oecnig2*2@3@ z061k>NoGw=04e|g00;m9hiL!=000010000Q0000000N)_00aO40096106d@r00aO4 z0096106YKy005{L%Vq!o0a8gsK~!i3?U-Q>!XONVH{(f6y#Ikryb1m7|=`(31^lp79iopfM#;;Sp*0? z!t=1|y}u6Qy}^IZt3J}w@F+^lwTjkyYB_0Mm0)B5QX?(%8%KH}HEG`}!Rd=$pDEZY zIdpFlMxF9nS49~4<CaSx7IWCY@I$IKHS2&~oX}nrE%2mXl`eyrz|`StMS4q`m8= zVDAJ=`;&0VA@6w-_D-<0KM9u{@}9pO;ig;59?H@kRLdWMmOX|Nmc+)zwOorZ>78MM z5kW|eBm|8Q6O1loT}Q#z4xinhgwG~mJ%1Qs1_LR01`3utkg%n@GxR3m87NrpK*E;p&d{5LXP{uY0|{HYJ45deyVf&wR?o_| P00000NkvXXu0mjf^T^Mn diff --git a/examples/latest/navigate/android/NavigationCustom/app/src/main/java/com/here/navigationcustom/MainActivity.java b/examples/latest/navigate/android/NavigationCustom/app/src/main/java/com/here/navigationcustom/MainActivity.java index b010d099..f58a11cb 100644 --- a/examples/latest/navigate/android/NavigationCustom/app/src/main/java/com/here/navigationcustom/MainActivity.java +++ b/examples/latest/navigate/android/NavigationCustom/app/src/main/java/com/here/navigationcustom/MainActivity.java @@ -72,7 +72,6 @@ public class MainActivity extends AppCompatActivity { private static final String TAG = MainActivity.class.getSimpleName(); - private static final GeoCoordinates ROUTE_START_GEO_COORDINATES = new GeoCoordinates(52.520798, 13.409408); private static final double DISTANCE_IN_METERS = 1000; private PermissionsRequestor permissionsRequestor; @@ -83,6 +82,7 @@ public class MainActivity extends AppCompatActivity { private LocationIndicator defaultLocationIndicator; private LocationIndicator customLocationIndicator; private Location lastKnownLocation = null; + private GeoCoordinates routeStartGeoCoordinates; private boolean isVisualNavigatorRenderingStarted = false; private boolean isDefaultLocationIndicator = true; @@ -141,6 +141,8 @@ public void onRequestPermissionsResult(int requestCode, @NonNull String[] permis } private void loadMapScene() { + routeStartGeoCoordinates = new GeoCoordinates(52.520798, 13.409408); + // Load a scene from the HERE SDK to render the map with a map scheme. mapView.getMapScene().loadScene(MapScheme.NORMAL_DAY, new MapScene.LoadSceneCallback() { @Override @@ -148,7 +150,7 @@ public void onLoadScene(@Nullable MapError mapError) { if (mapError == null) { MapMeasure mapMeasureZoom = new MapMeasure(MapMeasure.Kind.DISTANCE, DISTANCE_IN_METERS); mapView.getCamera().lookAt( - ROUTE_START_GEO_COORDINATES, mapMeasureZoom); + routeStartGeoCoordinates, mapMeasureZoom); startAppLogic(); } else { Log.d(TAG, "Loading map failed: mapError: " + mapError.name()); @@ -210,7 +212,7 @@ private LocationIndicator createCustomLocationIndicator() { // Calculate a fixed route for testing and start guidance simulation along the route. public void startButtonClicked(View view) { - Waypoint startWaypoint = new Waypoint(ROUTE_START_GEO_COORDINATES); + Waypoint startWaypoint = new Waypoint(routeStartGeoCoordinates); Waypoint destinationWaypoint = new Waypoint(new GeoCoordinates(52.530905, 13.385007)); routingEngine.calculateRoute( new ArrayList<>(Arrays.asList(startWaypoint, destinationWaypoint)), @@ -288,7 +290,7 @@ private Location getLastKnownLocationLocation() { // including a bearing direction. // For testing purposes, we create below a Location object. Usually, you want to get this from // a GPS sensor instead. Check the Positioning example app for this. - Location location = new Location(ROUTE_START_GEO_COORDINATES); + Location location = new Location(routeStartGeoCoordinates); location.time = new Date(); location.bearingInDegrees = 0.0; return location; diff --git a/examples/latest/navigate/flutter/custom_raster_layers_app/lib/CustomRasterLayersExample.dart b/examples/latest/navigate/flutter/custom_raster_layers_app/lib/CustomRasterLayersExample.dart index 9e73c4da..936cc3b9 100644 --- a/examples/latest/navigate/flutter/custom_raster_layers_app/lib/CustomRasterLayersExample.dart +++ b/examples/latest/navigate/flutter/custom_raster_layers_app/lib/CustomRasterLayersExample.dart @@ -70,7 +70,7 @@ class CustomRasterLayersExample { // Raster tiles are stored in a separate cache on the device. String path = "cache/raster/toner"; - int maxDiskSizeInBytes = 1024 * 1024 * 32; + int maxDiskSizeInBytes = 1024 * 1024 * 128; // 128 MB RasterDataSourceCacheConfiguration cacheConfig = RasterDataSourceCacheConfiguration(path, maxDiskSizeInBytes); // Note that this will make the raster source already known to the passed map view. diff --git a/examples/latest/navigate/flutter/hello_map_app/android/app/src/main/AndroidManifest.xml b/examples/latest/navigate/flutter/hello_map_app/android/app/src/main/AndroidManifest.xml index 681c2d01..30269a34 100644 --- a/examples/latest/navigate/flutter/hello_map_app/android/app/src/main/AndroidManifest.xml +++ b/examples/latest/navigate/flutter/hello_map_app/android/app/src/main/AndroidManifest.xml @@ -6,6 +6,10 @@ android:label="Hello Map" android:icon="@mipmap/ic_launcher"> + + + + LaunchScreen UIMainStoryboardFile Main + HERECredentials + + AccessKeyId + YOUR_ACCESS_KEY_ID + AccessKeySecret + YOUR_ACCESS_KEY_SECRET + UISupportedInterfaceOrientations UIInterfaceOrientationPortrait diff --git a/examples/latest/navigate/flutter/hello_map_app/lib/main.dart b/examples/latest/navigate/flutter/hello_map_app/lib/main.dart index f84a60f8..d073e40c 100644 --- a/examples/latest/navigate/flutter/hello_map_app/lib/main.dart +++ b/examples/latest/navigate/flutter/hello_map_app/lib/main.dart @@ -19,30 +19,11 @@ import 'package:flutter/material.dart'; import 'package:here_sdk/core.dart'; -import 'package:here_sdk/core.engine.dart'; -import 'package:here_sdk/core.errors.dart'; import 'package:here_sdk/mapview.dart'; void main() async { - // Usually, you need to initialize the HERE SDK only once during the lifetime of an application. - _initializeHERESDK(); - runApp(MyApp()); -} - -void _initializeHERESDK() async { - // Needs to be called before accessing SDKOptions to load necessary libraries. SdkContext.init(IsolateOrigin.main); - - // Set your credentials for the HERE SDK. - String accessKeyId = "YOUR_ACCESS_KEY_ID"; - String accessKeySecret = "YOUR_ACCESS_KEY_SECRET"; - SDKOptions sdkOptions = SDKOptions.withAccessKeySecret(accessKeyId, accessKeySecret); - - try { - await SDKNativeEngine.makeSharedInstance(sdkOptions); - } on InstantiationException { - throw Exception("Failed to initialize the HERE SDK."); - } + runApp(MyApp()); } class MyApp extends StatelessWidget { diff --git a/examples/latest/navigate/flutter/indoor_map_app/lib/venue_engine_widget.dart b/examples/latest/navigate/flutter/indoor_map_app/lib/venue_engine_widget.dart index fb6ab5c6..2065ad16 100644 --- a/examples/latest/navigate/flutter/indoor_map_app/lib/venue_engine_widget.dart +++ b/examples/latest/navigate/flutter/indoor_map_app/lib/venue_engine_widget.dart @@ -64,6 +64,9 @@ class VenueEngineState extends State { // Replace "CATALOG_HRN" with your platform catalog HRN value. final String HRN = "CATALOG_HRN"; + //Label text preference as per user choice + final List _labelPref = ["OCCUPANT_NAMES", "SPACE_NAME", "INTERNAL_ADDRESS"]; + @override Widget build(BuildContext context) { return Stack(children: [ @@ -141,6 +144,9 @@ class VenueEngineState extends State { // Set platform catalog HRN venueEngine!.venueService.setHrn(HRN); + + // Set label text preference + venueEngine!.venueService.setLabeltextPreference(_labelPref); } _onAuthCallback(AuthenticationError? error, AuthenticationData? data) { diff --git a/examples/latest/navigate/flutter/map_items_app/assets/blue_square.png b/examples/latest/navigate/flutter/map_items_app/assets/blue_square.png deleted file mode 100644 index 544d343c3f9567c989b021209772cadad86577cf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1513 zcmVBE1ZQLxAY_vg;$?V;oX(lt{{G@3qJ`_O^!KmPq;Qw2}Cn0L9?Tam?khm;cmfj@-EE=vY<#k5o0f^m&*sM6pBI0EL{uRZtU4R5Z z`^X8`V)zNfJ8YaF;u6EP09P2E5Ad?jnUOMxUqvh^s*L``+lU9}BlcPZ2XpY-jyyG} zttleQMaed+noc9ry@UIIwng1*#M^^UkFzj+6yF25_LnMhmf?pGpH<}CbcnAmX|u%; z|7E#p3GpKUUAw%6atiT2#A8)^yd3Cssj4^8z$>TJnP(8+gLrkpJj%xIMEtceUz`ec zeo~wa<_{hK;NmJRuzL3+9o0iVC08s$)vACv7|KExH6jmbd4gn8^0FkllzkRT6fd|P0n zrwSVAXrbt(XrcJk;OyVRDf#{Yw^VBW$m{6QFhZvPBk<6w!tZERBfJcLd1$M3&)TehHS09YRtkN(Z(GDi^F2;vKBX;HY+Q*UEnTqUvgh@A9J5aYSek}G;8j! zqp=F+X_rylpF&#LEj%b>g+0Q~5^H*5N-?MwSLAe5T{?GXqX;9WfX;*4pXw6&V*io?m|<6;W0GAb4f<-njQ>$>Q>9MPr@ zwU=n+0I+*9IKpp9{{0u*d8K7@p9VPmCp-6AwmA>rtOL;dXv;Q$XXCx^0IWWyc=l3w zC&Xgk0yx!!!@*Zi8qcdA>-AfBZYACT*nGWS|NH%Vee(m<-vGFv{{#Oecnig2*2@3@ z061k>NoGw=04e|g00;m9hiL!=000010000Q0000000N)_00aO40096106d@r00aO4 z0096106YKy005{L%Vq!o0a8gsK~!i3?U-Q>!XONVH{(f6y#Ikryb1m7|=`(31^lp79iopfM#;;Sp*0? z!t=1|y}u6Qy}^IZt3J}w@F+^lwTjkyYB_0Mm0)B5QX?(%8%KH}HEG`}!Rd=$pDEZY zIdpFlMxF9nS49~4<CaSx7IWCY@I$IKHS2&~oX}nrE%2mXl`eyrz|`StMS4q`m8= zVDAJ=`;&0VA@6w-_D-<0KM9u{@}9pO;ig;59?H@kRLdWMmOX|Nmc+)zwOorZ>78MM z5kW|eBm|8Q6O1loT}Q#z4xinhgwG~mJ%1Qs1_LR01`3utkg%n@GxR3m87NrpK*E;p&d{5LXP{uY0|{HYJ45deyVf&wR?o_| P00000NkvXXu0mjf^T^Mn diff --git a/examples/latest/navigate/flutter/map_items_app/lib/MapItemsExample.dart b/examples/latest/navigate/flutter/map_items_app/lib/MapItemsExample.dart index 300c02ec..992e2b20 100644 --- a/examples/latest/navigate/flutter/map_items_app/lib/MapItemsExample.dart +++ b/examples/latest/navigate/flutter/map_items_app/lib/MapItemsExample.dart @@ -17,10 +17,10 @@ * License-Filename: LICENSE */ -import 'dart:io'; import 'dart:math'; import 'dart:typed_data'; +import 'package:flutter/material.dart'; import 'package:flutter/services.dart' show rootBundle; import 'package:here_sdk/core.dart'; import 'package:here_sdk/gestures.dart'; @@ -86,20 +86,28 @@ class MapItemsExample { Future showMapMarkerCluster() async { // Reuse existing MapImage for new map markers. if (_blueSquareMapImage == null) { - Uint8List imagePixelData = await _loadFileAsUint8List('assets/blue_square.png'); + Uint8List imagePixelData = await _loadFileAsUint8List('assets/green_square.png'); _blueSquareMapImage = MapImage.withPixelDataAndImageFormat(imagePixelData, ImageFormat.png); } - MapMarkerCluster mapMarkerCluster = MapMarkerCluster(MapMarkerClusterImageStyle(_blueSquareMapImage!)); + // Defines a text that indicates how many markers are included in the cluster. + MapMarkerClusterCounterStyle counterStyle = MapMarkerClusterCounterStyle(); + counterStyle.textColor = Colors.black; + counterStyle.fontSize = 40; + counterStyle.maxCountNumber = 9; + counterStyle.aboveMaxText = "+9"; + + MapMarkerCluster mapMarkerCluster = + MapMarkerCluster.WithCounter(MapMarkerClusterImageStyle(_blueSquareMapImage!), counterStyle); _hereMapController.mapScene.addMapMarkerCluster(mapMarkerCluster); _mapMarkerClusterList.add(mapMarkerCluster); for (int i = 0; i < 10; i++) { - mapMarkerCluster.addMapMarker(await _createRandomMapMarkerInViewport()); + mapMarkerCluster.addMapMarker(await _createRandomMapMarkerInViewport(i.toString())); } } - Future _createRandomMapMarkerInViewport() async { + Future _createRandomMapMarkerInViewport(String metaDataText) async { // Reuse existing MapImage for new map markers. if (_greenSquareMapImage == null) { Uint8List imagePixelData = await _loadFileAsUint8List('assets/green_square.png'); @@ -107,6 +115,11 @@ class MapItemsExample { } MapMarker mapMarker = MapMarker(_createRandomGeoCoordinatesAroundMapCenter(), _greenSquareMapImage!); + + Metadata metadata = new Metadata(); + metadata.setString("key_cluster", metaDataText); + mapMarker.metadata = metadata; + return mapMarker; } @@ -259,7 +272,6 @@ class MapItemsExample { } void _addFlatMarker(GeoCoordinates geoCoordinates) async { - Uint8List imagePixelData = await _loadFileAsUint8List('assets/poi.png'); MapImage mapImage = MapImage.withPixelDataAndImageFormat(imagePixelData, ImageFormat.png); @@ -268,7 +280,8 @@ class MapItemsExample { double scaleFactor = 0.5; // With DENSITY_INDEPENDENT_PIXELS the map marker will have a constant size on the screen regardless if the map is zoomed in or out. - MapMarker3D mapMarker3D = MapMarker3D.fromImage(geoCoordinates,mapImage, scaleFactor, RenderSizeUnit.densityIndependentPixels); + MapMarker3D mapMarker3D = + MapMarker3D.fromImage(geoCoordinates, mapImage, scaleFactor, RenderSizeUnit.densityIndependentPixels); _hereMapController.mapScene.addMapMarker3d(mapMarker3D); _mapMarker3DList.add(mapMarker3D); @@ -316,7 +329,8 @@ class MapItemsExample { // Therefore, a 3D object becomes visible when the altitude of its location is 0 or higher. // By default, without setting a scale factor, 1 unit in 3D coordinate space equals 1 meter. var altitude = 18.0; - GeoCoordinates geoCoordinatesWithAltitude = GeoCoordinates.withAltitude(geoCoordinates.latitude, geoCoordinates.longitude, altitude); + GeoCoordinates geoCoordinatesWithAltitude = + GeoCoordinates.withAltitude(geoCoordinates.latitude, geoCoordinates.longitude, altitude); // Optionally, consider to store the model for reuse (like we showed for MapImages above). MapMarker3DModel mapMarker3DModel = MapMarker3DModel.withTextureFilePath(geometryFilePath, textureFilePath); @@ -385,16 +399,37 @@ class MapItemsExample { return; } if (clusterSize == 1) { - _showDialog("Map marker picked", "This MapMarker belongs to a cluster."); + _showDialog("Map marker picked", + "This MapMarker belongs to a cluster. Metadata: " + _getClusterMetadata(topmostGrouping.markers.first)); } else { + String metadata = ""; + topmostGrouping.markers.forEach((element) { + metadata += _getClusterMetadata(element); + metadata += " "; + }); int totalSize = topmostGrouping.parent.markers.length; _showDialog( "Map marker cluster picked", "Number of contained markers in this cluster: $clusterSize." + + "Contained Metadata: " + + metadata + + ". " + "Total number of markers in this MapMarkerCluster: $totalSize."); } } + String _getClusterMetadata(MapMarker mapMarker) { + Metadata? metadata = mapMarker.metadata; + String message = "No metadata."; + if (metadata != null) { + String? string = metadata.getString("key_cluster"); + if (string != null) { + message = string; + } + } + return message; + } + void _tiltMap() { double bearing = _hereMapController.camera.state.orientationAtTarget.bearing; double tilt = 60; diff --git a/examples/latest/navigate/ios/CustomRasterLayers/CustomRasterLayers/CustomRasterLayersExample.swift b/examples/latest/navigate/ios/CustomRasterLayers/CustomRasterLayers/CustomRasterLayersExample.swift index bb927064..12ae9311 100644 --- a/examples/latest/navigate/ios/CustomRasterLayers/CustomRasterLayers/CustomRasterLayersExample.swift +++ b/examples/latest/navigate/ios/CustomRasterLayers/CustomRasterLayers/CustomRasterLayersExample.swift @@ -73,7 +73,7 @@ class CustomRasterLayersExample { // Raster tiles are stored in a separate cache on the device. let path = "cache/raster/toner" - let maxDiskSizeInBytes: Int64 = 1024 * 1024 * 32 + let maxDiskSizeInBytes: Int64 = 1024 * 1024 * 128 // 128 MB let cacheConfig = RasterDataSourceConfiguration.Cache(path: path, diskSize: maxDiskSizeInBytes) diff --git a/examples/latest/navigate/ios/HelloMapCarPlay/HelloMapCarPlay/CarPlayViewController.swift b/examples/latest/navigate/ios/HelloMapCarPlay/HelloMapCarPlay/CarPlayViewController.swift index 8693d76c..256595cc 100644 --- a/examples/latest/navigate/ios/HelloMapCarPlay/HelloMapCarPlay/CarPlayViewController.swift +++ b/examples/latest/navigate/ios/HelloMapCarPlay/HelloMapCarPlay/CarPlayViewController.swift @@ -47,9 +47,6 @@ class CarPlayViewController: UIViewController { let camera = mapView.camera let distanceInMeters = MapMeasure(kind: .distance, value: 1000 * 10) camera.lookAt(point: GeoCoordinates(latitude: 52.518043, longitude: 13.405991), zoom: distanceInMeters) - - // Optionally enable textured 3D landmarks. - mapView.mapScene.setLayerVisibility(layerName: MapScene.Layers.landmarks, visibility: VisibilityState.visible) } public func zoomIn() { diff --git a/examples/latest/navigate/ios/IndoorMap/IndoorMap/AppDelegate.swift b/examples/latest/navigate/ios/IndoorMap/IndoorMap/AppDelegate.swift index a05b45d8..6b12958d 100644 --- a/examples/latest/navigate/ios/IndoorMap/IndoorMap/AppDelegate.swift +++ b/examples/latest/navigate/ios/IndoorMap/IndoorMap/AppDelegate.swift @@ -37,8 +37,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate { private func initializeHERESDK() { // Set your credentials for the HERE SDK. // Talk to your HERE representative to enable your private Venue data for use with these credentials. - let accessKeyID = "YOUR_ACCESS_KEY_ID" - let accessKeySecret = "YOUR_ACCESS_KEY_SECRET" + let accessKeyID = "VENUE_ACCESS_KEY_ID" + let accessKeySecret = "VENUE_ACCESS_KEY_SECRET" let options = SDKOptions(accessKeyId: accessKeyID, accessKeySecret: accessKeySecret) do { try SDKNativeEngine.makeSharedInstance(options: options) diff --git a/examples/latest/navigate/ios/IndoorMap/IndoorMap/ViewController.swift b/examples/latest/navigate/ios/IndoorMap/IndoorMap/ViewController.swift index 0a2b34cb..9b3e4d63 100644 --- a/examples/latest/navigate/ios/IndoorMap/IndoorMap/ViewController.swift +++ b/examples/latest/navigate/ios/IndoorMap/IndoorMap/ViewController.swift @@ -31,19 +31,22 @@ class ViewController: UIViewController { @IBOutlet private weak var venuesManager: VenuesManager! @IBOutlet private weak var indoorRoutingUIConstraint: NSLayoutConstraint! - var mapView: MapView = MapView() + var mapView: MapView! var mapScheme: MapScheme = .normalDay var venueEngine: VenueEngine! var moveToVenue: Bool = false var venueTapHandler: VenueTapHandler? + + //Label text preference as per user choice + var labelPref = ["OCCUPANT_NAMES", "SPACE_NAME", "INTERNAL_ADDRESS"] // Replace "CATALOG_HRN" with your platform catalog HRN value. let hrn: String = "CATALOG_HRN" - + override func viewDidLoad() { super.viewDidLoad() - - mapView.frame = viewFrame.bounds + + mapView = MapView(frame: viewFrame.bounds) viewFrame.addSubview(mapView) venueIdInput?.keyboardType = UIKeyboardType.numberPad @@ -121,6 +124,9 @@ class ViewController: UIViewController { // Set platform catalog HRN venueService.setHrn(hrn: hrn) + + // Set label text preference + venueService.setLabeltextPreference(labelTextPref: labelPref) } // Touch handler for the button which selects venues by id. diff --git a/examples/latest/navigate/ios/MapItems/MapItems/Assets.xcassets/blue_square.imageset/Contents.json b/examples/latest/navigate/ios/MapItems/MapItems/Assets.xcassets/blue_square.imageset/Contents.json deleted file mode 100644 index 8612dc0f..00000000 --- a/examples/latest/navigate/ios/MapItems/MapItems/Assets.xcassets/blue_square.imageset/Contents.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "images" : [ - { - "filename" : "blue_square.png", - "idiom" : "universal" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/examples/latest/navigate/ios/MapItems/MapItems/Assets.xcassets/blue_square.imageset/blue_square.png b/examples/latest/navigate/ios/MapItems/MapItems/Assets.xcassets/blue_square.imageset/blue_square.png deleted file mode 100644 index 544d343c3f9567c989b021209772cadad86577cf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1513 zcmVBE1ZQLxAY_vg;$?V;oX(lt{{G@3qJ`_O^!KmPq;Qw2}Cn0L9?Tam?khm;cmfj@-EE=vY<#k5o0f^m&*sM6pBI0EL{uRZtU4R5Z z`^X8`V)zNfJ8YaF;u6EP09P2E5Ad?jnUOMxUqvh^s*L``+lU9}BlcPZ2XpY-jyyG} zttleQMaed+noc9ry@UIIwng1*#M^^UkFzj+6yF25_LnMhmf?pGpH<}CbcnAmX|u%; z|7E#p3GpKUUAw%6atiT2#A8)^yd3Cssj4^8z$>TJnP(8+gLrkpJj%xIMEtceUz`ec zeo~wa<_{hK;NmJRuzL3+9o0iVC08s$)vACv7|KExH6jmbd4gn8^0FkllzkRT6fd|P0n zrwSVAXrbt(XrcJk;OyVRDf#{Yw^VBW$m{6QFhZvPBk<6w!tZERBfJcLd1$M3&)TehHS09YRtkN(Z(GDi^F2;vKBX;HY+Q*UEnTqUvgh@A9J5aYSek}G;8j! zqp=F+X_rylpF&#LEj%b>g+0Q~5^H*5N-?MwSLAe5T{?GXqX;9WfX;*4pXw6&V*io?m|<6;W0GAb4f<-njQ>$>Q>9MPr@ zwU=n+0I+*9IKpp9{{0u*d8K7@p9VPmCp-6AwmA>rtOL;dXv;Q$XXCx^0IWWyc=l3w zC&Xgk0yx!!!@*Zi8qcdA>-AfBZYACT*nGWS|NH%Vee(m<-vGFv{{#Oecnig2*2@3@ z061k>NoGw=04e|g00;m9hiL!=000010000Q0000000N)_00aO40096106d@r00aO4 z0096106YKy005{L%Vq!o0a8gsK~!i3?U-Q>!XONVH{(f6y#Ikryb1m7|=`(31^lp79iopfM#;;Sp*0? z!t=1|y}u6Qy}^IZt3J}w@F+^lwTjkyYB_0Mm0)B5QX?(%8%KH}HEG`}!Rd=$pDEZY zIdpFlMxF9nS49~4<CaSx7IWCY@I$IKHS2&~oX}nrE%2mXl`eyrz|`StMS4q`m8= zVDAJ=`;&0VA@6w-_D-<0KM9u{@}9pO;ig;59?H@kRLdWMmOX|Nmc+)zwOorZ>78MM z5kW|eBm|8Q6O1loT}Q#z4xinhgwG~mJ%1Qs1_LR01`3utkg%n@GxR3m87NrpK*E;p&d{5LXP{uY0|{HYJ45deyVf&wR?o_| P00000NkvXXu0mjf^T^Mn diff --git a/examples/latest/navigate/ios/MapItems/MapItems/MapItemsExample.swift b/examples/latest/navigate/ios/MapItems/MapItems/MapItemsExample.swift index 379da062..17bf0a87 100644 --- a/examples/latest/navigate/ios/MapItems/MapItems/MapItemsExample.swift +++ b/examples/latest/navigate/ios/MapItems/MapItems/MapItemsExample.swift @@ -72,7 +72,7 @@ class MapItemsExample: TapDelegate { func onMapMarkerClusterButtonClicked() { guard - let image = UIImage(named: "blue_square.png"), + let image = UIImage(named: "green_square.png"), let imageData = image.pngData() else { print("Error: Image not found.") return @@ -81,16 +81,27 @@ class MapItemsExample: TapDelegate { let clusterMapImage = MapImage(pixelData: imageData, imageFormat: ImageFormat.png) - let mapMarkerCluster = MapMarkerCluster(imageStyle: MapMarkerCluster.ImageStyle(image: clusterMapImage)) + // Defines a text that indicates how many markers are included in the cluster. + var counterStyle = MapMarkerCluster.CounterStyle() + counterStyle.textColor = UIColor.black + counterStyle.fontSize = 40 + counterStyle.maxCountNumber = 9 + counterStyle.aboveMaxText = "+9" + + let mapMarkerCluster = MapMarkerCluster(imageStyle: MapMarkerCluster.ImageStyle(image: clusterMapImage), + counterStyle: counterStyle) mapView.mapScene.addMapMarkerCluster(mapMarkerCluster) mapMarkerClusters.append(mapMarkerCluster) + var index = 1 for _ in 1...10 { - mapMarkerCluster.addMapMarker(marker: createRandomMapMarkerInViewport()) + let indexString = String(index) + mapMarkerCluster.addMapMarker(marker: createRandomMapMarkerInViewport(indexString)) + index = index + 1 } } - func createRandomMapMarkerInViewport() -> MapMarker { + func createRandomMapMarkerInViewport(_ metaDataText: String) -> MapMarker { let geoCoordinates = createRandomGeoCoordinatesAroundMapCenter() guard let image = UIImage(named: "green_square.png"), @@ -101,6 +112,11 @@ class MapItemsExample: TapDelegate { let mapImage = MapImage(pixelData: imageData, imageFormat: ImageFormat.png) let mapMarker = MapMarker(at: geoCoordinates, image: mapImage) + + let metadata = Metadata() + metadata.setString(key: "key_cluster", value: metaDataText) + mapMarker.metadata = metadata + return mapMarker } @@ -390,13 +406,27 @@ class MapItemsExample: TapDelegate { return } if (clusterSize == 1) { - showDialog(title: "Map Marker picked", message: "This MapMarker belongs to a cluster.") + let metadata = getClusterMetadata(topmostGrouping.markers.first!) + showDialog(title: "Map Marker picked", message: "This MapMarker belongs to a cluster. Metadata: \(metadata)") } else { + var metadata = "" + for mapMarker in topmostGrouping.markers { + metadata += getClusterMetadata(mapMarker) + metadata += " " + } + let metadataMessage = "Contained Metadata: " + metadata + ". " showDialog(title: "Map marker cluster picked", - message: "Number of contained markers in this cluster: \(clusterSize). Total number of markers in this MapMarkerCluster: \(topmostGrouping.parent.markers.count)") + message: "Number of contained markers in this cluster: \(clusterSize). \(metadataMessage) Total number of markers in this MapMarkerCluster: \(topmostGrouping.parent.markers.count)") } } + private func getClusterMetadata(_ mapMarker: MapMarker) -> String { + if let message = mapMarker.metadata?.getString(key: "key_cluster") { + return message + } + return "No metadata." + } + private func createRandomGeoCoordinatesAroundMapCenter() -> GeoCoordinates { let scaleFactor = UIScreen.main.scale let mapViewWidthInPixels = Double(mapView.bounds.width * scaleFactor)