Merge branch 'nodupe'

This commit is contained in:
Young Hahn
2012-04-30 18:43:19 -04:00

View File

@@ -566,31 +566,6 @@ MBTiles.prototype.putTile = function(z, x, y, data, callback) {
else return callback(null);
};
// Inserts a duplicate tile into the MBTiles store. Scheme is XYZ.
//
// - @param {Number} z tile z coordinate
// - @param {Number} x tile x coordinate
// - @param {Number} y tile y coordinate
// - @param {Number} duplicate tile ID
// - @param {Function(err)} callback
MBTiles.prototype.putDuplicateTile = function(z, x, y, id, callback) {
if (typeof callback !== 'function') throw new Error('Callback needed');
if (!this.open) return callback(new Error('MBTiles not yet loaded'));
if (!this._isWritable) return callback(new Error('MBTiles not in write mode'));
// Flip Y coordinate because MBTiles files are TMS.
y = (1 << z) - 1 - y;
// This corresponds to the map table.
var coords = hash(z, x, y);
if (!this._mapCache[coords]) this._mapCache[coords] = { z: z, x: x, y: y };
this._mapCache[coords].tile_id = id;
// Only commit when we can insert at least batchSize rows.
if (++this._pending >= this._batchSize) return this._commit(callback);
else return callback(null);
};
// Inserts a grid into the MBTiles store. Scheme is XYZ.
//
// - @param {Number} z grid z coordinate
@@ -642,31 +617,6 @@ MBTiles.prototype.putGrid = function(z, x, y, data, callback) {
});
};
// Inserts a duplicate grid into the MBTiles store. Scheme is XYZ.
//
// - @param {Number} z grid z coordinate
// - @param {Number} x grid x coordinate
// - @param {Number} y grid y coordinate
// - @param {Number} duplicate grid ID
// - @param {Function(err)} callback
MBTiles.prototype.putDuplicateGrid = function(z, x, y, id, callback) {
if (typeof callback !== 'function') throw new Error('Callback needed');
if (!this.open) return callback(new Error('MBTiles not yet loaded'));
if (!this._isWritable) return callback(new Error('MBTiles not in write mode'));
// Flip Y coordinate because MBTiles files are TMS.
y = (1 << z) - 1 - y;
// This corresponds to the map table.
var coords = hash(z, x, y);
if (!this._mapCache[coords]) this._mapCache[coords] = { z: z, x: x, y: y };
this._mapCache[coords].grid_id = id;
// Only commit when we can insert at least batchSize rows.
if (++this._pending >= this._batchSize) return this._commit(callback);
else return callback(null);
};
MBTiles.prototype.putInfo = function(data, callback) {
if (typeof callback !== 'function') throw new Error('Callback needed');
if (!this.open) return callback(new Error('MBTiles not yet loaded'));