use of com.here.android.mpa.common.GeoCoordinate in project here-android-sdk-examples by heremaps.
the class MapFragmentView method addMarkerAtPlace.
private void addMarkerAtPlace(PlaceLink placeLink) {
Image img = new Image();
try {
img.setImageResource(R.drawable.marker);
} catch (IOException e) {
e.printStackTrace();
}
MapMarker mapMarker = new MapMarker();
mapMarker.setIcon(img);
mapMarker.setCoordinate(new GeoCoordinate(placeLink.getPosition()));
m_map.addMapObject(mapMarker);
m_mapObjectList.add(mapMarker);
}
use of com.here.android.mpa.common.GeoCoordinate in project here-android-sdk-examples by heremaps.
the class MapFragmentView method initMapFragment.
private void initMapFragment() {
/* Locate the mapFragment UI element */
m_mapFragment = getMapFragment();
// This will use external storage to save map cache data, it is also possible to set
// private app's path
String path = new File(m_activity.getExternalFilesDir(null), ".here-map-data").getAbsolutePath();
// This method will throw IllegalArgumentException if provided path is not writable
com.here.android.mpa.common.MapSettings.setDiskCacheRootPath(path);
if (m_mapFragment != null) {
/* Initialize the AndroidXMapFragment, results will be given via the called back. */
m_mapFragment.init(new OnEngineInitListener() {
@Override
public void onEngineInitializationCompleted(OnEngineInitListener.Error error) {
if (error == Error.NONE) {
m_map = m_mapFragment.getMap();
m_map.setCenter(new GeoCoordinate(49.259149, -123.008555), Map.Animation.NONE);
// Put this call in Map.onTransformListener if the animation(Linear/Bow)
// is used in setCenter()
m_map.setZoomLevel(13.2);
/*
* Get the NavigationManager instance.It is responsible for providing voice
* and visual instructions while driving and walking
*/
m_navigationManager = NavigationManager.getInstance();
} else {
new AlertDialog.Builder(m_activity).setMessage("Error : " + error.name() + "\n\n" + error.getDetails()).setTitle(R.string.engine_init_error).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
m_activity.finish();
}
}).create().show();
}
}
});
}
}
use of com.here.android.mpa.common.GeoCoordinate in project here-android-sdk-examples by heremaps.
the class MapFragmentView method initMapFragment.
private void initMapFragment() {
m_mapFragment = getMapFragment();
// This will use external storage to save map cache data, it is also possible to set
// private app's path
String path = new File(m_activity.getExternalFilesDir(null), ".here-map-data").getAbsolutePath();
// This method will throw IllegalArgumentException if provided path is not writable
com.here.android.mpa.common.MapSettings.setDiskCacheRootPath(path);
if (m_mapFragment != null) {
/* Initialize the AndroidXMapFragment, results will be given via the called back. */
m_mapFragment.init(new OnEngineInitListener() {
@Override
public void onEngineInitializationCompleted(OnEngineInitListener.Error error) {
/*
* if no error returned from map fragment initialization, then set map center
* and zoom level.
*/
if (error == Error.NONE) {
/* get the map object */
m_map = m_mapFragment.getMap();
/* Set the map center to the Berlin region (no animation). */
m_map.setCenter(new GeoCoordinate(52.500556, 13.398889, 0.0), Map.Animation.NONE);
/* Set the zoom level to the average between min and max zoom level. */
m_map.setZoomLevel((m_map.getMaxZoomLevel() + m_map.getMinZoomLevel()) / 2);
} else {
new AlertDialog.Builder(m_activity).setMessage("Error : " + error.name() + "\n\n" + error.getDetails()).setTitle(R.string.engine_init_error).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
m_activity.finish();
}
}).create().show();
}
}
});
}
}
use of com.here.android.mpa.common.GeoCoordinate in project here-android-sdk-examples by heremaps.
the class MapFragmentView method initMapFragment.
private void initMapFragment() {
/* Locate the mapFragment UI element */
m_mapFragment = getMapFragment();
// This will use external storage to save map cache data, it is also possible to set
// private app's path
String path = new File(m_activity.getExternalFilesDir(null), ".here-map-data").getAbsolutePath();
// This method will throw IllegalArgumentException if provided path is not writable
com.here.android.mpa.common.MapSettings.setDiskCacheRootPath(path);
if (m_mapFragment != null) {
/* Initialize the AndroidXMapFragment, results will be given via the called back. */
m_mapFragment.init(new OnEngineInitListener() {
@Override
public void onEngineInitializationCompleted(OnEngineInitListener.Error error) {
if (error == Error.NONE) {
/*
* If no error returned from map fragment initialization, the map will be
* rendered on screen at this moment.Further actions on map can be provided
* by calling Map APIs.
*/
m_map = m_mapFragment.getMap();
/*
* Set the map center to Berlin Germany.
*/
m_map.setCenter(new GeoCoordinate(52.500556, 13.398889, 0.0), Map.Animation.NONE);
/* Set the zoom level. */
m_map.setZoomLevel(8);
} else {
new AlertDialog.Builder(m_activity).setMessage("Error : " + error.name() + "\n\n" + error.getDetails()).setTitle(R.string.engine_init_error).setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
m_activity.finish();
}
}).create().show();
}
}
});
}
}
use of com.here.android.mpa.common.GeoCoordinate in project here-android-sdk-examples by heremaps.
the class MapFragmentView method initFloatPropertyButton.
/**
* Initialize change float property button to add customizable scheme which customizes country
* boundary 's width.
*/
private void initFloatPropertyButton() {
m_floatBtn = (Button) m_activity.findViewById(R.id.float_button);
m_floatBtn.setOnClickListener(new View.OnClickListener() {
// if customizable scheme named "floatScheme" does not exist yet, create one
// and set customizable scheme 's country boundary width to be 10.0f for specific range
// and set it to be current map scheme.
@Override
public void onClick(View v) {
// if customizable scheme named with floatScheme does not exist, create one
if (m_map != null && m_map.getCustomizableScheme(m_floatSchemeName) == null) {
m_map.createCustomizableScheme(m_floatSchemeName, m_map.getMapScheme());
m_floatScheme = m_map.getCustomizableScheme(m_floatSchemeName);
}
// create zoom range
ZoomRange range = new ZoomRange(m_map.getMinZoomLevel(), m_map.getMaxZoomLevel());
// set country property'width to be 10.0f
m_floatScheme.setVariableValue(CustomizableVariables.CountryBoundary.WIDTH, 10.0f, range);
// set customizable scheme to be current map scheme.
m_map.setMapScheme(m_floatScheme);
// set current center and zoom level to have a better view.
m_map.setCenter(new GeoCoordinate(52.500556, 13.398889, 0.0), Map.Animation.NONE);
m_map.setZoomLevel(5);
}
});
}
Aggregations