Use named imports from extent

This commit is contained in:
Andreas Hocevar
2017-12-13 14:05:42 +01:00
parent 7247ccbf38
commit c0c43bca84
77 changed files with 360 additions and 385 deletions
+5 -6
View File
@@ -7,7 +7,7 @@ import _ol_ImageBase_ from '../ImageBase.js';
import _ol_ImageState_ from '../ImageState.js';
import _ol_events_ from '../events.js';
import _ol_events_EventType_ from '../events/EventType.js';
import _ol_extent_ from '../extent.js';
import {getCenter, getIntersection, getHeight, getWidth} from '../extent.js';
import _ol_reproj_ from '../reproj.js';
import _ol_reproj_Triangulation_ from '../reproj/Triangulation.js';
@@ -43,9 +43,9 @@ var _ol_reproj_Image_ = function(sourceProj, targetProj,
var maxTargetExtent = targetProj.getExtent();
var limitedTargetExtent = maxTargetExtent ?
_ol_extent_.getIntersection(targetExtent, maxTargetExtent) : targetExtent;
getIntersection(targetExtent, maxTargetExtent) : targetExtent;
var targetCenter = _ol_extent_.getCenter(limitedTargetExtent);
var targetCenter = getCenter(limitedTargetExtent);
var sourceResolution = _ol_reproj_.calculateSourceResolution(
sourceProj, targetProj, targetCenter, targetResolution);
@@ -145,9 +145,8 @@ _ol_reproj_Image_.prototype.getProjection = function() {
_ol_reproj_Image_.prototype.reproject_ = function() {
var sourceState = this.sourceImage_.getState();
if (sourceState == _ol_ImageState_.LOADED) {
var width = _ol_extent_.getWidth(this.targetExtent_) / this.targetResolution_;
var height =
_ol_extent_.getHeight(this.targetExtent_) / this.targetResolution_;
var width = getWidth(this.targetExtent_) / this.targetResolution_;
var height = getHeight(this.targetExtent_) / this.targetResolution_;
this.canvas_ = _ol_reproj_.render(width, height, this.sourcePixelRatio_,
this.sourceImage_.getResolution(), this.maxSourceExtent_,
+7 -8
View File
@@ -7,7 +7,7 @@ import _ol_Tile_ from '../Tile.js';
import _ol_TileState_ from '../TileState.js';
import _ol_events_ from '../events.js';
import _ol_events_EventType_ from '../events/EventType.js';
import _ol_extent_ from '../extent.js';
import {getArea, getCenter, getIntersection} from '../extent.js';
import _ol_math_ from '../math.js';
import _ol_reproj_ from '../reproj.js';
import _ol_reproj_Triangulation_ from '../reproj/Triangulation.js';
@@ -103,9 +103,9 @@ var _ol_reproj_Tile_ = function(sourceProj, sourceTileGrid,
var maxSourceExtent = this.sourceTileGrid_.getExtent();
var limitedTargetExtent = maxTargetExtent ?
_ol_extent_.getIntersection(targetExtent, maxTargetExtent) : targetExtent;
getIntersection(targetExtent, maxTargetExtent) : targetExtent;
if (_ol_extent_.getArea(limitedTargetExtent) === 0) {
if (getArea(limitedTargetExtent) === 0) {
// Tile is completely outside range -> EMPTY
// TODO: is it actually correct that the source even creates the tile ?
this.state = _ol_TileState_.EMPTY;
@@ -117,15 +117,14 @@ var _ol_reproj_Tile_ = function(sourceProj, sourceTileGrid,
if (!maxSourceExtent) {
maxSourceExtent = sourceProjExtent;
} else {
maxSourceExtent = _ol_extent_.getIntersection(
maxSourceExtent, sourceProjExtent);
maxSourceExtent = getIntersection(maxSourceExtent, sourceProjExtent);
}
}
var targetResolution = targetTileGrid.getResolution(
this.wrappedTileCoord_[0]);
var targetCenter = _ol_extent_.getCenter(limitedTargetExtent);
var targetCenter = getCenter(limitedTargetExtent);
var sourceResolution = _ol_reproj_.calculateSourceResolution(
sourceProj, targetProj, targetCenter, targetResolution);
@@ -163,11 +162,11 @@ var _ol_reproj_Tile_ = function(sourceProj, sourceTileGrid,
sourceExtent[3] = _ol_math_.clamp(
sourceExtent[3], maxSourceExtent[1], maxSourceExtent[3]);
} else {
sourceExtent = _ol_extent_.getIntersection(sourceExtent, maxSourceExtent);
sourceExtent = getIntersection(sourceExtent, maxSourceExtent);
}
}
if (!_ol_extent_.getArea(sourceExtent)) {
if (!getArea(sourceExtent)) {
this.state = _ol_TileState_.EMPTY;
} else {
var sourceRange = sourceTileGrid.getTileRangeForExtentAndZ(
+18 -19
View File
@@ -1,7 +1,8 @@
/**
* @module ol/reproj/Triangulation
*/
import _ol_extent_ from '../extent.js';
import {boundingExtent, createEmpty, extendCoordinate, getBottomLeft, getBottomRight,
getTopLeft, getTopRight, getWidth, intersects} from '../extent.js';
import _ol_math_ from '../math.js';
import _ol_proj_ from '../proj.js';
@@ -104,27 +105,26 @@ var _ol_reproj_Triangulation_ = function(sourceProj, targetProj, targetExtent,
this.canWrapXInSource_ = this.sourceProj_.canWrapX() &&
!!maxSourceExtent &&
!!this.sourceProj_.getExtent() &&
(_ol_extent_.getWidth(maxSourceExtent) ==
_ol_extent_.getWidth(this.sourceProj_.getExtent()));
(getWidth(maxSourceExtent) == getWidth(this.sourceProj_.getExtent()));
/**
* @type {?number}
* @private
*/
this.sourceWorldWidth_ = this.sourceProj_.getExtent() ?
_ol_extent_.getWidth(this.sourceProj_.getExtent()) : null;
getWidth(this.sourceProj_.getExtent()) : null;
/**
* @type {?number}
* @private
*/
this.targetWorldWidth_ = this.targetProj_.getExtent() ?
_ol_extent_.getWidth(this.targetProj_.getExtent()) : null;
getWidth(this.targetProj_.getExtent()) : null;
var destinationTopLeft = _ol_extent_.getTopLeft(targetExtent);
var destinationTopRight = _ol_extent_.getTopRight(targetExtent);
var destinationBottomRight = _ol_extent_.getBottomRight(targetExtent);
var destinationBottomLeft = _ol_extent_.getBottomLeft(targetExtent);
var destinationTopLeft = getTopLeft(targetExtent);
var destinationTopRight = getTopRight(targetExtent);
var destinationBottomRight = getBottomRight(targetExtent);
var destinationBottomLeft = getBottomLeft(targetExtent);
var sourceTopLeft = this.transformInv_(destinationTopLeft);
var sourceTopRight = this.transformInv_(destinationTopRight);
var sourceBottomRight = this.transformInv_(destinationBottomRight);
@@ -217,9 +217,9 @@ _ol_reproj_Triangulation_.prototype.addTriangle_ = function(a, b, c,
_ol_reproj_Triangulation_.prototype.addQuad_ = function(a, b, c, d,
aSrc, bSrc, cSrc, dSrc, maxSubdivision) {
var sourceQuadExtent = _ol_extent_.boundingExtent([aSrc, bSrc, cSrc, dSrc]);
var sourceQuadExtent = boundingExtent([aSrc, bSrc, cSrc, dSrc]);
var sourceCoverageX = this.sourceWorldWidth_ ?
_ol_extent_.getWidth(sourceQuadExtent) / this.sourceWorldWidth_ : null;
getWidth(sourceQuadExtent) / this.sourceWorldWidth_ : null;
var sourceWorldWidth = /** @type {number} */ (this.sourceWorldWidth_);
// when the quad is wrapped in the source projection
@@ -231,9 +231,8 @@ _ol_reproj_Triangulation_.prototype.addQuad_ = function(a, b, c, d,
if (maxSubdivision > 0) {
if (this.targetProj_.isGlobal() && this.targetWorldWidth_) {
var targetQuadExtent = _ol_extent_.boundingExtent([a, b, c, d]);
var targetCoverageX =
_ol_extent_.getWidth(targetQuadExtent) / this.targetWorldWidth_;
var targetQuadExtent = boundingExtent([a, b, c, d]);
var targetCoverageX = getWidth(targetQuadExtent) / this.targetWorldWidth_;
needsSubdivision |=
targetCoverageX > MAX_TRIANGLE_WIDTH;
}
@@ -244,7 +243,7 @@ _ol_reproj_Triangulation_.prototype.addQuad_ = function(a, b, c, d,
}
if (!needsSubdivision && this.maxSourceExtent_) {
if (!_ol_extent_.intersects(sourceQuadExtent, this.maxSourceExtent_)) {
if (!intersects(sourceQuadExtent, this.maxSourceExtent_)) {
// whole quad outside source projection extent -> ignore
return;
}
@@ -328,13 +327,13 @@ _ol_reproj_Triangulation_.prototype.addQuad_ = function(a, b, c, d,
* @return {ol.Extent} Calculated extent.
*/
_ol_reproj_Triangulation_.prototype.calculateSourceExtent = function() {
var extent = _ol_extent_.createEmpty();
var extent = createEmpty();
this.triangles_.forEach(function(triangle, i, arr) {
var src = triangle.source;
_ol_extent_.extendCoordinate(extent, src[0]);
_ol_extent_.extendCoordinate(extent, src[1]);
_ol_extent_.extendCoordinate(extent, src[2]);
extendCoordinate(extent, src[0]);
extendCoordinate(extent, src[1]);
extendCoordinate(extent, src[2]);
});
return extent;