This commit is contained in:
Olivier Guyot
2019-05-14 19:14:12 +02:00
parent 9ca75e9d43
commit c705775d75
5 changed files with 35 additions and 35 deletions

View File

@@ -83,9 +83,11 @@ export function pushFeatureInBuffer(vertexBuffer, indexBuffer, geojsonFeature, o
if (!geojsonFeature.geometry) {
return;
}
switch(geojsonFeature.geometry.type) {
case "Point":
pushPointGeomInBuffer_(vertexBuffer, indexBuffer, geojsonFeature, opt_attributes)
switch (geojsonFeature.geometry.type) {
case 'Point':
pushPointGeomInBuffer_(vertexBuffer, indexBuffer, geojsonFeature, opt_attributes);
return;
default:
return;
}
}
@@ -94,10 +96,10 @@ const tmpArray_ = [];
/**
* Pushes a quad (two triangles) based on a point geometry
* @param vertexBuffer
* @param indexBuffer
* @param geojsonFeature
* @param opt_attributes
* @param {import("../../webgl/Buffer").default} vertexBuffer WebGL buffer
* @param {import("../../webgl/Buffer").default} indexBuffer WebGL buffer
* @param {import("../../format/GeoJSON").GeoJSONFeature} geojsonFeature Feature
* @param {Array<string>} [opt_attributes] Custom attributes
* @private
*/
function pushPointGeomInBuffer_(vertexBuffer, indexBuffer, geojsonFeature, opt_attributes) {

View File

@@ -12,7 +12,6 @@ import ViewHint from '../../ViewHint';
import {createEmpty, equals} from '../../extent';
import {
create as createTransform,
reset as resetTransform,
makeInverse as makeInverseTransform,
multiply as multiplyTransform,
apply as applyTransform
@@ -350,7 +349,7 @@ class WebGLPointsLayerRenderer extends WebGLLayerRenderer {
/**
* Rebuild internal webgl buffers based on current view extent; costly, should not be called too much
* @param {import("../../PluggableMap.js").FrameState} frameState
* @param {import("../../PluggableMap").FrameState} frameState Frame state.
* @private
*/
rebuildBuffers_(frameState) {

View File

@@ -9,18 +9,18 @@ describe('ol.renderer.webgl.Layer', function() {
let target;
beforeEach(function () {
beforeEach(function() {
target = document.createElement('div');
target.style.width = '256px';
target.style.height = '256px';
document.body.appendChild(target);
});
afterEach(function () {
afterEach(function() {
document.body.removeChild(target);
});
it('creates a new instance', function () {
it('creates a new instance', function() {
const layer = new Layer({});
const renderer = new WebGLLayerRenderer(layer);
expect(renderer).to.be.a(WebGLLayerRenderer);
@@ -31,17 +31,17 @@ describe('ol.renderer.webgl.Layer', function() {
describe('pushFeatureInBuffer', function() {
let vertexBuffer, indexBuffer;
beforeEach(function () {
beforeEach(function() {
vertexBuffer = new WebGLArrayBuffer();
indexBuffer = new WebGLArrayBuffer();
});
it('does nothing if the feature has no geometry', function() {
const feature = {
type: "Feature",
id: "AFG",
type: 'Feature',
id: 'AFG',
properties: {
color:[0.5, 1, 0.2, 0.7],
color: [0.5, 1, 0.2, 0.7],
size: 3
},
geometry: null
@@ -53,15 +53,15 @@ describe('ol.renderer.webgl.Layer', function() {
it('adds two triangles with the correct attributes for a point geometry', function() {
const feature = {
type: "Feature",
id: "AFG",
type: 'Feature',
id: 'AFG',
properties: {
color:[0.5, 1, 0.2, 0.7],
color: [0.5, 1, 0.2, 0.7],
size: 3
},
geometry: {
type: "Point",
coordinates: [ -75, 47 ]
type: 'Point',
coordinates: [-75, 47]
}
};
const attributePerVertex = 12;
@@ -72,15 +72,15 @@ describe('ol.renderer.webgl.Layer', function() {
it('correctly sets indices & coordinates for several features', function() {
const feature = {
type: "Feature",
id: "AFG",
type: 'Feature',
id: 'AFG',
properties: {
color:[0.5, 1, 0.2, 0.7],
color: [0.5, 1, 0.2, 0.7],
size: 3
},
geometry: {
type: "Point",
coordinates: [ -75, 47 ]
type: 'Point',
coordinates: [-75, 47]
}
};
const attributePerVertex = 12;
@@ -110,8 +110,8 @@ describe('ol.renderer.webgl.Layer', function() {
it('correctly adds custom attributes', function() {
const feature = {
type: "Feature",
id: "AFG",
type: 'Feature',
id: 'AFG',
properties: {
color: [0.5, 1, 0.2, 0.7],
custom: 4,
@@ -120,8 +120,8 @@ describe('ol.renderer.webgl.Layer', function() {
customString2: 'abc'
},
geometry: {
type: "Point",
coordinates: [ -75, 47 ]
type: 'Point',
coordinates: [-75, 47]
}
};
const attributePerVertex = 16;

View File

@@ -15,18 +15,18 @@ describe('ol.renderer.webgl.PointsLayer', function() {
let target;
beforeEach(function () {
beforeEach(function() {
target = document.createElement('div');
target.style.width = '256px';
target.style.height = '256px';
document.body.appendChild(target);
});
afterEach(function () {
afterEach(function() {
document.body.removeChild(target);
});
it('creates a new instance', function () {
it('creates a new instance', function() {
const layer = new VectorLayer({
source: new VectorSource()
});

View File

@@ -1,7 +1,6 @@
import WebGLHelper from '../../../../src/ol/webgl/Helper';
import {
create as createTransform,
multiply,
rotate as rotateTransform,
scale as scaleTransform, translate as translateTransform
} from '../../../../src/ol/transform';
@@ -203,7 +202,7 @@ describe('ol.webgl.WebGLHelper', function() {
resolution: 2,
center: [10, 20]
}
}
};
});
it('gives out the correct transform', function() {