Merge branch 'master' of https://github.com/openlayers/ol3
This commit is contained in:
@@ -91,6 +91,8 @@ ol.Map.DEFAULT_TILE_SIZE = 256;
|
||||
* @return {ol.Loc} Location.
|
||||
*/
|
||||
ol.Map.prototype.getCenter = function() {
|
||||
var proj = this.getUserProjection();
|
||||
this.center_ = this.center_.transform(proj);
|
||||
return this.center_;
|
||||
};
|
||||
|
||||
@@ -201,7 +203,12 @@ ol.Map.prototype.getResolutionForZoom = function(zoom) {
|
||||
* @param {ol.Loc} center Center.
|
||||
*/
|
||||
ol.Map.prototype.setCenter = function(center) {
|
||||
this.center_ = center;
|
||||
var proj = center.getProjection();
|
||||
if (goog.isNull(proj)) {
|
||||
proj = this.getUserProjection();
|
||||
center.setProjection(proj);
|
||||
}
|
||||
this.center_ = center.transform(this.getProjection());
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -130,26 +130,22 @@ ol.layer.XYZ.prototype.getData = function(bounds, resolution) {
|
||||
offsetY = Math.floor(
|
||||
(tileOriginY - boundsMaxY) / tileHeightGeo),
|
||||
|
||||
gridWidth = Math.ceil(
|
||||
(boundsMaxX - boundsMinX) / tileWidthGeo),
|
||||
gridHeight = Math.ceil(
|
||||
(boundsMaxY - boundsMinY) / tileHeightGeo);
|
||||
gridLeft = tileOriginX + tileWidthGeo * offsetX,
|
||||
gridTop = tileOriginY - tileHeightGeo * offsetY;
|
||||
|
||||
var tiles = [],
|
||||
tile,
|
||||
url,
|
||||
i, ii,
|
||||
j, jj;
|
||||
|
||||
for (i=0, ii=gridWidth; i<ii; i++) {
|
||||
var tiles = [], tile, url, i = 0, j;
|
||||
while (gridTop - (i * tileHeightGeo) > boundsMinY) {
|
||||
tiles[i] = [];
|
||||
for (j=0, jj=gridHeight; j<jj; j++) {
|
||||
j = 0;
|
||||
while (gridLeft + (j * tileWidthGeo) < boundsMaxX) {
|
||||
url = me.url_.replace('{x}', offsetX + i + '')
|
||||
.replace('{y}', offsetY + j + '')
|
||||
.replace('{z}', zoom);
|
||||
tile = new ol.Tile(url);
|
||||
tiles[i][j] = tile;
|
||||
j++;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
||||
return new ol.TileSet(tiles, tileWidth, tileHeight, resolution);
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
|
||||
<!-- include source files here... -->
|
||||
<script type="text/javascript" src="http://localhost:9810/compile?id=ol&mode=SIMPLE"></script>
|
||||
<script type="text/javascript" src="http://localhost:9810/compile?id=ol&mode=RAW"></script>
|
||||
|
||||
<!-- common jasmine extensions -->
|
||||
<script type="text/javascript" src="jasmine-extensions.js"></script>
|
||||
|
||||
@@ -64,7 +64,6 @@ describe('ol.layer.XYZ', function() {
|
||||
});
|
||||
});
|
||||
|
||||
/*
|
||||
describe('extent -64,-64,64,64, resolution 0.5', function() {
|
||||
|
||||
it('returns the expected data', function() {
|
||||
@@ -94,6 +93,6 @@ describe('ol.layer.XYZ', function() {
|
||||
expect(tile.getImg()).toBeDefined();
|
||||
});
|
||||
});
|
||||
*/
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user