diff --git a/.gitmodules b/.gitmodules index 2aa6d52be..0152ed56b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -14,6 +14,3 @@ path = platform/ios/vendor/SMCalloutView url = https://github.com/nfarina/calloutview.git -[submodule "src/mbgl/util/geojsonvt"] - path = src/mbgl/util/geojsonvt - url = https://github.com/mapbox/geojson-vt-cpp diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml b/android/java/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml index 15d5edc17..f91c57e7e 100644 --- a/android/java/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/AndroidManifest.xml @@ -17,6 +17,7 @@ + diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java index ed9b7ef06..eb5d891cd 100644 --- a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/MainActivity.java @@ -1,6 +1,7 @@ package com.mapbox.mapboxgl.testapp; import android.Manifest; +import android.content.Intent; import android.content.pm.PackageManager; import android.graphics.Color; import android.graphics.PointF; @@ -281,6 +282,10 @@ public class MainActivity extends AppCompatActivity { menuItem.setChecked(mMapView.isCompassEnabled()); return true; + case R.id.action_second_map_activity: + startActivity(new Intent(getApplicationContext(), SecondMapActivity.class)); + return true; + /* case R.id.followNone: mMapView.setUserLocationTrackingMode(MapView.UserLocationTrackingMode.NONE); diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/SecondMapActivity.java b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/SecondMapActivity.java new file mode 100644 index 000000000..976140ffc --- /dev/null +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxgl/testapp/SecondMapActivity.java @@ -0,0 +1,101 @@ +package com.mapbox.mapboxgl.testapp; + +import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.support.v7.widget.Toolbar; +import android.util.Log; +import android.view.MenuItem; +import com.mapbox.mapboxgl.views.MapView; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStreamReader; + +public class SecondMapActivity extends AppCompatActivity { + + private static final String TAG = "SecondMapActivity"; + + private MapView mMapView; + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setContentView(R.layout.activity_second); + + Toolbar toolbar = (Toolbar) findViewById(R.id.secondToolBar); + setSupportActionBar(toolbar); + getSupportActionBar().setDisplayHomeAsUpEnabled(true); + getSupportActionBar().setDisplayShowHomeEnabled(true); + + mMapView = (MapView) findViewById(R.id.secondMapView); + // Load the access token + try { + BufferedReader reader = new BufferedReader(new InputStreamReader(getResources().openRawResource(R.raw.token))); + String line = reader.readLine(); + mMapView.setAccessToken(line); + } catch (IOException e) { + Log.e(TAG, "Error loading access token from token.txt: " + e.toString()); + } + + mMapView.onCreate(savedInstanceState); + + mMapView.setStyleUrl(getString(R.string.styleURLEmerald)); + } + + /** + * Dispatch onStart() to all fragments. Ensure any created loaders are + * now started. + */ + @Override + protected void onStart() { + super.onStart(); + mMapView.onStart(); + } + + @Override + protected void onStop() { + super.onStop(); + mMapView.onStop(); + } + + // Called when our app goes into the background + @Override + public void onPause() { + super.onPause(); + + mMapView.onPause(); + } + + // Called when our app comes into the foreground + @Override + public void onResume() { + super.onResume(); + + mMapView.onResume(); + } + + @Override + protected void onDestroy() { + super.onDestroy(); + mMapView.onDestroy(); + } + + // Called when the system is running low on memory + @Override + public void onLowMemory() { + super.onLowMemory(); + + mMapView.onLowMemory(); + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case android.R.id.home: + onBackPressed(); + return true; + default: + return super.onOptionsItemSelected(item); + } + } +} diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/res/drawable-hdpi/ic_looks_two_white_24dp.png b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/drawable-hdpi/ic_looks_two_white_24dp.png new file mode 100644 index 000000000..2c9cf5b3a Binary files /dev/null and b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/drawable-hdpi/ic_looks_two_white_24dp.png differ diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/res/drawable-mdpi/ic_looks_two_white_24dp.png b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/drawable-mdpi/ic_looks_two_white_24dp.png new file mode 100644 index 000000000..e48d75421 Binary files /dev/null and b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/drawable-mdpi/ic_looks_two_white_24dp.png differ diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xhdpi/ic_looks_two_white_24dp.png b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xhdpi/ic_looks_two_white_24dp.png new file mode 100644 index 000000000..c9fc6633e Binary files /dev/null and b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xhdpi/ic_looks_two_white_24dp.png differ diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xxhdpi/ic_looks_two_white_24dp.png b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xxhdpi/ic_looks_two_white_24dp.png new file mode 100644 index 000000000..f8ab38aa6 Binary files /dev/null and b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xxhdpi/ic_looks_two_white_24dp.png differ diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xxxhdpi/ic_looks_two_white_24dp.png b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xxxhdpi/ic_looks_two_white_24dp.png new file mode 100644 index 000000000..bb2f2e434 Binary files /dev/null and b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/drawable-xxxhdpi/ic_looks_two_white_24dp.png differ diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_second.xml b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_second.xml new file mode 100644 index 000000000..2ffda1daa --- /dev/null +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/layout/activity_second.xml @@ -0,0 +1,21 @@ + + + + + + + + diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_drawer.xml b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_drawer.xml index a374ab18d..ff537aaf3 100644 --- a/android/java/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_drawer.xml +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/menu/menu_drawer.xml @@ -19,18 +19,24 @@ android:checkable="true" /> - + diff --git a/android/java/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml index 403da277c..836951cc5 100644 --- a/android/java/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml +++ b/android/java/MapboxGLAndroidSDKTestApp/src/main/res/values/strings.xml @@ -3,6 +3,8 @@ Mapbox GL + Second Activity + Toggle GPS location Disable tracking Use follow tracking mode @@ -10,6 +12,7 @@ Toggle compass Toggle debug mode Toggle point annotations + Launch 2nd Map FPS: diff --git a/configure b/configure index 6fbaa9f7f..6d0ac780c 100755 --- a/configure +++ b/configure @@ -15,8 +15,15 @@ function abort { >&2 echo -e "\033[1m\033[31m$1\033[0m"; exit 1; } function info { >&2 echo -e "\033[1m\033[33m$1\033[0m"; } function warn { >&2 echo -e "\033[1m\033[33m$1\033[0m"; } -# Install mason -export PATH="`pwd`/.mason:${PATH}" MASON_DIR="`pwd`/.mason" +if [ -d "`pwd`/.git" ]; then + info "This build is within a git repository" + export MASON_DIR="`pwd`/.mason" + export PATH="${MASON_DIR}:${PATH}" +else + info "This build is NOT within a git repository" + which mason || abort "You must install mason to build mapbox-gl-native (https://github.com/mapbox/mason)" + export MASON_DIR="$(dirname $(readlink $(which mason)))" +fi # You can override the function for a particular set of flags by defining a # print_XXX_flags function in your dependencies.sh file @@ -37,6 +44,23 @@ function print_flags { fi } +function print_build_flags { + local NAME=$1; shift + if [ "$(type -t print_${NAME}_flags)" = 'function' ]; then + print_${NAME}_flags + else + local VERSION=`echo "${NAME}_VERSION" | tr "[:lower:]" "[:upper:]"` + if [ ! -z ${!VERSION:-} ] ; then + mason build ${NAME} ${!VERSION} + for FLAGS in "$@" ; do + CONFIG+=" '${NAME}_${FLAGS}%': $(quote_flags $(mason ${FLAGS} ${NAME} ${!VERSION})),"$LN + done + else + warn "* Not using ${NAME}" + fi + fi +} + function print_default_flags { : } @@ -93,6 +117,8 @@ print_flags libuv static_libs cflags ldflags print_flags zlib static_libs cflags ldflags print_flags nunicode static_libs cflags ldflags print_flags libzip static_libs cflags ldflags +print_build_flags geojsonvt static_libs cflags ldflags +print_flags variant static_libs cflags ldflags CONFIG+=" } } diff --git a/gyp/core.gypi b/gyp/core.gypi index f9b361032..51009be69 100644 --- a/gyp/core.gypi +++ b/gyp/core.gypi @@ -31,10 +31,14 @@ '<@(libuv_cflags)', '<@(opengl_cflags)', '<@(boost_cflags)', + '<@(geojsonvt_cflags)', + '<@(variant_cflags)', ], 'cflags': [ '<@(libuv_cflags)', '<@(opengl_cflags)', + '<@(geojsonvt_cflags)', + '<@(variant_cflags)', '-fPIC' ], 'ldflags': [ @@ -43,6 +47,7 @@ ], 'libraries': [ '<@(libuv_static_libs)', + '<@(geojsonvt_static_libs)', ], }, diff --git a/gyp/version.gypi b/gyp/version.gypi index 1cc2eb351..4efdd079a 100644 --- a/gyp/version.gypi +++ b/gyp/version.gypi @@ -13,7 +13,7 @@ 'outputs': [ '<(SHARED_INTERMEDIATE_DIR)/include/mbgl/util/version.hpp', ], - 'action': ['<@(_inputs)', '<(SHARED_INTERMEDIATE_DIR)', ' + #include #include #include #include #include #include -#include #include #include diff --git a/src/mbgl/map/annotation.hpp b/src/mbgl/map/annotation.hpp index 5adec162f..6b80d9f6c 100644 --- a/src/mbgl/map/annotation.hpp +++ b/src/mbgl/map/annotation.hpp @@ -1,13 +1,14 @@ #ifndef MBGL_MAP_ANNOTATIONS #define MBGL_MAP_ANNOTATIONS +#include + #include #include #include #include #include #include -#include #include #include diff --git a/test/test.gypi b/test/test.gypi index a35b00133..c53263bd5 100644 --- a/test/test.gypi +++ b/test/test.gypi @@ -95,6 +95,7 @@ 'libraries': [ '<@(libuv_static_libs)', '<@(sqlite_static_libs)', + '<@(geojsonvt_static_libs)', ], 'variables': { 'cflags_cc': [ @@ -102,6 +103,8 @@ '<@(opengl_cflags)', '<@(boost_cflags)', '<@(sqlite_cflags)', + '<@(geojsonvt_cflags)', + '<@(variant_cflags)', ], 'ldflags': [ '<@(libuv_ldflags)',