Rename _ol_reproj_Triangulation_ to Triangulation
This commit is contained in:
@@ -9,7 +9,7 @@ import _ol_events_ from '../events.js';
|
||||
import EventType from '../events/EventType.js';
|
||||
import {getCenter, getIntersection, getHeight, getWidth} from '../extent.js';
|
||||
import _ol_reproj_ from '../reproj.js';
|
||||
import _ol_reproj_Triangulation_ from '../reproj/Triangulation.js';
|
||||
import Triangulation from '../reproj/Triangulation.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -55,7 +55,7 @@ var ReprojImage = function(sourceProj, targetProj,
|
||||
* @private
|
||||
* @type {!ol.reproj.Triangulation}
|
||||
*/
|
||||
this.triangulation_ = new _ol_reproj_Triangulation_(
|
||||
this.triangulation_ = new Triangulation(
|
||||
sourceProj, targetProj, limitedTargetExtent, this.maxSourceExtent_,
|
||||
sourceResolution * errorThresholdInPixels);
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import EventType from '../events/EventType.js';
|
||||
import {getArea, getCenter, getIntersection} from '../extent.js';
|
||||
import {clamp} from '../math.js';
|
||||
import _ol_reproj_ from '../reproj.js';
|
||||
import _ol_reproj_Triangulation_ from '../reproj/Triangulation.js';
|
||||
import Triangulation from '../reproj/Triangulation.js';
|
||||
|
||||
/**
|
||||
* @classdesc
|
||||
@@ -142,7 +142,7 @@ var ReprojTile = function(sourceProj, sourceTileGrid,
|
||||
* @private
|
||||
* @type {!ol.reproj.Triangulation}
|
||||
*/
|
||||
this.triangulation_ = new _ol_reproj_Triangulation_(
|
||||
this.triangulation_ = new Triangulation(
|
||||
sourceProj, targetProj, limitedTargetExtent, maxSourceExtent,
|
||||
sourceResolution * errorThresholdInPixels);
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ var MAX_TRIANGLE_WIDTH = 0.25;
|
||||
* @param {number} errorThreshold Acceptable error (in source units).
|
||||
* @constructor
|
||||
*/
|
||||
var _ol_reproj_Triangulation_ = function(sourceProj, targetProj, targetExtent,
|
||||
var Triangulation = function(sourceProj, targetProj, targetExtent,
|
||||
maxSourceExtent, errorThreshold) {
|
||||
|
||||
/**
|
||||
@@ -189,7 +189,7 @@ var _ol_reproj_Triangulation_ = function(sourceProj, targetProj, targetExtent,
|
||||
* @param {ol.Coordinate} cSrc The source c coordinate.
|
||||
* @private
|
||||
*/
|
||||
_ol_reproj_Triangulation_.prototype.addTriangle_ = function(a, b, c,
|
||||
Triangulation.prototype.addTriangle_ = function(a, b, c,
|
||||
aSrc, bSrc, cSrc) {
|
||||
this.triangles_.push({
|
||||
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.
|
||||
* @private
|
||||
*/
|
||||
_ol_reproj_Triangulation_.prototype.addQuad_ = function(a, b, c, d,
|
||||
Triangulation.prototype.addQuad_ = function(a, b, c, d,
|
||||
aSrc, bSrc, cSrc, dSrc, maxSubdivision) {
|
||||
|
||||
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.
|
||||
*/
|
||||
_ol_reproj_Triangulation_.prototype.calculateSourceExtent = function() {
|
||||
Triangulation.prototype.calculateSourceExtent = function() {
|
||||
var extent = createEmpty();
|
||||
|
||||
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.
|
||||
*/
|
||||
_ol_reproj_Triangulation_.prototype.getTriangles = function() {
|
||||
Triangulation.prototype.getTriangles = function() {
|
||||
return this.triangles_;
|
||||
};
|
||||
export default _ol_reproj_Triangulation_;
|
||||
export default Triangulation;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import {addCommon, clearAllProjections, get as getProjection} from '../../../../src/ol/proj.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() {
|
||||
@@ -23,7 +23,7 @@ describe('ol.reproj.Triangulation', function() {
|
||||
describe('constructor', function() {
|
||||
it('is trivial for identity', function() {
|
||||
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);
|
||||
expect(triangulation.getTriangles().length).to.be(2);
|
||||
});
|
||||
@@ -31,14 +31,14 @@ describe('ol.reproj.Triangulation', function() {
|
||||
it('is empty when outside source extent', function() {
|
||||
var proj4326 = getProjection('EPSG:4326');
|
||||
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);
|
||||
expect(triangulation.getTriangles().length).to.be(0);
|
||||
});
|
||||
|
||||
it('can handle null source extent', function() {
|
||||
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);
|
||||
expect(triangulation.getTriangles().length).to.be(2);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user