This repository has been 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
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[core] Implement image expression (#15877)
* [core] Bump gl-js version * [core] Implement image expression * [core] Use new image expression * [core] Coerce image expression to / from string * [core] Serialize evaluated image * [core] Pass available images to layout * [core] Pass images to evaluation context * [core] Set available flag value based on image availability * [core] Allow image coercion to boolean to indicate image availability * [core] Coalesce image expression * [core] Add image expression to next build system * [core] Align serialization format and evaluated type with gl-js * [core] Add images to expression evaluation method * [core] Add support for Image expression to expression test runner * [core] Unskip image expression tests * [core] Update unit tests * [core] Use image expression in annotation manager * [core] Add string to ImageExpression conversion * [core] Add image expression to expression dsl * [core] Convert tokens for implicitly created Image literal * [core] Fix clang format * [core] Split generated style code lines that are over 120 characters * [core] Add unit test for image expression equality * [core] Add image property expression evaluation unit test * [core] Unskip image expression render test * [core] Skip 'in' expression tests * [core] Ignore fill-pattern/update-feature-state render test * [core] Rename Image::serialize to Image::toValue
- Loading branch information
1 parent
e1556fc
commit c6f3cc8
Showing
86 changed files
with
1,052 additions
and
527 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 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); | ||
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 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 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.