This repository has been archived by the owner on Apr 4, 2019. It is now read-only.
forked from tilemill-project/tilemill
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Young Hahn
committed
Jul 29, 2011
1 parent
2c6c28e
commit e2a7727
Showing
12 changed files
with
137 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
#!/usr/bin/env node | ||
process.title = 'tilemill'; | ||
|
||
|
||
var tilelive_mapnik = require('tilelive-mapnik'); | ||
tilelive_mapnik.registerProtocols(require('tilelive')); | ||
require('tilelive-mapnik').registerProtocols(require('tilelive')); | ||
require('mbtiles').registerProtocols(require('tilelive')); | ||
|
||
require('bones').load(__dirname); | ||
!module.parent && require('bones').start(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
// Preview of an mbtiles export. | ||
model = Backbone.Model.extend({}); | ||
model.prototype.url = function() { return '/api/Preview/' + this.id; }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
var path = require('path'); | ||
var tilelive = require('tilelive'); | ||
var settings = Bones.plugin.config; | ||
|
||
models.Preview.prototype.sync = function(method, model, success, error) { | ||
if (method !== 'read') return error(new Error('Method not supported.')); | ||
var filepath = path.join(settings.files, 'export', model.id); | ||
tilelive.load('mbtiles://' + filepath, function(err, source) { | ||
if (err) return error(err); | ||
source.getInfo(function(err, info) { | ||
if (err) return error(err); | ||
info.tiles = ['/1.0.0/' + model.id + '/{z}/{x}/{y}.png']; | ||
success(_(info).extend({id: model.id })); | ||
}); | ||
}); | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<ul class='form fill'> | ||
<li class='text'> | ||
<h2><%= get('id') %></h2> | ||
<p class='prose'> | ||
To host these tiles sign up for <a target='_blank' href='http://mapbox.com/tilestream'>TileStream Hosting</a> or setup <a target='_blank' href='http://github.com/mapbox/tilestream'>TileStream</a> on your own server. | ||
</p> | ||
</li> | ||
</ul> | ||
|
||
<div id='preview'></div> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
view = Backbone.View.extend(); | ||
|
||
view.prototype.initialize = function(options) { | ||
_(this).bindAll('render'); | ||
this.render(); | ||
}; | ||
|
||
view.prototype.render = function() { | ||
this.$('.content').html(templates.Preview(this.model)); | ||
|
||
if (!com.modestmaps) throw new Error('ModestMaps not found.'); | ||
this.map = new com.modestmaps.Map('preview', | ||
new wax.mm.connector(this.model.attributes)); | ||
wax.mm.interaction(this.map, this.model.attributes); | ||
wax.mm.legend(this.map, this.model.attributes); | ||
wax.mm.zoombox(this.map); | ||
wax.mm.zoomer(this.map).appendTo(this.map.parent); | ||
|
||
var center = this.model.get('center'); | ||
this.map.setCenterZoom(new com.modestmaps.Location( | ||
center[1], | ||
center[0]), | ||
center[2]); | ||
|
||
return this; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters