Rename triangles to triangulation to be more precise
This commit is contained in:
@@ -55,9 +55,8 @@ ol.reproj.Image = function(sourceProj, targetProj,
|
|||||||
* @private
|
* @private
|
||||||
* @type {!ol.reproj.Triangulation}
|
* @type {!ol.reproj.Triangulation}
|
||||||
*/
|
*/
|
||||||
this.triangles_ = ol.reproj.triangulation.createForExtent(
|
this.triangulation_ = ol.reproj.triangulation.createForExtent(
|
||||||
targetExtent, sourceProj, targetProj,
|
targetExtent, sourceProj, targetProj, maxTargetExtent, maxSourceExtent);
|
||||||
maxTargetExtent, maxSourceExtent);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -71,7 +70,7 @@ ol.reproj.Image = function(sourceProj, targetProj,
|
|||||||
*/
|
*/
|
||||||
this.targetExtent_ = targetExtent;
|
this.targetExtent_ = targetExtent;
|
||||||
|
|
||||||
var srcExtent = ol.reproj.triangulation.getSourceExtent(this.triangles_);
|
var srcExtent = ol.reproj.triangulation.getSourceExtent(this.triangulation_);
|
||||||
|
|
||||||
var targetCenter = ol.extent.getCenter(targetExtent);
|
var targetCenter = ol.extent.getCenter(targetExtent);
|
||||||
var sourceResolution = ol.reproj.calculateSourceResolution(
|
var sourceResolution = ol.reproj.calculateSourceResolution(
|
||||||
@@ -133,7 +132,7 @@ ol.reproj.Image.prototype.reproject_ = function() {
|
|||||||
// render the reprojected content
|
// render the reprojected content
|
||||||
ol.reproj.renderTriangles(this.context_, this.srcImage_.getResolution(),
|
ol.reproj.renderTriangles(this.context_, this.srcImage_.getResolution(),
|
||||||
this.targetResolution_, this.targetExtent_,
|
this.targetResolution_, this.targetExtent_,
|
||||||
this.triangles_, [{
|
this.triangulation_, [{
|
||||||
extent: this.srcImage_.getExtent(),
|
extent: this.srcImage_.getExtent(),
|
||||||
image: this.srcImage_.getImage()
|
image: this.srcImage_.getImage()
|
||||||
}]);
|
}]);
|
||||||
|
|||||||
+12
-14
@@ -57,11 +57,18 @@ ol.reproj.Tile = function(sourceProj, sourceTileGrid,
|
|||||||
*/
|
*/
|
||||||
this.targetTileGrid_ = targetTileGrid;
|
this.targetTileGrid_ = targetTileGrid;
|
||||||
|
|
||||||
|
|
||||||
|
var targetExtent = targetTileGrid.getTileCoordExtent(this.getTileCoord());
|
||||||
|
var maxTargetExtent = this.targetTileGrid_.getExtent();
|
||||||
|
var maxSourceExtent = this.sourceTileGrid_.getExtent();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
* @type {!ol.reproj.Triangulation}
|
* @type {!ol.reproj.Triangulation}
|
||||||
*/
|
*/
|
||||||
this.triangles_ = [];
|
this.triangulation_ = ol.reproj.triangulation.createForExtent(
|
||||||
|
targetExtent, sourceProj, targetProj,
|
||||||
|
maxTargetExtent, maxSourceExtent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @private
|
* @private
|
||||||
@@ -81,23 +88,14 @@ ol.reproj.Tile = function(sourceProj, sourceTileGrid,
|
|||||||
*/
|
*/
|
||||||
this.srcZ_ = 0;
|
this.srcZ_ = 0;
|
||||||
|
|
||||||
|
|
||||||
var targetExtent = targetTileGrid.getTileCoordExtent(this.getTileCoord());
|
|
||||||
var maxTargetExtent = this.targetTileGrid_.getExtent();
|
|
||||||
var maxSourceExtent = this.sourceTileGrid_.getExtent();
|
|
||||||
|
|
||||||
if (!ol.extent.intersects(maxTargetExtent, targetExtent)) {
|
if (!ol.extent.intersects(maxTargetExtent, targetExtent)) {
|
||||||
// Tile is completely outside range -> EMPTY
|
// Tile is completely outside range -> EMPTY
|
||||||
// TODO: is it actually correct that the source even creates the tile ?
|
// TODO: is it actually correct that the source even creates the tile ?
|
||||||
this.state = ol.TileState.EMPTY;
|
this.state = ol.TileState.EMPTY;
|
||||||
//return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.triangles_ = ol.reproj.triangulation.createForExtent(
|
if (this.triangulation_.triangles.length === 0) {
|
||||||
targetExtent, sourceProj, targetProj,
|
|
||||||
maxTargetExtent, maxSourceExtent);
|
|
||||||
|
|
||||||
if (this.triangles_.length === 0) {
|
|
||||||
// no valid triangles -> EMPTY
|
// no valid triangles -> EMPTY
|
||||||
this.state = ol.TileState.EMPTY;
|
this.state = ol.TileState.EMPTY;
|
||||||
return;
|
return;
|
||||||
@@ -116,7 +114,7 @@ ol.reproj.Tile = function(sourceProj, sourceTileGrid,
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.srcZ_ = sourceTileGrid.getZForResolution(sourceResolution);
|
this.srcZ_ = sourceTileGrid.getZForResolution(sourceResolution);
|
||||||
var srcExtent = ol.reproj.triangulation.getSourceExtent(this.triangles_);
|
var srcExtent = ol.reproj.triangulation.getSourceExtent(this.triangulation_);
|
||||||
|
|
||||||
var sourceProjExtent = sourceProj.getExtent();
|
var sourceProjExtent = sourceProj.getExtent();
|
||||||
if (!sourceProj.isGlobal() && sourceProjExtent) {
|
if (!sourceProj.isGlobal() && sourceProjExtent) {
|
||||||
@@ -241,7 +239,7 @@ ol.reproj.Tile.prototype.reproject_ = function() {
|
|||||||
if (sources.length > 0) {
|
if (sources.length > 0) {
|
||||||
var targetExtent = this.targetTileGrid_.getTileCoordExtent(tileCoord);
|
var targetExtent = this.targetTileGrid_.getTileCoordExtent(tileCoord);
|
||||||
ol.reproj.renderTriangles(context, srcResolution, targetResolution,
|
ol.reproj.renderTriangles(context, srcResolution, targetResolution,
|
||||||
targetExtent, this.triangles_, sources);
|
targetExtent, this.triangulation_, sources);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.canvas_ = context.canvas;
|
this.canvas_ = context.canvas;
|
||||||
|
|||||||
Reference in New Issue
Block a user