This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Repository navigation
Enable Within Expression with paint property + Filter Expression
#16157
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
924ce26
Enable parse within expression
zmiao c1beba8
Enable within expression with Filter
zmiao 3d19820
Add support for expression test
zmiao 0cd4d5b
Update baselines
zmiao 1defde6
Add metric baselines for within expression/render tests
zmiao 4e66246
reserve vecotr capacity, fix for points within polygon
zmiao 3c065b8
Add Changelog entry for within expression usage with paint property a…
zmiao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| #pragma once | ||
|
|
||
| #include <mbgl/style/conversion.hpp> | ||
| #include <mbgl/style/expression/expression.hpp> | ||
| #include <mbgl/style/expression/parsing_context.hpp> | ||
| #include <mbgl/util/geojson.hpp> | ||
|
|
||
| #include <memory> | ||
|
|
||
| namespace mbgl { | ||
| namespace style { | ||
| namespace expression { | ||
|
|
||
| class Within final : public Expression { | ||
| public: | ||
| explicit Within(GeoJSON geojson); | ||
|
|
||
| ~Within() override; | ||
|
|
||
| EvaluationResult evaluate(const EvaluationContext&) const override; | ||
|
|
||
| static ParseResult parse(const mbgl::style::conversion::Convertible&, ParsingContext&); | ||
|
|
||
| void eachChild(const std::function<void(const Expression&)>&) const override {} | ||
|
|
||
| bool operator==(const Expression& e) const override { | ||
| if (e.getKind() == Kind::Within) { | ||
| auto rhs = static_cast<const Within*>(&e); | ||
| return geoJSONSource == rhs->geoJSONSource; | ||
| } | ||
| return false; | ||
| } | ||
|
|
||
| std::vector<optional<Value>> possibleOutputs() const override { return {{true}, {false}}; } | ||
|
|
||
| mbgl::Value serialize() const override; | ||
| std::string getOperator() const override { return "within"; } | ||
|
|
||
| private: | ||
| GeoJSON geoJSONSource; | ||
| }; | ||
|
|
||
| } // namespace expression | ||
| } // namespace style | ||
| } // namespace mbgl | ||
35 changes: 35 additions & 0 deletions
35
...s/android-render-test-runner/render-tests/within/filter-with-inlined-geojson/metrics.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| { | ||
| "network": [ | ||
| [ | ||
| "probeNetwork - default - end", | ||
| 0, | ||
| 0 | ||
| ], | ||
| [ | ||
| "probeNetwork - default - start", | ||
| 0, | ||
| 0 | ||
| ] | ||
| ], | ||
| "gfx": [ | ||
| [ | ||
| "probeGFX - default - end", | ||
| 4, | ||
| 4, | ||
| 10, | ||
| 1, | ||
| [ | ||
| 49152, | ||
| 49152 | ||
| ], | ||
| [ | ||
| 66, | ||
| 66 | ||
| ], | ||
| [ | ||
| 100, | ||
| 100 | ||
| ] | ||
| ] | ||
| ] | ||
| } |
35 changes: 35 additions & 0 deletions
35
metrics/android-render-test-runner/render-tests/within/paint-circle/metrics.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| { | ||
| "network": [ | ||
| [ | ||
| "probeNetwork - default - end", | ||
| 0, | ||
| 0 | ||
| ], | ||
| [ | ||
| "probeNetwork - default - start", | ||
| 0, | ||
| 0 | ||
| ] | ||
| ], | ||
| "gfx": [ | ||
| [ | ||
| "probeGFX - default - end", | ||
| 16, | ||
| 13, | ||
| 29, | ||
| 1, | ||
| [ | ||
| 196608, | ||
| 196608 | ||
| ], | ||
| [ | ||
| 246, | ||
| 246 | ||
| ], | ||
| [ | ||
| 528, | ||
| 528 | ||
| ] | ||
| ] | ||
| ] | ||
| } |
35 changes: 35 additions & 0 deletions
35
metrics/android-render-test-runner/render-tests/within/paint-icon/metrics.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| { | ||
| "network": [ | ||
| [ | ||
| "probeNetwork - default - end", | ||
| 2, | ||
| 211659 | ||
| ], | ||
| [ | ||
| "probeNetwork - default - start", | ||
| 0, | ||
| 0 | ||
| ] | ||
| ], | ||
| "gfx": [ | ||
| [ | ||
| "probeGFX - default - end", | ||
| 13, | ||
| 17, | ||
| 22, | ||
| 1, | ||
| [ | ||
| 154848, | ||
| 154848 | ||
| ], | ||
| [ | ||
| 174, | ||
| 174 | ||
| ], | ||
| [ | ||
| 528, | ||
| 528 | ||
| ] | ||
| ] | ||
| ] | ||
| } |
35 changes: 35 additions & 0 deletions
35
metrics/android-render-test-runner/render-tests/within/paint-text/metrics.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| { | ||
| "network": [ | ||
| [ | ||
| "probeNetwork - default - end", | ||
| 1, | ||
| 84942 | ||
| ], | ||
| [ | ||
| "probeNetwork - default - start", | ||
| 0, | ||
| 0 | ||
| ] | ||
| ], | ||
| "gfx": [ | ||
| [ | ||
| "probeGFX - default - end", | ||
| 13, | ||
| 17, | ||
| 22, | ||
| 1, | ||
| [ | ||
| 207700, | ||
| 207700 | ||
| ], | ||
| [ | ||
| 246, | ||
| 246 | ||
| ], | ||
| [ | ||
| 1680, | ||
| 1680 | ||
| ] | ||
| ] | ||
| ] | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.