Skip to content

Commit

Permalink
Merge pull request heremaps#174 from heremaps/esd/41260
Browse files Browse the repository at this point in the history
Update example apps for release 4.12.6.0
  • Loading branch information
datasun authored Sep 16, 2022
2 parents 9d91428 + 3eb01c3 commit 45914a3
Show file tree
Hide file tree
Showing 99 changed files with 2,687 additions and 873 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.5.0)
## List of Available Example Apps (Version 4.12.6.0)

- **HelloMap**: Shows the classic 'Hello World'.
- **HelloMapKotlin**: Shows the classic 'Hello World' using Kotlin language (Android only).
Expand Down
2 changes: 1 addition & 1 deletion examples/latest/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This folder contains the HERE SDK examples apps for version: 4.12.5.0
This folder contains the HERE SDK examples apps for version: 4.12.6.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/))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,14 @@
import com.here.sdk.mapview.MapLayerVisibilityRange;
import com.here.sdk.mapview.MapMarker;
import com.here.sdk.mapview.MapMeasure;
import com.here.sdk.mapview.MapScene;
import com.here.sdk.mapview.MapView;
import com.here.sdk.mapview.VisibilityState;
import com.here.sdk.mapview.datasource.RasterDataSource;
import com.here.sdk.mapview.datasource.RasterDataSourceConfiguration;
import com.here.sdk.mapview.datasource.TilingScheme;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

Expand Down Expand Up @@ -69,6 +72,10 @@ public void onMapSceneLoaded(MapView mapView, Context context) {

// Add a POI marker
addPOIMapMarker(new GeoCoordinates(52.530932, 13.384915));

// Users of the Navigate Edition can set the visibility for all the POI categories to hidden.
// List<String> categoryIds = new ArrayList<>();
// MapScene.setPoiVisibility(categoryIds, VisibilityState.HIDDEN);
}

public void enableButtonClicked() {
Expand Down Expand Up @@ -107,8 +114,8 @@ private RasterDataSource createRasterDataSource(String dataSourceName) {
}

private MapLayer createMapLayer(String dataSourceName) {
// The layer should be rendered on top of other layers except the labels layer so that we don't overlap raster layer over POI markers.
MapLayerPriority priority = new MapLayerPriorityBuilder().renderedLast().renderedBeforeLayer("labels").build();
// The layer should be rendered on top of other layers.
MapLayerPriority priority = new MapLayerPriorityBuilder().renderedLast().build();
// And it should be visible for all zoom levels.
MapLayerVisibilityRange range = new MapLayerVisibilityRange(0, 22 + 1);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@

import android.content.Context;
import android.graphics.Color;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

Expand All @@ -41,7 +43,7 @@
import java.util.List;

public class MapViewPinExample {

private static final String TAG = MapViewPinExample.class.getSimpleName();
private static final GeoCoordinates MAP_CENTER_GEO_COORDINATES = new GeoCoordinates(52.51760485151816, 13.380312380535472);

private final Context context;
Expand Down Expand Up @@ -72,6 +74,12 @@ public void showMapViewPin() {
linearLayout.setBackgroundResource(R.color.colorAccent);
linearLayout.setPadding(10, 10, 10, 10);
linearLayout.addView(textView);
linearLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.i(TAG, "Tapped on MapViewPin");
}
});

mapView.pinView(linearLayout, MAP_CENTER_GEO_COORDINATES);
}
Expand All @@ -88,6 +96,12 @@ public void showAnchoredMapViewPin() {
linearLayout.setBackgroundResource(R.color.colorPrimary);
linearLayout.setPadding(10, 10, 10, 10);
linearLayout.addView(textView);
linearLayout.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.i(TAG, "Tapped on Anchored MapViewPin");
}
});

MapView.ViewPin viewPin = mapView.pinView(linearLayout, MAP_CENTER_GEO_COORDINATES);
viewPin.setAnchorPoint(new Anchor2D(0.5F, 1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,137 +19,141 @@

import 'dart:core';

import 'package:camera_keyframe_tracks_app/models/LocationKeyframeModel.dart';
import 'package:camera_keyframe_tracks_app/models/OrientationKeyframeModel.dart';
import 'package:camera_keyframe_tracks_app/models/ScalarKeyframeModel.dart';
import 'package:here_sdk/animation.dart';
import 'package:here_sdk/core.dart';
import 'package:here_sdk/mapview.dart';

class CameraKeyframeTracksExample {

static final String _tag = (CameraKeyframeTracksExample).toString();

final HereMapController _hereMapController;
List<MapCameraKeyframeTrack> _tracks = [];

CameraKeyframeTracksExample(HereMapController hereMapController) : _hereMapController = hereMapController;

void startTripToNYC() {
// This animation can be started and replayed. When started, it will always start from globe view.
List<MapCameraKeyframeTrack> tracks = _createTripToNYCAnimation();
_startTripToNYCAnimation(tracks);
}
List<MapCameraKeyframeTrack>? mapCameraKeyframeTracks = _createMapCameraKeyframeTracks();

void stopTripToNYCAnimation() {
_hereMapController.camera.cancelAnimations();
}
MapCameraAnimation mapCameraAnimation;

List<LocationKeyframeModel> _createLocationsForTripToNYC() {
List<LocationKeyframeModel> locationList = [];

locationList.addAll([
LocationKeyframeModel(GeoCoordinates(40.685869754854544, -74.02550202768754), const Duration(milliseconds: 0)), // Statue of Liberty
LocationKeyframeModel(GeoCoordinates(40.69051652745291, -74.04455943649657), const Duration(milliseconds: 5000)), // Statue of Liberty
LocationKeyframeModel(GeoCoordinates(40.69051652745291, -74.04455943649657), const Duration(milliseconds: 7000)), // Statue of Liberty
LocationKeyframeModel(GeoCoordinates(40.69051652745291, -74.04455943649657), const Duration(milliseconds: 9000)), // Statue of Liberty
LocationKeyframeModel(GeoCoordinates(40.690266839135, -74.01237515471776), const Duration(milliseconds: 5000)), // Governor Island
LocationKeyframeModel(GeoCoordinates(40.7116777285189, -74.01248494562448), const Duration(milliseconds: 6000)), // World Trade Center
LocationKeyframeModel(GeoCoordinates(40.71083291395444, -74.01226399217569), const Duration(milliseconds: 6000)), // World Trade Center
LocationKeyframeModel(GeoCoordinates(40.719259512385506, -74.01171007254635), const Duration(milliseconds: 5000)), // Manhattan College
LocationKeyframeModel(GeoCoordinates(40.73603959180013, -73.98968489844603), const Duration(milliseconds: 6000)), // Union Square
LocationKeyframeModel(GeoCoordinates(40.741732824650214, -73.98825255774022), const Duration(milliseconds: 5000)), // Flatiron
LocationKeyframeModel(GeoCoordinates(40.74870637098952, -73.98515306630678), const Duration(milliseconds: 6000)), // Empire State Building
LocationKeyframeModel(GeoCoordinates(40.742693509776856, -73.95937093336781), const Duration(milliseconds: 3000)), // Queens Midtown
LocationKeyframeModel(GeoCoordinates(40.75065611103842, -73.96053139022635), const Duration(milliseconds: 4000)), // Roosevelt Island
LocationKeyframeModel(GeoCoordinates(40.756823163883794, -73.95461519921352), const Duration(milliseconds: 4000)), // Queens Bridge
LocationKeyframeModel(GeoCoordinates(40.763573707276784, -73.94571562970638), const Duration(milliseconds: 4000)), // Roosevelt Bridge
LocationKeyframeModel(GeoCoordinates(40.773052036400294, -73.94027981305442), const Duration(milliseconds: 3000)), // Roosevelt Lighthouse
LocationKeyframeModel(GeoCoordinates(40.78270548734745, -73.92189566092568), const Duration(milliseconds: 3000)), // Hell gate Bridge
LocationKeyframeModel(GeoCoordinates(40.78406704306872, -73.91746017917936), const Duration(milliseconds: 2000)), // Ralph Park
LocationKeyframeModel(GeoCoordinates(40.768075472169045, -73.97446921306035), const Duration(milliseconds: 2000)), // Wollman Rink
LocationKeyframeModel(GeoCoordinates(40.78255966255712, -73.9586425508515), const Duration(milliseconds: 3000)) // Solomon Museum
]);
try {
mapCameraAnimation = MapCameraAnimationFactory.createAnimationFromKeyframeTracks(mapCameraKeyframeTracks!);
} on MapCameraKeyframeTrackInstantiationException catch (e) {
print(_tag + "Error occured: " + e.error.name);
return;
}

return locationList;
// This animation can be started and replayed. When started, it will always start from the first keyframe.
_hereMapController.camera.startAnimationWithListener(mapCameraAnimation, AnimationListener((AnimationState animationState) {
switch (animationState) {
case AnimationState.started:
print(_tag + "Animation started.");
break;
case AnimationState.cancelled:
print(_tag + "Animation cancelled.");
break;
case AnimationState.completed:
print(_tag + "Animation finished.");
break;
}
}));
}

List<OrientationKeyframeModel> _createOrientationsForTripToNYC() {
List<OrientationKeyframeModel> orientationList = [];

orientationList.addAll([
OrientationKeyframeModel(GeoOrientation(30, 60), const Duration(milliseconds: 0)),
OrientationKeyframeModel(GeoOrientation(-40, 80), const Duration(milliseconds: 6000)),
OrientationKeyframeModel(GeoOrientation(30, 70), const Duration(milliseconds: 6000)),
OrientationKeyframeModel(GeoOrientation(70, 30), const Duration(milliseconds: 4000)),
OrientationKeyframeModel(GeoOrientation(-30, 70), const Duration(milliseconds: 5000)),
OrientationKeyframeModel(GeoOrientation(30, 70), const Duration(milliseconds: 5000)),
OrientationKeyframeModel(GeoOrientation(40, 70), const Duration(milliseconds: 5000)),
OrientationKeyframeModel(GeoOrientation(80, 40), const Duration(milliseconds: 5000)),
OrientationKeyframeModel(GeoOrientation(30, 70), const Duration(milliseconds: 5000))
]);

return orientationList;
void stopTripToNYCAnimation() {
_hereMapController.camera.cancelAnimations();
}

List<ScalarKeyframeModel> _createScalarsForTripToNYC() {
List<ScalarKeyframeModel> scalarList = [];
List<MapCameraKeyframeTrack>? _createMapCameraKeyframeTracks() {
MapCameraKeyframeTrack geoCoordinatesMapCameraKeyframeTrack;
MapCameraKeyframeTrack scalarMapCameraKeyframeTrack;
MapCameraKeyframeTrack geoOrientationMapCameraKeyframeTrack;

scalarList.add(ScalarKeyframeModel(80000000.0, const Duration(milliseconds: 0)));
scalarList.add(ScalarKeyframeModel(8000000.0, const Duration(milliseconds: 2000)));
scalarList.add(ScalarKeyframeModel(8000.0, const Duration(milliseconds: 2000)));
scalarList.add(ScalarKeyframeModel(1000.0, const Duration(milliseconds: 2000)));
scalarList.add(ScalarKeyframeModel(400.0, const Duration(milliseconds: 3000)));
List<GeoCoordinatesKeyframe> geoCoordinatesKeyframes = _createGeoCoordinatesKeyframes();
List<ScalarKeyframe> scalarKeyframes = _createScalarKeyframes();
List<GeoOrientationKeyframe> geoOrientationKeyframes = _createGeoOrientationKeyframes();

return scalarList;
}
try {
geoCoordinatesMapCameraKeyframeTrack = MapCameraKeyframeTrack.lookAtTarget(geoCoordinatesKeyframes, EasingFunction.linear, KeyframeInterpolationMode.linear);
scalarMapCameraKeyframeTrack = MapCameraKeyframeTrack.lookAtDistance(scalarKeyframes, EasingFunction.linear, KeyframeInterpolationMode.linear);
geoOrientationMapCameraKeyframeTrack = MapCameraKeyframeTrack.lookAtOrientation(geoOrientationKeyframes, EasingFunction.linear, KeyframeInterpolationMode.linear);
} on MapCameraKeyframeTrackInstantiationException catch (e) {
// Throws an error if keyframes are empty or the duration of keyframes is invalid.
print(_tag + e.toString());
return null;
}

List<MapCameraKeyframeTrack> _createTripToNYCAnimation() {
// A list of location key frames for moving the map camera from one geo coordinate to another.
List<GeoCoordinatesKeyframe> locationKeyframesList = [];
List<LocationKeyframeModel> locationList = _createLocationsForTripToNYC();
// Add different kinds of animation tracks that can be played back simultaneously.
// Each track can have a different total duration.
// The animation completes, when the longest track has been competed.
List<MapCameraKeyframeTrack> mapCameraKeyframeTracks = [];

for (LocationKeyframeModel locationKeyframeModel in locationList) {
locationKeyframesList
.add(GeoCoordinatesKeyframe(locationKeyframeModel.geoCoordinates, locationKeyframeModel.duration));
}
// This changes the camera's location over time.
mapCameraKeyframeTracks.add(geoCoordinatesMapCameraKeyframeTrack);
// This changes the camera's distance (= scalar) to earth over time.
mapCameraKeyframeTracks.add(scalarMapCameraKeyframeTrack);
// This changes the camera's orientation over time.
mapCameraKeyframeTracks.add(geoOrientationMapCameraKeyframeTrack);

// A list of geo orientation keyframes for changing the map camera orientation.
List<GeoOrientationKeyframe> orientationKeyframeList = [];
List<OrientationKeyframeModel> orientationList = _createOrientationsForTripToNYC();
return mapCameraKeyframeTracks;
}

for (OrientationKeyframeModel orientationKeyframeModel in orientationList) {
orientationKeyframeList
.add(GeoOrientationKeyframe(orientationKeyframeModel.geoOrientation, orientationKeyframeModel.duration));
}
List<GeoCoordinatesKeyframe> _createGeoCoordinatesKeyframes() {
List<GeoCoordinatesKeyframe> geoCoordinatesKeyframes = [];

geoCoordinatesKeyframes.addAll([
GeoCoordinatesKeyframe(GeoCoordinates(40.685869754854544, -74.02550202768754), const Duration(milliseconds: 0)), // Statue of Liberty
GeoCoordinatesKeyframe(GeoCoordinates(40.69051652745291, -74.04455943649657), const Duration(milliseconds: 5000)), // Statue of Liberty
GeoCoordinatesKeyframe(GeoCoordinates(40.69051652745291, -74.04455943649657), const Duration(milliseconds: 7000)), // Statue of Liberty
GeoCoordinatesKeyframe(GeoCoordinates(40.69051652745291, -74.04455943649657), const Duration(milliseconds: 9000)), // Statue of Liberty
GeoCoordinatesKeyframe(GeoCoordinates(40.690266839135, -74.01237515471776), const Duration(milliseconds: 5000)), // Governor Island
GeoCoordinatesKeyframe(GeoCoordinates(40.7116777285189, -74.01248494562448), const Duration(milliseconds: 6000)), // World Trade Center
GeoCoordinatesKeyframe(GeoCoordinates(40.71083291395444, -74.01226399217569), const Duration(milliseconds: 6000)), // World Trade Center
GeoCoordinatesKeyframe(GeoCoordinates(40.719259512385506, -74.01171007254635), const Duration(milliseconds: 5000)), // Manhattan College
GeoCoordinatesKeyframe(GeoCoordinates(40.73603959180013, -73.98968489844603), const Duration(milliseconds: 6000)), // Union Square
GeoCoordinatesKeyframe(GeoCoordinates(40.741732824650214, -73.98825255774022), const Duration(milliseconds: 5000)), // Flatiron
GeoCoordinatesKeyframe(GeoCoordinates(40.74870637098952, -73.98515306630678), const Duration(milliseconds: 6000)), // Empire State Building
GeoCoordinatesKeyframe(GeoCoordinates(40.742693509776856, -73.95937093336781), const Duration(milliseconds: 3000)), // Queens Midtown
GeoCoordinatesKeyframe(GeoCoordinates(40.75065611103842, -73.96053139022635), const Duration(milliseconds: 4000)), // Roosevelt Island
GeoCoordinatesKeyframe(GeoCoordinates(40.756823163883794, -73.95461519921352), const Duration(milliseconds: 4000)), // Queens Bridge
GeoCoordinatesKeyframe(GeoCoordinates(40.763573707276784, -73.94571562970638), const Duration(milliseconds: 4000)), // Roosevelt Bridge
GeoCoordinatesKeyframe(GeoCoordinates(40.773052036400294, -73.94027981305442), const Duration(milliseconds: 3000)), // Roosevelt Lighthouse
GeoCoordinatesKeyframe(GeoCoordinates(40.78270548734745, -73.92189566092568), const Duration(milliseconds: 3000)), // Hell gate Bridge
GeoCoordinatesKeyframe(GeoCoordinates(40.78406704306872, -73.91746017917936), const Duration(milliseconds: 2000)), // Ralph Park
GeoCoordinatesKeyframe(GeoCoordinates(40.768075472169045, -73.97446921306035), const Duration(milliseconds: 2000)), // Wollman Rink
GeoCoordinatesKeyframe(GeoCoordinates(40.78255966255712, -73.9586425508515), const Duration(milliseconds: 3000)) // Solomon Museum˝
]);

// A list of scalar key frames for changing the map camera distance from the earth.
List<ScalarKeyframe> scalarKeyframesList = [];
List<ScalarKeyframeModel> scalarList = _createScalarsForTripToNYC();
return geoCoordinatesKeyframes;
}

for (ScalarKeyframeModel scalarKeyframeModel in scalarList) {
scalarKeyframesList.add(ScalarKeyframe(scalarKeyframeModel.scalar, scalarKeyframeModel.duration));
}
List<ScalarKeyframe> _createScalarKeyframes() {
List<ScalarKeyframe> scalarKeyframes = [];

try {
// Creating a track to add different kinds of animations to the MapCameraKeyframeTrack.
_tracks = [];
_tracks.add(MapCameraKeyframeTrack.lookAtDistance(
scalarKeyframesList, EasingFunction.linear, KeyframeInterpolationMode.linear));
_tracks.add(MapCameraKeyframeTrack.lookAtTarget(
locationKeyframesList, EasingFunction.linear, KeyframeInterpolationMode.linear));
_tracks.add(MapCameraKeyframeTrack.lookAtOrientation(
orientationKeyframeList, EasingFunction.linear, KeyframeInterpolationMode.linear));
} on MapCameraKeyframeTrackInstantiationException catch (e) {
// Throws an error if keyframes is empty or duration of keyframes are invalid.
print("KeyframeTrackTag: " + e.error.name);
}
scalarKeyframes.add(ScalarKeyframe(80000000.0, const Duration(milliseconds: 0)));
scalarKeyframes.add(ScalarKeyframe(8000000.0, const Duration(milliseconds: 2000)));
scalarKeyframes.add(ScalarKeyframe(8000.0, const Duration(milliseconds: 2000)));
scalarKeyframes.add(ScalarKeyframe(1000.0, const Duration(milliseconds: 2000)));
scalarKeyframes.add(ScalarKeyframe(400.0, const Duration(milliseconds: 3000)));

return _tracks;
return scalarKeyframes;
}

void _startTripToNYCAnimation(List<MapCameraKeyframeTrack> tracks) {
try {
_hereMapController.camera.startAnimation(MapCameraAnimationFactory.createAnimationFromKeyframeTracks(tracks));
} on MapCameraKeyframeTrackInstantiationException catch (e) {
print("KeyframeAnimationTag: " + e.error.name);
}
List<GeoOrientationKeyframe> _createGeoOrientationKeyframes() {
List<GeoOrientationKeyframe> geoOrientationKeyframe = [];

geoOrientationKeyframe.addAll([
GeoOrientationKeyframe(GeoOrientation(30, 60), const Duration(milliseconds: 0)),
GeoOrientationKeyframe(GeoOrientation(-40, 80), const Duration(milliseconds: 6000)),
GeoOrientationKeyframe(GeoOrientation(30, 70), const Duration(milliseconds: 6000)),
GeoOrientationKeyframe(GeoOrientation(70, 30), const Duration(milliseconds: 4000)),
GeoOrientationKeyframe(GeoOrientation(-30, 70), const Duration(milliseconds: 5000)),
GeoOrientationKeyframe(GeoOrientation(30, 70), const Duration(milliseconds: 5000)),
GeoOrientationKeyframe(GeoOrientation(40, 70), const Duration(milliseconds: 5000)),
GeoOrientationKeyframe(GeoOrientation(80, 40), const Duration(milliseconds: 5000)),
GeoOrientationKeyframe(GeoOrientation(30, 70), const Duration(milliseconds: 5000))
]);

return geoOrientationKeyframe;
}
}
Loading

0 comments on commit 45914a3

Please sign in to comment.