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

Add layer predicate editor to macosapp#7553

Closed
1ec5 wants to merge 1 commit into
masterfrom
1ec5-predicate-editor
Closed

Add layer predicate editor to macosapp#7553
1ec5 wants to merge 1 commit into
masterfrom
1ec5-predicate-editor

Conversation

@1ec5
Copy link
Copy Markdown
Contributor

@1ec5 1ec5 commented Dec 27, 2016

This PR adds a Layer Filter panel to the bottom of the macosapp document window that edits the selected layer’s predicate. A standard NSPredicateEditor bound to the style layer array controller provides the draggable, nestable rule editing UI. A custom subclass of NSPredicateEditorRowTemplate allows for arbitrary key paths in a single template and also represents an aggregate value (for the “is one of” operator) as a token field. (NSPredicateEditorRowTemplate only supports simple values by default. An editable table view would’ve been better, but NSPredicateEditor assumes fixed-height rows.) The predicate editor has a standard row template for compound predicates and a custom row template for each major value type (string, integer, floating-point number, etc.). Edits to this UI take effect immediately.

filter

As of writing, this editor is able to display predicates for the vast majority of layers in the Mapbox Streets style, and basic criteria can be edited without problems. Adding a criterion doesn’t quite work yet, and editing an “is one of” criterion often doesn’t round-trip correctly.

  • Add predicate editor in split view
  • Hook up menu items and split view delegate
  • Bind predicate editor to style layer array controller
  • Add common operators to row templates
  • Subclass row templates for arbitrary key paths
  • Replace text field with token field for aggregate values
  • Prefer number templates over string template based on existing value type
  • Add template for Boolean and null values
  • Add “is defined” and “is not defined” operators
  • Make key text field editable when adding a new criterion
  • Round-trip “is one of” criteria accurately
  • Fix UI after changing “is one of” to another operator
  • Add “is between” operator or transform to compound operator
  • Add template for $type key that uses a segmented control
  • Track predicate changes in undo manager
  • Add text fields for layer source, source layer

(For consistency with macOS and Apple applications, “filter” is the user-facing term, while “predicate” remains the API term to avoid confusion with other “filter” concepts.)

Depends on #7548.

@1ec5 1ec5 added feature macOS Mapbox Maps SDK for macOS runtime styling labels Dec 27, 2016
@1ec5 1ec5 self-assigned this Dec 27, 2016
@mention-bot
Copy link
Copy Markdown

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

@1ec5 1ec5 force-pushed the 1ec5-predicate-editor branch from b729e30 to ff0c583 Compare December 28, 2016 00:19
@1ec5
Copy link
Copy Markdown
Contributor Author

1ec5 commented Dec 28, 2016

This PR depends on some of the fixes in #7548.

@1ec5 1ec5 force-pushed the 1ec5-predicate-editor branch from ff0c583 to d11ead6 Compare January 4, 2017 16:55
@1ec5 1ec5 added the ⚠️ DO NOT MERGE Work in progress, proof of concept, or on hold label Mar 25, 2017
@tobrun tobrun closed this in #8759 Apr 18, 2017
@tobrun tobrun reopened this Apr 18, 2017
@1ec5 1ec5 force-pushed the 1ec5-predicate-editor branch from d11ead6 to b764fa7 Compare July 6, 2017 01:42
@jfirebaugh
Copy link
Copy Markdown
Contributor

Stale.

@jfirebaugh jfirebaugh closed this Oct 24, 2017
@jfirebaugh jfirebaugh deleted the 1ec5-predicate-editor branch October 24, 2017 20:40
@1ec5 1ec5 restored the 1ec5-predicate-editor branch October 26, 2017 19:30
@1ec5 1ec5 changed the base branch from release-ios-v3.4.0 to master October 26, 2017 19:32
Added a Layer Filter panel to the bottom of the macosapp document window that edits the selected layer’s predicate. Subclassed NSPredicateEditorRowTemplate to allow for arbitrary key paths in a single template and also to represent an aggregate value as a token field.
@1ec5 1ec5 reopened this Oct 26, 2017
@1ec5 1ec5 force-pushed the 1ec5-predicate-editor branch from b764fa7 to c3b1735 Compare October 26, 2017 19:35
@stale
Copy link
Copy Markdown

stale Bot commented Oct 24, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale Bot added the archived Archived because of inactivity label Oct 24, 2018
@stale
Copy link
Copy Markdown

stale Bot commented Oct 25, 2018

This pull request has been automatically detected as stale because it has not had recent activity and will be archived. Thank you for your contributions.

@stale stale Bot closed this Oct 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

archived Archived because of inactivity ⚠️ DO NOT MERGE Work in progress, proof of concept, or on hold feature macOS Mapbox Maps SDK for macOS runtime styling

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants