Permalink
Browse files

Merge branch 'mbostock-master'

  • Loading branch information...
2 parents 42b145f + c682b2a commit aa653ba65dc3c0b0b78decec4f62f0db611164e0 @mbostock mbostock committed Apr 11, 2011
Showing with 540 additions and 137 deletions.
  1. +1 −0 Makefile
  2. +1 −0 examples/bing/map.html
  3. +26 −0 examples/bounds/bounds.html
  4. +67 −0 examples/bounds/bounds.js
  5. +1 −0 examples/bounds/district.json
  6. +1 −0 examples/breakout/breakout.html
  7. +1 −0 examples/canvas/cell.html
  8. +1 −0 examples/canvas/mandelbrot.html
  9. +1 −0 examples/cloudmade/midnight-commander.html
  10. +1 −0 examples/cloudmade/pale-dawn.html
  11. +1 −0 examples/cluster/cluster.html
  12. +1 −0 examples/features/features.html
  13. +1 −0 examples/grid/grid.html
  14. +1 −0 examples/grid/tiles.html
  15. +1 −0 examples/hilbert/hilbert.html
  16. +1 −0 examples/invert/invert.html
  17. +21 −0 examples/iphone4/iphone4.html
  18. +19 −0 examples/iphone4/iphone4.js
  19. +1 −0 examples/kml/kml.html
  20. +1 −0 examples/loupe/loupe.html
  21. +1 −0 examples/marker/marker.html
  22. +1 −0 examples/nasa/blue-marble.html
  23. +1 −0 examples/overlay/overlay.html
  24. +1 −0 examples/population/population.html
  25. +1 −0 examples/shadow/shadow.html
  26. +1 −0 examples/small/small.html
  27. +1 −0 examples/small/static.html
  28. +1 −0 examples/statehood/statehood.html
  29. +1 −0 examples/streets/streets.html
  30. +1 −0 examples/tilestache/flickr.html
  31. +1 −0 examples/transform/transform-inverse.html
  32. +1 −0 examples/transform/transform.html
  33. +1 −0 examples/transition/transition.html
  34. +1 −0 examples/unemployment/unemployment.html
  35. +1 −0 examples/world/world.html
  36. +158 −40 polymaps.js
  37. +64 −61 polymaps.min.js
  38. +2 −3 src/Compass.js
  39. +12 −6 src/Image.js
  40. +2 −0 src/Interact.js
  41. +2 −1 src/Map.js
  42. +81 −0 src/Touch.js
  43. +1 −1 src/Transform.js
  44. +15 −3 src/Url.js
  45. +38 −21 src/Wheel.js
  46. +1 −1 src/start.js
