-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'style-spec-master' into merge-style-spec3
# Conflicts: # .gitignore # .npmignore # package.json
- Loading branch information
Showing
138 changed files
with
16,813 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/docs/api/index.html | ||
/docs/style-spec/index.html | ||
/_site | ||
/dist/mapbox-gl-dev.js | ||
/dist/mapbox-gl.js | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
|
||
### `undefined` | ||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
ISC License | ||
|
||
Copyright (c) 2016, Mapbox | ||
|
||
Permission to use, copy, modify, and/or distribute this software for any | ||
purpose with or without fee is hereby granted, provided that the above | ||
copyright notice and this permission notice appear in all copies. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH | ||
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | ||
FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, | ||
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM | ||
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR | ||
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR | ||
PERFORMANCE OF THIS SOFTWARE. | ||
|
||
-------------------------------------------------------------------------------- | ||
|
||
Contains a portion of d3-color https://github.com/d3/d3-color | ||
|
||
Copyright 2010-2016 Mike Bostock | ||
All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without modification, | ||
are permitted provided that the following conditions are met: | ||
|
||
* Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
* Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
* Neither the name of the author nor the names of contributors may be used to | ||
endorse or promote products derived from this software without specific prior | ||
written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
'use strict'; | ||
|
||
var VectorTile = require('vector-tile').VectorTile; | ||
var Pbf = require('pbf'); | ||
var fs = require('fs'); | ||
var createFilter = require('../../../js/style-spec').featureFilter; | ||
var filters = require('./filters.json'); | ||
var path = require('path'); | ||
|
||
var tile = new VectorTile(new Pbf(fs.readFileSync(path.join(__dirname, './785.vector.pbf')))); | ||
|
||
var layers = []; | ||
for (var name in tile.layers) { | ||
var layer = tile.layers[name]; | ||
if (!layer.length) continue; | ||
|
||
var features = []; | ||
for (var j = 0; j < layer.length; j++) { | ||
features.push(layer.feature(j)); | ||
} | ||
|
||
var layerFilters = []; | ||
for (j = 0; j < filters.length; j++) { | ||
if (filters[j].layer === name) layerFilters.push(filters[j].filter); | ||
} | ||
|
||
layers.push({ | ||
name: name, | ||
features: features, | ||
rawFilters: layerFilters | ||
}); | ||
} | ||
|
||
console.time('create filters'); | ||
for (var m = 0; m < 100; m++) { | ||
for (var i = 0; i < layers.length; i++) { | ||
var layer = layers[i]; | ||
layer.filters = []; | ||
for (j = 0; j < layer.rawFilters.length; j++) { | ||
layer.filters.push(createFilter(layer.rawFilters[j])); | ||
} | ||
} | ||
} | ||
console.timeEnd('create filters'); | ||
|
||
console.time('apply filters'); | ||
for (var m = 0; m < 100; m++) { | ||
for (var i = 0; i < layers.length; i++) { | ||
var layer = layers[i]; | ||
for (j = 0; j < layer.features.length; j++) { | ||
var feature = layer.features[j]; | ||
for (var k = 0; k < layer.filters.length; k++) { | ||
var filter = layer.filters[k]; | ||
filter(feature); | ||
} | ||
} | ||
} | ||
} | ||
console.timeEnd('apply filters'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict'; | ||
|
||
var filter = require('../../../js/style-spec').featureFilter; | ||
|
||
var N = 64000; | ||
|
||
var arr = ['in', 'foo']; | ||
for (var i = 0; i < N; i++) arr.push(i); | ||
|
||
console.time('create ' + N + '-item filter'); | ||
var f = filter(arr); | ||
console.timeEnd('create ' + N + '-item filter'); | ||
|
||
var feature = {properties: {foo: 0}}; | ||
|
||
console.time('filter 1 million times'); | ||
for (var i = 0; i < 1000000; i++) { | ||
feature.properties.foo = Math.floor(Math.random() * N * 2); | ||
f(feature); | ||
} | ||
console.timeEnd('filter 1 million times'); |
Oops, something went wrong.