[core] Layer::getPaintProperty() -> Layer::getProperty()
This commit is contained in:
@@ -115,7 +115,7 @@ public:
|
||||
const conversion::Convertible& value) = 0;
|
||||
optional<conversion::Error> setVisibility(const conversion::Convertible& value);
|
||||
|
||||
virtual StyleProperty getPaintProperty(const std::string&) const = 0;
|
||||
virtual StyleProperty getProperty(const std::string&) const = 0;
|
||||
|
||||
// Private implementation
|
||||
// TODO : We should not have public mutable data members.
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
optional<conversion::Error> setLayoutProperty(const std::string& name, const conversion::Convertible& value) final;
|
||||
optional<conversion::Error> setPaintProperty(const std::string& name, const conversion::Convertible& value) final;
|
||||
|
||||
StyleProperty getPaintProperty(const std::string& name) const final;
|
||||
StyleProperty getProperty(const std::string& name) const final;
|
||||
|
||||
// Paint properties
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
optional<conversion::Error> setLayoutProperty(const std::string& name, const conversion::Convertible& value) final;
|
||||
optional<conversion::Error> setPaintProperty(const std::string& name, const conversion::Convertible& value) final;
|
||||
|
||||
StyleProperty getPaintProperty(const std::string& name) const final;
|
||||
StyleProperty getProperty(const std::string& name) const final;
|
||||
|
||||
// Paint properties
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ public:
|
||||
// Dynamic properties
|
||||
optional<conversion::Error> setLayoutProperty(const std::string& name, const conversion::Convertible& value) final;
|
||||
optional<conversion::Error> setPaintProperty(const std::string& name, const conversion::Convertible& value) final;
|
||||
StyleProperty getPaintProperty(const std::string&) const final;
|
||||
StyleProperty getProperty(const std::string&) const final;
|
||||
// Private implementation
|
||||
|
||||
class Impl;
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
optional<conversion::Error> setLayoutProperty(const std::string& name, const conversion::Convertible& value) final;
|
||||
optional<conversion::Error> setPaintProperty(const std::string& name, const conversion::Convertible& value) final;
|
||||
|
||||
StyleProperty getPaintProperty(const std::string& name) const final;
|
||||
StyleProperty getProperty(const std::string& name) const final;
|
||||
|
||||
// Paint properties
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
optional<conversion::Error> setLayoutProperty(const std::string& name, const conversion::Convertible& value) final;
|
||||
optional<conversion::Error> setPaintProperty(const std::string& name, const conversion::Convertible& value) final;
|
||||
|
||||
StyleProperty getPaintProperty(const std::string& name) const final;
|
||||
StyleProperty getProperty(const std::string& name) const final;
|
||||
|
||||
// Paint properties
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public:
|
||||
optional<conversion::Error> setLayoutProperty(const std::string& name, const conversion::Convertible& value) final;
|
||||
optional<conversion::Error> setPaintProperty(const std::string& name, const conversion::Convertible& value) final;
|
||||
|
||||
StyleProperty getPaintProperty(const std::string& name) const final;
|
||||
StyleProperty getProperty(const std::string& name) const final;
|
||||
|
||||
// Paint properties
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
optional<conversion::Error> setLayoutProperty(const std::string& name, const conversion::Convertible& value) final;
|
||||
optional<conversion::Error> setPaintProperty(const std::string& name, const conversion::Convertible& value) final;
|
||||
|
||||
StyleProperty getPaintProperty(const std::string& name) const final;
|
||||
StyleProperty getProperty(const std::string& name) const final;
|
||||
|
||||
// Paint properties
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ public:
|
||||
optional<conversion::Error> setLayoutProperty(const std::string& name, const conversion::Convertible& value) final;
|
||||
optional<conversion::Error> setPaintProperty(const std::string& name, const conversion::Convertible& value) final;
|
||||
|
||||
StyleProperty getPaintProperty(const std::string& name) const final;
|
||||
StyleProperty getProperty(const std::string& name) const final;
|
||||
|
||||
<% if (layoutProperties.length) { -%>
|
||||
// Layout properties
|
||||
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
optional<conversion::Error> setLayoutProperty(const std::string& name, const conversion::Convertible& value) final;
|
||||
optional<conversion::Error> setPaintProperty(const std::string& name, const conversion::Convertible& value) final;
|
||||
|
||||
StyleProperty getPaintProperty(const std::string& name) const final;
|
||||
StyleProperty getProperty(const std::string& name) const final;
|
||||
|
||||
// Layout properties
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ public:
|
||||
optional<conversion::Error> setLayoutProperty(const std::string& name, const conversion::Convertible& value) final;
|
||||
optional<conversion::Error> setPaintProperty(const std::string& name, const conversion::Convertible& value) final;
|
||||
|
||||
StyleProperty getPaintProperty(const std::string& name) const final;
|
||||
StyleProperty getProperty(const std::string& name) const final;
|
||||
|
||||
// Paint properties
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public:
|
||||
optional<conversion::Error> setLayoutProperty(const std::string& name, const conversion::Convertible& value) final;
|
||||
optional<conversion::Error> setPaintProperty(const std::string& name, const conversion::Convertible& value) final;
|
||||
|
||||
StyleProperty getPaintProperty(const std::string& name) const final;
|
||||
StyleProperty getProperty(const std::string& name) const final;
|
||||
|
||||
// Layout properties
|
||||
|
||||
|
||||
@@ -244,7 +244,7 @@ optional<Error> BackgroundLayer::setPaintProperty(const std::string& name, const
|
||||
return Error{"layer doesn't support this property"};
|
||||
}
|
||||
|
||||
StyleProperty BackgroundLayer::getPaintProperty(const std::string& name) const {
|
||||
StyleProperty BackgroundLayer::getProperty(const std::string& name) const {
|
||||
const auto it = paintProperties.find(name.c_str());
|
||||
if (it == paintProperties.end()) {
|
||||
return {};
|
||||
|
||||
@@ -597,7 +597,7 @@ optional<Error> CircleLayer::setPaintProperty(const std::string& name, const Con
|
||||
return Error{"layer doesn't support this property"};
|
||||
}
|
||||
|
||||
StyleProperty CircleLayer::getPaintProperty(const std::string& name) const {
|
||||
StyleProperty CircleLayer::getProperty(const std::string& name) const {
|
||||
const auto it = paintProperties.find(name.c_str());
|
||||
if (it == paintProperties.end()) {
|
||||
return {};
|
||||
|
||||
@@ -47,7 +47,7 @@ optional<Error> CustomLayer::setLayoutProperty(const std::string&, const Convert
|
||||
return Error { "layer doesn't support this property" };
|
||||
}
|
||||
|
||||
StyleProperty CustomLayer::getPaintProperty(const std::string&) const {
|
||||
StyleProperty CustomLayer::getProperty(const std::string&) const {
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
@@ -479,7 +479,7 @@ optional<Error> FillExtrusionLayer::setPaintProperty(const std::string& name, co
|
||||
return Error{"layer doesn't support this property"};
|
||||
}
|
||||
|
||||
StyleProperty FillExtrusionLayer::getPaintProperty(const std::string& name) const {
|
||||
StyleProperty FillExtrusionLayer::getProperty(const std::string& name) const {
|
||||
const auto it = paintProperties.find(name.c_str());
|
||||
if (it == paintProperties.end()) {
|
||||
return {};
|
||||
|
||||
@@ -431,7 +431,7 @@ optional<Error> FillLayer::setPaintProperty(const std::string& name, const Conve
|
||||
return Error{"layer doesn't support this property"};
|
||||
}
|
||||
|
||||
StyleProperty FillLayer::getPaintProperty(const std::string& name) const {
|
||||
StyleProperty FillLayer::getProperty(const std::string& name) const {
|
||||
const auto it = paintProperties.find(name.c_str());
|
||||
if (it == paintProperties.end()) {
|
||||
return {};
|
||||
|
||||
@@ -332,7 +332,7 @@ optional<Error> HeatmapLayer::setPaintProperty(const std::string& name, const Co
|
||||
return Error{"layer doesn't support this property"};
|
||||
}
|
||||
|
||||
StyleProperty HeatmapLayer::getPaintProperty(const std::string& name) const {
|
||||
StyleProperty HeatmapLayer::getProperty(const std::string& name) const {
|
||||
const auto it = paintProperties.find(name.c_str());
|
||||
if (it == paintProperties.end()) {
|
||||
return {};
|
||||
|
||||
@@ -371,7 +371,7 @@ optional<Error> HillshadeLayer::setPaintProperty(const std::string& name, const
|
||||
return Error{"layer doesn't support this property"};
|
||||
}
|
||||
|
||||
StyleProperty HillshadeLayer::getPaintProperty(const std::string& name) const {
|
||||
StyleProperty HillshadeLayer::getProperty(const std::string& name) const {
|
||||
const auto it = paintProperties.find(name.c_str());
|
||||
if (it == paintProperties.end()) {
|
||||
return {};
|
||||
|
||||
@@ -265,7 +265,7 @@ optional<Error> <%- camelize(type) %>Layer::setPaintProperty(const std::string&
|
||||
return Error{"layer doesn't support this property"};
|
||||
}
|
||||
|
||||
StyleProperty <%- camelize(type) %>Layer::getPaintProperty(const std::string& name) const {
|
||||
StyleProperty <%- camelize(type) %>Layer::getProperty(const std::string& name) const {
|
||||
const auto it = paintProperties.find(name.c_str());
|
||||
if (it == paintProperties.end()) {
|
||||
return {};
|
||||
|
||||
@@ -668,7 +668,7 @@ optional<Error> LineLayer::setPaintProperty(const std::string& name, const Conve
|
||||
return Error{"layer doesn't support this property"};
|
||||
}
|
||||
|
||||
StyleProperty LineLayer::getPaintProperty(const std::string& name) const {
|
||||
StyleProperty LineLayer::getProperty(const std::string& name) const {
|
||||
const auto it = paintProperties.find(name.c_str());
|
||||
if (it == paintProperties.end()) {
|
||||
return {};
|
||||
|
||||
@@ -444,7 +444,7 @@ optional<Error> RasterLayer::setPaintProperty(const std::string& name, const Con
|
||||
return Error{"layer doesn't support this property"};
|
||||
}
|
||||
|
||||
StyleProperty RasterLayer::getPaintProperty(const std::string& name) const {
|
||||
StyleProperty RasterLayer::getProperty(const std::string& name) const {
|
||||
const auto it = paintProperties.find(name.c_str());
|
||||
if (it == paintProperties.end()) {
|
||||
return {};
|
||||
|
||||
@@ -1367,7 +1367,7 @@ optional<Error> SymbolLayer::setPaintProperty(const std::string& name, const Con
|
||||
return Error{"layer doesn't support this property"};
|
||||
}
|
||||
|
||||
StyleProperty SymbolLayer::getPaintProperty(const std::string& name) const {
|
||||
StyleProperty SymbolLayer::getProperty(const std::string& name) const {
|
||||
const auto it = paintProperties.find(name.c_str());
|
||||
if (it == paintProperties.end()) {
|
||||
return {};
|
||||
|
||||
@@ -953,15 +953,15 @@ TEST(Map, UniversalStyleGetter) {
|
||||
Layer* lineLayer = test.map.getStyle().getLayer("line");
|
||||
ASSERT_TRUE(lineLayer);
|
||||
|
||||
StyleProperty nonexistent = lineLayer->getPaintProperty("nonexistent");
|
||||
StyleProperty nonexistent = lineLayer->getProperty("nonexistent");
|
||||
ASSERT_FALSE(nonexistent.value);
|
||||
EXPECT_EQ(StyleProperty::Kind::Undefined, nonexistent.kind);
|
||||
|
||||
StyleProperty undefined = lineLayer->getPaintProperty("line-blur");
|
||||
StyleProperty undefined = lineLayer->getProperty("line-blur");
|
||||
ASSERT_FALSE(undefined.value);
|
||||
EXPECT_EQ(StyleProperty::Kind::Undefined, undefined.kind);
|
||||
|
||||
StyleProperty lineColor = lineLayer->getPaintProperty("line-color");
|
||||
StyleProperty lineColor = lineLayer->getProperty("line-color");
|
||||
ASSERT_TRUE(lineColor.value);
|
||||
EXPECT_EQ(StyleProperty::Kind::Constant, lineColor.kind);
|
||||
ASSERT_TRUE(lineColor.value.getObject());
|
||||
@@ -971,19 +971,19 @@ TEST(Map, UniversalStyleGetter) {
|
||||
EXPECT_EQ(0.0, *color.at("b").getDouble());
|
||||
EXPECT_EQ(1.0, *color.at("a").getDouble());
|
||||
|
||||
StyleProperty lineOpacity = lineLayer->getPaintProperty("line-opacity");
|
||||
StyleProperty lineOpacity = lineLayer->getProperty("line-opacity");
|
||||
ASSERT_TRUE(lineOpacity.value);
|
||||
EXPECT_EQ(StyleProperty::Kind::Constant, lineOpacity.kind);
|
||||
ASSERT_TRUE(lineOpacity.value.getDouble());
|
||||
EXPECT_EQ(0.5, *lineOpacity.value.getDouble());
|
||||
|
||||
StyleProperty lineOpacityTransition = lineLayer->getPaintProperty("line-opacity-transition");
|
||||
StyleProperty lineOpacityTransition = lineLayer->getProperty("line-opacity-transition");
|
||||
ASSERT_TRUE(lineOpacityTransition.value);
|
||||
EXPECT_EQ(StyleProperty::Kind::Transition, lineOpacityTransition.kind);
|
||||
ASSERT_TRUE(lineOpacityTransition.value.getArray());
|
||||
EXPECT_EQ(3u, lineOpacityTransition.value.getArray()->size());
|
||||
|
||||
StyleProperty lineWidth = lineLayer->getPaintProperty("line-width");
|
||||
StyleProperty lineWidth = lineLayer->getProperty("line-width");
|
||||
ASSERT_TRUE(lineWidth.value);
|
||||
EXPECT_EQ(StyleProperty::Kind::Expression, lineWidth.kind);
|
||||
ASSERT_TRUE(lineWidth.value.getArray());
|
||||
|
||||
Reference in New Issue
Block a user