Rename _ol_reproj_Triangulation_ to Triangulation

This commit is contained in:
Tim Schaub
2018-01-11 10:31:07 -07:00
parent 1552f27a43
commit 84e93efe5c
4 changed files with 14 additions and 14 deletions

View File

@@ -9,7 +9,7 @@ import _ol_events_ from '../events.js';
import EventType from '../events/EventType.js'; import EventType from '../events/EventType.js';
import {getCenter, getIntersection, getHeight, getWidth} from '../extent.js'; import {getCenter, getIntersection, getHeight, getWidth} from '../extent.js';
import _ol_reproj_ from '../reproj.js'; import _ol_reproj_ from '../reproj.js';
import _ol_reproj_Triangulation_ from '../reproj/Triangulation.js'; import Triangulation from '../reproj/Triangulation.js';
/** /**
* @classdesc * @classdesc
@@ -55,7 +55,7 @@ var ReprojImage = function(sourceProj, targetProj,
* @private * @private
* @type {!ol.reproj.Triangulation} * @type {!ol.reproj.Triangulation}
*/ */
this.triangulation_ = new _ol_reproj_Triangulation_( this.triangulation_ = new Triangulation(
sourceProj, targetProj, limitedTargetExtent, this.maxSourceExtent_, sourceProj, targetProj, limitedTargetExtent, this.maxSourceExtent_,
sourceResolution * errorThresholdInPixels); sourceResolution * errorThresholdInPixels);

View File

@@ -10,7 +10,7 @@ import EventType from '../events/EventType.js';
import {getArea, getCenter, getIntersection} from '../extent.js'; import {getArea, getCenter, getIntersection} from '../extent.js';
import {clamp} from '../math.js'; import {clamp} from '../math.js';
import _ol_reproj_ from '../reproj.js'; import _ol_reproj_ from '../reproj.js';
import _ol_reproj_Triangulation_ from '../reproj/Triangulation.js'; import Triangulation from '../reproj/Triangulation.js';
/** /**
* @classdesc * @classdesc
@@ -142,7 +142,7 @@ var ReprojTile = function(sourceProj, sourceTileGrid,
* @private * @private
* @type {!ol.reproj.Triangulation} * @type {!ol.reproj.Triangulation}
*/ */
this.triangulation_ = new _ol_reproj_Triangulation_( this.triangulation_ = new Triangulation(
sourceProj, targetProj, limitedTargetExtent, maxSourceExtent, sourceProj, targetProj, limitedTargetExtent, maxSourceExtent,
sourceResolution * errorThresholdInPixels); sourceResolution * errorThresholdInPixels);

View File

