[android] - add binding integration for RasterDEMSource, add example
This commit is contained in:
@@ -778,6 +778,17 @@
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.style.HillshadeLayerActivity"
|
||||
android:description="@string/description_hillshade"
|
||||
android:label="@string/activity_hillshade">
|
||||
<meta-data
|
||||
android:name="@string/category"
|
||||
android:value="@string/category_style"/>
|
||||
<meta-data
|
||||
android:name="android.support.PARENT_ACTIVITY"
|
||||
android:value=".activity.FeatureOverviewActivity"/>
|
||||
</activity>
|
||||
|
||||
<!-- For Instrumentation tests -->
|
||||
<activity
|
||||
|
||||
@@ -0,0 +1,84 @@
|
||||
package com.mapbox.mapboxsdk.testapp.activity.style;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
|
||||
import com.mapbox.mapboxsdk.maps.MapView;
|
||||
import com.mapbox.mapboxsdk.maps.MapboxMap;
|
||||
import com.mapbox.mapboxsdk.style.layers.HillshadeLayer;
|
||||
import com.mapbox.mapboxsdk.style.sources.RasterDemSource;
|
||||
import com.mapbox.mapboxsdk.testapp.R;
|
||||
|
||||
/**
|
||||
* Test activity showcasing using HillshadeLayer.
|
||||
*/
|
||||
public class HillshadeLayerActivity extends AppCompatActivity {
|
||||
|
||||
private static final String LAYER_ID = "hillshade-layer";
|
||||
private static final String LAYER_BELOW_ID = "waterway-river-canal";
|
||||
private static final String SOURCE_ID = "hillshade-source";
|
||||
private static final String SOURCE_URL = "mapbox://mapbox.terrain-rgb";
|
||||
|
||||
private MapView mapView;
|
||||
private MapboxMap mapboxMap;
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_fill_extrusion_layer);
|
||||
|
||||
mapView = (MapView) findViewById(R.id.mapView);
|
||||
mapView.onCreate(savedInstanceState);
|
||||
mapView.getMapAsync(map -> {
|
||||
mapboxMap = map;
|
||||
|
||||
RasterDemSource rasterDemSource = new RasterDemSource(SOURCE_ID, SOURCE_URL);
|
||||
mapboxMap.addSource(rasterDemSource);
|
||||
|
||||
HillshadeLayer hillshadeLayer = new HillshadeLayer(LAYER_ID, SOURCE_ID);
|
||||
mapboxMap.addLayerBelow(hillshadeLayer, LAYER_BELOW_ID);
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
mapView.onStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
mapView.onResume();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
mapView.onPause();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
mapView.onStop();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
mapView.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
mapView.onLowMemory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
mapView.onDestroy();
|
||||
}
|
||||
}
|
||||
@@ -9,9 +9,11 @@
|
||||
android:id="@id/mapView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:mapbox_cameraTargetLat="52.090710"
|
||||
app:mapbox_cameraTargetLng="5.121125"
|
||||
app:mapbox_cameraZoom="10"
|
||||
app:mapbox_cameraTargetLat="46.343350"
|
||||
app:mapbox_cameraTargetLng="7.497989"
|
||||
app:mapbox_cameraZoom="9"
|
||||
app:mapbox_cameraBearing="140"
|
||||
app:mapbox_cameraTilt="60"
|
||||
app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets"/>
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.mapbox.mapboxsdk.maps.MapView
|
||||
android:id="@id/mapView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:mapbox_cameraTargetLat="52.090710"
|
||||
app:mapbox_cameraTargetLng="5.121125"
|
||||
app:mapbox_cameraZoom="10"
|
||||
app:mapbox_styleUrl="@string/mapbox_style_mapbox_streets"/>
|
||||
|
||||
</RelativeLayout>
|
||||
@@ -69,4 +69,5 @@
|
||||
<string name="description_textureview_animate">Animate a map rendered on a TextureView</string>
|
||||
<string name="description_grid_source">Example Custom Geometry Source</string>
|
||||
<string name="description_local_glyph">Suzhou using Droid Sans for Chinese glyphs</string>
|
||||
<string name="description_hillshade">Example raster-dem source and hillshade layer</string>
|
||||
</resources>
|
||||
|
||||
@@ -69,4 +69,5 @@
|
||||
<string name="activity_textureview_animate">TextureView animation</string>
|
||||
<string name="activity_grid_source">Grid Source</string>
|
||||
<string name="activity_local_glyph">Local CJK glyph generation</string>
|
||||
<string name="activity_hillshade">Hillshade</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user