Merge branch 'expressions' into expressions-pois
This commit is contained in:
@@ -43,7 +43,9 @@ script:
|
||||
notifications:
|
||||
hipchat:
|
||||
rooms:
|
||||
secure: H/Z51pvNrTgdePfHpF66obRy2JF+yBCmp70MWjGnW8RZDyUQ+U5HgcVe/HBeCYFRg81hjSr3TxV70WrTUHP1NNPQ4+kcuW194bjZqq8TACwXOasFGNQ5L32izthfGto6rKtgNz6TzR5t44BpJnJhJMmqh46ybZvNTN2XBIaYkDQ=
|
||||
secure: "ZKtTiFjXgXfrAO8eMU1nJBe46OBLgk0H7VAVmk84QwAb6DuoqT+mGMs+1yrWtjLwZI8vayZyaucupp1siM7lBWCOADx5GXA6GCCLOuE7fYLSNJFrXHa1u70IUBLOU8b5bDWRn8tcd5CM754R609l4ckTzBH3y4CIh9YNFrB0b+g="
|
||||
template:
|
||||
- '%{repository}#%{build_number} (%{branch} - %{commit} : %{author}): %{message}'
|
||||
|
||||
git:
|
||||
submodules: false
|
||||
|
||||
2
Makefile
2
Makefile
@@ -53,7 +53,7 @@ linux: config.gypi linux/llmr-app.gyp node
|
||||
|
||||
# Executes the Linux binary
|
||||
run-linux: linux
|
||||
build/$(BUILDTYPE)/mapbox-gl
|
||||
(cd build/$(BUILDTYPE) && ./mapbox-gl)
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1306,6 +1306,10 @@ module.exports = {
|
||||
"name": "road_street_casing",
|
||||
"bucket": "street"
|
||||
},
|
||||
{
|
||||
"name": "road_motorway_casing",
|
||||
"bucket": "motorway"
|
||||
},
|
||||
{
|
||||
"name": "road_motorway_link",
|
||||
"bucket": "motorway_link"
|
||||
@@ -1322,10 +1326,6 @@ module.exports = {
|
||||
"name": "road_main",
|
||||
"bucket": "main"
|
||||
},
|
||||
{
|
||||
"name": "road_motorway_casing",
|
||||
"bucket": "motorway"
|
||||
},
|
||||
{
|
||||
"name": "road_motorway",
|
||||
"bucket": "motorway"
|
||||
|
||||
@@ -190,32 +190,27 @@ void curl_perform(uv_poll_t *req, int /*status*/, int events) {
|
||||
}
|
||||
|
||||
int handle_socket(CURL * /*easy*/, curl_socket_t s, int action, void * /*userp*/, void *socketp) {
|
||||
curl_context *context;
|
||||
if (action == CURL_POLL_IN || action == CURL_POLL_OUT) {
|
||||
if (socketp) {
|
||||
context = (curl_context *)socketp;
|
||||
} else {
|
||||
context = create_curl_context(s);
|
||||
}
|
||||
curl_multi_assign(curl_multi, s, (void *)context);
|
||||
curl_context *context = nullptr;
|
||||
|
||||
if (socketp) {
|
||||
context = (curl_context *)socketp;
|
||||
} else if (action != CURL_POLL_REMOVE) {
|
||||
context = create_curl_context(s);
|
||||
}
|
||||
|
||||
switch (action) {
|
||||
case CURL_POLL_IN:
|
||||
uv_poll_start(&context->poll_handle, UV_READABLE, curl_perform);
|
||||
break;
|
||||
case CURL_POLL_OUT:
|
||||
uv_poll_start(&context->poll_handle, UV_WRITABLE, curl_perform);
|
||||
break;
|
||||
case CURL_POLL_REMOVE:
|
||||
if (socketp) {
|
||||
uv_poll_stop(&((curl_context *)socketp)->poll_handle);
|
||||
destroy_curl_context((curl_context *)socketp);
|
||||
if (context) {
|
||||
curl_multi_assign(curl_multi, s, (void *)context);
|
||||
if (action == CURL_POLL_IN || action == CURL_POLL_INOUT) {
|
||||
uv_poll_start(&context->poll_handle, UV_READABLE, curl_perform);
|
||||
}
|
||||
if (action == CURL_POLL_OUT || action == CURL_POLL_INOUT) {
|
||||
uv_poll_start(&context->poll_handle, UV_WRITABLE, curl_perform);
|
||||
}
|
||||
if (action == CURL_POLL_REMOVE && socketp) {
|
||||
uv_poll_stop(&context->poll_handle);
|
||||
destroy_curl_context(context);
|
||||
curl_multi_assign(curl_multi, s, NULL);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
abort();
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -87,17 +87,17 @@ public:
|
||||
inline bool compare(const Value &other) const {
|
||||
switch (op) {
|
||||
case FilterOperator::Equal:
|
||||
return util::relaxed_equal(value, other);
|
||||
return util::relaxed_equal(other, value);
|
||||
case FilterOperator::NotEqual:
|
||||
return !util::relaxed_equal(value, other);
|
||||
return !util::relaxed_equal(other, value);
|
||||
case FilterOperator::Greater:
|
||||
return util::relaxed_greater(value, other);
|
||||
return util::relaxed_greater(other, value);
|
||||
case FilterOperator::GreaterEqual:
|
||||
return util::relaxed_greater_equal(value, other);
|
||||
return util::relaxed_greater_equal(other, value);
|
||||
case FilterOperator::Less:
|
||||
return util::relaxed_less(value, other);
|
||||
return util::relaxed_less(other, value);
|
||||
case FilterOperator::LessEqual:
|
||||
return util::relaxed_less_equal(value, other);
|
||||
return util::relaxed_less_equal(other, value);
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ public:
|
||||
|
||||
bool update();
|
||||
void updateMatrices(const TransformState &transform);
|
||||
bool viewportTileParsed();
|
||||
void drawClippingMasks();
|
||||
size_t getTileCount() const;
|
||||
void render(const LayerDescription& layer_desc, const BucketDescription &bucket_desc);
|
||||
|
||||
@@ -51,7 +51,22 @@
|
||||
],
|
||||
'dependencies': [
|
||||
'../llmr.gyp:llmr-x86',
|
||||
'default_stylesheet',
|
||||
],
|
||||
},
|
||||
{
|
||||
'target_name': 'default_stylesheet',
|
||||
'type': 'none',
|
||||
'hard_dependency': 1,
|
||||
'dependencies': [
|
||||
'../llmr.gyp:build_stylesheet'
|
||||
],
|
||||
'copies': [
|
||||
{
|
||||
'files': [ '<(SHARED_INTERMEDIATE_DIR)/bin/style.min.js' ],
|
||||
'destination': '<(PRODUCT_DIR)'
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
|
||||
#include <signal.h>
|
||||
#include <getopt.h>
|
||||
#include <fstream>
|
||||
#include <sstream>
|
||||
|
||||
#include "../common/settings_json.hpp"
|
||||
#include "../common/glfw_view.hpp"
|
||||
@@ -40,6 +42,15 @@ int main(int argc, char *argv[]) {
|
||||
sigIntHandler.sa_flags = 0;
|
||||
sigaction(SIGINT, &sigIntHandler, NULL);
|
||||
|
||||
// read default stylesheet from disk
|
||||
std::ifstream stylefile("./style.min.js");
|
||||
if (!stylefile.good()) {
|
||||
fprintf(stderr, "Cannot read style file\n");
|
||||
return 1;
|
||||
}
|
||||
std::stringstream stylejson;
|
||||
stylejson << stylefile.rdbuf();
|
||||
|
||||
view = new GLFWView();
|
||||
llmr::Map map(*view);
|
||||
|
||||
@@ -49,6 +60,9 @@ int main(int argc, char *argv[]) {
|
||||
map.setAngle(settings.angle);
|
||||
map.setDebug(settings.debug);
|
||||
|
||||
// Load style
|
||||
map.setStyleJSON(stylejson.str());
|
||||
|
||||
int ret = view->run();
|
||||
|
||||
// Save settings
|
||||
|
||||
@@ -57,6 +57,19 @@ size_t Source::getTileCount() const {
|
||||
return tiles.size();
|
||||
}
|
||||
|
||||
bool Source::viewportTileParsed() {
|
||||
bool parsed = false;
|
||||
|
||||
for (auto &pair : tiles) {
|
||||
Tile::ID id = pair.first;
|
||||
if (hasTile(id) == TileData::State::parsed) {
|
||||
parsed = true;
|
||||
}
|
||||
}
|
||||
|
||||
return parsed;
|
||||
}
|
||||
|
||||
void Source::drawClippingMasks() {
|
||||
for (std::pair<const Tile::ID, std::unique_ptr<Tile>> &pair : tiles) {
|
||||
Tile &tile = *pair.second;
|
||||
|
||||
@@ -9,22 +9,64 @@ using namespace llmr;
|
||||
void Painter::drawClippingMasks(const Sources &sources) {
|
||||
gl::group group("clipping masks");
|
||||
|
||||
useProgram(plainShader->program);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
depthMask(false);
|
||||
glDepthRange(1.0f, 1.0f);
|
||||
glStencilMask(0xFF);
|
||||
|
||||
const BackgroundProperties &properties = map.getStyle()->computed.background;
|
||||
Color background = properties.color;
|
||||
const float opacity = properties.opacity;
|
||||
background[0] *= opacity;
|
||||
background[1] *= opacity;
|
||||
background[2] *= opacity;
|
||||
background[3] *= opacity;
|
||||
plainShader->setColor(background);
|
||||
bool ready = false;
|
||||
|
||||
coveringPlainArray.bind(*plainShader, tileStencilBuffer, BUFFER_OFFSET(0));
|
||||
for (const auto &pair : sources) {
|
||||
Source &source = *pair.second;
|
||||
if (source.viewportTileParsed()) {
|
||||
ready = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (ready) {
|
||||
// At least one viewport tile is parsed. Draw the background.
|
||||
useProgram(plainShader->program);
|
||||
|
||||
const BackgroundProperties &properties = map.getStyle()->computed.background;
|
||||
Color background = properties.color;
|
||||
const float opacity = properties.opacity;
|
||||
background[0] *= opacity;
|
||||
background[1] *= opacity;
|
||||
background[2] *= opacity;
|
||||
background[3] *= opacity;
|
||||
plainShader->setColor(background);
|
||||
|
||||
coveringPlainArray.bind(*plainShader, tileStencilBuffer, BUFFER_OFFSET(0));
|
||||
} else {
|
||||
// No viewport tiles are parsed. Draw the grid pattern.
|
||||
const std::shared_ptr<Sprite> &sprite = map.getStyle()->sprite;
|
||||
if (sprite) {
|
||||
SpriteAtlas &spriteAtlas = *map.getSpriteAtlas();
|
||||
Rect<uint16_t> imagePos = spriteAtlas.getImage("matte-256", *sprite);
|
||||
|
||||
std::array<float, 2> imageSize = {{
|
||||
(float)(imagePos.w * 0.5),
|
||||
(float)(imagePos.h * 0.5)
|
||||
}
|
||||
};
|
||||
|
||||
useProgram(patternShader->program);
|
||||
patternShader->setPatternSize(imageSize);
|
||||
patternShader->setPatternTopLeft({{
|
||||
float(imagePos.x) / spriteAtlas.getWidth(),
|
||||
float(imagePos.y) / spriteAtlas.getHeight(),
|
||||
}});
|
||||
patternShader->setPatternBottomRight({{
|
||||
float(imagePos.x + imagePos.w) / spriteAtlas.getWidth(),
|
||||
float(imagePos.y + imagePos.h) / spriteAtlas.getHeight(),
|
||||
}});
|
||||
std::array<float, 4> color = {{ 1, 1, 1, 1 }};
|
||||
patternShader->setColor(color);
|
||||
spriteAtlas.bind(true);
|
||||
|
||||
coveringPatternArray.bind(*patternShader, tileStencilBuffer, BUFFER_OFFSET(0));
|
||||
}
|
||||
}
|
||||
|
||||
for (const auto &pair : sources) {
|
||||
Source &source = *pair.second;
|
||||
|
||||
Reference in New Issue
Block a user