Merge pull request #1177 from mapbox/cleanup

Some minor cleanups
This commit is contained in:
Konstantin Käfer
2015-04-02 16:13:54 +02:00
4 changed files with 11 additions and 27 deletions

View File

@@ -4,7 +4,7 @@
#include <mbgl/map/geometry_tile.hpp>
#include <mbgl/util/pbf.hpp>
#include <unordered_map>
#include <map>
namespace mbgl {
@@ -39,7 +39,7 @@ private:
std::string name;
uint32_t extent = 4096;
std::unordered_map<std::string, uint32_t> keys;
std::map<std::string, uint32_t> keys;
std::vector<Value> values;
std::vector<pbf> features;
};
@@ -51,7 +51,7 @@ public:
util::ptr<GeometryTileLayer> getLayer(const std::string&) const override;
private:
std::unordered_map<std::string, util::ptr<GeometryTileLayer>> layers;
std::map<std::string, util::ptr<GeometryTileLayer>> layers;
};
}

View File

@@ -102,11 +102,11 @@ void FillBucket::tessellate() {
if (!lineGroups.size() || (lineGroups.back()->vertex_length + total_vertex_count > 65535)) {
// Move to a new group because the old one can't hold the geometry.
lineGroups.emplace_back(util::make_unique<line_group_type>());
lineGroups.emplace_back(util::make_unique<LineGroup>());
}
assert(lineGroups.back());
line_group_type& lineGroup = *lineGroups.back();
LineGroup& lineGroup = *lineGroups.back();
uint32_t lineIndex = lineGroup.vertex_length;
for (const auto& polygon : polygons) {
@@ -149,13 +149,13 @@ void FillBucket::tessellate() {
if (!triangleGroups.size() || (triangleGroups.back()->vertex_length + total_vertex_count > 65535)) {
// Move to a new group because the old one can't hold the geometry.
triangleGroups.emplace_back(util::make_unique<triangle_group_type>());
triangleGroups.emplace_back(util::make_unique<TriangleGroup>());
}
// We're generating triangle fans, so we always start with the first
// coordinate in this polygon.
assert(triangleGroups.back());
triangle_group_type& triangleGroup = *triangleGroups.back();
TriangleGroup& triangleGroup = *triangleGroups.back();
uint32_t triangleIndex = triangleGroup.vertex_length;
for (int i = 0; i < triangle_count; ++i) {

View File

@@ -4,9 +4,6 @@
#include <mbgl/renderer/bucket.hpp>
#include <mbgl/map/geometry_tile.hpp>
#include <mbgl/geometry/elements_buffer.hpp>
#include <mbgl/geometry/fill_buffer.hpp>
#include <mbgl/style/style_bucket.hpp>
#include <mbgl/style/style_layout.hpp>
#include <clipper/clipper.hpp>
#include <libtess2/tesselator.h>
@@ -20,12 +17,7 @@
namespace mbgl {
class Style;
class StyleLayoutFill;
class FillVertexBuffer;
class TriangleElementsBuffer;
class LineElementsBuffer;
class BucketDescription;
class OutlineShader;
class PlainShader;
class PatternShader;
@@ -36,8 +28,8 @@ class FillBucket : public Bucket {
static void *realloc(void *data, void *ptr, unsigned int size);
static void free(void *userData, void *ptr);
typedef ElementGroup<2> triangle_group_type;
typedef ElementGroup<1> line_group_type;
typedef ElementGroup<2> TriangleGroup;
typedef ElementGroup<1> LineGroup;
public:
FillBucket(FillVertexBuffer &vertexBuffer,
@@ -56,9 +48,6 @@ public:
void drawElements(PatternShader& shader);
void drawVertices(OutlineShader& shader);
public:
StyleLayoutFill layout;
private:
TESSalloc *allocator;
TESStesselator *tesselator;
@@ -72,10 +61,9 @@ private:
const size_t vertex_start;
const size_t triangle_elements_start;
const size_t line_elements_start;
VertexArrayObject array;
std::vector<std::unique_ptr<triangle_group_type>> triangleGroups;
std::vector<std::unique_ptr<line_group_type>> lineGroups;
std::vector<std::unique_ptr<TriangleGroup>> triangleGroups;
std::vector<std::unique_ptr<LineGroup>> lineGroups;
std::vector<ClipperLib::IntPoint> line;
bool hasVertices = false;

View File

@@ -18,17 +18,13 @@
namespace mbgl {
class Style;
class StyleLayoutSymbol;
class SDFShader;
class IconShader;
class DotShader;
class Collision;
class SpriteAtlas;
class Sprite;
class GlyphAtlas;
class GlyphStore;
class FontStack;
class SymbolFeature {
public: