Merge branch 'master' into fuzz-pipe
Conflicts: bin/package.json src/style/style_parser.cpp test/fixtures/fixture_log.cpp test/test.gyp
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -12,7 +12,7 @@
|
||||
/config/constants_local.cpp
|
||||
/build
|
||||
/bin/node_modules
|
||||
/include/llmr/shader/shaders.hpp
|
||||
/include/mbgl/shader/shaders.hpp
|
||||
/src/shader/shaders_gl.cpp
|
||||
/src/shader/shaders_gles2.cpp
|
||||
/bin/style.bin.js
|
||||
|
||||
40
Makefile
40
Makefile
@@ -12,9 +12,9 @@ config.gypi:
|
||||
./setup-libraries.sh
|
||||
|
||||
# Builds the regular library
|
||||
llmr: config.gypi llmr.gyp node
|
||||
deps/run_gyp llmr.gyp --depth=. -Goutput_dir=.. --generator-output=./build/llmr -f make
|
||||
$(MAKE) -C build/llmr BUILDTYPE=$(BUILDTYPE) V=$(V) llmr-x86
|
||||
mbgl: config.gypi mapboxgl.gyp node
|
||||
deps/run_gyp mapboxgl.gyp --depth=. -Goutput_dir=.. --generator-output=./build/mbgl -f make
|
||||
$(MAKE) -C build/mbgl BUILDTYPE=$(BUILDTYPE) V=$(V) mapboxgl
|
||||
|
||||
node:
|
||||
@if [ ! `which node` ]; then echo 'error: depends on node.js. please make sure node is on your PATH'; exit 1; fi;
|
||||
@@ -40,8 +40,8 @@ xtest: config.gypi clear_xcode_cache node
|
||||
|
||||
|
||||
# Builds the linux app with make. This is also used by Travis CI
|
||||
linux: config.gypi linux/llmr-app.gyp node
|
||||
deps/run_gyp linux/llmr-app.gyp --depth=. -Goutput_dir=.. --generator-output=./build/linux -f make
|
||||
linux: config.gypi linux/mapboxgl-app.gyp node
|
||||
deps/run_gyp linux/mapboxgl-app.gyp --depth=. -Goutput_dir=.. --generator-output=./build/linux -f make
|
||||
$(MAKE) -C build/linux BUILDTYPE=$(BUILDTYPE) V=$(V) linuxapp
|
||||
|
||||
# Executes the Linux binary
|
||||
@@ -51,8 +51,8 @@ run-linux: linux
|
||||
|
||||
|
||||
# Builds the OS X app with make.
|
||||
osx: config.gypi macosx/llmr-app.gyp node
|
||||
deps/run_gyp macosx/llmr-app.gyp --depth=. -Goutput_dir=.. --generator-output=./build/macosx -f make
|
||||
osx: config.gypi macosx/mapboxgl-app.gyp node
|
||||
deps/run_gyp macosx/mapboxgl-app.gyp --depth=. -Goutput_dir=.. --generator-output=./build/macosx -f make
|
||||
$(MAKE) -C build/macosx BUILDTYPE=$(BUILDTYPE) V=$(V) osxapp
|
||||
|
||||
# Executes the OS X binary
|
||||
@@ -65,27 +65,27 @@ clear_xcode_cache:
|
||||
@CUSTOM_DD=`defaults read com.apple.dt.Xcode IDECustomDerivedDataLocation 2>/dev/null`; \
|
||||
if [[ $$CUSTOM_DD ]]; then \
|
||||
echo clearing files in $$CUSTOM_DD older than one day; \
|
||||
find $$CUSTOM_DD/llmr-app-* -mtime +1 | xargs rm -rf; \
|
||||
find $$CUSTOM_DD/mapboxgl-app-* -mtime +1 | xargs rm -rf; \
|
||||
fi; \
|
||||
if [[ -d ~/Library/Developer/Xcode/DerivedData/ ]] && [[ ! $$CUSTOM_DD ]]; then \
|
||||
echo 'clearing files in ~/Library/Developer/Xcode/DerivedData/llmr-app-* older than one day'; \
|
||||
find ~/Library/Developer/Xcode/DerivedData/llmr-app-* -mtime +1 | xargs rm -rf; \
|
||||
echo 'clearing files in ~/Library/Developer/Xcode/DerivedData/mapboxgl-app-* older than one day'; \
|
||||
find ~/Library/Developer/Xcode/DerivedData/mapboxgl-app-* -mtime +1 | xargs rm -rf; \
|
||||
fi
|
||||
|
||||
# build Mac OS X project for Xcode
|
||||
xproj: config.gypi macosx/llmr-app.gyp clear_xcode_cache node
|
||||
deps/run_gyp macosx/llmr-app.gyp --depth=. --generator-output=./build -f xcode
|
||||
open ./build/macosx/llmr-app.xcodeproj
|
||||
xproj: config.gypi macosx/mapboxgl-app.gyp clear_xcode_cache node
|
||||
deps/run_gyp macosx/mapboxgl-app.gyp --depth=. --generator-output=./build -f xcode
|
||||
open ./build/macosx/mapboxgl-app.xcodeproj
|
||||
|
||||
# build iOS project for Xcode
|
||||
iproj: config.gypi ios/mapbox-gl-cocoa/app/llmr-app.gyp clear_xcode_cache node
|
||||
deps/run_gyp ios/mapbox-gl-cocoa/app/llmr-app.gyp --depth=. --generator-output=./build -f xcode
|
||||
open ./build/ios/mapbox-gl-cocoa/app/llmr-app.xcodeproj
|
||||
iproj: config.gypi ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp clear_xcode_cache node
|
||||
deps/run_gyp ios/mapbox-gl-cocoa/app/mapboxgl-app.gyp --depth=. --generator-output=./build -f xcode
|
||||
open ./build/ios/mapbox-gl-cocoa/app/mapboxgl-app.xcodeproj
|
||||
|
||||
# build Linux project for Xcode (Runs on Mac OS X too, but without platform-specific code)
|
||||
lproj: config.gypi linux/llmr-app.gyp clear_xcode_cache node
|
||||
deps/run_gyp linux/llmr-app.gyp --depth=. --generator-output=./build -f xcode
|
||||
open ./build/linux/llmr-app.xcodeproj
|
||||
lproj: config.gypi linux/mapboxgl-app.gyp clear_xcode_cache node
|
||||
deps/run_gyp linux/mapboxgl-app.gyp --depth=. --generator-output=./build -f xcode
|
||||
open ./build/linux/mapboxgl-app.xcodeproj
|
||||
|
||||
|
||||
##### Maintenace operations ####################################################
|
||||
@@ -101,4 +101,4 @@ distclean: clean
|
||||
-rm -rf ./config.gypi
|
||||
-rm -rf ./mapnik-packaging/osx/out/
|
||||
|
||||
.PHONY: llmr test linux
|
||||
.PHONY: mbgl test linux
|
||||
|
||||
@@ -83,10 +83,10 @@ module.exports = function(shader_type, prefix, suffix) {
|
||||
}
|
||||
|
||||
var header = '// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.\n\n';
|
||||
header += '#ifndef LLMR_SHADER_SHADERS\n';
|
||||
header += '#define LLMR_SHADER_SHADERS\n';
|
||||
header += '#ifndef MBGL_SHADER_SHADERS\n';
|
||||
header += '#define MBGL_SHADER_SHADERS\n';
|
||||
header += '\n';
|
||||
header += 'namespace llmr {\n';
|
||||
header += 'namespace mbgl {\n';
|
||||
header += '\n';
|
||||
header += 'struct shader_source {\n';
|
||||
header += ' const char *vertex;\n';
|
||||
@@ -106,18 +106,19 @@ module.exports = function(shader_type, prefix, suffix) {
|
||||
|
||||
|
||||
var code = '// NOTE: DO NOT CHANGE THIS FILE. IT IS AUTOMATICALLY GENERATED.\n';
|
||||
code += '#include <llmr/platform/gl.hpp>\n';
|
||||
code += '#include <mbgl/platform/gl.hpp>\n';
|
||||
code += prefix + '\n';
|
||||
code += '#include <llmr/shader/shaders.hpp>\n';
|
||||
code += '#include <mbgl/shader/shaders.hpp>\n';
|
||||
code += '\n';
|
||||
code += 'using namespace llmr;\n';
|
||||
code += 'namespace mbgl {\n';
|
||||
code += '\n';
|
||||
code += 'const shader_source llmr::shaders[SHADER_COUNT] = {\n';
|
||||
code += 'const shader_source shaders[SHADER_COUNT] = {\n';
|
||||
code += lines.join(',\n');
|
||||
code += '\n};\n';
|
||||
code += '\n}\n';
|
||||
code += suffix + '\n';
|
||||
|
||||
var header_path = path.join(process.argv[2], 'include/llmr/shader/shaders.hpp');
|
||||
var header_path = path.join(process.argv[2], 'include/mbgl/shader/shaders.hpp');
|
||||
mkdirp.sync(path.dirname(header_path));
|
||||
fs.writeFileSync(header_path, header);
|
||||
console.warn('wrote file ' + header_path);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "llmr-native",
|
||||
"name": "mbgl-native",
|
||||
"version": "0.0.1",
|
||||
"dependencies": {
|
||||
"brfs": "^1.1.2",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
|
||||
#include <llmr/platform/platform.hpp>
|
||||
#include <llmr/platform/request.hpp>
|
||||
#include <llmr/util/uv.hpp>
|
||||
#include <llmr/util/std.hpp>
|
||||
#include <mbgl/platform/platform.hpp>
|
||||
#include <mbgl/platform/request.hpp>
|
||||
#include <mbgl/util/uv.hpp>
|
||||
#include <mbgl/util/std.hpp>
|
||||
|
||||
#include <queue>
|
||||
#include <boost/lockfree/queue.hpp>
|
||||
@@ -47,7 +47,7 @@
|
||||
See http://nikhilm.github.com/uvbook/ for more information on libuv.
|
||||
*/
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
namespace platform {
|
||||
namespace request {
|
||||
|
||||
@@ -66,8 +66,8 @@ static uv_async_t async_cancel;
|
||||
// Stores pointers (!) to shared_ptrs. We use shared_ptrs so that request objects don't get
|
||||
// auto-destructed while they're in progress. The TileData object retains a weak_ptr to this
|
||||
// request, so we have to use a shared_ptr here to ensure that this object stays alive.
|
||||
static boost::lockfree::queue<std::shared_ptr<llmr::platform::Request> *> add_queue(8);
|
||||
static boost::lockfree::queue<std::shared_ptr<llmr::platform::Request> *> cancel_queue(8);
|
||||
static boost::lockfree::queue<std::shared_ptr<mbgl::platform::Request> *> add_queue(8);
|
||||
static boost::lockfree::queue<std::shared_ptr<mbgl::platform::Request> *> cancel_queue(8);
|
||||
|
||||
// Used as the CURL timer function to periodically check for socket updates.
|
||||
static uv_timer_t timeout;
|
||||
@@ -85,10 +85,10 @@ static CURLSH *curl_share = nullptr;
|
||||
static std::queue<CURL *> curl_handle_cache;
|
||||
|
||||
|
||||
class CURLRequest : public llmr::platform::Request {
|
||||
class CURLRequest : public mbgl::platform::Request {
|
||||
public:
|
||||
CURLRequest(const std::string &url,
|
||||
std::function<void(llmr::platform::Response *)> callback,
|
||||
std::function<void(mbgl::platform::Response *)> callback,
|
||||
std::shared_ptr<uv::loop> loop)
|
||||
: Request(url, callback, loop) {}
|
||||
|
||||
@@ -380,4 +380,4 @@ void platform::cancel_request_http(const std::shared_ptr<Request> &req) {
|
||||
uv_async_send(&async_cancel);
|
||||
}
|
||||
}
|
||||
} // end namespace llmr
|
||||
} // end namespace mbgl
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <llmr/platform/request.hpp>
|
||||
#include <llmr/platform/platform.hpp>
|
||||
#include <llmr/util/std.hpp>
|
||||
#include <mbgl/platform/request.hpp>
|
||||
#include <mbgl/platform/platform.hpp>
|
||||
#include <mbgl/util/std.hpp>
|
||||
#include <uv.h>
|
||||
|
||||
uv_once_t request_initialize = UV_ONCE_INIT;
|
||||
@@ -37,10 +37,10 @@ void request_initialize_cb() {
|
||||
|
||||
// We're using a child class to make sure ARC is working correctly, as well as to add activity
|
||||
// indicators on iOS.
|
||||
class FoundationRequest : public llmr::platform::Request {
|
||||
class FoundationRequest : public mbgl::platform::Request {
|
||||
public:
|
||||
FoundationRequest(const std::string &url,
|
||||
std::function<void(llmr::platform::Response *)> callback,
|
||||
std::function<void(mbgl::platform::Response *)> callback,
|
||||
std::shared_ptr<uv::loop> loop)
|
||||
: Request(url, callback, loop) {
|
||||
#if TARGET_OS_IPHONE
|
||||
@@ -65,8 +65,8 @@ public:
|
||||
NSURLSessionDataTask *task = nullptr;
|
||||
};
|
||||
|
||||
std::shared_ptr<llmr::platform::Request>
|
||||
llmr::platform::request_http(const std::string &url,
|
||||
std::shared_ptr<mbgl::platform::Request>
|
||||
mbgl::platform::request_http(const std::string &url,
|
||||
std::function<void(Response *)> callback,
|
||||
std::shared_ptr<uv::loop> loop) {
|
||||
uv_once(&request_initialize, request_initialize_cb);
|
||||
@@ -109,7 +109,7 @@ llmr::platform::request_http(const std::string &url,
|
||||
return req;
|
||||
}
|
||||
|
||||
void llmr::platform::cancel_request_http(const std::shared_ptr<Request> &req) {
|
||||
void mbgl::platform::cancel_request_http(const std::shared_ptr<Request> &req) {
|
||||
if (req) {
|
||||
[((FoundationRequest *)(req.get()))->task cancel];
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ GLFWView::GLFWView(bool fullscreen) : fullscreen(fullscreen) {
|
||||
|
||||
GLFWView::~GLFWView() { glfwTerminate(); }
|
||||
|
||||
void GLFWView::initialize(llmr::Map *map) {
|
||||
void GLFWView::initialize(mbgl::Map *map) {
|
||||
View::initialize(map);
|
||||
|
||||
if (!glfwInit()) {
|
||||
@@ -34,7 +34,7 @@ void GLFWView::initialize(llmr::Map *map) {
|
||||
glfwWindowHint(GLFW_STENCIL_BITS, 8);
|
||||
glfwWindowHint(GLFW_DEPTH_BITS, 16);
|
||||
|
||||
window = glfwCreateWindow(1024, 768, "llmr", monitor, NULL);
|
||||
window = glfwCreateWindow(1024, 768, "Mapbox GL", monitor, NULL);
|
||||
if (!window) {
|
||||
glfwTerminate();
|
||||
fprintf(stderr, "Failed to initialize window\n");
|
||||
@@ -194,6 +194,10 @@ void GLFWView::swap() {
|
||||
glfwPostEmptyEvent();
|
||||
}
|
||||
|
||||
void GLFWView::notify_map_change(mbgl::MapChange change, mbgl::timestamp delay) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
void GLFWView::fps() {
|
||||
static int frames = 0;
|
||||
static double time_elapsed = 0;
|
||||
@@ -208,7 +212,7 @@ void GLFWView::fps() {
|
||||
}
|
||||
}
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
namespace platform {
|
||||
|
||||
double elapsed() { return glfwGetTime(); }
|
||||
@@ -281,9 +285,5 @@ void show_color_debug_image(std::string name, const char *data, size_t logical_w
|
||||
}
|
||||
#endif
|
||||
|
||||
void notify_map_change(MapChange change) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#ifndef LLMR_COMMON_GLFW_VIEW
|
||||
#define LLMR_COMMON_GLFW_VIEW
|
||||
#ifndef MBGL_COMMON_GLFW_VIEW
|
||||
#define MBGL_COMMON_GLFW_VIEW
|
||||
|
||||
#include <llmr/llmr.hpp>
|
||||
#include <mbgl/mbgl.hpp>
|
||||
#include <mbgl/util/time.hpp>
|
||||
|
||||
#ifdef NVIDIA
|
||||
#define GLFW_INCLUDE_ES2
|
||||
@@ -10,14 +11,15 @@
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
class GLFWView : public llmr::View {
|
||||
class GLFWView : public mbgl::View {
|
||||
public:
|
||||
GLFWView(bool fullscreen = false);
|
||||
~GLFWView();
|
||||
|
||||
void initialize(llmr::Map *map);
|
||||
void initialize(mbgl::Map *map);
|
||||
void swap();
|
||||
void make_active();
|
||||
void notify_map_change(mbgl::MapChange change, mbgl::timestamp delay = 0);
|
||||
|
||||
static void key(GLFWwindow *window, int key, int scancode, int action, int mods);
|
||||
static void scroll(GLFWwindow *window, double xoffset, double yoffset);
|
||||
|
||||
@@ -1,19 +1,12 @@
|
||||
#include "headless_view.hpp"
|
||||
#include <llmr/util/timer.hpp>
|
||||
#include <llmr/platform/platform.hpp>
|
||||
#include <mbgl/util/timer.hpp>
|
||||
|
||||
namespace llmr {
|
||||
#include <stdexcept>
|
||||
|
||||
namespace platform {
|
||||
|
||||
void notify_map_change(MapChange change) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
}
|
||||
namespace mbgl {
|
||||
|
||||
HeadlessView::HeadlessView() {
|
||||
#if LLMR_USE_CGL
|
||||
#if MBGL_USE_CGL
|
||||
// TODO: test if OpenGL 4.1 with GL_ARB_ES2_compatibility is supported
|
||||
// If it is, use kCGLOGLPVersion_3_2_Core and enable that extension.
|
||||
CGLPixelFormatAttribute attributes[] = {
|
||||
@@ -39,7 +32,7 @@ HeadlessView::HeadlessView() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LLMR_USE_GLX
|
||||
#if MBGL_USE_GLX
|
||||
x_display = XOpenDisplay(0);
|
||||
|
||||
if (x_display == nullptr) {
|
||||
@@ -75,7 +68,7 @@ HeadlessView::HeadlessView() {
|
||||
void HeadlessView::resize(int width, int height) {
|
||||
clear_buffers();
|
||||
|
||||
#if LLMR_USE_CGL
|
||||
#if MBGL_USE_CGL
|
||||
make_active();
|
||||
|
||||
// Create depth/stencil buffer
|
||||
@@ -110,7 +103,7 @@ void HeadlessView::resize(int width, int height) {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LLMR_USE_GLX
|
||||
#if MBGL_USE_GLX
|
||||
x_pixmap = XCreatePixmap(x_display, DefaultRootWindow(x_display), width, height, 32);
|
||||
glx_pixmap = glXCreateGLXPixmap(x_display, x_info, x_pixmap);
|
||||
|
||||
@@ -120,7 +113,7 @@ void HeadlessView::resize(int width, int height) {
|
||||
}
|
||||
|
||||
void HeadlessView::clear_buffers() {
|
||||
#if LLMR_USE_CGL
|
||||
#if MBGL_USE_CGL
|
||||
glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, 0);
|
||||
|
||||
if (fbo) {
|
||||
@@ -139,7 +132,7 @@ void HeadlessView::clear_buffers() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LLMR_USE_GLX
|
||||
#if MBGL_USE_GLX
|
||||
if (glx_pixmap) {
|
||||
glXDestroyGLXPixmap(x_display, glx_pixmap);
|
||||
glx_pixmap = 0;
|
||||
@@ -155,20 +148,24 @@ void HeadlessView::clear_buffers() {
|
||||
HeadlessView::~HeadlessView() {
|
||||
clear_buffers();
|
||||
|
||||
#if LLMR_USE_CGL
|
||||
#if MBGL_USE_CGL
|
||||
CGLDestroyContext(gl_context);
|
||||
#endif
|
||||
}
|
||||
|
||||
void HeadlessView::notify_map_change(mbgl::MapChange change, mbgl::timestamp delay) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
void HeadlessView::make_active() {
|
||||
#if LLMR_USE_CGL
|
||||
#if MBGL_USE_CGL
|
||||
CGLError error = CGLSetCurrentContext(gl_context);
|
||||
if (error) {
|
||||
fprintf(stderr, "Switching OpenGL context failed\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
#if LLMR_USE_GLX
|
||||
#if MBGL_USE_GLX
|
||||
if (!glXMakeCurrent(x_display, glx_pixmap, gl_context)) {
|
||||
fprintf(stderr, "Switching OpenGL context failed\n");
|
||||
}
|
||||
@@ -178,7 +175,7 @@ void HeadlessView::make_active() {
|
||||
void HeadlessView::swap() {}
|
||||
|
||||
unsigned int HeadlessView::root_fbo() {
|
||||
#if LLMR_USE_CGL
|
||||
#if MBGL_USE_CGL
|
||||
return fbo;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -1,17 +1,18 @@
|
||||
#ifndef LLMR_COMMON_HEADLESS_CGL
|
||||
#define LLMR_COMMON_HEADLESS_CGL
|
||||
#ifndef MBGL_COMMON_HEADLESS_CGL
|
||||
#define MBGL_COMMON_HEADLESS_CGL
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define LLMR_USE_CGL 1
|
||||
#define MBGL_USE_CGL 1
|
||||
#else
|
||||
#include <GL/glx.h>
|
||||
#define LLMR_USE_GLX 1
|
||||
#define MBGL_USE_GLX 1
|
||||
#endif
|
||||
|
||||
#include <llmr/map/view.hpp>
|
||||
#include <llmr/platform/gl.hpp>
|
||||
#include <mbgl/map/view.hpp>
|
||||
#include <mbgl/platform/gl.hpp>
|
||||
#include <mbgl/util/time.hpp>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class HeadlessView : public View {
|
||||
public:
|
||||
@@ -20,6 +21,7 @@ public:
|
||||
|
||||
void resize(int width, int height);
|
||||
|
||||
void notify_map_change(MapChange change, timestamp delay = 0);
|
||||
void make_active();
|
||||
void swap();
|
||||
unsigned int root_fbo();
|
||||
@@ -29,14 +31,14 @@ private:
|
||||
|
||||
|
||||
private:
|
||||
#if LLMR_USE_CGL
|
||||
#if MBGL_USE_CGL
|
||||
CGLContextObj gl_context;
|
||||
GLuint fbo = 0;
|
||||
GLuint fbo_depth_stencil = 0;
|
||||
GLuint fbo_color = 0;
|
||||
#endif
|
||||
|
||||
#if LLMR_USE_GLX
|
||||
#if MBGL_USE_GLX
|
||||
GLXContext gl_context = nullptr;
|
||||
XVisualInfo *x_info = nullptr;
|
||||
Display *x_display = nullptr;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef LLMR_COMMON_NSLOG_LOG
|
||||
#define LLMR_COMMON_NSLOG_LOG
|
||||
#ifndef MBGL_COMMON_NSLOG_LOG
|
||||
#define MBGL_COMMON_NSLOG_LOG
|
||||
|
||||
#include <llmr/platform/log.hpp>
|
||||
#include <mbgl/platform/log.hpp>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class NSLogBackend : public LogBackend {
|
||||
public:
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <cstdarg>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
void NSLogBackend::record(EventSeverity severity, Event event, const std::string &msg) {
|
||||
NSLog(@"[%s] %s: %@", EventSeverityClass(severity).c_str(), EventClass(event).c_str(),
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
#include <rapidjson/document.h>
|
||||
#include <stdio.h>
|
||||
|
||||
using namespace llmr;
|
||||
using namespace mbgl;
|
||||
|
||||
Settings_JSON::Settings_JSON() { load(); }
|
||||
|
||||
void Settings_JSON::load() {
|
||||
FILE *settingsFile = fopen("/tmp/llmr-native.json", "r");
|
||||
FILE *settingsFile = fopen("/tmp/mbgl-native.json", "r");
|
||||
if (settingsFile != NULL) {
|
||||
rapidjson::FileStream is(settingsFile);
|
||||
rapidjson::Document document;
|
||||
@@ -26,7 +26,7 @@ void Settings_JSON::load() {
|
||||
|
||||
void Settings_JSON::save() {
|
||||
|
||||
rapidjson::FileStream s(fopen("/tmp/llmr-native.json", "w"));
|
||||
rapidjson::FileStream s(fopen("/tmp/mbgl-native.json", "w"));
|
||||
rapidjson::PrettyWriter<rapidjson::FileStream> writer(s);
|
||||
writer.StartArray();
|
||||
writer.Double(longitude);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef LLMR_JSON_SETTINGS
|
||||
#define LLMR_JSON_SETTINGS
|
||||
#ifndef MBGL_JSON_SETTINGS
|
||||
#define MBGL_JSON_SETTINGS
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class Settings_JSON {
|
||||
public:
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef LLMR_COMMON_SETTINGS_NSUSERDEFAULTS
|
||||
#define LLMR_COMMON_SETTINGS_NSUSERDEFAULTS
|
||||
#ifndef MBGL_COMMON_SETTINGS_NSUSERDEFAULTS
|
||||
#define MBGL_COMMON_SETTINGS_NSUSERDEFAULTS
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class Settings_NSUserDefaults {
|
||||
public:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "settings_nsuserdefaults.hpp"
|
||||
|
||||
using namespace llmr;
|
||||
using namespace mbgl;
|
||||
|
||||
Settings_NSUserDefaults::Settings_NSUserDefaults()
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <iostream>
|
||||
#include <cstdarg>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
void StderrLogBackend::record(EventSeverity severity, Event event, const std::string &msg) {
|
||||
std::cerr << "[" << severity << "] " << event << ": " << msg << std::endl;
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef LLMR_COMMON_STDERR_LOG
|
||||
#define LLMR_COMMON_STDERR_LOG
|
||||
#ifndef MBGL_COMMON_STDERR_LOG
|
||||
#define MBGL_COMMON_STDERR_LOG
|
||||
|
||||
#include <llmr/platform/log.hpp>
|
||||
#include <mbgl/platform/log.hpp>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class StderrLogBackend : public LogBackend {
|
||||
public:
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
#include <llmr/util/constants.hpp>
|
||||
#include <mbgl/util/constants.hpp>
|
||||
|
||||
const float llmr::util::tileSize = 512.0f;
|
||||
const float mbgl::util::tileSize = 512.0f;
|
||||
|
||||
#if defined(DEBUG)
|
||||
const bool llmr::debug::tileParseWarnings = false;
|
||||
const bool llmr::debug::styleParseWarnings = false;
|
||||
const bool llmr::debug::spriteWarnings = false;
|
||||
const bool llmr::debug::renderWarnings = false;
|
||||
const bool llmr::debug::renderTree = false;
|
||||
const bool llmr::debug::labelTextMissingWarning = true;
|
||||
const bool llmr::debug::missingFontStackWarning = true;
|
||||
const bool llmr::debug::missingFontFaceWarning = true;
|
||||
const bool llmr::debug::glyphWarning = true;
|
||||
const bool llmr::debug::shapingWarning = true;
|
||||
const bool mbgl::debug::tileParseWarnings = false;
|
||||
const bool mbgl::debug::styleParseWarnings = false;
|
||||
const bool mbgl::debug::spriteWarnings = false;
|
||||
const bool mbgl::debug::renderWarnings = false;
|
||||
const bool mbgl::debug::renderTree = false;
|
||||
const bool mbgl::debug::labelTextMissingWarning = true;
|
||||
const bool mbgl::debug::missingFontStackWarning = true;
|
||||
const bool mbgl::debug::missingFontFaceWarning = true;
|
||||
const bool mbgl::debug::glyphWarning = true;
|
||||
const bool mbgl::debug::shapingWarning = true;
|
||||
#else
|
||||
const bool llmr::debug::tileParseWarnings = false;
|
||||
const bool llmr::debug::styleParseWarnings = false;
|
||||
const bool llmr::debug::spriteWarnings = false;
|
||||
const bool llmr::debug::renderWarnings = false;
|
||||
const bool llmr::debug::renderTree = false;
|
||||
const bool llmr::debug::labelTextMissingWarning = false;
|
||||
const bool llmr::debug::missingFontStackWarning = false;
|
||||
const bool llmr::debug::missingFontFaceWarning = false;
|
||||
const bool llmr::debug::glyphWarning = false;
|
||||
const bool llmr::debug::shapingWarning = false;
|
||||
const bool mbgl::debug::tileParseWarnings = false;
|
||||
const bool mbgl::debug::styleParseWarnings = false;
|
||||
const bool mbgl::debug::spriteWarnings = false;
|
||||
const bool mbgl::debug::renderWarnings = false;
|
||||
const bool mbgl::debug::renderTree = false;
|
||||
const bool mbgl::debug::labelTextMissingWarning = false;
|
||||
const bool mbgl::debug::missingFontStackWarning = false;
|
||||
const bool mbgl::debug::missingFontFaceWarning = false;
|
||||
const bool mbgl::debug::glyphWarning = false;
|
||||
const bool mbgl::debug::shapingWarning = false;
|
||||
#endif
|
||||
|
||||
4
configure
vendored
4
configure
vendored
@@ -50,7 +50,7 @@ def pkg_config(pkg, pkgconfig_root):
|
||||
|
||||
return (libs, cflags)
|
||||
|
||||
def configure_llmr(o):
|
||||
def configure_mbgl(o):
|
||||
if options.boost_root:
|
||||
o['variables']['boost_root'] = options.boost_root
|
||||
else:
|
||||
@@ -115,7 +115,7 @@ output = {
|
||||
}
|
||||
|
||||
if __name__ == '__main__':
|
||||
configure_llmr(output)
|
||||
configure_mbgl(output)
|
||||
configure_glfw3(output)
|
||||
configure_uv(output)
|
||||
configure_png(output)
|
||||
|
||||
@@ -1,13 +0,0 @@
|
||||
#ifndef LLMR_GEOMETRY_INTERPOLATE
|
||||
#define LLMR_GEOMETRY_INTERPOLATE
|
||||
|
||||
#include <llmr/geometry/anchor.hpp>
|
||||
#include <llmr/util/math.hpp>
|
||||
|
||||
namespace llmr {
|
||||
|
||||
Anchors interpolate(const std::vector<Coordinate> &vertices, float spacing,
|
||||
float minScale = 0.0f, int start = 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,34 +0,0 @@
|
||||
#ifndef LLMR_MAP_VIEW
|
||||
#define LLMR_MAP_VIEW
|
||||
|
||||
namespace llmr {
|
||||
|
||||
class Map;
|
||||
|
||||
class View {
|
||||
public:
|
||||
virtual void initialize(Map *map) {
|
||||
this->map = map;
|
||||
}
|
||||
|
||||
// Called from the render (=GL) thread. Signals that the context should
|
||||
// swap the front and the back buffer.
|
||||
virtual void swap() = 0;
|
||||
|
||||
// Called from the render thread. Makes the GL context active in the current
|
||||
// thread. This is typically just called once at the beginning of the
|
||||
// renderer setup since the render thread doesn't switch the contexts.
|
||||
virtual void make_active() = 0;
|
||||
|
||||
// Returns the base framebuffer object, if any, and 0 if using the system
|
||||
// provided framebuffer.
|
||||
virtual unsigned int root_fbo() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
llmr::Map *map = nullptr;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,117 +0,0 @@
|
||||
#ifndef LLMR_STYLE_FILTER_EXPRESSION
|
||||
#define LLMR_STYLE_FILTER_EXPRESSION
|
||||
|
||||
#include <llmr/style/value.hpp>
|
||||
#include <llmr/util/recursive_wrapper.hpp>
|
||||
|
||||
#include <forward_list>
|
||||
#include <string>
|
||||
#include <ostream>
|
||||
#include <iostream>
|
||||
|
||||
namespace llmr {
|
||||
|
||||
class VectorTileTagExtractor;
|
||||
|
||||
class FilterComparison {
|
||||
public:
|
||||
enum class Operator : uint8_t {
|
||||
Equal,
|
||||
NotEqual,
|
||||
Greater,
|
||||
GreaterEqual,
|
||||
Less,
|
||||
LessEqual,
|
||||
In,
|
||||
NotIn
|
||||
};
|
||||
|
||||
class Instance {
|
||||
public:
|
||||
Instance(Operator op, std::forward_list<Value> &&values)
|
||||
: op(op), values(values) {}
|
||||
|
||||
bool compare(const Value &property_value) const;
|
||||
bool compare(const std::forward_list<Value> &property_values) const;
|
||||
|
||||
private:
|
||||
template <typename Comparer> inline bool includes(const Value &property_value, const Comparer &comparer) const;
|
||||
template <typename Comparer> inline bool compare(const Value &property_value, const Comparer &comparer) const;
|
||||
template <typename Comparer> inline bool all(const std::forward_list<Value> &property_values, const Comparer &comparer) const;
|
||||
|
||||
private:
|
||||
Operator op = Operator::Equal;
|
||||
std::forward_list<Value> values;
|
||||
|
||||
friend std::ostream& operator <<(std::ostream &, const Instance &);
|
||||
};
|
||||
|
||||
public:
|
||||
FilterComparison(const std::string &field) : field(field) {};
|
||||
|
||||
const std::string &getField() const;
|
||||
inline bool compare(const VectorTileTagExtractor &extractor) const;
|
||||
|
||||
template <typename ...Args>
|
||||
inline void add(Args&& ...args) {
|
||||
instances.emplace_front(::std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
private:
|
||||
std::string field;
|
||||
std::forward_list<Instance> instances;
|
||||
|
||||
friend std::ostream& operator <<(std::ostream &, const FilterComparison &);
|
||||
};
|
||||
|
||||
std::ostream& operator <<(std::ostream &s, const FilterComparison &comparison);
|
||||
std::ostream& operator <<(std::ostream &s, const FilterComparison::Instance &instance);
|
||||
|
||||
|
||||
FilterComparison::Operator parseFilterComparisonOperator(const std::string &op);
|
||||
|
||||
|
||||
class FilterExpression {
|
||||
public:
|
||||
typedef util::recursive_wrapper<FilterExpression> Wrapper;
|
||||
|
||||
enum class Operator : uint8_t {
|
||||
And,
|
||||
Or,
|
||||
Xor,
|
||||
Nor
|
||||
};
|
||||
|
||||
enum class GeometryType : uint8_t {
|
||||
Any,
|
||||
Point,
|
||||
LineString,
|
||||
Polygon
|
||||
};
|
||||
|
||||
public:
|
||||
FilterExpression() = default;
|
||||
FilterExpression(Operator op) : op(op) {};
|
||||
|
||||
bool empty() const;
|
||||
|
||||
bool compare(const VectorTileTagExtractor &extractor) const;
|
||||
void add(const FilterComparison &comparison);
|
||||
void add(const FilterExpression &expression);
|
||||
void setGeometryType(GeometryType g);
|
||||
|
||||
private:
|
||||
Operator op = Operator::And;
|
||||
GeometryType type = GeometryType::Any;
|
||||
std::forward_list<FilterComparison> comparisons;
|
||||
std::forward_list<FilterExpression::Wrapper> expressions;
|
||||
|
||||
friend std::ostream& operator <<(std::ostream &, const FilterExpression &);
|
||||
};
|
||||
|
||||
std::ostream& operator <<(std::ostream &s, const FilterExpression &expression);
|
||||
|
||||
FilterExpression::GeometryType parseGeometryType(const std::string &geometry);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,21 +0,0 @@
|
||||
#ifndef LLMR_STYLE_PROPERTY_VALUE
|
||||
#define LLMR_STYLE_PROPERTY_VALUE
|
||||
|
||||
#include <llmr/util/variant.hpp>
|
||||
#include <llmr/style/function_properties.hpp>
|
||||
#include <llmr/style/types.hpp>
|
||||
|
||||
namespace llmr {
|
||||
|
||||
typedef util::variant<
|
||||
std::string,
|
||||
TranslateAnchorType,
|
||||
RotateAnchorType,
|
||||
Function<bool>,
|
||||
Function<float>,
|
||||
Function<Color>
|
||||
> PropertyValue;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,147 +0,0 @@
|
||||
#ifndef LLMR_STYLE_VALUE
|
||||
#define LLMR_STYLE_VALUE
|
||||
|
||||
#include <llmr/util/variant.hpp>
|
||||
#include <llmr/util/pbf.hpp>
|
||||
|
||||
namespace llmr {
|
||||
|
||||
typedef util::variant<bool, int64_t, uint64_t, double, std::string> Value;
|
||||
|
||||
std::string toString(const Value &value);
|
||||
|
||||
Value parseValue(pbf data);
|
||||
|
||||
namespace util {
|
||||
|
||||
namespace detail {
|
||||
|
||||
inline int string_to_bool(std::string str) {
|
||||
std::transform(str.begin(), str.end(), str.begin(), ::tolower);
|
||||
if (str == "0" || str == "0.0" || str == "false" || str == "null" || !str.length()) return 0;
|
||||
else if (str == "true") return 1;
|
||||
else return -1;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct string_to_number {};
|
||||
|
||||
template <> struct string_to_number<bool> {
|
||||
bool operator()(const std::string &str) const {
|
||||
// Converts 0 => false, 1 => true and -1 => true.
|
||||
return string_to_bool(str);
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct string_to_number<double> {
|
||||
double operator()(std::string const &str) const {
|
||||
int val = string_to_bool(str);
|
||||
return val < 0 ? std::stod(str) : val;
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct string_to_number<int64_t> {
|
||||
int64_t operator()(std::string const &str) const {
|
||||
int val = string_to_bool(str);
|
||||
return val < 0 ? std::stoll(str) : val;
|
||||
}
|
||||
};
|
||||
|
||||
template <> struct string_to_number<uint64_t> {
|
||||
uint64_t operator()(std::string const &str) const {
|
||||
int val = string_to_bool(str);
|
||||
return val < 0 ? std::stoull(str) : val;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename Operator>
|
||||
struct relaxed_operator_visitor {
|
||||
typedef bool result_type;
|
||||
|
||||
bool operator()(bool lhs, bool rhs) const { return Operator()(lhs, rhs); }
|
||||
|
||||
template <typename T, class = typename std::enable_if<std::is_arithmetic<T>::value>::type>
|
||||
bool operator()(bool lhs, T rhs) const { return Operator()(lhs, bool(rhs)); }
|
||||
|
||||
template <typename T, class = typename std::enable_if<std::is_arithmetic<T>::value>::type>
|
||||
bool operator()(T lhs, bool rhs) const { return Operator()(bool(lhs), rhs); }
|
||||
|
||||
bool operator()(int64_t lhs, uint64_t rhs) const { return lhs < 0 ? false : Operator()(uint64_t(lhs), rhs); }
|
||||
bool operator()(uint64_t lhs, int64_t rhs) const { return rhs < 0 ? false : Operator()(lhs, uint64_t(rhs)); }
|
||||
|
||||
template <typename T, class = typename std::enable_if<std::is_arithmetic<T>::value>::type>
|
||||
bool operator()(const std::string &lhs, T rhs) const try { return Operator()(string_to_number<T>()(lhs), rhs); }
|
||||
catch(...) { return false; }
|
||||
|
||||
template <typename T, class = typename std::enable_if<std::is_arithmetic<T>::value>::type>
|
||||
bool operator()(T lhs, const std::string &rhs) const try { return Operator()(lhs, string_to_number<T>()(rhs)); }
|
||||
catch(...) { return false; }
|
||||
|
||||
template <typename T0, typename T1>
|
||||
bool operator()(T0 lhs, T1 rhs) const { return Operator()(lhs, rhs); }
|
||||
};
|
||||
|
||||
struct relaxed_equal_operator {
|
||||
template <typename T0, typename T1>
|
||||
bool operator()(T0 lhs, T1 rhs) const { return lhs == rhs; }
|
||||
};
|
||||
|
||||
struct relaxed_greater_operator {
|
||||
template <typename T0, typename T1>
|
||||
bool operator()(T0 lhs, T1 rhs) const { return lhs > rhs; }
|
||||
};
|
||||
|
||||
struct relaxed_greater_equal_operator {
|
||||
template <typename T0, typename T1>
|
||||
bool operator()(T0 lhs, T1 rhs) const { return lhs >= rhs; }
|
||||
};
|
||||
|
||||
struct relaxed_less_operator {
|
||||
template <typename T0, typename T1>
|
||||
bool operator()(T0 lhs, T1 rhs) const { return lhs < rhs; }
|
||||
};
|
||||
|
||||
struct relaxed_less_equal_operator {
|
||||
template <typename T0, typename T1>
|
||||
bool operator()(T0 lhs, T1 rhs) const { return lhs <= rhs; }
|
||||
};
|
||||
|
||||
|
||||
} // end namespace detail
|
||||
|
||||
inline bool relaxed_equal(Value const &lhs, Value const &rhs) {
|
||||
return apply_visitor(detail::relaxed_operator_visitor<detail::relaxed_equal_operator>(), lhs, rhs);
|
||||
}
|
||||
|
||||
inline bool relaxed_greater(Value const &lhs, Value const &rhs) {
|
||||
return apply_visitor(detail::relaxed_operator_visitor<detail::relaxed_greater_operator>(), lhs, rhs);
|
||||
}
|
||||
|
||||
inline bool relaxed_greater_equal(Value const &lhs, Value const &rhs) {
|
||||
return apply_visitor(detail::relaxed_operator_visitor<detail::relaxed_greater_equal_operator>(), lhs, rhs);
|
||||
}
|
||||
|
||||
inline bool relaxed_less(Value const &lhs, Value const &rhs) {
|
||||
return apply_visitor(detail::relaxed_operator_visitor<detail::relaxed_less_operator>(), lhs, rhs);
|
||||
}
|
||||
|
||||
inline bool relaxed_less_equal(Value const &lhs, Value const &rhs) {
|
||||
return apply_visitor(detail::relaxed_operator_visitor<detail::relaxed_less_equal_operator>(), lhs, rhs);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
template <typename T>
|
||||
T toNumber(const Value &value) {
|
||||
if (value.is<std::string>()) return util::detail::string_to_number<T>()(value.get<std::string>());
|
||||
else if (value.is<bool>()) return value.get<bool>();
|
||||
else if (value.is<int64_t>()) return value.get<int64_t>();
|
||||
else if (value.is<uint64_t>()) return value.get<uint64_t>();
|
||||
else if (value.is<double>()) return value.get<double>();
|
||||
else return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef LLMR_GEOMETRY_ANCHOR
|
||||
#define LLMR_GEOMETRY_ANCHOR
|
||||
#ifndef MBGL_GEOMETRY_ANCHOR
|
||||
#define MBGL_GEOMETRY_ANCHOR
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
struct Anchor {
|
||||
float x = 0.0f;
|
||||
@@ -1,12 +1,12 @@
|
||||
#ifndef LLMR_GEOMETRY_BINPACK
|
||||
#define LLMR_GEOMETRY_BINPACK
|
||||
#ifndef MBGL_GEOMETRY_BINPACK
|
||||
#define MBGL_GEOMETRY_BINPACK
|
||||
|
||||
#include <llmr/util/noncopyable.hpp>
|
||||
#include <llmr/util/rect.hpp>
|
||||
#include <mbgl/util/noncopyable.hpp>
|
||||
#include <mbgl/util/rect.hpp>
|
||||
#include <cstdint>
|
||||
#include <list>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
template <typename T>
|
||||
class BinPack : private util::noncopyable {
|
||||
@@ -1,14 +1,14 @@
|
||||
#ifndef LLMR_GEOMETRY_BUFFER
|
||||
#define LLMR_GEOMETRY_BUFFER
|
||||
#ifndef MBGL_GEOMETRY_BUFFER
|
||||
#define MBGL_GEOMETRY_BUFFER
|
||||
|
||||
#include <llmr/platform/gl.hpp>
|
||||
#include <llmr/util/noncopyable.hpp>
|
||||
#include <mbgl/platform/gl.hpp>
|
||||
#include <mbgl/util/noncopyable.hpp>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cassert>
|
||||
#include <stdexcept>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
template <
|
||||
size_t item_size,
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef LLMR_GEOMETRY_DEBUG_FONT_BUFFER
|
||||
#define LLMR_GEOMETRY_DEBUG_FONT_BUFFER
|
||||
#ifndef MBGL_GEOMETRY_DEBUG_FONT_BUFFER
|
||||
#define MBGL_GEOMETRY_DEBUG_FONT_BUFFER
|
||||
|
||||
#include "buffer.hpp"
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class DebugFontBuffer : public Buffer<
|
||||
4 // 2 bytes per coordinate, 2 coordinates
|
||||
@@ -1,10 +1,10 @@
|
||||
#ifndef LLMR_GEOMETRY_TRIANGLE_ELEMENTS_BUFFER
|
||||
#define LLMR_GEOMETRY_TRIANGLE_ELEMENTS_BUFFER
|
||||
#ifndef MBGL_GEOMETRY_TRIANGLE_ELEMENTS_BUFFER
|
||||
#define MBGL_GEOMETRY_TRIANGLE_ELEMENTS_BUFFER
|
||||
|
||||
#include <llmr/geometry/buffer.hpp>
|
||||
#include <llmr/geometry/vao.hpp>
|
||||
#include <mbgl/geometry/buffer.hpp>
|
||||
#include <mbgl/geometry/vao.hpp>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
struct ElementGroup {
|
||||
VertexArrayObject array;
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef LLMR_GEOMETRY_FILL_BUFFER
|
||||
#define LLMR_GEOMETRY_FILL_BUFFER
|
||||
#ifndef MBGL_GEOMETRY_FILL_BUFFER
|
||||
#define MBGL_GEOMETRY_FILL_BUFFER
|
||||
|
||||
#include "buffer.hpp"
|
||||
#include <vector>
|
||||
#include <cstdint>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class FillVertexBuffer : public Buffer<
|
||||
4 // bytes per coordinates (2 * unsigned short == 4 bytes)
|
||||
@@ -1,12 +1,12 @@
|
||||
#ifndef LLMR_GEOMETRY_GEOMETRY
|
||||
#define LLMR_GEOMETRY_GEOMETRY
|
||||
#ifndef MBGL_GEOMETRY_GEOMETRY
|
||||
#define MBGL_GEOMETRY_GEOMETRY
|
||||
|
||||
#include <llmr/util/pbf.hpp>
|
||||
#include <llmr/util/noncopyable.hpp>
|
||||
#include <mbgl/util/pbf.hpp>
|
||||
#include <mbgl/util/noncopyable.hpp>
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class Geometry : private util::noncopyable {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#ifndef LLMR_GEOMETRY_GLYPH_ATLAS
|
||||
#define LLMR_GEOMETRY_GLYPH_ATLAS
|
||||
#ifndef MBGL_GEOMETRY_GLYPH_ATLAS
|
||||
#define MBGL_GEOMETRY_GLYPH_ATLAS
|
||||
|
||||
#include <llmr/geometry/binpack.hpp>
|
||||
#include <llmr/text/glyph_store.hpp>
|
||||
#include <mbgl/geometry/binpack.hpp>
|
||||
#include <mbgl/text/glyph_store.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <set>
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <mutex>
|
||||
#include <atomic>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class GlyphAtlas {
|
||||
public:
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef LLMR_GEOMETRY_ICON_BUFFER
|
||||
#define LLMR_GEOMETRY_ICON_BUFFER
|
||||
#ifndef MBGL_GEOMETRY_ICON_BUFFER
|
||||
#define MBGL_GEOMETRY_ICON_BUFFER
|
||||
|
||||
#include "buffer.hpp"
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class IconVertexBuffer : public Buffer<
|
||||
4 + // int16 x/y coordinates per vertex (== 4 bytes)
|
||||
13
include/mbgl/geometry/interpolate.hpp
Normal file
13
include/mbgl/geometry/interpolate.hpp
Normal file
@@ -0,0 +1,13 @@
|
||||
#ifndef MBGL_GEOMETRY_INTERPOLATE
|
||||
#define MBGL_GEOMETRY_INTERPOLATE
|
||||
|
||||
#include <mbgl/geometry/anchor.hpp>
|
||||
#include <mbgl/util/math.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
Anchors interpolate(const std::vector<Coordinate> &vertices, float spacing,
|
||||
float minScale = 0.0f, int start = 0);
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef LLMR_GEOMETRY_LINE_BUFFER
|
||||
#define LLMR_GEOMETRY_LINE_BUFFER
|
||||
#ifndef MBGL_GEOMETRY_LINE_BUFFER
|
||||
#define MBGL_GEOMETRY_LINE_BUFFER
|
||||
|
||||
#include "buffer.hpp"
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class LineVertexBuffer : public Buffer<
|
||||
8 // 2 coordinates per vertex + 1 linesofar + 1 extrude coord pair == 4 (== 8 bytes)
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef LLMR_GEOMETRY_SPRITE_ATLAS
|
||||
#define LLMR_GEOMETRY_SPRITE_ATLAS
|
||||
#ifndef MBGL_GEOMETRY_SPRITE_ATLAS
|
||||
#define MBGL_GEOMETRY_SPRITE_ATLAS
|
||||
|
||||
#include <llmr/geometry/binpack.hpp>
|
||||
#include <mbgl/geometry/binpack.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <atomic>
|
||||
#include <set>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class Sprite;
|
||||
class SpritePosition;
|
||||
@@ -1,10 +1,10 @@
|
||||
#ifndef LLMR_GEOMETRY_TEXT_BUFFER
|
||||
#define LLMR_GEOMETRY_TEXT_BUFFER
|
||||
#ifndef MBGL_GEOMETRY_TEXT_BUFFER
|
||||
#define MBGL_GEOMETRY_TEXT_BUFFER
|
||||
|
||||
#include "buffer.hpp"
|
||||
#include <array>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class TextVertexBuffer : public Buffer <
|
||||
16,
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef LLMR_GEOMETRY_VAO
|
||||
#define LLMR_GEOMETRY_VAO
|
||||
#ifndef MBGL_GEOMETRY_VAO
|
||||
#define MBGL_GEOMETRY_VAO
|
||||
|
||||
#include <llmr/platform/gl.hpp>
|
||||
#include <mbgl/platform/gl.hpp>
|
||||
|
||||
#include <stdexcept>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class VertexArrayObject {
|
||||
public:
|
||||
@@ -1,12 +1,12 @@
|
||||
#ifndef LLMR_GEOMETRY_VERTEX_BUFFER
|
||||
#define LLMR_GEOMETRY_VERTEX_BUFFER
|
||||
#ifndef MBGL_GEOMETRY_VERTEX_BUFFER
|
||||
#define MBGL_GEOMETRY_VERTEX_BUFFER
|
||||
|
||||
#include <vector>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cmath>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class VertexBuffer {
|
||||
public:
|
||||
@@ -1,23 +1,23 @@
|
||||
|
||||
#ifndef LLMR_MAP_MAP
|
||||
#define LLMR_MAP_MAP
|
||||
#ifndef MBGL_MAP_MAP
|
||||
#define MBGL_MAP_MAP
|
||||
|
||||
#include <uv.h>
|
||||
|
||||
#include <llmr/map/view.hpp>
|
||||
#include <llmr/map/transform.hpp>
|
||||
#include <llmr/style/style.hpp>
|
||||
#include <llmr/geometry/glyph_atlas.hpp>
|
||||
#include <llmr/text/glyph_store.hpp>
|
||||
#include <llmr/renderer/painter.hpp>
|
||||
#include <llmr/util/noncopyable.hpp>
|
||||
#include <llmr/util/texturepool.hpp>
|
||||
#include <mbgl/map/view.hpp>
|
||||
#include <mbgl/map/transform.hpp>
|
||||
#include <mbgl/style/style.hpp>
|
||||
#include <mbgl/geometry/glyph_atlas.hpp>
|
||||
#include <mbgl/text/glyph_store.hpp>
|
||||
#include <mbgl/renderer/painter.hpp>
|
||||
#include <mbgl/util/noncopyable.hpp>
|
||||
#include <mbgl/util/texturepool.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class Source;
|
||||
class SpriteAtlas;
|
||||
@@ -1,12 +1,12 @@
|
||||
#ifndef LLMR_MAP_RASTER_TILE_DATA
|
||||
#define LLMR_MAP_RASTER_TILE_DATA
|
||||
#ifndef MBGL_MAP_RASTER_TILE_DATA
|
||||
#define MBGL_MAP_RASTER_TILE_DATA
|
||||
|
||||
#include <llmr/map/tile_data.hpp>
|
||||
#include <mbgl/map/tile_data.hpp>
|
||||
|
||||
#include <llmr/renderer/raster_bucket.hpp>
|
||||
#include <mbgl/renderer/raster_bucket.hpp>
|
||||
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class RasterTileData : public TileData {
|
||||
friend class TileParser;
|
||||
@@ -1,12 +1,12 @@
|
||||
#ifndef LLMR_MAP_SOURCE
|
||||
#define LLMR_MAP_SOURCE
|
||||
#ifndef MBGL_MAP_SOURCE
|
||||
#define MBGL_MAP_SOURCE
|
||||
|
||||
#include <llmr/map/tile.hpp>
|
||||
#include <llmr/map/tile_data.hpp>
|
||||
#include <llmr/util/noncopyable.hpp>
|
||||
#include <llmr/util/time.hpp>
|
||||
#include <llmr/style/style_source.hpp>
|
||||
#include <llmr/style/types.hpp>
|
||||
#include <mbgl/map/tile.hpp>
|
||||
#include <mbgl/map/tile_data.hpp>
|
||||
#include <mbgl/util/noncopyable.hpp>
|
||||
#include <mbgl/util/time.hpp>
|
||||
#include <mbgl/style/style_source.hpp>
|
||||
#include <mbgl/style/types.hpp>
|
||||
|
||||
#include <list>
|
||||
#include <forward_list>
|
||||
@@ -16,7 +16,7 @@
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class TransformState;
|
||||
class Texturepool;
|
||||
@@ -1,8 +1,8 @@
|
||||
#ifndef LLMR_STYLE_SPRITE
|
||||
#define LLMR_STYLE_SPRITE
|
||||
#ifndef MBGL_STYLE_SPRITE
|
||||
#define MBGL_STYLE_SPRITE
|
||||
|
||||
#include <llmr/util/raster.hpp>
|
||||
#include <llmr/util/vec.hpp>
|
||||
#include <mbgl/util/raster.hpp>
|
||||
#include <mbgl/util/vec.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <mutex>
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <atomic>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class Map;
|
||||
|
||||
@@ -52,6 +52,7 @@ private:
|
||||
|
||||
private:
|
||||
Map ↦
|
||||
std::string url;
|
||||
std::string body;
|
||||
std::string image;
|
||||
std::atomic<bool> loaded;
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef LLMR_MAP_TILE
|
||||
#define LLMR_MAP_TILE
|
||||
#ifndef MBGL_MAP_TILE
|
||||
#define MBGL_MAP_TILE
|
||||
|
||||
#include <llmr/util/vec.hpp>
|
||||
#include <llmr/util/mat4.hpp>
|
||||
#include <llmr/util/noncopyable.hpp>
|
||||
#include <mbgl/util/vec.hpp>
|
||||
#include <mbgl/util/mat4.hpp>
|
||||
#include <mbgl/util/noncopyable.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <forward_list>
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <bitset>
|
||||
#include <memory>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class TileData;
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
#ifndef LLMR_MAP_TILE_DATA
|
||||
#define LLMR_MAP_TILE_DATA
|
||||
#ifndef MBGL_MAP_TILE_DATA
|
||||
#define MBGL_MAP_TILE_DATA
|
||||
|
||||
#include <llmr/map/tile.hpp>
|
||||
#include <llmr/util/noncopyable.hpp>
|
||||
#include <llmr/platform/platform.hpp>
|
||||
#include <llmr/geometry/vao.hpp>
|
||||
#include <llmr/renderer/debug_bucket.hpp>
|
||||
#include <mbgl/map/tile.hpp>
|
||||
#include <mbgl/util/noncopyable.hpp>
|
||||
#include <mbgl/platform/platform.hpp>
|
||||
#include <mbgl/geometry/vao.hpp>
|
||||
#include <mbgl/renderer/debug_bucket.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <atomic>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class Map;
|
||||
class Painter;
|
||||
@@ -1,14 +1,14 @@
|
||||
#ifndef LLMR_MAP_TILE_PARSER
|
||||
#define LLMR_MAP_TILE_PARSER
|
||||
#ifndef MBGL_MAP_TILE_PARSER
|
||||
#define MBGL_MAP_TILE_PARSER
|
||||
|
||||
#include <llmr/map/vector_tile.hpp>
|
||||
#include <llmr/text/placement.hpp>
|
||||
#include <llmr/text/glyph_store.hpp>
|
||||
#include <llmr/text/glyph.hpp>
|
||||
#include <llmr/util/utf.hpp>
|
||||
#include <llmr/style/filter_expression.hpp>
|
||||
#include <mbgl/map/vector_tile.hpp>
|
||||
#include <mbgl/text/placement.hpp>
|
||||
#include <mbgl/text/glyph_store.hpp>
|
||||
#include <mbgl/text/glyph.hpp>
|
||||
#include <mbgl/util/utf.hpp>
|
||||
#include <mbgl/style/filter_expression.hpp>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class Style;
|
||||
class GlyphAtlas;
|
||||
@@ -1,21 +1,22 @@
|
||||
#ifndef LLMR_MAP_TRANSFORM
|
||||
#define LLMR_MAP_TRANSFORM
|
||||
#ifndef MBGL_MAP_TRANSFORM
|
||||
#define MBGL_MAP_TRANSFORM
|
||||
|
||||
#include <llmr/util/transition.hpp>
|
||||
#include <llmr/util/noncopyable.hpp>
|
||||
#include <llmr/util/uv.hpp>
|
||||
#include <mbgl/util/transition.hpp>
|
||||
#include <mbgl/util/noncopyable.hpp>
|
||||
#include <mbgl/util/uv.hpp>
|
||||
|
||||
#include "view.hpp"
|
||||
#include "transform_state.hpp"
|
||||
|
||||
#include <forward_list>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
struct box;
|
||||
|
||||
class Transform : private util::noncopyable {
|
||||
public:
|
||||
Transform();
|
||||
Transform(View &view);
|
||||
|
||||
// Map view
|
||||
// Note: width * ratio does not necessarily equal fb_width
|
||||
@@ -74,6 +75,8 @@ private:
|
||||
void constrain(double& scale, double& y) const;
|
||||
|
||||
private:
|
||||
View &view;
|
||||
|
||||
mutable uv::rwlock mtx;
|
||||
|
||||
// This reflects the current state of the transform, representing the actual position of the
|
||||
@@ -1,12 +1,12 @@
|
||||
#ifndef LLMR_MAP_TRANSFORM_STATE
|
||||
#define LLMR_MAP_TRANSFORM_STATE
|
||||
#ifndef MBGL_MAP_TRANSFORM_STATE
|
||||
#define MBGL_MAP_TRANSFORM_STATE
|
||||
|
||||
#include <llmr/util/mat4.hpp>
|
||||
#include <llmr/map/tile.hpp>
|
||||
#include <mbgl/util/mat4.hpp>
|
||||
#include <mbgl/map/tile.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class Transform;
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
#ifndef LLMR_MAP_VECTOR_TILE
|
||||
#define LLMR_MAP_VECTOR_TILE
|
||||
#ifndef MBGL_MAP_VECTOR_TILE
|
||||
#define MBGL_MAP_VECTOR_TILE
|
||||
|
||||
#include <llmr/util/pbf.hpp>
|
||||
#include <llmr/util/vec.hpp>
|
||||
#include <llmr/style/value.hpp>
|
||||
#include <llmr/text/glyph.hpp>
|
||||
#include <llmr/style/filter_expression.hpp>
|
||||
#include <mbgl/util/pbf.hpp>
|
||||
#include <mbgl/util/vec.hpp>
|
||||
#include <mbgl/style/value.hpp>
|
||||
#include <mbgl/text/glyph.hpp>
|
||||
#include <mbgl/style/filter_expression.hpp>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <set>
|
||||
#include <limits>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class BucketDescription;
|
||||
class VectorTileLayer;
|
||||
@@ -46,7 +46,7 @@ public:
|
||||
VectorTileTagExtractor(const VectorTileLayer &layer);
|
||||
|
||||
void setTags(const pbf &pbf);
|
||||
std::forward_list<Value> getValues(const std::string &key) const;
|
||||
std::vector<Value> getValues(const std::string &key) const;
|
||||
void setType(FilterExpression::GeometryType type);
|
||||
FilterExpression::GeometryType getType() const;
|
||||
|
||||
@@ -1,22 +1,22 @@
|
||||
#ifndef LLMR_MAP_VECTOR_TILE_DATA
|
||||
#define LLMR_MAP_VECTOR_TILE_DATA
|
||||
#ifndef MBGL_MAP_VECTOR_TILE_DATA
|
||||
#define MBGL_MAP_VECTOR_TILE_DATA
|
||||
|
||||
#include <llmr/map/tile_data.hpp>
|
||||
#include <mbgl/map/tile_data.hpp>
|
||||
|
||||
|
||||
#include <llmr/renderer/bucket.hpp>
|
||||
#include <mbgl/renderer/bucket.hpp>
|
||||
|
||||
#include <llmr/geometry/vertex_buffer.hpp>
|
||||
#include <llmr/geometry/elements_buffer.hpp>
|
||||
#include <llmr/geometry/fill_buffer.hpp>
|
||||
#include <llmr/geometry/line_buffer.hpp>
|
||||
#include <llmr/geometry/icon_buffer.hpp>
|
||||
#include <llmr/geometry/text_buffer.hpp>
|
||||
#include <llmr/map/tile_parser.hpp>
|
||||
#include <mbgl/geometry/vertex_buffer.hpp>
|
||||
#include <mbgl/geometry/elements_buffer.hpp>
|
||||
#include <mbgl/geometry/fill_buffer.hpp>
|
||||
#include <mbgl/geometry/line_buffer.hpp>
|
||||
#include <mbgl/geometry/icon_buffer.hpp>
|
||||
#include <mbgl/geometry/text_buffer.hpp>
|
||||
#include <mbgl/map/tile_parser.hpp>
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
|
||||
class VectorTileData : public TileData {
|
||||
54
include/mbgl/map/view.hpp
Normal file
54
include/mbgl/map/view.hpp
Normal file
@@ -0,0 +1,54 @@
|
||||
#ifndef MBGL_MAP_VIEW
|
||||
#define MBGL_MAP_VIEW
|
||||
|
||||
#include <mbgl/util/time.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
class Map;
|
||||
|
||||
enum MapChange : uint8_t {
|
||||
MapChangeRegionWillChange = 0,
|
||||
MapChangeRegionWillChangeAnimated = 1,
|
||||
MapChangeRegionDidChange = 2,
|
||||
MapChangeRegionDidChangeAnimated = 3,
|
||||
MapChangeWillStartLoadingMap = 4,
|
||||
MapChangeDidFinishLoadingMap = 5,
|
||||
MapChangeDidFailLoadingMap = 6,
|
||||
MapChangeWillStartRenderingMap = 7,
|
||||
MapChangeDidFinishRenderingMap = 8,
|
||||
MapChangeDidFinishRenderingMapFullyRendered = 9
|
||||
};
|
||||
|
||||
class View {
|
||||
public:
|
||||
virtual void initialize(Map *map) {
|
||||
this->map = map;
|
||||
}
|
||||
|
||||
// Called from the render (=GL) thread. Signals that the context should
|
||||
// swap the front and the back buffer.
|
||||
virtual void swap() = 0;
|
||||
|
||||
// Called from the render thread. Makes the GL context active in the current
|
||||
// thread. This is typically just called once at the beginning of the
|
||||
// renderer setup since the render thread doesn't switch the contexts.
|
||||
virtual void make_active() = 0;
|
||||
|
||||
// Returns the base framebuffer object, if any, and 0 if using the system
|
||||
// provided framebuffer.
|
||||
virtual unsigned int root_fbo() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Notifies a watcher of map x/y/scale/rotation changes.
|
||||
// Must only be called from the same thread that caused the change.
|
||||
// Must not be called from the render thread.
|
||||
virtual void notify_map_change(MapChange change, timestamp delay = 0) = 0;
|
||||
|
||||
protected:
|
||||
mbgl::Map *map = nullptr;
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef LLMR_MAIN
|
||||
#define LLMR_MAIN
|
||||
#ifndef MBGL_MAIN
|
||||
#define MBGL_MAIN
|
||||
|
||||
#include "map/map.hpp"
|
||||
#include "map/view.hpp"
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef LLMR_PLATFORM_EVENT
|
||||
#define LLMR_PLATFORM_EVENT
|
||||
#ifndef MBGL_PLATFORM_EVENT
|
||||
#define MBGL_PLATFORM_EVENT
|
||||
|
||||
#include <llmr/util/enum.hpp>
|
||||
#include <mbgl/util/enum.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
enum class EventSeverity : uint8_t {
|
||||
Debug,
|
||||
@@ -15,7 +15,7 @@ enum class EventSeverity : uint8_t {
|
||||
Error,
|
||||
};
|
||||
|
||||
LLMR_DEFINE_ENUM_CLASS(EventSeverityClass, EventSeverity, {
|
||||
MBGL_DEFINE_ENUM_CLASS(EventSeverityClass, EventSeverity, {
|
||||
{ EventSeverity::Debug, "DEBUG" },
|
||||
{ EventSeverity::Info, "INFO" },
|
||||
{ EventSeverity::Test, "TEST" },
|
||||
@@ -32,9 +32,10 @@ enum class Event : uint8_t {
|
||||
ParseTile,
|
||||
Render,
|
||||
HttpRequest,
|
||||
Sprite,
|
||||
};
|
||||
|
||||
LLMR_DEFINE_ENUM_CLASS(EventClass, Event, {
|
||||
MBGL_DEFINE_ENUM_CLASS(EventClass, Event, {
|
||||
{ Event::General, "General" },
|
||||
{ Event::Setup, "Setup" },
|
||||
{ Event::Shader, "Shader" },
|
||||
@@ -42,6 +43,7 @@ LLMR_DEFINE_ENUM_CLASS(EventClass, Event, {
|
||||
{ Event::ParseTile, "ParseTile" },
|
||||
{ Event::Render, "Render" },
|
||||
{ Event::HttpRequest, "HttpRequest" },
|
||||
{ Event::Sprite, "Sprite" },
|
||||
{ Event(-1), "Unknown" },
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef LLMR_RENDERER_GL
|
||||
#define LLMR_RENDERER_GL
|
||||
#ifndef MBGL_RENDERER_GL
|
||||
#define MBGL_RENDERER_GL
|
||||
|
||||
#include <string>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#include <GL/glext.h>
|
||||
#endif
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
namespace gl {
|
||||
// Debug group markers, useful for debuggin on iOS
|
||||
#if defined(__APPLE__) && defined(DEBUG) && defined(GL_EXT_debug_marker)
|
||||
@@ -1,12 +1,12 @@
|
||||
#ifndef LLMR_PLATFORM_LOG
|
||||
#define LLMR_PLATFORM_LOG
|
||||
#ifndef MBGL_PLATFORM_LOG
|
||||
#define MBGL_PLATFORM_LOG
|
||||
|
||||
#include "event.hpp"
|
||||
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class LogBackend {
|
||||
public:
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef LLMR_PLATFORM_PLATFORM
|
||||
#define LLMR_PLATFORM_PLATFORM
|
||||
#ifndef MBGL_PLATFORM_PLATFORM
|
||||
#define MBGL_PLATFORM_PLATFORM
|
||||
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
@@ -11,7 +11,7 @@ namespace uv {
|
||||
class loop;
|
||||
}
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
namespace platform {
|
||||
|
||||
class Request;
|
||||
@@ -24,19 +24,6 @@ struct Response {
|
||||
std::function<void(Response *)> callback;
|
||||
};
|
||||
|
||||
enum MapChange : uint8_t {
|
||||
MapChangeRegionWillChange = 0,
|
||||
MapChangeRegionWillChangeAnimated = 1,
|
||||
MapChangeRegionDidChange = 2,
|
||||
MapChangeRegionDidChangeAnimated = 3,
|
||||
MapChangeWillStartLoadingMap = 4,
|
||||
MapChangeDidFinishLoadingMap = 5,
|
||||
MapChangeDidFailLoadingMap = 6,
|
||||
MapChangeWillStartRenderingMap = 7,
|
||||
MapChangeDidFinishRenderingMap = 8,
|
||||
MapChangeDidFinishRenderingMapFullyRendered = 9
|
||||
};
|
||||
|
||||
// Makes an HTTP request of a URL, preferrably on a background thread, and calls a function with the
|
||||
// results in the original thread (which runs the libuv loop).
|
||||
// If the loop pointer is NULL, the callback function will be called on an arbitrary thread.
|
||||
@@ -48,9 +35,6 @@ std::shared_ptr<Request> request_http(const std::string &url,
|
||||
// Cancels an HTTP request.
|
||||
void cancel_request_http(const std::shared_ptr<Request> &req);
|
||||
|
||||
// Notifies a watcher of map changes.
|
||||
void notify_map_change(MapChange key);
|
||||
|
||||
// Shows an alpha image with the specified dimensions in a named window.
|
||||
void show_debug_image(std::string name, const char *data, size_t width, size_t height);
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
#ifndef LLMR_PLATFORM_REQUEST
|
||||
#define LLMR_PLATFORM_REQUEST
|
||||
#ifndef MBGL_PLATFORM_REQUEST
|
||||
#define MBGL_PLATFORM_REQUEST
|
||||
|
||||
#include <string>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <atomic>
|
||||
|
||||
#include <llmr/util/noncopyable.hpp>
|
||||
#include <mbgl/util/noncopyable.hpp>
|
||||
|
||||
// Forward definition.
|
||||
typedef struct uv_loop_s uv_loop_t;
|
||||
@@ -16,7 +16,7 @@ namespace uv {
|
||||
class loop;
|
||||
}
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
namespace platform {
|
||||
|
||||
struct Response;
|
||||
@@ -1,13 +1,13 @@
|
||||
#ifndef LLMR_RENDERER_BUCKET
|
||||
#define LLMR_RENDERER_BUCKET
|
||||
#ifndef MBGL_RENDERER_BUCKET
|
||||
#define MBGL_RENDERER_BUCKET
|
||||
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <llmr/map/tile.hpp>
|
||||
#include <llmr/util/noncopyable.hpp>
|
||||
#include <llmr/renderer/prerendered_texture.hpp>
|
||||
#include <mbgl/map/tile.hpp>
|
||||
#include <mbgl/util/noncopyable.hpp>
|
||||
#include <mbgl/renderer/prerendered_texture.hpp>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class Painter;
|
||||
class StyleLayer;
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef LLMR_RENDERER_DEBUGBUCKET
|
||||
#define LLMR_RENDERER_DEBUGBUCKET
|
||||
#ifndef MBGL_RENDERER_DEBUGBUCKET
|
||||
#define MBGL_RENDERER_DEBUGBUCKET
|
||||
|
||||
#include <llmr/renderer/bucket.hpp>
|
||||
#include <llmr/geometry/debug_font_buffer.hpp>
|
||||
#include <llmr/geometry/vao.hpp>
|
||||
#include <mbgl/renderer/bucket.hpp>
|
||||
#include <mbgl/geometry/debug_font_buffer.hpp>
|
||||
#include <mbgl/geometry/vao.hpp>
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
@@ -12,7 +12,7 @@
|
||||
#define BUFFER_OFFSET(i) ((char *)nullptr + (i))
|
||||
#endif
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class PlainShader;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#ifndef LLMR_RENDERER_FILLBUCKET
|
||||
#define LLMR_RENDERER_FILLBUCKET
|
||||
#ifndef MBGL_RENDERER_FILLBUCKET
|
||||
#define MBGL_RENDERER_FILLBUCKET
|
||||
|
||||
#include <llmr/renderer/bucket.hpp>
|
||||
#include <llmr/geometry/elements_buffer.hpp>
|
||||
#include <llmr/geometry/fill_buffer.hpp>
|
||||
#include <llmr/style/style_bucket.hpp>
|
||||
#include <mbgl/renderer/bucket.hpp>
|
||||
#include <mbgl/geometry/elements_buffer.hpp>
|
||||
#include <mbgl/geometry/fill_buffer.hpp>
|
||||
#include <mbgl/style/style_bucket.hpp>
|
||||
|
||||
#include <clipper/clipper.hpp>
|
||||
#include <libtess2/tesselator.h>
|
||||
@@ -16,7 +16,7 @@
|
||||
#define BUFFER_OFFSET(i) ((char *)nullptr + (i))
|
||||
#endif
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class Style;
|
||||
class FillVertexBuffer;
|
||||
@@ -1,14 +1,14 @@
|
||||
#ifndef LLMR_RENDERER_FRAME_HISTORY
|
||||
#define LLMR_RENDERER_FRAME_HISTORY
|
||||
#ifndef MBGL_RENDERER_FRAME_HISTORY
|
||||
#define MBGL_RENDERER_FRAME_HISTORY
|
||||
|
||||
#include <deque>
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
#include <llmr/platform/platform.hpp>
|
||||
#include <llmr/util/time.hpp>
|
||||
#include <mbgl/platform/platform.hpp>
|
||||
#include <mbgl/util/time.hpp>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
struct FrameSnapshot {
|
||||
explicit inline FrameSnapshot(timestamp t, float z) : t(t), z(z) {}
|
||||
@@ -1,10 +1,10 @@
|
||||
#ifndef LLMR_RENDERER_ICONBUCKET
|
||||
#define LLMR_RENDERER_ICONBUCKET
|
||||
#ifndef MBGL_RENDERER_ICONBUCKET
|
||||
#define MBGL_RENDERER_ICONBUCKET
|
||||
|
||||
#include <llmr/renderer/bucket.hpp>
|
||||
#include <llmr/geometry/elements_buffer.hpp>
|
||||
#include <llmr/geometry/icon_buffer.hpp>
|
||||
#include <llmr/style/style_bucket.hpp>
|
||||
#include <mbgl/renderer/bucket.hpp>
|
||||
#include <mbgl/geometry/elements_buffer.hpp>
|
||||
#include <mbgl/geometry/icon_buffer.hpp>
|
||||
#include <mbgl/style/style_bucket.hpp>
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
@@ -13,7 +13,7 @@
|
||||
#define BUFFER_OFFSET(i) ((char *)nullptr + (i))
|
||||
#endif
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class Style;
|
||||
class IconVertexBuffer;
|
||||
@@ -1,16 +1,16 @@
|
||||
#ifndef LLMR_RENDERER_LINEBUCKET
|
||||
#define LLMR_RENDERER_LINEBUCKET
|
||||
#ifndef MBGL_RENDERER_LINEBUCKET
|
||||
#define MBGL_RENDERER_LINEBUCKET
|
||||
|
||||
#include "bucket.hpp"
|
||||
#include <llmr/geometry/vao.hpp>
|
||||
#include <llmr/geometry/elements_buffer.hpp>
|
||||
#include <llmr/geometry/line_buffer.hpp>
|
||||
#include <llmr/style/style_bucket.hpp>
|
||||
#include <mbgl/geometry/vao.hpp>
|
||||
#include <mbgl/geometry/elements_buffer.hpp>
|
||||
#include <mbgl/geometry/line_buffer.hpp>
|
||||
#include <mbgl/style/style_bucket.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class Style;
|
||||
class LineVertexBuffer;
|
||||
@@ -1,33 +1,33 @@
|
||||
#ifndef LLMR_RENDERER_PAINTER
|
||||
#define LLMR_RENDERER_PAINTER
|
||||
#ifndef MBGL_RENDERER_PAINTER
|
||||
#define MBGL_RENDERER_PAINTER
|
||||
|
||||
#include <llmr/map/tile_data.hpp>
|
||||
#include <llmr/geometry/vao.hpp>
|
||||
#include <llmr/geometry/vertex_buffer.hpp>
|
||||
#include <llmr/util/mat4.hpp>
|
||||
#include <llmr/util/noncopyable.hpp>
|
||||
#include <llmr/renderer/frame_history.hpp>
|
||||
#include <llmr/style/types.hpp>
|
||||
#include <mbgl/map/tile_data.hpp>
|
||||
#include <mbgl/geometry/vao.hpp>
|
||||
#include <mbgl/geometry/vertex_buffer.hpp>
|
||||
#include <mbgl/util/mat4.hpp>
|
||||
#include <mbgl/util/noncopyable.hpp>
|
||||
#include <mbgl/renderer/frame_history.hpp>
|
||||
#include <mbgl/style/types.hpp>
|
||||
|
||||
#include <llmr/shader/plain_shader.hpp>
|
||||
#include <llmr/shader/outline_shader.hpp>
|
||||
#include <llmr/shader/pattern_shader.hpp>
|
||||
#include <llmr/shader/line_shader.hpp>
|
||||
#include <llmr/shader/linejoin_shader.hpp>
|
||||
#include <llmr/shader/icon_shader.hpp>
|
||||
#include <llmr/shader/raster_shader.hpp>
|
||||
#include <llmr/shader/text_shader.hpp>
|
||||
#include <llmr/shader/dot_shader.hpp>
|
||||
#include <llmr/shader/composite_shader.hpp>
|
||||
#include <llmr/shader/gaussian_shader.hpp>
|
||||
#include <mbgl/shader/plain_shader.hpp>
|
||||
#include <mbgl/shader/outline_shader.hpp>
|
||||
#include <mbgl/shader/pattern_shader.hpp>
|
||||
#include <mbgl/shader/line_shader.hpp>
|
||||
#include <mbgl/shader/linejoin_shader.hpp>
|
||||
#include <mbgl/shader/icon_shader.hpp>
|
||||
#include <mbgl/shader/raster_shader.hpp>
|
||||
#include <mbgl/shader/text_shader.hpp>
|
||||
#include <mbgl/shader/dot_shader.hpp>
|
||||
#include <mbgl/shader/composite_shader.hpp>
|
||||
#include <mbgl/shader/gaussian_shader.hpp>
|
||||
|
||||
#include <llmr/map/transform_state.hpp>
|
||||
#include <mbgl/map/transform_state.hpp>
|
||||
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <set>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class Transform;
|
||||
class Style;
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef LLMR_RENDERER_PRERENDERED_TEXTURE
|
||||
#define LLMR_RENDERER_PRERENDERED_TEXTURE
|
||||
#ifndef MBGL_RENDERER_PRERENDERED_TEXTURE
|
||||
#define MBGL_RENDERER_PRERENDERED_TEXTURE
|
||||
|
||||
#include <llmr/util/noncopyable.hpp>
|
||||
#include <llmr/platform/gl.hpp>
|
||||
#include <llmr/style/rasterize_properties.hpp>
|
||||
#include <mbgl/util/noncopyable.hpp>
|
||||
#include <mbgl/platform/gl.hpp>
|
||||
#include <mbgl/style/rasterize_properties.hpp>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class Painter;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#ifndef LLMR_RENDERER_RASTERBUCKET
|
||||
#define LLMR_RENDERER_RASTERBUCKET
|
||||
#ifndef MBGL_RENDERER_RASTERBUCKET
|
||||
#define MBGL_RENDERER_RASTERBUCKET
|
||||
|
||||
#include <llmr/renderer/bucket.hpp>
|
||||
#include <llmr/util/raster.hpp>
|
||||
#include <mbgl/renderer/bucket.hpp>
|
||||
#include <mbgl/util/raster.hpp>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class RasterShader;
|
||||
class VertexBuffer;
|
||||
@@ -1,19 +1,19 @@
|
||||
#ifndef LLMR_RENDERER_TEXTBUCKET
|
||||
#define LLMR_RENDERER_TEXTBUCKET
|
||||
#ifndef MBGL_RENDERER_TEXTBUCKET
|
||||
#define MBGL_RENDERER_TEXTBUCKET
|
||||
|
||||
#include "bucket.hpp"
|
||||
#include <llmr/geometry/vao.hpp>
|
||||
#include <llmr/geometry/elements_buffer.hpp>
|
||||
#include <llmr/map/vector_tile.hpp>
|
||||
#include <llmr/text/types.hpp>
|
||||
#include <llmr/text/glyph.hpp>
|
||||
#include <llmr/style/style_bucket.hpp>
|
||||
#include <mbgl/geometry/vao.hpp>
|
||||
#include <mbgl/geometry/elements_buffer.hpp>
|
||||
#include <mbgl/map/vector_tile.hpp>
|
||||
#include <mbgl/text/types.hpp>
|
||||
#include <mbgl/text/glyph.hpp>
|
||||
#include <mbgl/style/style_bucket.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class Style;
|
||||
class TextVertexBuffer;
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef LLMR_SHADER_COMPOSITE_SHADER
|
||||
#define LLMR_SHADER_COMPOSITE_SHADER
|
||||
#ifndef MBGL_SHADER_COMPOSITE_SHADER
|
||||
#define MBGL_SHADER_COMPOSITE_SHADER
|
||||
|
||||
#include <llmr/shader/shader.hpp>
|
||||
#include <mbgl/shader/shader.hpp>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class CompositeShader : public Shader {
|
||||
public:
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef LLMR_SHADER_SHADER_DOT
|
||||
#define LLMR_SHADER_SHADER_DOT
|
||||
#ifndef MBGL_SHADER_SHADER_DOT
|
||||
#define MBGL_SHADER_SHADER_DOT
|
||||
|
||||
#include <llmr/shader/shader.hpp>
|
||||
#include <mbgl/shader/shader.hpp>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class DotShader : public Shader {
|
||||
public:
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef LLMR_RENDERER_SHADER_GAUSSIAN
|
||||
#define LLMR_RENDERER_SHADER_GAUSSIAN
|
||||
#ifndef MBGL_RENDERER_SHADER_GAUSSIAN
|
||||
#define MBGL_RENDERER_SHADER_GAUSSIAN
|
||||
|
||||
#include <llmr/shader/shader.hpp>
|
||||
#include <mbgl/shader/shader.hpp>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class GaussianShader : public Shader {
|
||||
public:
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef LLMR_SHADER_SHADER_ICON
|
||||
#define LLMR_SHADER_SHADER_ICON
|
||||
#ifndef MBGL_SHADER_SHADER_ICON
|
||||
#define MBGL_SHADER_SHADER_ICON
|
||||
|
||||
#include <llmr/shader/shader.hpp>
|
||||
#include <mbgl/shader/shader.hpp>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class IconShader : public Shader {
|
||||
public:
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef LLMR_SHADER_SHADER_LINE
|
||||
#define LLMR_SHADER_SHADER_LINE
|
||||
#ifndef MBGL_SHADER_SHADER_LINE
|
||||
#define MBGL_SHADER_SHADER_LINE
|
||||
|
||||
#include <llmr/shader/shader.hpp>
|
||||
#include <mbgl/shader/shader.hpp>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class LineShader : public Shader {
|
||||
public:
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef LLMR_SHADER_SHADER_LINEJOIN
|
||||
#define LLMR_SHADER_SHADER_LINEJOIN
|
||||
#ifndef MBGL_SHADER_SHADER_LINEJOIN
|
||||
#define MBGL_SHADER_SHADER_LINEJOIN
|
||||
|
||||
#include <llmr/shader/shader.hpp>
|
||||
#include <mbgl/shader/shader.hpp>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class LinejoinShader : public Shader {
|
||||
public:
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef LLMR_SHADER_SHADER_OUTLINE
|
||||
#define LLMR_SHADER_SHADER_OUTLINE
|
||||
#ifndef MBGL_SHADER_SHADER_OUTLINE
|
||||
#define MBGL_SHADER_SHADER_OUTLINE
|
||||
|
||||
#include <llmr/shader/shader.hpp>
|
||||
#include <mbgl/shader/shader.hpp>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class OutlineShader : public Shader {
|
||||
public:
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef LLMR_SHADER_SHADER_PATTERN
|
||||
#define LLMR_SHADER_SHADER_PATTERN
|
||||
#ifndef MBGL_SHADER_SHADER_PATTERN
|
||||
#define MBGL_SHADER_SHADER_PATTERN
|
||||
|
||||
#include <llmr/shader/shader.hpp>
|
||||
#include <mbgl/shader/shader.hpp>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class PatternShader : public Shader {
|
||||
public:
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef LLMR_SHADER_SHADER_PLAIN
|
||||
#define LLMR_SHADER_SHADER_PLAIN
|
||||
#ifndef MBGL_SHADER_SHADER_PLAIN
|
||||
#define MBGL_SHADER_SHADER_PLAIN
|
||||
|
||||
#include <llmr/shader/shader.hpp>
|
||||
#include <mbgl/shader/shader.hpp>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class PlainShader : public Shader {
|
||||
public:
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef LLMR_RENDERER_SHADER_RASTER
|
||||
#define LLMR_RENDERER_SHADER_RASTER
|
||||
#ifndef MBGL_RENDERER_SHADER_RASTER
|
||||
#define MBGL_RENDERER_SHADER_RASTER
|
||||
|
||||
#include <llmr/shader/shader.hpp>
|
||||
#include <mbgl/shader/shader.hpp>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class RasterShader : public Shader {
|
||||
public:
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef LLMR_RENDERER_SHADER
|
||||
#define LLMR_RENDERER_SHADER
|
||||
#ifndef MBGL_RENDERER_SHADER
|
||||
#define MBGL_RENDERER_SHADER
|
||||
|
||||
#include <cstdint>
|
||||
#include <array>
|
||||
#include <llmr/util/noncopyable.hpp>
|
||||
#include <mbgl/util/noncopyable.hpp>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class Shader : private util::noncopyable {
|
||||
public:
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef LLMR_SHADER_TEXT_SHADER
|
||||
#define LLMR_SHADER_TEXT_SHADER
|
||||
#ifndef MBGL_SHADER_TEXT_SHADER
|
||||
#define MBGL_SHADER_TEXT_SHADER
|
||||
|
||||
#include "shader.hpp"
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class TextShader : public Shader {
|
||||
public:
|
||||
@@ -1,13 +1,13 @@
|
||||
#ifndef LLMR_STYLE_APPLIED_CLASS_PROPERTIES
|
||||
#define LLMR_STYLE_APPLIED_CLASS_PROPERTIES
|
||||
#ifndef MBGL_STYLE_APPLIED_CLASS_PROPERTIES
|
||||
#define MBGL_STYLE_APPLIED_CLASS_PROPERTIES
|
||||
|
||||
#include <llmr/style/property_value.hpp>
|
||||
#include <llmr/style/class_dictionary.hpp>
|
||||
#include <llmr/util/time.hpp>
|
||||
#include <mbgl/style/property_value.hpp>
|
||||
#include <mbgl/style/class_dictionary.hpp>
|
||||
#include <mbgl/util/time.hpp>
|
||||
|
||||
#include <list>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class AppliedClassProperty {
|
||||
public:
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef LLMR_STYLE_CLASS_DICTIONARY
|
||||
#define LLMR_STYLE_CLASS_DICTIONARY
|
||||
#ifndef MBGL_STYLE_CLASS_DICTIONARY
|
||||
#define MBGL_STYLE_CLASS_DICTIONARY
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
enum class ClassID : uint32_t {
|
||||
Fallback = 0, // These values are from the fallback properties
|
||||
@@ -1,13 +1,13 @@
|
||||
#ifndef LLMR_STYLE_CLASS_PROPERTIES
|
||||
#define LLMR_STYLE_CLASS_PROPERTIES
|
||||
#ifndef MBGL_STYLE_CLASS_PROPERTIES
|
||||
#define MBGL_STYLE_CLASS_PROPERTIES
|
||||
|
||||
#include <llmr/style/property_key.hpp>
|
||||
#include <llmr/style/property_value.hpp>
|
||||
#include <llmr/style/property_transition.hpp>
|
||||
#include <mbgl/style/property_key.hpp>
|
||||
#include <mbgl/style/property_value.hpp>
|
||||
#include <mbgl/style/property_transition.hpp>
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class ClassProperties {
|
||||
public:
|
||||
65
include/mbgl/style/filter_comparison.hpp
Normal file
65
include/mbgl/style/filter_comparison.hpp
Normal file
@@ -0,0 +1,65 @@
|
||||
#ifndef MBGL_STYLE_FILTER_COMPARISON
|
||||
#define MBGL_STYLE_FILTER_COMPARISON
|
||||
|
||||
#include <mbgl/style/value.hpp>
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <iosfwd>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
class FilterComparison {
|
||||
public:
|
||||
enum class Operator : uint8_t {
|
||||
Equal,
|
||||
NotEqual,
|
||||
Greater,
|
||||
GreaterEqual,
|
||||
Less,
|
||||
LessEqual,
|
||||
In,
|
||||
NotIn
|
||||
};
|
||||
|
||||
class Instance {
|
||||
public:
|
||||
Instance(Operator op, std::vector<Value> &&values)
|
||||
: op(op), values(values) {}
|
||||
|
||||
bool compare(const std::vector<Value> &property_values) const;
|
||||
|
||||
private:
|
||||
Operator op = Operator::Equal;
|
||||
std::vector<Value> values;
|
||||
|
||||
friend std::ostream& operator <<(std::ostream &, const Instance &);
|
||||
};
|
||||
|
||||
public:
|
||||
FilterComparison(const std::string &field) : field(field) {};
|
||||
|
||||
const std::string &getField() const;
|
||||
template <typename Extractor> inline bool compare(const Extractor &extractor) const;
|
||||
|
||||
template <typename ...Args>
|
||||
inline void add(Args&& ...args) {
|
||||
instances.emplace_back(::std::forward<Args>(args)...);
|
||||
}
|
||||
|
||||
private:
|
||||
std::string field;
|
||||
std::vector<Instance> instances;
|
||||
|
||||
friend std::ostream& operator <<(std::ostream &, const FilterComparison &);
|
||||
};
|
||||
|
||||
std::ostream& operator <<(std::ostream &s, const FilterComparison &comparison);
|
||||
std::ostream& operator <<(std::ostream &s, const FilterComparison::Instance &instance);
|
||||
|
||||
|
||||
FilterComparison::Operator parseFilterComparisonOperator(const std::string &op);
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
23
include/mbgl/style/filter_comparison_private.hpp
Normal file
23
include/mbgl/style/filter_comparison_private.hpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef MBGL_STYLE_FILTER_COMPARISON_PRIVATE
|
||||
#define MBGL_STYLE_FILTER_COMPARISON_PRIVATE
|
||||
|
||||
#include "filter_comparison.hpp"
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
template <typename Extractor>
|
||||
inline bool FilterComparison::compare(const Extractor &extractor) const {
|
||||
const std::vector<Value> values = extractor.getValues(field);
|
||||
|
||||
// All instances are ANDed together.
|
||||
for (const Instance &instance : instances) {
|
||||
if (!instance.compare(values)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
54
include/mbgl/style/filter_expression.hpp
Normal file
54
include/mbgl/style/filter_expression.hpp
Normal file
@@ -0,0 +1,54 @@
|
||||
#ifndef MBGL_STYLE_FILTER_EXPRESSION
|
||||
#define MBGL_STYLE_FILTER_EXPRESSION
|
||||
|
||||
#include <mbgl/style/filter_comparison.hpp>
|
||||
#include <mbgl/util/recursive_wrapper.hpp>
|
||||
|
||||
#include <iosfwd>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
class FilterExpression {
|
||||
public:
|
||||
typedef util::recursive_wrapper<FilterExpression> Wrapper;
|
||||
|
||||
enum class Operator : uint8_t {
|
||||
And,
|
||||
Or,
|
||||
Xor,
|
||||
Nor
|
||||
};
|
||||
|
||||
enum class GeometryType : uint8_t {
|
||||
Any,
|
||||
Point,
|
||||
LineString,
|
||||
Polygon
|
||||
};
|
||||
|
||||
public:
|
||||
FilterExpression() = default;
|
||||
FilterExpression(Operator op) : op(op) {};
|
||||
|
||||
bool empty() const;
|
||||
|
||||
template <typename Extractor> bool compare(const Extractor &extractor) const;
|
||||
void add(const FilterComparison &comparison);
|
||||
void add(const FilterExpression &expression);
|
||||
void setGeometryType(GeometryType g);
|
||||
|
||||
private:
|
||||
Operator op = Operator::And;
|
||||
GeometryType type = GeometryType::Any;
|
||||
std::vector<FilterComparison> comparisons;
|
||||
std::vector<FilterExpression::Wrapper> expressions;
|
||||
|
||||
friend std::ostream& operator <<(std::ostream &, const FilterExpression &);
|
||||
};
|
||||
|
||||
std::ostream& operator <<(std::ostream &s, const FilterExpression &expression);
|
||||
|
||||
FilterExpression::GeometryType parseGeometryType(const std::string &geometry);
|
||||
}
|
||||
|
||||
#endif
|
||||
75
include/mbgl/style/filter_expression_private.hpp
Normal file
75
include/mbgl/style/filter_expression_private.hpp
Normal file
@@ -0,0 +1,75 @@
|
||||
#ifndef MBGL_STYLE_FILTER_EXPRESSION_PRIVATE
|
||||
#define MBGL_STYLE_FILTER_EXPRESSION_PRIVATE
|
||||
|
||||
#include "filter_expression.hpp"
|
||||
#include "filter_comparison_private.hpp"
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
template <typename Extractor>
|
||||
bool FilterExpression::compare(const Extractor &extractor) const {
|
||||
if (type != GeometryType::Any && extractor.getType() != type && extractor.getType() != GeometryType::Any) {
|
||||
return false;
|
||||
}
|
||||
|
||||
switch (op) {
|
||||
case Operator::And:
|
||||
for (const FilterComparison &comparison : comparisons) {
|
||||
if (!comparison.compare(extractor)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (const FilterExpression &expression: expressions) {
|
||||
if (!expression.compare(extractor)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
case Operator::Or:
|
||||
for (const FilterComparison &comparison : comparisons) {
|
||||
if (comparison.compare(extractor)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
for (const FilterExpression &expression: expressions) {
|
||||
if (expression.compare(extractor)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
case Operator::Xor: {
|
||||
int count = 0;
|
||||
for (const FilterComparison &comparison : comparisons) {
|
||||
count += comparison.compare(extractor);
|
||||
if (count > 1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (const FilterExpression &expression: expressions) {
|
||||
count += expression.compare(extractor);
|
||||
if (count > 1) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return count == 1;
|
||||
}
|
||||
case Operator::Nor:
|
||||
for (const FilterComparison &comparison : comparisons) {
|
||||
if (comparison.compare(extractor)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (const FilterExpression &expression: expressions) {
|
||||
if (expression.compare(extractor)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef LLMR_STYLE_FUNCTION_PROPERTIES
|
||||
#define LLMR_STYLE_FUNCTION_PROPERTIES
|
||||
#ifndef MBGL_STYLE_FUNCTION_PROPERTIES
|
||||
#define MBGL_STYLE_FUNCTION_PROPERTIES
|
||||
|
||||
#include <llmr/util/variant.hpp>
|
||||
#include <mbgl/util/variant.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
template <typename T>
|
||||
struct ConstantFunction {
|
||||
@@ -1,12 +1,12 @@
|
||||
#ifndef LLMR_STYLE_PROPERTY_FALLBACK
|
||||
#define LLMR_STYLE_PROPERTY_FALLBACK
|
||||
#ifndef MBGL_STYLE_PROPERTY_FALLBACK
|
||||
#define MBGL_STYLE_PROPERTY_FALLBACK
|
||||
|
||||
#include <llmr/style/property_key.hpp>
|
||||
#include <llmr/style/property_value.hpp>
|
||||
#include <mbgl/style/property_key.hpp>
|
||||
#include <mbgl/style/property_value.hpp>
|
||||
|
||||
#include <map>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class PropertyFallbackValue {
|
||||
public:
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef LLMR_STYLE_PROPERTY_KEY
|
||||
#define LLMR_STYLE_PROPERTY_KEY
|
||||
#ifndef MBGL_STYLE_PROPERTY_KEY
|
||||
#define MBGL_STYLE_PROPERTY_KEY
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
enum class PropertyKey {
|
||||
FillAntialias,
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef LLMR_STYLE_PROPERTY_TRANSITION
|
||||
#define LLMR_STYLE_PROPERTY_TRANSITION
|
||||
#ifndef MBGL_STYLE_PROPERTY_TRANSITION
|
||||
#define MBGL_STYLE_PROPERTY_TRANSITION
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
struct PropertyTransition {
|
||||
uint16_t duration = 0;
|
||||
21
include/mbgl/style/property_value.hpp
Normal file
21
include/mbgl/style/property_value.hpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#ifndef MBGL_STYLE_PROPERTY_VALUE
|
||||
#define MBGL_STYLE_PROPERTY_VALUE
|
||||
|
||||
#include <mbgl/util/variant.hpp>
|
||||
#include <mbgl/style/function_properties.hpp>
|
||||
#include <mbgl/style/types.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
typedef util::variant<
|
||||
std::string,
|
||||
TranslateAnchorType,
|
||||
RotateAnchorType,
|
||||
Function<bool>,
|
||||
Function<float>,
|
||||
Function<Color>
|
||||
> PropertyValue;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,9 +1,9 @@
|
||||
#ifndef LLMR_STYLE_RASTERIZE_PROPERTIES
|
||||
#define LLMR_STYLE_RASTERIZE_PROPERTIES
|
||||
#ifndef MBGL_STYLE_RASTERIZE_PROPERTIES
|
||||
#define MBGL_STYLE_RASTERIZE_PROPERTIES
|
||||
|
||||
#include <llmr/style/function_properties.hpp>
|
||||
#include <mbgl/style/function_properties.hpp>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
// The calculated properties for a layer in a tile.
|
||||
class RasterizedProperties {
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef LLMR_STYLE_STYLE
|
||||
#define LLMR_STYLE_STYLE
|
||||
#ifndef MBGL_STYLE_STYLE
|
||||
#define MBGL_STYLE_STYLE
|
||||
|
||||
#include <llmr/style/property_transition.hpp>
|
||||
#include <llmr/style/style_source.hpp>
|
||||
#include <mbgl/style/property_transition.hpp>
|
||||
#include <mbgl/style/style_source.hpp>
|
||||
|
||||
#include <llmr/util/time.hpp>
|
||||
#include <llmr/util/uv.hpp>
|
||||
#include <mbgl/util/time.hpp>
|
||||
#include <mbgl/util/uv.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <map>
|
||||
@@ -15,7 +15,7 @@
|
||||
#include <set>
|
||||
#include <memory>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class Sprite;
|
||||
class StyleLayer;
|
||||
@@ -1,16 +1,16 @@
|
||||
#ifndef LLMR_STYLE_STYLE_BUCKET
|
||||
#define LLMR_STYLE_STYLE_BUCKET
|
||||
#ifndef MBGL_STYLE_STYLE_BUCKET
|
||||
#define MBGL_STYLE_STYLE_BUCKET
|
||||
|
||||
#include <llmr/style/types.hpp>
|
||||
#include <llmr/style/filter_expression.hpp>
|
||||
#include <llmr/style/style_source.hpp>
|
||||
#include <llmr/util/vec.hpp>
|
||||
#include <llmr/util/variant.hpp>
|
||||
#include <mbgl/style/types.hpp>
|
||||
#include <mbgl/style/filter_expression.hpp>
|
||||
#include <mbgl/style/style_source.hpp>
|
||||
#include <mbgl/util/vec.hpp>
|
||||
#include <mbgl/util/variant.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <forward_list>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class Source;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef LLMR_STYLE_STYLE_LAYER
|
||||
#define LLMR_STYLE_STYLE_LAYER
|
||||
#ifndef MBGL_STYLE_STYLE_LAYER
|
||||
#define MBGL_STYLE_STYLE_LAYER
|
||||
|
||||
#include <llmr/style/class_dictionary.hpp>
|
||||
#include <llmr/style/class_properties.hpp>
|
||||
#include <llmr/style/style_properties.hpp>
|
||||
#include <llmr/style/rasterize_properties.hpp>
|
||||
#include <llmr/style/applied_class_properties.hpp>
|
||||
#include <mbgl/style/class_dictionary.hpp>
|
||||
#include <mbgl/style/class_properties.hpp>
|
||||
#include <mbgl/style/style_properties.hpp>
|
||||
#include <mbgl/style/rasterize_properties.hpp>
|
||||
#include <mbgl/style/applied_class_properties.hpp>
|
||||
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class StyleBucket;
|
||||
class StyleLayerGroup;
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef LLMR_STYLE_STYLE_LAYER_GROUP
|
||||
#define LLMR_STYLE_STYLE_LAYER_GROUP
|
||||
#ifndef MBGL_STYLE_STYLE_LAYER_GROUP
|
||||
#define MBGL_STYLE_STYLE_LAYER_GROUP
|
||||
|
||||
#include <llmr/style/style_layer.hpp>
|
||||
#include <mbgl/style/style_layer.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class StyleLayerGroup {
|
||||
public:
|
||||
@@ -1,19 +1,19 @@
|
||||
#ifndef LLMR_STYLE_STYLE_PARSER
|
||||
#define LLMR_STYLE_STYLE_PARSER
|
||||
#ifndef MBGL_STYLE_STYLE_PARSER
|
||||
#define MBGL_STYLE_STYLE_PARSER
|
||||
|
||||
#include <rapidjson/document.h>
|
||||
#include <llmr/style/style.hpp>
|
||||
#include <llmr/style/style_source.hpp>
|
||||
#include <llmr/style/filter_expression.hpp>
|
||||
#include <llmr/style/class_properties.hpp>
|
||||
#include <llmr/style/rasterize_properties.hpp>
|
||||
#include <llmr/style/style_bucket.hpp>
|
||||
#include <mbgl/style/style.hpp>
|
||||
#include <mbgl/style/style_source.hpp>
|
||||
#include <mbgl/style/filter_expression.hpp>
|
||||
#include <mbgl/style/class_properties.hpp>
|
||||
#include <mbgl/style/rasterize_properties.hpp>
|
||||
#include <mbgl/style/style_bucket.hpp>
|
||||
|
||||
#include <unordered_map>
|
||||
#include <forward_list>
|
||||
#include <tuple>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
enum class ClassID : uint32_t;
|
||||
|
||||
@@ -91,7 +91,7 @@ private:
|
||||
FilterExpression parseFilter(JSVal, FilterExpression::Operator op);
|
||||
FilterExpression parseFilter(JSVal);
|
||||
Value parseValue(JSVal value);
|
||||
std::forward_list<Value> parseValues(JSVal values);
|
||||
std::vector<Value> parseValues(JSVal values);
|
||||
|
||||
private:
|
||||
std::unordered_map<std::string, const rapidjson::Value *> constants;
|
||||
@@ -1,16 +1,16 @@
|
||||
#ifndef LLMR_STYLE_STYLE_PROPERTIES
|
||||
#define LLMR_STYLE_STYLE_PROPERTIES
|
||||
#ifndef MBGL_STYLE_STYLE_PROPERTIES
|
||||
#define MBGL_STYLE_STYLE_PROPERTIES
|
||||
|
||||
#include <llmr/util/variant.hpp>
|
||||
#include <llmr/style/types.hpp>
|
||||
#include <llmr/style/function_properties.hpp>
|
||||
#include <mbgl/util/variant.hpp>
|
||||
#include <mbgl/style/types.hpp>
|
||||
#include <mbgl/style/function_properties.hpp>
|
||||
|
||||
#include <array>
|
||||
#include <string>
|
||||
#include <type_traits>
|
||||
#include <memory>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
struct FillProperties {
|
||||
FillProperties() {}
|
||||
@@ -1,11 +1,11 @@
|
||||
#ifndef LLMR_STYLE_STYLE_SOURCE
|
||||
#define LLMR_STYLE_STYLE_SOURCE
|
||||
#ifndef MBGL_STYLE_STYLE_SOURCE
|
||||
#define MBGL_STYLE_STYLE_SOURCE
|
||||
|
||||
#include <llmr/style/types.hpp>
|
||||
#include <mbgl/style/types.hpp>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace llmr {
|
||||
namespace mbgl {
|
||||
|
||||
class Source;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user