summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorŁukasz Paczos <lukas.paczos@gmail.com>2019-05-31 14:40:47 +0200
committerŁukasz Paczos <lukas.paczos@gmail.com>2019-05-31 14:40:47 +0200
commit06bed75c9889602111c4e56158713c5eb439c888 (patch)
tree03a679cd27fab4c0eda2b3105abc3efbe805ed52
parent0181ef8f63351aa2724d5a89ba9ea3e5484e3aaf (diff)
downloadqtlocation-mapboxgl-upstream/lp-sdf-artifacts-repro.tar.gz
[core] sdf impacting other icons repro caseupstream/lp-sdf-artifacts-repro
-rw-r--r--platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/SimpleMapActivity.java40
1 files changed, 39 insertions, 1 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/SimpleMapActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/SimpleMapActivity.java
index 66faf9b7a8..b0a5e0b9b3 100644
--- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/SimpleMapActivity.java
+++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/maplayout/SimpleMapActivity.java
@@ -1,12 +1,25 @@
package com.mapbox.mapboxsdk.testapp.activity.maplayout;
+import android.graphics.Bitmap;
+import android.graphics.Color;
import android.os.Bundle;
+import android.support.annotation.NonNull;
+import android.support.v4.content.ContextCompat;
import android.support.v7.app.AppCompatActivity;
import android.view.MenuItem;
+
+import com.mapbox.geojson.Feature;
+import com.mapbox.geojson.FeatureCollection;
+import com.mapbox.geojson.Point;
import com.mapbox.mapboxsdk.maps.MapView;
import com.mapbox.mapboxsdk.maps.Style;
+import com.mapbox.mapboxsdk.style.expressions.Expression;
+import com.mapbox.mapboxsdk.style.layers.PropertyFactory;
+import com.mapbox.mapboxsdk.style.layers.SymbolLayer;
+import com.mapbox.mapboxsdk.style.sources.GeoJsonSource;
import com.mapbox.mapboxsdk.testapp.R;
import com.mapbox.mapboxsdk.testapp.utils.NavUtils;
+import com.mapbox.mapboxsdk.utils.BitmapUtils;
/**
* Test activity showcasing a simple MapView without any MapboxMap interaction.
@@ -22,7 +35,32 @@ public class SimpleMapActivity extends AppCompatActivity {
mapView = findViewById(R.id.mapView);
mapView.onCreate(savedInstanceState);
mapView.getMapAsync(mapboxMap -> mapboxMap.setStyle(
- new Style.Builder().fromUrl(Style.MAPBOX_STREETS)
+ new Style.Builder().fromUrl(Style.MAPBOX_STREETS), new Style.OnStyleLoaded() {
+ @Override
+ public void onStyleLoaded(@NonNull Style style) {
+ mapboxMap.setDebugActive(true);
+
+ Feature feature1 = Feature.fromGeometry(Point.fromLngLat(16, 50));
+ feature1.addStringProperty("icon", "car-15" /*MAKI*/);
+
+ Feature feature2 = Feature.fromGeometry(Point.fromLngLat(-15, 40));
+ feature2.addStringProperty("icon", "sdf-image");
+
+ Bitmap bitmap = BitmapUtils.getBitmapFromDrawable(ContextCompat.getDrawable(SimpleMapActivity.this,
+ R.drawable.mapbox_user_puck_icon));
+ if (bitmap != null) {
+ style.addImage("sdf-image", bitmap, true /*SDF*/);
+ }
+
+ style.addSource(new GeoJsonSource("source",
+ FeatureCollection.fromFeatures(new Feature[] {feature1, feature2})));
+ style.addLayer(new SymbolLayer("layer", "source")
+ .withProperties(
+ PropertyFactory.iconImage(Expression.get("icon")),
+ PropertyFactory.iconColor(Color.RED))
+ );
+ }
+ }
));
}