Skip to content

Commit

Permalink
Merge pull request #117 from keichan34/fix-relief-tile-layer
Browse files Browse the repository at this point in the history
ReliefTileLayer(自分で作る色別標高図)の修正
  • Loading branch information
johofukyu authored Jan 10, 2024
2 parents ef51137 + fcf3a9f commit 6f2c424
Showing 1 changed file with 5 additions and 28 deletions.
33 changes: 5 additions & 28 deletions js/gsimaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -17192,8 +17192,6 @@ GSI.ReliefTileLayer = L.TileLayer.extend({
this._elevationData = null;
L.TileLayer.prototype.initialize.call(this, url, options);

this._requests = {};

this._drawer = new GSI.ReliefTileLayer.TileDrawer();
},

Expand Down Expand Up @@ -17241,22 +17239,6 @@ GSI.ReliefTileLayer = L.TileLayer.extend({

},

_removeTile: function (key) {
var req = this._requests[key];

if (req) {
L.DomUtil.remove(req.el);

if (req.loader) {
req.loader.destroy();
delete req.loader;

}

delete this._requests[key];
}
L.TileLayer.prototype._removeTile.call(this, key);
},

// タイル生成
createTile: function (coords, done) {
Expand All @@ -17275,10 +17257,11 @@ GSI.ReliefTileLayer = L.TileLayer.extend({

// タイル読み込み
_loadTile: function (tile, coords, done) {
var key = this._tileCoordsToKey(coords);
var req = this._requests[key];
if (req) return;
loader = new GSI.FreeReliefDEMLoader(this._map, coords.x, coords.y, coords.z, this._demUrlList, {
// 以前、読み込み中タイルがもう一度読み込みさせようとしていましたが、
// その場合、読み込み中タイルが表示されなくなるため、
// 現在は同じタイルが読み込まれる可能性があるが、読み込み中タイルをチェックせずに読み込むようにしています。

var loader = new GSI.FreeReliefDEMLoader(this._map, coords.x, coords.y, coords.z, this._demUrlList, {
overZooming: true,
useHillshademap: this._elevationData.useHillshademap,
hillshademapUrl: this._hillshademapUrl
Expand All @@ -17291,19 +17274,13 @@ GSI.ReliefTileLayer = L.TileLayer.extend({
};

loader.on("load", L.bind(function (e) {

var obj = e.target;

this._drawer.draw(obj._params.tile, obj.getData(), obj.getHillshademapImage());
obj._params.done(null, obj._params.tile);

}, this));

this._requests[key] = {
el: tile,
loader: loader
};

loader.load();
}
});
Expand Down

0 comments on commit 6f2c424

Please sign in to comment.