Skip to content
This repository has been archived by the owner on Jun 25, 2019. It is now read-only.

Encoding and ToolbarActions improvement #93

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Encoding and ToolbarActions improvement #93

wants to merge 9 commits into from

Conversation

LJaraCastillo
Copy link
Contributor

  • Added methods to add/edit/remove/change visibility of ToolbarActions
  • Added utility methods to encode and decode lists of Location

Flutter

* Support for encoded path for polyline and polygon.
* Added method for encode and decode paths.

Android

* Support for encoded path for polyline and polygon.
* Added maps-utils dependency for Android. This library has the functions to encode and decode the path.

iOS

* Incomplete changes regarding the path encoding.
* Added getter for PathData to make it easy to get the content from the child classes (EncodedPath and PathPoints).
* Added add/edit/remove behavior for ToolbarAction.
* Added method to change visibility of ToolbarAction.
Android & Flutter

* Removed the direct usage of encoded points in polylines and polygons due to complex usage in Dart code. (too much type casting)
* Encode and Decode methods in MapView remains as it is.

iOS

* Incomplete changes regarding the path encoding.
* Incomplete changes regarding ToolbarActions.
Flutter

* Updated version of uri package from ^0.11.1 to ^0.11.3
* dev_dependencies commented in example/pubspec.yaml due to error while compiling in last version of Flutter.

iOS

* Partial changes applied regarding encoding. Testing needed.
* Partial changes applied regaring toolbar actions. ViewControllers left. Testing needed.
iOS

* Toolbar Actions Methods Added and tested.
* Encode & decode methods added and tested.
Fix previous commit
@RaimundWege
Copy link

RaimundWege commented Aug 22, 2018

For those who need a decoded polyline right now:

import 'package:map_view/map_view.dart';

List<Location> decodePolyline(String encoded) {
  List<Location> points = new List<Location>();
  int index = 0, len = encoded.length;
  int lat = 0, lng = 0;
  while (index < len) {
    int b, shift = 0, result = 0;
    do {
      b = encoded.codeUnitAt(index++) - 63;
      result |= (b & 0x1f) << shift;
      shift += 5;
    } while (b >= 0x20);
    int dlat = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
    lat += dlat;
    shift = 0;
    result = 0;
    do {
      b = encoded.codeUnitAt(index++) - 63;
      result |= (b & 0x1f) << shift;
      shift += 5;
    } while (b >= 0x20);
    int dlng = ((result & 1) != 0 ? ~(result >> 1) : (result >> 1));
    lng += dlng;
    Location p = new Location(lat / 1E5, lng / 1E5);
    points.add(p);
  }
  return points;
}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants