Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add all points to circle bucket not just outer ring #2027

Merged
merged 1 commit into from
Jan 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 31 additions & 27 deletions js/data/circle_bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,34 +41,38 @@ CircleBucket.prototype.shaders = {

CircleBucket.prototype.addFeature = function(feature) {

var geometries = loadGeometry(feature)[0];
var geometries = loadGeometry(feature);
for (var j = 0; j < geometries.length; j++) {
var group = this.makeRoomFor('circle', 4);

var x = geometries[j].x;
var y = geometries[j].y;

// Do not include points that are outside the tile boundaries.
if (x < 0 || x >= EXTENT || y < 0 || y >= EXTENT) continue;

// this geometry will be of the Point type, and we'll derive
// two triangles from it.
//
// ┌─────────┐
// │ 3 2 │
// │ │
// │ 0 1 │
// └─────────┘

var index = this.addCircleVertex(x, y, -1, -1) - group.vertexStartIndex;
this.addCircleVertex(x, y, 1, -1);
this.addCircleVertex(x, y, 1, 1);
this.addCircleVertex(x, y, -1, 1);
group.vertexLength += 4;

this.addCircleElement(index, index + 1, index + 2);
this.addCircleElement(index, index + 3, index + 2);
group.elementLength += 2;
var geometry = geometries[j];

for (var k = 0; k < geometry.length; k++) {
var group = this.makeRoomFor('circle', 4);

var x = geometry[k].x;
var y = geometry[k].y;

// Do not include points that are outside the tile boundaries.
if (x < 0 || x >= EXTENT || y < 0 || y >= EXTENT) continue;

// this geometry will be of the Point type, and we'll derive
// two triangles from it.
//
// ┌─────────┐
// │ 3 2 │
// │ │
// │ 0 1 │
// └─────────┘

var index = this.addCircleVertex(x, y, -1, -1) - group.vertexStartIndex;
this.addCircleVertex(x, y, 1, -1);
this.addCircleVertex(x, y, 1, 1);
this.addCircleVertex(x, y, -1, 1);
group.vertexLength += 4;

this.addCircleElement(index, index + 1, index + 2);
this.addCircleElement(index, index + 3, index + 2);
group.elementLength += 2;
}
}

};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"eslint": "^1.5.0",
"eslint-config-mourner": "^1.0.0",
"istanbul": "^0.4.1",
"mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#7ebad0438ea47721235434f56eb0dba2db66ddb5",
"mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#bd74e2c8aef40651f5fcc9d5544b89b6707787ae",
"prova": "^2.1.2",
"sinon": "^1.15.4",
"st": "^1.0.0",
Expand Down