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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
An OpenGL renderer for [Mapbox vector tiles](https://www.mapbox.com/blog/vector-tiles),
implemented in C++11, targeting iOS & OS X.
# Depends
- Modern C++ compiler that supports `-std=c++11`
- libpng
- glfw3
- Boost (headers only)
- Python (for build only)
- Node.js (for build only)
# Build instructions
## OS X
Install libpng and [glfw3](http://www.glfw.org/docs/latest/):
```
brew install libpng
brew install homebrew/versions/glfw3
```
Then configure the project:
./configure --glfw3=`brew --prefix` --png=`brew --prefix`
See all the options by calling `./configure --help`
```sh
$ ./configure --help
Usage: configure [options]
Options:
-h, --help show this help message and exit
--debug Also build debug build
--glfw3=GLFW3 Path to gflw3 (defaults to using pkg-config)
--png=PNG Path to png (defaults to using pkg-config)
--png-includes=PNG_INCLUDES
Path to png includes
--png-libpath=PNG_LIBPATH
Path to png libs
```
Then you can build the OS X app with make:
make app
Or generate a dual iOS/OS X-compatible Xcode project for `libllmr` to include as a subproject:
make xcode # then open llmr.xcodeproj
## iOS
Because `libpng` isn't included in the iOS SDK, you will need to build a cross-architecture version yourself. Run `./ios/setup_libpng.sh`, which is derived from Mapnik's cross-architecture build scripts. This will also run `./configure`.
Then you can build the iOS app with make:
make iapp
Consider `sudo npm install -g ios-sim` for auto-launching the simulator, but it can be tricky and it's better to run on an ARM-based device anyway. To do this, open `./ios/llmr-app.xcodeproj` in Xcode, then build and run on the simulator or a device yourself.
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 install git cmake make pkg-config
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 libpng-dev:
sudo apt-get install libpng-dev
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
Install glfw3:
git clone https://github.com/glfw/glfw.git
cd glfw
mkdir build
cd build
cmake ../ -DCMAKE_C_COMPILER_ENV_VAR=gcc-4.8
make
sudo make install
cd ../../
Build `libllmr`:
git clone git@github.com:mapbox/llmr-native.git
cd llmr-native
export CXX="g++-4.8"
./configure
make
# Style protobuf
We're encoding the styling information as a protocol buffer, according to
proto/style.proto. The reason for doing so is to avoid needing to ship with a
JSON/yaml parser. To test the conversion script, run
```
bin/convert-style.js && cat resources/style.pbf | protoc --decode=style proto/style.proto
```
You should see a nicely formatted hierarchical output of the converted style.
To update the included default style, use
```
bin/convert-style.js && bin/build-style.js
```
This is automatically taken care of as a build phase if you are using the Xcode projects.
# Usage
## Desktop
- Press 'R' to reset the transform
- Press 'N' to reset north
- 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
- Long-press to reset north
- Two-finger long press to reset the transform
- Three-finger long press to toggle debug information
|