Permalink
Browse files

Pushing 5.0.1, with real support for MM 1.0.0-alpha2.

This changes the connector slightly to adapt to new MM changes.
  • Loading branch information...
1 parent 685c8e4 commit 77e78c7ef74d5cd28d68cb8c9a36a347f5a37276 @tmcw tmcw committed Mar 14, 2012
View
@@ -1,5 +1,10 @@
## Changelog
+## 5.0.1
+
+* Real support for Modest Maps 1.0.0-alpha2
+* No longer requires layers to be wrapped with `MM.Layer()` in MM 1.x
+
## 5.0.0-alpha*
* Initial support for Modest Maps 1.0.0-alpha
View
@@ -8,7 +8,7 @@ For full documentation of supported mapping APIs and how to use Wax see http://m
There are three current development branches of Wax:
-* `master`, this branch, supports **Modest Maps 1.x**, the latest version of Modest Maps _only_
+* `master`, this branch, supports **Modest Maps 1.0.0-alpha2 and later**
* 4.x supports **Modest Maps 0.x**, older versions of Modest Maps
* 6.x is **unstable** and will introduce new **event-based interaction APIs**
@@ -3,7 +3,7 @@ wax.mm = wax.mm || {};
// A layer connector for Modest Maps conformant to TileJSON
// https://github.com/mapbox/tilejson
-wax.mm.connector = function(options) {
+wax.mm._provider = function(options) {
this.options = {
tiles: options.tiles,
scheme: options.scheme || 'xyz',
@@ -13,7 +13,7 @@ wax.mm.connector = function(options) {
};
};
-wax.mm.connector.prototype = {
+wax.mm._provider.prototype = {
outerLimits: function() {
return [
this.locationCoordinate(
@@ -28,6 +28,7 @@ wax.mm.connector.prototype = {
},
getTile: function(c) {
if (!(coord = this.sourceCoordinate(c))) return null;
+ if (coord.zoom < this.options.minzoom || coord.zoom > this.options.maxzoom) return null;
coord.row = (this.options.scheme === 'tms') ?
Math.pow(2, coord.zoom) - coord.row - 1 :
@@ -48,8 +49,11 @@ wax.mm.connector.prototype = {
}
};
-// Wax shouldn't throw any exceptions if the external it relies on isn't
-// present, so check for modestmaps.
if (MM) {
- MM.extend(wax.mm.connector, MM.MapProvider);
+ MM.extend(wax.mm._provider, MM.MapProvider);
}
+
+wax.mm.connector = function(options) {
+ var x = new wax.mm._provider(options);
+ return new MM.Layer(x);
+};
View
@@ -1,4 +1,4 @@
-/* wax - 5.0.0-alpha2 - 1.0.4-489-g7b6392f */
+/* wax - 5.0.0-alpha2 - 1.0.4-496-g685c8e4 */
/*!
@@ -1539,7 +1539,7 @@ wax.GridInstance = function(grid_tile, formatter, options) {
// Resolve the UTF-8 encoding stored in grids to simple
// number values.
- // See the [utfgrid section of the mbtiles spec](https://github.com/mapbox/mbtiles-spec/blob/master/1.1/utfgrid.md)
+ // See the [utfgrid spec](https://github.com/mapbox/utfgrid-spec)
// for details.
function resolveCode(key) {
if (key >= 93) key--;
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -1,4 +1,4 @@
-/* wax - 5.0.0-alpha2 - 1.0.4-489-g7b6392f */
+/* wax - 5.0.0-alpha2 - 1.0.4-496-g685c8e4 */
/*!
@@ -1539,7 +1539,7 @@ wax.GridInstance = function(grid_tile, formatter, options) {
// Resolve the UTF-8 encoding stored in grids to simple
// number values.
- // See the [utfgrid section of the mbtiles spec](https://github.com/mapbox/mbtiles-spec/blob/master/1.1/utfgrid.md)
+ // See the [utfgrid spec](https://github.com/mapbox/utfgrid-spec)
// for details.
function resolveCode(key) {
if (key >= 93) key--;
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View
@@ -1,4 +1,4 @@
-/* wax - 5.0.0-alpha2 - 1.0.4-489-g7b6392f */
+/* wax - 5.0.0-alpha2 - 1.0.4-496-g685c8e4 */
/*!
@@ -1539,7 +1539,7 @@ wax.GridInstance = function(grid_tile, formatter, options) {
// Resolve the UTF-8 encoding stored in grids to simple
// number values.
- // See the [utfgrid section of the mbtiles spec](https://github.com/mapbox/mbtiles-spec/blob/master/1.1/utfgrid.md)
+ // See the [utfgrid spec](https://github.com/mapbox/utfgrid-spec)
// for details.
function resolveCode(key) {
if (key >= 93) key--;
@@ -3510,7 +3510,7 @@ wax.mm = wax.mm || {};
// A layer connector for Modest Maps conformant to TileJSON
// https://github.com/mapbox/tilejson
-wax.mm.connector = function(options) {
+wax.mm._provider = function(options) {
this.options = {
tiles: options.tiles,
scheme: options.scheme || 'xyz',
@@ -3520,7 +3520,7 @@ wax.mm.connector = function(options) {
};
};
-wax.mm.connector.prototype = {
+wax.mm._provider.prototype = {
outerLimits: function() {
return [
this.locationCoordinate(
@@ -3535,6 +3535,7 @@ wax.mm.connector.prototype = {
},
getTile: function(c) {
if (!(coord = this.sourceCoordinate(c))) return null;
+ if (coord.zoom < this.options.minzoom || coord.zoom > this.options.maxzoom) return null;
coord.row = (this.options.scheme === 'tms') ?
Math.pow(2, coord.zoom) - coord.row - 1 :
@@ -3555,8 +3556,11 @@ wax.mm.connector.prototype = {
}
};
-// Wax shouldn't throw any exceptions if the external it relies on isn't
-// present, so check for modestmaps.
if (MM) {
- MM.extend(wax.mm.connector, MM.MapProvider);
+ MM.extend(wax.mm._provider, MM.MapProvider);
}
+
+wax.mm.connector = function(options) {
+ var x = new wax.mm._provider(options);
+ return new MM.Layer(x);
+};
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,4 +1,4 @@
-/* wax - 5.0.0-alpha2 - 1.0.4-489-g7b6392f */
+/* wax - 5.0.0-alpha2 - 1.0.4-496-g685c8e4 */
/*!
@@ -1386,7 +1386,8 @@ wax.ol.connector = function(tilejson) {
tilejson.tiles, {
sphericalMercator: true,
zoomOffset: tilejson.minzoom,
- numZoomLevels: tilejson.maxzoom - tilejson.minzoom
+ numZoomLevels: tilejson.maxzoom - tilejson.minzoom,
+ attribution: tilejson.attribution
});
};
;wax = wax || {};
@@ -1557,7 +1558,7 @@ wax.GridInstance = function(grid_tile, formatter, options) {
// Resolve the UTF-8 encoding stored in grids to simple
// number values.
- // See the [utfgrid section of the mbtiles spec](https://github.com/mapbox/mbtiles-spec/blob/master/1.1/utfgrid.md)
+ // See the [utfgrid spec](https://github.com/mapbox/utfgrid-spec)
// for details.
function resolveCode(key) {
if (key >= 93) key--;
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,4 +1,4 @@
-/* wax - 5.0.0-alpha2 - 1.0.4-489-g7b6392f */
+/* wax - 5.0.0-alpha2 - 1.0.4-496-g685c8e4 */
/*!
@@ -175,7 +175,7 @@ wax.GridInstance = function(grid_tile, formatter, options) {
// Resolve the UTF-8 encoding stored in grids to simple
// number values.
- // See the [utfgrid section of the mbtiles spec](https://github.com/mapbox/mbtiles-spec/blob/master/1.1/utfgrid.md)
+ // See the [utfgrid spec](https://github.com/mapbox/utfgrid-spec)
// for details.
function resolveCode(key) {
if (key >= 93) key--;
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View

Large diffs are not rendered by default.

Oops, something went wrong.
View
@@ -1,9 +1,4 @@
describe('util', function() {
- // beforeEach(function() {
- // player = new Player();
- // song = new Song();
- // });
-
it('should be able to recognize strings', function() {
expect(wax.util.isString('Tom')).toEqual(true);
expect(wax.util.isString(2)).toEqual(false);
@@ -18,45 +13,4 @@ describe('util', function() {
expect(wax.util.keys({a: 2})).toEqual(['a']);
expect(wax.util.keys({})).toEqual([]);
});
-
- //describe("when song has been paused", function() {
- // beforeEach(function() {
- // player.play(song);
- // player.pause();
- // });
-
- // it("should indicate that the song is currently paused", function() {
- // expect(player.isPlaying).toBeFalsy();
-
- // // demonstrates use of 'not' with a custom matcher
- // expect(player).not.toBePlaying(song);
- // });
-
- // it("should be possible to resume", function() {
- // player.resume();
- // expect(player.isPlaying).toBeTruthy();
- // expect(player.currentlyPlayingSong).toEqual(song);
- // });
- //});
-
- //// demonstrates use of spies to intercept and test method calls
- //it("tells the current song if the user has made it a favorite", function() {
- // spyOn(song, 'persistFavoriteStatus');
-
- // player.play(song);
- // player.makeFavorite();
-
- // expect(song.persistFavoriteStatus).toHaveBeenCalledWith(true);
- //});
-
- ////demonstrates use of expected exceptions
- //describe("#resume", function() {
- // it("should throw an exception if song is already playing", function() {
- // player.play(song);
-
- // expect(function() {
- // player.resume();
- // }).toThrow("song is already playing");
- // });
- //});
});

0 comments on commit 77e78c7

Please sign in to comment.