--------------------------------------------------------------------------------
/demos/_sources/demo.json:
--------------------------------------------------------------------------------
1 | {
2 | "author": "Damon Oehlman"
3 | }
--------------------------------------------------------------------------------
/demos/_sources/animation/map-panning/demo.json:
--------------------------------------------------------------------------------
1 | {
2 | "drawOnTween": true
3 | }
--------------------------------------------------------------------------------
/test/img/zoom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DamonOehlman/tile5/HEAD/test/img/zoom.png
--------------------------------------------------------------------------------
/demos/_sources/basic/marker-hit-test/demo.json:
--------------------------------------------------------------------------------
1 | {
2 | "includes": ["_data/cities.js"]
3 | }
--------------------------------------------------------------------------------
/demos/img/plane.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DamonOehlman/tile5/HEAD/demos/img/plane.png
--------------------------------------------------------------------------------
/demos/img/tile5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DamonOehlman/tile5/HEAD/demos/img/tile5.png
--------------------------------------------------------------------------------
/demos/img/zoom.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DamonOehlman/tile5/HEAD/demos/img/zoom.png
--------------------------------------------------------------------------------
/demos/img/map-bg.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DamonOehlman/tile5/HEAD/demos/img/map-bg.png
--------------------------------------------------------------------------------
/demos/img/square-marker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DamonOehlman/tile5/HEAD/demos/img/square-marker.png
--------------------------------------------------------------------------------
/test/img/square-marker.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DamonOehlman/tile5/HEAD/test/img/square-marker.png
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | apidoc
2 | .settings
3 | *~
4 | *.diff
5 | *.patch
6 | test/qunit
7 | .DS_Store
8 | closed-*
9 | node_modules
--------------------------------------------------------------------------------
/demos/img/square-marker-highlight.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/DamonOehlman/tile5/HEAD/demos/img/square-marker-highlight.png
--------------------------------------------------------------------------------
/test/js/testenv.js:
--------------------------------------------------------------------------------
1 | var TESTENV = (function() {
2 | /* internals */
3 |
4 | /* exports */
5 |
6 | return {
7 | };
8 | })();
--------------------------------------------------------------------------------
/demos/_sources/visualization/walmart/demo.json:
--------------------------------------------------------------------------------
1 | {
2 | "drawOnMove": true,
3 | "mapstyle": 999,
4 | "renderer": "canvas/dom",
5 | "includes": ["_data/walmarts.js"]
6 | }
--------------------------------------------------------------------------------
/demos/_demogen/codemirror/mode/diff/diff.css:
--------------------------------------------------------------------------------
1 | .cm-s-default span.cm-rangeinfo {color: #a0b;}
2 | .cm-s-default span.cm-minus {color: #a22;}
3 | .cm-s-default span.cm-plus {color: #2b2;}
4 |
--------------------------------------------------------------------------------
/src/core/graphics/drawables/line.js:
--------------------------------------------------------------------------------
1 | /**
2 | # DRAWABLE: line
3 | */
4 | reg(typeDrawable, 'line', function(view, layer, params, callback) {
5 | params.fill = false;
6 | params.allowCull = true;
7 |
8 | return regCreate(typeDrawable, 'poly', view, layer, params);
9 | });
--------------------------------------------------------------------------------
/demos/_sources/_style.css:
--------------------------------------------------------------------------------
1 | html, body, #mapContainer {
2 | margin: 0;
3 | height: 100%;
4 | width: 100%;
5 | }
6 |
7 | body {
8 | font: 1em Helvetica, Arial;
9 | }
10 |
11 | .t5-copyright {
12 | background: #e8e8e8;
13 | opacity: 0.4;
14 | font-size: 0.8em;
15 | padding: 5px;
16 | }
--------------------------------------------------------------------------------
/src/core/graphics/drawables/arc.js:
--------------------------------------------------------------------------------
1 | /**
2 | # DRAWABLE: arc
3 | */
4 | reg(typeDrawable, 'arc', function(view, layer, params) {
5 | params = cog.extend({
6 | startAngle: 0,
7 | endAngle: Math.PI * 2,
8 | typeName: 'Arc'
9 | }, params);
10 |
11 | return new Drawable(view, layer, params);
12 | });
--------------------------------------------------------------------------------
/demos/_sources/basic/simple-map/demo.js:
--------------------------------------------------------------------------------
1 | map = new T5.Map('mapContainer', {
2 | padding: 'auto'
3 | });
4 |
5 | map.layer('tiles', 'tile', {
6 | generator: 'osm.cloudmade',
7 | // demo api key, register for an API key at http://dev.cloudmade.com/
8 | apikey: '7960daaf55f84bfdb166014d0b9f8d41'
9 | });
10 |
11 | map.zoom(8).center('-27.4695 153.0201');
--------------------------------------------------------------------------------
/src/core/messages.js:
--------------------------------------------------------------------------------
1 | // define messages that are used in tile5
2 | // any messages that can be formatted should use the formatter for simple reuse
3 |
4 | var WARN_REGOVERRIDE = formatter('Registration of {{0}}: {{1}} will override existing definition'),
5 | NO_TYPE = formatter('Could not create {{0}} of type: {{1}}'),
6 | NO_DRAWABLE = formatter('Could not create drawable of type: {{0}}');
7 |
--------------------------------------------------------------------------------
/test/css/tests.css:
--------------------------------------------------------------------------------
1 | html, body {
2 | height: 100%;
3 | overflow: hidden;
4 | margin: 0;
5 | }
6 |
7 | #mapContainer {
8 | height: 60%;
9 | overflow: hidden;
10 | }
11 |
12 | #testControls {
13 | position: absolute;
14 | width: 100%;
15 | height: 60%;
16 | z-index: 200;
17 | }
18 |
19 | .jasmine_reporter {
20 | overflow-y: scroll;
21 | height: 40%;
22 | }
--------------------------------------------------------------------------------
/demos/_demogen/codemirror/mode/diff/diff.js:
--------------------------------------------------------------------------------
1 | CodeMirror.defineMode("diff", function() {
2 | return {
3 | token: function(stream) {
4 | var ch = stream.next();
5 | stream.skipToEnd();
6 | if (ch == "+") return "plus";
7 | if (ch == "-") return "minus";
8 | if (ch == "@") return "rangeinfo";
9 | }
10 | };
11 | });
12 |
13 | CodeMirror.defineMIME("text/x-diff", "diff");
14 |
--------------------------------------------------------------------------------
/Makefile:
--------------------------------------------------------------------------------
1 | SHELL := /bin/bash
2 |
3 | build:
4 | @interleave --wrap oldschool src/T5.js --output dist/tile5.js
5 | @interleave src/engines --path dist/engines
6 | @interleave src/plugins --path dist/plugins
7 | @interleave src/plugins/layers --path dist/plugins/layers
8 | @../bake-js/bin/bake dist/tile5.js --refresh --output demos/_demogen/js
9 | @../bake-js/bin/bake dist/tile5.js --output test
10 |
11 | test:
12 | @mocha --reporter spec
13 |
14 | .PHONY: test
--------------------------------------------------------------------------------
/demos/_demogen/codemirror/theme/neat.css:
--------------------------------------------------------------------------------
1 | .cm-s-neat span.cm-comment { color: #a86; }
2 | .cm-s-neat span.cm-keyword { font-weight: bold; color: blue; }
3 | .cm-s-neat span.cm-string { color: #a22; }
4 | .cm-s-neat span.cm-builtin { font-weight: bold; color: #077; }
5 | .cm-s-neat span.cm-special { font-weight: bold; color: #0aa; }
6 | .cm-s-neat span.cm-variable { color: black; }
7 | .cm-s-neat span.cm-number, .cm-s-neat span.cm-atom { color: #3a3; }
8 | .cm-s-neat span.cm-meta {color: #555;}
9 |
--------------------------------------------------------------------------------
/demos/_sources/init.js:
--------------------------------------------------------------------------------
1 | // create the map
2 | var map = new T5.Map('mapContainer', {
3 | renderer: settings.renderer || 'canvas',
4 | drawOnMove: settings.drawOnMove,
5 | drawOnTween: settings.drawOnTween
6 | });
7 |
8 | map.layer('tiles', 'tile', {
9 | generator: 'osm.cloudmade',
10 | // demo api key, register for an API key at http://dev.cloudmade.com/
11 | apikey: '7960daaf55f84bfdb166014d0b9f8d41',
12 | styleid: settings.mapstyle
13 | });
14 |
15 | map.zoom(8).center('-27.469 153.020');
--------------------------------------------------------------------------------
/test/specs/drawables/line.js:
--------------------------------------------------------------------------------
1 | describe('drawables.line', function() {
2 | var POS_COUNT = 10;
3 |
4 | it('should be able to create a line on the map', function() {
5 | var positions = [];
6 |
7 | for (var ii = POS_COUNT; ii--; ) {
8 | positions[ii] = new GeoJS.Pos(startLat + Math.random() - 0.5, startLon + Math.random() - 0.5);
9 | } // for
10 |
11 | // create a line with the positions
12 | map.layer('markers').create('line', {
13 | points: positions
14 | });
15 | });
16 | });
--------------------------------------------------------------------------------
/demos/_demogen/codemirror/theme/elegant.css:
--------------------------------------------------------------------------------
1 | .cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom {color: #762;}
2 | .cm-s-elegant span.cm-comment {color: #262;font-style: italic;}
3 | .cm-s-elegant span.cm-meta {color: #555;font-style: italic;}
4 | .cm-s-elegant span.cm-variable {color: black;}
5 | .cm-s-elegant span.cm-variable-2 {color: #b11;}
6 | .cm-s-elegant span.cm-qualifier {color: #555;}
7 | .cm-s-elegant span.cm-keyword {color: #730;}
8 | .cm-s-elegant span.cm-builtin {color: #30a;}
9 | .cm-s-elegant span.cm-error {background-color: #fdd;}
10 |
--------------------------------------------------------------------------------
/demos/_demogen/codemirror/mode/markdown/markdown.css:
--------------------------------------------------------------------------------
1 | .cm-s-default span.cm-header {color: #2f2f4f; font-weight:bold;}
2 | .cm-s-default span.cm-code {color: #666;}
3 | .cm-s-default span.cm-quote {color: #090;}
4 | .cm-s-default span.cm-list {color: #a50;}
5 | .cm-s-default span.cm-hr {color: #999;}
6 | .cm-s-default span.cm-linktext {color: #00c; text-decoration: underline;}
7 | .cm-s-default span.cm-linkhref {color: #00c;}
8 | .cm-s-default span.cm-em {font-style: italic;}
9 | .cm-s-default span.cm-strong {font-weight: bold;}
10 | .cm-s-default span.cm-emstrong {font-style: italic; font-weight: bold;}
11 |
--------------------------------------------------------------------------------
/test/specs/drawables/markers.js:
--------------------------------------------------------------------------------
1 | describe('map.markers', function() {
2 | it('should be able to clear a draw layer', function() {
3 | map.layer('markers').clear();
4 | expect(map.layer('markers').find().length).toEqual(0);
5 | });
6 |
7 | it('should be able to drop a marker at the center of the map', function() {
8 | map.layer('markers').create('marker', {
9 | xy: map.center(),
10 | markerStyle: 'image',
11 | imageUrl: 'img/square-marker.png'
12 | });
13 |
14 | var marker = map.layer('markers').find()[0];
15 | expect(marker.xy.equals(map.center())).toBeTruthy();
16 | });
17 | });
--------------------------------------------------------------------------------
/src/style/map-overlays.js:
--------------------------------------------------------------------------------
1 | T5.Style.define({
2 | 'path.bike': {
3 | lineWidth: 3,
4 | stroke: '#007ee8'
5 | },
6 |
7 | 'area.simple': {
8 | lineWidth: 1,
9 | stroke: '#000000',
10 | fill: '#ffffff'
11 | },
12 |
13 | 'area.highlight': {
14 | lineWidth: 1,
15 | stroke: '#000000',
16 | fill: '#f8d461',
17 | opacity: 0.8
18 | },
19 |
20 | 'area.parkland': {
21 | lineWidth: 1,
22 | stroke: '#1e1e1e',
23 | fill: '#a7d732',
24 | opacity: 0.7
25 | },
26 |
27 | 'area.general': {
28 | lineWidth: 0,
29 | fill: '#1e1e1e'
30 | }
31 | });
--------------------------------------------------------------------------------
/demos/_sources/basic/simple-marker/demo.js:
--------------------------------------------------------------------------------
1 | var map = new T5.Map('mapContainer');
2 |
3 | map.layer('tiles', 'tile', {
4 | generator: 'osm.cloudmade',
5 | // demo api key, register for an API key at http://dev.cloudmade.com/
6 | apikey: '7960daaf55f84bfdb166014d0b9f8d41'
7 | });
8 |
9 | map.zoom(8).center('-27.4695 153.0201');
10 |
11 | // add a marker at the center of the map
12 | var marker = map.layer('markers').create('marker', {
13 | xy: '-27.4695 153.0201',
14 | imageUrl: 'img/square-marker.png',
15 | markerType: 'image'
16 | });
17 |
18 | marker
19 | .translate(0, -500)
20 | .translate(0, 500, {
21 | easing: 'bounce.out',
22 | duration: 1500
23 | });
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "tile5",
3 | "description": "Canvas (and others) mapping library",
4 | "main": "./index",
5 | "author": "Damon Oehlman",
6 | "version": "1.0.0",
7 |
8 | "repository": {
9 | "type": "git",
10 | "url": "http://github.com/DamonOehlman/tile5.git"
11 | },
12 |
13 | "bugs": {
14 | "web": "https://github.com/DamonOehlman/tile5/issues"
15 | },
16 |
17 | "dependencies": {
18 | },
19 |
20 | "devDependencies": {
21 | "interleave": "0.4.x"
22 | },
23 |
24 | "licenses": [{
25 | "type": "MIT",
26 | "url": "http://github.com/DamonOehlman/tile5/raw/LICENCE"
27 | }]
28 | }
--------------------------------------------------------------------------------
/src/core/parser.js:
--------------------------------------------------------------------------------
1 | var Parser = (function() {
2 |
3 | /* internals */
4 | var REGEX_XYRAW = /^xy\((.*)\).*$/i;
5 |
6 | /* exports */
7 |
8 | function parseXY(xyStr) {
9 | // if the xystr is a raw xy string, then process as such
10 | if (REGEX_XYRAW.test(xyStr)) {
11 |
12 | }
13 | else {
14 | // split the string and parse as a position
15 | var xyVals = xyStr.split(reDelimitedSplit);
16 |
17 | return _project(xyVals[1], xyVals[0]);
18 | } // if..else
19 |
20 | return undefined;
21 | } // parseXY
22 |
23 | return {
24 | parseXY: parseXY
25 | };
26 | })();
--------------------------------------------------------------------------------
/test/specs/map/basic.js:
--------------------------------------------------------------------------------
1 | describe('map.basic', function() {
2 | var testPrecision = Math.pow(10, 3);
3 |
4 | it('should be able to move to a particular position', function() {
5 | var centerPos;
6 |
7 | // move the map to the specified start position
8 | map.zoom(8).center(startLat + ', ' + startLon);
9 |
10 | // get the center position for the map
11 | centerPos = map.center().pos();
12 |
13 | expect(centerPos.lat * testPrecision | 0).toEqual(startLat * testPrecision | 0);
14 | expect(centerPos.lon * testPrecision | 0).toEqual(startLon * testPrecision | 0);
15 | });
16 |
17 | it('should not have a center value and offset value equal', function() {
18 | expect(map.center().equals(map.offset())).toBeFalsy();
19 | });
20 | });
--------------------------------------------------------------------------------
/src/core/types/rect.js:
--------------------------------------------------------------------------------
1 | /**
2 | # T5.Rect
3 | */
4 | function Rect(x, y, width, height) {
5 | // initialise members
6 | this.x = x || 0;
7 | this.y = y || 0;
8 | this.w = width || 0;
9 | this.h = height || 0;
10 |
11 | // update the x2 and y2 coordinates
12 | this.x2 = this.x + this.w;
13 | this.y2 = this.y + this.h;
14 | } // Rect
15 |
16 | Rect.prototype = {
17 | constructor: Rect,
18 |
19 | /**
20 | ### buffer(amountX, amountY)
21 | */
22 | buffer: function(amountX, amountY) {
23 | return new Rect(
24 | this.x - amountX,
25 | this.y - (amountY || amountX),
26 | this.w + amountX * 2,
27 | this.h + (amountY || amountX) * 2
28 | );
29 | },
30 |
31 | /**
32 | ### center()
33 | */
34 | center: function() {
35 | return new XY(this.x + (this.w >> 1), this.y + (this.h >> 1));
36 | }
37 | };
--------------------------------------------------------------------------------
/dist/engines/cloudmade.js:
--------------------------------------------------------------------------------
1 | T5.Registry.register('generator', 'osm.cloudmade', function(view, params) {
2 | var urlFormatter;
3 |
4 | // ensure we have parameters
5 | params = params || {};
6 |
7 | // initialise the apikey and style
8 | params.apikey = params.apikey || null;
9 | params.styleid = params.styleid || 1;
10 |
11 | urlFormatter = formatter('http://{{3}}.tile.cloudmade.com/{{0}}/{{1}}/{{2}}/');
12 | view.addCopy('This product uses the CloudMade APIs, but is not endorsed or certified by CloudMade.');
13 |
14 | return cog.extend(T5.Registry.create('generator', 'osm', view, params), {
15 | getServerDetails: function() {
16 | return {
17 | baseUrl: urlFormatter(params.apikey, params.styleid, 256, '{{0}}'),
18 | subDomains: ['a', 'b', 'c']
19 | };
20 | }
21 | });
22 | });
--------------------------------------------------------------------------------
/src/engines/cloudmade.js:
--------------------------------------------------------------------------------
1 | T5.Registry.register('generator', 'osm.cloudmade', function(view, params) {
2 | var urlFormatter;
3 |
4 | // ensure we have parameters
5 | params = params || {};
6 |
7 | // initialise the apikey and style
8 | params.apikey = params.apikey || null;
9 | params.styleid = params.styleid || 1;
10 |
11 | urlFormatter = formatter('http://{{3}}.tile.cloudmade.com/{{0}}/{{1}}/{{2}}/');
12 | view.addCopy('This product uses the CloudMade APIs, but is not endorsed or certified by CloudMade.');
13 |
14 | return cog.extend(T5.Registry.create('generator', 'osm', view, params), {
15 | getServerDetails: function() {
16 | return {
17 | baseUrl: urlFormatter(params.apikey, params.styleid, 256, '{{0}}'),
18 | subDomains: ['a', 'b', 'c']
19 | };
20 | }
21 | });
22 | });
--------------------------------------------------------------------------------
/src/core/geo/projections/default.js:
--------------------------------------------------------------------------------
1 | var _project = _project || function(lon, lat) {
2 | var radLat = parseFloat(lat) * DEGREES_TO_RADIANS,
3 | sinPhi = sin(radLat),
4 | eSinPhi = ECC * sinPhi,
5 | retVal = log(((1.0 + sinPhi) / (1.0 - sinPhi)) * pow((1.0 - eSinPhi) / (1.0 + eSinPhi), ECC)) / 2.0;
6 |
7 | return new GeoXY(0, 0, parseFloat(lon) * DEGREES_TO_RADIANS, retVal);
8 | }; // _project
9 |
10 | var _unproject = _unproject || function(x, y) {
11 | var t = pow(Math.E, -y),
12 | prevPhi = mercatorUnproject(t),
13 | newPhi = findRadPhi(prevPhi, t),
14 | iterCount = 0;
15 |
16 | while (iterCount < PHI_MAXITER && abs(prevPhi - newPhi) > PHI_EPSILON) {
17 | prevPhi = newPhi;
18 | newPhi = findRadPhi(prevPhi, t);
19 | iterCount++;
20 | } // while
21 |
22 | return new GeoJS.Pos(newPhi * RADIANS_TO_DEGREES, (x % 360) * RADIANS_TO_DEGREES);
23 | }; // _unproject
--------------------------------------------------------------------------------
/demos/_demogen/codemirror/theme/default.css:
--------------------------------------------------------------------------------
1 | .cm-s-default span.cm-keyword {color: #708;}
2 | .cm-s-default span.cm-atom {color: #219;}
3 | .cm-s-default span.cm-number {color: #164;}
4 | .cm-s-default span.cm-def {color: #00f;}
5 | .cm-s-default span.cm-variable {color: black;}
6 | .cm-s-default span.cm-variable-2 {color: #05a;}
7 | .cm-s-default span.cm-variable-3 {color: #0a5;}
8 | .cm-s-default span.cm-property {color: black;}
9 | .cm-s-default span.cm-operator {color: black;}
10 | .cm-s-default span.cm-comment {color: #a50;}
11 | .cm-s-default span.cm-string {color: #a11;}
12 | .cm-s-default span.cm-string-2 {color: #f50;}
13 | .cm-s-default span.cm-meta {color: #555;}
14 | .cm-s-default span.cm-error {color: #f00;}
15 | .cm-s-default span.cm-qualifier {color: #555;}
16 | .cm-s-default span.cm-builtin {color: #30a;}
17 | .cm-s-default span.cm-bracket {color: #cc7;}
18 | .cm-s-default span.cm-tag {color: #170;}
19 | .cm-s-default span.cm-attribute {color: #00c;}
20 |
--------------------------------------------------------------------------------
/src/core/functions.js:
--------------------------------------------------------------------------------
1 | /**
2 | # T5
3 | The T5 core module contains classes and functionality that support basic drawing
4 | operations and math that are used in managing and drawing the graphical and tiling interfaces
5 | that are provided in the Tile5 library.
6 |
7 | ## Module Functions
8 | */
9 |
10 | /* exports */
11 |
12 | function ticks() {
13 | return new Date().getTime();
14 | } // getTicks
15 |
16 | /* exports */
17 |
18 | /**
19 | ### radsPerPixel(zoomLevel)
20 | */
21 | function radsPerPixel(zoomLevel) {
22 | return TWO_PI / (256 << zoomLevel);
23 | } // radsPerPixel
24 |
25 |
26 | /* internal functions */
27 |
28 | function findRadPhi(phi, t) {
29 | var eSinPhi = ECC * sin(phi);
30 |
31 | return HALF_PI - (2 * atan (t * pow((1 - eSinPhi) / (1 + eSinPhi), ECC / 2)));
32 | } // findRadPhi
33 |
34 | function mercatorUnproject(t) {
35 | return HALF_PI - 2 * atan(t);
36 | } // mercatorUnproject
37 |
38 | function toRad(value) {
39 | return value * DEGREES_TO_RADIANS;
40 | } // toRad
--------------------------------------------------------------------------------
/src/core/constants.js:
--------------------------------------------------------------------------------
1 | var LAT_VARIABILITIES = [
2 | 1.406245461070741,
3 | 1.321415085624082,
4 | 1.077179995861952,
5 | 0.703119412486786,
6 | 0.488332580888611
7 | ];
8 |
9 | // define some constants
10 | var TWO_PI = Math.PI * 2,
11 | HALF_PI = Math.PI / 2,
12 | PROP_WK_TRANSFORM = '-webkit-transform',
13 | VECTOR_SIMPLIFICATION = 3,
14 | DEGREES_TO_RADIANS = Math.PI / 180,
15 | RADIANS_TO_DEGREES = 180 / Math.PI,
16 | MAX_LAT = 90, // 85.0511 * DEGREES_TO_RADIANS, // TODO: validate this instead of using HALF_PI
17 | MIN_LAT = -MAX_LAT,
18 | MAX_LON = 180,
19 | MIN_LON = -MAX_LON,
20 | MAX_LAT_RAD = MAX_LAT * DEGREES_TO_RADIANS,
21 | MIN_LAT_RAD = -MAX_LAT_RAD,
22 | MAX_LON_RAD = MAX_LON * DEGREES_TO_RADIANS,
23 | MIN_LON_RAD = -MAX_LON_RAD,
24 | M_PER_KM = 1000,
25 | KM_PER_RAD = 6371,
26 | M_PER_RAD = KM_PER_RAD * M_PER_KM,
27 | ECC = 0.08181919084262157,
28 | PHI_EPSILON = 1E-7,
29 | PHI_MAXITER = 12,
30 |
31 | // some style constants
32 | STYLE_RESET = 'reset';
--------------------------------------------------------------------------------
/demos/_demogen/codemirror/runmode.js:
--------------------------------------------------------------------------------
1 | CodeMirror.runMode = function(string, modespec, callback) {
2 | var mode = CodeMirror.getMode({indentUnit: 2}, modespec);
3 | var isNode = callback.nodeType == 1;
4 | if (isNode) {
5 | var node = callback, accum = [];
6 | callback = function(string, style) {
7 | if (string == "\n")
8 | accum.push(" ");
9 | else if (style)
10 | accum.push("" + CodeMirror.htmlEscape(string) + "");
11 | else
12 | accum.push(CodeMirror.htmlEscape(string));
13 | }
14 | }
15 | var lines = CodeMirror.splitLines(string), state = CodeMirror.startState(mode);
16 | for (var i = 0, e = lines.length; i < e; ++i) {
17 | if (i) callback("\n");
18 | var stream = new CodeMirror.StringStream(lines[i]);
19 | while (!stream.eol()) {
20 | var style = mode.token(stream, state);
21 | callback(stream.current(), style);
22 | stream.start = stream.pos;
23 | }
24 | }
25 | if (isNode)
26 | node.innerHTML = accum.join("");
27 | };
28 |
--------------------------------------------------------------------------------
/demos/_demogen/codemirror/theme/cobalt.css:
--------------------------------------------------------------------------------
1 | .cm-s-cobalt { background: #002240; color: white; }
2 | .cm-s-cobalt span.CodeMirror-selected { background: #b36539 !important; }
3 | .cm-s-cobalt .CodeMirror-gutter { background: #002240; border-right: 1px solid #aaa; }
4 | .cm-s-cobalt .CodeMirror-gutter-text { color: #d0d0d0; }
5 | .cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white !important; }
6 |
7 | .cm-s-cobalt span.cm-comment { color: #08f; }
8 | .cm-s-cobalt span.cm-atom { color: #845dc4; }
9 | .cm-s-cobalt span.cm-number, .cm-s-cobalt span.cm-attribute { color: #ff80e1; }
10 | .cm-s-cobalt span.cm-keyword { color: #ffee80; }
11 | .cm-s-cobalt span.cm-string { color: #3ad900; }
12 | .cm-s-cobalt span.cm-meta { color: #ff9d00; }
13 | .cm-s-cobalt span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #9effff; }
14 | .cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def { color: white; }
15 | .cm-s-cobalt span.cm-error { color: #9d1e15; }
16 | .cm-s-cobalt span.cm-bracket { color: #d8d8d8; }
17 | .cm-s-cobalt span.cm-builtin, .cm-s-cobalt span.cm-special { color: #ff9e59; }
18 |
--------------------------------------------------------------------------------
/demos/_demogen/codemirror/theme/eclipse.css:
--------------------------------------------------------------------------------
1 | .cm-s-eclipse span.cm-meta {color: #FF1717;}
2 | .cm-s-eclipse span.cm-keyword { font-weight: bold; color: #7F0055; }
3 | .cm-s-eclipse span.cm-atom {color: #219;}
4 | .cm-s-eclipse span.cm-number {color: #164;}
5 | .cm-s-eclipse span.cm-def {color: #00f;}
6 | .cm-s-eclipse span.cm-variable {color: black;}
7 | .cm-s-eclipse span.cm-variable-2 {color: #0000C0;}
8 | .cm-s-eclipse span.cm-variable-3 {color: #0000C0;}
9 | .cm-s-eclipse span.cm-property {color: black;}
10 | .cm-s-eclipse span.cm-operator {color: black;}
11 | .cm-s-eclipse span.cm-comment {color: #3F7F5F;}
12 | .cm-s-eclipse span.cm-string {color: #2A00FF;}
13 | .cm-s-eclipse span.cm-string-2 {color: #f50;}
14 | .cm-s-eclipse span.cm-error {color: #f00;}
15 | .cm-s-eclipse span.cm-qualifier {color: #555;}
16 | .cm-s-eclipse span.cm-builtin {color: #30a;}
17 | .cm-s-eclipse span.cm-bracket {color: #cc7;}
18 | .cm-s-eclipse span.cm-tag {color: #170;}
19 | .cm-s-eclipse span.cm-attribute {color: #00c;}
20 |
21 | .CodeMirror-matchingbracket{
22 | border:1px solid grey;
23 | color:black !important;;
24 | }
--------------------------------------------------------------------------------
/src/core/images/tile.js:
--------------------------------------------------------------------------------
1 | function Tile(x, y, url, width, height, id) {
2 | this.x = x;
3 | this.y = y;
4 | this.w = width || 256;
5 | this.h = width || 256;
6 |
7 | // calculate the max x and y
8 | this.x2 = this.x + this.w;
9 | this.y2 = this.y + this.h;
10 |
11 | // initialise the url
12 | this.url = url;
13 |
14 | // initialise the tile id
15 | this.id = id || (x + '_' + y);
16 |
17 | // derived properties
18 | this.loaded = false;
19 | this.image = null;
20 | };
21 |
22 | Tile.prototype = {
23 | constructor: Tile,
24 |
25 | load: function(callback) {
26 | // take a reference to the tile
27 | var tile = this;
28 |
29 | // get the image
30 | getImage(this.url, function(image, loaded) {
31 | // flag the tile as loaded and save the image to a member var
32 | tile.loaded = true;
33 | tile.image = image;
34 |
35 | if (callback) {
36 | callback(tile);
37 | } // if
38 | });
39 | }
40 | };
--------------------------------------------------------------------------------
/src/core/shorts.js:
--------------------------------------------------------------------------------
1 | // some math functions
2 | var abs = Math.abs,
3 | ceil = Math.ceil,
4 | floor = Math.floor,
5 | round = Math.round,
6 | min = Math.min,
7 | max = Math.max,
8 | pow = Math.pow,
9 | sqrt = Math.sqrt,
10 | log = Math.log,
11 | sin = Math.sin,
12 | asin = Math.asin,
13 | cos = Math.cos,
14 | acos = Math.acos,
15 | tan = Math.tan,
16 | atan = Math.atan,
17 | atan2 = Math.atan2,
18 |
19 | // detected commonjs implementation
20 | isCommonJS = typeof module !== 'undefined' && module.exports,
21 |
22 | // some type references
23 | typeUndefined = 'undefined',
24 | typeString = 'string',
25 | typeNumber = 'number',
26 |
27 | // type references for internal types
28 | typeDrawable = 'drawable',
29 | typeLayer = 'layer',
30 |
31 | // shortcuts to the registry functions
32 | reg = Registry.register,
33 | regCreate = Registry.create,
34 | regGet = Registry.get,
35 |
36 | drawableCounter = 0,
37 | layerCounter = 0,
38 |
39 | reDelimitedSplit = /[\,\s]+/;
--------------------------------------------------------------------------------
/demos/_demogen/codemirror/mode/pascal/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011 souceLair
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4 |
5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6 |
7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8 |
--------------------------------------------------------------------------------
/src/core/registry.js:
--------------------------------------------------------------------------------
1 | var Registry = (function() {
2 | /* internals */
3 |
4 | var types = {};
5 |
6 | /* exports */
7 |
8 | function create(type, name) {
9 | if (types[type][name]) {
10 | return types[type][name].apply(null, Array.prototype.slice.call(arguments, 2));
11 | } // if
12 |
13 | throw NO_TYPE(type, name);
14 | } // create
15 |
16 | function get(type, name) {
17 | return types[type] ? types[type][name] : null;
18 | } // get
19 |
20 | function register(type, name, initFn) {
21 | // initialise the type of not defined
22 | if (! types[type]) {
23 | types[type] = {};
24 | } // if
25 |
26 | // log a warning if the type already exists
27 | if (types[type][name]) {
28 | cog.log(WARN_REGOVERRIDE(type, name), 'warn');
29 | } // if
30 |
31 | // add to the registry
32 | types[type][name] = initFn;
33 | } // register
34 |
35 | return {
36 | create: create,
37 | get: get,
38 | register: register
39 | };
40 | })();
--------------------------------------------------------------------------------
/dist/engines/wms.js:
--------------------------------------------------------------------------------
1 | T5.Generator.register('osm.wms', function(params) {
2 | params = cog.extend({
3 | extent: [-90, -180, 90, 180],
4 | mapurl: ""
5 | }, params);
6 |
7 | /* internals */
8 |
9 | var minLat = params.extent[0] || -90,
10 | minLon = params.extent[1] || -180,
11 | maxLat = params.extent[2] || 90,
12 | maxLon = params.extent[3] || 180,
13 | dlat = maxLat - minLat,
14 | dlon = maxLon - minLon;
15 |
16 | function tileToExtent(x, y, zoomLevel, numTiles) {
17 | var ddlat = dlat / numTiles,
18 | ddlon = dlon / numTiles,
19 | llat = ddlon * x + minLat,
20 | tlon = maxLon - y * ddlon,
21 | tlat = llat + ddlon,
22 | llon = tlon - ddlon;
23 |
24 | return llat + "," + llon + "," + tlat + "," + tlon;
25 | } // tileToExtend
26 |
27 | return cog.extend(new T5.Geo.OSM.Generator(params), {
28 | buildTileUrl: function(tileX, tileY, zoomLevel, numTiles) {
29 | return params.mapurl + "&BBOX=" + tileToExtent(tileX, tileY, zoomLevel, numTiles);
30 | }
31 | });
32 | });
--------------------------------------------------------------------------------
/src/engines/wms.js:
--------------------------------------------------------------------------------
1 | T5.Generator.register('osm.wms', function(params) {
2 | params = cog.extend({
3 | extent: [-90, -180, 90, 180],
4 | mapurl: ""
5 | }, params);
6 |
7 | /* internals */
8 |
9 | var minLat = params.extent[0] || -90,
10 | minLon = params.extent[1] || -180,
11 | maxLat = params.extent[2] || 90,
12 | maxLon = params.extent[3] || 180,
13 | dlat = maxLat - minLat,
14 | dlon = maxLon - minLon;
15 |
16 | function tileToExtent(x, y, zoomLevel, numTiles) {
17 | var ddlat = dlat / numTiles,
18 | ddlon = dlon / numTiles,
19 | llat = ddlon * x + minLat,
20 | tlon = maxLon - y * ddlon,
21 | tlat = llat + ddlon,
22 | llon = tlon - ddlon;
23 |
24 | return llat + "," + llon + "," + tlat + "," + tlon;
25 | } // tileToExtend
26 |
27 | return cog.extend(new T5.Geo.OSM.Generator(params), {
28 | buildTileUrl: function(tileX, tileY, zoomLevel, numTiles) {
29 | return params.mapurl + "&BBOX=" + tileToExtent(tileX, tileY, zoomLevel, numTiles);
30 | }
31 | });
32 | });
--------------------------------------------------------------------------------
/test/lib/jasmine-1.0.2/MIT.LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2008-2010 Pivotal Labs
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining
4 | a copy of this software and associated documentation files (the
5 | "Software"), to deal in the Software without restriction, including
6 | without limitation the rights to use, copy, modify, merge, publish,
7 | distribute, sublicense, and/or sell copies of the Software, and to
8 | permit persons to whom the Software is furnished to do so, subject to
9 | the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be
12 | included in all copies or substantial portions of the Software.
13 |
14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21 |
--------------------------------------------------------------------------------
/demos/_demogen/codemirror/theme/night.css:
--------------------------------------------------------------------------------
1 | /* Loosely based on the Midnight Textmate theme */
2 |
3 | .cm-s-night { background: #0a001f; color: #f8f8f8; }
4 | .cm-s-night span.CodeMirror-selected { background: #a8f !important; }
5 | .cm-s-night .CodeMirror-gutter { background: #0a001f; border-right: 1px solid #aaa; }
6 | .cm-s-night .CodeMirror-gutter-text { color: #f8f8f8; }
7 | .cm-s-night .CodeMirror-cursor { border-left: 1px solid white !important; }
8 |
9 | .cm-s-night span.cm-comment { color: #6900a1; }
10 | .cm-s-night span.cm-atom { color: #845dc4; }
11 | .cm-s-night span.cm-number, .cm-s-night span.cm-attribute { color: #ffd500; }
12 | .cm-s-night span.cm-keyword { color: #599eff; }
13 | .cm-s-night span.cm-string { color: #37f14a; }
14 | .cm-s-night span.cm-meta { color: #7678e2; }
15 | .cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { color: #99b2ff; }
16 | .cm-s-night span.cm-variable-3, .cm-s-night span.cm-def { color: white; }
17 | .cm-s-night span.cm-error { color: #9d1e15; }
18 | .cm-s-night span.cm-bracket { color: #8da6ce; }
19 | .cm-s-night span.cm-comment { color: #6900a1; }
20 | .cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; }
21 |
--------------------------------------------------------------------------------
/demos/_demogen/codemirror/mode/python/LICENSE.txt:
--------------------------------------------------------------------------------
1 | The MIT License
2 |
3 | Copyright (c) 2010 Timothy Farrell
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/LICENSE.mdown:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011 Damon Oehlman (damon.oehlman -at- sidelab.com)
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is
8 | furnished to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in
11 | all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
21 |
--------------------------------------------------------------------------------
/demos/_demogen/codemirror/mode/ntriples/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CodeMirror 2: NTriples mode
5 |
6 |
7 |
8 |
9 |
10 |
15 |
16 |
17 |
CodeMirror 2: NTriples mode
18 |
27 |
28 |
31 |
MIME types defined:text/n-triples.
32 |
33 |
34 |
--------------------------------------------------------------------------------
/src/core/graphics/drawables/marker.js:
--------------------------------------------------------------------------------
1 | /**
2 | # DRAWABLE: marker
3 | The T5.Marker class represents a generic marker for annotating an underlying view.
4 | Originally the marker class did very little, and in most instances a T5.ImageMarker
5 | was used instead to generate a marker that looked more visually appealing, however,
6 | with the introduction of different rendering backends the standard marker class is
7 | the recommended option for annotating maps and views as it allows the renderer to
8 | implement suitable rendering behaviour which looks good regardless of the context.
9 |
10 | ## Initialization Parameters
11 | In addition to the standard T5.Drawable initialization parameters, a Marker can
12 | accept the following:
13 |
14 |
15 | - `markerType` - (default = simple)
16 |
17 | The style of marker that will be displayed for the marker. This is interpreted
18 | by each renderer individually.
19 |
20 | */
21 | reg(typeDrawable, 'marker', function(view, layer, params) {
22 | params = cog.extend({
23 | fill: true,
24 | stroke: false,
25 | markerType: 'simple',
26 | hoverStyle: 'highlight',
27 | typeName: 'Marker'
28 | }, params);
29 |
30 | return new Drawable(view, layer, params);
31 | });
--------------------------------------------------------------------------------
/demos/_demogen/codemirror/mode/coffeescript/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License
2 |
3 | Copyright (c) 2011 Jeff Pickhardt
4 | Modified from the Python CodeMirror mode, Copyright (c) 2010 Timothy Farrell
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
--------------------------------------------------------------------------------
/demos/_sources/plugins/heatmap/demo.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | function createMarkers() {
3 | var markers = map.layer('markers');
4 |
5 | // clear any existing markers
6 | markers.clear();
7 |
8 | // create the markers
9 | for (ii = 0 ; ii < data.length; ii++) {
10 | markers.create('marker', {
11 | xy: new T5.GeoXY(new GeoJS.Pos(data[ii][0], data[ii][1])),
12 | markerType: 'image',
13 | imageUrl: 'img/square-marker.png',
14 | size: 15,
15 | value: data[ii][2]
16 | });
17 | } // for
18 | } // loadData
19 |
20 | map = new T5.Map('mapContainer', {
21 | renderer: DEMO.getRenderer(),
22 | padding: 'auto'
23 | });
24 |
25 | map.layer('tiles', 'tile', {
26 | generator: 'osm.cloudmade',
27 | renderer: 'canvas',
28 | // demo api key, register for an API key at http://dev.cloudmade.com/
29 | apikey: '7960daaf55f84bfdb166014d0b9f8d41'
30 | });
31 |
32 | // set the map center
33 | map.center('25 -110').zoom(3);
34 |
35 | // add the heatmap layer
36 | map.layer('heatmap', 'heatcanvas');
37 |
38 | // create some markers
39 | createMarkers();
40 | })();
41 |
--------------------------------------------------------------------------------
/demos/_demogen/js/ace/mode-latex.js:
--------------------------------------------------------------------------------
1 | define("ace/mode/latex",["require","exports","module","pilot/oop","ace/mode/text","ace/tokenizer","ace/mode/latex_highlight_rules","ace/range"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text").Mode,f=a("ace/tokenizer").Tokenizer,g=a("ace/mode/latex_highlight_rules").LatexHighlightRules,h=a("ace/range").Range,i=function(){this.$tokenizer=new f((new g).getRules())};d.inherits(i,e),function(){this.toggleCommentLines=function(a,b,c,d){var e=!0,f=[],g=/^(\s*)\%/;for(var i=c;i<=d;i++)if(!g.test(b.getLine(i))){e=!1;break}if(e){var j=new h(0,0,0,0);for(var i=c;i<=d;i++){var k=b.getLine(i),l=k.match(g);j.start.row=i,j.end.row=i,j.end.column=l[0].length,b.replace(j,l[1])}}else b.indentRows(c,d,"%")},this.getNextLineIndent=function(a,b,c){return this.$getIndent(b)}}.call(i.prototype),b.Mode=i}),define("ace/mode/latex_highlight_rules",["require","exports","module","pilot/oop","ace/mode/text_highlight_rules"],function(a,b,c){var d=a("pilot/oop"),e=a("ace/mode/text_highlight_rules").TextHighlightRules,f=function(){this.$rules={start:[{token:"keyword",regex:"\\\\(?:[^a-zA-Z]|[a-zA-Z]+)"},{token:"lparen",regex:"[[({]"},{token:"rparen",regex:"[\\])}]"},{token:"string",regex:"\\$(?:(?:\\\\.)|(?:[^\\$\\\\]))*?\\$"},{token:"comment",regex:"%.*$"}]}};d.inherits(f,e),b.LatexHighlightRules=f})
--------------------------------------------------------------------------------
/demos/_demogen/codemirror/mode/jinja2/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | CodeMirror 2: Jinja2 mode
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/demos/_demogen/codemirror/mode/rst/rst.css:
--------------------------------------------------------------------------------
1 | .cm-s-default span.cm-emphasis {
2 | font-style: italic;
3 | }
4 |
5 | .cm-s-default span.cm-strong {
6 | font-weight: bold;
7 | }
8 |
9 | .cm-s-default span.cm-interpreted {
10 | color: #33cc66;
11 | }
12 |
13 | .cm-s-default span.cm-inline {
14 | color: #3399cc;
15 | }
16 |
17 | .cm-s-default span.cm-role {
18 | color: #666699;
19 | }
20 |
21 | .cm-s-default span.cm-list {
22 | color: #cc0099;
23 | font-weight: bold;
24 | }
25 |
26 | .cm-s-default span.cm-body {
27 | color: #6699cc;
28 | }
29 |
30 | .cm-s-default span.cm-verbatim {
31 | color: #3366ff;
32 | }
33 |
34 | .cm-s-default span.cm-comment {
35 | color: #aa7700;
36 | }
37 |
38 | .cm-s-default span.cm-directive {
39 | font-weight: bold;
40 | color: #3399ff;
41 | }
42 |
43 | .cm-s-default span.cm-hyperlink {
44 | font-weight: bold;
45 | color: #3366ff;
46 | }
47 |
48 | .cm-s-default span.cm-footnote {
49 | font-weight: bold;
50 | color: #3333ff;
51 | }
52 |
53 | .cm-s-default span.cm-citation {
54 | font-weight: bold;
55 | color: #3300ff;
56 | }
57 |
58 | .cm-s-default span.cm-replacement {
59 | color: #9933cc;
60 | }
61 |
62 | .cm-s-default span.cm-section {
63 | font-weight: bold;
64 | color: #cc0099;
65 | }
66 |
67 | .cm-s-default span.cm-directive-marker {
68 | font-weight: bold;
69 | color: #3399ff;
70 | }
71 |
72 | .cm-s-default span.cm-verbatim-marker {
73 | font-weight: bold;
74 | color: #9900ff;
75 | }
76 |
--------------------------------------------------------------------------------
/demos/_demogen/codemirror/mode/jinja2/jinja2.js:
--------------------------------------------------------------------------------
1 | CodeMirror.defineMode("jinja2", function(config, parserConf) {
2 | var keywords = ["block", "endblock", "for", "endfor", "in", "true", "false",
3 | "loop", "none", "self", "super", "if", "as", "not", "and",
4 | "else", "import", "with", "without", "context"];
5 | keywords = new RegExp("^((" + keywords.join(")|(") + "))\\b");
6 |
7 | function tokenBase (stream, state) {
8 | var ch = stream.next();
9 | if (ch == "{") {
10 | if (ch = stream.eat(/\{|%|#/)) {
11 | stream.eat("-");
12 | state.tokenize = inTag(ch);
13 | return "tag";
14 | }
15 | }
16 | }
17 | function inTag (close) {
18 | if (close == "{") {
19 | close = "}";
20 | }
21 | return function (stream, state) {
22 | var ch = stream.next();
23 | if ((ch == close || (ch == "-" && stream.eat(close)))
24 | && stream.eat("}")) {
25 | state.tokenize = tokenBase;
26 | return "tag";
27 | }
28 | if (stream.match(keywords)) {
29 | return "keyword";
30 | }
31 | return close == "#" ? "comment" : "string";
32 | };
33 | }
34 | return {
35 | startState: function () {
36 | return {tokenize: tokenBase};
37 | },
38 | token: function (stream, state) {
39 | return state.tokenize(stream, state);
40 | }
41 | };
42 | });
43 |
--------------------------------------------------------------------------------
/demos/_demogen/codemirror/mode/r/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011, Ubalo, Inc.
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 | * Redistributions of source code must retain the above copyright
7 | notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | * Neither the name of the Ubalo, Inc nor the names of its
12 | contributors may be used to endorse or promote products derived
13 | from this software without specific prior written permission.
14 |
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 | DISCLAIMED. IN NO EVENT SHALL UBALO, INC BE LIABLE FOR ANY
19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 |
--------------------------------------------------------------------------------
/demos/_demogen/codemirror/mode/ruby/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2011, Ubalo, Inc.
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without
5 | modification, are permitted provided that the following conditions are met:
6 | * Redistributions of source code must retain the above copyright
7 | notice, this list of conditions and the following disclaimer.
8 | * Redistributions in binary form must reproduce the above copyright
9 | notice, this list of conditions and the following disclaimer in the
10 | documentation and/or other materials provided with the distribution.
11 | * Neither the name of the Ubalo, Inc. nor the names of its
12 | contributors may be used to endorse or promote products derived
13 | from this software without specific prior written permission.
14 |
15 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
16 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 | DISCLAIMED. IN NO EVENT SHALL UBALO, INC BE LIABLE FOR ANY
19 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 |
--------------------------------------------------------------------------------
/test/specs/map/movement.js:
--------------------------------------------------------------------------------
1 | describe('map.movement', function() {
2 | // get the current map offset
3 | var offsetXY;
4 |
5 | beforeEach(function() {
6 | offsetXY = map.offset();
7 | });
8 |
9 | it('should be able to pan a map', function() {
10 | map.pan(500, 500);
11 |
12 | expect(map.offset().x).toEqual(offsetXY.x + 500);
13 | expect(map.offset().y).toEqual(offsetXY.y + 500);
14 | });
15 |
16 | it('should be able to pan a map with easing', function() {
17 | runs(function() {
18 | map.pan(-500, -500, {
19 | callback: function() {
20 | expect(map.offset().x).toEqual(offsetXY.x - 500);
21 | expect(map.offset().y).toEqual(offsetXY.y - 500);
22 | }
23 | });
24 | });
25 |
26 | waits(1200);
27 | });
28 |
29 | it('should be able to scale a map', function() {
30 | runs(function() {
31 | map.scale(0.75, {
32 | callback: function() {
33 | expect(map.scale()).toEqual(0.75);
34 | }
35 | });
36 | });
37 |
38 | waits(1200);
39 | map.scale(1, false, true);
40 | });
41 |
42 | it('should be able to rotate a map', function() {
43 | runs(function() {
44 | map.rotate(360, {
45 | callback: function() {
46 | expect(map.rotate()).toEqual(0);
47 | }
48 | });
49 | });
50 |
51 | waits(1200);
52 | });
53 | });
--------------------------------------------------------------------------------
/demos/_sources/_layout.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 | {{#css}}
20 |
21 | {{/css}}
22 | {{{ body }}}
23 |
24 |
25 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 | {{#includes}}{{/includes}}
38 |
41 |
42 |
43 |
44 |
--------------------------------------------------------------------------------
/demos/_sources/geojson/dnd-geojson.js:
--------------------------------------------------------------------------------
1 | (function() {
2 | var parser = T5.Registry.create('parser', 'geojson'),
3 | container = $('#mapContainer')[0];
4 |
5 | map = new T5.Map('mapContainer', {
6 | renderer: 'canvas',
7 | padding: 'auto'
8 | });
9 |
10 | map.layer('tiles', 'tile', {
11 | generator: 'osm.cloudmade',
12 | // demo api key, register for an API key at http://dev.cloudmade.com/
13 | apikey: '7960daaf55f84bfdb166014d0b9f8d41'
14 | });
15 |
16 | map.center(DEMO.getHomePosition()).zoom(4);
17 |
18 | container.addEventListener("dragover", function (evt) {
19 | evt.preventDefault();
20 | }, false);
21 |
22 | // Handle dropped image file - only Firefox and Google Chrome
23 | container.addEventListener("drop", function (evt) {
24 | var files = evt.dataTransfer.files;
25 | if (files.length > 0) {
26 | var file = files[0];
27 | if (typeof FileReader !== "undefined") {
28 | var reader = new FileReader();
29 | // Note: addEventListener doesn't work in Google Chrome for this event
30 | reader.onload = function (evt) {
31 | parser(map, JSON.parse(evt.target.result), function(layers) {
32 | for (var key in layers) {
33 | layers[key].visible = true;
34 | } // for
35 |
36 | map.invalidate();
37 | });
38 | };
39 | reader.readAsText(file);
40 | }
41 | }
42 | evt.preventDefault();
43 | }, false);
44 | })();
--------------------------------------------------------------------------------
/README.mdown:
--------------------------------------------------------------------------------
1 | # Tile5 - Alternative HTML5 Mapping
2 |
3 |
4 |
5 |
6 | ## Tile5 Refresh
7 |
8 | I'm currently doing a refresh on Tile5 to make it have some points of difference from other Mapping libraries. If you are looking for a great, stable mapping library, then I would recommend checking out [LeafletJS](http://leaflet.cloudmade.com/). It is far and away the best choice.
9 |
10 | Additionally, if you want to work with older version of Tile5 (unsupported) then the best place for you to start is probably the [pre-refresh tag](https://github.com/DamonOehlman/tile5/tree/pre-refresh/).
11 |
12 | The new version will essentially abandon previous work using CSS3D transforms and focus purely on manipulating a `