summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
authorJohn Firebaugh <john.firebaugh@gmail.com>2017-05-10 12:37:46 -0700
committerJohn Firebaugh <john.firebaugh@gmail.com>2017-05-15 09:45:55 -0700
commit9eba2a66d107f30aa9216fb34ed62df60797986a (patch)
treed334e6f3b5154b3dc5a49d87e8be9b42df2b212a /platform
parente473f2dcceb31eda816ac9e6c972d7e0a8f1dceb (diff)
downloadqtlocation-mapboxgl-9eba2a66d107f30aa9216fb34ed62df60797986a.tar.gz
[core, node, darwin, qt] Remove support for paint classes
Diffstat (limited to 'platform')
-rw-r--r--platform/android/src/style/layers/layer.cpp2
-rw-r--r--platform/darwin/docs/guides/For Style Authors.md.ejs1
-rw-r--r--platform/darwin/src/MGLStyle.h32
-rw-r--r--platform/darwin/src/MGLStyle.mm34
-rw-r--r--platform/glfw/glfw_view.cpp11
-rw-r--r--platform/ios/CHANGELOG.md4
-rw-r--r--platform/ios/docs/guides/For Style Authors.md1
-rw-r--r--platform/ios/src/MGLMapView.h20
-rw-r--r--platform/macos/CHANGELOG.md4
-rw-r--r--platform/macos/docs/guides/For Style Authors.md1
-rw-r--r--platform/node/src/node_map.cpp29
-rw-r--r--platform/node/src/node_map.hpp1
-rw-r--r--platform/node/test/js/map.test.js1
-rw-r--r--platform/qt/app/mapwindow.cpp10
-rw-r--r--platform/qt/include/qmapboxgl.hpp8
-rw-r--r--platform/qt/src/qmapboxgl.cpp85
16 files changed, 40 insertions, 204 deletions
diff --git a/platform/android/src/style/layers/layer.cpp b/platform/android/src/style/layers/layer.cpp
index d571c3fd2e..5352f9e548 100644
--- a/platform/android/src/style/layers/layer.cpp
+++ b/platform/android/src/style/layers/layer.cpp
@@ -91,7 +91,7 @@ namespace android {
Value value(env, jvalue);
// Convert and set property
- optional<mbgl::style::conversion::Error> error = mbgl::style::conversion::setPaintProperty(layer, jni::Make<std::string>(env, jname), value, mbgl::optional<std::string>());
+ optional<mbgl::style::conversion::Error> error = mbgl::style::conversion::setPaintProperty(layer, jni::Make<std::string>(env, jname), value);
if (error) {
mbgl::Log::Error(mbgl::Event::JNI, "Error setting property: " + jni::Make<std::string>(env, jname) + " " + error->message);
return;
diff --git a/platform/darwin/docs/guides/For Style Authors.md.ejs b/platform/darwin/docs/guides/For Style Authors.md.ejs
index 2d9ce635b8..34c1b5dddc 100644
--- a/platform/darwin/docs/guides/For Style Authors.md.ejs
+++ b/platform/darwin/docs/guides/For Style Authors.md.ejs
@@ -158,7 +158,6 @@ the following terms for concepts defined in the style specification:
In the style specification | In the SDK
---------------------------|---------
-class | style class
filter | predicate
function type | interpolation mode
id | identifier
diff --git a/platform/darwin/src/MGLStyle.h b/platform/darwin/src/MGLStyle.h
index 26434eb492..ccec863236 100644
--- a/platform/darwin/src/MGLStyle.h
+++ b/platform/darwin/src/MGLStyle.h
@@ -483,40 +483,24 @@ MGL_EXPORT
#pragma mark Managing Style Classes
/**
- Currently active style classes, represented as an array of string identifiers.
+ Support for style classes has been removed. This property always returns an empty array.
*/
-@property (nonatomic) NS_ARRAY_OF(NSString *) *styleClasses __attribute__((deprecated("This property will be removed in a future release.")));
+@property (nonatomic) NS_ARRAY_OF(NSString *) *styleClasses __attribute__((deprecated("This property is non-functional.")));
/**
- Returns a Boolean value indicating whether the style class with the given
- identifier is currently active.
-
- @param styleClass The style class to query for.
- @return Whether the style class is currently active.
+ Support for style classes has been removed. This method always returns NO.
*/
-- (BOOL)hasStyleClass:(NSString *)styleClass __attribute__((deprecated("This method will be removed in a future release.")));
+- (BOOL)hasStyleClass:(NSString *)styleClass __attribute__((deprecated("This method is non-functional.")));
/**
- Activates the style class with the given identifier.
-
- @param styleClass The style class to activate.
+ Support for style classes has been removed. This method is a no-op.
*/
-- (void)addStyleClass:(NSString *)styleClass __attribute__((deprecated("This method will be removed in a future release.")));
+- (void)addStyleClass:(NSString *)styleClass __attribute__((deprecated("This method is non-functional.")));
/**
- Deactivates the style class with the given identifier.
-
- @note Style class names are not guaranteed to exist across styles or different
- versions of the same style. Applications that use this API must first set the
- style URL to an explicitly versioned style using a convenience method like
- `+[MGLStyle outdoorsStyleURLWithVersion:]`, `MGLMapView`’s “Style URL”
- inspectable in Interface Builder, or a manually constructed `NSURL`. This
- approach also avoids style class name changes that will occur in the default
- style over time.
-
- @param styleClass The style class to deactivate.
+ Support for style classes has been removed. This method is a no-op.
*/
-- (void)removeStyleClass:(NSString *)styleClass __attribute__((deprecated("This method will be removed in a future release.")));
+- (void)removeStyleClass:(NSString *)styleClass __attribute__((deprecated("This method is non-functional.")));
#pragma mark Managing a Style’s Images
diff --git a/platform/darwin/src/MGLStyle.mm b/platform/darwin/src/MGLStyle.mm
index af02c31b6d..2c54b11634 100644
--- a/platform/darwin/src/MGLStyle.mm
+++ b/platform/darwin/src/MGLStyle.mm
@@ -469,60 +469,32 @@ static NSURL *MGLStyleURL_emerald;
- (NS_ARRAY_OF(NSString *) *)styleClasses
{
- const std::vector<std::string> &appliedClasses = self.mapView.mbglMap->getClasses();
-
- NSMutableArray *returnArray = [NSMutableArray arrayWithCapacity:appliedClasses.size()];
-
- for (auto appliedClass : appliedClasses) {
- [returnArray addObject:@(appliedClass.c_str())];
- }
-
- return returnArray;
+ return @[];
}
- (void)setStyleClasses:(NS_ARRAY_OF(NSString *) *)appliedClasses
{
- [self setStyleClasses:appliedClasses transitionDuration:0];
}
- (void)setStyleClasses:(NS_ARRAY_OF(NSString *) *)appliedClasses transitionDuration:(NSTimeInterval)transitionDuration
{
- std::vector<std::string> newAppliedClasses;
-
- for (NSString *appliedClass in appliedClasses)
- {
- newAppliedClasses.push_back([appliedClass UTF8String]);
- }
-
- mbgl::style::TransitionOptions transition { { MGLDurationFromTimeInterval(transitionDuration) } };
- self.mapView.mbglMap->setTransitionOptions(transition);
- self.mapView.mbglMap->setClasses(newAppliedClasses);
}
- (NSUInteger)countOfStyleClasses {
- const auto &classes = self.mapView.mbglMap->getClasses();
- return classes.size();
+ return 0;
}
- (BOOL)hasStyleClass:(NSString *)styleClass
{
- return styleClass && self.mapView.mbglMap->hasClass([styleClass UTF8String]);
+ return NO;
}
- (void)addStyleClass:(NSString *)styleClass
{
- if (styleClass)
- {
- self.mapView.mbglMap->addClass([styleClass UTF8String]);
- }
}
- (void)removeStyleClass:(NSString *)styleClass
{
- if (styleClass)
- {
- self.mapView.mbglMap->removeClass([styleClass UTF8String]);
- }
}
#pragma mark Style images
diff --git a/platform/glfw/glfw_view.cpp b/platform/glfw/glfw_view.cpp
index 1be38e5e4a..d3a6347110 100644
--- a/platform/glfw/glfw_view.cpp
+++ b/platform/glfw/glfw_view.cpp
@@ -163,17 +163,6 @@ void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action,
if (view->changeStyleCallback)
view->changeStyleCallback();
break;
- case GLFW_KEY_R:
- if (!mods) {
- static const mbgl::style::TransitionOptions transition { { mbgl::Milliseconds(300) } };
- view->map->setTransitionOptions(transition);
- if (view->map->hasClass("night")) {
- view->map->removeClass("night");
- } else {
- view->map->addClass("night");
- }
- }
- break;
#if not MBGL_USE_GLES2
case GLFW_KEY_B: {
auto debug = view->map->getDebug();
diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md
index 922b7b6486..ed28b65ae5 100644
--- a/platform/ios/CHANGELOG.md
+++ b/platform/ios/CHANGELOG.md
@@ -4,6 +4,10 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT
## master
+* The previously-deprecated support for style classes has been removed. For interface compatibility, the API methods remain, but they are now non-functional.
+
+## 3.6.0
+
### Styles
* Added support for 3D extrusion of buildings and other polygonal features via the `MGLFillExtrusionStyleLayer` class and the `fill-extrusion` layer type in style JSON. ([#8431](https://github.com/mapbox/mapbox-gl-native/pull/8431))
diff --git a/platform/ios/docs/guides/For Style Authors.md b/platform/ios/docs/guides/For Style Authors.md
index fee4d70b34..734e0dc9ee 100644
--- a/platform/ios/docs/guides/For Style Authors.md
+++ b/platform/ios/docs/guides/For Style Authors.md
@@ -107,7 +107,6 @@ the following terms for concepts defined in the style specification:
In the style specification | In the SDK
---------------------------|---------
-class | style class
filter | predicate
function type | interpolation mode
id | identifier
diff --git a/platform/ios/src/MGLMapView.h b/platform/ios/src/MGLMapView.h
index 31320ac977..8d26b1c90e 100644
--- a/platform/ios/src/MGLMapView.h
+++ b/platform/ios/src/MGLMapView.h
@@ -270,13 +270,25 @@ IB_DESIGNABLE
*/
@property (nonatomic, readonly) UIButton *attributionButton;
-@property (nonatomic) NS_ARRAY_OF(NSString *) *styleClasses __attribute__((deprecated("Use style.styleClasses.")));
+/**
+ Support for style classes has been removed. This property always returns an empty array.
+ */
+@property (nonatomic) NS_ARRAY_OF(NSString *) *styleClasses __attribute__((deprecated("This property is non-functional.")));
-- (BOOL)hasStyleClass:(NSString *)styleClass __attribute__((deprecated("Use style.hasStyleClass:.")));
+/**
+ Support for style classes has been removed. This property always returns NO.
+ */
+- (BOOL)hasStyleClass:(NSString *)styleClass __attribute__((deprecated("This method is non-functional.")));
-- (void)addStyleClass:(NSString *)styleClass __attribute__((deprecated("Use style.addStyleClass:.")));
+/**
+ Support for style classes has been removed. This property is a no-op.
+ */
+- (void)addStyleClass:(NSString *)styleClass __attribute__((deprecated("This method is non-functional.")));
-- (void)removeStyleClass:(NSString *)styleClass __attribute__((deprecated("Use style.removeStyleClass:.")));
+/**
+ Support for style classes has been removed. This property is a no-op.
+ */
+- (void)removeStyleClass:(NSString *)styleClass __attribute__((deprecated("This method is non-functional.")));
#pragma mark Displaying the User’s Location
diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md
index 632bcfa44b..377c321452 100644
--- a/platform/macos/CHANGELOG.md
+++ b/platform/macos/CHANGELOG.md
@@ -2,6 +2,10 @@
## master
+* The previously-deprecated support for style classes has been removed. For interface compatibility, the API methods remain, but they are now non-functional.
+
+## 0.5.0
+
### Styles
* Added support for 3D extrusion of buildings and other polygonal features via the `MGLFillExtrusionStyleLayer` class and the `fill-extrusion` layer type in style JSON. ([#8431](https://github.com/mapbox/mapbox-gl-native/pull/8431))
diff --git a/platform/macos/docs/guides/For Style Authors.md b/platform/macos/docs/guides/For Style Authors.md
index b9163582b4..164b1b58bf 100644
--- a/platform/macos/docs/guides/For Style Authors.md
+++ b/platform/macos/docs/guides/For Style Authors.md
@@ -96,7 +96,6 @@ the following terms for concepts defined in the style specification:
In the style specification | In the SDK
---------------------------|---------
-class | style class
filter | predicate
function type | interpolation mode
id | identifier
diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp
index 680de6f90c..b174893e78 100644
--- a/platform/node/src/node_map.cpp
+++ b/platform/node/src/node_map.cpp
@@ -60,7 +60,6 @@ void NodeMap::Init(v8::Local<v8::Object> target) {
Nan::SetPrototypeMethod(tpl, "release", Release);
Nan::SetPrototypeMethod(tpl, "cancel", Cancel);
- Nan::SetPrototypeMethod(tpl, "addClass", AddClass);
Nan::SetPrototypeMethod(tpl, "addSource", AddSource);
Nan::SetPrototypeMethod(tpl, "addLayer", AddLayer);
Nan::SetPrototypeMethod(tpl, "removeLayer", RemoveLayer);
@@ -376,10 +375,6 @@ void NodeMap::startRender(NodeMap::RenderOptions options) {
view = std::make_unique<mbgl::OffscreenView>(backend.getContext(), fbSize);
}
- if (map->getClasses() != options.classes) {
- map->setClasses(options.classes);
- }
-
if (map->getZoom() != options.zoom) {
map->setZoom(options.zoom);
}
@@ -546,23 +541,6 @@ void NodeMap::cancel() {
renderFinished();
}
-void NodeMap::AddClass(const Nan::FunctionCallbackInfo<v8::Value>& info) {
- auto nodeMap = Nan::ObjectWrap::Unwrap<NodeMap>(info.Holder());
- if (!nodeMap->map) return Nan::ThrowError(releasedMessage());
-
- if (info.Length() <= 0 || !info[0]->IsString()) {
- return Nan::ThrowTypeError("First argument must be a string");
- }
-
- try {
- nodeMap->map->addClass(*Nan::Utf8String(info[0]));
- } catch (const std::exception &ex) {
- return Nan::ThrowError(ex.what());
- }
-
- info.GetReturnValue().SetUndefined();
-}
-
void NodeMap::AddSource(const Nan::FunctionCallbackInfo<v8::Value>& info) {
using namespace mbgl::style;
using namespace mbgl::style::conversion;
@@ -763,12 +741,7 @@ void NodeMap::SetPaintProperty(const Nan::FunctionCallbackInfo<v8::Value>& info)
return Nan::ThrowTypeError("Second argument must be a string");
}
- mbgl::optional<std::string> klass;
- if (info.Length() == 4 && info[3]->IsString()) {
- klass = std::string(*Nan::Utf8String(info[3]));
- }
-
- mbgl::optional<Error> error = setPaintProperty(*layer, *Nan::Utf8String(info[1]), info[2], klass);
+ mbgl::optional<Error> error = setPaintProperty(*layer, *Nan::Utf8String(info[1]), info[2]);
if (error) {
return Nan::ThrowTypeError(error->message.c_str());
}
diff --git a/platform/node/src/node_map.hpp b/platform/node/src/node_map.hpp
index cdc8f1e51f..7b81ecd894 100644
--- a/platform/node/src/node_map.hpp
+++ b/platform/node/src/node_map.hpp
@@ -42,7 +42,6 @@ public:
static void Render(const Nan::FunctionCallbackInfo<v8::Value>&);
static void Release(const Nan::FunctionCallbackInfo<v8::Value>&);
static void Cancel(const Nan::FunctionCallbackInfo<v8::Value>&);
- static void AddClass(const Nan::FunctionCallbackInfo<v8::Value>&);
static void AddSource(const Nan::FunctionCallbackInfo<v8::Value>&);
static void AddLayer(const Nan::FunctionCallbackInfo<v8::Value>&);
static void RemoveLayer(const Nan::FunctionCallbackInfo<v8::Value>&);
diff --git a/platform/node/test/js/map.test.js b/platform/node/test/js/map.test.js
index 4ab76b937a..04d02d0558 100644
--- a/platform/node/test/js/map.test.js
+++ b/platform/node/test/js/map.test.js
@@ -108,7 +108,6 @@ test('Map', function(t) {
'render',
'release',
'cancel',
- 'addClass',
'addSource',
'addLayer',
'removeLayer',
diff --git a/platform/qt/app/mapwindow.cpp b/platform/qt/app/mapwindow.cpp
index aa5561731c..03ca052ec4 100644
--- a/platform/qt/app/mapwindow.cpp
+++ b/platform/qt/app/mapwindow.cpp
@@ -79,8 +79,6 @@ void MapWindow::changeStyle()
void MapWindow::keyPressEvent(QKeyEvent *ev)
{
- static const qint64 transitionDuration = 300;
-
switch (ev->key()) {
case Qt::Key_S:
changeStyle();
@@ -307,14 +305,6 @@ void MapWindow::keyPressEvent(QKeyEvent *ev)
case Qt::Key_Tab:
m_map->cycleDebugOptions();
break;
- case Qt::Key_R: {
- m_map->setTransitionOptions(transitionDuration);
- if (m_map->hasClass("night")) {
- m_map->removeClass("night");
- } else {
- m_map->addClass("night");
- }
- } break;
default:
break;
}
diff --git a/platform/qt/include/qmapboxgl.hpp b/platform/qt/include/qmapboxgl.hpp
index 478c15a51e..e2fb283989 100644
--- a/platform/qt/include/qmapboxgl.hpp
+++ b/platform/qt/include/qmapboxgl.hpp
@@ -168,12 +168,6 @@ public:
void setGestureInProgress(bool inProgress);
- void addClass(const QString &);
- void removeClass(const QString &);
- bool hasClass(const QString &) const;
- void setClasses(const QStringList &);
- QStringList getClasses() const;
-
void setTransitionOptions(qint64 duration, qint64 delay = 0);
void addAnnotationIcon(const QString &name, const QImage &sprite);
@@ -183,7 +177,7 @@ public:
void removeAnnotation(QMapbox::AnnotationID);
void setLayoutProperty(const QString &layer, const QString &property, const QVariant &value);
- void setPaintProperty(const QString &layer, const QString &property, const QVariant &value, const QString &klass = QString());
+ void setPaintProperty(const QString &layer, const QString &property, const QVariant &value);
bool isFullyLoaded() const;
diff --git a/platform/qt/src/qmapboxgl.cpp b/platform/qt/src/qmapboxgl.cpp
index 80b64f05df..c37b2563b5 100644
--- a/platform/qt/src/qmapboxgl.cpp
+++ b/platform/qt/src/qmapboxgl.cpp
@@ -71,16 +71,6 @@ QThreadStorage<std::shared_ptr<mbgl::util::RunLoop>> loop;
// Conversion helper functions.
-auto fromQStringList(const QStringList &list)
-{
- std::vector<std::string> strings;
- strings.reserve(list.size());
- for (const QString &string : list) {
- strings.push_back(string.toStdString());
- }
- return strings;
-}
-
mbgl::Size sanitizedSize(const QSize& size) {
return mbgl::Size {
mbgl::util::max(0u, static_cast<uint32_t>(size.width())),
@@ -752,69 +742,6 @@ void QMapboxGL::setGestureInProgress(bool progress)
}
/*!
- Adds an \a className to the list of active classes. Layers tagged with a certain class
- will only be active when the class is added.
-
- This was removed from the \l {https://www.mapbox.com/mapbox-gl-style-spec/#layer-paint.*}
- {Mapbox style specification} and should no longer be used.
-
- \deprecated
- \sa removeClass()
-*/
-void QMapboxGL::addClass(const QString &className)
-{
- d_ptr->mapObj->addClass(className.toStdString());
-}
-
-/*!
- Removes a \a className.
-
- \deprecated
- \sa addClass()
-*/
-void QMapboxGL::removeClass(const QString &className)
-{
- d_ptr->mapObj->removeClass(className.toStdString());
-}
-
-/*!
- Returns true when \a className is active, false otherwise.
-
- \deprecated
- \sa addClass()
-*/
-bool QMapboxGL::hasClass(const QString &className) const
-{
- return d_ptr->mapObj->hasClass(className.toStdString());
-}
-
-/*!
- Bulk adds a list of \a classNames.
-
- \deprecated
- \sa addClass()
-*/
-void QMapboxGL::setClasses(const QStringList &classNames)
-{
- d_ptr->mapObj->setClasses(fromQStringList(classNames));
-}
-
-/*!
- Returns a list of active classes.
-
- \deprecated
- \sa setClasses()
-*/
-QStringList QMapboxGL::getClasses() const
-{
- QStringList classNames;
- for (const std::string &mbglClass : d_ptr->mapObj->getClasses()) {
- classNames << QString::fromStdString(mbglClass);
- }
- return classNames;
-}
-
-/*!
Sets the \a duration and \a delay of style class transitions. Style property
values transition to new values with animation when a new class is set.
@@ -958,9 +885,6 @@ void QMapboxGL::setLayoutProperty(const QString& layer, const QString& property,
as defined by the \l {https://www.mapbox.com/mapbox-gl-style-spec/} {Mapbox style specification}
for paint properties.
- The argument \a styleClass is deprecated and is used for defining the style class for the paint
- property.
-
For paint properties that take a color as \a value, such as \c fill-color, a string such as
\c blue can be passed or a QColor.
@@ -1006,7 +930,7 @@ void QMapboxGL::setLayoutProperty(const QString& layer, const QString& property,
map->setPaintProperty("route","line-dasharray", lineDashArray);
\endcode
*/
-void QMapboxGL::setPaintProperty(const QString& layer, const QString& property, const QVariant& value, const QString& styleClass)
+void QMapboxGL::setPaintProperty(const QString& layer, const QString& property, const QVariant& value)
{
using namespace mbgl::style;
@@ -1016,12 +940,7 @@ void QMapboxGL::setPaintProperty(const QString& layer, const QString& property,
return;
}
- mbgl::optional<std::string> klass;
- if (!styleClass.isEmpty()) {
- klass = styleClass.toStdString();
- }
-
- if (conversion::setPaintProperty(*layer_, property.toStdString(), value, klass)) {
+ if (conversion::setPaintProperty(*layer_, property.toStdString(), value)) {
qWarning() << "Error setting paint property:" << layer << "-" << property;
return;
}