-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[ios, macos] fixes #5962 added geojson options to support clustering #6217
Conversation
3d97fbb
to
f9794ab
Compare
Thinking ahead to when we document these options: Fortunately, I don’t think this needs to be one of those “guess-and-check” APIs that we try to avoid exposing in the SDK. Rather than the formulation used in the style specification documentation, I think we should talk about the buffer and cluster radius being expressed in screen points (which is true at integral zoom levels), with a caveat that they may be scaled up to 2× between integral zoom levels. (The offset threshold implemented in #1843 is only for raster and video sources, so it won’t affect clustering.) @mourner, a couple questions for you:
|
@@ -0,0 +1,13 @@ | |||
#import <Foundation/Foundation.h> | |||
|
|||
@interface MGLGeoJSONOptions : NSObject |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s ironic for me to say this in light of #5970, but I think we could get away with a simple NSDictionary and some global string constants instead of a full-blown options object. That’s the way most Cocoa APIs accept options, especially when not all of the options are required (for example, NSAttributedString). Moving to a loosely-typed dictionary also frees us from having to hard-code default values.
I actually already started this in another branch. I noticed that when I try to combine similar changes in this commit with the changes in the 6049 branch and filter on |
f9794ab
to
2495143
Compare
2495143 implements this with an NSDictionary as suggested above. Regarding #6217 (comment) and the discussion in mapbox/mapbox-gl-js#2985; this PR has minimum viable documentation and I'd like to land it sooner for an alpha release. I'll create another ticket to capture the work to make the documentation better. cc @frederoni @1ec5 |
Tail work ticket for documentation opened: #6236 |
2495143
to
55a1d4f
Compare
/** | ||
The value of this option is an `NSNumber` object containing a boolean. If the data | ||
is a collection of point features, setting this to true clusters the points by | ||
radius into groups. The default value is false. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: our convention is currently to use Objective-C Boolean values, so YES
and NO
(in backticks) rather than true
and false
.
bd778b5
to
4912238
Compare
Great points @1ec5. Thanks for the help. I've simplified this and will land it later today if it looks ok. |
AFAICT, isn't this just |
Not quite: zoom levels are logarithmic, not linear. But we don’t have an API for it anyways, so I don’t think we should hand-wave about it in documentation. |
Ah, right. But then: But, true. This is a side point anyway. |
a996245
to
46ab8aa
Compare
This removes a previous implementation of geojson options that used a new type to transfer the data around. Added in its place is an options API that takes an NSDictionary that works similarly to NSAttributedString and many other Cocoa APIs that take options. The options parser now expects the developer to send values of the type noted in the documentation and it simply converts the NSNumber to the correct type (integer, double, or bool) for mbgl. However, an exception is raised if the value is not an NSNumber.
46ab8aa
to
08f55af
Compare
wip #5962
- [ ] Reuse default values from core- [ ] Documentation for mobile environment(will happen in #6236)👀 @boundsj