summaryrefslogtreecommitdiff
path: root/README.md
blob: 7319023b76f8c7ce2449a5f6871b84b245707d53 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
[![Travis](https://api.travis-ci.com/mapbox/mapbox-gl-native.svg?token=yZ9zvfZwYkJNWivRLoyX)](https://magnum.travis-ci.com/mapbox/mapbox-gl-native)

An OpenGL renderer for [Mapbox vector tiles](https://www.mapbox.com/blog/vector-tiles),
implemented in C++11, currently targeting iOS, OS X, and Ubuntu Linux.

# Depends

 - Modern C++ compiler that supports `-std=c++11`
 - Boost headers
 - `libpng`
 - `libuv`
 - `glfw3`
 - `libcurl` (depends on OpenSSL; Linux only)
 - `libboost_regex` (Linux only)
 - Homebrew (for build on OS X)
 - Python (for build only)
 - Node.js (for build only)

# Build instructions

We use [mapnik-packaging](https://github.com/mapnik/mapnik-packaging) to build static libraries of
dependencies.

First off: if you hit problems during development try:

    make clean

This will clear cached build data and update to the latest versions of dependencies.

## OS X

First run:

    make setup

This downloads all required dependencies, builds them and creates universal libraries that can be used on both OS X and iOS.

To create projects, you can run:
- `make xproj`: Creates an Xcode project with OS X-specific handlers for HTTP downloads and
  settings storage. It uses GLFW for window handling.
- `make lproj`: Creates an Xcode project with platform-independent handlers for downloads
  and settings storage. This is what is also being built on Linux.
- `make linux`: Builds the Linux GLFW application with `make`.

## iOS

iOS makes use of a Cocoa-specific API called [mapbox-gl-cocoa](https://github.com/mapbox/mapbox-gl-cocoa), 
which is included as a submodule and provides a `UIView` interface to the map view and some bundle resources. 

First, pull down the submodule(s): 

    git submodule init
    git submodule update

Then run:

    make setup

This downloads all required dependencies, builds them and creates universal libraries that can be used on both OS X and iOS.

Lastly, `make iproj` to create and open an Xcode project with an iOS-specific view controller housing. 

Target devices: iPhone 4 and above (4S, 5, 5c, 5s) and iPad 2 and above (3, 4, mini and/or retina).

## Ubuntu

Ensure you have git and other build essentials:

    sudo apt-get update
    sudo apt-get install git build-essential zlib1g-dev automake libtool xutils-dev make cmake pkg-config nodejs-legacy

Install a `-std=c++11` capable compiler

    sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test
    sudo apt-get update
    sudo apt-get install gcc-4.8 g++-4.8

Install glfw3 dependencies:

    sudo apt-get install libxi-dev libglu1-mesa-dev x11proto-randr-dev x11proto-xext-dev libxrandr-dev x11proto-xf86vidmode-dev libxxf86vm-dev libxcursor-dev

Then run:

    make setup

This downloads all required dependencies, builds them and creates universal libraries that can be used on both OS X and iOS.

You can then proceed to build the library like:

    make linux

# Style

We're currently embedding the stylesheet JSON in the binary. To create the C++
file and the associated header, run

```
node bin/build-style.js
```

This is automatically taken care of as a build phase.

# Usage

## Desktop

- Press `X` to reset the transform
- Press `N` to reset north
- Press `R` to toggle styles
- Press `Tab` to toggle debug information
- Press `Esc` to quit

## Mobile

- Pan to move
- Pinch to zoom
- Use two fingers to rotate
- Double-tap to zoom in one level
- Two-finger single-tap to zoom out one level
- Single-tap to toggle the command palette visibility for resetting north & the transform, toggling debug, toggling styles, and locating the user
- Double-tap, long-pressing the second, then pan up and down to "quick zoom" (iPhone only, meant for one-handed use)

# Other notes

Under early development, this project was called LLMR (Low-Level Map Renderer), in case you see any lingering references to it.