Shorter names for drawing methods
This commit is contained in:
@@ -67,72 +67,72 @@ describe('ol.render.canvas.Immediate', function() {
|
||||
|
||||
var extent = [-10, -10, 10, 10];
|
||||
|
||||
it('calls drawPointGeometry() with a Point', function() {
|
||||
it('calls drawPoint() with a Point', function() {
|
||||
var context = new ol.render.canvas.Immediate(getMockContext(), 1, extent);
|
||||
sinon.spy(context, 'drawPointGeometry');
|
||||
sinon.spy(context, 'drawPoint');
|
||||
|
||||
var geometry = new ol.geom.Point([1, 2]);
|
||||
context.drawGeometry(geometry);
|
||||
expect(context.drawPointGeometry.calledOnce).to.be(true);
|
||||
expect(context.drawPointGeometry.firstCall.calledWithExactly(geometry)).to.be(true);
|
||||
expect(context.drawPoint.calledOnce).to.be(true);
|
||||
expect(context.drawPoint.firstCall.calledWithExactly(geometry)).to.be(true);
|
||||
});
|
||||
|
||||
it('calls drawLineStringGeometry() with a LineString', function() {
|
||||
it('calls drawLineString() with a LineString', function() {
|
||||
var context = new ol.render.canvas.Immediate(getMockContext(), 1, extent);
|
||||
sinon.spy(context, 'drawLineStringGeometry');
|
||||
sinon.spy(context, 'drawLineString');
|
||||
|
||||
var geometry = new ol.geom.LineString([[1, 2], [3, 4]]);
|
||||
context.drawGeometry(geometry);
|
||||
expect(context.drawLineStringGeometry.calledOnce).to.be(true);
|
||||
expect(context.drawLineStringGeometry.firstCall.calledWithExactly(geometry)).to.be(true);
|
||||
expect(context.drawLineString.calledOnce).to.be(true);
|
||||
expect(context.drawLineString.firstCall.calledWithExactly(geometry)).to.be(true);
|
||||
});
|
||||
|
||||
it('calls drawPolygonGeometry() with a Polygon', function() {
|
||||
it('calls drawPolygon() with a Polygon', function() {
|
||||
var context = new ol.render.canvas.Immediate(getMockContext(), 1, extent);
|
||||
sinon.spy(context, 'drawPolygonGeometry');
|
||||
sinon.spy(context, 'drawPolygon');
|
||||
|
||||
var geometry = new ol.geom.Polygon([[[1, 2], [3, 4], [5, 6], [1, 2]]]);
|
||||
context.drawGeometry(geometry);
|
||||
expect(context.drawPolygonGeometry.calledOnce).to.be(true);
|
||||
expect(context.drawPolygonGeometry.firstCall.calledWithExactly(geometry)).to.be(true);
|
||||
expect(context.drawPolygon.calledOnce).to.be(true);
|
||||
expect(context.drawPolygon.firstCall.calledWithExactly(geometry)).to.be(true);
|
||||
});
|
||||
|
||||
it('calls drawMultiPointGeometry() with a MultiPoint', function() {
|
||||
it('calls drawMultiPoint() with a MultiPoint', function() {
|
||||
var context = new ol.render.canvas.Immediate(getMockContext(), 1, extent);
|
||||
sinon.spy(context, 'drawMultiPointGeometry');
|
||||
sinon.spy(context, 'drawMultiPoint');
|
||||
|
||||
var geometry = new ol.geom.MultiPoint([[1, 2], [3, 4]]);
|
||||
context.drawGeometry(geometry);
|
||||
expect(context.drawMultiPointGeometry.calledOnce).to.be(true);
|
||||
expect(context.drawMultiPointGeometry.firstCall.calledWithExactly(geometry)).to.be(true);
|
||||
expect(context.drawMultiPoint.calledOnce).to.be(true);
|
||||
expect(context.drawMultiPoint.firstCall.calledWithExactly(geometry)).to.be(true);
|
||||
});
|
||||
|
||||
it('calls drawMultiLineStringGeometry() with a MultiLineString', function() {
|
||||
it('calls drawMultiLineString() with a MultiLineString', function() {
|
||||
var context = new ol.render.canvas.Immediate(getMockContext(), 1, extent);
|
||||
sinon.spy(context, 'drawMultiLineStringGeometry');
|
||||
sinon.spy(context, 'drawMultiLineString');
|
||||
|
||||
var geometry = new ol.geom.MultiLineString([[[1, 2], [3, 4]]]);
|
||||
context.drawGeometry(geometry);
|
||||
expect(context.drawMultiLineStringGeometry.calledOnce).to.be(true);
|
||||
expect(context.drawMultiLineStringGeometry.firstCall.calledWithExactly(geometry)).to.be(true);
|
||||
expect(context.drawMultiLineString.calledOnce).to.be(true);
|
||||
expect(context.drawMultiLineString.firstCall.calledWithExactly(geometry)).to.be(true);
|
||||
});
|
||||
|
||||
it('calls drawMultiPolygonGeometry() with a MultiPolygon', function() {
|
||||
it('calls drawMultiPolygon() with a MultiPolygon', function() {
|
||||
var context = new ol.render.canvas.Immediate(getMockContext(), 1, extent);
|
||||
sinon.spy(context, 'drawMultiPolygonGeometry');
|
||||
sinon.spy(context, 'drawMultiPolygon');
|
||||
|
||||
var geometry = new ol.geom.MultiPolygon([[[[1, 2], [3, 4], [5, 6], [1, 2]]]]);
|
||||
context.drawGeometry(geometry);
|
||||
expect(context.drawMultiPolygonGeometry.calledOnce).to.be(true);
|
||||
expect(context.drawMultiPolygonGeometry.firstCall.calledWithExactly(geometry)).to.be(true);
|
||||
expect(context.drawMultiPolygon.calledOnce).to.be(true);
|
||||
expect(context.drawMultiPolygon.firstCall.calledWithExactly(geometry)).to.be(true);
|
||||
});
|
||||
|
||||
it('calls drawGeometryCollectionGeometry() with a GeometryCollection', function() {
|
||||
it('calls drawGeometryCollection() with a GeometryCollection', function() {
|
||||
var context = new ol.render.canvas.Immediate(getMockContext(), 1, extent);
|
||||
sinon.spy(context, 'drawGeometryCollectionGeometry');
|
||||
sinon.spy(context, 'drawPointGeometry');
|
||||
sinon.spy(context, 'drawLineStringGeometry');
|
||||
sinon.spy(context, 'drawPolygonGeometry');
|
||||
sinon.spy(context, 'drawGeometryCollection');
|
||||
sinon.spy(context, 'drawPoint');
|
||||
sinon.spy(context, 'drawLineString');
|
||||
sinon.spy(context, 'drawPolygon');
|
||||
|
||||
var point = new ol.geom.Point([1, 2]);
|
||||
var linestring = new ol.geom.LineString([[1, 2], [3, 4]]);
|
||||
@@ -141,29 +141,29 @@ describe('ol.render.canvas.Immediate', function() {
|
||||
var geometry = new ol.geom.GeometryCollection([point, linestring, polygon]);
|
||||
context.drawGeometry(geometry);
|
||||
|
||||
expect(context.drawGeometryCollectionGeometry.calledOnce).to.be(true);
|
||||
expect(context.drawPointGeometry.calledOnce).to.be(true);
|
||||
expect(context.drawPointGeometry.firstCall.calledWithExactly(point)).to.be(true);
|
||||
expect(context.drawLineStringGeometry.calledOnce).to.be(true);
|
||||
expect(context.drawLineStringGeometry.firstCall.calledWithExactly(linestring)).to.be(true);
|
||||
expect(context.drawPolygonGeometry.calledOnce).to.be(true);
|
||||
expect(context.drawPolygonGeometry.firstCall.calledWithExactly(polygon)).to.be(true);
|
||||
expect(context.drawGeometryCollection.calledOnce).to.be(true);
|
||||
expect(context.drawPoint.calledOnce).to.be(true);
|
||||
expect(context.drawPoint.firstCall.calledWithExactly(point)).to.be(true);
|
||||
expect(context.drawLineString.calledOnce).to.be(true);
|
||||
expect(context.drawLineString.firstCall.calledWithExactly(linestring)).to.be(true);
|
||||
expect(context.drawPolygon.calledOnce).to.be(true);
|
||||
expect(context.drawPolygon.firstCall.calledWithExactly(polygon)).to.be(true);
|
||||
});
|
||||
|
||||
it('calls drawCircle() with a Circle', function() {
|
||||
var context = new ol.render.canvas.Immediate(getMockContext(), 1, extent);
|
||||
sinon.spy(context, 'drawCircleGeometry');
|
||||
sinon.spy(context, 'drawCircle');
|
||||
|
||||
var geometry = new ol.geom.Circle([0, 0]);
|
||||
context.drawGeometry(geometry);
|
||||
|
||||
expect(context.drawCircleGeometry.calledOnce).to.be(true);
|
||||
expect(context.drawCircleGeometry.firstCall.calledWithExactly(geometry)).to.be(true);
|
||||
expect(context.drawCircle.calledOnce).to.be(true);
|
||||
expect(context.drawCircle.firstCall.calledWithExactly(geometry)).to.be(true);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('#drawMultiPolygonGeometry', function() {
|
||||
describe('#drawMultiPolygon', function() {
|
||||
it('creates the correct canvas instructions for 3D geometries', function() {
|
||||
var log = {
|
||||
lineTo: [],
|
||||
@@ -214,7 +214,7 @@ describe('ol.render.canvas.Immediate', function() {
|
||||
[-82.128838, 26.693342, 0],
|
||||
[-82.102127, 26.585724, 0]]]
|
||||
]).transform('EPSG:4326', 'EPSG:3857');
|
||||
canvas.drawMultiPolygonGeometry(multiPolygonGeometry, null);
|
||||
canvas.drawMultiPolygon(multiPolygonGeometry, null);
|
||||
expect(log.lineTo.length).to.be(15);
|
||||
expect(log.lineTo[0][0]).to.roughlyEqual(805.3521540835154, 1e-9);
|
||||
expect(log.lineTo[0][1]).to.roughlyEqual(158.76358389011807, 1e-9);
|
||||
|
||||
@@ -62,13 +62,13 @@ describe('ol.renderer.vector', function() {
|
||||
var imageReplay = replayGroup.getReplay(
|
||||
style.getZIndex(), ol.render.ReplayType.IMAGE);
|
||||
var setImageStyleSpy = sinon.spy(imageReplay, 'setImageStyle');
|
||||
var drawPointGeometrySpy = sinon.stub(imageReplay,
|
||||
'drawPointGeometry', ol.nullFunction);
|
||||
var drawPointSpy = sinon.stub(imageReplay,
|
||||
'drawPoint', ol.nullFunction);
|
||||
ol.renderer.vector.renderFeature(replayGroup, feature,
|
||||
style, squaredTolerance, listener, listenerThis);
|
||||
expect(setImageStyleSpy.called).to.be(false);
|
||||
setImageStyleSpy.restore();
|
||||
drawPointGeometrySpy.restore();
|
||||
drawPointSpy.restore();
|
||||
});
|
||||
|
||||
it('does not render the multipoint', function() {
|
||||
@@ -76,13 +76,13 @@ describe('ol.renderer.vector', function() {
|
||||
var imageReplay = replayGroup.getReplay(
|
||||
style.getZIndex(), ol.render.ReplayType.IMAGE);
|
||||
var setImageStyleSpy = sinon.spy(imageReplay, 'setImageStyle');
|
||||
var drawMultiPointGeometrySpy = sinon.stub(imageReplay,
|
||||
'drawMultiPointGeometry', ol.nullFunction);
|
||||
var drawMultiPointSpy = sinon.stub(imageReplay,
|
||||
'drawMultiPoint', ol.nullFunction);
|
||||
ol.renderer.vector.renderFeature(replayGroup, feature,
|
||||
style, squaredTolerance, listener, listenerThis);
|
||||
expect(setImageStyleSpy.called).to.be(false);
|
||||
setImageStyleSpy.restore();
|
||||
drawMultiPointGeometrySpy.restore();
|
||||
drawMultiPointSpy.restore();
|
||||
});
|
||||
|
||||
it('does render the linestring', function() {
|
||||
@@ -91,14 +91,14 @@ describe('ol.renderer.vector', function() {
|
||||
style.getZIndex(), ol.render.ReplayType.LINE_STRING);
|
||||
var setFillStrokeStyleSpy = sinon.spy(lineStringReplay,
|
||||
'setFillStrokeStyle');
|
||||
var drawLineStringGeometrySpy = sinon.stub(lineStringReplay,
|
||||
'drawLineStringGeometry', ol.nullFunction);
|
||||
var drawLineStringSpy = sinon.stub(lineStringReplay,
|
||||
'drawLineString', ol.nullFunction);
|
||||
ol.renderer.vector.renderFeature(replayGroup, feature,
|
||||
style, squaredTolerance, listener, listenerThis);
|
||||
expect(setFillStrokeStyleSpy.called).to.be(true);
|
||||
expect(drawLineStringGeometrySpy.called).to.be(true);
|
||||
expect(drawLineStringSpy.called).to.be(true);
|
||||
setFillStrokeStyleSpy.restore();
|
||||
drawLineStringGeometrySpy.restore();
|
||||
drawLineStringSpy.restore();
|
||||
});
|
||||
|
||||
it('does render the multilinestring', function() {
|
||||
@@ -107,14 +107,14 @@ describe('ol.renderer.vector', function() {
|
||||
style.getZIndex(), ol.render.ReplayType.LINE_STRING);
|
||||
var setFillStrokeStyleSpy = sinon.spy(lineStringReplay,
|
||||
'setFillStrokeStyle');
|
||||
var drawMultiLineStringGeometrySpy = sinon.stub(lineStringReplay,
|
||||
'drawMultiLineStringGeometry', ol.nullFunction);
|
||||
var drawMultiLineStringSpy = sinon.stub(lineStringReplay,
|
||||
'drawMultiLineString', ol.nullFunction);
|
||||
ol.renderer.vector.renderFeature(replayGroup, feature,
|
||||
style, squaredTolerance, listener, listenerThis);
|
||||
expect(setFillStrokeStyleSpy.called).to.be(true);
|
||||
expect(drawMultiLineStringGeometrySpy.called).to.be(true);
|
||||
expect(drawMultiLineStringSpy.called).to.be(true);
|
||||
setFillStrokeStyleSpy.restore();
|
||||
drawMultiLineStringGeometrySpy.restore();
|
||||
drawMultiLineStringSpy.restore();
|
||||
});
|
||||
|
||||
it('does render the polygon', function() {
|
||||
@@ -124,14 +124,14 @@ describe('ol.renderer.vector', function() {
|
||||
style.getZIndex(), ol.render.ReplayType.POLYGON);
|
||||
var setFillStrokeStyleSpy = sinon.spy(polygonReplay,
|
||||
'setFillStrokeStyle');
|
||||
var drawPolygonGeometrySpy = sinon.stub(polygonReplay,
|
||||
'drawPolygonGeometry', ol.nullFunction);
|
||||
var drawPolygonSpy = sinon.stub(polygonReplay,
|
||||
'drawPolygon', ol.nullFunction);
|
||||
ol.renderer.vector.renderFeature(replayGroup, feature,
|
||||
style, squaredTolerance, listener, listenerThis);
|
||||
expect(setFillStrokeStyleSpy.called).to.be(true);
|
||||
expect(drawPolygonGeometrySpy.called).to.be(true);
|
||||
expect(drawPolygonSpy.called).to.be(true);
|
||||
setFillStrokeStyleSpy.restore();
|
||||
drawPolygonGeometrySpy.restore();
|
||||
drawPolygonSpy.restore();
|
||||
});
|
||||
|
||||
it('does render the multipolygon', function() {
|
||||
@@ -141,14 +141,14 @@ describe('ol.renderer.vector', function() {
|
||||
style.getZIndex(), ol.render.ReplayType.POLYGON);
|
||||
var setFillStrokeStyleSpy = sinon.spy(polygonReplay,
|
||||
'setFillStrokeStyle');
|
||||
var drawMultiPolygonGeometrySpy = sinon.stub(polygonReplay,
|
||||
'drawMultiPolygonGeometry', ol.nullFunction);
|
||||
var drawMultiPolygonSpy = sinon.stub(polygonReplay,
|
||||
'drawMultiPolygon', ol.nullFunction);
|
||||
ol.renderer.vector.renderFeature(replayGroup, feature,
|
||||
style, squaredTolerance, listener, listenerThis);
|
||||
expect(setFillStrokeStyleSpy.called).to.be(true);
|
||||
expect(drawMultiPolygonGeometrySpy.called).to.be(true);
|
||||
expect(drawMultiPolygonSpy.called).to.be(true);
|
||||
setFillStrokeStyleSpy.restore();
|
||||
drawMultiPolygonGeometrySpy.restore();
|
||||
drawMultiPolygonSpy.restore();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ describe('ol.render.webgl.ImageReplay', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('#drawPointGeometry', function() {
|
||||
describe('#drawPoint', function() {
|
||||
beforeEach(function() {
|
||||
var imageStyle = createImageStyle(new Image());
|
||||
replay.setImageStyle(imageStyle);
|
||||
@@ -92,7 +92,7 @@ describe('ol.render.webgl.ImageReplay', function() {
|
||||
var point;
|
||||
|
||||
point = new ol.geom.Point([1000, 2000]);
|
||||
replay.drawPointGeometry(point, null);
|
||||
replay.drawPoint(point, null);
|
||||
expect(replay.vertices_).to.have.length(32);
|
||||
expect(replay.indices_).to.have.length(6);
|
||||
expect(replay.indices_[0]).to.be(0);
|
||||
@@ -103,7 +103,7 @@ describe('ol.render.webgl.ImageReplay', function() {
|
||||
expect(replay.indices_[5]).to.be(3);
|
||||
|
||||
point = new ol.geom.Point([2000, 3000]);
|
||||
replay.drawPointGeometry(point, null);
|
||||
replay.drawPoint(point, null);
|
||||
expect(replay.vertices_).to.have.length(64);
|
||||
expect(replay.indices_).to.have.length(12);
|
||||
expect(replay.indices_[6]).to.be(4);
|
||||
@@ -115,7 +115,7 @@ describe('ol.render.webgl.ImageReplay', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('#drawMultiPointGeometry', function() {
|
||||
describe('#drawMultiPoint', function() {
|
||||
beforeEach(function() {
|
||||
var imageStyle = createImageStyle(new Image());
|
||||
replay.setImageStyle(imageStyle);
|
||||
@@ -126,7 +126,7 @@ describe('ol.render.webgl.ImageReplay', function() {
|
||||
|
||||
multiPoint = new ol.geom.MultiPoint(
|
||||
[[1000, 2000], [2000, 3000]]);
|
||||
replay.drawMultiPointGeometry(multiPoint, null);
|
||||
replay.drawMultiPoint(multiPoint, null);
|
||||
expect(replay.vertices_).to.have.length(64);
|
||||
expect(replay.indices_).to.have.length(12);
|
||||
expect(replay.indices_[0]).to.be(0);
|
||||
@@ -144,7 +144,7 @@ describe('ol.render.webgl.ImageReplay', function() {
|
||||
|
||||
multiPoint = new ol.geom.MultiPoint(
|
||||
[[3000, 4000], [4000, 5000]]);
|
||||
replay.drawMultiPointGeometry(multiPoint, null);
|
||||
replay.drawMultiPoint(multiPoint, null);
|
||||
expect(replay.vertices_).to.have.length(128);
|
||||
expect(replay.indices_).to.have.length(24);
|
||||
expect(replay.indices_[12]).to.be(8);
|
||||
|
||||
Reference in New Issue
Block a user