View
@@ -17,6 +17,7 @@ JS_FILES = \
src/Wheel.js \
src/Arrow.js \
src/Hash.js \
+ src/Touch.js \
src/Interact.js \
src/Compass.js \
src/Grid.js \
View
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../../lib/jquery/jquery.min.js"></script>
@@ -0,0 +1,26 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <script type="text/javascript" src="../../polymaps.js"></script>
+ <style type="text/css">
+
+@import url("../example.css");
+
+#district path {
+ fill: lightsteelblue;
+ fill-opacity: .5;
+ stroke: steelblue;
+}
+
+ </style>
+ </head>
+ <body id="map">
+ <script type="text/javascript" src="bounds.js"></script>
+ <span id="copy">
+ &copy; 2010
+ <a href="http://www.cloudmade.com/">CloudMade</a>,
+ <a href="http://www.openstreetmap.org/">OpenStreetMap</a> contributors,
+ <a href="http://creativecommons.org/licenses/by-sa/2.0/">CCBYSA</a>.
+ </span>
+ </body>
+</html>
View
@@ -0,0 +1,67 @@
+var po = org.polymaps;
+
+var map = po.map()
+ .container(document.getElementById("map").appendChild(po.svg("svg")))
+ .add(po.interact());
+
+map.add(po.image()
+ .url(po.url("http://{S}tile.cloudmade.com"
+ + "/1a1b06b230af4efdbb989ea99e9841af" // http://cloudmade.com/register
+ + "/998/256/{Z}/{X}/{Y}.png")
+ .hosts(["a.", "b.", "c.", ""])));
+
+map.add(po.geoJson()
+ .url("district.json")
+ .id("district")
+ .on("load", load));
+
+map.add(po.compass()
+ .pan("none"));
+
+function load(e) {
+ map.extent(bounds(e.features)).zoomBy(-.5);
+}
+
+function bounds(features) {
+ var i = -1,
+ n = features.length,
+ geometry,
+ bounds = [{lon: Infinity, lat: Infinity}, {lon: -Infinity, lat: -Infinity}];
+ while (++i < n) {
+ geometry = features[i].data.geometry;
+ boundGeometry[geometry.type](bounds, geometry.coordinates);
+ }
+ return bounds;
+}
+
+function boundPoint(bounds, coordinate) {
+ var x = coordinate[0], y = coordinate[1];
+ if (x < bounds[0].lon) bounds[0].lon = x;
+ if (x > bounds[1].lon) bounds[1].lon = x;
+ if (y < bounds[0].lat) bounds[0].lat = y;
+ if (y > bounds[1].lat) bounds[1].lat = y;
+}
+
+function boundPoints(bounds, coordinates) {
+ var i = -1, n = coordinates.length;
+ while (++i < n) boundPoint(bounds, coordinates[i]);
+}
+
+function boundMultiPoints(bounds, coordinates) {
+ var i = -1, n = coordinates.length;
+ while (++i < n) boundPoints(bounds, coordinates[i]);
+}
+
+var boundGeometry = {
+ Point: boundPoint,
+ MultiPoint: boundPoints,
+ LineString: boundPoints,
+ MultiLineString: boundMultiPoints,
+ Polygon: function(bounds, coordinates) {
+ boundPoints(bounds, coordinates[0]); // exterior ring
+ },
+ MultiPolygon: function(bounds, coordinates) {
+ var i = -1, n = coordinates.length;
+ while (++i < n) boundPoints(bounds, coordinates[i][0]);
+ }
+};

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../../polymaps.js"></script>
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../../polymaps.js"></script>
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../../polymaps.js"></script>
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../../polymaps.js"></script>
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../../polymaps.js"></script>
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../../polymaps.js"></script>
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../../polymaps.js"></script>
View
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../../polymaps.js"></script>
View
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../../polymaps.js"></script>
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../../polymaps.js"></script>
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../../polymaps.js"></script>
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <meta name="viewport" content="initial-scale=1,maximum-scale=1"/>
+ <script type="text/javascript" src="../../polymaps.js"></script>
+ <style type="text/css">
+
+@import url("../example.css");
+
+ </style>
+ </head>
+ <body id="map">
+ <script type="text/javascript" src="iphone4.js"></script>
+ <span id="copy">
+ &copy; 2011
+ <a href="http://www.cloudmade.com/">CloudMade</a>,
+ <a href="http://www.openstreetmap.org/">OpenStreetMap</a> contributors,
+ <a href="http://creativecommons.org/licenses/by-sa/2.0/">CCBYSA</a>.
+ </span>
+ </body>
+</html>
@@ -0,0 +1,19 @@
+var po = org.polymaps;
+
+// Note: po.interact has built-in touch support!
+var map = po.map()
+ .container(document.getElementById("map").appendChild(po.svg("svg")))
+ .add(po.interact());
+
+// Compute zoom offset for retina display.
+var dz = Math.log(window.devicePixelRatio || 1) / Math.LN2;
+
+// CloudMade image tiles, hooray!
+map.add(po.image()
+ .url(po.url("http://{S}tile.cloudmade.com"
+ + "/1a1b06b230af4efdbb989ea99e9841af" // http://cloudmade.com/register
+ + "/998/256/{Z}/{X}/{Y}.png")
+ .hosts(["a.", "b.", "c.", ""]))
+ .zoom(function(z) { return z + dz; }));
+
+// no compass! pinch-to-zoom ftw
View
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<title>KML</title>
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../../polymaps.js"></script>
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../../polymaps.js"></script>
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../../polymaps.js"></script>
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../../polymaps.js"></script>
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<title>Population Density</title>
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../../polymaps.js"></script>
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../../polymaps.js"></script>
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../../polymaps.js"></script>
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<title>U.S. Statehood by Date</title>
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<title>San Francisco Street Pavement</title>
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../../polymaps.js"></script>
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../../polymaps.js"></script>
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../../polymaps.js"></script>
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="../../polymaps.js"></script>
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<title>Unemployment</title>
@@ -1,3 +1,4 @@
+<!DOCTYPE html>
<html>
<head>
<title>Internet Users</title>
Oops, something went wrong.

0 comments on commit aa653ba

Please sign in to comment.