This repository was archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[core] Implement image expression #15877
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
eb2ef8c
[android] Update image expression evaluated type name
alexshalamov 9b3a9bf
[android] Placeholders for conversion from:to Image
alexshalamov 38c84cf
[darwin] Update image expression evaluated type name
alexshalamov 3cd1b3f
[darwin] Add conversion for resolvedImage
alexshalamov bb3c2ae
[darwin] Fix image roundrip conversion
alexshalamov 7d362de
[node] Update changelog
alexshalamov b15c6d0
[android] Update changelog
alexshalamov d0f3bca
[darwin] Update changelog
alexshalamov b9aa337
[core] Implement image expression (#15877)
alexshalamov 9924808
[node] Add support for Image expression
alexshalamov 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
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,49 @@ | ||
| #pragma once | ||
|
|
||
| #include <mbgl/style/conversion.hpp> | ||
| #include <mbgl/util/color.hpp> | ||
| #include <mbgl/util/optional.hpp> | ||
|
|
||
| #include <string> | ||
| #include <vector> | ||
|
|
||
| namespace mbgl { | ||
| namespace style { | ||
| namespace expression { | ||
|
|
||
| class Image { | ||
| public: | ||
| Image() = default; | ||
| Image(const char* imageID); | ||
| Image(std::string imageID); | ||
|
alexshalamov marked this conversation as resolved.
Outdated
|
||
| explicit Image(std::string imageID, bool available); | ||
| bool operator==(const Image&) const; | ||
| mbgl::Value toValue() const; | ||
| const std::string& id() const; | ||
| bool isAvailable() const; | ||
| bool empty() const; | ||
|
|
||
| private: | ||
| std::string imageID; | ||
| bool available; | ||
| }; | ||
|
|
||
| } // namespace expression | ||
|
|
||
| namespace conversion { | ||
|
|
||
| template <> | ||
| struct Converter<expression::Image> { | ||
| public: | ||
| optional<expression::Image> operator()(const Convertible& value, Error& error) const; | ||
| }; | ||
|
|
||
| template <> | ||
| struct ValueFactory<expression::Image> { | ||
| static Value make(const expression::Image& image) { return image.toValue(); } | ||
| }; | ||
|
|
||
| } // namespace conversion | ||
|
|
||
| } // namespace style | ||
| } // namespace mbgl | ||
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,33 @@ | ||
| #pragma once | ||
|
|
||
| #include <mbgl/style/expression/expression.hpp> | ||
|
|
||
| namespace mbgl { | ||
| namespace style { | ||
| namespace expression { | ||
|
|
||
| class ParsingContext; | ||
|
|
||
| class ImageExpression final : public Expression { | ||
| public: | ||
| explicit ImageExpression(std::unique_ptr<Expression> imageID); | ||
|
|
||
| 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; | ||
|
|
||
| std::vector<optional<Value>> possibleOutputs() const override { return {nullopt}; } | ||
|
|
||
| mbgl::Value serialize() const override; | ||
| std::string getOperator() const override { return "image"; } | ||
|
|
||
| private: | ||
| std::shared_ptr<Expression> imageID; | ||
| }; | ||
|
|
||
| } // namespace expression | ||
| } // namespace style | ||
| } // namespace mbgl |
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
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.