Refactor to a more convenient internal API

This commit is contained in:
Andreas Hocevar
2016-06-22 23:41:00 +02:00
parent cf7ff841a7
commit 6b4ee42c90
34 changed files with 497 additions and 554 deletions

View File

@@ -147,8 +147,8 @@ describe('ol.dom', function() {
describe('ol.dom.transformElement2D', function() {
var element = null;
var transform = ol.matrix.create();
var transformFloat = ol.matrix.create();
var transform = ol.transform.create();
var transformFloat = ol.transform.create();
transformFloat[0] = 0.12345;
beforeEach(function() {
element = document.createElement('div');
@@ -564,5 +564,5 @@ describe('ol.dom', function() {
});
goog.require('goog.userAgent');
goog.require('ol.matrix');
goog.require('ol.transform');
goog.require('ol.dom');

View File

@@ -22,16 +22,16 @@ describe('ol.render', function() {
[0, 0, size[0] * pixelRatio, size[1] * pixelRatio]);
expect(canvas.style.width).to.be(size[0] + 'px');
expect(canvas.style.height).to.be(size[1] + 'px');
var transform = ol.matrix.makeTransform(ol.matrix.create(),
0, 0, pixelRatio, pixelRatio, 0, 0, 0);
expect(ol.matrix.equals(render.transform_, transform)).to.be.ok();
var transform = ol.transform.scale(ol.transform.create(),
pixelRatio, pixelRatio);
expect(ol.array.equals(render.transform_, transform)).to.be.ok();
});
});
});
goog.require('ol.matrix');
goog.require('ol.transform');
goog.require('ol.render');
goog.require('ol.render.canvas.Immediate');
goog.require('ol.vec.Mat4');

View File

@@ -23,11 +23,11 @@ describe('ol.renderer.canvas.Layer', function() {
},
size: [10, 10],
pixelRatio: 1,
coordinateToPixelMatrix: ol.matrix.create(),
pixelToCoordinateMatrix: ol.matrix.create()
coordinateToPixelTransform: ol.transform.create(),
pixelToCoordinateTransform: ol.transform.create()
};
renderer.getImageTransform = function() {
return ol.matrix.create();
return ol.transform.create();
};
ol.renderer.Map.prototype.calculateMatrices2D(frameState);
var layerState = layer.getLayerState();
@@ -62,7 +62,7 @@ describe('ol.renderer.canvas.Layer', function() {
goog.require('ol.render.canvas');
goog.require('ol.matrix');
goog.require('ol.transform');
goog.require('ol.layer.Image');
goog.require('ol.renderer.Map');
goog.require('ol.renderer.canvas.Layer');

View File

@@ -49,32 +49,30 @@ describe('ol.renderer.webgl.ImageLayer', function() {
pixelRatio, viewCenter, viewResolution, viewRotation, imageExtent);
var matrix = renderer.getProjectionMatrix();
var output = ol.matrix.create();
ol.matrix.multVec2(matrix, [-1, -1], output);
var output = ol.transform.apply(matrix, [-1, -1]);
expect(output[0]).to.eql(-6);
expect(output[1]).to.eql(-6);
ol.matrix.multVec2(matrix, [1, -1], output);
output = ol.transform.apply(matrix, [1, -1]);
expect(output[0]).to.eql(2);
expect(output[1]).to.eql(-6);
ol.matrix.multVec2(matrix, [-1, 1], output);
output = ol.transform.apply(matrix, [-1, 1]);
expect(output[0]).to.eql(-6);
expect(output[1]).to.eql(6);
ol.matrix.multVec2(matrix, [1, 1], output);
output = ol.transform.apply(matrix, [1, 1]);
expect(output[0]).to.eql(2);
expect(output[1]).to.eql(6);
ol.matrix.multVec2(matrix, [0, 0], output);
output = ol.transform.apply(matrix, [0, 0]);
expect(output[0]).to.eql(-2);
expect(output[1]).to.eql(0);
});
});
});
goog.require('ol.matrix');
goog.require('ol.transform');
goog.require('ol.Map');
goog.require('ol.proj.common');
goog.require('ol.layer.Image');