Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Add more predicate operator to mbgl filter translations - #6405

Merged
boundsj merged 2 commits into
masterfrom
boundsj-more-pred-to-filter-translations
Sep 21, 2016
Merged

boundsj merged 2 commits into
masterfrom
boundsj-more-pred-to-filter-translations

Conversation

@boundsj

@boundsj boundsj commented Sep 20, 2016

Copy link
Copy Markdown
Contributor

@boundsj boundsj added the iOS Mapbox Maps SDK for iOS label Sep 20, 2016
@boundsj boundsj added this to the ios-v3.4.0 milestone Sep 20, 2016
@boundsj boundsj self-assigned this Sep 20, 2016
@mention-bot

Copy link
Copy Markdown

@boundsj, thanks for your PR! By analyzing this pull request, we identified @1ec5 to be potential reviewers.

@boundsj
boundsj force-pushed the boundsj-more-pred-to-filter-translations branch 2 times, most recently from 8e8bd4d to 78b43be Compare September 20, 2016 23:35
Adds several new translations to prevent data loss.
@boundsj
boundsj force-pushed the boundsj-more-pred-to-filter-translations branch from 78b43be to e1d5504 Compare September 21, 2016 00:00

@1ec5 1ec5 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure == nil and != nil are flipped, but looks good otherwise.

}
else
{
auto filter = mbgl::style::NotHasFilter();

@1ec5 1ec5 Sep 21, 2016 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn’t %K != nil be an mbgl::style::HasFilter?

}
else
{
auto filter = mbgl::style::HasFilter();

@1ec5 1ec5 Sep 21, 2016 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn’t %K == nil be an mbgl::style::NotHasFilter?

[NSException raise:@"Unsupported filter type"
format:@"Cannot convert mbgl::style::HasFilter to NSPredicate"];
return nil;
return [NSPredicate predicateWithFormat:@"%K == nil", @(filter.key.c_str())];

@1ec5 1ec5 Sep 21, 2016 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn’t this be %K != nil?

[NSException raise:@"Unsupported filter type"
format:@"Cannot convert mbgl::style::NotHasFilter to NSPredicate"];
return nil;
return [NSPredicate predicateWithFormat:@"%K != nil", @(filter.key.c_str())];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn’t this be %K == nil?

Comment thread platform/darwin/test/MGLFilterTests.mm Outdated
{
// core does not have a "contains" filter but we can achieve the equivilant by creating a set of greater than or equal / less than or equal
// filters for the lower and upper bounds (inclusive)
NSPredicate *expectedPredicate = [NSCompoundPredicate andPredicateWithSubpredicates:@[[NSPredicate predicateWithFormat:@"%K >= 2", @"stroke-width"],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be expressed more succinctly as %K >= 2 AND %K <= 3

@boundsj

boundsj commented Sep 21, 2016

Copy link
Copy Markdown
Contributor Author

Pretty sure == nil and != nil are flipped, but looks good otherwise.

oops, will fix

@1ec5 1ec5 added bug macOS Mapbox Maps SDK for macOS release blocker Blocks the next final release runtime styling labels Sep 21, 2016
@1ec5 1ec5 changed the title [ios, macos] Add more predicate operator to mbgl filter translations Add more predicate operator to mbgl filter translations Sep 21, 2016
@boundsj
boundsj merged commit 1165a40 into master Sep 21, 2016
@boundsj
boundsj deleted the boundsj-more-pred-to-filter-translations branch September 21, 2016 16:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug iOS Mapbox Maps SDK for iOS macOS Mapbox Maps SDK for macOS release blocker Blocks the next final release runtime styling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants