Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nocoerce #98

Merged
merged 2 commits into from
Feb 1, 2012
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/anyscale/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

var template = 'http://{S}tile.openstreetmap.org/{Z}/{X}/{Y}.png';
var subdomains = [ '', 'a.', 'b.', 'c.' ];
var provider = new MM.TemplatedMapProvider(template, subdomains);
var provider = new MM.TemplatedLayer(template, subdomains);

map = new MM.Map('map', provider, null, [
new MM.MouseWheelHandler(null, true)
Expand Down
4 changes: 2 additions & 2 deletions examples/bubble/canvas-bubble.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ <h1>Modest Maps JS</h1>
// "import" the namespace
var mm = com.modestmaps;

var provider = new mm.TemplatedMapProvider('http://osm-bayarea.s3.amazonaws.com/{Z}-r{Y}-c{X}.jpg');
var layer = new mm.TemplatedLayer('http://osm-bayarea.s3.amazonaws.com/{Z}-r{Y}-c{X}.jpg');

map = new mm.Map('map', provider, new mm.Point(1024,768))
map = new mm.Map('map', layer, new mm.Point(1024,768))

var f = new mm.Follower(map, new mm.Location(37.811530, -122.2666097), 'Broadway and Grand');

Expand Down
8 changes: 2 additions & 6 deletions examples/bubble/follower-canvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,9 @@ if (!com) {
dimensions: null,
margin: null,

draw: function(map)
{
console.log(Date.now());

draw: function(map) {
try {
var point = map.coordinatePoint(this.coord);

} catch(e) {
console.error(e);
// too soon?
Expand Down Expand Up @@ -148,4 +144,4 @@ if (!com) {

};

})(com.modestmaps)
})(com.modestmaps)
16 changes: 4 additions & 12 deletions examples/cabs/cabspotting.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,33 +10,25 @@

function initMap() {
// "import" the namespace
var mm = com.modestmaps;

// please use your own API key, see http://developers.cloudmade.com/ for more details
var provider = new mm.CloudMadeProvider('1a914755a77758e49e19a26e799268b7','999');

map = new mm.Map('map', provider, new mm.Point(640,480))

map.setCenterZoom(new mm.Location(37.774, -122.422), 11);
var provider = new MM.Layer(new MM.CloudMadeProvider('1a914755a77758e49e19a26e799268b7','999'));
map = new MM.Map('map', provider, new MM.Point(640,480))
map.setCenterZoom(new MM.Location(37.774, -122.422), 11);

loadYQL("http://cabspotting.org/cabs.xml.php", 'cablist');
}

function loadYQL(url, callback) {

var yqlURL = 'http://query.yahooapis.com/v1/public/yql';

var yqlArgs = {
var yqlArgs = {
q: 'select * from xml where url="'+url+'"',
format: 'json',
callback: callback
};

var queries = [];
for (var prop in yqlArgs) {
queries.push(prop + '=' + yqlArgs[prop]);
}

var script = document.createElement('script');
script.src = yqlURL + '?' + queries.join('&');
document.getElementsByTagName('head')[0].appendChild(script);
Expand Down
2 changes: 1 addition & 1 deletion examples/chaining/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

window.onload = function() {
var MM = com.modestmaps;
var provider = new MM.TemplatedMapProvider('http://tile.openstreetmap.org/{Z}/{X}/{Y}.png');
var provider = new MM.TemplatedLayer('http://tile.openstreetmap.org/{Z}/{X}/{Y}.png');
var map = new MM.Map(document.body, provider)
.setCenter(new MM.Location(51.5001524, -0.1262362))
.setZoom(11);
Expand Down
10 changes: 4 additions & 6 deletions examples/enforce-limits/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
<script type="text/javascript" src="../../modestmaps.js"></script>
<script type="text/javascript">
window.onload = function() {
// "import" the namespace
var provider = new MM.TemplatedMapProvider("http://otile1.mqcdn.com/tiles/1.0.0/osm/{Z}/{X}/{Y}.png");

map = new MM.Map(document.body, provider)
var layer = new MM.TemplatedLayer("http://otile1.mqcdn.com/tiles/1.0.0/osm/{Z}/{X}/{Y}.png");
map = new MM.Map(document.body, layer)

var minZoom = 2;
var maxZoom = 10;
Expand All @@ -22,14 +20,14 @@
];

// override provider limits so that tiles are not loaded unless they are inside these bounds:
provider.tileLimits = [
layer.tileLimits = [
map.locationCoordinate(topLeft).zoomTo(minZoom),
map.locationCoordinate(bottomRight).zoomTo(maxZoom)
];

// override sourceCoordinate so that it doesn't use coord limits to wrap tiles
// but so that it rejects any tile coordinates that lie outside the limits
provider.sourceCoordinate = function(coord) {
layer.sourceCoordinate = function(coord) {
// don't need .container() stuff here but it means *something* will get loaded at low zoom levels
// e.g. at level 0 the base tile could contain the entire extent
// skip the .container() stuff if you don't want to load/render tiles outside the extent *at all*
Expand Down
4 changes: 2 additions & 2 deletions examples/extent-selector/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@

function initMap() {
// the map
var provider = new MM.TemplatedMapProvider("http://acetate.geoiq.com/tiles/acetate-base/{Z}/{X}/{Y}.png");
map = new MM.Map("map", provider);
var layer = new MM.TemplatedLayer("http://acetate.geoiq.com/tiles/acetate-base/{Z}/{X}/{Y}.png");
map = new MM.Map("map", layer);

// the initial extent
var extent = new MM.MapExtent(37.837, -122.522, 37.691, -122.350);
Expand Down
6 changes: 3 additions & 3 deletions examples/flickr/bluemarble.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
com.modestmaps.BlueMarbleProvider = function() {
com.modestmaps.MapProvider.call(this, function(coordinate) {
MM.BlueMarbleProvider = function() {
MM.MapProvider.call(this, function(coordinate) {
coordinate = this.sourceCoordinate(coordinate);
if (!coordinate) return null;
var img = coordinate.zoom.toFixed(0) +'-r'+ coordinate.row.toFixed(0) +'-c'+ coordinate.column.toFixed(0) + '.jpg';
return 'http://s3.amazonaws.com/com.modestmaps.bluemarble/' + img;
});
};

com.modestmaps.extend(com.modestmaps.BlueMarbleProvider, com.modestmaps.MapProvider);
com.modestmaps.extend(MM.BlueMarbleProvider, MM.MapProvider);
2 changes: 1 addition & 1 deletion examples/flickr/flickr.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ <h1>Modest Maps JS</h1>
// "import" the namespace
var MM = com.modestmaps;

var provider = new MM.BlueMarbleProvider();
var provider = new MM.Layer(new MM.BlueMarbleProvider());

map = new MM.Map('map', provider, new MM.Point(1024,512))

Expand Down
3 changes: 1 addition & 2 deletions examples/flickr/follower.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ if (!com) {
}

(function(MM){
MM.Follower = function(map, location, content, dimensions)
{
MM.Follower = function(map, location, content, dimensions) {
this.coord = map.locationCoordinate(location);

this.offset = new MM.Point(0, 0);
Expand Down
2 changes: 1 addition & 1 deletion examples/geojson/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
markers;

function initMap() {
var provider = new MM.TemplatedMapProvider("http://ecn.t{S}.tiles.virtualearth.net/tiles/r{Q}?g=689&mkt=en-us&lbl=l0&stl=m", [0,1,2,3,4,5,6,7]);
var provider = new MM.TemplatedLayer("http://ecn.t{S}.tiles.virtualearth.net/tiles/r{Q}?g=689&mkt=en-us&lbl=l0&stl=m", [0,1,2,3,4,5,6,7]);
map = new MM.Map("map", provider);
map.setCenterZoom(new MM.Location(37.764, -122.419), 12);

Expand Down
2 changes: 1 addition & 1 deletion examples/getbbox/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
var container = document.getElementById('container');

map = new com.modestmaps.Map('map',
new com.modestmaps.TemplatedMapProvider('http://tile.openstreetmap.org/{Z}/{X}/{Y}.png'),
new com.modestmaps.TemplatedLayer('http://tile.openstreetmap.org/{Z}/{X}/{Y}.png'),
new com.modestmaps.Point(container.offsetWidth, container.offsetHeight));

map.setCenterZoom(new com.modestmaps.Location(0, 0), 1);
Expand Down
2 changes: 1 addition & 1 deletion examples/greatcircle/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

window.onload = function() {

var provider = new com.modestmaps.TemplatedMapProvider('http://tile.openstreetmap.org/{Z}/{X}/{Y}.png');
var provider = new com.modestmaps.TemplatedLayer('http://tile.openstreetmap.org/{Z}/{X}/{Y}.png');

map = new com.modestmaps.Map(document.body, provider);

Expand Down
2 changes: 1 addition & 1 deletion examples/hash/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
map, hash;

function initMap() {
var provider = new MM.TemplatedMapProvider("http://acetate.geoiq.com/tiles/acetate/{Z}/{X}/{Y}.png");
var provider = new MM.TemplatedLayer("http://acetate.geoiq.com/tiles/acetate/{Z}/{X}/{Y}.png");
map = new MM.Map("map", provider);
map.setCenterZoom(new MM.Location(37.804, -122.252), 12);
hash = new MM.Hash(map);
Expand Down
18 changes: 9 additions & 9 deletions examples/hello-oakland/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@

var subdomains = [ 'a.', 'b.', 'c.', '' ];
var providers = [
new MM.TemplatedMapProvider('http://osm-bayarea.s3.amazonaws.com/{Z}-r{Y}-c{X}.png'),
new MM.TemplatedMapProvider('http://oakland-1967.s3.amazonaws.com/{Z}-r{Y}-c{X}.jpg'),
new MM.TemplatedMapProvider('http://oakland-1950s.s3.amazonaws.com/{Z}-r{Y}-c{X}.jpg'),
new MM.TemplatedMapProvider('http://oakland-sf-1936.s3.amazonaws.com/{Z}-r{Y}-c{X}.jpg'),
new MM.TemplatedMapProvider('http://oakland-1912.s3.amazonaws.com/{Z}-r{Y}-c{X}.jpg'),
new MM.TemplatedMapProvider('http://oakland-1877.s3.amazonaws.com/{Z}-r{Y}-c{X}.jpg'),
new MM.TemplatedMapProvider('http://{S}tile.cloudmade.com/1a914755a77758e49e19a26e799268b7/997/256/{Z}/{X}/{Y}.png', subdomains),
new MM.TemplatedMapProvider('http://{S}tile.cloudmade.com/1a914755a77758e49e19a26e799268b7/998/256/{Z}/{X}/{Y}.png', subdomains),
new MM.TemplatedMapProvider('http://{S}tile.cloudmade.com/1a914755a77758e49e19a26e799268b7/999/256/{Z}/{X}/{Y}.png', subdomains)
new MM.TemplatedLayer('http://osm-bayarea.s3.amazonaws.com/{Z}-r{Y}-c{X}.png'),
new MM.TemplatedLayer('http://oakland-1967.s3.amazonaws.com/{Z}-r{Y}-c{X}.jpg'),
new MM.TemplatedLayer('http://oakland-1950s.s3.amazonaws.com/{Z}-r{Y}-c{X}.jpg'),
new MM.TemplatedLayer('http://oakland-sf-1936.s3.amazonaws.com/{Z}-r{Y}-c{X}.jpg'),
new MM.TemplatedLayer('http://oakland-1912.s3.amazonaws.com/{Z}-r{Y}-c{X}.jpg'),
new MM.TemplatedLayer('http://oakland-1877.s3.amazonaws.com/{Z}-r{Y}-c{X}.jpg'),
new MM.TemplatedLayer('http://{S}tile.cloudmade.com/1a914755a77758e49e19a26e799268b7/997/256/{Z}/{X}/{Y}.png', subdomains),
new MM.TemplatedLayer('http://{S}tile.cloudmade.com/1a914755a77758e49e19a26e799268b7/998/256/{Z}/{X}/{Y}.png', subdomains),
new MM.TemplatedLayer('http://{S}tile.cloudmade.com/1a914755a77758e49e19a26e799268b7/999/256/{Z}/{X}/{Y}.png', subdomains)
];

for (var i = 0; i < providers.length; i++) {
Expand Down
2 changes: 1 addition & 1 deletion examples/keyboard/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@

function initMap() {

var provider = new MM.TemplatedMapProvider('http://oatile1.mqcdn.com/naip/{Z}/{X}/{Y}.jpg')
var provider = new MM.TemplatedLayer('http://oatile1.mqcdn.com/naip/{Z}/{X}/{Y}.jpg')
// new MM.TemplatedMapProvider('http://tile.openstreetmap.org/{Z}/{X}/{Y}.png')

var handler = new MM.ThrowableHandler();
Expand Down
8 changes: 4 additions & 4 deletions examples/layers/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
{
var mm = com.modestmaps,
bust = '?q=005',
bg = new MM.Layer(new mm.TemplatedMapProvider('http://acetate.geoiq.com/tiles/terrain/{Z}/{X}/{Y}.png'+bust)),
fg = new MM.Layer(new mm.TemplatedMapProvider('http://acetate.geoiq.com/tiles/acetate-fg/{Z}/{X}/{Y}.png'+bust)),
osm = new MM.Layer(new mm.TemplatedMapProvider('http://tile.openstreetmap.org/{Z}/{X}/{Y}.png'+bust)),
mq = new MM.Layer(new mm.TemplatedMapProvider('http://otile1.mqcdn.com/tiles/1.0.0/osm/{Z}/{X}/{Y}.jpg'+bust));
bg = new MM.Layer(new mm.TemplatedLayer('http://acetate.geoiq.com/tiles/terrain/{Z}/{X}/{Y}.png'+bust)),
fg = new MM.Layer(new mm.TemplatedLayer('http://acetate.geoiq.com/tiles/acetate-fg/{Z}/{X}/{Y}.png'+bust)),
osm = new MM.Layer(new mm.TemplatedLayer('http://tile.openstreetmap.org/{Z}/{X}/{Y}.png'+bust)),
mq = new MM.Layer(new mm.TemplatedLayer('http://otile1.mqcdn.com/tiles/1.0.0/osm/{Z}/{X}/{Y}.jpg'+bust));

var map = new mm.Map('map', [bg, fg], new mm.Point(800, 360));

Expand Down
2 changes: 1 addition & 1 deletion examples/markerclip/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
function initMap() {

map = new MM.Map('map',
new MM.TemplatedMapProvider('http://tile.openstreetmap.org/{Z}/{X}/{Y}.png'));
new MM.TemplatedLayer('http://tile.openstreetmap.org/{Z}/{X}/{Y}.png'));

map.setCenterZoom(new MM.Location(0, 0), 1);

Expand Down
2 changes: 1 addition & 1 deletion examples/microsoft/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
var key = "AjBbdc2nn_71Hyc__uvinjvuHX5g8GLMiVYCJdx7XLLfiSenf1qtnmbv_VO8iyOj",
style = 'AerialWithLabels',
provider = new MM.BingProvider(key, style, function() {
map = new MM.Map(document.body, provider)
map = new MM.Map(document.body, new MM.Layer(provider))
map.setCenterZoom(new MM.Location(37.804656, -122.263606), 14);
});
}
Expand Down
2 changes: 1 addition & 1 deletion examples/navwindow/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
var map, nav;

window.onload = function() {
var provider = new MM.TemplatedMapProvider('http://tile.openstreetmap.org/{Z}/{X}/{Y}.png');
var provider = new MM.TemplatedLayer('http://tile.openstreetmap.org/{Z}/{X}/{Y}.png');
map = new MM.Map('map', provider);
nav = new MM.Map('nav', provider);

Expand Down
2 changes: 1 addition & 1 deletion examples/node/modestmaps-static.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ renderStaticMap(provider, dimensions, 11, location, function(err, canvas) {

// just one for now...
var providers = {
osm: new MM.TemplatedMapProvider("http://tile.openstreetmap.org/{Z}/{X}/{Y}.png")
osm: new MM.TemplatedLayer("http://tile.openstreetmap.org/{Z}/{X}/{Y}.png")
}

var app = express.createServer();
Expand Down
2 changes: 1 addition & 1 deletion examples/placeholder/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// "import" the namespace
var MM = com.modestmaps;

var provider = new MM.TemplatedMapProvider("http://placehold.it/256/ccc/000.png&text={Z}/{X}/{Y}");
var provider = new MM.TemplatedLayer("http://placehold.it/256/ccc/000.png&text={Z}/{X}/{Y}");
map = new MM.Map('map', provider)
map.setCenterZoom(new MM.Location(37.804656, -122.263606), 14);
}
Expand Down
4 changes: 2 additions & 2 deletions examples/show-hide/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
// defaults to Google-style Mercator projection, so works
// out of the box with OpenStreetMap and friends:
var template = 'http://tile.openstreetmap.org/{Z}/{X}/{Y}.png';
var provider = new MM.TemplatedMapProvider(template);
var provider = new MM.TemplatedLayer(template);

// without a size, it will expand to fit the parent:
map = new MM.Map(parent, provider);
Expand Down Expand Up @@ -57,4 +57,4 @@
<div id='map_div'></div>
<a href='#' id='toggle'>toggle map visibility</a>
</body>
</html>
</html>
Loading