@@ -41,7 +41,7 @@ var MAX_TRIANGLE_WIDTH = 0.25;
* @param {number} errorThreshold Acceptable error (in source units). * @param {number} errorThreshold Acceptable error (in source units).
* @constructor * @constructor
*/ */
var _ol_reproj_Triangulation_ = function(sourceProj, targetProj, targetExtent, var Triangulation = function(sourceProj, targetProj, targetExtent,
maxSourceExtent, errorThreshold) { maxSourceExtent, errorThreshold) {
/** /**
@@ -189,7 +189,7 @@ var _ol_reproj_Triangulation_ = function(sourceProj, targetProj, targetExtent,
* @param {ol.Coordinate} cSrc The source c coordinate. * @param {ol.Coordinate} cSrc The source c coordinate.
* @private * @private
*/ */
_ol_reproj_Triangulation_.prototype.addTriangle_ = function(a, b, c, Triangulation.prototype.addTriangle_ = function(a, b, c,
aSrc, bSrc, cSrc) { aSrc, bSrc, cSrc) {
this.triangles_.push({ this.triangles_.push({
source: [aSrc, bSrc, cSrc], source: [aSrc, bSrc, cSrc],
@@ -214,7 +214,7 @@ _ol_reproj_Triangulation_.prototype.addTriangle_ = function(a, b, c,
* @param {number} maxSubdivision Maximal allowed subdivision of the quad. * @param {number} maxSubdivision Maximal allowed subdivision of the quad.
* @private * @private
*/ */
_ol_reproj_Triangulation_.prototype.addQuad_ = function(a, b, c, d, Triangulation.prototype.addQuad_ = function(a, b, c, d,
aSrc, bSrc, cSrc, dSrc, maxSubdivision) { aSrc, bSrc, cSrc, dSrc, maxSubdivision) {
var sourceQuadExtent = boundingExtent([aSrc, bSrc, cSrc, dSrc]); var sourceQuadExtent = boundingExtent([aSrc, bSrc, cSrc, dSrc]);
@@ -326,7 +326,7 @@ _ol_reproj_Triangulation_.prototype.addQuad_ = function(a, b, c, d,
* *
* @return {ol.Extent} Calculated extent. * @return {ol.Extent} Calculated extent.
*/ */
_ol_reproj_Triangulation_.prototype.calculateSourceExtent = function() { Triangulation.prototype.calculateSourceExtent = function() {
var extent = createEmpty(); var extent = createEmpty();
this.triangles_.forEach(function(triangle, i, arr) { this.triangles_.forEach(function(triangle, i, arr) {
@@ -343,7 +343,7 @@ _ol_reproj_Triangulation_.prototype.calculateSourceExtent = function() {
/** /**
* @return {Array.<ol.ReprojTriangle>} Array of the calculated triangles. * @return {Array.<ol.ReprojTriangle>} Array of the calculated triangles.
*/ */
_ol_reproj_Triangulation_.prototype.getTriangles = function() { Triangulation.prototype.getTriangles = function() {
return this.triangles_; return this.triangles_;
}; };
export default _ol_reproj_Triangulation_; export default Triangulation;

View File

@@ -1,6 +1,6 @@
import {addCommon, clearAllProjections, get as getProjection} from '../../../../src/ol/proj.js'; import {addCommon, clearAllProjections, get as getProjection} from '../../../../src/ol/proj.js';
import {register} from '../../../../src/ol/proj/proj4.js'; import {register} from '../../../../src/ol/proj/proj4.js';
import _ol_reproj_Triangulation_ from '../../../../src/ol/reproj/Triangulation.js'; import Triangulation from '../../../../src/ol/reproj/Triangulation.js';
describe('ol.reproj.Triangulation', function() { describe('ol.reproj.Triangulation', function() {
@@ -23,7 +23,7 @@ describe('ol.reproj.Triangulation', function() {
describe('constructor', function() { describe('constructor', function() {
it('is trivial for identity', function() { it('is trivial for identity', function() {
var proj4326 = getProjection('EPSG:4326'); var proj4326 = getProjection('EPSG:4326');
var triangulation = new _ol_reproj_Triangulation_(proj4326, proj4326, var triangulation = new Triangulation(proj4326, proj4326,
[20, 20, 30, 30], [-180, -90, 180, 90], 0); [20, 20, 30, 30], [-180, -90, 180, 90], 0);
expect(triangulation.getTriangles().length).to.be(2); expect(triangulation.getTriangles().length).to.be(2);
}); });
@@ -31,14 +31,14 @@ describe('ol.reproj.Triangulation', function() {
it('is empty when outside source extent', function() { it('is empty when outside source extent', function() {
var proj4326 = getProjection('EPSG:4326'); var proj4326 = getProjection('EPSG:4326');
var proj27700 = getProjection('EPSG:27700'); var proj27700 = getProjection('EPSG:27700');
var triangulation = new _ol_reproj_Triangulation_(proj27700, proj4326, var triangulation = new Triangulation(proj27700, proj4326,
[0, 0, 10, 10], proj27700.getExtent(), 0); [0, 0, 10, 10], proj27700.getExtent(), 0);
expect(triangulation.getTriangles().length).to.be(0); expect(triangulation.getTriangles().length).to.be(0);
}); });
it('can handle null source extent', function() { it('can handle null source extent', function() {
var proj4326 = getProjection('EPSG:4326'); var proj4326 = getProjection('EPSG:4326');
var triangulation = new _ol_reproj_Triangulation_(proj4326, proj4326, var triangulation = new Triangulation(proj4326, proj4326,
[20, 20, 30, 30], null, 0); [20, 20, 30, 30], null, 0);
expect(triangulation.getTriangles().length).to.be(2); expect(triangulation.getTriangles().length).to.be(2);
}); });