Skip to content

Commit

Permalink
Merged (#1)
Browse files Browse the repository at this point in the history
* Expose CompassViewPosition flutter-mapbox-gl#344 (flutter-mapbox-gl#346)

Co-authored-by: emre.yalcin <emre.yalcin@netcad.com.tr>

* Readme: location features on Android (flutter-mapbox-gl#342)

* Update CONTRIBUTING.md (flutter-mapbox-gl#366)

* Release 0.8.0 (flutter-mapbox-gl#390)

* [release] update CHANGELOG.md for release of v0.8.0

* [release] update version numbers to v0.8.0

* Update CONTRIBUTING.md (flutter-mapbox-gl#401)

Fix stale pull, issues & changelog urls in the contributing guide.

* Fix data parameter for addLine and addCircle (flutter-mapbox-gl#388)

* Split padding values in CameraUpdate.newLatLngBounds() (flutter-mapbox-gl#382)

* Split padding values in CameraUpdate.newLatLngBounds()

* Remove old unused code

Co-authored-by: Tobrun <tobrun.van.nuland@gmail.com>

* Re-enable attribution on android (flutter-mapbox-gl#383)

* Upgrade Android annotation plugin to v0.9 (flutter-mapbox-gl#381)

* web: ignore myLocationTrackingMode if myLocationEnabled is false (flutter-mapbox-gl#363)

* Add methods to access projection (flutter-mapbox-gl#380)

* remove bitmap; add projection access

* Replace ScreenLocation with Point; expand iOS implementation

* fix iOS with guard let

* iOS: cast to NSObject

* fix typo

* round result of toScreenLocation()

* Revert "round result of toScreenLocation()"

This reverts commit 838726a.

* Docs: document rounding behaviour

* Add Fill API support (flutter-mapbox-gl#49)

* [flutter] [android] - add fill support

* Resolved merge conflict.

* A first working version for ios (after some extensive rebasing).

* Minor cleanup

* Minor cleanup.

* Fix broken build Android.

* A working version for Android.

* Minor cleanup.

* Added fill pattern example. Works on Android not on iOS. Seems to break consecutive fills though.

* For the first queried feature (when filter is set) create a fill.

* Fix lint issue (unused method).

* Updated code formatting.

* Added interior polygon to iOS.

* [docs] update readme support table

* fixup

Co-authored-by: Timothy Sealy <timothy.sealy@gmail.com>

* Listen to OnUserLocationUpdated to provide user location to app (flutter-mapbox-gl#237)

* Listen to OnUserLocationUpdated to provide user location to app

While the `myLocationEnabled` property is set to `true`, this method is
called whenever a new location update is received by the map view.

iOS only, needs Android. I did check that the location properties
carried here are also provided in Android's [Location][1] object.

[1]: https://developer.android.com/reference/android/location/Location

* add android, web; fix conflicts

Co-authored-by: m0nac0 <58807793+m0nac0@users.noreply.github.com>
Co-authored-by: Tobrun <tobrun.van.nuland@gmail.com>

* fix: correct bug on android where checking on activity lifecycles that were disposed (flutter-mapbox-gl#266)

Co-authored-by: leo cornillon <leo.cornillon.dev@gmail.com>
Co-authored-by: m0nac0 <58807793+m0nac0@users.noreply.github.com>

* Add support for custom font stack in symbol options (flutter-mapbox-gl#359)

* fix memory leak caused by strong self reference (flutter-mapbox-gl#370)

* Basic ImageSource Support (flutter-mapbox-gl#409)

* Introduce LatLngQuad

Introduce the LatLngQuad object which will be
useful to pass in all the required parameters
to the addSource() method we will define later.

* Introduce addSource() Method

Add the addSource(..) method to the mapbox_gl_platform_interface.dart

* Add addSource MethodChannel

* Place ImageSource Android

- Introduce the PlaceSource page as a playground
- Add 'addImageSource', 'removeImageSource', 'addLayer' & 'removeLayer' apis
- Implement Android platform interface

* iOS ImageSource Implementation

Implement addImageSource, removeImageSource, addLayer &
removeLayer on iOS.

* Fix iOS CoordinateQuad Mapping

Co-authored-by: Tobrun <tobrun.van.nuland@gmail.com>

* Get meters per pixel at latitude (flutter-mapbox-gl#416)

* fix git refferences

* fix git refferences

* implementation of getMetersPerPixelAtLatitude

* getMetersPerPixelAtLatitude

* fix refference paths

* Android implementation and Example updated.

* added comments to getMetersPerPixelAtLatitude method

* IOS implementation

* Removed modified lines from pubspec.yaml files

* web implementation

Co-authored-by: Tobrun <tobrun.van.nuland@gmail.com>

* fix onStyleLoadedCallback (flutter-mapbox-gl#418)

* fix onStyleLoadedCallback

* fix onStyleLoadedCallback called before onMapCreated

Co-authored-by: Tobrun <tobrun.van.nuland@gmail.com>

* Release 0.9.0

* update version numbers for v0.9.0 release

* fix ios onSymbolTapped

Co-authored-by: emreuguryalcintr <50848628+emreuguryalcintr@users.noreply.github.com>
Co-authored-by: emre.yalcin <emre.yalcin@netcad.com.tr>
Co-authored-by: m0nac0 <58807793+m0nac0@users.noreply.github.com>
Co-authored-by: Tobrun <tobrun.van.nuland@gmail.com>
Co-authored-by: cuberob <robdeknegt@gmail.com>
Co-authored-by: qbouchat <48958612+qbouchat@users.noreply.github.com>
Co-authored-by: Timothy Sealy <timothy.sealy@gmail.com>
Co-authored-by: Nathan <nathan@transit.app>
Co-authored-by: Leo Cornillon <corle.cugly@gmail.com>
Co-authored-by: leo cornillon <leo.cornillon.dev@gmail.com>
Co-authored-by: Philip Lindberg <philip.c.lindberg@gmail.com>
Co-authored-by: Thomas Kröniger <30893720+thirteenthstep@users.noreply.github.com>
Co-authored-by: cuberob <git@cuberob.com>
Co-authored-by: GULERTOLGA <gulertolga@gmail.com>
Co-authored-by: Andrea Valenzano <andr3a689@gmail.com>
  • Loading branch information
16 people committed Nov 15, 2020
1 parent 40d0419 commit 34769d9
Show file tree
Hide file tree
Showing 48 changed files with 1,843 additions and 206 deletions.
39 changes: 32 additions & 7 deletions CHANGELOG.md
@@ -1,3 +1,28 @@
## 0.9.0, October 24. 2020
* Fix data parameter for addLine and addCircle [#388](https://github.com/tobrun/flutter-mapbox-gl/pull/388)
* Re-enable attribution on Android [#383](https://github.com/tobrun/flutter-mapbox-gl/pull/383)
* Upgrade annotation plugin to v0.9 [#381](https://github.com/tobrun/flutter-mapbox-gl/pull/381)
* Breaking change: CameraUpdate.newLatLngBounds() now supports setting different padding values for left, top, right, bottom with default of 0 for all. Implementations using the old approach with only one padding value for all edges have to be updated. [#382](https://github.com/tobrun/flutter-mapbox-gl/pull/382)
* web:ignore myLocationTrackingMode if myLocationEnabled is false [#363](https://github.com/tobrun/flutter-mapbox-gl/pull/363)
* Add methods to access projection [#380](https://github.com/tobrun/flutter-mapbox-gl/pull/380)
* Add fill API support for Android and iOS [#49](https://github.com/tobrun/flutter-mapbox-gl/pull/49)
* Listen to OnUserLocationUpdated to provide user location to app [#237](https://github.com/tobrun/flutter-mapbox-gl/pull/237)
* Correct integration in Activity lifecycle on Android [#266](https://github.com/tobrun/flutter-mapbox-gl/pull/266)
* Add support for custom font stackn in symbol options [#359](https://github.com/tobrun/flutter-mapbox-gl/pull/359)
* Fix memory leak on iOS caused by strong self reference [#370](https://github.com/tobrun/flutter-mapbox-gl/pull/370)
* Basic ImageSource Support [#409](https://github.com/tobrun/flutter-mapbox-gl/pull/409)
* Get meters per pixel at latitude [#416](https://github.com/tobrun/flutter-mapbox-gl/pull/416)
* Fix onStyleLoadedCallback [#418](https://github.com/tobrun/flutter-mapbox-gl/pull/418)

## 0.8.0, August 22, 2020
- implementation of feature querying [#177](https://github.com/tobrun/flutter-mapbox-gl/pull/177)
- Batch create/delete of symbols [#279](https://github.com/tobrun/flutter-mapbox-gl/pull/279)
- Add multi map support [#315](https://github.com/tobrun/flutter-mapbox-gl/pull/315)
- Fix OnCameraIdle not being invoked [#313](https://github.com/tobrun/flutter-mapbox-gl/pull/313)
- Fix android zIndex symbol option [#312](https://github.com/tobrun/flutter-mapbox-gl/pull/312)
- Set dependencies from git [#319](https://github.com/tobrun/flutter-mapbox-gl/pull/319)
- Add line#getGeometry and symbol#getGeometry [#281](https://github.com/tobrun/flutter-mapbox-gl/pull/281)

## 0.7.0, June 6, 2020
* Introduction of mapbox_gl_platform_interface library
* Introduction of mapbox_gl_web library
Expand All @@ -8,12 +33,12 @@
* Update mapbox depdendency to 9.2.0 (android) and 5.6.0 (iOS)
* Long press handlers for both iOS as Android
* Change default location tracking to none
* OnCameraIdle listener support
* Add image to style
* OnCameraIdle listener support
* Add image to style
* Add animation duration to animateCamera
* Content insets
* Visible region support on iOS
* Numerous bug fixes
* Numerous bug fixes

## 0.0.5, December 21, 2019
* iOS support for annotation extensions (circle, symbol, line)
Expand All @@ -25,13 +50,13 @@
* Last location API (Android)
* Throttle max FPS of user location component (Android)
* Fix for handling permission handling of the test application (Android)
* Support for loading symbol images from assets (iOS/Android)
* Support for loading symbol images from assets (iOS/Android)

## v0.0.4, Nov 2, 2019
* Update SDK to 8.4.0 (Android) and 5.4.0 (iOS)
* Add support for sideloading offline maps (Android/iOS)
* Add user tracking mode (iOS)
* Invert compassView.isHidden logic (iOS)
* Invert compassView.isHidden logic (iOS)
* Specific swift version (iOS)

## v0.0.3, Mar 30, 2019
Expand All @@ -40,7 +65,7 @@
* Update codebase to AndroidX
* Update Mapbox Maps SDK for Android to v7.3.0

## v0.0.2, Mar 23, 2019
## v0.0.2, Mar 23, 2019
* Support for iOS
* Migration to embedded Android and iOS SDK View system
* Style URL API
Expand All @@ -51,5 +76,5 @@
* Location component (Android)
* Camera API (Android)

## v0.0.1, May 7, 2018
## v0.0.1, May 7, 2018
* Initial Android surface rendering POC
11 changes: 5 additions & 6 deletions CONTRIBUTING.md
Expand Up @@ -2,15 +2,14 @@

We welcome contributions to this repository. Please follow these steps if you're interested in making contributions:

1. Please familiarize yourself with the [install process](https://github.com/mapbox/flutter-mapbox-gl#getting-started).
1. Please familiarize yourself with the [process of running the example app](https://github.com/tobrun/flutter-mapbox-gl#running-the-example-app) and [add a Mapbox access token](https://github.com/tobrun/flutter-mapbox-gl#adding-a-mapbox-access-token) as described in the Readme.
2. Ensure that existing [pull requests](https://github.com/tobrun/flutter-mapbox-gl/pulls) and [issues](https://github.com/tobrun/flutter-mapbox-gl/issues) don’t already cover your contribution or question.

2. Ensure that existing [pull requests](https://github.com/mapbox/flutter-mapbox-gl/pulls) and [issues](https://github.com/mapbox/flutter-mapbox-gl/issues) don’t already cover your contribution or question.
3. Create a new branch that will contain your contributed code. Along with your contribution you should also adapt the example app to showcase any new features or APIs you have developed. This also makes testing your contribution much easier. Eventually create a pull request once you're done making changes.

3. Create a new branch that will contain your contributed code and eventually create a pull request once you're done making changes.

4. If there are any changes that developers should be aware of, please update the [changelog](https://github.com/mapbox/flutter-mapbox-gl/blob/master/CHANGELOG.md) once your pull request has been merged to the `master` branch.
4. If there are any changes that developers should be aware of, please update the [changelog](https://github.com/tobrun/flutter-mapbox-gl/blob/master/CHANGELOG.md) once your pull request has been merged to the `master` branch.

# Code of conduct
Everyone is invited to participate in Mapbox’s open source projects and public discussions: we want to create a welcoming and friendly environment. Harassment of participants or other unethical and unprofessional behavior will not be tolerated in our spaces. The [Contributor Covenant](http://contributor-covenant.org) applies to all projects under the Mapbox organization and we ask that you please read [the full text](http://contributor-covenant.org/version/1/2/0/).

You can learn more about our open source philosophy on [mapbox.com](https://www.mapbox.com/about/open/).
You can learn more about our open source philosophy on [mapbox.com](https://www.mapbox.com/about/open/).
7 changes: 5 additions & 2 deletions README.md
Expand Up @@ -40,7 +40,7 @@ This project is available on [pub.dev](https://pub.dev/packages/mapbox_gl), foll
| Symbol | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Circle | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Line | :white_check_mark: | :white_check_mark: | :white_check_mark: |
| Fill | | | |
| Fill | :white_check_mark: | :white_check_mark: | |

## Map Styles

Expand Down Expand Up @@ -109,8 +109,11 @@ An offline region is a defined region of a map that is available for use in cond


## Location features
To enable location features in an **Android** application:

To enable location features in an iOS application:
You need to declare the `ACCESS_COARSE_LOCATION` or `ACCESS_FINE_LOCATION` permission in the AndroidManifest.xml and starting from Android API level 23 also request it at runtime. The plugin does not handle this for you. The example app uses the flutter ['location' plugin](https://pub.dev/packages/location) for this.

To enable location features in an **iOS** application:

If you access your users' location, you should also add the following key to your Info.plist to explain why you need access to their location data:

Expand Down
2 changes: 1 addition & 1 deletion android/build.gradle
Expand Up @@ -38,7 +38,7 @@ android {
}
dependencies {
implementation "com.mapbox.mapboxsdk:mapbox-android-sdk:9.2.0"
implementation "com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:0.8.0"
implementation "com.mapbox.mapboxsdk:mapbox-android-plugin-annotation-v9:0.9.0"
implementation "com.mapbox.mapboxsdk:mapbox-android-plugin-localization-v9:0.12.0"
implementation "com.mapbox.mapboxsdk:mapbox-android-plugin-offline-v8:0.6.0"
}
Expand Down
68 changes: 62 additions & 6 deletions android/src/main/java/com/mapbox/mapboxgl/Convert.java
Expand Up @@ -5,7 +5,7 @@
package com.mapbox.mapboxgl;

import android.graphics.Point;

import com.mapbox.geojson.Polygon;
import com.mapbox.mapboxsdk.camera.CameraPosition;
import com.mapbox.mapboxsdk.camera.CameraUpdate;
import com.mapbox.mapboxsdk.camera.CameraUpdateFactory;
Expand Down Expand Up @@ -75,8 +75,8 @@ static CameraUpdate toCameraUpdate(Object o, MapboxMap mapboxMap, float density)
case "newLatLng":
return CameraUpdateFactory.newLatLng(toLatLng(data.get(1)));
case "newLatLngBounds":
return CameraUpdateFactory.newLatLngBounds(
toLatLngBounds(data.get(1)), toPixels(data.get(2), density));
return CameraUpdateFactory.newLatLngBounds(toLatLngBounds(data.get(1)), toPixels(data.get(2), density),
toPixels(data.get(3), density), toPixels(data.get(4), density), toPixels(data.get(5), density));
case "newLatLngZoom":
return CameraUpdateFactory.newLatLngZoom(toLatLng(data.get(1)), toFloat(data.get(2)));
case "scrollBy":
Expand All @@ -100,7 +100,7 @@ static CameraUpdate toCameraUpdate(Object o, MapboxMap mapboxMap, float density)
case "bearingTo":
return CameraUpdateFactory.bearingTo(toFloat(data.get(1)));
case "tiltTo":
return CameraUpdateFactory.tiltTo(toFloat(data.get(1)));
return CameraUpdateFactory.tiltTo(toFloat(data.get(1)));
default:
throw new IllegalArgumentException("Cannot interpret " + o + " as CameraUpdate");
}
Expand Down Expand Up @@ -155,7 +155,7 @@ private static LatLngBounds toLatLngBounds(Object o) {
return builder.build();
}

private static List<LatLng> toLatLngList(Object o) {
static List<LatLng> toLatLngList(Object o) {
if (o == null) {
return null;
}
Expand All @@ -168,6 +168,31 @@ private static List<LatLng> toLatLngList(Object o) {
return latLngList;
}

private static List<List<LatLng>> toLatLngListList(Object o) {
if (o == null) {
return null;
}
final List<?> data = toList(o);
List<List<LatLng>> latLngListList = new ArrayList<>();
for (int i = 0; i < data.size(); i++) {
List<LatLng> latLngList = toLatLngList(data.get(i));
latLngListList.add(latLngList);
}
return latLngListList;
}

static Polygon interpretListLatLng(List<List<LatLng>> geometry) {
List<List<com.mapbox.geojson.Point>> points = new ArrayList<>(geometry.size());
for (List<LatLng> innerGeometry : geometry) {
List<com.mapbox.geojson.Point> innerPoints = new ArrayList<>(innerGeometry.size());
for (LatLng latLng : innerGeometry) {
innerPoints.add(com.mapbox.geojson.Point.fromLngLat(latLng.getLongitude(), latLng.getLatitude()));
}
points.add(innerPoints);
}
return Polygon.fromLngLats(points);
}

private static List<?> toList(Object o) {
return (List<?>) o;
}
Expand Down Expand Up @@ -294,6 +319,10 @@ static void interpretSymbolOptions(Object o, SymbolOptionsSink sink) {
if (iconAnchor != null) {
sink.setIconAnchor(toString(iconAnchor));
}
final ArrayList fontNames = (ArrayList) data.get("fontNames");
if (fontNames != null) {
sink.setFontNames((String[]) fontNames.toArray(new String[0]));
}
final Object textField = data.get("textField");
if (textField != null) {
sink.setTextField(toString(textField));
Expand Down Expand Up @@ -423,7 +452,6 @@ static void interpretCircleOptions(Object o, CircleOptionsSink sink) {
sink.setDraggable(toBoolean(draggable));
}
}

static void interpretLineOptions(Object o, LineOptionsSink sink) {
final Map<?, ?> data = toMap(o);
final Object lineJoin = data.get("lineJoin");
Expand Down Expand Up @@ -477,4 +505,32 @@ static void interpretLineOptions(Object o, LineOptionsSink sink) {
sink.setDraggable(toBoolean(draggable));
}
}

static void interpretFillOptions(Object o, FillOptionsSink sink) {
final Map<?, ?> data = toMap(o);
final Object fillOpacity = data.get("fillOpacity");
if (fillOpacity != null) {
sink.setFillOpacity(toFloat(fillOpacity));
}
final Object fillColor = data.get("fillColor");
if (fillColor != null) {
sink.setFillColor(toString(fillColor));
}
final Object fillOutlineColor = data.get("fillOutlineColor");
if (fillOutlineColor != null) {
sink.setFillOutlineColor(toString(fillOutlineColor));
}
final Object fillPattern = data.get("fillPattern");
if (fillPattern != null) {
sink.setFillPattern(toString(fillPattern));
}
final Object geometry = data.get("geometry");
if (geometry != null) {
sink.setGeometry(toLatLngListList(geometry));
}
final Object draggable = data.get("draggable");
if (draggable != null) {
sink.setDraggable(toBoolean(draggable));
}
}
}
58 changes: 58 additions & 0 deletions android/src/main/java/com/mapbox/mapboxgl/FillBuilder.java
@@ -0,0 +1,58 @@
// This file is generated.

// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package com.mapbox.mapboxgl;

import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.plugins.annotation.Fill;
import com.mapbox.mapboxsdk.plugins.annotation.FillManager;
import com.mapbox.mapboxsdk.plugins.annotation.FillOptions;

import java.util.List;

class FillBuilder implements FillOptionsSink {
private final FillManager fillManager;
private final FillOptions fillOptions;

FillBuilder(FillManager fillManager) {
this.fillManager = fillManager;
this.fillOptions = new FillOptions();
}

Fill build() {
return fillManager.create(fillOptions);
}

@Override
public void setFillOpacity(float fillOpacity) {
fillOptions.withFillOpacity(fillOpacity);
}

@Override
public void setFillColor(String fillColor) {
fillOptions.withFillColor(fillColor);
}

@Override
public void setFillOutlineColor(String fillOutlineColor) {
fillOptions.withFillOutlineColor(fillOutlineColor);
}

@Override
public void setFillPattern(String fillPattern) {
fillOptions.withFillPattern(fillPattern);
}

@Override
public void setGeometry(List<List<LatLng>> geometry) {
fillOptions.withGeometry(Convert.interpretListLatLng(geometry));
}

@Override
public void setDraggable(boolean draggable) {
fillOptions.withDraggable(draggable);
}
}
74 changes: 74 additions & 0 deletions android/src/main/java/com/mapbox/mapboxgl/FillController.java
@@ -0,0 +1,74 @@
// This file is generated.

// Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

package com.mapbox.mapboxgl;

import android.graphics.Color;
import com.mapbox.mapboxsdk.geometry.LatLng;
import com.mapbox.mapboxsdk.plugins.annotation.Fill;
import com.mapbox.mapboxsdk.plugins.annotation.FillManager;

import java.util.List;

/**
* Controller of a single Fill on the map.
*/
class FillController implements FillOptionsSink {
private final Fill fill;
private final OnFillTappedListener onTappedListener;
private boolean consumeTapEvents;

FillController(Fill fill, boolean consumeTapEvents, OnFillTappedListener onTappedListener) {
this.fill = fill;
this.consumeTapEvents = consumeTapEvents;
this.onTappedListener = onTappedListener;
}

boolean onTap() {
if (onTappedListener != null) {
onTappedListener.onFillTapped(fill);
}
return consumeTapEvents;
}

void remove(FillManager fillManager) {
fillManager.delete(fill);
}

@Override
public void setFillOpacity(float fillOpacity) {
fill.setFillOpacity(fillOpacity);
}

@Override
public void setFillColor(String fillColor) {
fill.setFillColor(Color.parseColor(fillColor));
}

@Override
public void setFillOutlineColor(String fillOutlineColor) {
fill.setFillOutlineColor(Color.parseColor(fillOutlineColor));
}

@Override
public void setFillPattern(String fillPattern) {
fill.setFillPattern(fillPattern);
}

@Override
public void setGeometry(List<List<LatLng>> geometry) {
fill.setGeometry(Convert.interpretListLatLng(geometry));
}

@Override
public void setDraggable(boolean draggable) {
fill.setDraggable(draggable);
}

public void update(FillManager fillManager) {
fillManager.update(fill);
}
}

0 comments on commit 34769d9

Please sign in to comment.