Skip to content

Commit

Permalink
Composite GeoJsonLayer, PolygonLayer and PathLayer (visgl#303)
Browse files Browse the repository at this point in the history
* Composite geojson layer, with flat, extrusion and wireframe capability on PolygonLayer

* Lighting supported on polygon layer. New lighting shader module.

* Lighting supported on polygon layer. New lighting shader module.

* v3.1.0-beta.11

* v3.0.0-beta.12
  • Loading branch information
ibgreen authored and Shaojing Li committed Mar 8, 2017
1 parent e28eede commit 7186311
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 212 deletions.
43 changes: 0 additions & 43 deletions examples/exhibits/webpack/config.js

This file was deleted.

10 changes: 0 additions & 10 deletions examples/exhibits/webpack/index.html

This file was deleted.

37 changes: 0 additions & 37 deletions examples/exhibits/webpack/package.json

This file was deleted.

69 changes: 0 additions & 69 deletions examples/hello-world-webpack2/app.js

This file was deleted.

21 changes: 18 additions & 3 deletions examples/main/layer-examples.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
ArcLayer,
LineLayer,
ScreenGridLayer,
HexagonLayer,

GeoJsonLayer,
// PolygonLayer,
Expand All @@ -17,6 +18,7 @@ import {
ExtrudedChoroplethLayer64,

Container

} from 'deck.gl';

import * as dataSamples from './data-samples';
Expand Down Expand Up @@ -169,6 +171,20 @@ const ScatterplotLayerMetersExample = {
}
};

const HexagonLayerExample = {
layer: HexagonLayer,
props: {
id: 'hexagonLayer',
data: dataSamples.hexagons,
hexagonVertices: dataSamples.hexagons[0].vertices,
getColor: h => [48, 128, h.value * 255],
getElevation: h => h.value,
enable3d: true,
pickable: true,
opacity: 1
}
};

// 64 BIT LAYER EXAMPLES

const ArcLayer64Example = {
Expand Down Expand Up @@ -274,12 +290,11 @@ const ExtrudedChoroplethLayer64Example = {
}
};


const ExtrudedChoroplethLayer64WireframeExample = {
layer: ExtrudedChoroplethLayer64,
props: Object.assign({}, ExtrudedChoroplethLayer64Example.props, {
id: 'extrudedChoroplethLayer64-wireframe',
drawWireframe: true
id: 'extrudedChoroplethLayer64-wireframe',
drawWireframe: true
})
};

Expand Down
2 changes: 0 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
<!doctype html>
<html>
<head>
<meta charset='UTF-8' />
<title>deck.gl tests</title>
<link href="app.css" rel="stylesheet">
</head>
<body>
<script src='test-browser-bundle.js'></script>
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
"scripts": {
"start": "(cd examples/main && yarn && npm start)",
"compile": "rm -fr dist && buble src -o dist --no modules --y dangerousForOf --objectAssign",
"build": "rnpm run compile && webpack -d --display-modules",
"build": "npm run compile && webpack -d --display-modules",
"lint": "eslint src test exhibits/app.js examples",
"publish-prod": "npm run build && npm run test && npm publish",
"publish-beta": "npm run build && npm run test && npm publish --tag beta",
"test": "npm run lint && npm run test-node",
"test-node": "npm run compile && node test/node.js",
"test-node": "node test/node.js",
"test-browser": "webpack-dev-server --config webpack.config.test-browser.js --progress --hot --open --port 3010",
"bench-node": "npm run compile && node test/bench/node.js",
"bench": "node test/bench/node.js",
"bench-browser": "webpack-dev-server --config webpack.config.bench-browser.js --progress --hot --open --port 3011",
"test-fp64": "(cd test/fp64-test && webpack-dev-server --config webpack.config.test-fp64.js --progress --hot --open)",
"test-rendering": "(cd test/rendering-test && webpack-dev-server --config webpack.config.test-rendering.js --progress --hot --open)"
Expand Down
4 changes: 0 additions & 4 deletions src/lib/layer.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,7 @@ export default class Layer {
data: props.data || []
});

