[core] Rationalize naming for style-related code
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/style/types.hpp>
|
||||
|
||||
#include <mbgl/util/geometry.hpp>
|
||||
#include <mbgl/util/variant.hpp>
|
||||
#include <mbgl/util/color.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <vector>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include <mbgl/util/feature.hpp>
|
||||
#include <mbgl/util/noncopyable.hpp>
|
||||
#include <mbgl/annotation/annotation.hpp>
|
||||
#include <mbgl/style/property_transition.hpp>
|
||||
#include <mbgl/style/transition_options.hpp>
|
||||
|
||||
#include <cstdint>
|
||||
#include <string>
|
||||
@@ -22,10 +22,13 @@ namespace mbgl {
|
||||
class FileSource;
|
||||
class View;
|
||||
class SpriteImage;
|
||||
class Layer;
|
||||
struct CameraOptions;
|
||||
struct AnimationOptions;
|
||||
|
||||
namespace style {
|
||||
class Layer;
|
||||
}
|
||||
|
||||
class Map : private util::noncopyable {
|
||||
public:
|
||||
explicit Map(View&, FileSource&,
|
||||
@@ -47,9 +50,9 @@ public:
|
||||
void update(Update update);
|
||||
|
||||
// Styling
|
||||
void addClass(const std::string&, const PropertyTransition& = {});
|
||||
void removeClass(const std::string&, const PropertyTransition& = {});
|
||||
void setClasses(const std::vector<std::string>&, const PropertyTransition& = {});
|
||||
void addClass(const std::string&, const style::TransitionOptions& = {});
|
||||
void removeClass(const std::string&, const style::TransitionOptions& = {});
|
||||
void setClasses(const std::vector<std::string>&, const style::TransitionOptions& = {});
|
||||
|
||||
bool hasClass(const std::string&) const;
|
||||
std::vector<std::string> getClasses() const;
|
||||
@@ -146,7 +149,7 @@ public:
|
||||
|
||||
AnnotationIDs getPointAnnotationsInBounds(const LatLngBounds&);
|
||||
|
||||
void addLayer(std::unique_ptr<Layer>, const optional<std::string>& beforeLayerID = {});
|
||||
void addLayer(std::unique_ptr<style::Layer>, const optional<std::string>& beforeLayerID = {});
|
||||
void removeLayer(const std::string& layerID);
|
||||
|
||||
// Feature queries
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace mbgl {
|
||||
|
||||
class TileID;
|
||||
class SourceInfo;
|
||||
class Tileset;
|
||||
|
||||
/*
|
||||
* An offline region defined by a style URL, geographic bounding box, zoom range, and
|
||||
@@ -30,7 +30,7 @@ public:
|
||||
OfflineTilePyramidRegionDefinition(const std::string&, const LatLngBounds&, double, double, float);
|
||||
|
||||
/* Private */
|
||||
std::vector<CanonicalTileID> tileCover(SourceType, uint16_t tileSize, const SourceInfo&) const;
|
||||
std::vector<CanonicalTileID> tileCover(SourceType, uint16_t tileSize, const Tileset&) const;
|
||||
|
||||
const std::string styleURL;
|
||||
const LatLngBounds bounds;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <mbgl/storage/response.hpp>
|
||||
#include <mbgl/util/optional.hpp>
|
||||
#include <mbgl/style/types.hpp>
|
||||
#include <mbgl/util/font_stack.hpp>
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <vector>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
typedef variant<
|
||||
class NullFilter,
|
||||
@@ -100,4 +101,5 @@ public:
|
||||
std::string key;
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
|
||||
27
include/mbgl/style/function.hpp
Normal file
27
include/mbgl/style/function.hpp
Normal file
@@ -0,0 +1,27 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
template <typename T>
|
||||
class Function {
|
||||
public:
|
||||
using Stop = std::pair<float, T>;
|
||||
using Stops = std::vector<Stop>;
|
||||
|
||||
explicit Function(const Stops& stops_, float base_)
|
||||
: base(base_), stops(stops_) {}
|
||||
|
||||
float getBase() const { return base; }
|
||||
const std::vector<std::pair<float, T>>& getStops() const { return stops; }
|
||||
|
||||
private:
|
||||
float base = 1;
|
||||
std::vector<std::pair<float, T>> stops;
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -1,5 +1,4 @@
|
||||
#ifndef MBGL_LAYER
|
||||
#define MBGL_LAYER
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/util/noncopyable.hpp>
|
||||
#include <mbgl/style/types.hpp>
|
||||
@@ -7,6 +6,7 @@
|
||||
#include <memory>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
/**
|
||||
* The runtime representation of a [layer](https://www.mapbox.com/mapbox-gl-style-spec/#layers) from the Mapbox Style
|
||||
@@ -79,6 +79,5 @@ protected:
|
||||
Layer(Type, std::unique_ptr<Impl>);
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
|
||||
#endif
|
||||
|
||||
@@ -6,7 +6,10 @@
|
||||
#include <mbgl/style/filter.hpp>
|
||||
#include <mbgl/style/property_value.hpp>
|
||||
|
||||
#include <mbgl/util/color.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
class BackgroundLayer : public Layer {
|
||||
public:
|
||||
@@ -38,4 +41,5 @@ inline bool Layer::is<BackgroundLayer>() const {
|
||||
return type == Type::Background;
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -6,7 +6,10 @@
|
||||
#include <mbgl/style/filter.hpp>
|
||||
#include <mbgl/style/property_value.hpp>
|
||||
|
||||
#include <mbgl/util/color.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
class CircleLayer : public Layer {
|
||||
public:
|
||||
@@ -56,4 +59,5 @@ inline bool Layer::is<CircleLayer>() const {
|
||||
return type == Type::Circle;
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <mbgl/style/layer.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
/**
|
||||
* Initialize any GL state needed by the custom layer. This method is called once, from the
|
||||
@@ -66,4 +67,5 @@ inline bool Layer::is<CustomLayer>() const {
|
||||
return type == Type::Custom;
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -6,7 +6,10 @@
|
||||
#include <mbgl/style/filter.hpp>
|
||||
#include <mbgl/style/property_value.hpp>
|
||||
|
||||
#include <mbgl/util/color.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
class FillLayer : public Layer {
|
||||
public:
|
||||
@@ -59,4 +62,5 @@ inline bool Layer::is<FillLayer>() const {
|
||||
return type == Type::Fill;
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -6,9 +6,12 @@
|
||||
#include <mbgl/style/filter.hpp>
|
||||
#include <mbgl/style/property_value.hpp>
|
||||
|
||||
#include <mbgl/util/color.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
class LineLayer : public Layer {
|
||||
public:
|
||||
@@ -84,4 +87,5 @@ inline bool Layer::is<LineLayer>() const {
|
||||
return type == Type::Line;
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -6,7 +6,10 @@
|
||||
#include <mbgl/style/filter.hpp>
|
||||
#include <mbgl/style/property_value.hpp>
|
||||
|
||||
#include <mbgl/util/color.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
class RasterLayer : public Layer {
|
||||
public:
|
||||
@@ -55,4 +58,5 @@ inline bool Layer::is<RasterLayer>() const {
|
||||
return type == Type::Raster;
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -6,9 +6,12 @@
|
||||
#include <mbgl/style/filter.hpp>
|
||||
#include <mbgl/style/property_value.hpp>
|
||||
|
||||
#include <mbgl/util/color.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
class SymbolLayer : public Layer {
|
||||
public:
|
||||
@@ -177,4 +180,5 @@ inline bool Layer::is<SymbolLayer>() const {
|
||||
return type == Type::Symbol;
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -1,9 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/util/variant.hpp>
|
||||
#include <mbgl/style/types.hpp>
|
||||
#include <mbgl/style/function.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
class Undefined {};
|
||||
|
||||
@@ -33,4 +34,5 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -4,14 +4,16 @@
|
||||
#include <mbgl/util/optional.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
class PropertyTransition {
|
||||
class TransitionOptions {
|
||||
public:
|
||||
PropertyTransition(const optional<Duration>& duration_ = {}, const optional<Duration>& delay_ = {})
|
||||
TransitionOptions(const optional<Duration>& duration_ = {}, const optional<Duration>& delay_ = {})
|
||||
: duration(duration_), delay(delay_) {}
|
||||
|
||||
optional<Duration> duration;
|
||||
optional<Duration> delay;
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -2,44 +2,9 @@
|
||||
|
||||
#include <mbgl/util/enum.hpp>
|
||||
|
||||
#include <string>
|
||||
#include <array>
|
||||
#include <vector>
|
||||
#include <utility>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
// Stores a premultiplied color, with all four channels ranging from 0..1
|
||||
using Color = std::array<float, 4>;
|
||||
|
||||
// An array of font names
|
||||
using FontStack = std::vector<std::string>;
|
||||
|
||||
std::string fontStackToString(const FontStack&);
|
||||
|
||||
struct FontStackHash {
|
||||
std::size_t operator()(const FontStack&) const;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class Function {
|
||||
public:
|
||||
using Stop = std::pair<float, T>;
|
||||
using Stops = std::vector<Stop>;
|
||||
|
||||
explicit Function(const Stops& stops_, float base_)
|
||||
: base(base_), stops(stops_) {}
|
||||
|
||||
float getBase() const { return base; }
|
||||
const std::vector<std::pair<float, T>>& getStops() const { return stops; }
|
||||
|
||||
private:
|
||||
float base = 1;
|
||||
std::vector<std::pair<float, T>> stops;
|
||||
};
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
|
||||
// TODO: should be in public source.hpp header and style namespace
|
||||
enum class SourceType : uint8_t {
|
||||
Vector,
|
||||
Raster,
|
||||
@@ -56,7 +21,7 @@ MBGL_DEFINE_ENUM_CLASS(SourceTypeClass, SourceType, {
|
||||
{ SourceType::Annotations, "annotations" },
|
||||
});
|
||||
|
||||
// -------------------------------------------------------------------------------------------------
|
||||
namespace style {
|
||||
|
||||
enum class VisibilityType : bool {
|
||||
Visible,
|
||||
@@ -122,5 +87,5 @@ enum class TextTransformType : uint8_t {
|
||||
Lowercase,
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
|
||||
|
||||
10
include/mbgl/util/color.hpp
Normal file
10
include/mbgl/util/color.hpp
Normal file
@@ -0,0 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
// Stores a premultiplied color, with all four channels ranging from 0..1
|
||||
using Color = std::array<float, 4>;
|
||||
|
||||
} // namespace mbgl
|
||||
17
include/mbgl/util/font_stack.hpp
Normal file
17
include/mbgl/util/font_stack.hpp
Normal file
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
// An array of font names
|
||||
using FontStack = std::vector<std::string>;
|
||||
|
||||
std::string fontStackToString(const FontStack&);
|
||||
|
||||
struct FontStackHash {
|
||||
std::size_t operator()(const FontStack&) const;
|
||||
};
|
||||
|
||||
} // namespace mbgl
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <jni.h>
|
||||
#include <GLES2/gl2.h>
|
||||
|
||||
#include <mbgl/layer/custom_layer.hpp>
|
||||
#include <mbgl/style/layers/custom_layer.hpp>
|
||||
|
||||
static const GLchar * vertexShaderSource = "attribute vec2 a_pos; void main() { gl_Position = vec4(a_pos, 0, 1); }";
|
||||
static const GLchar * fragmentShaderSource = "void main() { gl_FragColor = vec4(0, 1, 0, 1); }";
|
||||
@@ -64,7 +64,7 @@ void nativeInitialize(void *context) {
|
||||
reinterpret_cast<ExampleCustomLayer*>(context)->initialize();
|
||||
}
|
||||
|
||||
void nativeRender(void *context, const mbgl::CustomLayerRenderParameters& /*parameters*/) {
|
||||
void nativeRender(void *context, const mbgl::style::CustomLayerRenderParameters& /*parameters*/) {
|
||||
reinterpret_cast<ExampleCustomLayer*>(context)->render();
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <mbgl/map/map.hpp>
|
||||
#include <mbgl/map/camera.hpp>
|
||||
#include <mbgl/annotation/annotation.hpp>
|
||||
#include <mbgl/layer/custom_layer.hpp>
|
||||
#include <mbgl/style/layers/custom_layer.hpp>
|
||||
#include <mbgl/sprite/sprite_image.hpp>
|
||||
#include <mbgl/platform/event.hpp>
|
||||
#include <mbgl/platform/log.hpp>
|
||||
@@ -1112,11 +1112,11 @@ void nativeAddCustomLayer(JNIEnv *env, jni::jobject* obj, jlong nativeMapViewPtr
|
||||
mbgl::Log::Debug(mbgl::Event::JNI, "nativeAddCustomLayer");
|
||||
assert(nativeMapViewPtr != 0);
|
||||
NativeMapView *nativeMapView = reinterpret_cast<NativeMapView *>(nativeMapViewPtr);
|
||||
nativeMapView->getMap().addLayer(std::make_unique<mbgl::CustomLayer>(
|
||||
nativeMapView->getMap().addLayer(std::make_unique<mbgl::style::CustomLayer>(
|
||||
std_string_from_jstring(env, reinterpret_cast<jni::jstring*>(jni::GetField<jni::jobject*>(*env, customLayer, *customLayerIdId))),
|
||||
reinterpret_cast<mbgl::CustomLayerInitializeFunction>(jni::GetField<jlong>(*env, customLayer, *customLayerInitializeFunctionId)),
|
||||
reinterpret_cast<mbgl::CustomLayerRenderFunction>(jni::GetField<jlong>(*env, customLayer, *customLayerRenderFunctionId)),
|
||||
reinterpret_cast<mbgl::CustomLayerDeinitializeFunction>(jni::GetField<jlong>(*env, customLayer, *customLayerDeinitializeFunctionId)),
|
||||
reinterpret_cast<mbgl::style::CustomLayerInitializeFunction>(jni::GetField<jlong>(*env, customLayer, *customLayerInitializeFunctionId)),
|
||||
reinterpret_cast<mbgl::style::CustomLayerRenderFunction>(jni::GetField<jlong>(*env, customLayer, *customLayerRenderFunctionId)),
|
||||
reinterpret_cast<mbgl::style::CustomLayerDeinitializeFunction>(jni::GetField<jlong>(*env, customLayer, *customLayerDeinitializeFunctionId)),
|
||||
reinterpret_cast<void*>(jni::GetField<jlong>(*env, customLayer, *customLayerContextId))),
|
||||
before ? mbgl::optional<std::string>(std_string_from_jstring(env, before)) : mbgl::optional<std::string>());
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <mbgl/platform/default/glfw_view.hpp>
|
||||
#include <mbgl/annotation/annotation.hpp>
|
||||
#include <mbgl/sprite/sprite_image.hpp>
|
||||
#include <mbgl/style/property_transition.hpp>
|
||||
#include <mbgl/style/transition_options.hpp>
|
||||
#include <mbgl/gl/gl.hpp>
|
||||
#include <mbgl/gl/gl_values.hpp>
|
||||
#include <mbgl/gl/gl_helper.hpp>
|
||||
@@ -146,7 +146,7 @@ void GLFWView::onKey(GLFWwindow *window, int key, int /*scancode*/, int action,
|
||||
break;
|
||||
case GLFW_KEY_R:
|
||||
if (!mods) {
|
||||
static const mbgl::PropertyTransition transition { { mbgl::Milliseconds(300) } };
|
||||
static const mbgl::style::TransitionOptions transition { { mbgl::Milliseconds(300) } };
|
||||
if (view->map->hasClass("night")) {
|
||||
view->map->removeClass("night", transition);
|
||||
} else {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <mbgl/storage/offline.hpp>
|
||||
#include <mbgl/util/tile_cover.hpp>
|
||||
#include <mbgl/source/source_info.hpp>
|
||||
#include <mbgl/util/tileset.hpp>
|
||||
|
||||
#include <rapidjson/document.h>
|
||||
#include <rapidjson/stringbuffer.h>
|
||||
@@ -23,9 +23,9 @@ OfflineTilePyramidRegionDefinition::OfflineTilePyramidRegionDefinition(
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<CanonicalTileID> OfflineTilePyramidRegionDefinition::tileCover(SourceType type, uint16_t tileSize, const SourceInfo& info) const {
|
||||
double minZ = std::max<double>(util::coveringZoomLevel(minZoom, type, tileSize), info.minZoom);
|
||||
double maxZ = std::min<double>(util::coveringZoomLevel(maxZoom, type, tileSize), info.maxZoom);
|
||||
std::vector<CanonicalTileID> OfflineTilePyramidRegionDefinition::tileCover(SourceType type, uint16_t tileSize, const Tileset& tileset) const {
|
||||
double minZ = std::max<double>(util::coveringZoomLevel(minZoom, type, tileSize), tileset.minZoom);
|
||||
double maxZ = std::min<double>(util::coveringZoomLevel(maxZoom, type, tileSize), tileset.maxZoom);
|
||||
|
||||
assert(minZ >= 0);
|
||||
assert(maxZ >= 0);
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <mbgl/storage/file_source.hpp>
|
||||
#include <mbgl/storage/resource.hpp>
|
||||
#include <mbgl/storage/response.hpp>
|
||||
#include <mbgl/style/style_parser.hpp>
|
||||
#include <mbgl/style/parser.hpp>
|
||||
#include <mbgl/text/glyph.hpp>
|
||||
#include <mbgl/util/tile_cover.hpp>
|
||||
#include <mbgl/util/mapbox.hpp>
|
||||
@@ -46,7 +46,7 @@ void OfflineDownload::setState(OfflineRegionDownloadState state) {
|
||||
observer->statusChanged(status);
|
||||
}
|
||||
|
||||
std::vector<Resource> OfflineDownload::spriteResources(const StyleParser& parser) const {
|
||||
std::vector<Resource> OfflineDownload::spriteResources(const style::Parser& parser) const {
|
||||
std::vector<Resource> result;
|
||||
|
||||
if (!parser.spriteURL.empty()) {
|
||||
@@ -57,7 +57,7 @@ std::vector<Resource> OfflineDownload::spriteResources(const StyleParser& parser
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<Resource> OfflineDownload::glyphResources(const StyleParser& parser) const {
|
||||
std::vector<Resource> OfflineDownload::glyphResources(const style::Parser& parser) const {
|
||||
std::vector<Resource> result;
|
||||
|
||||
if (!parser.glyphURL.empty()) {
|
||||
@@ -71,11 +71,11 @@ std::vector<Resource> OfflineDownload::glyphResources(const StyleParser& parser)
|
||||
return result;
|
||||
}
|
||||
|
||||
std::vector<Resource> OfflineDownload::tileResources(SourceType type, uint16_t tileSize, const SourceInfo& info) const {
|
||||
std::vector<Resource> OfflineDownload::tileResources(SourceType type, uint16_t tileSize, const Tileset& tileset) const {
|
||||
std::vector<Resource> result;
|
||||
|
||||
for (const auto& tile : definition.tileCover(type, tileSize, info)) {
|
||||
result.push_back(Resource::tile(info.tiles[0], definition.pixelRatio, tile.x, tile.y, tile.z));
|
||||
for (const auto& tile : definition.tileCover(type, tileSize, tileset)) {
|
||||
result.push_back(Resource::tile(tileset.tiles[0], definition.pixelRatio, tile.x, tile.y, tile.z));
|
||||
}
|
||||
|
||||
return result;
|
||||
@@ -94,7 +94,7 @@ OfflineRegionStatus OfflineDownload::getStatus() const {
|
||||
return result;
|
||||
}
|
||||
|
||||
StyleParser parser;
|
||||
style::Parser parser;
|
||||
parser.parse(*styleResponse->data);
|
||||
|
||||
result.requiredResourceCountIsPrecise = true;
|
||||
@@ -103,14 +103,14 @@ OfflineRegionStatus OfflineDownload::getStatus() const {
|
||||
switch (source->type) {
|
||||
case SourceType::Vector:
|
||||
case SourceType::Raster:
|
||||
if (source->getInfo()) {
|
||||
result.requiredResourceCount += tileResources(source->type, source->tileSize, *source->getInfo()).size();
|
||||
if (source->getTileset()) {
|
||||
result.requiredResourceCount += tileResources(source->type, source->tileSize, *source->getTileset()).size();
|
||||
} else {
|
||||
result.requiredResourceCount += 1;
|
||||
optional<Response> sourceResponse = offlineDatabase.get(Resource::source(source->url));
|
||||
if (sourceResponse) {
|
||||
result.requiredResourceCount += tileResources(source->type, source->tileSize,
|
||||
*StyleParser::parseTileJSON(*sourceResponse->data, source->url, source->type, source->tileSize)).size();
|
||||
*style::parseTileJSON(*sourceResponse->data, source->url, source->type, source->tileSize)).size();
|
||||
} else {
|
||||
result.requiredResourceCountIsPrecise = false;
|
||||
}
|
||||
@@ -144,7 +144,7 @@ void OfflineDownload::activateDownload() {
|
||||
ensureResource(Resource::style(definition.styleURL), [&] (Response styleResponse) {
|
||||
status.requiredResourceCountIsPrecise = true;
|
||||
|
||||
StyleParser parser;
|
||||
style::Parser parser;
|
||||
parser.parse(*styleResponse.data);
|
||||
|
||||
for (const auto& source : parser.sources) {
|
||||
@@ -155,14 +155,14 @@ void OfflineDownload::activateDownload() {
|
||||
switch (type) {
|
||||
case SourceType::Vector:
|
||||
case SourceType::Raster:
|
||||
if (source->getInfo()) {
|
||||
ensureTiles(type, tileSize, *source->getInfo());
|
||||
if (source->getTileset()) {
|
||||
ensureTiles(type, tileSize, *source->getTileset());
|
||||
} else {
|
||||
status.requiredResourceCountIsPrecise = false;
|
||||
requiredSourceURLs.insert(url);
|
||||
|
||||
ensureResource(Resource::source(url), [=] (Response sourceResponse) {
|
||||
ensureTiles(type, tileSize, *StyleParser::parseTileJSON(*sourceResponse.data, url, type, tileSize));
|
||||
ensureTiles(type, tileSize, *style::parseTileJSON(*sourceResponse.data, url, type, tileSize));
|
||||
|
||||
requiredSourceURLs.erase(url);
|
||||
if (requiredSourceURLs.empty()) {
|
||||
@@ -198,7 +198,7 @@ void OfflineDownload::deactivateDownload() {
|
||||
requests.clear();
|
||||
}
|
||||
|
||||
void OfflineDownload::ensureTiles(SourceType type, uint16_t tileSize, const SourceInfo& info) {
|
||||
void OfflineDownload::ensureTiles(SourceType type, uint16_t tileSize, const Tileset& info) {
|
||||
for (const auto& resource : tileResources(type, tileSize, info)) {
|
||||
ensureResource(resource);
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/storage/offline.hpp>
|
||||
#include <mbgl/style/types.hpp>
|
||||
|
||||
#include <list>
|
||||
#include <set>
|
||||
@@ -14,9 +13,11 @@ class FileSource;
|
||||
class AsyncRequest;
|
||||
class Resource;
|
||||
class Response;
|
||||
class SourceInfo;
|
||||
class StyleParser;
|
||||
class Source;
|
||||
class Tileset;
|
||||
|
||||
namespace style {
|
||||
class Parser;
|
||||
}
|
||||
|
||||
/**
|
||||
* Coordinates the request and storage of all resources for an offline region.
|
||||
@@ -37,9 +38,9 @@ private:
|
||||
void activateDownload();
|
||||
void deactivateDownload();
|
||||
|
||||
std::vector<Resource> spriteResources(const StyleParser&) const;
|
||||
std::vector<Resource> glyphResources(const StyleParser&) const;
|
||||
std::vector<Resource> tileResources(SourceType, uint16_t, const SourceInfo&) const;
|
||||
std::vector<Resource> spriteResources(const style::Parser&) const;
|
||||
std::vector<Resource> glyphResources(const style::Parser&) const;
|
||||
std::vector<Resource> tileResources(SourceType, uint16_t, const Tileset&) const;
|
||||
|
||||
/*
|
||||
* Ensure that the resource is stored in the database, requesting it if necessary.
|
||||
@@ -47,7 +48,7 @@ private:
|
||||
* is deactivated, all in progress requests are cancelled.
|
||||
*/
|
||||
void ensureResource(const Resource&, std::function<void (Response)> = {});
|
||||
void ensureTiles(SourceType, uint16_t, const SourceInfo&);
|
||||
void ensureTiles(SourceType, uint16_t, const Tileset&);
|
||||
bool checkTileCountLimit(const Resource& resource);
|
||||
|
||||
int64_t id;
|
||||
|
||||
@@ -15,9 +15,9 @@
|
||||
#include <mbgl/platform/darwin/reachability.h>
|
||||
#include <mbgl/storage/default_file_source.hpp>
|
||||
#include <mbgl/storage/network_status.hpp>
|
||||
#include <mbgl/style/property_transition.hpp>
|
||||
#include <mbgl/style/transition_options.hpp>
|
||||
#include <mbgl/style/layers/custom_layer.hpp>
|
||||
#include <mbgl/math/wrap.hpp>
|
||||
#include <mbgl/layer/custom_layer.hpp>
|
||||
#include <mbgl/util/geo.hpp>
|
||||
#include <mbgl/util/constants.hpp>
|
||||
#include <mbgl/util/image.hpp>
|
||||
@@ -2700,7 +2700,7 @@ mbgl::Duration MGLDurationInSeconds(NSTimeInterval duration)
|
||||
newAppliedClasses.insert(newAppliedClasses.end(), [appliedClass UTF8String]);
|
||||
}
|
||||
|
||||
mbgl::PropertyTransition transition { { MGLDurationInSeconds(transitionDuration) } };
|
||||
mbgl::style::TransitionOptions transition { { MGLDurationInSeconds(transitionDuration) } };
|
||||
_mbglMap->setClasses(newAppliedClasses, transition);
|
||||
}
|
||||
|
||||
@@ -4973,7 +4973,7 @@ void MGLPrepareCustomStyleLayer(void *context)
|
||||
}
|
||||
}
|
||||
|
||||
void MGLDrawCustomStyleLayer(void *context, const mbgl::CustomLayerRenderParameters ¶ms)
|
||||
void MGLDrawCustomStyleLayer(void *context, const mbgl::style::CustomLayerRenderParameters ¶ms)
|
||||
{
|
||||
CGSize size = CGSizeMake(params.width, params.height);
|
||||
CLLocationCoordinate2D centerCoordinate = CLLocationCoordinate2DMake(params.latitude, params.longitude);
|
||||
@@ -5005,8 +5005,8 @@ void MGLFinishCustomStyleLayer(void *context)
|
||||
{
|
||||
NSAssert(identifier, @"Style layer needs an identifier");
|
||||
MGLCustomStyleLayerHandlers *context = new MGLCustomStyleLayerHandlers(preparation, drawing, completion);
|
||||
_mbglMap->addLayer(std::make_unique<mbgl::CustomLayer>(identifier.UTF8String, MGLPrepareCustomStyleLayer,
|
||||
MGLDrawCustomStyleLayer, MGLFinishCustomStyleLayer, context),
|
||||
_mbglMap->addLayer(std::make_unique<mbgl::style::CustomLayer>(identifier.UTF8String, MGLPrepareCustomStyleLayer,
|
||||
MGLDrawCustomStyleLayer, MGLFinishCustomStyleLayer, context),
|
||||
otherIdentifier ? mbgl::optional<std::string>(otherIdentifier.UTF8String) : mbgl::optional<std::string>());
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <mbgl/gl/gl.hpp>
|
||||
#include <mbgl/map/camera.hpp>
|
||||
#include <mbgl/map/map.hpp>
|
||||
#include <mbgl/layer/custom_layer.hpp>
|
||||
#include <mbgl/style/layers/custom_layer.hpp>
|
||||
#include <mbgl/sprite/sprite_image.hpp>
|
||||
#include <mbgl/storage/network_status.hpp>
|
||||
#include <mbgl/util/constants.hpp>
|
||||
@@ -557,13 +557,13 @@ void QMapboxGL::addCustomLayer(const QString &id,
|
||||
void *context_,
|
||||
char *before)
|
||||
{
|
||||
d_ptr->mapObj->addLayer(std::make_unique<mbgl::CustomLayer>(
|
||||
d_ptr->mapObj->addLayer(std::make_unique<mbgl::style::CustomLayer>(
|
||||
id.toStdString(),
|
||||
reinterpret_cast<mbgl::CustomLayerInitializeFunction>(initFn),
|
||||
reinterpret_cast<mbgl::style::CustomLayerInitializeFunction>(initFn),
|
||||
// This cast is safe as long as both mbgl:: and QMapbox::
|
||||
// CustomLayerRenderParameters members remains the same.
|
||||
(mbgl::CustomLayerRenderFunction)renderFn,
|
||||
reinterpret_cast<mbgl::CustomLayerDeinitializeFunction>(deinitFn),
|
||||
(mbgl::style::CustomLayerRenderFunction)renderFn,
|
||||
reinterpret_cast<mbgl::style::CustomLayerDeinitializeFunction>(deinitFn),
|
||||
context_),
|
||||
before ? mbgl::optional<std::string>(before) : mbgl::optional<std::string>());
|
||||
}
|
||||
|
||||
@@ -80,11 +80,14 @@ const layerHpp = ejs.compile(`<%
|
||||
#include <mbgl/style/filter.hpp>
|
||||
#include <mbgl/style/property_value.hpp>
|
||||
|
||||
#include <mbgl/util/color.hpp>
|
||||
|
||||
<% if (type === 'line' || type === 'symbol') { -%>
|
||||
#include <vector>
|
||||
|
||||
<% } -%>
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
class <%- camelize(type) %>Layer : public Layer {
|
||||
public:
|
||||
@@ -138,6 +141,7 @@ inline bool Layer::is<<%- camelize(type) %>Layer>() const {
|
||||
return type == Type::<%- camelize(type) %>;
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
`, {strict: true});
|
||||
|
||||
@@ -148,10 +152,11 @@ const layerCpp = ejs.compile(`<%
|
||||
-%>
|
||||
// This file is generated. Edit scripts/generate-style-code.js, then run \`make style-code\`.
|
||||
|
||||
#include <mbgl/layer/<%- type %>_layer.hpp>
|
||||
#include <mbgl/layer/<%- type %>_layer_impl.hpp>
|
||||
#include <mbgl/style/layers/<%- type %>_layer.hpp>
|
||||
#include <mbgl/style/layers/<%- type %>_layer_impl.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
<%- camelize(type) %>Layer::<%- camelize(type) %>Layer(const std::string& layerID)
|
||||
: Layer(Type::<%- camelize(type) %>, std::make_unique<Impl>())
|
||||
@@ -230,6 +235,7 @@ void <%- camelize(type) %>Layer::set<%- camelize(property.name) %>(PropertyValue
|
||||
}
|
||||
<% } -%>
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
`, {strict: true});
|
||||
|
||||
@@ -247,15 +253,16 @@ const propertiesHpp = ejs.compile(`<%
|
||||
#include <mbgl/util/rapidjson.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
class StyleCascadeParameters;
|
||||
class StyleCalculationParameters;
|
||||
class CascadeParameters;
|
||||
class CalculationParameters;
|
||||
|
||||
<% if (layoutProperties.length) { -%>
|
||||
class <%- camelize(type) %>LayoutProperties {
|
||||
public:
|
||||
void parse(const JSValue&);
|
||||
void recalculate(const StyleCalculationParameters&);
|
||||
void recalculate(const CalculationParameters&);
|
||||
|
||||
<% for (const property of layoutProperties) { -%>
|
||||
LayoutProperty<<%- propertyType(property) %>> <%- camelizeWithLeadingLowercase(property.name) %> { <%- defaultValue(property) %> };
|
||||
@@ -266,8 +273,8 @@ public:
|
||||
class <%- camelize(type) %>PaintProperties {
|
||||
public:
|
||||
void parse(const JSValue&);
|
||||
void cascade(const StyleCascadeParameters&);
|
||||
bool recalculate(const StyleCalculationParameters&);
|
||||
void cascade(const CascadeParameters&);
|
||||
bool recalculate(const CalculationParameters&);
|
||||
|
||||
<% for (const property of paintProperties) { -%>
|
||||
<% if (/-pattern$/.test(property.name) || property.name === 'line-dasharray') { -%>
|
||||
@@ -280,6 +287,7 @@ public:
|
||||
<% } -%>
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
`, {strict: true});
|
||||
|
||||
@@ -290,9 +298,10 @@ const propertiesCpp = ejs.compile(`<%
|
||||
-%>
|
||||
// This file is generated. Edit scripts/generate-style-code.js, then run \`make style-code\`.
|
||||
|
||||
#include <mbgl/layer/<%- type %>_layer_properties.hpp>
|
||||
#include <mbgl/style/layers/<%- type %>_layer_properties.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
<% if (layoutProperties.length) { -%>
|
||||
void <%- camelize(type) %>LayoutProperties::parse(const JSValue& value) {
|
||||
@@ -301,7 +310,7 @@ void <%- camelize(type) %>LayoutProperties::parse(const JSValue& value) {
|
||||
<% } -%>
|
||||
}
|
||||
|
||||
void <%- camelize(type) %>LayoutProperties::recalculate(const StyleCalculationParameters& parameters) {
|
||||
void <%- camelize(type) %>LayoutProperties::recalculate(const CalculationParameters& parameters) {
|
||||
<% for (const property of layoutProperties) { -%>
|
||||
<%- camelizeWithLeadingLowercase(property.name) %>.calculate(parameters);
|
||||
<% } -%>
|
||||
@@ -314,13 +323,13 @@ void <%- camelize(type) %>PaintProperties::parse(const JSValue& value) {
|
||||
<% } -%>
|
||||
}
|
||||
|
||||
void <%- camelize(type) %>PaintProperties::cascade(const StyleCascadeParameters& parameters) {
|
||||
void <%- camelize(type) %>PaintProperties::cascade(const CascadeParameters& parameters) {
|
||||
<% for (const property of paintProperties) { -%>
|
||||
<%- camelizeWithLeadingLowercase(property.name) %>.cascade(parameters);
|
||||
<% } -%>
|
||||
}
|
||||
|
||||
bool <%- camelize(type) %>PaintProperties::recalculate(const StyleCalculationParameters& parameters) {
|
||||
bool <%- camelize(type) %>PaintProperties::recalculate(const CalculationParameters& parameters) {
|
||||
bool hasTransitions = false;
|
||||
|
||||
<% for (const property of paintProperties) { -%>
|
||||
@@ -330,6 +339,7 @@ bool <%- camelize(type) %>PaintProperties::recalculate(const StyleCalculationPar
|
||||
return hasTransitions;
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
`, {strict: true});
|
||||
|
||||
@@ -354,9 +364,9 @@ for (const type of spec.layer.type.values) {
|
||||
paintProperties: paintProperties,
|
||||
};
|
||||
|
||||
fs.writeFileSync(`include/mbgl/layer/${type}_layer.hpp`, layerHpp(layer));
|
||||
fs.writeFileSync(`src/mbgl/layer/${type}_layer.cpp`, layerCpp(layer));
|
||||
fs.writeFileSync(`include/mbgl/style/layers/${type}_layer.hpp`, layerHpp(layer));
|
||||
fs.writeFileSync(`src/mbgl/style/layers/${type}_layer.cpp`, layerCpp(layer));
|
||||
|
||||
fs.writeFileSync(`src/mbgl/layer/${type}_layer_properties.hpp`, propertiesHpp(layer));
|
||||
fs.writeFileSync(`src/mbgl/layer/${type}_layer_properties.cpp`, propertiesCpp(layer));
|
||||
fs.writeFileSync(`src/mbgl/style/layers/${type}_layer_properties.hpp`, propertiesHpp(layer));
|
||||
fs.writeFileSync(`src/mbgl/style/layers/${type}_layer_properties.cpp`, propertiesCpp(layer));
|
||||
}
|
||||
|
||||
@@ -4,15 +4,17 @@
|
||||
#include <mbgl/annotation/line_annotation_impl.hpp>
|
||||
#include <mbgl/annotation/fill_annotation_impl.hpp>
|
||||
#include <mbgl/annotation/style_sourced_annotation_impl.hpp>
|
||||
#include <mbgl/source/source.hpp>
|
||||
#include <mbgl/style/source.hpp>
|
||||
#include <mbgl/style/style.hpp>
|
||||
#include <mbgl/layer/symbol_layer.hpp>
|
||||
#include <mbgl/layer/symbol_layer_impl.hpp>
|
||||
#include <mbgl/style/layers/symbol_layer.hpp>
|
||||
#include <mbgl/style/layers/symbol_layer_impl.hpp>
|
||||
|
||||
#include <boost/function_output_iterator.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
using namespace style;
|
||||
|
||||
const std::string AnnotationManager::SourceID = "com.mapbox.annotations";
|
||||
const std::string AnnotationManager::PointLayerID = "com.mapbox.annotations.points";
|
||||
|
||||
@@ -105,7 +107,7 @@ std::unique_ptr<AnnotationTile> AnnotationManager::getTile(const CanonicalTileID
|
||||
void AnnotationManager::updateStyle(Style& style) {
|
||||
// Create annotation source, point layer, and point bucket
|
||||
if (!style.getSource(SourceID)) {
|
||||
std::unique_ptr<Source> source = std::make_unique<Source>(SourceType::Annotations, SourceID, "", util::tileSize, std::make_unique<SourceInfo>(), nullptr);
|
||||
std::unique_ptr<Source> source = std::make_unique<Source>(SourceType::Annotations, SourceID, "", util::tileSize, std::make_unique<Tileset>(), nullptr);
|
||||
source->enabled = true;
|
||||
style.addSource(std::move(source));
|
||||
|
||||
|
||||
@@ -18,7 +18,10 @@ class AnnotationTile;
|
||||
class AnnotationTileMonitor;
|
||||
class SymbolAnnotationImpl;
|
||||
class ShapeAnnotationImpl;
|
||||
|
||||
namespace style {
|
||||
class Style;
|
||||
}
|
||||
|
||||
class AnnotationManager : private util::noncopyable {
|
||||
public:
|
||||
@@ -36,7 +39,7 @@ public:
|
||||
double getTopOffsetPixelsForIcon(const std::string& name);
|
||||
SpriteAtlas& getSpriteAtlas() { return spriteAtlas; }
|
||||
|
||||
void updateStyle(Style&);
|
||||
void updateStyle(style::Style&);
|
||||
|
||||
void addTileMonitor(AnnotationTileMonitor&);
|
||||
void removeTileMonitor(AnnotationTileMonitor&);
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#include <mbgl/annotation/fill_annotation_impl.hpp>
|
||||
#include <mbgl/annotation/annotation_manager.hpp>
|
||||
#include <mbgl/style/style.hpp>
|
||||
#include <mbgl/layer/fill_layer.hpp>
|
||||
#include <mbgl/style/layers/fill_layer.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
namespace geojsonvt = mapbox::geojsonvt;
|
||||
using namespace style;
|
||||
|
||||
FillAnnotationImpl::FillAnnotationImpl(const AnnotationID id_, const FillAnnotation& annotation_, const uint8_t maxZoom_)
|
||||
: ShapeAnnotationImpl(id_, maxZoom_),
|
||||
|
||||
@@ -9,7 +9,7 @@ class FillAnnotationImpl : public ShapeAnnotationImpl {
|
||||
public:
|
||||
FillAnnotationImpl(const AnnotationID, const FillAnnotation&, const uint8_t maxZoom);
|
||||
|
||||
void updateStyle(Style&) const final;
|
||||
void updateStyle(style::Style&) const final;
|
||||
const ShapeAnnotationGeometry& geometry() const final;
|
||||
|
||||
private:
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#include <mbgl/annotation/line_annotation_impl.hpp>
|
||||
#include <mbgl/annotation/annotation_manager.hpp>
|
||||
#include <mbgl/style/style.hpp>
|
||||
#include <mbgl/layer/line_layer.hpp>
|
||||
#include <mbgl/style/layers/line_layer.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
namespace geojsonvt = mapbox::geojsonvt;
|
||||
using namespace style;
|
||||
|
||||
LineAnnotationImpl::LineAnnotationImpl(const AnnotationID id_, const LineAnnotation& annotation_, const uint8_t maxZoom_)
|
||||
: ShapeAnnotationImpl(id_, maxZoom_),
|
||||
|
||||
@@ -9,7 +9,7 @@ class LineAnnotationImpl : public ShapeAnnotationImpl {
|
||||
public:
|
||||
LineAnnotationImpl(const AnnotationID, const LineAnnotation&, const uint8_t maxZoom);
|
||||
|
||||
void updateStyle(Style&) const final;
|
||||
void updateStyle(style::Style&) const final;
|
||||
const ShapeAnnotationGeometry& geometry() const final;
|
||||
|
||||
private:
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
using namespace style;
|
||||
namespace geojsonvt = mapbox::geojsonvt;
|
||||
|
||||
ShapeAnnotationImpl::ShapeAnnotationImpl(const AnnotationID id_, const uint8_t maxZoom_)
|
||||
|
||||
@@ -9,16 +9,19 @@
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
class Style;
|
||||
class AnnotationTile;
|
||||
class CanonicalTileID;
|
||||
|
||||
namespace style {
|
||||
class Style;
|
||||
}
|
||||
|
||||
class ShapeAnnotationImpl {
|
||||
public:
|
||||
ShapeAnnotationImpl(const AnnotationID, const uint8_t maxZoom);
|
||||
virtual ~ShapeAnnotationImpl() = default;
|
||||
|
||||
virtual void updateStyle(Style&) const = 0;
|
||||
virtual void updateStyle(style::Style&) const = 0;
|
||||
virtual const ShapeAnnotationGeometry& geometry() const = 0;
|
||||
|
||||
void updateTile(const CanonicalTileID&, AnnotationTile&);
|
||||
|
||||
@@ -2,12 +2,12 @@
|
||||
#include <mbgl/annotation/annotation_manager.hpp>
|
||||
#include <mbgl/style/style.hpp>
|
||||
#include <mbgl/style/layer.hpp>
|
||||
#include <mbgl/layer/line_layer.hpp>
|
||||
#include <mbgl/layer/fill_layer.hpp>
|
||||
#include <mbgl/style/layers/line_layer.hpp>
|
||||
#include <mbgl/style/layers/fill_layer.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
namespace geojsonvt = mapbox::geojsonvt;
|
||||
using namespace style;
|
||||
|
||||
StyleSourcedAnnotationImpl::StyleSourcedAnnotationImpl(const AnnotationID id_, const StyleSourcedAnnotation& annotation_, const uint8_t maxZoom_)
|
||||
: ShapeAnnotationImpl(id_, maxZoom_),
|
||||
|
||||
@@ -9,7 +9,7 @@ class StyleSourcedAnnotationImpl : public ShapeAnnotationImpl {
|
||||
public:
|
||||
StyleSourcedAnnotationImpl(const AnnotationID, const StyleSourcedAnnotation&, const uint8_t maxZoom);
|
||||
|
||||
void updateStyle(Style&) const final;
|
||||
void updateStyle(style::Style&) const final;
|
||||
const ShapeAnnotationGeometry& geometry() const final;
|
||||
|
||||
private:
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
#include <mbgl/geometry/feature_index.hpp>
|
||||
#include <mbgl/style/style.hpp>
|
||||
#include <mbgl/style/layer.hpp>
|
||||
#include <mbgl/layer/layer_impl.hpp>
|
||||
#include <mbgl/layer/symbol_layer.hpp>
|
||||
#include <mbgl/style/layer_impl.hpp>
|
||||
#include <mbgl/style/layers/symbol_layer.hpp>
|
||||
#include <mbgl/text/collision_tile.hpp>
|
||||
#include <mbgl/util/constants.hpp>
|
||||
#include <mbgl/util/math.hpp>
|
||||
@@ -59,7 +59,7 @@ void FeatureIndex::query(
|
||||
const optional<std::vector<std::string>>& filterLayerIDs,
|
||||
const GeometryTile& geometryTile,
|
||||
const CanonicalTileID& tileID,
|
||||
const Style& style) const {
|
||||
const style::Style& style) const {
|
||||
|
||||
mapbox::geometry::box<int16_t> box = mapbox::geometry::envelope(queryGeometry);
|
||||
|
||||
@@ -94,7 +94,7 @@ void FeatureIndex::addFeature(
|
||||
const optional<std::vector<std::string>>& filterLayerIDs,
|
||||
const GeometryTile& geometryTile,
|
||||
const CanonicalTileID& tileID,
|
||||
const Style& style,
|
||||
const style::Style& style,
|
||||
const float bearing,
|
||||
const float pixelsToTileUnits) const {
|
||||
|
||||
@@ -116,7 +116,7 @@ void FeatureIndex::addFeature(
|
||||
|
||||
auto styleLayer = style.getLayer(layerID);
|
||||
if (!styleLayer ||
|
||||
(!styleLayer->is<SymbolLayer>() &&
|
||||
(!styleLayer->is<style::SymbolLayer>() &&
|
||||
!styleLayer->baseImpl->queryIntersectsGeometry(queryGeometry, geometryTileFeature->getGeometries(), bearing, pixelsToTileUnits))) {
|
||||
continue;
|
||||
}
|
||||
@@ -128,7 +128,7 @@ void FeatureIndex::addFeature(
|
||||
optional<GeometryCollection> FeatureIndex::translateQueryGeometry(
|
||||
const GeometryCollection& queryGeometry,
|
||||
const std::array<float, 2>& translate,
|
||||
const TranslateAnchorType anchorType,
|
||||
const style::TranslateAnchorType anchorType,
|
||||
const float bearing,
|
||||
const float pixelsToTileUnits) {
|
||||
if (translate[0] == 0 && translate[1] == 0) {
|
||||
@@ -136,7 +136,7 @@ optional<GeometryCollection> FeatureIndex::translateQueryGeometry(
|
||||
}
|
||||
|
||||
GeometryCoordinate translateVec(translate[0] * pixelsToTileUnits, translate[1] * pixelsToTileUnits);
|
||||
if (anchorType == TranslateAnchorType::Viewport) {
|
||||
if (anchorType == style::TranslateAnchorType::Viewport) {
|
||||
translateVec = util::rotate(translateVec, -bearing);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/style/types.hpp>
|
||||
#include <mbgl/tile/geometry_tile.hpp>
|
||||
#include <mbgl/util/grid_index.hpp>
|
||||
#include <mbgl/util/feature.hpp>
|
||||
@@ -10,9 +11,11 @@
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
namespace style {
|
||||
class Style;
|
||||
}
|
||||
|
||||
class CollisionTile;
|
||||
enum class TranslateAnchorType : bool;
|
||||
class CanonicalTileID;
|
||||
|
||||
class IndexedSubfeature {
|
||||
@@ -39,12 +42,12 @@ public:
|
||||
const optional<std::vector<std::string>>& layerIDs,
|
||||
const GeometryTile&,
|
||||
const CanonicalTileID&,
|
||||
const Style&) const;
|
||||
const style::Style&) const;
|
||||
|
||||
static optional<GeometryCollection> translateQueryGeometry(
|
||||
const GeometryCollection& queryGeometry,
|
||||
const std::array<float, 2>& translate,
|
||||
const TranslateAnchorType,
|
||||
const style::TranslateAnchorType,
|
||||
const float bearing,
|
||||
const float pixelsToTileUnits);
|
||||
|
||||
@@ -60,7 +63,7 @@ private:
|
||||
const optional<std::vector<std::string>>& filterLayerIDs,
|
||||
const GeometryTile&,
|
||||
const CanonicalTileID&,
|
||||
const Style&,
|
||||
const style::Style&,
|
||||
const float bearing,
|
||||
const float pixelsToTileUnits) const;
|
||||
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/layer/layer_impl.hpp>
|
||||
#include <mbgl/layer/background_layer.hpp>
|
||||
#include <mbgl/layer/background_layer_properties.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
class BackgroundLayer::Impl : public Layer::Impl {
|
||||
public:
|
||||
std::unique_ptr<Layer> clone() const override;
|
||||
|
||||
void parseLayout(const JSValue&) override {};
|
||||
void parsePaints(const JSValue&) override;
|
||||
|
||||
void cascade(const StyleCascadeParameters&) override;
|
||||
bool recalculate(const StyleCalculationParameters&) override;
|
||||
|
||||
std::unique_ptr<Bucket> createBucket(StyleBucketParameters&) const override;
|
||||
|
||||
BackgroundPaintProperties paint;
|
||||
};
|
||||
|
||||
} // namespace mbgl
|
||||
@@ -1,24 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/layer/layer_impl.hpp>
|
||||
#include <mbgl/layer/raster_layer.hpp>
|
||||
#include <mbgl/layer/raster_layer_properties.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
class RasterLayer::Impl : public Layer::Impl {
|
||||
public:
|
||||
std::unique_ptr<Layer> clone() const override;
|
||||
|
||||
void parseLayout(const JSValue&) override {};
|
||||
void parsePaints(const JSValue&) override;
|
||||
|
||||
void cascade(const StyleCascadeParameters&) override;
|
||||
bool recalculate(const StyleCalculationParameters&) override;
|
||||
|
||||
std::unique_ptr<Bucket> createBucket(StyleBucketParameters&) const override;
|
||||
|
||||
RasterPaintProperties paint;
|
||||
};
|
||||
|
||||
} // namespace mbgl
|
||||
@@ -5,11 +5,11 @@
|
||||
#include <mbgl/map/transform_state.hpp>
|
||||
#include <mbgl/annotation/annotation_manager.hpp>
|
||||
#include <mbgl/style/style.hpp>
|
||||
#include <mbgl/style/style_observer.hpp>
|
||||
#include <mbgl/style/property_transition.hpp>
|
||||
#include <mbgl/style/style_update_parameters.hpp>
|
||||
#include <mbgl/style/style_query_parameters.hpp>
|
||||
#include <mbgl/layer/custom_layer.hpp>
|
||||
#include <mbgl/style/layer.hpp>
|
||||
#include <mbgl/style/observer.hpp>
|
||||
#include <mbgl/style/transition_options.hpp>
|
||||
#include <mbgl/style/update_parameters.hpp>
|
||||
#include <mbgl/style/query_parameters.hpp>
|
||||
#include <mbgl/renderer/painter.hpp>
|
||||
#include <mbgl/storage/file_source.hpp>
|
||||
#include <mbgl/storage/resource.hpp>
|
||||
@@ -25,13 +25,15 @@
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
using namespace style;
|
||||
|
||||
enum class RenderState {
|
||||
never,
|
||||
partial,
|
||||
fully
|
||||
};
|
||||
|
||||
class Map::Impl : public StyleObserver {
|
||||
class Map::Impl : public style::Observer {
|
||||
public:
|
||||
Impl(View&, FileSource&, MapMode, GLContextMode, ConstrainMode, ViewportMode);
|
||||
|
||||
@@ -221,17 +223,17 @@ void Map::Impl::update() {
|
||||
style->recalculate(transform.getZoom(), timePoint, mode);
|
||||
}
|
||||
|
||||
StyleUpdateParameters parameters(pixelRatio,
|
||||
debugOptions,
|
||||
timePoint,
|
||||
transform.getState(),
|
||||
style->workers,
|
||||
fileSource,
|
||||
*texturePool,
|
||||
style->shouldReparsePartialTiles,
|
||||
mode,
|
||||
*annotationManager,
|
||||
*style);
|
||||
style::UpdateParameters parameters(pixelRatio,
|
||||
debugOptions,
|
||||
timePoint,
|
||||
transform.getState(),
|
||||
style->workers,
|
||||
fileSource,
|
||||
*texturePool,
|
||||
style->shouldReparsePartialTiles,
|
||||
mode,
|
||||
*annotationManager,
|
||||
*style);
|
||||
|
||||
style->update(parameters);
|
||||
|
||||
@@ -799,19 +801,19 @@ bool Map::isFullyLoaded() const {
|
||||
return impl->style->isLoaded();
|
||||
}
|
||||
|
||||
void Map::addClass(const std::string& className, const PropertyTransition& properties) {
|
||||
void Map::addClass(const std::string& className, const TransitionOptions& properties) {
|
||||
if (impl->style->addClass(className, properties)) {
|
||||
update(Update::Classes);
|
||||
}
|
||||
}
|
||||
|
||||
void Map::removeClass(const std::string& className, const PropertyTransition& properties) {
|
||||
void Map::removeClass(const std::string& className, const TransitionOptions& properties) {
|
||||
if (impl->style->removeClass(className, properties)) {
|
||||
update(Update::Classes);
|
||||
}
|
||||
}
|
||||
|
||||
void Map::setClasses(const std::vector<std::string>& classNames, const PropertyTransition& properties) {
|
||||
void Map::setClasses(const std::vector<std::string>& classNames, const TransitionOptions& properties) {
|
||||
impl->style->setClasses(classNames, properties);
|
||||
update(Update::Classes);
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
namespace mbgl {
|
||||
|
||||
class Painter;
|
||||
class Layer;
|
||||
class UnwrappedTileID;
|
||||
class CollisionTile;
|
||||
|
||||
@@ -21,6 +20,10 @@ namespace gl {
|
||||
class ObjectStore;
|
||||
}
|
||||
|
||||
namespace style {
|
||||
class Layer;
|
||||
}
|
||||
|
||||
class Bucket : private util::noncopyable {
|
||||
public:
|
||||
Bucket() : uploaded(false) {}
|
||||
@@ -31,7 +34,7 @@ public:
|
||||
|
||||
// Every time this bucket is getting rendered, this function is called. This happens either
|
||||
// once or twice (for Opaque and Transparent render passes).
|
||||
virtual void render(Painter&, const Layer&, const UnwrappedTileID&, const mat4&) = 0;
|
||||
virtual void render(Painter&, const style::Layer&, const UnwrappedTileID&, const mat4&) = 0;
|
||||
|
||||
virtual ~Bucket() = default;
|
||||
|
||||
|
||||
@@ -2,10 +2,12 @@
|
||||
#include <mbgl/renderer/painter.hpp>
|
||||
|
||||
#include <mbgl/shader/circle_shader.hpp>
|
||||
#include <mbgl/layer/circle_layer.hpp>
|
||||
#include <mbgl/style/layers/circle_layer.hpp>
|
||||
#include <mbgl/util/constants.hpp>
|
||||
|
||||
using namespace mbgl;
|
||||
namespace mbgl {
|
||||
|
||||
using namespace style;
|
||||
|
||||
CircleBucket::CircleBucket(MapMode mode_) : mode(mode_) {
|
||||
}
|
||||
@@ -97,3 +99,5 @@ void CircleBucket::drawCircles(CircleShader& shader, gl::ObjectStore& store) {
|
||||
elementsIndex += group->elements_length * elementsBuffer_.itemSize;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public:
|
||||
~CircleBucket() override;
|
||||
|
||||
void upload(gl::ObjectStore&) override;
|
||||
void render(Painter&, const Layer&, const UnwrappedTileID&, const mat4&) override;
|
||||
void render(Painter&, const style::Layer&, const UnwrappedTileID&, const mat4&) override;
|
||||
|
||||
bool hasData() const override;
|
||||
bool needsClipping() const override;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <mbgl/renderer/fill_bucket.hpp>
|
||||
#include <mbgl/layer/fill_layer.hpp>
|
||||
#include <mbgl/style/layers/fill_layer.hpp>
|
||||
#include <mbgl/renderer/painter.hpp>
|
||||
#include <mbgl/shader/plain_shader.hpp>
|
||||
#include <mbgl/shader/pattern_shader.hpp>
|
||||
@@ -12,22 +12,24 @@
|
||||
|
||||
#include <cassert>
|
||||
|
||||
struct GeometryTooLongException : std::exception {};
|
||||
|
||||
using namespace mbgl;
|
||||
|
||||
namespace mapbox {
|
||||
namespace util {
|
||||
template <> struct nth<0, GeometryCoordinate> {
|
||||
inline static int64_t get(const GeometryCoordinate& t) { return t.x; };
|
||||
template <> struct nth<0, mbgl::GeometryCoordinate> {
|
||||
inline static int64_t get(const mbgl::GeometryCoordinate& t) { return t.x; };
|
||||
};
|
||||
|
||||
template <> struct nth<1, GeometryCoordinate> {
|
||||
inline static int64_t get(const GeometryCoordinate& t) { return t.y; };
|
||||
template <> struct nth<1, mbgl::GeometryCoordinate> {
|
||||
inline static int64_t get(const mbgl::GeometryCoordinate& t) { return t.y; };
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
using namespace style;
|
||||
|
||||
struct GeometryTooLongException : std::exception {};
|
||||
|
||||
FillBucket::FillBucket() {
|
||||
}
|
||||
|
||||
@@ -165,3 +167,5 @@ void FillBucket::drawVertices(OutlinePatternShader& shader, gl::ObjectStore& sto
|
||||
elements_index += group->elements_length * lineElementsBuffer.itemSize;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
~FillBucket() override;
|
||||
|
||||
void upload(gl::ObjectStore&) override;
|
||||
void render(Painter&, const Layer&, const UnwrappedTileID&, const mat4&) override;
|
||||
void render(Painter&, const style::Layer&, const UnwrappedTileID&, const mat4&) override;
|
||||
bool hasData() const override;
|
||||
bool needsClipping() const override;
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <mbgl/renderer/line_bucket.hpp>
|
||||
#include <mbgl/layer/line_layer.hpp>
|
||||
#include <mbgl/style/layers/line_layer.hpp>
|
||||
#include <mbgl/geometry/elements_buffer.hpp>
|
||||
#include <mbgl/renderer/painter.hpp>
|
||||
#include <mbgl/shader/line_shader.hpp>
|
||||
@@ -11,7 +11,9 @@
|
||||
|
||||
#include <cassert>
|
||||
|
||||
using namespace mbgl;
|
||||
namespace mbgl {
|
||||
|
||||
using namespace style;
|
||||
|
||||
LineBucket::LineBucket(uint32_t overscaling_) : overscaling(overscaling_) {
|
||||
}
|
||||
@@ -505,3 +507,5 @@ void LineBucket::drawLinePatterns(LinepatternShader& shader, gl::ObjectStore& st
|
||||
elements_index += group->elements_length * triangleElementsBuffer.itemSize;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,13 +5,12 @@
|
||||
#include <mbgl/geometry/vao.hpp>
|
||||
#include <mbgl/geometry/elements_buffer.hpp>
|
||||
#include <mbgl/geometry/line_buffer.hpp>
|
||||
#include <mbgl/layer/line_layer_impl.hpp>
|
||||
#include <mbgl/style/layers/line_layer_properties.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
class Style;
|
||||
class LineVertexBuffer;
|
||||
class TriangleElementsBuffer;
|
||||
class LineShader;
|
||||
@@ -26,7 +25,7 @@ public:
|
||||
~LineBucket() override;
|
||||
|
||||
void upload(gl::ObjectStore&) override;
|
||||
void render(Painter&, const Layer&, const UnwrappedTileID&, const mat4&) override;
|
||||
void render(Painter&, const style::Layer&, const UnwrappedTileID&, const mat4&) override;
|
||||
bool hasData() const override;
|
||||
bool needsClipping() const override;
|
||||
|
||||
@@ -50,7 +49,7 @@ private:
|
||||
std::vector<TriangleElement>& triangleStore);
|
||||
|
||||
public:
|
||||
LineLayoutProperties layout;
|
||||
style::LineLayoutProperties layout;
|
||||
|
||||
private:
|
||||
LineVertexBuffer vertexBuffer;
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
#include <mbgl/renderer/painter.hpp>
|
||||
|
||||
#include <mbgl/source/source.hpp>
|
||||
#include <mbgl/style/source.hpp>
|
||||
#include <mbgl/tile/tile.hpp>
|
||||
|
||||
#include <mbgl/platform/log.hpp>
|
||||
#include <mbgl/gl/debugging.hpp>
|
||||
|
||||
#include <mbgl/style/style.hpp>
|
||||
#include <mbgl/layer/layer_impl.hpp>
|
||||
#include <mbgl/style/style_render_parameters.hpp>
|
||||
#include <mbgl/style/layer_impl.hpp>
|
||||
|
||||
#include <mbgl/layer/background_layer.hpp>
|
||||
#include <mbgl/layer/custom_layer.hpp>
|
||||
#include <mbgl/layer/custom_layer_impl.hpp>
|
||||
#include <mbgl/style/layers/background_layer.hpp>
|
||||
#include <mbgl/style/layers/custom_layer.hpp>
|
||||
#include <mbgl/style/layers/custom_layer_impl.hpp>
|
||||
|
||||
#include <mbgl/sprite/sprite_atlas.hpp>
|
||||
#include <mbgl/geometry/line_atlas.hpp>
|
||||
@@ -46,7 +45,9 @@
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
||||
using namespace mbgl;
|
||||
namespace mbgl {
|
||||
|
||||
using namespace style;
|
||||
|
||||
Painter::Painter(const TransformState& state_, gl::ObjectStore& store_)
|
||||
: state(state_),
|
||||
@@ -308,3 +309,5 @@ void Painter::setDepthSublayer(int n) {
|
||||
float farDepth = nearDepth + depthRangeSize;
|
||||
config.depthRange = { nearDepth, farDepth };
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <mbgl/gl/gl_config.hpp>
|
||||
|
||||
#include <mbgl/style/render_item.hpp>
|
||||
#include <mbgl/style/types.hpp>
|
||||
#include <mbgl/style/style.hpp>
|
||||
|
||||
#include <mbgl/gl/gl.hpp>
|
||||
|
||||
@@ -28,27 +28,19 @@
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
class Style;
|
||||
class Tile;
|
||||
class SpriteAtlas;
|
||||
class GlyphAtlas;
|
||||
class LineAtlas;
|
||||
class Source;
|
||||
struct FrameData;
|
||||
class TileData;
|
||||
|
||||
class DebugBucket;
|
||||
class FillBucket;
|
||||
class FillLayer;
|
||||
class LineBucket;
|
||||
class LineLayer;
|
||||
class CircleBucket;
|
||||
class CircleLayer;
|
||||
class SymbolBucket;
|
||||
class SymbolLayer;
|
||||
class RasterBucket;
|
||||
class RasterLayer;
|
||||
class BackgroundLayer;
|
||||
|
||||
class SDFShader;
|
||||
class PlainShader;
|
||||
@@ -72,6 +64,17 @@ namespace util {
|
||||
class ObjectStore;
|
||||
}
|
||||
|
||||
namespace style {
|
||||
class Style;
|
||||
class Source;
|
||||
class FillLayer;
|
||||
class LineLayer;
|
||||
class CircleLayer;
|
||||
class SymbolLayer;
|
||||
class RasterLayer;
|
||||
class BackgroundLayer;
|
||||
}
|
||||
|
||||
struct FrameData {
|
||||
std::array<uint16_t, 2> framebufferSize;
|
||||
TimePoint timePoint;
|
||||
@@ -86,8 +89,8 @@ public:
|
||||
Painter(const TransformState&, gl::ObjectStore&);
|
||||
~Painter();
|
||||
|
||||
void render(const Style& style,
|
||||
const FrameData& frame,
|
||||
void render(const style::Style&,
|
||||
const FrameData&,
|
||||
SpriteAtlas& annotationSpriteAtlas);
|
||||
|
||||
// Renders debug information for a tile.
|
||||
@@ -99,12 +102,12 @@ public:
|
||||
void renderClipMasks();
|
||||
|
||||
void renderDebugText(TileData&, const mat4&);
|
||||
void renderFill(FillBucket&, const FillLayer&, const UnwrappedTileID&, const mat4&);
|
||||
void renderLine(LineBucket&, const LineLayer&, const UnwrappedTileID&, const mat4&);
|
||||
void renderCircle(CircleBucket&, const CircleLayer&, const UnwrappedTileID&, const mat4&);
|
||||
void renderSymbol(SymbolBucket&, const SymbolLayer&, const UnwrappedTileID&, const mat4&);
|
||||
void renderRaster(RasterBucket&, const RasterLayer&, const UnwrappedTileID&, const mat4&);
|
||||
void renderBackground(const BackgroundLayer&);
|
||||
void renderFill(FillBucket&, const style::FillLayer&, const UnwrappedTileID&, const mat4&);
|
||||
void renderLine(LineBucket&, const style::LineLayer&, const UnwrappedTileID&, const mat4&);
|
||||
void renderCircle(CircleBucket&, const style::CircleLayer&, const UnwrappedTileID&, const mat4&);
|
||||
void renderSymbol(SymbolBucket&, const style::SymbolLayer&, const UnwrappedTileID&, const mat4&);
|
||||
void renderRaster(RasterBucket&, const style::RasterLayer&, const UnwrappedTileID&, const mat4&);
|
||||
void renderBackground(const style::BackgroundLayer&);
|
||||
|
||||
float saturationFactor(float saturation);
|
||||
float contrastFactor(float contrast);
|
||||
@@ -118,9 +121,9 @@ private:
|
||||
mat4 translatedMatrix(const mat4& matrix,
|
||||
const std::array<float, 2>& translation,
|
||||
const UnwrappedTileID& id,
|
||||
TranslateAnchorType anchor);
|
||||
style::TranslateAnchorType anchor);
|
||||
|
||||
std::vector<RenderItem> determineRenderOrder(const Style& style);
|
||||
std::vector<RenderItem> determineRenderOrder(const style::Style&);
|
||||
|
||||
template <class Iterator>
|
||||
void renderPass(RenderPass,
|
||||
@@ -138,7 +141,7 @@ private:
|
||||
void (SymbolBucket::*drawSDF)(SDFShader&, gl::ObjectStore&),
|
||||
|
||||
// Layout
|
||||
RotationAlignmentType rotationAlignment,
|
||||
style::RotationAlignmentType rotationAlignment,
|
||||
float layoutSize,
|
||||
|
||||
// Paint
|
||||
@@ -148,7 +151,7 @@ private:
|
||||
float haloWidth,
|
||||
float haloBlur,
|
||||
std::array<float, 2> translate,
|
||||
TranslateAnchorType translateAnchor,
|
||||
style::TranslateAnchorType translateAnchor,
|
||||
float paintSize);
|
||||
|
||||
void setDepthSublayer(int n);
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
#include <mbgl/renderer/painter.hpp>
|
||||
|
||||
#include <mbgl/layer/background_layer.hpp>
|
||||
#include <mbgl/layer/background_layer_impl.hpp>
|
||||
#include <mbgl/style/layers/background_layer.hpp>
|
||||
#include <mbgl/style/layers/background_layer_impl.hpp>
|
||||
#include <mbgl/shader/pattern_shader.hpp>
|
||||
#include <mbgl/shader/plain_shader.hpp>
|
||||
#include <mbgl/sprite/sprite_atlas.hpp>
|
||||
#include <mbgl/util/mat4.hpp>
|
||||
#include <mbgl/util/tile_cover.hpp>
|
||||
|
||||
using namespace mbgl;
|
||||
namespace mbgl {
|
||||
|
||||
using namespace style;
|
||||
|
||||
void Painter::renderBackground(const BackgroundLayer& layer) {
|
||||
// Note that for bottommost layers without a pattern, the background color is drawn with
|
||||
@@ -107,3 +109,5 @@ void Painter::renderBackground(const BackgroundLayer& layer) {
|
||||
MBGL_CHECK_ERROR(glDrawArrays(GL_TRIANGLE_STRIP, 0, (GLsizei)tileStencilBuffer.index()));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
#include <mbgl/renderer/painter.hpp>
|
||||
#include <mbgl/renderer/circle_bucket.hpp>
|
||||
|
||||
#include <mbgl/layer/circle_layer.hpp>
|
||||
#include <mbgl/layer/circle_layer_impl.hpp>
|
||||
#include <mbgl/style/layers/circle_layer.hpp>
|
||||
#include <mbgl/style/layers/circle_layer_impl.hpp>
|
||||
|
||||
#include <mbgl/shader/circle_shader.hpp>
|
||||
|
||||
using namespace mbgl;
|
||||
namespace mbgl {
|
||||
|
||||
using namespace style;
|
||||
|
||||
void Painter::renderCircle(CircleBucket& bucket,
|
||||
const CircleLayer& layer,
|
||||
@@ -43,3 +45,5 @@ void Painter::renderCircle(CircleBucket& bucket,
|
||||
|
||||
bucket.drawCircles(*circleShader, store);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <mbgl/renderer/painter.hpp>
|
||||
#include <mbgl/source/source.hpp>
|
||||
#include <mbgl/style/source.hpp>
|
||||
#include <mbgl/shader/plain_shader.hpp>
|
||||
#include <mbgl/util/clip_id.hpp>
|
||||
#include <mbgl/util/string.hpp>
|
||||
|
||||
@@ -1,14 +1,16 @@
|
||||
#include <mbgl/renderer/painter.hpp>
|
||||
#include <mbgl/renderer/fill_bucket.hpp>
|
||||
#include <mbgl/layer/fill_layer.hpp>
|
||||
#include <mbgl/layer/fill_layer_impl.hpp>
|
||||
#include <mbgl/style/layers/fill_layer.hpp>
|
||||
#include <mbgl/style/layers/fill_layer_impl.hpp>
|
||||
#include <mbgl/sprite/sprite_atlas.hpp>
|
||||
#include <mbgl/shader/outline_shader.hpp>
|
||||
#include <mbgl/shader/outlinepattern_shader.hpp>
|
||||
#include <mbgl/shader/pattern_shader.hpp>
|
||||
#include <mbgl/shader/plain_shader.hpp>
|
||||
|
||||
using namespace mbgl;
|
||||
namespace mbgl {
|
||||
|
||||
using namespace style;
|
||||
|
||||
void Painter::renderFill(FillBucket& bucket,
|
||||
const FillLayer& layer,
|
||||
@@ -195,3 +197,5 @@ void Painter::renderFill(FillBucket& bucket,
|
||||
bucket.drawVertices(*outlineShader, store);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <mbgl/renderer/painter.hpp>
|
||||
#include <mbgl/renderer/line_bucket.hpp>
|
||||
#include <mbgl/layer/line_layer.hpp>
|
||||
#include <mbgl/layer/line_layer_impl.hpp>
|
||||
#include <mbgl/style/layers/line_layer.hpp>
|
||||
#include <mbgl/style/layers/line_layer_impl.hpp>
|
||||
#include <mbgl/shader/line_shader.hpp>
|
||||
#include <mbgl/shader/linesdf_shader.hpp>
|
||||
#include <mbgl/shader/linepattern_shader.hpp>
|
||||
@@ -9,7 +9,9 @@
|
||||
#include <mbgl/geometry/line_atlas.hpp>
|
||||
#include <mbgl/util/mat2.hpp>
|
||||
|
||||
using namespace mbgl;
|
||||
namespace mbgl {
|
||||
|
||||
using namespace style;
|
||||
|
||||
void Painter::renderLine(LineBucket& bucket,
|
||||
const LineLayer& layer,
|
||||
@@ -161,3 +163,5 @@ void Painter::renderLine(LineBucket& bucket,
|
||||
bucket.drawLines(*lineShader, store);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
#include <mbgl/renderer/painter.hpp>
|
||||
#include <mbgl/gl/gl.hpp>
|
||||
#include <mbgl/renderer/raster_bucket.hpp>
|
||||
#include <mbgl/layer/raster_layer.hpp>
|
||||
#include <mbgl/layer/raster_layer_impl.hpp>
|
||||
#include <mbgl/style/layers/raster_layer.hpp>
|
||||
#include <mbgl/style/layers/raster_layer_impl.hpp>
|
||||
#include <mbgl/shader/raster_shader.hpp>
|
||||
|
||||
using namespace mbgl;
|
||||
namespace mbgl {
|
||||
|
||||
using namespace style;
|
||||
|
||||
void Painter::renderRaster(RasterBucket& bucket,
|
||||
const RasterLayer& layer,
|
||||
@@ -66,3 +68,5 @@ std::array<float, 3> Painter::spinWeights(float spin) {
|
||||
}};
|
||||
return spin_weights;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <mbgl/renderer/painter.hpp>
|
||||
#include <mbgl/renderer/symbol_bucket.hpp>
|
||||
#include <mbgl/layer/symbol_layer.hpp>
|
||||
#include <mbgl/style/layers/symbol_layer.hpp>
|
||||
#include <mbgl/style/layers/symbol_layer_impl.hpp>
|
||||
#include <mbgl/geometry/glyph_atlas.hpp>
|
||||
#include <mbgl/sprite/sprite_atlas.hpp>
|
||||
#include <mbgl/shader/sdf_shader.hpp>
|
||||
@@ -10,7 +11,9 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
using namespace mbgl;
|
||||
namespace mbgl {
|
||||
|
||||
using namespace style;
|
||||
|
||||
void Painter::renderSDF(SymbolBucket &bucket,
|
||||
const UnwrappedTileID &tileID,
|
||||
@@ -257,3 +260,5 @@ void Painter::renderSymbol(SymbolBucket& bucket,
|
||||
|
||||
config.activeTexture = GL_TEXTURE0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
#include <mbgl/renderer/raster_bucket.hpp>
|
||||
#include <mbgl/layer/raster_layer.hpp>
|
||||
#include <mbgl/style/layers/raster_layer.hpp>
|
||||
#include <mbgl/shader/raster_shader.hpp>
|
||||
#include <mbgl/renderer/painter.hpp>
|
||||
|
||||
using namespace mbgl;
|
||||
namespace mbgl {
|
||||
|
||||
using namespace style;
|
||||
|
||||
RasterBucket::RasterBucket(gl::TexturePool& texturePool)
|
||||
: raster(texturePool) {
|
||||
@@ -40,3 +42,5 @@ bool RasterBucket::hasData() const {
|
||||
bool RasterBucket::needsClipping() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ public:
|
||||
RasterBucket(gl::TexturePool&);
|
||||
|
||||
void upload(gl::ObjectStore&) override;
|
||||
void render(Painter&, const Layer&, const UnwrappedTileID&, const mat4&) override;
|
||||
void render(Painter&, const style::Layer&, const UnwrappedTileID&, const mat4&) override;
|
||||
bool hasData() const override;
|
||||
bool needsClipping() const override;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include <mbgl/renderer/symbol_bucket.hpp>
|
||||
#include <mbgl/style/filter_evaluator.hpp>
|
||||
#include <mbgl/layer/symbol_layer.hpp>
|
||||
#include <mbgl/style/layers/symbol_layer.hpp>
|
||||
#include <mbgl/tile/geometry_tile.hpp>
|
||||
#include <mbgl/sprite/sprite_image.hpp>
|
||||
#include <mbgl/sprite/sprite_store.hpp>
|
||||
@@ -31,6 +31,8 @@
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
using namespace style;
|
||||
|
||||
SymbolInstance::SymbolInstance(Anchor& anchor, const GeometryCoordinates& line,
|
||||
const Shaping& shapedText, const PositionedIcon& shapedIcon,
|
||||
const SymbolLayoutProperties& layout, const bool addToBuffers, const uint32_t index_,
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <mbgl/text/shaping.hpp>
|
||||
#include <mbgl/text/quads.hpp>
|
||||
#include <mbgl/style/filter.hpp>
|
||||
#include <mbgl/layer/symbol_layer_impl.hpp>
|
||||
#include <mbgl/style/layers/symbol_layer_properties.hpp>
|
||||
|
||||
#include <memory>
|
||||
#include <map>
|
||||
@@ -46,7 +46,7 @@ class SymbolInstance {
|
||||
public:
|
||||
explicit SymbolInstance(Anchor& anchor, const GeometryCoordinates& line,
|
||||
const Shaping& shapedText, const PositionedIcon& shapedIcon,
|
||||
const SymbolLayoutProperties& layout, const bool inside, const uint32_t index,
|
||||
const style::SymbolLayoutProperties&, const bool inside, const uint32_t index,
|
||||
const float textBoxScale, const float textPadding, const float textAlongLine,
|
||||
const float iconBoxScale, const float iconPadding, const float iconAlongLine,
|
||||
const GlyphPositions& face, const IndexedSubfeature& indexedfeature);
|
||||
@@ -70,7 +70,7 @@ public:
|
||||
~SymbolBucket() override;
|
||||
|
||||
void upload(gl::ObjectStore&) override;
|
||||
void render(Painter&, const Layer&, const UnwrappedTileID&, const mat4&) override;
|
||||
void render(Painter&, const style::Layer&, const UnwrappedTileID&, const mat4&) override;
|
||||
bool hasData() const override;
|
||||
bool hasTextData() const;
|
||||
bool hasIconData() const;
|
||||
@@ -87,7 +87,7 @@ public:
|
||||
void drawIcons(IconShader&, gl::ObjectStore&);
|
||||
void drawCollisionBoxes(CollisionBoxShader&, gl::ObjectStore&);
|
||||
|
||||
void parseFeatures(const GeometryTileLayer&, const Filter&);
|
||||
void parseFeatures(const GeometryTileLayer&, const style::Filter&);
|
||||
bool needsDependencies(GlyphStore&, SpriteStore&);
|
||||
void placeFeatures(CollisionTile&) override;
|
||||
|
||||
@@ -109,7 +109,7 @@ private:
|
||||
const bool keepUpright, const bool alongLine, const float placementAngle);
|
||||
|
||||
public:
|
||||
SymbolLayoutProperties layout;
|
||||
style::SymbolLayoutProperties layout;
|
||||
|
||||
float iconMaxSize = 1.0f;
|
||||
float textMaxSize = 16.0f;
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#include <mbgl/style/style_bucket_parameters.hpp>
|
||||
#include <mbgl/style/bucket_parameters.hpp>
|
||||
#include <mbgl/style/filter_evaluator.hpp>
|
||||
#include <mbgl/tile/geometry_tile.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
void StyleBucketParameters::eachFilteredFeature(const Filter& filter,
|
||||
void BucketParameters::eachFilteredFeature(const Filter& filter,
|
||||
std::function<void (const GeometryTileFeature&, std::size_t index, const std::string& layerName)> function) {
|
||||
auto name = layer.getName();
|
||||
for (std::size_t i = 0; !cancelled() && i < layer.featureCount(); i++) {
|
||||
@@ -18,4 +19,5 @@ void StyleBucketParameters::eachFilteredFeature(const Filter& filter,
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -18,9 +18,11 @@ class GlyphStore;
|
||||
class CollisionTile;
|
||||
class FeatureIndex;
|
||||
|
||||
class StyleBucketParameters {
|
||||
namespace style {
|
||||
|
||||
class BucketParameters {
|
||||
public:
|
||||
StyleBucketParameters(const OverscaledTileID& tileID_,
|
||||
BucketParameters(const OverscaledTileID& tileID_,
|
||||
const GeometryTileLayer& layer_,
|
||||
const std::atomic<bool>& obsolete_,
|
||||
uintptr_t tileUID_,
|
||||
@@ -59,4 +61,5 @@ public:
|
||||
const MapMode mode;
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
30
src/mbgl/style/calculation_parameters.hpp
Normal file
30
src/mbgl/style/calculation_parameters.hpp
Normal file
@@ -0,0 +1,30 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/map/zoom_history.hpp>
|
||||
#include <mbgl/util/chrono.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
class CalculationParameters {
|
||||
public:
|
||||
explicit CalculationParameters(float z_)
|
||||
: z(z_) {}
|
||||
|
||||
CalculationParameters(float z_,
|
||||
const TimePoint& now_,
|
||||
const ZoomHistory& zoomHistory_,
|
||||
const Duration& defaultFadeDuration_)
|
||||
: z(z_),
|
||||
now(now_),
|
||||
zoomHistory(zoomHistory_),
|
||||
defaultFadeDuration(defaultFadeDuration_) {}
|
||||
|
||||
float z;
|
||||
TimePoint now;
|
||||
ZoomHistory zoomHistory;
|
||||
Duration defaultFadeDuration;
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
22
src/mbgl/style/cascade_parameters.hpp
Normal file
22
src/mbgl/style/cascade_parameters.hpp
Normal file
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/util/chrono.hpp>
|
||||
#include <mbgl/style/class_dictionary.hpp>
|
||||
#include <mbgl/style/transition_options.hpp>
|
||||
|
||||
#include <vector>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
class TransitionOptions;
|
||||
|
||||
class CascadeParameters {
|
||||
public:
|
||||
std::vector<ClassID> classes;
|
||||
TimePoint now;
|
||||
TransitionOptions transition;
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -3,6 +3,7 @@
|
||||
#include <pthread.h>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
ClassDictionary::ClassDictionary() {}
|
||||
|
||||
@@ -46,4 +47,5 @@ ClassID ClassDictionary::normalize(ClassID id) {
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <unordered_map>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
enum class ClassID : uint32_t {
|
||||
Fallback = 0, // These values are from the fallback properties
|
||||
@@ -31,4 +32,5 @@ private:
|
||||
uint32_t offset = 0;
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include <type_traits>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
class FilterEvaluator {
|
||||
public:
|
||||
@@ -159,3 +160,4 @@ private:
|
||||
};
|
||||
|
||||
} // namespace mbgl
|
||||
} // namespace mbgl
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#include <mbgl/style/layer.hpp>
|
||||
#include <mbgl/layer/layer_impl.hpp>
|
||||
#include <mbgl/style/layer_impl.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
Layer::Layer(Type type_, std::unique_ptr<Impl> baseImpl_)
|
||||
: baseImpl(std::move(baseImpl_)), type(type_) {
|
||||
@@ -45,4 +46,5 @@ std::unique_ptr<Layer> Layer::copy(const std::string& id,
|
||||
return result;
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -1,6 +1,7 @@
|
||||
#include <mbgl/layer/layer_impl.hpp>
|
||||
#include <mbgl/style/layer_impl.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
const std::string& Layer::Impl::bucketName() const {
|
||||
return ref.empty() ? id : ref;
|
||||
@@ -14,4 +15,5 @@ bool Layer::Impl::needsRendering() const {
|
||||
return passes != RenderPass::None && visibility != VisibilityType::None;
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -14,11 +14,14 @@
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
class StyleCascadeParameters;
|
||||
class StyleCalculationParameters;
|
||||
class StyleBucketParameters;
|
||||
class Bucket;
|
||||
|
||||
namespace style {
|
||||
|
||||
class CascadeParameters;
|
||||
class CalculationParameters;
|
||||
class BucketParameters;
|
||||
|
||||
/**
|
||||
* `Layer::Impl` contains the internal implementation of `Layer`: the details that need to be accessible to other parts
|
||||
* of the code, but hidden from the public API. Like `Layer`, it is an abstract base class, with derived classes for
|
||||
@@ -44,13 +47,13 @@ public:
|
||||
const std::string& bucketName() const;
|
||||
|
||||
// Partially evaluate paint properties based on a set of classes.
|
||||
virtual void cascade(const StyleCascadeParameters&) = 0;
|
||||
virtual void cascade(const CascadeParameters&) = 0;
|
||||
|
||||
// Fully evaluate cascaded paint properties based on a zoom level.
|
||||
// Returns true if any paint properties have active transitions.
|
||||
virtual bool recalculate(const StyleCalculationParameters&) = 0;
|
||||
virtual bool recalculate(const CalculationParameters&) = 0;
|
||||
|
||||
virtual std::unique_ptr<Bucket> createBucket(StyleBucketParameters&) const = 0;
|
||||
virtual std::unique_ptr<Bucket> createBucket(BucketParameters&) const = 0;
|
||||
|
||||
// Checks whether this layer needs to be rendered in the given render pass.
|
||||
bool hasRenderPass(RenderPass) const;
|
||||
@@ -85,4 +88,5 @@ protected:
|
||||
RenderPass passes = RenderPass::None;
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -1,9 +1,10 @@
|
||||
// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
|
||||
|
||||
#include <mbgl/layer/background_layer.hpp>
|
||||
#include <mbgl/layer/background_layer_impl.hpp>
|
||||
#include <mbgl/style/layers/background_layer.hpp>
|
||||
#include <mbgl/style/layers/background_layer_impl.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
BackgroundLayer::BackgroundLayer(const std::string& layerID)
|
||||
: Layer(Type::Background, std::make_unique<Impl>())
|
||||
@@ -52,4 +53,5 @@ void BackgroundLayer::setBackgroundOpacity(PropertyValue<float> value) {
|
||||
impl->paint.backgroundOpacity.set(value);
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -1,17 +1,18 @@
|
||||
#include <mbgl/layer/background_layer_impl.hpp>
|
||||
#include <mbgl/style/layers/background_layer_impl.hpp>
|
||||
#include <mbgl/renderer/bucket.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
void BackgroundLayer::Impl::parsePaints(const JSValue& layer) {
|
||||
paint.parse(layer);
|
||||
}
|
||||
|
||||
void BackgroundLayer::Impl::cascade(const StyleCascadeParameters& parameters) {
|
||||
void BackgroundLayer::Impl::cascade(const CascadeParameters& parameters) {
|
||||
paint.cascade(parameters);
|
||||
}
|
||||
|
||||
bool BackgroundLayer::Impl::recalculate(const StyleCalculationParameters& parameters) {
|
||||
bool BackgroundLayer::Impl::recalculate(const CalculationParameters& parameters) {
|
||||
bool hasTransitions = paint.recalculate(parameters);
|
||||
|
||||
passes = paint.backgroundOpacity > 0 ? RenderPass::Translucent : RenderPass::None;
|
||||
@@ -19,8 +20,9 @@ bool BackgroundLayer::Impl::recalculate(const StyleCalculationParameters& parame
|
||||
return hasTransitions;
|
||||
}
|
||||
|
||||
std::unique_ptr<Bucket> BackgroundLayer::Impl::createBucket(StyleBucketParameters&) const {
|
||||
std::unique_ptr<Bucket> BackgroundLayer::Impl::createBucket(BucketParameters&) const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
26
src/mbgl/style/layers/background_layer_impl.hpp
Normal file
26
src/mbgl/style/layers/background_layer_impl.hpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/style/layer_impl.hpp>
|
||||
#include <mbgl/style/layers/background_layer.hpp>
|
||||
#include <mbgl/style/layers/background_layer_properties.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
class BackgroundLayer::Impl : public Layer::Impl {
|
||||
public:
|
||||
std::unique_ptr<Layer> clone() const override;
|
||||
|
||||
void parseLayout(const JSValue&) override {};
|
||||
void parsePaints(const JSValue&) override;
|
||||
|
||||
void cascade(const CascadeParameters&) override;
|
||||
bool recalculate(const CalculationParameters&) override;
|
||||
|
||||
std::unique_ptr<Bucket> createBucket(BucketParameters&) const override;
|
||||
|
||||
BackgroundPaintProperties paint;
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -1,8 +1,9 @@
|
||||
// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
|
||||
|
||||
#include <mbgl/layer/background_layer_properties.hpp>
|
||||
#include <mbgl/style/layers/background_layer_properties.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
void BackgroundPaintProperties::parse(const JSValue& value) {
|
||||
backgroundColor.parse("background-color", value);
|
||||
@@ -10,13 +11,13 @@ void BackgroundPaintProperties::parse(const JSValue& value) {
|
||||
backgroundOpacity.parse("background-opacity", value);
|
||||
}
|
||||
|
||||
void BackgroundPaintProperties::cascade(const StyleCascadeParameters& parameters) {
|
||||
void BackgroundPaintProperties::cascade(const CascadeParameters& parameters) {
|
||||
backgroundColor.cascade(parameters);
|
||||
backgroundPattern.cascade(parameters);
|
||||
backgroundOpacity.cascade(parameters);
|
||||
}
|
||||
|
||||
bool BackgroundPaintProperties::recalculate(const StyleCalculationParameters& parameters) {
|
||||
bool BackgroundPaintProperties::recalculate(const CalculationParameters& parameters) {
|
||||
bool hasTransitions = false;
|
||||
|
||||
hasTransitions |= backgroundColor.calculate(parameters);
|
||||
@@ -26,4 +27,5 @@ bool BackgroundPaintProperties::recalculate(const StyleCalculationParameters& pa
|
||||
return hasTransitions;
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -7,19 +7,21 @@
|
||||
#include <mbgl/util/rapidjson.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
class StyleCascadeParameters;
|
||||
class StyleCalculationParameters;
|
||||
class CascadeParameters;
|
||||
class CalculationParameters;
|
||||
|
||||
class BackgroundPaintProperties {
|
||||
public:
|
||||
void parse(const JSValue&);
|
||||
void cascade(const StyleCascadeParameters&);
|
||||
bool recalculate(const StyleCalculationParameters&);
|
||||
void cascade(const CascadeParameters&);
|
||||
bool recalculate(const CalculationParameters&);
|
||||
|
||||
PaintProperty<Color> backgroundColor { {{ 0, 0, 0, 1 }} };
|
||||
PaintProperty<std::string, CrossFadedPropertyEvaluator> backgroundPattern { "" };
|
||||
PaintProperty<float> backgroundOpacity { 1 };
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -1,9 +1,10 @@
|
||||
// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
|
||||
|
||||
#include <mbgl/layer/circle_layer.hpp>
|
||||
#include <mbgl/layer/circle_layer_impl.hpp>
|
||||
#include <mbgl/style/layers/circle_layer.hpp>
|
||||
#include <mbgl/style/layers/circle_layer_impl.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
CircleLayer::CircleLayer(const std::string& layerID)
|
||||
: Layer(Type::Circle, std::make_unique<Impl>())
|
||||
@@ -100,4 +101,5 @@ void CircleLayer::setCircleTranslateAnchor(PropertyValue<TranslateAnchorType> va
|
||||
impl->paint.circleTranslateAnchor.set(value);
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -1,21 +1,22 @@
|
||||
#include <mbgl/layer/circle_layer_impl.hpp>
|
||||
#include <mbgl/style/style_bucket_parameters.hpp>
|
||||
#include <mbgl/style/layers/circle_layer_impl.hpp>
|
||||
#include <mbgl/style/bucket_parameters.hpp>
|
||||
#include <mbgl/renderer/circle_bucket.hpp>
|
||||
#include <mbgl/geometry/feature_index.hpp>
|
||||
#include <mbgl/util/math.hpp>
|
||||
#include <mbgl/util/intersection_tests.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
void CircleLayer::Impl::parsePaints(const JSValue& layer) {
|
||||
paint.parse(layer);
|
||||
}
|
||||
|
||||
void CircleLayer::Impl::cascade(const StyleCascadeParameters& parameters) {
|
||||
void CircleLayer::Impl::cascade(const CascadeParameters& parameters) {
|
||||
paint.cascade(parameters);
|
||||
}
|
||||
|
||||
bool CircleLayer::Impl::recalculate(const StyleCalculationParameters& parameters) {
|
||||
bool CircleLayer::Impl::recalculate(const CalculationParameters& parameters) {
|
||||
bool hasTransitions = paint.recalculate(parameters);
|
||||
|
||||
passes = (paint.circleRadius > 0 && paint.circleColor.value[3] > 0 && paint.circleOpacity > 0)
|
||||
@@ -24,7 +25,7 @@ bool CircleLayer::Impl::recalculate(const StyleCalculationParameters& parameters
|
||||
return hasTransitions;
|
||||
}
|
||||
|
||||
std::unique_ptr<Bucket> CircleLayer::Impl::createBucket(StyleBucketParameters& parameters) const {
|
||||
std::unique_ptr<Bucket> CircleLayer::Impl::createBucket(BucketParameters& parameters) const {
|
||||
auto bucket = std::make_unique<CircleBucket>(parameters.mode);
|
||||
|
||||
auto& name = bucketName();
|
||||
@@ -57,4 +58,5 @@ bool CircleLayer::Impl::queryIntersectsGeometry(
|
||||
translatedQueryGeometry.value_or(queryGeometry), geometry, circleRadius);
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -1,10 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/layer/layer_impl.hpp>
|
||||
#include <mbgl/layer/circle_layer.hpp>
|
||||
#include <mbgl/layer/circle_layer_properties.hpp>
|
||||
#include <mbgl/style/layer_impl.hpp>
|
||||
#include <mbgl/style/layers/circle_layer.hpp>
|
||||
#include <mbgl/style/layers/circle_layer_properties.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
class CircleLayer::Impl : public Layer::Impl {
|
||||
public:
|
||||
@@ -13,10 +14,10 @@ public:
|
||||
void parseLayout(const JSValue&) override {};
|
||||
void parsePaints(const JSValue&) override;
|
||||
|
||||
void cascade(const StyleCascadeParameters&) override;
|
||||
bool recalculate(const StyleCalculationParameters&) override;
|
||||
void cascade(const CascadeParameters&) override;
|
||||
bool recalculate(const CalculationParameters&) override;
|
||||
|
||||
std::unique_ptr<Bucket> createBucket(StyleBucketParameters&) const override;
|
||||
std::unique_ptr<Bucket> createBucket(BucketParameters&) const override;
|
||||
|
||||
float getQueryRadius() const override;
|
||||
bool queryIntersectsGeometry(
|
||||
@@ -28,4 +29,5 @@ public:
|
||||
CirclePaintProperties paint;
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -1,8 +1,9 @@
|
||||
// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
|
||||
|
||||
#include <mbgl/layer/circle_layer_properties.hpp>
|
||||
#include <mbgl/style/layers/circle_layer_properties.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
void CirclePaintProperties::parse(const JSValue& value) {
|
||||
circleRadius.parse("circle-radius", value);
|
||||
@@ -13,7 +14,7 @@ void CirclePaintProperties::parse(const JSValue& value) {
|
||||
circleTranslateAnchor.parse("circle-translate-anchor", value);
|
||||
}
|
||||
|
||||
void CirclePaintProperties::cascade(const StyleCascadeParameters& parameters) {
|
||||
void CirclePaintProperties::cascade(const CascadeParameters& parameters) {
|
||||
circleRadius.cascade(parameters);
|
||||
circleColor.cascade(parameters);
|
||||
circleBlur.cascade(parameters);
|
||||
@@ -22,7 +23,7 @@ void CirclePaintProperties::cascade(const StyleCascadeParameters& parameters) {
|
||||
circleTranslateAnchor.cascade(parameters);
|
||||
}
|
||||
|
||||
bool CirclePaintProperties::recalculate(const StyleCalculationParameters& parameters) {
|
||||
bool CirclePaintProperties::recalculate(const CalculationParameters& parameters) {
|
||||
bool hasTransitions = false;
|
||||
|
||||
hasTransitions |= circleRadius.calculate(parameters);
|
||||
@@ -35,4 +36,5 @@ bool CirclePaintProperties::recalculate(const StyleCalculationParameters& parame
|
||||
return hasTransitions;
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -7,15 +7,16 @@
|
||||
#include <mbgl/util/rapidjson.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
class StyleCascadeParameters;
|
||||
class StyleCalculationParameters;
|
||||
class CascadeParameters;
|
||||
class CalculationParameters;
|
||||
|
||||
class CirclePaintProperties {
|
||||
public:
|
||||
void parse(const JSValue&);
|
||||
void cascade(const StyleCascadeParameters&);
|
||||
bool recalculate(const StyleCalculationParameters&);
|
||||
void cascade(const CascadeParameters&);
|
||||
bool recalculate(const CalculationParameters&);
|
||||
|
||||
PaintProperty<float> circleRadius { 5 };
|
||||
PaintProperty<Color> circleColor { {{ 0, 0, 0, 1 }} };
|
||||
@@ -25,4 +26,5 @@ public:
|
||||
PaintProperty<TranslateAnchorType> circleTranslateAnchor { TranslateAnchorType::Map };
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -1,7 +1,8 @@
|
||||
#include <mbgl/layer/custom_layer.hpp>
|
||||
#include <mbgl/layer/custom_layer_impl.hpp>
|
||||
#include <mbgl/style/layers/custom_layer.hpp>
|
||||
#include <mbgl/style/layers/custom_layer_impl.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
CustomLayer::CustomLayer(const std::string& layerID,
|
||||
CustomLayerInitializeFunction init,
|
||||
@@ -19,4 +20,5 @@ CustomLayer::CustomLayer(const Impl& other)
|
||||
|
||||
CustomLayer::~CustomLayer() = default;
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -1,8 +1,9 @@
|
||||
#include <mbgl/layer/custom_layer_impl.hpp>
|
||||
#include <mbgl/style/layers/custom_layer_impl.hpp>
|
||||
#include <mbgl/renderer/bucket.hpp>
|
||||
#include <mbgl/map/transform_state.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
CustomLayer::Impl::Impl(const std::string& id_,
|
||||
CustomLayerInitializeFunction initializeFn_,
|
||||
@@ -54,13 +55,14 @@ void CustomLayer::Impl::render(const TransformState& state) const {
|
||||
renderFn(context, parameters);
|
||||
}
|
||||
|
||||
bool CustomLayer::Impl::recalculate(const StyleCalculationParameters&) {
|
||||
bool CustomLayer::Impl::recalculate(const CalculationParameters&) {
|
||||
passes = RenderPass::Translucent;
|
||||
return false;
|
||||
}
|
||||
|
||||
std::unique_ptr<Bucket> CustomLayer::Impl::createBucket(StyleBucketParameters&) const {
|
||||
std::unique_ptr<Bucket> CustomLayer::Impl::createBucket(BucketParameters&) const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -1,12 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/layer/layer_impl.hpp>
|
||||
#include <mbgl/layer/custom_layer.hpp>
|
||||
#include <mbgl/style/layer_impl.hpp>
|
||||
#include <mbgl/style/layers/custom_layer.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
|
||||
class TransformState;
|
||||
|
||||
namespace style {
|
||||
|
||||
class CustomLayer::Impl : public Layer::Impl {
|
||||
public:
|
||||
Impl(const std::string& id,
|
||||
@@ -27,10 +29,10 @@ private:
|
||||
void parseLayout(const JSValue&) final {}
|
||||
void parsePaints(const JSValue&) final {}
|
||||
|
||||
void cascade(const StyleCascadeParameters&) final {}
|
||||
bool recalculate(const StyleCalculationParameters&) final;
|
||||
void cascade(const CascadeParameters&) final {}
|
||||
bool recalculate(const CalculationParameters&) final;
|
||||
|
||||
std::unique_ptr<Bucket> createBucket(StyleBucketParameters&) const final;
|
||||
std::unique_ptr<Bucket> createBucket(BucketParameters&) const final;
|
||||
|
||||
CustomLayerInitializeFunction initializeFn = nullptr;
|
||||
CustomLayerRenderFunction renderFn = nullptr;
|
||||
@@ -38,4 +40,5 @@ private:
|
||||
void* context = nullptr;
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -1,9 +1,10 @@
|
||||
// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
|
||||
|
||||
#include <mbgl/layer/fill_layer.hpp>
|
||||
#include <mbgl/layer/fill_layer_impl.hpp>
|
||||
#include <mbgl/style/layers/fill_layer.hpp>
|
||||
#include <mbgl/style/layers/fill_layer_impl.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
FillLayer::FillLayer(const std::string& layerID)
|
||||
: Layer(Type::Fill, std::make_unique<Impl>())
|
||||
@@ -108,4 +109,5 @@ void FillLayer::setFillPattern(PropertyValue<std::string> value) {
|
||||
impl->paint.fillPattern.set(value);
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -1,21 +1,22 @@
|
||||
#include <mbgl/layer/fill_layer_impl.hpp>
|
||||
#include <mbgl/style/style_bucket_parameters.hpp>
|
||||
#include <mbgl/style/layers/fill_layer_impl.hpp>
|
||||
#include <mbgl/style/bucket_parameters.hpp>
|
||||
#include <mbgl/renderer/fill_bucket.hpp>
|
||||
#include <mbgl/geometry/feature_index.hpp>
|
||||
#include <mbgl/util/math.hpp>
|
||||
#include <mbgl/util/intersection_tests.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
void FillLayer::Impl::parsePaints(const JSValue& layer) {
|
||||
paint.parse(layer);
|
||||
}
|
||||
|
||||
void FillLayer::Impl::cascade(const StyleCascadeParameters& parameters) {
|
||||
void FillLayer::Impl::cascade(const CascadeParameters& parameters) {
|
||||
paint.cascade(parameters);
|
||||
}
|
||||
|
||||
bool FillLayer::Impl::recalculate(const StyleCalculationParameters& parameters) {
|
||||
bool FillLayer::Impl::recalculate(const CalculationParameters& parameters) {
|
||||
bool hasTransitions = paint.recalculate(parameters);
|
||||
|
||||
passes = RenderPass::None;
|
||||
@@ -33,7 +34,7 @@ bool FillLayer::Impl::recalculate(const StyleCalculationParameters& parameters)
|
||||
return hasTransitions;
|
||||
}
|
||||
|
||||
std::unique_ptr<Bucket> FillLayer::Impl::createBucket(StyleBucketParameters& parameters) const {
|
||||
std::unique_ptr<Bucket> FillLayer::Impl::createBucket(BucketParameters& parameters) const {
|
||||
auto bucket = std::make_unique<FillBucket>();
|
||||
|
||||
auto& name = bucketName();
|
||||
@@ -63,4 +64,5 @@ bool FillLayer::Impl::queryIntersectsGeometry(
|
||||
return util::multiPolygonIntersectsMultiPolygon(translatedQueryGeometry.value_or(queryGeometry), geometry);
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -1,10 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/layer/layer_impl.hpp>
|
||||
#include <mbgl/layer/fill_layer.hpp>
|
||||
#include <mbgl/layer/fill_layer_properties.hpp>
|
||||
#include <mbgl/style/layer_impl.hpp>
|
||||
#include <mbgl/style/layers/fill_layer.hpp>
|
||||
#include <mbgl/style/layers/fill_layer_properties.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
class FillLayer::Impl : public Layer::Impl {
|
||||
public:
|
||||
@@ -13,10 +14,10 @@ public:
|
||||
void parseLayout(const JSValue&) override {};
|
||||
void parsePaints(const JSValue&) override;
|
||||
|
||||
void cascade(const StyleCascadeParameters&) override;
|
||||
bool recalculate(const StyleCalculationParameters&) override;
|
||||
void cascade(const CascadeParameters&) override;
|
||||
bool recalculate(const CalculationParameters&) override;
|
||||
|
||||
std::unique_ptr<Bucket> createBucket(StyleBucketParameters&) const override;
|
||||
std::unique_ptr<Bucket> createBucket(BucketParameters&) const override;
|
||||
|
||||
float getQueryRadius() const override;
|
||||
bool queryIntersectsGeometry(
|
||||
@@ -28,4 +29,5 @@ public:
|
||||
FillPaintProperties paint;
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -1,8 +1,9 @@
|
||||
// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
|
||||
|
||||
#include <mbgl/layer/fill_layer_properties.hpp>
|
||||
#include <mbgl/style/layers/fill_layer_properties.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
void FillPaintProperties::parse(const JSValue& value) {
|
||||
fillAntialias.parse("fill-antialias", value);
|
||||
@@ -14,7 +15,7 @@ void FillPaintProperties::parse(const JSValue& value) {
|
||||
fillPattern.parse("fill-pattern", value);
|
||||
}
|
||||
|
||||
void FillPaintProperties::cascade(const StyleCascadeParameters& parameters) {
|
||||
void FillPaintProperties::cascade(const CascadeParameters& parameters) {
|
||||
fillAntialias.cascade(parameters);
|
||||
fillOpacity.cascade(parameters);
|
||||
fillColor.cascade(parameters);
|
||||
@@ -24,7 +25,7 @@ void FillPaintProperties::cascade(const StyleCascadeParameters& parameters) {
|
||||
fillPattern.cascade(parameters);
|
||||
}
|
||||
|
||||
bool FillPaintProperties::recalculate(const StyleCalculationParameters& parameters) {
|
||||
bool FillPaintProperties::recalculate(const CalculationParameters& parameters) {
|
||||
bool hasTransitions = false;
|
||||
|
||||
hasTransitions |= fillAntialias.calculate(parameters);
|
||||
@@ -38,4 +39,5 @@ bool FillPaintProperties::recalculate(const StyleCalculationParameters& paramete
|
||||
return hasTransitions;
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -7,15 +7,16 @@
|
||||
#include <mbgl/util/rapidjson.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
class StyleCascadeParameters;
|
||||
class StyleCalculationParameters;
|
||||
class CascadeParameters;
|
||||
class CalculationParameters;
|
||||
|
||||
class FillPaintProperties {
|
||||
public:
|
||||
void parse(const JSValue&);
|
||||
void cascade(const StyleCascadeParameters&);
|
||||
bool recalculate(const StyleCalculationParameters&);
|
||||
void cascade(const CascadeParameters&);
|
||||
bool recalculate(const CalculationParameters&);
|
||||
|
||||
PaintProperty<bool> fillAntialias { true };
|
||||
PaintProperty<float> fillOpacity { 1 };
|
||||
@@ -26,4 +27,5 @@ public:
|
||||
PaintProperty<std::string, CrossFadedPropertyEvaluator> fillPattern { "" };
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -1,9 +1,10 @@
|
||||
// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
|
||||
|
||||
#include <mbgl/layer/line_layer.hpp>
|
||||
#include <mbgl/layer/line_layer_impl.hpp>
|
||||
#include <mbgl/style/layers/line_layer.hpp>
|
||||
#include <mbgl/style/layers/line_layer_impl.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
LineLayer::LineLayer(const std::string& layerID)
|
||||
: Layer(Type::Line, std::make_unique<Impl>())
|
||||
@@ -160,4 +161,5 @@ void LineLayer::setLinePattern(PropertyValue<std::string> value) {
|
||||
impl->paint.linePattern.set(value);
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -1,11 +1,12 @@
|
||||
#include <mbgl/layer/line_layer_impl.hpp>
|
||||
#include <mbgl/style/style_bucket_parameters.hpp>
|
||||
#include <mbgl/style/layers/line_layer_impl.hpp>
|
||||
#include <mbgl/style/bucket_parameters.hpp>
|
||||
#include <mbgl/renderer/line_bucket.hpp>
|
||||
#include <mbgl/geometry/feature_index.hpp>
|
||||
#include <mbgl/util/math.hpp>
|
||||
#include <mbgl/util/intersection_tests.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
void LineLayer::Impl::parseLayout(const JSValue& value) {
|
||||
layout.parse(value);
|
||||
@@ -15,13 +16,13 @@ void LineLayer::Impl::parsePaints(const JSValue& layer) {
|
||||
paint.parse(layer);
|
||||
}
|
||||
|
||||
void LineLayer::Impl::cascade(const StyleCascadeParameters& parameters) {
|
||||
void LineLayer::Impl::cascade(const CascadeParameters& parameters) {
|
||||
paint.cascade(parameters);
|
||||
}
|
||||
|
||||
bool LineLayer::Impl::recalculate(const StyleCalculationParameters& parameters) {
|
||||
bool LineLayer::Impl::recalculate(const CalculationParameters& parameters) {
|
||||
// for scaling dasharrays
|
||||
StyleCalculationParameters dashArrayParams = parameters;
|
||||
CalculationParameters dashArrayParams = parameters;
|
||||
dashArrayParams.z = std::floor(dashArrayParams.z);
|
||||
paint.lineWidth.calculate(dashArrayParams);
|
||||
dashLineWidth = paint.lineWidth;
|
||||
@@ -34,11 +35,11 @@ bool LineLayer::Impl::recalculate(const StyleCalculationParameters& parameters)
|
||||
return hasTransitions;
|
||||
}
|
||||
|
||||
std::unique_ptr<Bucket> LineLayer::Impl::createBucket(StyleBucketParameters& parameters) const {
|
||||
std::unique_ptr<Bucket> LineLayer::Impl::createBucket(BucketParameters& parameters) const {
|
||||
auto bucket = std::make_unique<LineBucket>(parameters.tileID.overscaleFactor());
|
||||
|
||||
bucket->layout = layout;
|
||||
bucket->layout.recalculate(StyleCalculationParameters(parameters.tileID.overscaledZ));
|
||||
bucket->layout.recalculate(CalculationParameters(parameters.tileID.overscaledZ));
|
||||
|
||||
auto& name = bucketName();
|
||||
parameters.eachFilteredFeature(filter, [&] (const auto& feature, std::size_t index, const std::string& layerName) {
|
||||
@@ -111,4 +112,5 @@ bool LineLayer::Impl::queryIntersectsGeometry(
|
||||
halfWidth);
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -1,10 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/layer/layer_impl.hpp>
|
||||
#include <mbgl/layer/line_layer.hpp>
|
||||
#include <mbgl/layer/line_layer_properties.hpp>
|
||||
#include <mbgl/style/layer_impl.hpp>
|
||||
#include <mbgl/style/layers/line_layer.hpp>
|
||||
#include <mbgl/style/layers/line_layer_properties.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
class LineLayer::Impl : public Layer::Impl {
|
||||
public:
|
||||
@@ -13,10 +14,10 @@ public:
|
||||
void parseLayout(const JSValue&) override;
|
||||
void parsePaints(const JSValue&) override;
|
||||
|
||||
void cascade(const StyleCascadeParameters&) override;
|
||||
bool recalculate(const StyleCalculationParameters&) override;
|
||||
void cascade(const CascadeParameters&) override;
|
||||
bool recalculate(const CalculationParameters&) override;
|
||||
|
||||
std::unique_ptr<Bucket> createBucket(StyleBucketParameters&) const override;
|
||||
std::unique_ptr<Bucket> createBucket(BucketParameters&) const override;
|
||||
|
||||
float getQueryRadius() const override;
|
||||
bool queryIntersectsGeometry(
|
||||
@@ -35,4 +36,5 @@ private:
|
||||
float getLineWidth() const;
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -1,8 +1,9 @@
|
||||
// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
|
||||
|
||||
#include <mbgl/layer/line_layer_properties.hpp>
|
||||
#include <mbgl/style/layers/line_layer_properties.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
void LineLayoutProperties::parse(const JSValue& value) {
|
||||
lineCap.parse("line-cap", value);
|
||||
@@ -11,7 +12,7 @@ void LineLayoutProperties::parse(const JSValue& value) {
|
||||
lineRoundLimit.parse("line-round-limit", value);
|
||||
}
|
||||
|
||||
void LineLayoutProperties::recalculate(const StyleCalculationParameters& parameters) {
|
||||
void LineLayoutProperties::recalculate(const CalculationParameters& parameters) {
|
||||
lineCap.calculate(parameters);
|
||||
lineJoin.calculate(parameters);
|
||||
lineMiterLimit.calculate(parameters);
|
||||
@@ -31,7 +32,7 @@ void LinePaintProperties::parse(const JSValue& value) {
|
||||
linePattern.parse("line-pattern", value);
|
||||
}
|
||||
|
||||
void LinePaintProperties::cascade(const StyleCascadeParameters& parameters) {
|
||||
void LinePaintProperties::cascade(const CascadeParameters& parameters) {
|
||||
lineOpacity.cascade(parameters);
|
||||
lineColor.cascade(parameters);
|
||||
lineTranslate.cascade(parameters);
|
||||
@@ -44,7 +45,7 @@ void LinePaintProperties::cascade(const StyleCascadeParameters& parameters) {
|
||||
linePattern.cascade(parameters);
|
||||
}
|
||||
|
||||
bool LinePaintProperties::recalculate(const StyleCalculationParameters& parameters) {
|
||||
bool LinePaintProperties::recalculate(const CalculationParameters& parameters) {
|
||||
bool hasTransitions = false;
|
||||
|
||||
hasTransitions |= lineOpacity.calculate(parameters);
|
||||
@@ -61,4 +62,5 @@ bool LinePaintProperties::recalculate(const StyleCalculationParameters& paramete
|
||||
return hasTransitions;
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -7,14 +7,15 @@
|
||||
#include <mbgl/util/rapidjson.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
class StyleCascadeParameters;
|
||||
class StyleCalculationParameters;
|
||||
class CascadeParameters;
|
||||
class CalculationParameters;
|
||||
|
||||
class LineLayoutProperties {
|
||||
public:
|
||||
void parse(const JSValue&);
|
||||
void recalculate(const StyleCalculationParameters&);
|
||||
void recalculate(const CalculationParameters&);
|
||||
|
||||
LayoutProperty<LineCapType> lineCap { LineCapType::Butt };
|
||||
LayoutProperty<LineJoinType> lineJoin { LineJoinType::Miter };
|
||||
@@ -25,8 +26,8 @@ public:
|
||||
class LinePaintProperties {
|
||||
public:
|
||||
void parse(const JSValue&);
|
||||
void cascade(const StyleCascadeParameters&);
|
||||
bool recalculate(const StyleCalculationParameters&);
|
||||
void cascade(const CascadeParameters&);
|
||||
bool recalculate(const CalculationParameters&);
|
||||
|
||||
PaintProperty<float> lineOpacity { 1 };
|
||||
PaintProperty<Color> lineColor { {{ 0, 0, 0, 1 }} };
|
||||
@@ -40,4 +41,5 @@ public:
|
||||
PaintProperty<std::string, CrossFadedPropertyEvaluator> linePattern { "" };
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -1,9 +1,10 @@
|
||||
// This file is generated. Edit scripts/generate-style-code.js, then run `make style-code`.
|
||||
|
||||
#include <mbgl/layer/raster_layer.hpp>
|
||||
#include <mbgl/layer/raster_layer_impl.hpp>
|
||||
#include <mbgl/style/layers/raster_layer.hpp>
|
||||
#include <mbgl/style/layers/raster_layer_impl.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
RasterLayer::RasterLayer(const std::string& layerID)
|
||||
: Layer(Type::Raster, std::make_unique<Impl>())
|
||||
@@ -93,4 +94,5 @@ void RasterLayer::setRasterFadeDuration(PropertyValue<float> value) {
|
||||
impl->paint.rasterFadeDuration.set(value);
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
@@ -1,17 +1,18 @@
|
||||
#include <mbgl/layer/raster_layer_impl.hpp>
|
||||
#include <mbgl/style/layers/raster_layer_impl.hpp>
|
||||
#include <mbgl/renderer/bucket.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
void RasterLayer::Impl::parsePaints(const JSValue& layer) {
|
||||
paint.parse(layer);
|
||||
}
|
||||
|
||||
void RasterLayer::Impl::cascade(const StyleCascadeParameters& parameters) {
|
||||
void RasterLayer::Impl::cascade(const CascadeParameters& parameters) {
|
||||
paint.cascade(parameters);
|
||||
}
|
||||
|
||||
bool RasterLayer::Impl::recalculate(const StyleCalculationParameters& parameters) {
|
||||
bool RasterLayer::Impl::recalculate(const CalculationParameters& parameters) {
|
||||
bool hasTransitions = paint.recalculate(parameters);
|
||||
|
||||
passes = paint.rasterOpacity > 0 ? RenderPass::Translucent : RenderPass::None;
|
||||
@@ -19,8 +20,9 @@ bool RasterLayer::Impl::recalculate(const StyleCalculationParameters& parameters
|
||||
return hasTransitions;
|
||||
}
|
||||
|
||||
std::unique_ptr<Bucket> RasterLayer::Impl::createBucket(StyleBucketParameters&) const {
|
||||
std::unique_ptr<Bucket> RasterLayer::Impl::createBucket(BucketParameters&) const {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
26
src/mbgl/style/layers/raster_layer_impl.hpp
Normal file
26
src/mbgl/style/layers/raster_layer_impl.hpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include <mbgl/style/layer_impl.hpp>
|
||||
#include <mbgl/style/layers/raster_layer.hpp>
|
||||
#include <mbgl/style/layers/raster_layer_properties.hpp>
|
||||
|
||||
namespace mbgl {
|
||||
namespace style {
|
||||
|
||||
class RasterLayer::Impl : public Layer::Impl {
|
||||
public:
|
||||
std::unique_ptr<Layer> clone() const override;
|
||||
|
||||
void parseLayout(const JSValue&) override {};
|
||||
void parsePaints(const JSValue&) override;
|
||||
|
||||
void cascade(const CascadeParameters&) override;
|
||||
bool recalculate(const CalculationParameters&) override;
|
||||
|
||||
std::unique_ptr<Bucket> createBucket(BucketParameters&) const override;
|
||||
|
||||
RasterPaintProperties paint;
|
||||
};
|
||||
|
||||
} // namespace style
|
||||
} // namespace mbgl
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user