Commit Graph

30 Commits

Author SHA1 Message Date
Minh Nguyễn
dc884cd6c3 [ios, macos] Fixed syntax error in documentation comment (#6822)
Fixes #6821.
2016-10-26 00:36:23 -07:00
Minh Nguyễn
9652028915 [ios, macos] Expand changes to entire API 2016-10-17 11:47:22 -07:00
Minh Nguyễn
c78b5b1d7e [ios, macos] Simplified style property enum names
The name of each enumeration type no longer refers to the layer type that uses it.
2016-10-11 15:30:16 -07:00
Minh Nguyễn
50d2c01d7d [ios, macos] Revamped MGLStyleLayer, MGLSource inheritance
Removed the MGLStyleLayer protocol, because almost none of its members was actually implemented in every class that adopted the protocol. Removed the unused mapView backpointer property with no replacement. Renamed MGLBaseStyleLayer to MGLStyleLayer. Created the intermediate abstract classes MGLForegroundStyleLayer and MGLVectorStyleLayer to cover subsets of style layer classes with like functionality.

Moved each MGLBaseStyleLayer initializer and the corresponding properties down to an abstract subclass such that the initializer makes sense for all concrete subclasses. Moved more initializers and the predicate property up to MGLVectorStyleLayer to eliminate duplication among the concrete subclasses. Marked these initializers as designated initializers.

Removed “source” or “layer” before identifier wherever the type of identifier is apparent. Removed extra MGLGeoJSONSource initializer variants in favor of nullable parameters.

Added copious documentation comments for source and style layer classes, including several previously undocumented methods and properties. In particular, some preconditions and postconditions have been documented. Added pragma marks to break up the jazzy documentation pages into sections. Reformatted exceptions for consistency.
2016-10-06 15:19:38 -07:00
Minh Nguyễn
132954b563 [ios, macos] Loosened style doc transform regex (#6543)
Mildly decoupled the transformation from the style specification to the format required for iOS/macOS documentation so it’s harder for style specification references to other properties’ values to fall through the cracks.

Fixes #6541.
2016-09-30 18:20:47 -07:00
Justin R. Miller
ee4715a821 update style generation code for new style spec enum values docs (#6508)
Documentation for enum values landed in mapbox/mapbox-gl-style-spec#510. 

This updates Android, iOS, and macOS documentation code gen scripts to capitalize on them.
2016-09-30 15:55:46 -07:00
David Clark
bf18c33040 [ios, macos] Doc gen handles arrays as required property values (#6448) 2016-09-24 07:39:56 -07:00
Minh Nguyễn
a0e20a6b0f [ios, macos] Allow full hexadecimal colors in layer documentation (#6444)
* [ios, macos] Allow full hex colors in layer docs

CSS hexadecimal RGB syntax can contain all the hexadecimal digits, not just the decimal digits.

* [ios, macos] Parse colors with csscolorparser
2016-09-23 16:04:37 -07:00
Jesse Bounds
4c8d61abf1 [ios, macos] Put MGLStyleLayer inits in respective classes
Previously, we declared MGLStyleLayer initializers in the MGLStyleLayer
protocol as optional methods. This made it easy to opt in and out
of initializers that did or or did not make sense for the subclass.
However, this approach was dangerous since it was easy for an
application developer to initialize an MGLStyleLayer subclass with an
init method that was actually not implemented in that class causing
an exception at runtime.

This commit moves the init methods that each subclass supports to
each subclass so xcode (and the compiler) help the developer avoid
the previously possible runtime exception.

In addition, a new init method is added that takes the source layer
and passes that on to `mbgl::style:Layer` (but only on classes
where this is possible in core). This allows an application developer
to style a specific source layer (i.e. the contour lines of the mapbox
terrain vector source).

Finally, this refactors MGLStyleLayer classes to use an MGLSource instead of a
string identifier for the source when initializing the style.
2016-09-08 09:17:35 -07:00
John Firebaugh
fe2a26225f [core, ios, android, qt] Observe style layer mutations rather than requiring SDKs to use Map::update
This paves the way for updates to filter and layout properties to trigger a source reload, without each SDK having to participate in the implementation.
2016-09-06 14:29:22 -07:00
Minh Nguyễn
f4be8260ba [ios, macos] Specialize color properties by platform
Duplicate each color-typed property once per platform using conditional compilation macros. Let’s just hope we never have to throw CGColor into the mix.
2016-08-26 22:27:55 -07:00
Minh Nguyễn
35a1c01166 [ios, macos] Test roundtripping property functions 2016-08-26 22:27:55 -07:00
Minh Nguyễn
1e7a5ce273 [ios, macos] Test enum values, not just types 2016-08-26 22:27:55 -07:00
Minh Nguyễn
5d06a4370d [ios, macos] Simplified test code generation 2016-08-26 22:27:54 -07:00
Minh Nguyễn
a648f42bc7 [ios, macos] More specific default value types
The documentation for runtime style API properties now spells out the value of the default type, to help developers infer the type of the property itself.
2016-08-26 22:27:51 -07:00
Minh Nguyễn
9d368ea98d [ios, macos] Mark MGLStyleLayer properties null_resettable
If the property is unset, return the default value.

Fixes #6126.
2016-08-26 15:40:10 -07:00
Minh Nguyễn
1b4593efcc [ios, macos] Distinguish between blackColor and clearColor (#6125) 2016-08-24 01:41:26 -07:00
Minh Nguyễn
d6c8463da8 [ios, macos] Copyedit default color property documentation (#6105)
* [ios, macos] Fixed typo in color property docs

* [ios, macos] Predefined colors as default color property values

Use {NS,UI}Color.blackColor and {NS,UI}Color.whiteColor as aliases for common default color values.
2016-08-21 16:04:22 -07:00
Minh Nguyễn
abc825e19b [ios, macos] Detect zero edge insets more strictly
Edges shouldn’t be able to cancel out other edges, so a summation is inappropriate here.
2016-08-19 15:45:17 -07:00
Minh Nguyễn
0a4f0e40ec [ios, macos] Offsets as vectors, padding as edge insets
An offset style attribute is now exposed publicly as an NSValue representing a CGVector instead of an NSArray of NSNumbers. A padding style attribute is now exposed publicly as an NSValue representing an NSEdgeInsets or UIEdgeInsets instead of an NSArray of NSNumbers. This change also fixes round-tripping of padding values due to a difference between the style specification and Foundation regarding the order of edges around a box. Used a designated initializer on NSEdgeInsets/UIEdgeInsets to ensure correct order when converting from C++ to Objective-C.

Fixes #5947, fixes #6065.
2016-08-19 15:45:14 -07:00
Minh Nguyễn
98787b37bf [ios, macos] Refactored array type conversion
Key the array subtype on the last part of the property name. Don’t assume one of the unaccounted-for properties is an offset.
2016-08-19 14:20:27 -07:00
Minh Nguyễn
cb32f60444 [ios, macos] Removed dead code 2016-08-19 14:20:27 -07:00
Minh Nguyễn
14aeb107f3 [ios, macos] Document style attribute interdependencies 2016-08-19 14:20:27 -07:00
Minh Nguyễn
938540b919 [ios, macos] Specify units
Replaced pixels with points in documentation.
2016-08-19 14:20:27 -07:00
Minh Nguyễn
e6ed9cd638 [ios, macos] Fully describe default values
Also expand values in documentation comments to the full enumeration values.

Fixes #5949.
2016-08-19 14:20:27 -07:00
Minh Nguyễn
a4fcea4122 [ios, macos] Refer to attributes in kebab-case
Fixes #5951.
2016-08-19 14:20:26 -07:00
Minh Nguyễn
aa03f0cab7 [ios, macos] Replaced let with var in codegen script 2016-08-19 14:20:26 -07:00
Fredrik Karlsson
9dc252f2f9 [ios, macos] fixes #5958 naming conventions 2016-08-18 14:26:04 +02:00
Justin R. Miller
01b94de107 fixes #5957: automatically call update() for iOS runtime style API 2016-08-16 11:29:26 -07:00
Fredrik Karlsson
2354c87411 Runtime styling API for iOS/macOS (#5727)
* [ios] wip runtime styling

* [ios, macos] Outlined header templates

* [ios, macos] cleanup and use appropiate data types

* [ios, macos] removed refs to mbgl and added convenient color methods on UIColor and NSColor

* [ios, macos] updated header template, included doc string

* [ios, macos] outlined template for layer implementation files

* [ios, macos] moved script to platform/darwin and updated comments

* [ios, macos] Cleaned up the implementation template

* [ios, macos] removed unused function and added support for more datatypes

* [ios, macos] overhauling the type protocols

* [ios, macos] removed unnecessary style classes

* [ios, macos] added support for more types

* [ios, macos] fixed string and number prop values

* [ios, macos] enum getters

* [ios, macos] added removeLayer() and removed unused layer ref

* [ios, macos] fixed remaining layer types and converted style layer into a protocol

* [ios, macos] fixed addLayer() and added example for line layer

* [ios] GeoJSON source now works

* [ios] fixed raster layer and raster source

* [ios] fixed attr prop number and outlined prop function

* [ios] wip functions

* [ios] bool and float function fix

* [ios] cleanup

* [macos] fixed support for macos

* [ios] fixed string functions

* [ios] extended array functions

* [ios] added tests and fixed a few bugs

* [ios] less verbose functions and improved tests

* [ios, macos] Removed unnecessary use of default arguments

Default arguments aren’t supported in Node v4, and they aren’t needed here anyways, because we’re only testing for truthiness.

* [ios, macos] Enum setters

Rely on a macro instead of category methods to specialize the setter implementation for enum attributes, since generic types are disallowed in Objective-C method signatures and mbgl::style::PropertyType must be type-qualified.

* [ios, macos] Got macOS closer to parity w/ iOS

Added various classes and test classes to the macOS workspace. Also fixed lots of compiler errors and updated macosapp runtime styling example to use the new dictionary syntax for function stops.

Updated all conversions from Objective-C stops to C++ stops to enumerate over the dictionary. Fixed compiler errors in enum setter implementations.

Also corrected path to script in generated file comments.

* [ios, macos] Added EJS templates to project

* [ios, macos] Code formatting

Made code format more consistent.

* [ios, macos] Spelled out ID

Cocoa convention is to always spell out “ID” as “identifier”, in part to avoid confusion with the id keyword. Also, URL is capitalized in most contexts, including property names.

* [ios, macos] Grouped related headers together

* [ios, macos] Cleaned up layer transformation

Also added support for converting background layers into Objective-C.

* [ios, macos] Cleaned up tests

Also made the tests work on macOS by introducing a new window to host the map.

* [ios, macos] Replaced TODOs with #warnings

* [ios] convert array based property values

* [ios, macos] color function/undefined getter

* [ios, macos] fixed function/undefined getters for bool and float properties

* [ios, macos] more function/undefined property getters

* [ios, macos] more type conversion and cleanup

* [ios, macos] disable macos runtime styling tests for now

* [ios, macos] cleaned up style code script

* [ios, macos] more type conversion

* [ios] added a base layer to handle visibility min/max zoom

* [macos] fixed base layer

* [ios, macos] use accessor methods

* [ios, macos] cleanup

* [ios, macos] add geojson to ios and macos

* [macos] rebase fix

* [ios, macos] fixed enum getters and added tests for enums

* [ios, macos] added an update method to base layer

* [ios, macos] added some documentation

* [ios, macos] docs

* [ios, macos] removed refs to filters for now

* [ios, macos] various tail work

* [ios, macos] missing import and incorrect type
2016-08-11 13:14:45 -04:00