<<<<<<< HEAD
this.id = props.id;
=======
// this.id = props.id;
>>>>>>> Add benchmarks for node and browser.js (#299)
this.props = props;
this.oldProps = null;
this.state = null;
Expand Down
101 changes: 60 additions & 41 deletions test/bench/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,72 @@
/* global console */
import {Suite} from 'benchmark';
import * as data from '../data';
import {ScatterplotLayer, ChoroplethLayer} from 'deck.gl';

import {createGLContext} from 'luma.gl';
import {
// ScatterplotLayer,
PolygonLayer,
ChoroplethLayer,
ExtrudedChoroplethLayer64
} from 'deck.gl';

export function testInitializeLayer({gl, layer}) {
const oldContext = {gl};
const context = {gl};
let failures = 0;
try {
layer.context = context;

layer.initializeLayer({
oldProps: {},
props: layer.props,
oldContext,
context,
changeFlags: layer.diffProps({}, layer.props, context)
});

layer.updateLayer({
oldProps: {},
props: layer.props,
oldContext,
context,
changeFlags: layer.diffProps({}, layer.props, context)
});
} catch (error) {
failures++;
}
return failures;
}

const gl = createGLContext();
import {testInitializeLayer} from '../test-utils';

const suite = new Suite();

// add tests
suite

.add('ScatterplotLayer#construct', () => {
return new ScatterplotLayer({data: data.choropleths});
})
.add('ChoroplethLayer#construct', () => {
return new ChoroplethLayer({data: data.choropleths});
})
// .add('ScatterplotLayer#construct', () => {
// return new ScatterplotLayer({data: data.choropleths});
// })
// .add('ChoroplethLayer#construct', () => {
// return new ChoroplethLayer({data: data.choropleths});
// })
// .add('PolygonLayer#construct', () => {
// return new PolygonLayer({data: data.choropleths});
// })
.add('ChoroplethLayer#initialize', () => {
const layer = new ChoroplethLayer({data: data.choropleths});
testInitializeLayer({gl, layer});
testInitializeLayer({layer});
})
.add('PolygonLayer#initialize (flat)', () => {
const layer = new PolygonLayer({data: data.choropleths});
testInitializeLayer({layer});
})
.add('PolygonLayer#initialize (extruded)', () => {
const layer = new PolygonLayer({data: data.choropleths, extruded: true});
testInitializeLayer({layer});
})
.add('PolygonLayer#initialize (wireframe)', () => {
const layer = new PolygonLayer({data: data.choropleths, extruded: true, wireframe: true});
testInitializeLayer({layer});
})
// .add('PolygonLayer#initialize from Immutable', () => {
// const layer = new PolygonLayer({data: data.immutableChoropleths});
// testInitializeLayer({layer});
// })
.add('ExtrudedChoroplethLayer64#initialize', () => {
try {
const layer = new ExtrudedChoroplethLayer64({
id: 'extrudedChoroplethLayer64',
data: data.choropleths,
getColor: f => [128, 0, 0],
pointLightLocation: [
37.751537058389985,
-122.42694203247012,
1e4
],
opacity: 1.0,
pickable: true
});
testInitializeLayer({layer});
} catch (error) {
console.error(error);
}
})
// .add('ScatterplotLayer#initialize', () => {
// const layer = new ScatterplotLayer({data: data.points});
// testInitializeLayer({layer});
// })
// add listeners
.on('start', (event) => {
console.log('Starting bench...');
Expand All @@ -61,5 +78,7 @@ suite
.on('complete', function t() {
console.log(`Fastest is ${this.filter('fastest').map('name')}`);
})
// run async
.run({delay: 0.1});
.run({
maxTime: 0.01,
delay: 0.1
});
5 changes: 5 additions & 0 deletions test/data/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
export * from '../../examples/main/data-samples';

import * as data from '../../examples/main/data-samples';

import Immutable from 'immutable';
export const immutableChoropleths = Immutable.fromJS(data.choropleths);

0 comments on commit 7186311

Please sign in to comment.