Commit Graph

1345 Commits

Author SHA1 Message Date
Minh Nguyễn
11d99bd890 [ios] Refined custom callout view support
Renamed MGLCalloutView to MGLCompactCalloutView and MGLCalloutViewProtocol to MGLCalloutView to avoid an awkward workaround for a Swift name collision. Replaced individual title and subtitle properties with a single representedObject property that lets you use custom annotation properties in the custom callout view. Overrode a problematic SMCalloutView method. Added lots more documentation.
2016-01-06 23:43:07 -08:00
Romain Quidet
04ab28b621 [ios] expose custom callout api, wrap around SMCalloutView class 2016-01-06 23:42:41 -08:00
Minh Nguyễn
bc6054152c [ios] Removed appledoc workaround 2016-01-05 12:41:58 -08:00
Jason Wray
6905be6b2d [ios] more inline docs updates for jazzy
- Change all smart quotes to dumb quotes to workaround SourceKitten bug.
- Port changes from OS X (#3135)
2016-01-05 12:41:58 -08:00
Minh Nguyễn
1420a49689 [ios] Generate API documentation using jazzy
Replaced appledoc usage with jazzy, which understands modern Objective-C syntax by virtue of using Clang ASTs. Nevertheless, we have to make lots of changes to our documentation syntax, which was tailored to appledocs quirks. The new syntax jives much better with what Xcode expects in terms of auto-indentation and Quick Help.

Fixes #1420.
2016-01-05 12:41:54 -08:00
Thiago Marcos P. Santos
6d0b01c5fb [core] Make it possible to limit the size of the SQLite cache 2015-12-27 18:15:33 +02:00
John Firebaugh
7a6076ea9d [tests] Test with OnlineFileSource
When we introduce OfflineFileSource, the behavior of existing tests should
not change.
2015-12-23 14:55:12 -08:00
John Firebaugh
16de579d7c [core] Rationalize error handling for resource loading
* Standardize on std::exception_ptr as the error representation
  (fixes #2854).
* Don't format textual strings at the error source; pass on the
  constituent data via observer method parameters instead.
* Use the null object pattern to simplify observer notification code.
* Further refactoring for ResourceLoading tests.
2015-12-23 12:50:42 -08:00
John Firebaugh
7c22792bdf [tests] Rewrite resource loading test
Make it more readable and easier to debug.
2015-12-22 18:00:30 -08:00
Minh Nguyễn
d745ff0923 [ios] Meters per point at latitude
Renamed -metersPerPixelAtLatitude: to -metersPerPointAtLatitude:, leaving the old name as a deprecated alias. In Cocoa Touch terminology, “point” is the visual unit backed by pixels.
2015-12-22 17:06:43 -08:00
John Firebaugh
913f49c701 [core] Prepare for OfflineFileSource
* Rename existing DefaultFileSource to OnlineFileSource
* Restore a DefaultFileSource that's a passthrough to OnlineFileSource
2015-12-21 11:35:00 -08:00
Minh Nguyễn
49bfdd662f [ios, osx] Optional peak altitude for flying 2015-12-20 04:11:14 -08:00
Minh Nguyễn
a5230f3e11 [core] Clamp pitch in easeTo(), flyTo()
Also factored out the maximum pitch into a constant.
2015-12-19 23:14:01 -08:00
Minh Nguyễn
2cb70eac3c [ios, osx] Allow zero-duration flight
For consistency with -setCamera:…, a duration of 0 jumps instantaneously to the new location, while a negative value uses the distance-dependent default.

Due to the produced curve and applied easing, flyTo() doesn’t model a parabola or ballistic trajectory, but it does simulate powered flight to some extent.
2015-12-19 20:33:37 -08:00
Minh Nguyễn
0a9b6a82e4 [core] Reformulated flyTo options
The speed and curve fields in CameraOptions have been replaced with velocity and minZoom fields, which expressed in screen units. Scaling and easing make it difficult to derive options that are expressed in physical units.
2015-12-19 20:33:18 -08:00
Minh Nguyễn
af9de6c0ac [core] Refined and commented flyTo
Rewrote the flyTo implementation to more closely match GL JS’s implementation and the paper on which it is based.

Rewrote CameraOptions documentation. Only document units for generic types like double. The semantics of LatLng and Duration are already baked into the types; one just needs to look up the types’ definitions. Also, the […) is set notation, so the braces are supposed to be mismatched.

Fixes #3296.
2015-12-19 20:31:40 -08:00
Brad Leege
f7d1a40350 [android] Camera API 2015-12-18 11:33:40 -08:00
John Firebaugh
110f1ec796 [ios, android] Add methods to remove a custom layer 2015-12-17 15:15:55 -08:00
Minh Nguyễn
bf89ed080b [ios] Renamed custom style layer invalidation method
Cf. -[UIView setNeedsDisplay] and -[MKOverlayRenderer setNeedsDisplay].
2015-12-16 16:15:28 -08:00
John Firebaugh
2ee52915fe [ios, android] Add a method to invalidate custom layers, forcing a repaint 2015-12-16 16:15:28 -08:00
Minh Nguyễn
304b4ec664 [ios] Silence undocumented typedef warnings from appledoc
ref #3203
2015-12-16 15:48:55 -08:00
Minh Nguyễn
350cafb903 Revert "Revert "[ios] Custom style layer""
This reverts commit 081e4e4451.
2015-12-16 15:48:55 -08:00
John Firebaugh
0db9f229f2 [android] Move includes to platform subdirectory 2015-12-16 14:52:29 -08:00
John Firebaugh
081e4e4451 Revert "[ios] Custom style layer"
ec9a4cd328
2015-12-16 14:05:54 -08:00
Minh Nguyễn
ec9a4cd328 [ios] Custom style layer
Exposed Map::addCustomLayer() publicly as an undocumented, block-based API. This change avoids the terms “layer”, “initialize”, “render”, and “altitude” because they overload existing terminology in the SDK, UIKit, or MapKit. (“Layer” is qualified as “style layer”.) There are outstanding questions about ARC memory management, but this approach works in both Objective-C and Swift for pure OpenGL programming.

Added a demo to iosapp that draws a green layer below any labels in Mapbox Streets.
2015-12-16 11:03:54 -08:00
Romain Quidet
b8be1f0632 code review updates: sprite_atlas brackets and nullable removed for reuseIdentifier of annotationImage 2015-12-15 16:36:17 -08:00
Romain Quidet
02a32b55e4 2210: MGLAnnotationImage image can be update 2015-12-15 16:36:17 -08:00
Minh Nguyễn
4e0e816653 [ios, osx] Added flyToCamera: variation that uses default duration 2015-12-15 12:52:13 -08:00
Minh Nguyễn
9aba820892 [ios, osx] Added flyTo to OS X; refactored camera setters 2015-12-15 12:52:13 -08:00
Minh Nguyễn
e1854f0f26 [core] Corrected flying trajectory; pitched flight
Corrected some fairly opaque code that was incorrectly ported from GL JS the first time around in #3171, causing the trajectory to extend far into the Earth’s orbit. Also transition pitch while flying, call transition frame/finish callback functions, and recognize the same “speed” and “curve” parameters that GL JS does.

Fixes #3296, fixes #3297.
2015-12-15 12:52:13 -08:00
Konstantin Käfer
4fc8226838 [core] allow changing the orientation
You can now change the orientation of north to be to the right, bottom, left in addition to the default of top
2015-12-15 11:41:58 -08:00
Mike Morris
f4d394d935 [node] code review cleanup 2015-12-15 10:19:56 -08:00
Minh Nguyễn
0fb2b855a4 [osx] Map camera
Shared MGLMapCamera between iOS and OS X. Unfortunately -camera and -setCamera: implementations need to be copy-pasted for now.
2015-12-13 17:26:53 -08:00
Minh Nguyễn
fdff7901e2 [osx] Default callout view controller 2015-12-13 17:26:53 -08:00
Minh Nguyễn
ea57be5598 [osx] Documentation comments for public classes
Added documentation comments for all the public headers that aren’t being shared with iOS.

Removed an animated: parameter from -selectAnnotation: and -deselectAnnotation:: because callout popovers may extend beyond the entire window, there is no need to scroll the map to make the entire callout visible.

Added missing geometric conversion methods.

Renamed -mapView:regionWillChangeAnimated: et al. to say “camera” instead of “region”. “Region” leaves ambiguity about whether properties like rotation and pitch trigger this method. “Camera” associates these methods with the camera property, which seems apt.
2015-12-13 17:26:53 -08:00
Minh Nguyễn
73324ae2f8 [osx] Commented private headers and implementation files 2015-12-13 17:26:53 -08:00
Minh Nguyễn
47fb5e820b [osx] Moved Mapbox.{h,m} into framework proper; set version variables 2015-12-13 17:26:53 -08:00
Minh Nguyễn
1598330a93 [osx] Added inline comments to MGLMapView 2015-12-13 17:26:53 -08:00
Minh Nguyễn
004d04075a [osx] Annotation cursors
Also added an option to osxapp for assigning a random cursor to all the annotations each time an annotation is added or removed.
2015-12-13 17:26:53 -08:00
Minh Nguyễn
f542d7b2a7 [osx] Annotation tooltips
Annotations can optionally have tooltips. osxapp has an option, off by default, to assign a (localized) tooltip to each dropped pin.
2015-12-13 17:26:53 -08:00
Minh Nguyễn
96145ef170 [osx] Drop Pin context menu item 2015-12-13 17:26:53 -08:00
Minh Nguyễn
0cab7809eb [osx] Rewrote platform-osx and osxapp
platform-osx now vends a real NSView subclass, MGLMapView, that is readily embedded inside a Cocoa application for OS X. MGLMapView is backed by an NSOpenGLLayer for optimal performance and integration with other layer-backed views. It supports keyboard shortcuts and several gestures and hosts attribution, zooming, and rotation controls as subviews. osxapp is now a bona fide Cocoa application that embeds MGLMapView inside a XIB. osxapp has preferences and a share button for tight integration with custom styles.

Enabling asynchronous rendering would be more consistent with iOS but increases CPU usage so much, even when idle, that it isn’t worth any performance gain. The bigger issue is that VAOs aren’t being used.

make xpackage creates a static library similar to the one created by make ipackage. make clean cleans additional places where build output ends up.

The OS X minimum deployment target has been increased from 10.9 to 10.10. osxapp’s window has a full size content view, which requires 10.10. Lightweight generics require iOS 9+ and OS X 10.11 regardless, because it was only in that release that Foundation collection classes started adopting lightweight generics.

Shuffled files around and refactored annotations so that iOS and OS X share a good chunk of the annotations code, which now takes advantage of polymorphism. MGLMapView can now display annotations but cannot yet select them. In osxapp, a long press drops a pin, and so does the map view’s context menu.

Annotations have NSPopovers as callouts, and their view controllers can be customized. Annotation image alignment rects are respected for hit testing purposes and for positioning the callout anchor. Callouts in osxapp demonstrate the use of bindings to keep callouts in sync with underlying model objects.
2015-12-13 17:17:35 -08:00
John Firebaugh
65b3220368 [core] Reduce custom layer API to lowest common denominator 2015-12-11 12:44:54 -08:00
Adam Hunter
095a8be300 Implementation of flyTo. 2015-12-09 17:14:22 -08:00
John Firebaugh
bde07c8f0e [core] Custom layers 2015-12-09 13:51:28 -08:00
John Firebaugh
e04c5f6506 [core] Replace StyleLayerType with RTTI 2015-12-07 18:22:33 -08:00
Minh Nguyễn
265e56d056 Fixed linker warnings about overridden styleURL__
Reapplied #3097, which was originally applied to the release-ios-v3.0.0 branch but was omitted in a merge back to master.
2015-12-06 14:44:57 -08:00
Konstantin Käfer
0c351eb523 [core] use default instead of empty function body 2015-12-03 15:38:36 +01:00
Konstantin Käfer
478472e501 [core] add std::move to constructors 2015-12-03 15:38:36 +01:00
Konstantin Käfer
d5fb535058 [core] add namespace comment to closing brace 2015-12-03 15:38:36 +01:00