Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Add expression conversion, getters, tests #11352

Merged
merged 2 commits into from
Mar 8, 2018

Conversation

tobrun
Copy link
Member

@tobrun tobrun commented Mar 1, 2018

Closes #10721, #10722, #11247, #10868

This PR adds accessors for expressions and removes the old API for doing DDS.

  • add conversion template to convert mapbox::geometry::value to JsonArray
  • convert JsonArray.java to Expression.java
  • add basic set/get tests for camera, source and composite functions
  • add edge case test for internal expression conversion (eg. rgb becomes rgba)
  • remove old DDS stop concepts in c++ and java
  • replace all old DDS examples in test app with expressions
  • replace anonymous inner classes by lamba constructs in generated test code Replace anonymous inner classes with lambda in generated code #10868
  • simplify function concept in java code (eg. only expose expression on PropertyValue.java)
  • add generated tests for using an expression in any paint/layout property
  • cleanup code

@tobrun tobrun added the Android Mapbox Maps SDK for Android label Mar 1, 2018
@tobrun tobrun added this to the android-v6.0.0 milestone Mar 1, 2018
@tobrun tobrun self-assigned this Mar 1, 2018
@tobrun tobrun force-pushed the tvn-expressions-continued branch from 147093e to b98f2cc Compare March 1, 2018 13:38
@tobrun tobrun force-pushed the tvn-expressions-continued branch from b98f2cc to 09ee6e3 Compare March 2, 2018 15:55
@tobrun tobrun requested a review from ivovandongen March 2, 2018 15:56
@tobrun tobrun force-pushed the tvn-expressions-continued branch 4 times, most recently from 619a7e4 to 21f8838 Compare March 5, 2018 12:05
Copy link
Contributor

@ivovandongen ivovandongen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Two general remarks (maybe a follow-up):

  • Let's make all new jni bindings use the high-level abstractions as much as possible (eg, the new templates and evaluator)
  • There are some classes in platform/android/src/gson that are a good place to add much of the conversion now inline in the evaluator.

return object;
}

jni::jobject*operator()(const std::vector<mapbox::geometry::value> values) const {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space after star

return jarray;
}

jni::jobject*operator()(const std::unordered_map<std::string, mapbox::geometry::value> value) const {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space after star

Result<jni::jobject*> operator()(jni::JNIEnv& env, const mapbox::geometry::value& value) const {
JsonEvaluator evaluator { env } ;
jni::jobject* converted = mapbox::geometry::value::visit(value, evaluator);
return {converted};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spaces around converted

@@ -39,7 +40,7 @@ class PropertyValueEvaluator {
}

jni::jobject* operator()(const mbgl::style::CompositeFunction<T> &value) const {
return *convert<jni::jobject*, mbgl::style::CompositeFunction<T>>(env, value);
return *convert<jni::jobject*, mbgl::style::CompositeFunction<T>>(env, value);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accidental space?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -7,6 +7,7 @@
#include "../../conversion/constant.hpp"
#include "types.hpp"
#include "function.hpp"
#include "json.hpp"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we name this gson.hpp?

@tobrun tobrun merged commit 6179110 into release-boba Mar 8, 2018
@tobrun tobrun deleted the tvn-expressions-continued branch March 8, 2018 15:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants