stripchart 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/LICENSE +21 -0
- data/README.md +21 -0
- data/exe/stripchart +5 -0
- data/lib/stripchart/app.rb +71 -0
- data/lib/stripchart/public/app.css +37 -0
- data/lib/stripchart/public/app.js +167 -0
- data/lib/stripchart/public/components/d3/LICENSE +26 -0
- data/lib/stripchart/public/components/d3/Makefile +45 -0
- data/lib/stripchart/public/components/d3/README.md +7 -0
- data/lib/stripchart/public/components/d3/bower.json +25 -0
- data/lib/stripchart/public/components/d3/component.json +30 -0
- data/lib/stripchart/public/components/d3/d3.js +8798 -0
- data/lib/stripchart/public/components/d3/d3.min.js +5 -0
- data/lib/stripchart/public/components/d3/index-browserify.js +3 -0
- data/lib/stripchart/public/components/d3/index.js +15 -0
- data/lib/stripchart/public/components/d3/lib/colorbrewer/LICENSE +38 -0
- data/lib/stripchart/public/components/d3/lib/colorbrewer/colorbrewer.css +1690 -0
- data/lib/stripchart/public/components/d3/lib/colorbrewer/colorbrewer.js +302 -0
- data/lib/stripchart/public/components/d3/lib/geographiclib/LICENSE +23 -0
- data/lib/stripchart/public/components/d3/lib/jit/LICENSE +27 -0
- data/lib/stripchart/public/components/d3/lib/penner/LICENSE +31 -0
- data/lib/stripchart/public/components/d3/lib/polymaps/LICENSE +28 -0
- data/lib/stripchart/public/components/d3/lib/protovis/LICENSE +27 -0
- data/lib/stripchart/public/components/d3/lib/science/LICENSE +26 -0
- data/lib/stripchart/public/components/d3/lib/science/science.js +225 -0
- data/lib/stripchart/public/components/d3/lib/science/science.lin.js +27 -0
- data/lib/stripchart/public/components/d3/lib/science/science.lin.min.js +1 -0
- data/lib/stripchart/public/components/d3/lib/science/science.min.js +1 -0
- data/lib/stripchart/public/components/d3/lib/science/science.stats.js +720 -0
- data/lib/stripchart/public/components/d3/lib/science/science.stats.min.js +1 -0
- data/lib/stripchart/public/components/d3/package.json +53 -0
- data/lib/stripchart/public/components/d3/src/arrays/ascending.js +3 -0
- data/lib/stripchart/public/components/d3/src/arrays/bisect.js +28 -0
- data/lib/stripchart/public/components/d3/src/arrays/descending.js +3 -0
- data/lib/stripchart/public/components/d3/src/arrays/entries.js +5 -0
- data/lib/stripchart/public/components/d3/src/arrays/extent.js +21 -0
- data/lib/stripchart/public/components/d3/src/arrays/index.js +22 -0
- data/lib/stripchart/public/components/d3/src/arrays/keys.js +5 -0
- data/lib/stripchart/public/components/d3/src/arrays/map.js +50 -0
- data/lib/stripchart/public/components/d3/src/arrays/max.js +14 -0
- data/lib/stripchart/public/components/d3/src/arrays/mean.js +15 -0
- data/lib/stripchart/public/components/d3/src/arrays/median.js +9 -0
- data/lib/stripchart/public/components/d3/src/arrays/merge.js +3 -0
- data/lib/stripchart/public/components/d3/src/arrays/min.js +14 -0
- data/lib/stripchart/public/components/d3/src/arrays/nest.js +97 -0
- data/lib/stripchart/public/components/d3/src/arrays/permute.js +7 -0
- data/lib/stripchart/public/components/d3/src/arrays/quantile.js +8 -0
- data/lib/stripchart/public/components/d3/src/arrays/range.js +24 -0
- data/lib/stripchart/public/components/d3/src/arrays/set.js +38 -0
- data/lib/stripchart/public/components/d3/src/arrays/shuffle.js +8 -0
- data/lib/stripchart/public/components/d3/src/arrays/sum.js +14 -0
- data/lib/stripchart/public/components/d3/src/arrays/transpose.js +5 -0
- data/lib/stripchart/public/components/d3/src/arrays/values.js +5 -0
- data/lib/stripchart/public/components/d3/src/arrays/zip.js +15 -0
- data/lib/stripchart/public/components/d3/src/behavior/behavior.js +1 -0
- data/lib/stripchart/public/components/d3/src/behavior/drag.js +79 -0
- data/lib/stripchart/public/components/d3/src/behavior/index.js +3 -0
- data/lib/stripchart/public/components/d3/src/behavior/zoom.js +209 -0
- data/lib/stripchart/public/components/d3/src/color/color.js +5 -0
- data/lib/stripchart/public/components/d3/src/color/hcl.js +42 -0
- data/lib/stripchart/public/components/d3/src/color/hsl.js +64 -0
- data/lib/stripchart/public/components/d3/src/color/index.js +6 -0
- data/lib/stripchart/public/components/d3/src/color/lab.js +68 -0
- data/lib/stripchart/public/components/d3/src/color/rgb.js +307 -0
- data/lib/stripchart/public/components/d3/src/color/xyz.js +7 -0
- data/lib/stripchart/public/components/d3/src/compat/date.js +3 -0
- data/lib/stripchart/public/components/d3/src/compat/index.js +2 -0
- data/lib/stripchart/public/components/d3/src/compat/style.js +20 -0
- data/lib/stripchart/public/components/d3/src/core/array.js +19 -0
- data/lib/stripchart/public/components/d3/src/core/class.js +12 -0
- data/lib/stripchart/public/components/d3/src/core/document.js +3 -0
- data/lib/stripchart/public/components/d3/src/core/functor.js +5 -0
- data/lib/stripchart/public/components/d3/src/core/identity.js +3 -0
- data/lib/stripchart/public/components/d3/src/core/index.js +3 -0
- data/lib/stripchart/public/components/d3/src/core/noop.js +1 -0
- data/lib/stripchart/public/components/d3/src/core/ns.js +22 -0
- data/lib/stripchart/public/components/d3/src/core/rebind.js +16 -0
- data/lib/stripchart/public/components/d3/src/core/source.js +3 -0
- data/lib/stripchart/public/components/d3/src/core/subclass.js +11 -0
- data/lib/stripchart/public/components/d3/src/core/target.js +3 -0
- data/lib/stripchart/public/components/d3/src/core/true.js +3 -0
- data/lib/stripchart/public/components/d3/src/core/vendor.js +12 -0
- data/lib/stripchart/public/components/d3/src/d3.js +23 -0
- data/lib/stripchart/public/components/d3/src/dsv/csv.js +3 -0
- data/lib/stripchart/public/components/d3/src/dsv/dsv.js +136 -0
- data/lib/stripchart/public/components/d3/src/dsv/index.js +3 -0
- data/lib/stripchart/public/components/d3/src/dsv/tsv.js +3 -0
- data/lib/stripchart/public/components/d3/src/end.js +2 -0
- data/lib/stripchart/public/components/d3/src/event/dispatch.js +69 -0
- data/lib/stripchart/public/components/d3/src/event/drag.js +27 -0
- data/lib/stripchart/public/components/d3/src/event/event.js +50 -0
- data/lib/stripchart/public/components/d3/src/event/index.js +5 -0
- data/lib/stripchart/public/components/d3/src/event/mouse.js +39 -0
- data/lib/stripchart/public/components/d3/src/event/timer.js +82 -0
- data/lib/stripchart/public/components/d3/src/event/touches.js +12 -0
- data/lib/stripchart/public/components/d3/src/format/collapse.js +3 -0
- data/lib/stripchart/public/components/d3/src/format/format-locale.js +4 -0
- data/lib/stripchart/public/components/d3/src/format/format-localized.js +5 -0
- data/lib/stripchart/public/components/d3/src/format/format.js +144 -0
- data/lib/stripchart/public/components/d3/src/format/formatPrefix.js +22 -0
- data/lib/stripchart/public/components/d3/src/format/index.js +4 -0
- data/lib/stripchart/public/components/d3/src/format/requote.js +5 -0
- data/lib/stripchart/public/components/d3/src/format/round.js +5 -0
- data/lib/stripchart/public/components/d3/src/geo/albers-usa.js +129 -0
- data/lib/stripchart/public/components/d3/src/geo/albers.js +11 -0
- data/lib/stripchart/public/components/d3/src/geo/area.js +67 -0
- data/lib/stripchart/public/components/d3/src/geo/azimuthal-equal-area.js +12 -0
- data/lib/stripchart/public/components/d3/src/geo/azimuthal-equidistant.js +13 -0
- data/lib/stripchart/public/components/d3/src/geo/azimuthal.js +25 -0
- data/lib/stripchart/public/components/d3/src/geo/bounds.js +169 -0
- data/lib/stripchart/public/components/d3/src/geo/cartesian.js +47 -0
- data/lib/stripchart/public/components/d3/src/geo/centroid.js +149 -0
- data/lib/stripchart/public/components/d3/src/geo/circle.js +81 -0
- data/lib/stripchart/public/components/d3/src/geo/clip-antimeridian.js +101 -0
- data/lib/stripchart/public/components/d3/src/geo/clip-circle.js +182 -0
- data/lib/stripchart/public/components/d3/src/geo/clip-polygon.js +94 -0
- data/lib/stripchart/public/components/d3/src/geo/clip-view.js +212 -0
- data/lib/stripchart/public/components/d3/src/geo/clip.js +135 -0
- data/lib/stripchart/public/components/d3/src/geo/compose.js +12 -0
- data/lib/stripchart/public/components/d3/src/geo/conic-conformal.js +36 -0
- data/lib/stripchart/public/components/d3/src/geo/conic-equal-area.js +33 -0
- data/lib/stripchart/public/components/d3/src/geo/conic-equidistant.js +35 -0
- data/lib/stripchart/public/components/d3/src/geo/conic.js +16 -0
- data/lib/stripchart/public/components/d3/src/geo/distance.js +13 -0
- data/lib/stripchart/public/components/d3/src/geo/equirectangular.js +10 -0
- data/lib/stripchart/public/components/d3/src/geo/geo.js +1 -0
- data/lib/stripchart/public/components/d3/src/geo/gnomonic.js +12 -0
- data/lib/stripchart/public/components/d3/src/geo/graticule.js +102 -0
- data/lib/stripchart/public/components/d3/src/geo/greatArc.js +42 -0
- data/lib/stripchart/public/components/d3/src/geo/index.js +32 -0
- data/lib/stripchart/public/components/d3/src/geo/interpolate.js +38 -0
- data/lib/stripchart/public/components/d3/src/geo/length.js +43 -0
- data/lib/stripchart/public/components/d3/src/geo/mercator.js +48 -0
- data/lib/stripchart/public/components/d3/src/geo/orthographic.js +12 -0
- data/lib/stripchart/public/components/d3/src/geo/path-area.js +40 -0
- data/lib/stripchart/public/components/d3/src/geo/path-bounds.js +21 -0
- data/lib/stripchart/public/components/d3/src/geo/path-buffer.js +59 -0
- data/lib/stripchart/public/components/d3/src/geo/path-centroid.js +78 -0
- data/lib/stripchart/public/components/d3/src/geo/path-context.js +49 -0
- data/lib/stripchart/public/components/d3/src/geo/path.js +97 -0
- data/lib/stripchart/public/components/d3/src/geo/point-in-polygon.js +71 -0
- data/lib/stripchart/public/components/d3/src/geo/projection.js +132 -0
- data/lib/stripchart/public/components/d3/src/geo/resample.js +98 -0
- data/lib/stripchart/public/components/d3/src/geo/rotation.js +72 -0
- data/lib/stripchart/public/components/d3/src/geo/spherical.js +12 -0
- data/lib/stripchart/public/components/d3/src/geo/stereographic.js +12 -0
- data/lib/stripchart/public/components/d3/src/geo/stream.js +71 -0
- data/lib/stripchart/public/components/d3/src/geo/transverse-mercator.js +23 -0
- data/lib/stripchart/public/components/d3/src/geom/delaunay.js +31 -0
- data/lib/stripchart/public/components/d3/src/geom/geom.js +1 -0
- data/lib/stripchart/public/components/d3/src/geom/hull.js +120 -0
- data/lib/stripchart/public/components/d3/src/geom/index.js +6 -0
- data/lib/stripchart/public/components/d3/src/geom/polygon.js +105 -0
- data/lib/stripchart/public/components/d3/src/geom/quadtree.js +190 -0
- data/lib/stripchart/public/components/d3/src/geom/voronoi.js +545 -0
- data/lib/stripchart/public/components/d3/src/interpolate/array.js +19 -0
- data/lib/stripchart/public/components/d3/src/interpolate/ease.js +110 -0
- data/lib/stripchart/public/components/d3/src/interpolate/hcl.js +23 -0
- data/lib/stripchart/public/components/d3/src/interpolate/hsl.js +23 -0
- data/lib/stripchart/public/components/d3/src/interpolate/index.js +13 -0
- data/lib/stripchart/public/components/d3/src/interpolate/interpolate.js +25 -0
- data/lib/stripchart/public/components/d3/src/interpolate/lab.js +20 -0
- data/lib/stripchart/public/components/d3/src/interpolate/number.js +6 -0
- data/lib/stripchart/public/components/d3/src/interpolate/object.js +25 -0
- data/lib/stripchart/public/components/d3/src/interpolate/rgb.js +20 -0
- data/lib/stripchart/public/components/d3/src/interpolate/round.js +6 -0
- data/lib/stripchart/public/components/d3/src/interpolate/string.js +88 -0
- data/lib/stripchart/public/components/d3/src/interpolate/transform.js +56 -0
- data/lib/stripchart/public/components/d3/src/interpolate/uninterpolate.js +9 -0
- data/lib/stripchart/public/components/d3/src/layout/bundle.js +59 -0
- data/lib/stripchart/public/components/d3/src/layout/chord.js +157 -0
- data/lib/stripchart/public/components/d3/src/layout/cluster.js +92 -0
- data/lib/stripchart/public/components/d3/src/layout/force.js +359 -0
- data/lib/stripchart/public/components/d3/src/layout/hierarchy.js +116 -0
- data/lib/stripchart/public/components/d3/src/layout/histogram.js +110 -0
- data/lib/stripchart/public/components/d3/src/layout/index.js +13 -0
- data/lib/stripchart/public/components/d3/src/layout/layout.js +1 -0
- data/lib/stripchart/public/components/d3/src/layout/pack.js +212 -0
- data/lib/stripchart/public/components/d3/src/layout/partition.js +51 -0
- data/lib/stripchart/public/components/d3/src/layout/pie.js +99 -0
- data/lib/stripchart/public/components/d3/src/layout/stack.js +245 -0
- data/lib/stripchart/public/components/d3/src/layout/tree.js +251 -0
- data/lib/stripchart/public/components/d3/src/layout/treemap.js +230 -0
- data/lib/stripchart/public/components/d3/src/math/adder.js +34 -0
- data/lib/stripchart/public/components/d3/src/math/index.js +2 -0
- data/lib/stripchart/public/components/d3/src/math/number.js +3 -0
- data/lib/stripchart/public/components/d3/src/math/random.js +28 -0
- data/lib/stripchart/public/components/d3/src/math/transform.js +64 -0
- data/lib/stripchart/public/components/d3/src/math/trigonometry.js +29 -0
- data/lib/stripchart/public/components/d3/src/scale/bilinear.js +7 -0
- data/lib/stripchart/public/components/d3/src/scale/category.js +57 -0
- data/lib/stripchart/public/components/d3/src/scale/identity.js +33 -0
- data/lib/stripchart/public/components/d3/src/scale/index.js +11 -0
- data/lib/stripchart/public/components/d3/src/scale/linear.js +128 -0
- data/lib/stripchart/public/components/d3/src/scale/log.js +92 -0
- data/lib/stripchart/public/components/d3/src/scale/nice.js +28 -0
- data/lib/stripchart/public/components/d3/src/scale/ordinal.js +92 -0
- data/lib/stripchart/public/components/d3/src/scale/polylinear.js +24 -0
- data/lib/stripchart/public/components/d3/src/scale/pow.js +58 -0
- data/lib/stripchart/public/components/d3/src/scale/quantile.js +54 -0
- data/lib/stripchart/public/components/d3/src/scale/quantize.js +44 -0
- data/lib/stripchart/public/components/d3/src/scale/scale.js +10 -0
- data/lib/stripchart/public/components/d3/src/scale/sqrt.js +6 -0
- data/lib/stripchart/public/components/d3/src/scale/threshold.js +36 -0
- data/lib/stripchart/public/components/d3/src/selection/append.js +16 -0
- data/lib/stripchart/public/components/d3/src/selection/attr.js +62 -0
- data/lib/stripchart/public/components/d3/src/selection/call.js +8 -0
- data/lib/stripchart/public/components/d3/src/selection/classed.js +72 -0
- data/lib/stripchart/public/components/d3/src/selection/data.js +118 -0
- data/lib/stripchart/public/components/d3/src/selection/datum.js +7 -0
- data/lib/stripchart/public/components/d3/src/selection/each.js +16 -0
- data/lib/stripchart/public/components/d3/src/selection/empty.js +5 -0
- data/lib/stripchart/public/components/d3/src/selection/enter-insert.js +20 -0
- data/lib/stripchart/public/components/d3/src/selection/enter-select.js +27 -0
- data/lib/stripchart/public/components/d3/src/selection/enter.js +21 -0
- data/lib/stripchart/public/components/d3/src/selection/filter.js +28 -0
- data/lib/stripchart/public/components/d3/src/selection/html.js +10 -0
- data/lib/stripchart/public/components/d3/src/selection/index.js +1 -0
- data/lib/stripchart/public/components/d3/src/selection/insert.js +9 -0
- data/lib/stripchart/public/components/d3/src/selection/node.js +11 -0
- data/lib/stripchart/public/components/d3/src/selection/on.js +104 -0
- data/lib/stripchart/public/components/d3/src/selection/order.js +13 -0
- data/lib/stripchart/public/components/d3/src/selection/property.js +43 -0
- data/lib/stripchart/public/components/d3/src/selection/remove.js +11 -0
- data/lib/stripchart/public/components/d3/src/selection/select.js +32 -0
- data/lib/stripchart/public/components/d3/src/selection/selectAll.js +27 -0
- data/lib/stripchart/public/components/d3/src/selection/selection.js +67 -0
- data/lib/stripchart/public/components/d3/src/selection/size.js +7 -0
- data/lib/stripchart/public/components/d3/src/selection/sort.js +15 -0
- data/lib/stripchart/public/components/d3/src/selection/style.js +56 -0
- data/lib/stripchart/public/components/d3/src/selection/text.js +10 -0
- data/lib/stripchart/public/components/d3/src/selection/transition.js +19 -0
- data/lib/stripchart/public/components/d3/src/start.js +2 -0
- data/lib/stripchart/public/components/d3/src/svg/arc.js +99 -0
- data/lib/stripchart/public/components/d3/src/svg/area-radial.js +14 -0
- data/lib/stripchart/public/components/d3/src/svg/area.js +120 -0
- data/lib/stripchart/public/components/d3/src/svg/axis.js +222 -0
- data/lib/stripchart/public/components/d3/src/svg/brush.js +379 -0
- data/lib/stripchart/public/components/d3/src/svg/chord.js +90 -0
- data/lib/stripchart/public/components/d3/src/svg/diagonal-radial.js +26 -0
- data/lib/stripchart/public/components/d3/src/svg/diagonal.js +43 -0
- data/lib/stripchart/public/components/d3/src/svg/index.js +12 -0
- data/lib/stripchart/public/components/d3/src/svg/line-radial.js +26 -0
- data/lib/stripchart/public/components/d3/src/svg/line.js +439 -0
- data/lib/stripchart/public/components/d3/src/svg/svg.js +1 -0
- data/lib/stripchart/public/components/d3/src/svg/symbol.js +105 -0
- data/lib/stripchart/public/components/d3/src/time/day.js +21 -0
- data/lib/stripchart/public/components/d3/src/time/format-iso.js +20 -0
- data/lib/stripchart/public/components/d3/src/time/format-locale.js +10 -0
- data/lib/stripchart/public/components/d3/src/time/format-localized.js +11 -0
- data/lib/stripchart/public/components/d3/src/time/format-utc.js +31 -0
- data/lib/stripchart/public/components/d3/src/time/format.js +303 -0
- data/lib/stripchart/public/components/d3/src/time/hour.js +14 -0
- data/lib/stripchart/public/components/d3/src/time/index.js +15 -0
- data/lib/stripchart/public/components/d3/src/time/interval.js +71 -0
- data/lib/stripchart/public/components/d3/src/time/minute.js +13 -0
- data/lib/stripchart/public/components/d3/src/time/month.js +16 -0
- data/lib/stripchart/public/components/d3/src/time/scale-utc.js +43 -0
- data/lib/stripchart/public/components/d3/src/time/scale.js +150 -0
- data/lib/stripchart/public/components/d3/src/time/second.js +13 -0
- data/lib/stripchart/public/components/d3/src/time/time.js +35 -0
- data/lib/stripchart/public/components/d3/src/time/week.js +32 -0
- data/lib/stripchart/public/components/d3/src/time/year.js +16 -0
- data/lib/stripchart/public/components/d3/src/transition/attr.js +58 -0
- data/lib/stripchart/public/components/d3/src/transition/delay.js +9 -0
- data/lib/stripchart/public/components/d3/src/transition/duration.js +9 -0
- data/lib/stripchart/public/components/d3/src/transition/each.js +23 -0
- data/lib/stripchart/public/components/d3/src/transition/ease.js +10 -0
- data/lib/stripchart/public/components/d3/src/transition/filter.js +22 -0
- data/lib/stripchart/public/components/d3/src/transition/index.js +1 -0
- data/lib/stripchart/public/components/d3/src/transition/remove.js +8 -0
- data/lib/stripchart/public/components/d3/src/transition/select.js +27 -0
- data/lib/stripchart/public/components/d3/src/transition/selectAll.js +30 -0
- data/lib/stripchart/public/components/d3/src/transition/style.js +53 -0
- data/lib/stripchart/public/components/d3/src/transition/subtransition.js +25 -0
- data/lib/stripchart/public/components/d3/src/transition/text.js +11 -0
- data/lib/stripchart/public/components/d3/src/transition/transition.js +118 -0
- data/lib/stripchart/public/components/d3/src/transition/tween.js +17 -0
- data/lib/stripchart/public/components/d3/src/xhr/html.js +12 -0
- data/lib/stripchart/public/components/d3/src/xhr/index.js +5 -0
- data/lib/stripchart/public/components/d3/src/xhr/json.js +9 -0
- data/lib/stripchart/public/components/d3/src/xhr/text.js +5 -0
- data/lib/stripchart/public/components/d3/src/xhr/xhr.js +118 -0
- data/lib/stripchart/public/components/d3/src/xhr/xml.js +5 -0
- data/lib/stripchart/public/components/d3/test/XMLHttpRequest.js +55 -0
- data/lib/stripchart/public/components/d3/test/arrays/ascending-test.js +45 -0
- data/lib/stripchart/public/components/d3/test/arrays/bisect-test.js +257 -0
- data/lib/stripchart/public/components/d3/test/arrays/descending-test.js +45 -0
- data/lib/stripchart/public/components/d3/test/arrays/entries-test.js +39 -0
- data/lib/stripchart/public/components/d3/test/arrays/extent-test.js +50 -0
- data/lib/stripchart/public/components/d3/test/arrays/keys-test.js +27 -0
- data/lib/stripchart/public/components/d3/test/arrays/map-test.js +214 -0
- data/lib/stripchart/public/components/d3/test/arrays/max-test.js +51 -0
- data/lib/stripchart/public/components/d3/test/arrays/mean-test.js +39 -0
- data/lib/stripchart/public/components/d3/test/arrays/median-test.js +39 -0
- data/lib/stripchart/public/components/d3/test/arrays/merge-test.js +26 -0
- data/lib/stripchart/public/components/d3/test/arrays/min-test.js +51 -0
- data/lib/stripchart/public/components/d3/test/arrays/nest-test.js +256 -0
- data/lib/stripchart/public/components/d3/test/arrays/permute-test.js +49 -0
- data/lib/stripchart/public/components/d3/test/arrays/quantile-test.js +56 -0
- data/lib/stripchart/public/components/d3/test/arrays/range-test.js +99 -0
- data/lib/stripchart/public/components/d3/test/arrays/set-test.js +136 -0
- data/lib/stripchart/public/components/d3/test/arrays/sum-test.js +43 -0
- data/lib/stripchart/public/components/d3/test/arrays/transpose-test.js +28 -0
- data/lib/stripchart/public/components/d3/test/arrays/values-test.js +31 -0
- data/lib/stripchart/public/components/d3/test/arrays/zip-test.js +28 -0
- data/lib/stripchart/public/components/d3/test/assert.js +153 -0
- data/lib/stripchart/public/components/d3/test/color/hcl-test.js +112 -0
- data/lib/stripchart/public/components/d3/test/color/hsl-test.js +118 -0
- data/lib/stripchart/public/components/d3/test/color/lab-test.js +81 -0
- data/lib/stripchart/public/components/d3/test/color/rgb-test.js +91 -0
- data/lib/stripchart/public/components/d3/test/core/functor-test.js +25 -0
- data/lib/stripchart/public/components/d3/test/core/ns-test.js +57 -0
- data/lib/stripchart/public/components/d3/test/core/rebind-test.js +50 -0
- data/lib/stripchart/public/components/d3/test/core/version-test.js +16 -0
- data/lib/stripchart/public/components/d3/test/data/sample.csv +2 -0
- data/lib/stripchart/public/components/d3/test/data/sample.html +5 -0
- data/lib/stripchart/public/components/d3/test/data/sample.json +1 -0
- data/lib/stripchart/public/components/d3/test/data/sample.tsv +2 -0
- data/lib/stripchart/public/components/d3/test/data/sample.txt +1 -0
- data/lib/stripchart/public/components/d3/test/data/sample.xml +4 -0
- data/lib/stripchart/public/components/d3/test/data/us-counties.json +3186 -0
- data/lib/stripchart/public/components/d3/test/dsv/csv-test.js +214 -0
- data/lib/stripchart/public/components/d3/test/dsv/tsv-test.js +185 -0
- data/lib/stripchart/public/components/d3/test/event/dispatch-test.js +163 -0
- data/lib/stripchart/public/components/d3/test/event/mouse-test.html +22 -0
- data/lib/stripchart/public/components/d3/test/event/timer-test.js +74 -0
- data/lib/stripchart/public/components/d3/test/event/touch-test.html +61 -0
- data/lib/stripchart/public/components/d3/test/format/format-test.js +360 -0
- data/lib/stripchart/public/components/d3/test/format/formatPrefix-test.js +112 -0
- data/lib/stripchart/public/components/d3/test/format/requote-test.js +49 -0
- data/lib/stripchart/public/components/d3/test/format/round-test.js +66 -0
- data/lib/stripchart/public/components/d3/test/geo/albers-test.js +40 -0
- data/lib/stripchart/public/components/d3/test/geo/albers-usa-test.js +33 -0
- data/lib/stripchart/public/components/d3/test/geo/area-benchmark.js +12 -0
- data/lib/stripchart/public/components/d3/test/geo/area-test.js +185 -0
- data/lib/stripchart/public/components/d3/test/geo/azimuthal-equal-area-test.js +38 -0
- data/lib/stripchart/public/components/d3/test/geo/azimuthal-equidistant-test.js +38 -0
- data/lib/stripchart/public/components/d3/test/geo/benchmark.js +83 -0
- data/lib/stripchart/public/components/d3/test/geo/bounds-test.js +265 -0
- data/lib/stripchart/public/components/d3/test/geo/centroid-test.js +187 -0
- data/lib/stripchart/public/components/d3/test/geo/circle-test.js +29 -0
- data/lib/stripchart/public/components/d3/test/geo/clip-view-mock.js +4 -0
- data/lib/stripchart/public/components/d3/test/geo/clip-view-test.js +44 -0
- data/lib/stripchart/public/components/d3/test/geo/conic-conformal-test.js +38 -0
- data/lib/stripchart/public/components/d3/test/geo/conic-equal-area-test.js +38 -0
- data/lib/stripchart/public/components/d3/test/geo/conic-equidistant-test.js +38 -0
- data/lib/stripchart/public/components/d3/test/geo/distance-test.js +20 -0
- data/lib/stripchart/public/components/d3/test/geo/equirectangular-test.js +38 -0
- data/lib/stripchart/public/components/d3/test/geo/gnomonic-test.js +38 -0
- data/lib/stripchart/public/components/d3/test/geo/graticule-test.js +188 -0
- data/lib/stripchart/public/components/d3/test/geo/greatArc-test.js +35 -0
- data/lib/stripchart/public/components/d3/test/geo/interpolate-test.js +22 -0
- data/lib/stripchart/public/components/d3/test/geo/length-test.js +44 -0
- data/lib/stripchart/public/components/d3/test/geo/mercator-test.js +38 -0
- data/lib/stripchart/public/components/d3/test/geo/orthographic-test.js +34 -0
- data/lib/stripchart/public/components/d3/test/geo/path-test.js +832 -0
- data/lib/stripchart/public/components/d3/test/geo/point-in-polygon-mock.js +18 -0
- data/lib/stripchart/public/components/d3/test/geo/point-in-polygon-test.js +352 -0
- data/lib/stripchart/public/components/d3/test/geo/projection-test-suite.js +29 -0
- data/lib/stripchart/public/components/d3/test/geo/projection-test.js +58 -0
- data/lib/stripchart/public/components/d3/test/geo/rotation-test.js +35 -0
- data/lib/stripchart/public/components/d3/test/geo/stereographic-test.js +38 -0
- data/lib/stripchart/public/components/d3/test/geo/stream-test.js +264 -0
- data/lib/stripchart/public/components/d3/test/geo/transverse-mercator-test.js +38 -0
- data/lib/stripchart/public/components/d3/test/geom/hull-test.js +68 -0
- data/lib/stripchart/public/components/d3/test/geom/polygon-test.js +151 -0
- data/lib/stripchart/public/components/d3/test/geom/quadtree-test.js +139 -0
- data/lib/stripchart/public/components/d3/test/geom/voronoi-test.js +230 -0
- data/lib/stripchart/public/components/d3/test/interpolate/array-test.js +24 -0
- data/lib/stripchart/public/components/d3/test/interpolate/ease-test.js +135 -0
- data/lib/stripchart/public/components/d3/test/interpolate/hcl-test.js +47 -0
- data/lib/stripchart/public/components/d3/test/interpolate/hsl-test.js +47 -0
- data/lib/stripchart/public/components/d3/test/interpolate/interpolate-test.js +157 -0
- data/lib/stripchart/public/components/d3/test/interpolate/interpolate-transform-test.js +60 -0
- data/lib/stripchart/public/components/d3/test/interpolate/lab-test.js +31 -0
- data/lib/stripchart/public/components/d3/test/interpolate/number-test.js +20 -0
- data/lib/stripchart/public/components/d3/test/interpolate/object-test.js +35 -0
- data/lib/stripchart/public/components/d3/test/interpolate/rgb-test.js +31 -0
- data/lib/stripchart/public/components/d3/test/interpolate/round-test.js +17 -0
- data/lib/stripchart/public/components/d3/test/interpolate/string-test.js +43 -0
- data/lib/stripchart/public/components/d3/test/layout/chord-test.js +164 -0
- data/lib/stripchart/public/components/d3/test/layout/cluster-test.js +44 -0
- data/lib/stripchart/public/components/d3/test/layout/force-test.js +119 -0
- data/lib/stripchart/public/components/d3/test/layout/hierarchy-test.js +27 -0
- data/lib/stripchart/public/components/d3/test/layout/histogram-test.js +92 -0
- data/lib/stripchart/public/components/d3/test/layout/pack-test.js +129 -0
- data/lib/stripchart/public/components/d3/test/layout/partition-test.js +45 -0
- data/lib/stripchart/public/components/d3/test/layout/pie-test.js +24 -0
- data/lib/stripchart/public/components/d3/test/layout/tree-test.js +45 -0
- data/lib/stripchart/public/components/d3/test/layout/treemap-test.js +181 -0
- data/lib/stripchart/public/components/d3/test/load.js +58 -0
- data/lib/stripchart/public/components/d3/test/math/random-test.js +37 -0
- data/lib/stripchart/public/components/d3/test/math/transform-null-matrix-test.html +26 -0
- data/lib/stripchart/public/components/d3/test/math/transform-null-test.html +26 -0
- data/lib/stripchart/public/components/d3/test/math/transform-rotate-origin-test.html +40 -0
- data/lib/stripchart/public/components/d3/test/math/transform-rotate-test.html +138 -0
- data/lib/stripchart/public/components/d3/test/math/transform-test.html +88 -0
- data/lib/stripchart/public/components/d3/test/scale/category-test.js +76 -0
- data/lib/stripchart/public/components/d3/test/scale/identity-test.js +163 -0
- data/lib/stripchart/public/components/d3/test/scale/linear-test.js +281 -0
- data/lib/stripchart/public/components/d3/test/scale/log-test.js +378 -0
- data/lib/stripchart/public/components/d3/test/scale/ordinal-test.js +272 -0
- data/lib/stripchart/public/components/d3/test/scale/pow-test.js +267 -0
- data/lib/stripchart/public/components/d3/test/scale/quantile-test.js +91 -0
- data/lib/stripchart/public/components/d3/test/scale/quantize-test.js +92 -0
- data/lib/stripchart/public/components/d3/test/scale/sqrt-test.js +260 -0
- data/lib/stripchart/public/components/d3/test/scale/threshold-test.js +64 -0
- data/lib/stripchart/public/components/d3/test/selection/append-test.js +153 -0
- data/lib/stripchart/public/components/d3/test/selection/attr-test.js +182 -0
- data/lib/stripchart/public/components/d3/test/selection/call-test.js +75 -0
- data/lib/stripchart/public/components/d3/test/selection/classed-test.js +269 -0
- data/lib/stripchart/public/components/d3/test/selection/data-test.js +270 -0
- data/lib/stripchart/public/components/d3/test/selection/datum-test.js +87 -0
- data/lib/stripchart/public/components/d3/test/selection/each-test.js +87 -0
- data/lib/stripchart/public/components/d3/test/selection/empty-test.js +53 -0
- data/lib/stripchart/public/components/d3/test/selection/enter-test.js +24 -0
- data/lib/stripchart/public/components/d3/test/selection/filter-test.js +72 -0
- data/lib/stripchart/public/components/d3/test/selection/html-test.js +134 -0
- data/lib/stripchart/public/components/d3/test/selection/insert-test.js +169 -0
- data/lib/stripchart/public/components/d3/test/selection/node-test.js +55 -0
- data/lib/stripchart/public/components/d3/test/selection/on-test.js +135 -0
- data/lib/stripchart/public/components/d3/test/selection/order-test.js +32 -0
- data/lib/stripchart/public/components/d3/test/selection/property-test.js +118 -0
- data/lib/stripchart/public/components/d3/test/selection/remove-test.js +38 -0
- data/lib/stripchart/public/components/d3/test/selection/select-test.js +69 -0
- data/lib/stripchart/public/components/d3/test/selection/selectAll-test.js +52 -0
- data/lib/stripchart/public/components/d3/test/selection/selection-select-test.js +128 -0
- data/lib/stripchart/public/components/d3/test/selection/selection-selectAll-test.js +131 -0
- data/lib/stripchart/public/components/d3/test/selection/selection-test.js +38 -0
- data/lib/stripchart/public/components/d3/test/selection/size-test.js +52 -0
- data/lib/stripchart/public/components/d3/test/selection/sort-test.js +81 -0
- data/lib/stripchart/public/components/d3/test/selection/style-test.js +129 -0
- data/lib/stripchart/public/components/d3/test/selection/text-test.js +115 -0
- data/lib/stripchart/public/components/d3/test/svg/arc-test.js +143 -0
- data/lib/stripchart/public/components/d3/test/svg/area-radial-test.js +199 -0
- data/lib/stripchart/public/components/d3/test/svg/area-test.js +192 -0
- data/lib/stripchart/public/components/d3/test/svg/axis-test.js +447 -0
- data/lib/stripchart/public/components/d3/test/svg/brush-test.js +96 -0
- data/lib/stripchart/public/components/d3/test/svg/diagonal-test.js +62 -0
- data/lib/stripchart/public/components/d3/test/svg/line-radial-test.js +120 -0
- data/lib/stripchart/public/components/d3/test/svg/line-test.js +207 -0
- data/lib/stripchart/public/components/d3/test/svg/symbol-test.js +91 -0
- data/lib/stripchart/public/components/d3/test/time/day-test.js +178 -0
- data/lib/stripchart/public/components/d3/test/time/dayOfYear-test.js +16 -0
- data/lib/stripchart/public/components/d3/test/time/days-test.js +95 -0
- data/lib/stripchart/public/components/d3/test/time/format-iso-test.js +33 -0
- data/lib/stripchart/public/components/d3/test/time/format-test.js +300 -0
- data/lib/stripchart/public/components/d3/test/time/format-utc-test.js +219 -0
- data/lib/stripchart/public/components/d3/test/time/hour-test.js +215 -0
- data/lib/stripchart/public/components/d3/test/time/hours-test.js +109 -0
- data/lib/stripchart/public/components/d3/test/time/minute-test.js +127 -0
- data/lib/stripchart/public/components/d3/test/time/minutes-test.js +91 -0
- data/lib/stripchart/public/components/d3/test/time/month-test.js +150 -0
- data/lib/stripchart/public/components/d3/test/time/months-test.js +95 -0
- data/lib/stripchart/public/components/d3/test/time/scale-test.js +585 -0
- data/lib/stripchart/public/components/d3/test/time/second-test.js +143 -0
- data/lib/stripchart/public/components/d3/test/time/seconds-test.js +91 -0
- data/lib/stripchart/public/components/d3/test/time/time.js +30 -0
- data/lib/stripchart/public/components/d3/test/time/week-test.js +162 -0
- data/lib/stripchart/public/components/d3/test/time/weeks-test.js +95 -0
- data/lib/stripchart/public/components/d3/test/time/year-test.js +137 -0
- data/lib/stripchart/public/components/d3/test/time/years-test.js +74 -0
- data/lib/stripchart/public/components/d3/test/transition/transition-test-attr.js +56 -0
- data/lib/stripchart/public/components/d3/test/transition/transition-test-attrTween.js +59 -0
- data/lib/stripchart/public/components/d3/test/transition/transition-test-call.js +30 -0
- data/lib/stripchart/public/components/d3/test/transition/transition-test-delay.js +56 -0
- data/lib/stripchart/public/components/d3/test/transition/transition-test-duration.js +60 -0
- data/lib/stripchart/public/components/d3/test/transition/transition-test-each.js +163 -0
- data/lib/stripchart/public/components/d3/test/transition/transition-test-filter.js +84 -0
- data/lib/stripchart/public/components/d3/test/transition/transition-test-id.js +22 -0
- data/lib/stripchart/public/components/d3/test/transition/transition-test-node.js +39 -0
- data/lib/stripchart/public/components/d3/test/transition/transition-test-remove.js +45 -0
- data/lib/stripchart/public/components/d3/test/transition/transition-test-select.js +60 -0
- data/lib/stripchart/public/components/d3/test/transition/transition-test-selectAll.js +56 -0
- data/lib/stripchart/public/components/d3/test/transition/transition-test-size.js +37 -0
- data/lib/stripchart/public/components/d3/test/transition/transition-test-style.js +51 -0
- data/lib/stripchart/public/components/d3/test/transition/transition-test-styleTween.js +65 -0
- data/lib/stripchart/public/components/d3/test/transition/transition-test-text.js +27 -0
- data/lib/stripchart/public/components/d3/test/transition/transition-test-time.js +38 -0
- data/lib/stripchart/public/components/d3/test/transition/transition-test-transition.js +59 -0
- data/lib/stripchart/public/components/d3/test/transition/transition-test-tween.js +62 -0
- data/lib/stripchart/public/components/d3/test/transition/transition-test.js +89 -0
- data/lib/stripchart/public/components/d3/test/xhr/html-test.js +37 -0
- data/lib/stripchart/public/components/d3/test/xhr/json-test.js +51 -0
- data/lib/stripchart/public/components/d3/test/xhr/text-test.js +46 -0
- data/lib/stripchart/public/components/d3/test/xhr/xhr-test.js +54 -0
- data/lib/stripchart/public/components/d3/test/xhr/xml-test.js +46 -0
- data/lib/stripchart/public/components/jquery/README.md +11 -0
- data/lib/stripchart/public/components/jquery/bower.json +11 -0
- data/lib/stripchart/public/components/jquery/component.json +23 -0
- data/lib/stripchart/public/components/jquery/composer.json +35 -0
- data/lib/stripchart/public/components/jquery/jquery-migrate.js +511 -0
- data/lib/stripchart/public/components/jquery/jquery-migrate.min.js +3 -0
- data/lib/stripchart/public/components/jquery/jquery.js +8829 -0
- data/lib/stripchart/public/components/jquery/jquery.min.js +6 -0
- data/lib/stripchart/public/components/jquery/jquery.min.map +1 -0
- data/lib/stripchart/public/components/jquery/package.json +7 -0
- data/lib/stripchart/version.rb +3 -0
- data/lib/stripchart/views/index.erb +19 -0
- data/lib/stripchart/web.rb +22 -0
- data/lib/stripchart/websocket.rb +22 -0
- metadata +602 -0
@@ -0,0 +1,35 @@
|
|
1
|
+
var vows = require("vows"),
|
2
|
+
load = require("../load"),
|
3
|
+
assert = require("../assert");
|
4
|
+
|
5
|
+
var suite = vows.describe("d3.geo.greatArc");
|
6
|
+
|
7
|
+
suite.addBatch({
|
8
|
+
"greatArc": {
|
9
|
+
topic: load("geo/greatArc").expression("d3.geo.greatArc"),
|
10
|
+
"distance": function(arc) {
|
11
|
+
var a = arc();
|
12
|
+
assert.equal(a.distance({source: [0, 0], target: [0, 0]}), 0);
|
13
|
+
assert.inDelta(a.distance({
|
14
|
+
source: [118 + 24 / 60, 33 + 57 / 60],
|
15
|
+
target: [ 73 + 47 / 60, 40 + 38 / 60]
|
16
|
+
}), 3973 / 6371, .5);
|
17
|
+
},
|
18
|
+
"source and target can be set as constants": function(arc) {
|
19
|
+
var a = arc().source([5, 52]).target([-120, 37]);
|
20
|
+
assert.inDelta(a().coordinates, [
|
21
|
+
[ 5, 52 ],
|
22
|
+
[-120, 37 ]
|
23
|
+
], .5);
|
24
|
+
},
|
25
|
+
"geodesic": function(arc) {
|
26
|
+
var a = arc();
|
27
|
+
assert.inDelta(a({source: [5, 52], target: [-120, 37]}).coordinates, [
|
28
|
+
[ 5, 52 ],
|
29
|
+
[-120, 37 ]
|
30
|
+
], .5);
|
31
|
+
}
|
32
|
+
}
|
33
|
+
});
|
34
|
+
|
35
|
+
suite.export(module);
|
@@ -0,0 +1,22 @@
|
|
1
|
+
var vows = require("vows"),
|
2
|
+
load = require("../load"),
|
3
|
+
assert = require("../assert");
|
4
|
+
|
5
|
+
var suite = vows.describe("d3.geo.interpolate");
|
6
|
+
|
7
|
+
suite.addBatch({
|
8
|
+
"interpolate": {
|
9
|
+
topic: load("geo/interpolate").expression("d3.geo.interpolate"),
|
10
|
+
"zero distance": function(interpolate) {
|
11
|
+
assert.deepEqual(interpolate([140.63289, -29.95101], [140.63289, -29.95101])(.5), [140.63289, -29.95101]);
|
12
|
+
},
|
13
|
+
"equator": function(interpolate) {
|
14
|
+
assert.inDelta(interpolate([10, 0], [20, 0])(.5), [15, 0], 1e-6);
|
15
|
+
},
|
16
|
+
"meridian": function(interpolate) {
|
17
|
+
assert.inDelta(interpolate([10, -20], [10, 40])(.5), [10, 10], 1e-6);
|
18
|
+
}
|
19
|
+
}
|
20
|
+
});
|
21
|
+
|
22
|
+
suite.export(module);
|
@@ -0,0 +1,44 @@
|
|
1
|
+
var vows = require("vows"),
|
2
|
+
load = require("../load"),
|
3
|
+
assert = require("assert");
|
4
|
+
|
5
|
+
var suite = vows.describe("d3.geo.length");
|
6
|
+
|
7
|
+
var π = Math.PI;
|
8
|
+
|
9
|
+
suite.addBatch({
|
10
|
+
"length": {
|
11
|
+
topic: load("geo/length").expression("d3.geo.length"),
|
12
|
+
"the length of points are zero": function(length) {
|
13
|
+
assert.inDelta(length({type: "Point", coordinates: [0, 0]}), 0, 1e-6);
|
14
|
+
assert.inDelta(length({type: "MultiPoint", coordinates: [[0, 1], [2, 3]]}), 0, 1e-6);
|
15
|
+
},
|
16
|
+
"the length of a line string is the sum of its great arc segments": function(length) {
|
17
|
+
assert.inDelta(length({type: "LineString", coordinates: [[-45, 0], [45, 0]]}), Math.PI / 2, 1e-6);
|
18
|
+
assert.inDelta(length({type: "LineString", coordinates: [[-45, 0], [-30, 0], [-15, 0], [0, 0]]}), Math.PI / 4, 1e-6);
|
19
|
+
assert.inDelta(length({type: "MultiLineString", coordinates: [[[-45, 0], [-30, 0]], [[-15, 0], [0, 0]]]}), Math.PI / 6, 1e-6);
|
20
|
+
},
|
21
|
+
"the length of a polygon is its perimeter": function(length) {
|
22
|
+
assert.inDelta(length({type: "Polygon", coordinates: [[[0, 0], [3, 0], [3, 3], [0, 3], [0, 0]]]}), 0.157008, 1e-6);
|
23
|
+
assert.inDelta(length({type: "MultiPolygon", coordinates: [[[[0, 0], [3, 0], [3, 3], [0, 3], [0, 0]]]]}), 0.157008, 1e-6);
|
24
|
+
assert.inDelta(length({type: "MultiPolygon", coordinates: [[[[0, 0], [3, 0], [3, 3], [0, 3], [0, 0]]], [[[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]]]]}), 0.209354, 1e-6);
|
25
|
+
},
|
26
|
+
"the length of a polygon is its perimeter, including holes": function(length) {
|
27
|
+
assert.inDelta(length({type: "Polygon", coordinates: [[[0, 0], [3, 0], [3, 3], [0, 3], [0, 0]], [[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]]]}), 0.209354, 1e-6);
|
28
|
+
},
|
29
|
+
"the length of a feature collection is the sum of its features": function(length) {
|
30
|
+
assert.inDelta(length({type: "FeatureCollection", features: [
|
31
|
+
{type: "Feature", geometry: {type: "LineString", coordinates: [[-45, 0], [0, 0]]}},
|
32
|
+
{type: "Feature", geometry: {type: "LineString", coordinates: [[0, 0], [45, 0]]}}
|
33
|
+
]}), Math.PI / 2, 1e-6);
|
34
|
+
},
|
35
|
+
"the length of a geometry collection is the sum of its geometries": function(length) {
|
36
|
+
assert.inDelta(length({type: "GeometryCollection", geometries: [
|
37
|
+
{type: "GeometryCollection", geometries: [{type: "LineString", coordinates: [[-45, 0], [0, 0]]}]},
|
38
|
+
{type: "LineString", coordinates: [[0, 0], [45, 0]]}
|
39
|
+
]}), Math.PI / 2, 1e-6);
|
40
|
+
}
|
41
|
+
}
|
42
|
+
});
|
43
|
+
|
44
|
+
suite.export(module);
|
@@ -0,0 +1,38 @@
|
|
1
|
+
var vows = require("vows"),
|
2
|
+
load = require("../load"),
|
3
|
+
assert = require("../assert"),
|
4
|
+
projectionTestSuite = require("./projection-test-suite");
|
5
|
+
|
6
|
+
var suite = vows.describe("d3.geo.mercator");
|
7
|
+
|
8
|
+
suite.addBatch({
|
9
|
+
"mercator": {
|
10
|
+
topic: load("geo/mercator").expression("d3.geo.mercator"),
|
11
|
+
"default": projectionTestSuite({
|
12
|
+
topic: function(projection) { return projection(); }
|
13
|
+
}, {
|
14
|
+
"Null Island": [[ 0.00000000, 0.00000000], [ 480.00000000, 250.00000000]],
|
15
|
+
"Honolulu, HI": [[ -21.01262744, 82.63349103], [ 424.98907000, -161.45770791]],
|
16
|
+
"San Francisco, CA": [[ -46.16620803, 77.04946507], [ 359.13715001, -76.39503103]],
|
17
|
+
"Svalbard": [[ 3.13977663, 61.55241523], [ 488.21991600, 44.12991498]],
|
18
|
+
"Tierra del Fuego": [[ -35.62300462, -60.29317484], [ 386.73919199, 449.08559401]],
|
19
|
+
"Tokyo": [[ 33.38709832, 79.49539834], [ 567.40721901, -108.01311493]],
|
20
|
+
"west antimeridian": [[-180.00000000, 0.00000000], [ 8.76110196, 250.00000000]],
|
21
|
+
"east antimeridian": [[ 180.00000000, 0.00000000], [ 951.23889804, 250.00000000]]
|
22
|
+
}),
|
23
|
+
"translated to 0,0 and at scale 1": projectionTestSuite({
|
24
|
+
topic: function(projection) { return projection().translate([0, 0]).scale(1); }
|
25
|
+
}, {
|
26
|
+
"Null Island": [[ 0.00000000, 0.00000000], [ 0.00000000, 0.00000000]],
|
27
|
+
"Honolulu, HI": [[ -21.01262725, 82.63349099], [ -0.36673953, -2.74305138]],
|
28
|
+
"San Francisco, CA": [[ -46.16620841, 77.04946502], [ -0.80575234, -2.17596687]],
|
29
|
+
"Svalbard": [[ 3.13977663, 61.55241514], [ 0.05479944, -1.37246723]],
|
30
|
+
"Tierra del Fuego": [[ -35.62300462, -60.29317474], [ -0.62173872, 1.32723729]],
|
31
|
+
"Tokyo": [[ 33.38709813, 79.49539834], [ 0.58271479, -2.38675410]],
|
32
|
+
"west antimeridian": [[-180.00000000, 0.00000000], [ -3.14159265, 0.00000000]],
|
33
|
+
"east antimeridian": [[ 180.00000000, 0.00000000], [ 3.14159265, 0.00000000]]
|
34
|
+
})
|
35
|
+
}
|
36
|
+
});
|
37
|
+
|
38
|
+
suite.export(module);
|
@@ -0,0 +1,34 @@
|
|
1
|
+
var vows = require("vows"),
|
2
|
+
assert = require("../assert"),
|
3
|
+
load = require("../load"),
|
4
|
+
projectionTestSuite = require("./projection-test-suite");
|
5
|
+
|
6
|
+
var suite = vows.describe("d3.geo.orthographic");
|
7
|
+
|
8
|
+
suite.addBatch({
|
9
|
+
"orthographic": {
|
10
|
+
topic: load("geo/orthographic").expression("d3.geo.orthographic"),
|
11
|
+
"default": projectionTestSuite(function(projection) { return projection(); }, {
|
12
|
+
"Null Island": [[ 0.00000000, 0.00000000], [ 480.00000000, 250.00000000]],
|
13
|
+
"Honolulu, HI": [[ -21.01262744, 82.63349103], [ 473.10377192, 101.23805835]],
|
14
|
+
"San Francisco, CA": [[ -46.16620803, 77.04946507], [ 455.75069916, 103.81541376]],
|
15
|
+
"Svalbard": [[ 3.13977663, 61.55241523], [ 483.91363537, 118.11201123]],
|
16
|
+
"Tierra del Fuego": [[ -35.62300462, -60.29317484], [ 436.70402041, 380.28587327]],
|
17
|
+
"Tokyo": [[ 33.38709832, 79.49539834], [ 495.04895132, 102.51395975]],
|
18
|
+
"the South Pole": [[ 0.00000000, -85.00000000], [ 480.00000000, 399.42920471]],
|
19
|
+
"the North Pole": [[ 0.00000000, 85.00000000], [ 480.00000000, 100.57079529]]
|
20
|
+
}),
|
21
|
+
"translated to 0,0 and at scale 1": projectionTestSuite(function(projection) { return projection().translate([0, 0]).scale(1); }, {
|
22
|
+
"Null Island": [[ 0.00000000, 0.00000000], [ 0.00000000, 0.00000000]],
|
23
|
+
"Honolulu, HI": [[ -21.01262744, 82.63349120], [ -0.04597485, -0.99174628]],
|
24
|
+
"San Francisco, CA": [[ -46.16620803, 77.04946507], [ -0.16166201, -0.97456391]],
|
25
|
+
"Svalbard": [[ 3.13977663, 61.55241523], [ 0.02609090, -0.87925326]],
|
26
|
+
"Tierra del Fuego": [[ -35.62300462, -60.29317484], [ -0.28863986, 0.86857249]],
|
27
|
+
"Tokyo": [[ 33.38709832, 79.49539834], [ 0.10032634, -0.98324027]],
|
28
|
+
"the South Pole": [[ 0.00000000, -85.00000000], [ 0.00000000, 0.99619470]],
|
29
|
+
"the North Pole": [[ 0.00000000, 85.00000000], [ 0.00000000, -0.99619470]]
|
30
|
+
})
|
31
|
+
}
|
32
|
+
});
|
33
|
+
|
34
|
+
suite.export(module);
|
@@ -0,0 +1,832 @@
|
|
1
|
+
var vows = require("vows"),
|
2
|
+
_ = require("../../"),
|
3
|
+
load = require("../load"),
|
4
|
+
assert = require("../assert");
|
5
|
+
|
6
|
+
var suite = vows.describe("d3.geo.path");
|
7
|
+
|
8
|
+
suite.addBatch({
|
9
|
+
"path": {
|
10
|
+
topic: load("geo/path").expression("d3.geo.path"),
|
11
|
+
|
12
|
+
"with an equirectangular projection": {
|
13
|
+
topic: function(path) {
|
14
|
+
return path()
|
15
|
+
.context(testContext)
|
16
|
+
.projection(_.geo.equirectangular()
|
17
|
+
.scale(900 / Math.PI)
|
18
|
+
.precision(0));
|
19
|
+
},
|
20
|
+
|
21
|
+
"renders a point": function(p) {
|
22
|
+
p({
|
23
|
+
type: "Point",
|
24
|
+
coordinates: [-63, 18]
|
25
|
+
});
|
26
|
+
assert.deepEqual(testContext.buffer(), [
|
27
|
+
{type: "moveTo", x: 165, y: 160},
|
28
|
+
{type: "arc", x: 165, y: 160, r: 4.5}
|
29
|
+
]);
|
30
|
+
},
|
31
|
+
|
32
|
+
"renders a multipoint": function(p) {
|
33
|
+
p({
|
34
|
+
type: "MultiPoint",
|
35
|
+
coordinates: [[-63, 18], [-62, 18], [-62, 17]]
|
36
|
+
});
|
37
|
+
assert.deepEqual(testContext.buffer(), [
|
38
|
+
{type: "moveTo", x: 165, y: 160}, {type: "arc", x: 165, y: 160, r: 4.5},
|
39
|
+
{type: "moveTo", x: 170, y: 160}, {type: "arc", x: 170, y: 160, r: 4.5},
|
40
|
+
{type: "moveTo", x: 170, y: 165}, {type: "arc", x: 170, y: 165, r: 4.5}
|
41
|
+
]);
|
42
|
+
},
|
43
|
+
|
44
|
+
"renders a line string": function(p) {
|
45
|
+
p({
|
46
|
+
type: "Feature",
|
47
|
+
geometry: {
|
48
|
+
type: "LineString",
|
49
|
+
coordinates: [[-63, 18], [-62, 18], [-62, 17]]
|
50
|
+
}
|
51
|
+
});
|
52
|
+
assert.deepEqual(testContext.buffer(), [
|
53
|
+
{type: "moveTo", x: 165, y: 160},
|
54
|
+
{type: "lineTo", x: 170, y: 160},
|
55
|
+
{type: "lineTo", x: 170, y: 165}
|
56
|
+
]);
|
57
|
+
},
|
58
|
+
|
59
|
+
"renders a polygon": function(p) {
|
60
|
+
p({
|
61
|
+
type: "Feature",
|
62
|
+
geometry: {
|
63
|
+
type: "Polygon",
|
64
|
+
coordinates: [[[-63, 18], [-62, 18], [-62, 17], [-63, 18]]]
|
65
|
+
}
|
66
|
+
});
|
67
|
+
assert.deepEqual(testContext.buffer(), [
|
68
|
+
{type: "moveTo", x: 165, y: 160},
|
69
|
+
{type: "lineTo", x: 170, y: 160},
|
70
|
+
{type: "lineTo", x: 170, y: 165},
|
71
|
+
{type: "closePath"}
|
72
|
+
]);
|
73
|
+
},
|
74
|
+
|
75
|
+
"renders a geometry collection": function(p) {
|
76
|
+
p({
|
77
|
+
type: "GeometryCollection",
|
78
|
+
geometries: [{type: "Point", coordinates: [0, 0]}]
|
79
|
+
});
|
80
|
+
assert.deepEqual(testContext.buffer(), [
|
81
|
+
{type: "moveTo", x: 480, y: 250}, {type: "arc", x: 480, y: 250, r: 4.5}
|
82
|
+
]);
|
83
|
+
},
|
84
|
+
|
85
|
+
"renders a feature collection": function(p) {
|
86
|
+
p({
|
87
|
+
type: "FeatureCollection",
|
88
|
+
features: [{type: "Feature", geometry: {type: "Point", coordinates: [0, 0]}}]
|
89
|
+
});
|
90
|
+
assert.deepEqual(testContext.buffer(), [
|
91
|
+
{type: "moveTo", x: 480, y: 250}, {type: "arc", x: 480, y: 250, r: 4.5}
|
92
|
+
]);
|
93
|
+
},
|
94
|
+
|
95
|
+
"longitudes wrap at ±180°": function(p) {
|
96
|
+
p({type: "Point", coordinates: [180 + 1e-6, 0]});
|
97
|
+
assert.deepEqual(testContext.buffer(), [{type: "moveTo", x: -420, y: 250}, {type: "arc", x: -420, y: 250, r: 4.5}]);
|
98
|
+
},
|
99
|
+
|
100
|
+
"observes the correct winding order of a tiny polygon": function(p) {
|
101
|
+
p({type: "Polygon", coordinates: [[
|
102
|
+
[-0.06904102953339501, 0.346043661846373],
|
103
|
+
[-6.725674252975136e-15, 0.3981303360336475],
|
104
|
+
[-6.742247658534323e-15, -0.08812465346531581],
|
105
|
+
[-0.17301258217724075, -0.12278150669440671],
|
106
|
+
[-0.06904102953339501, 0.346043661846373]]]});
|
107
|
+
assert.equal(testContext.buffer().filter(function(d) { return d.type === "moveTo"; }).length, 1);
|
108
|
+
},
|
109
|
+
|
110
|
+
"area": {
|
111
|
+
topic: function(p) {
|
112
|
+
return p.area;
|
113
|
+
},
|
114
|
+
"of a polygon with no holes": function(area) {
|
115
|
+
assert.strictEqual(area({type: "Polygon", coordinates: [[[100, 0], [100, 1], [101, 1], [101, 0], [100, 0]]]}), 25);
|
116
|
+
},
|
117
|
+
"of a polygon with holes": function(area) {
|
118
|
+
assert.strictEqual(area({type: "Polygon", coordinates: [[[100, 0], [100, 1], [101, 1], [101, 0], [100, 0]], [[100.2, .2], [100.8, .2], [100.8, .8], [100.2, .8], [100.2, .2]]]}), 16);
|
119
|
+
},
|
120
|
+
"area of a Sphere": function(area) {
|
121
|
+
assert.strictEqual(area({type: "Sphere"}), 1620000);
|
122
|
+
}
|
123
|
+
},
|
124
|
+
|
125
|
+
"centroid": {
|
126
|
+
topic: function(p) {
|
127
|
+
return p.centroid;
|
128
|
+
},
|
129
|
+
"of a point": function(centroid) {
|
130
|
+
assert.deepEqual(centroid({type: "Point", coordinates: [0, 0]}), [480, 250]);
|
131
|
+
},
|
132
|
+
"of an empty multipoint": function(centroid) {
|
133
|
+
assert.ok(centroid({type: "MultiPoint", coordinates: []}).every(isNaN));
|
134
|
+
},
|
135
|
+
"of a singleton multipoint": function(centroid) {
|
136
|
+
assert.deepEqual(centroid({type: "MultiPoint", coordinates: [[0, 0]]}), [480, 250]);
|
137
|
+
},
|
138
|
+
"of a multipoint with two points": function(centroid) {
|
139
|
+
assert.deepEqual(centroid({type: "MultiPoint", coordinates: [[-122, 37], [-74, 40]]}), [-10, 57.5]);
|
140
|
+
},
|
141
|
+
"of an empty linestring": function(centroid) {
|
142
|
+
assert.ok(centroid({type: "LineString", coordinates: []}).every(isNaN));
|
143
|
+
},
|
144
|
+
"of a linestring with two points": function(centroid) {
|
145
|
+
assert.deepEqual(centroid({type: "LineString", coordinates: [[100, 0], [0, 0]]}), [730, 250]);
|
146
|
+
assert.deepEqual(centroid({type: "LineString", coordinates: [[0, 0], [100, 0], [101, 0]]}), [732.5, 250]);
|
147
|
+
},
|
148
|
+
"of a linestring with two points, one unique": function(centroid) {
|
149
|
+
assert.deepEqual(centroid({type: "LineString", coordinates: [[-122, 37], [-122, 37]]}), [-130, 65]);
|
150
|
+
assert.deepEqual(centroid({type: "LineString", coordinates: [[-74, 40], [-74, 40]]}), [110, 50]);
|
151
|
+
},
|
152
|
+
"of a linestring with three points; two unique": function(centroid) {
|
153
|
+
assert.deepEqual(centroid({type: "LineString", coordinates: [[-122, 37], [-74, 40], [-74, 40]]}), [-10, 57.5]);
|
154
|
+
},
|
155
|
+
"of a linestring with three points": function(centroid) {
|
156
|
+
assert.inDelta(centroid({type: "LineString", coordinates: [[-122, 37], [-74, 40], [-100, 0]]}), [17.389135, 103.563545], 1e-6);
|
157
|
+
},
|
158
|
+
"of a multilinestring": function(centroid) {
|
159
|
+
assert.deepEqual(centroid({type: "MultiLineString", coordinates: [[[100, 0], [0, 0]], [[-10, 0], [0, 0]]]}), [705, 250]);
|
160
|
+
},
|
161
|
+
"of a single-ring polygon": function(centroid) {
|
162
|
+
assert.deepEqual(centroid({type: "Polygon", coordinates: [[[100, 0], [100, 1], [101, 1], [101, 0], [100, 0]]]}), [982.5, 247.5]);
|
163
|
+
},
|
164
|
+
"of a zero-area polygon": function(centroid) {
|
165
|
+
assert.deepEqual(centroid({type: "Polygon", coordinates: [[[1, 0], [2, 0], [3, 0], [1, 0]]]}), [490, 250]);
|
166
|
+
},
|
167
|
+
"of a polygon with two rings, one with zero area": function(centroid) {
|
168
|
+
assert.deepEqual(centroid({type: "Polygon", coordinates: [
|
169
|
+
[[100, 0], [100, 1], [101, 1], [101, 0], [100, 0]],
|
170
|
+
[[100.1, 0], [100.2, 0], [100.3, 0], [100.1, 0]
|
171
|
+
]]}), [982.5, 247.5]);
|
172
|
+
},
|
173
|
+
"of a polygon with clockwise exterior and anticlockwise interior": function(centroid) {
|
174
|
+
assert.inDelta(centroid({
|
175
|
+
type: "Polygon",
|
176
|
+
coordinates: [
|
177
|
+
[[-2, -2], [2, -2], [2, 2], [-2, 2], [-2, -2]].reverse(),
|
178
|
+
[[ 0, -1], [1, -1], [1, 1], [ 0, 1], [ 0, -1]]
|
179
|
+
]
|
180
|
+
}), [479.642857, 250], 1e-6);
|
181
|
+
},
|
182
|
+
"of an empty multipolygon": function(centroid) {
|
183
|
+
assert.ok(centroid({type: "MultiPolygon", coordinates: []}).every(isNaN));
|
184
|
+
},
|
185
|
+
"of a singleton multipolygon": function(centroid) {
|
186
|
+
assert.deepEqual(centroid({type: "MultiPolygon", coordinates: [[[[100, 0], [100, 1], [101, 1], [101, 0], [100, 0]]]]}), [982.5, 247.5]);
|
187
|
+
},
|
188
|
+
"of a multipolygon with two polygons": function(centroid) {
|
189
|
+
assert.deepEqual(centroid({type: "MultiPolygon", coordinates: [
|
190
|
+
[[[100, 0], [100, 1], [101, 1], [101, 0], [100, 0]]],
|
191
|
+
[[[0, 0], [1, 0], [1, -1], [0, -1], [0, 0]]]
|
192
|
+
]}), [732.5, 250]);
|
193
|
+
},
|
194
|
+
"of a multipolygon with two polygons, one zero area": function(centroid) {
|
195
|
+
assert.deepEqual(centroid({type: "MultiPolygon", coordinates: [
|
196
|
+
[[[100, 0], [100, 1], [101, 1], [101, 0], [100, 0]]],
|
197
|
+
[[[0, 0], [1, 0], [2, 0], [0, 0]]]
|
198
|
+
]}), [982.5, 247.5]);
|
199
|
+
},
|
200
|
+
"of a geometry collection with a single point": function(centroid) {
|
201
|
+
assert.deepEqual(centroid({type: "GeometryCollection", geometries: [{type: "Point", coordinates: [0, 0]}]}), [480, 250]);
|
202
|
+
},
|
203
|
+
"of a geometry collection with a point and a linestring": function(centroid) {
|
204
|
+
assert.deepEqual(centroid({type: "GeometryCollection", geometries: [
|
205
|
+
{type: "LineString", coordinates: [[179, 0], [180, 0]]},
|
206
|
+
{type: "Point", coordinates: [0, 0]}
|
207
|
+
]}), [1377.5, 250]);
|
208
|
+
},
|
209
|
+
"of a geometry collection with a point, linestring and polygon": function(centroid) {
|
210
|
+
assert.deepEqual(centroid({type: "GeometryCollection", geometries: [
|
211
|
+
{type: "Polygon", coordinates: [[[-180, 0], [-180, 1], [-179, 1], [-179, 0], [-180, 0]]]},
|
212
|
+
{type: "LineString", coordinates: [[179, 0], [180, 0]]},
|
213
|
+
{type: "Point", coordinates: [0, 0]}
|
214
|
+
]}), [-417.5, 247.5]);
|
215
|
+
},
|
216
|
+
"of a feature collection with a point": function(centroid) {
|
217
|
+
assert.deepEqual(centroid({type: "FeatureCollection", features: [{type: "Feature", geometry: {type: "Point", coordinates: [0, 0]}}]}), [480, 250]);
|
218
|
+
},
|
219
|
+
"of a feature collection with a point and a line string": function(centroid) {
|
220
|
+
assert.deepEqual(centroid({type: "FeatureCollection", features: [
|
221
|
+
{type: "Feature", geometry: {type: "LineString", coordinates: [[179, 0], [180, 0]]}},
|
222
|
+
{type: "Feature", geometry: {type: "Point", coordinates: [0, 0]}}
|
223
|
+
]}), [1377.5, 250]);
|
224
|
+
},
|
225
|
+
"of a feature collection with a point, line string and polygon": function(centroid) {
|
226
|
+
assert.deepEqual(centroid({type: "FeatureCollection", features: [
|
227
|
+
{type: "Feature", geometry: {type: "Polygon", coordinates: [[[-180, 0], [-180, 1], [-179, 1], [-179, 0], [-180, 0]]]}},
|
228
|
+
{type: "Feature", geometry: {type: "LineString", coordinates: [[179, 0], [180, 0]]}},
|
229
|
+
{type: "Feature", geometry: {type: "Point", coordinates: [0, 0]}}
|
230
|
+
]}), [-417.5, 247.5]);
|
231
|
+
},
|
232
|
+
"of a sphere": function(centroid) {
|
233
|
+
assert.deepEqual(centroid({type: "Sphere"}), [480, 250]);
|
234
|
+
}
|
235
|
+
}
|
236
|
+
},
|
237
|
+
|
238
|
+
"with a null (identity) projection": {
|
239
|
+
topic: function(path) {
|
240
|
+
return path()
|
241
|
+
.context(testContext)
|
242
|
+
.projection(null);
|
243
|
+
},
|
244
|
+
"renders a Polygon": function(p) {
|
245
|
+
p({
|
246
|
+
type: "Feature",
|
247
|
+
geometry: {
|
248
|
+
type: "Polygon",
|
249
|
+
coordinates: [[[-63, 18], [-62, 18], [-62, 17], [-63, 18]]]
|
250
|
+
}
|
251
|
+
});
|
252
|
+
assert.deepEqual(testContext.buffer(), [
|
253
|
+
{type: "moveTo", x: -63, y: 18},
|
254
|
+
{type: "lineTo", x: -62, y: 18},
|
255
|
+
{type: "lineTo", x: -62, y: 17},
|
256
|
+
{type: "closePath"}
|
257
|
+
]);
|
258
|
+
}
|
259
|
+
},
|
260
|
+
|
261
|
+
"with the default context (null) and an identity projection": {
|
262
|
+
topic: function(path) {
|
263
|
+
return path()
|
264
|
+
.projection(_.geo.equirectangular()
|
265
|
+
.scale(900 / Math.PI)
|
266
|
+
.precision(0));
|
267
|
+
},
|
268
|
+
"returns null when passed null or undefined": function(p) {
|
269
|
+
assert.equal(p(null), null);
|
270
|
+
assert.equal(p(undefined), null);
|
271
|
+
assert.equal(p(), null);
|
272
|
+
},
|
273
|
+
"returns null with bogus type name": function(p) {
|
274
|
+
assert.equal(p({
|
275
|
+
type: "Feature",
|
276
|
+
geometry: {
|
277
|
+
type: "__proto__",
|
278
|
+
coordinates: [[[-63.03, 18.02], [-63.14, 18.06], [-63.01, 18.07], [-63.03, 18.02]]]
|
279
|
+
}
|
280
|
+
}), null);
|
281
|
+
}
|
282
|
+
},
|
283
|
+
|
284
|
+
"with the default context (null) and default projection (albers-usa)": {
|
285
|
+
topic: function(path) {
|
286
|
+
return path();
|
287
|
+
},
|
288
|
+
"area of a polygon": function(p) {
|
289
|
+
var area = p.area({type: "Polygon", coordinates: [[[-122, 37], [-71, 42], [-80, 25], [-122, 37]]]});
|
290
|
+
assert.inDelta(area, 124884.274, 1e-3);
|
291
|
+
},
|
292
|
+
"bounds of a line string": function(p) {
|
293
|
+
assert.inDelta(p.bounds({type: "LineString", coordinates: [[-122, 37], [-74, 40], [-100, 0]]}),
|
294
|
+
[[109.378, 189.584], [797.758, 504.660]], 1e-3);
|
295
|
+
},
|
296
|
+
"centroid of a line string": function(p) {
|
297
|
+
assert.inDelta(p.centroid({type: "LineString", coordinates: [[-122, 37], [-74, 40], [-100, 0]]}), [545.131, 253.860], 1e-3);
|
298
|
+
}
|
299
|
+
},
|
300
|
+
|
301
|
+
"with an equirectangular projection rotated by [180, -248]": {
|
302
|
+
topic: function(path) {
|
303
|
+
return path()
|
304
|
+
.context(testContext)
|
305
|
+
.projection(_.geo.equirectangular()
|
306
|
+
.rotate([-180, -248])
|
307
|
+
.scale(900 / Math.PI)
|
308
|
+
.precision(0));
|
309
|
+
},
|
310
|
+
"renders a polygon": function(p) {
|
311
|
+
p({type: "Polygon", coordinates: [[[-175.03150315031502, 66.57410661866186], [-174.34743474347434, 66.33097912391239], [-174.5994599459946, 67.0603616081608], [-171.86318631863185, 66.90406536153614], [-169.9189918991899, 65.96628788178816], [-170.89108910891088, 65.53213164116411], [-172.54725472547256, 65.42793414341432], [-172.5832583258326, 64.45542416441643], [-172.97929792979298, 64.2470291689169], [-173.91539153915392, 64.28176166816681], [-174.67146714671466, 64.62908666066605], [-176.003600360036, 64.90694665466546], [-176.21962196219621, 65.34110289528951], [-177.22772277227722, 65.51476539153916], [-178.37983798379838, 65.37583539453945], [-178.91989198919893, 65.72316038703869], [-178.7038703870387, 66.10521787878787], [-179.8919891989199, 65.8620903840384], [-179.45994599459945, 65.3932016441644], [-180, 64.97641165316531], [-180, 68.95328281728172], [-177.55175517551754, 68.18916783378336], [-174.95949594959495, 67.19929160516051], [-175.03150315031502, 66.57410661866186]]]});
|
312
|
+
assert.deepEqual(testContext.buffer().filter(function(d) { return d.type === "moveTo"; }), [{type: "moveTo", x: 1370, y: 243}]);
|
313
|
+
}
|
314
|
+
},
|
315
|
+
|
316
|
+
"projection": {
|
317
|
+
"returns the current projection when called with no arguments": function(path) {
|
318
|
+
var p = path(), projection = _.geo.equirectangular();
|
319
|
+
p.projection(projection);
|
320
|
+
assert.strictEqual(p.projection(), projection);
|
321
|
+
}
|
322
|
+
},
|
323
|
+
|
324
|
+
"pointRadius": {
|
325
|
+
"returns the current point radius when called with no arguments": function(path) {
|
326
|
+
var p = path(), radius = function() { return 5; };
|
327
|
+
assert.strictEqual(p.pointRadius(), 4.5);
|
328
|
+
assert.strictEqual(p.pointRadius(radius).pointRadius(), radius);
|
329
|
+
},
|
330
|
+
"coerces point radius to a number": {
|
331
|
+
"when the radius is specified as a constant": function(path) {
|
332
|
+
var p = path().projection(null).context(testContext).pointRadius("6");
|
333
|
+
assert.strictEqual(p.pointRadius(), 6);
|
334
|
+
p({type: "Point", coordinates: [0, 0]});
|
335
|
+
assert.strictEqual(testContext.buffer().filter(function(d) { return d.type === "arc"; })[0].r, 6);
|
336
|
+
},
|
337
|
+
"when the radius is specified as a function": function(path) {
|
338
|
+
var p = path().projection(null).context(testContext).pointRadius(function() { return "6"; });
|
339
|
+
p({type: "Point", coordinates: [0, 0]});
|
340
|
+
assert.strictEqual(testContext.buffer().filter(function(d) { return d.type === "arc"; })[0].r, 6);
|
341
|
+
}
|
342
|
+
}
|
343
|
+
},
|
344
|
+
|
345
|
+
"with an equirectangular projection clipped to 90°": {
|
346
|
+
topic: function(path) {
|
347
|
+
return path()
|
348
|
+
.context(testContext)
|
349
|
+
.projection(_.geo.equirectangular()
|
350
|
+
.scale(900 / Math.PI)
|
351
|
+
.precision(0)
|
352
|
+
.clipAngle(90));
|
353
|
+
},
|
354
|
+
"renders a point": function(p) {
|
355
|
+
p({
|
356
|
+
type: "Point",
|
357
|
+
coordinates: [-63, 18]
|
358
|
+
});
|
359
|
+
assert.deepEqual(testContext.buffer(), [
|
360
|
+
{type: "moveTo", x: 165, y: 160}, {type: "arc", x: 165, y: 160, r: 4.5}
|
361
|
+
]);
|
362
|
+
},
|
363
|
+
"renders a multipoint": function(p) {
|
364
|
+
p({
|
365
|
+
type: "MultiPoint",
|
366
|
+
coordinates: [[-63, 18], [-62, 18], [-62, 17]]
|
367
|
+
});
|
368
|
+
assert.deepEqual(testContext.buffer(), [
|
369
|
+
{type: "moveTo", x: 165, y: 160}, {type: "arc", x: 165, y: 160, r: 4.5},
|
370
|
+
{type: "moveTo", x: 170, y: 160}, {type: "arc", x: 170, y: 160, r: 4.5},
|
371
|
+
{type: "moveTo", x: 170, y: 165}, {type: "arc", x: 170, y: 165, r: 4.5}
|
372
|
+
]);
|
373
|
+
},
|
374
|
+
"inserts exterior along clip edge if polygon interior surrounds it": function(p) {
|
375
|
+
p({type: "Polygon", coordinates: [[[80, -80], [80, 80], [-80, 80], [-80, -80], [80, -80]]]});
|
376
|
+
assert.equal(testContext.buffer().filter(function(d) { return d.type === "moveTo"; }).length, 2);
|
377
|
+
},
|
378
|
+
"inserts exterior along clip edge if polygon exterior surrounds it": function(p) {
|
379
|
+
p({type: "Polygon", coordinates: [[[100, -80], [-100, -80], [-100, 80], [100, 80], [100, -80]]]});
|
380
|
+
assert.equal(testContext.buffer().filter(function(d) { return d.type === "moveTo"; }).length, 1);
|
381
|
+
},
|
382
|
+
"renders a small circle of 60°": function(p) {
|
383
|
+
p(_.geo.circle().angle(60)());
|
384
|
+
assert.deepEqual(testContext.buffer().filter(function(d) { return d.type === "moveTo"; }), [{type: "moveTo", x: 276, y: 493}]);
|
385
|
+
},
|
386
|
+
"renders a small circle of 120°": function(p) {
|
387
|
+
p(_.geo.circle().angle(120)());
|
388
|
+
assert.deepEqual(testContext.buffer().filter(function(d) { return d.type === "moveTo"; }), [{type: "moveTo", x: 87, y: 700}]);
|
389
|
+
}
|
390
|
+
},
|
391
|
+
|
392
|
+
"with an equirectangular projection clipped to 90° and rotated by [-17°, -451°]": {
|
393
|
+
"renders a polygon": function(path) {
|
394
|
+
var pole = _.range(-180, 180, 10).map(function(x) { return [x, 70]; });
|
395
|
+
pole.push(pole[0]);
|
396
|
+
path()
|
397
|
+
.context(testContext)
|
398
|
+
.projection(_.geo.equirectangular()
|
399
|
+
.rotate([-17, -451])
|
400
|
+
.scale(900 / Math.PI)
|
401
|
+
.precision(0)
|
402
|
+
.clipAngle(90))({type: "Polygon", coordinates: [pole]});
|
403
|
+
assert.deepEqual(testContext.buffer().filter(function(d) { return d.type === "moveTo"; }), [
|
404
|
+
{type: "moveTo", x: 510, y: 160},
|
405
|
+
{type: "moveTo", x: 87, y: 700}
|
406
|
+
]);
|
407
|
+
}
|
408
|
+
},
|
409
|
+
|
410
|
+
"with an equirectangular projection clipped to 90° and rotated by [71.03°, 42.37°]": {
|
411
|
+
topic: function(path) {
|
412
|
+
return path()
|
413
|
+
.context(testContext)
|
414
|
+
.projection(_.geo.equirectangular()
|
415
|
+
.rotate([71.03, 42.37])
|
416
|
+
.scale(900 / Math.PI)
|
417
|
+
.precision(0)
|
418
|
+
.clipAngle(90));
|
419
|
+
},
|
420
|
+
/*
|
421
|
+
"grid component": function(path) {
|
422
|
+
var yStepsBig = _.range(-90, 90, 10);
|
423
|
+
path({type: "LineString", coordinates: yStepsBig.map(function(y) { return [110, y]; })});
|
424
|
+
assert.inDelta(testContext.buffer(), [[
|
425
|
+
[109.538009, -90],
|
426
|
+
[110, -80],
|
427
|
+
[110, -70],
|
428
|
+
[110, -60],
|
429
|
+
[110, -50],
|
430
|
+
[110, -47.625390]
|
431
|
+
]], 1e-6);
|
432
|
+
},
|
433
|
+
*/
|
434
|
+
"can completely clip a LineString": function(p) {
|
435
|
+
p({type: "LineString", coordinates: [[90.0, -42.37], [95.0, -42.37], [90.0, -42.37]]});
|
436
|
+
assert.deepEqual(testContext.buffer(), []);
|
437
|
+
},
|
438
|
+
"doesn't insert a duplicate point": function(p) {
|
439
|
+
p({type: "LineString", coordinates: [[0, 0]]});
|
440
|
+
assert.deepEqual(testContext.buffer(), [{type: "moveTo", x: 859, y: 187}]);
|
441
|
+
},
|
442
|
+
"renders a visible point": function(p) {
|
443
|
+
p({type: "Point", coordinates: [0, 0]});
|
444
|
+
assert.deepEqual(testContext.buffer(), [{type: "moveTo", x: 859, y: 187}, {type: "arc", x: 859, y: 187, r: 4.5}]);
|
445
|
+
},
|
446
|
+
"does not render an invisible point": function(p) {
|
447
|
+
p({type: "Point", coordinates: [-180, 0]});
|
448
|
+
assert.deepEqual(testContext.buffer(), []);
|
449
|
+
},
|
450
|
+
"renders a multipoint": function(p) {
|
451
|
+
p({type: "MultiPoint", coordinates: [[0, 0], [-180, 0]]});
|
452
|
+
assert.deepEqual(testContext.buffer(), [{type: "moveTo", x: 859, y: 187}, {type: "arc", x: 859, y: 187, r: 4.5}]);
|
453
|
+
}
|
454
|
+
},
|
455
|
+
|
456
|
+
"with an equirectangular projection clipped to 90° and rotated by [-24°, -175.5°]": {
|
457
|
+
topic: function(path) {
|
458
|
+
return path()
|
459
|
+
.context(testContext)
|
460
|
+
.projection(_.geo.equirectangular()
|
461
|
+
.rotate([-24, -175.5])
|
462
|
+
.scale(900 / Math.PI)
|
463
|
+
.precision(0)
|
464
|
+
.clipAngle(90));
|
465
|
+
},
|
466
|
+
"renders Antarctica with no gaps": function(p) {
|
467
|
+
p(antarctica);
|
468
|
+
assert.equal(testContext.buffer().filter(function(d) { return d.type === "moveTo"; }).length, 2);
|
469
|
+
}
|
470
|
+
},
|
471
|
+
|
472
|
+
"with an equirectangular projection clipped to 90° and rotated by [90°, 0°]": {
|
473
|
+
topic: function(path) {
|
474
|
+
return path()
|
475
|
+
.context(testContext)
|
476
|
+
.projection(_.geo.equirectangular()
|
477
|
+
.rotate([90, 0])
|
478
|
+
.scale(900 / Math.PI)
|
479
|
+
.precision(0)
|
480
|
+
.clipAngle(90));
|
481
|
+
},
|
482
|
+
"renders a small circle of 60°": function(p) {
|
483
|
+
p(_.geo.circle().angle(60)());
|
484
|
+
assert.deepEqual(testContext.buffer().filter(function(d) { return d.type === "moveTo"; }), [{type: "moveTo", x: 930, y: 550}]);
|
485
|
+
},
|
486
|
+
"renders a small circle of 120°": function(p) {
|
487
|
+
p(_.geo.circle().angle(120)());
|
488
|
+
assert.deepEqual(testContext.buffer().filter(function(d) { return d.type === "moveTo"; }), [{type: "moveTo", x: 30, y: 550}]);
|
489
|
+
}
|
490
|
+
},
|
491
|
+
|
492
|
+
"with an equirectangular projection clipped to 90° and rotated by [180°, 0°]": {
|
493
|
+
topic: function(path) {
|
494
|
+
return path()
|
495
|
+
.context(testContext)
|
496
|
+
.projection(_.geo.equirectangular()
|
497
|
+
.rotate([180, 0])
|
498
|
+
.scale(900 / Math.PI)
|
499
|
+
.precision(0)
|
500
|
+
.clipAngle(90));
|
501
|
+
},
|
502
|
+
"does not render a small circle of 60°": function(p) {
|
503
|
+
p(_.geo.circle().angle(60)());
|
504
|
+
assert.deepEqual(testContext.buffer().filter(function(d) { return d.type === "moveTo"; }), []);
|
505
|
+
},
|
506
|
+
"renders a small circle of 120° in two parts": function(p) {
|
507
|
+
p(_.geo.circle().angle(120)());
|
508
|
+
assert.deepEqual(testContext.buffer().filter(function(d) { return d.type === "moveTo"; }), [
|
509
|
+
{type: "moveTo", x: 276, y: 493},
|
510
|
+
{type: "moveTo", x: 87, y: 700}
|
511
|
+
]);
|
512
|
+
}
|
513
|
+
},
|
514
|
+
|
515
|
+
"with an equirectangular projection clipped to 90° and rotated by [270°, 0°]": {
|
516
|
+
topic: function(path) {
|
517
|
+
return path()
|
518
|
+
.context(testContext)
|
519
|
+
.projection(_.geo.equirectangular()
|
520
|
+
.rotate([270, 0])
|
521
|
+
.scale(900 / Math.PI)
|
522
|
+
.precision(0)
|
523
|
+
.clipAngle(90));
|
524
|
+
},
|
525
|
+
"renders a small circle of 60°": function(p) {
|
526
|
+
p(_.geo.circle().angle(60)());
|
527
|
+
assert.deepEqual(testContext.buffer().filter(function(d) { return d.type === "moveTo"; }), [{type: "moveTo", x: 30, y: -50}]);
|
528
|
+
},
|
529
|
+
"renders a small circle of 120°": function(p) {
|
530
|
+
p(_.geo.circle().angle(120)());
|
531
|
+
assert.deepEqual(testContext.buffer().filter(function(d) { return d.type === "moveTo"; }), [{type: "moveTo", x: 930, y: -50}]);
|
532
|
+
}
|
533
|
+
},
|
534
|
+
|
535
|
+
"with an equirectangular projection clipped to 90° and rotated by [210°, 1°]": {
|
536
|
+
topic: function(path) {
|
537
|
+
return path()
|
538
|
+
.context(testContext)
|
539
|
+
.projection(_.geo.equirectangular()
|
540
|
+
.rotate([210, 1])
|
541
|
+
.scale(900 / Math.PI)
|
542
|
+
.precision(0)
|
543
|
+
.clipAngle(90));
|
544
|
+
},
|
545
|
+
"renders a small circle of 120°": function(p) {
|
546
|
+
p(_.geo.circle().angle(120)());
|
547
|
+
assert.deepEqual(testContext.buffer().filter(function(d) { return d.type === "moveTo"; }), [{type: "moveTo", x: 930, y: 250}]);
|
548
|
+
}
|
549
|
+
},
|
550
|
+
|
551
|
+
"with an equirectangular projection clipped to 90° and rotated by [-150°, 60°]": {
|
552
|
+
topic: function(path) {
|
553
|
+
return path()
|
554
|
+
.context(testContext)
|
555
|
+
.projection(_.geo.equirectangular()
|
556
|
+
.rotate([-150, 60])
|
557
|
+
.scale(900 / Math.PI)
|
558
|
+
.precision(0)
|
559
|
+
.clipAngle(90));
|
560
|
+
},
|
561
|
+
"renders a small circle of 120°": function(p) {
|
562
|
+
p(_.geo.circle().angle(120)());
|
563
|
+
assert.deepEqual(testContext.buffer().filter(function(d) { return d.type === "moveTo"; }), [{type: "moveTo", x: 30, y: -87}]);
|
564
|
+
},
|
565
|
+
"renders a sphere": function(p) {
|
566
|
+
p({type: "Sphere"});
|
567
|
+
assert.deepEqual(testContext.buffer().filter(function(d) { return d.type === "moveTo"; }), [{type: "moveTo", x: 87, y: 700}]);
|
568
|
+
}
|
569
|
+
},
|
570
|
+
|
571
|
+
"with an equirectangular projection clipped to 170°": {
|
572
|
+
topic: function(path) {
|
573
|
+
return path()
|
574
|
+
.context(testContext)
|
575
|
+
.projection(_.geo.equirectangular()
|
576
|
+
.scale(900 / Math.PI)
|
577
|
+
.precision(0)
|
578
|
+
.clipAngle(170));
|
579
|
+
},
|
580
|
+
"renders stripes": function(p) {
|
581
|
+
p(stripes(80, -80));
|
582
|
+
assert.deepEqual(testContext.buffer().filter(function(d) { return d.type === "moveTo"; }), [
|
583
|
+
{type: "moveTo", x: -420, y: -150},
|
584
|
+
{type: "moveTo", x: -420, y: 650},
|
585
|
+
{type: "moveTo", x: 1331, y: 259}
|
586
|
+
]);
|
587
|
+
}
|
588
|
+
},
|
589
|
+
|
590
|
+
"with an equirectangular projection clipped to 170° and rotated by [0°, -90°]": {
|
591
|
+
topic: function(path) {
|
592
|
+
return path()
|
593
|
+
.context(testContext)
|
594
|
+
.projection(_.geo.equirectangular()
|
595
|
+
.scale(900 / Math.PI)
|
596
|
+
.rotate([0, -90])
|
597
|
+
.precision(0)
|
598
|
+
.clipAngle(170));
|
599
|
+
},
|
600
|
+
"renders stripes": function(p) {
|
601
|
+
p(stripes(80, -80));
|
602
|
+
assert.deepEqual(testContext.buffer().filter(function(d) { return d.type === "moveTo"; }), [
|
603
|
+
{type: "moveTo", x: 480, y: 200},
|
604
|
+
{type: "moveTo", x: 1350, y: 210}
|
605
|
+
]);
|
606
|
+
}
|
607
|
+
},
|
608
|
+
|
609
|
+
"with an equirectangular projection clipped to 30°": {
|
610
|
+
topic: function(path) {
|
611
|
+
return path()
|
612
|
+
.context(testContext)
|
613
|
+
.projection(_.geo.equirectangular()
|
614
|
+
.scale(900 / Math.PI)
|
615
|
+
.precision(0)
|
616
|
+
.clipAngle(30));
|
617
|
+
},
|
618
|
+
"clips lines with two invisible endpoints and visible middle": function(p) {
|
619
|
+
p({type: "LineString", coordinates: [[-45, 0], [45, 0]]});
|
620
|
+
assert.deepEqual(testContext.buffer(), [
|
621
|
+
{type: "moveTo", x: 330, y: 250},
|
622
|
+
{type: "lineTo", x: 630, y: 250}
|
623
|
+
]);
|
624
|
+
}
|
625
|
+
},
|
626
|
+
|
627
|
+
"with an equirectangular projection clipped to 150°": {
|
628
|
+
topic: function(path) {
|
629
|
+
return path()
|
630
|
+
.context(testContext)
|
631
|
+
.projection(_.geo.equirectangular()
|
632
|
+
.scale(900 / Math.PI)
|
633
|
+
.precision(0)
|
634
|
+
.clipAngle(150));
|
635
|
+
},
|
636
|
+
"clips lines with two visible endpoints and invisible middle": function(p) {
|
637
|
+
p({type: "LineString", coordinates: [[135, 0], [-135, 0]]});
|
638
|
+
assert.deepEqual(testContext.buffer(), [
|
639
|
+
{type: "moveTo", x: 1155, y: 250},
|
640
|
+
{type: "lineTo", x: 1230, y: 250},
|
641
|
+
{type: "moveTo", x: -270, y: 250},
|
642
|
+
{type: "lineTo", x: -195, y: 250}
|
643
|
+
]);
|
644
|
+
}
|
645
|
+
},
|
646
|
+
|
647
|
+
"with an equirectangular projection rotated by [98°, 0°]": {
|
648
|
+
topic: function(path) {
|
649
|
+
return path()
|
650
|
+
.context(testContext)
|
651
|
+
.projection(_.geo.equirectangular()
|
652
|
+
.scale(900 / Math.PI)
|
653
|
+
.rotate([98, 0])
|
654
|
+
.precision(0));
|
655
|
+
},
|
656
|
+
"renders Keweenaw, a small U.S. county": function(p) {
|
657
|
+
p({
|
658
|
+
type: "Polygon",
|
659
|
+
coordinates: [[[-88.23013, 47.198326], [-88.514931, 47.285957], [-88.383484, 47.285957], [-88.23013, 47.198326]]]
|
660
|
+
});
|
661
|
+
assert.equal(testContext.buffer().filter(function(d) { return d.type === "moveTo"; }).length, 1);
|
662
|
+
},
|
663
|
+
"renders Accomack, a small U.S. county": function(p) {
|
664
|
+
p({
|
665
|
+
type: "MultiPolygon",
|
666
|
+
coordinates: [
|
667
|
+
[[[-75.397659, 38.013497], [-75.244304, 38.029928], [-75.666029, 37.465803], [-75.939876, 37.547957], [-75.671506, 37.95325], [-75.622213, 37.991589], [-75.397659, 38.013497]]],
|
668
|
+
[[[-76.016553, 37.95325], [-76.043938, 37.95325], [-75.994645, 37.95325], [-76.016553, 37.95325]]]
|
669
|
+
]
|
670
|
+
});
|
671
|
+
assert.equal(testContext.buffer().filter(function(d) { return d.type === "moveTo"; }).length, 2);
|
672
|
+
},
|
673
|
+
"renders Hopewell, a small U.S. county": function(p) {
|
674
|
+
p({
|
675
|
+
type: "Polygon",
|
676
|
+
coordinates: [[[-77.298157, 37.312448], [-77.298157, 37.312448], [-77.336496, 37.312448], [-77.281726, 37.312448], [-77.298157, 37.312448]]]
|
677
|
+
});
|
678
|
+
assert.equal(testContext.buffer().filter(function(d) { return d.type === "moveTo"; }).length, 1);
|
679
|
+
}
|
680
|
+
},
|
681
|
+
|
682
|
+
"with an equirectangular projection rotated by [330°, 232°]": {
|
683
|
+
topic: function(path) {
|
684
|
+
return path()
|
685
|
+
.context(testContext)
|
686
|
+
.projection(_.geo.equirectangular()
|
687
|
+
.scale(900 / Math.PI)
|
688
|
+
.rotate([330, 232])
|
689
|
+
.precision(0));
|
690
|
+
},
|
691
|
+
"renders degenerate points for a small circle of 30°": function(p) {
|
692
|
+
p(_.geo.circle().angle(30)());
|
693
|
+
assert.equal(testContext.buffer().filter(function(d) { return d.type === "moveTo"; }).length, 2);
|
694
|
+
}
|
695
|
+
},
|
696
|
+
|
697
|
+
"with an equirectangular projection rotated by [34.5°, 90°]": {
|
698
|
+
topic: function(path) {
|
699
|
+
return path()
|
700
|
+
.context(testContext)
|
701
|
+
.projection(_.geo.equirectangular()
|
702
|
+
.scale(900 / Math.PI)
|
703
|
+
.rotate([34.5, 90])
|
704
|
+
.precision(0));
|
705
|
+
},
|
706
|
+
"observes proper clip point ordering for lines": function(p) {
|
707
|
+
var line = _.range(-90, 180, 10).map(function(x) { return [x, 20]; })
|
708
|
+
.concat(_.range(170, -100, -10).map(function(x) { return [x, 0]; }))
|
709
|
+
.concat([[-90, 20]]);
|
710
|
+
p({type: "Polygon", coordinates: [line]});
|
711
|
+
assert.equal(testContext.buffer().filter(function(d) { return d.type === "moveTo"; }).length, 3);
|
712
|
+
}
|
713
|
+
},
|
714
|
+
|
715
|
+
"with an equirectangular projection with the viewport clipped to 960×500": {
|
716
|
+
topic: function(path) {
|
717
|
+
return path()
|
718
|
+
.context(testContext)
|
719
|
+
.projection(_.geo.equirectangular()
|
720
|
+
.scale(900 / Math.PI)
|
721
|
+
.clipExtent([[0, 0], [960, 500]])
|
722
|
+
.precision(0));
|
723
|
+
},
|
724
|
+
"doesn't generate a redundant closing point": function(p) {
|
725
|
+
p({type: "Polygon", coordinates: [[[0, 0], [0, 1], [1, 1], [1, 0], [0, 0]]]});
|
726
|
+
assert.deepEqual(testContext.buffer(), [
|
727
|
+
{type: "moveTo", x: 480, y: 250},
|
728
|
+
{type: "lineTo", x: 480, y: 245},
|
729
|
+
{type: "lineTo", x: 485, y: 245},
|
730
|
+
{type: "lineTo", x: 485, y: 250},
|
731
|
+
{type: "closePath"}
|
732
|
+
]);
|
733
|
+
}
|
734
|
+
},
|
735
|
+
|
736
|
+
"with a stereographic projection and adaptive resampling": {
|
737
|
+
topic: function(path) {
|
738
|
+
return path()
|
739
|
+
.context(testContext)
|
740
|
+
.projection(_.geo.stereographic()
|
741
|
+
.precision(1));
|
742
|
+
},
|
743
|
+
"correctly resamples points on antimeridian": function(p) {
|
744
|
+
p({type: "LineString", coordinates: [[0, 90], [90, 0]]});
|
745
|
+
assert.deepEqual(testContext.buffer(), [
|
746
|
+
{type: "moveTo", x: 480, y: 100},
|
747
|
+
{type: "lineTo", x: 509, y: 103},
|
748
|
+
{type: "lineTo", x: 537, y: 111},
|
749
|
+
{type: "lineTo", x: 563, y: 125},
|
750
|
+
{type: "lineTo", x: 586, y: 144},
|
751
|
+
{type: "lineTo", x: 605, y: 167},
|
752
|
+
{type: "lineTo", x: 619, y: 193},
|
753
|
+
{type: "lineTo", x: 627, y: 221},
|
754
|
+
{type: "lineTo", x: 630, y: 250}
|
755
|
+
]);
|
756
|
+
}
|
757
|
+
},
|
758
|
+
|
759
|
+
"with an Albers projection and adaptive resampling": {
|
760
|
+
"correctly resamples near the poles": function(path) {
|
761
|
+
var p = path()
|
762
|
+
.context(testContext)
|
763
|
+
.projection(_.geo.albers()
|
764
|
+
.scale(140)
|
765
|
+
.rotate([0, 0])
|
766
|
+
.precision(1));
|
767
|
+
p({type: "LineString", coordinates: [[0, 88], [180, 89]]});
|
768
|
+
assert.isTrue(testContext.buffer().filter(function(d) { return d.type === "lineTo"; }).length > 1);
|
769
|
+
p({type: "LineString", coordinates: [[180, 90], [1, 89.5]]});
|
770
|
+
assert.isTrue(testContext.buffer().filter(function(d) { return d.type === "lineTo"; }).length > 1);
|
771
|
+
},
|
772
|
+
"rotate([11.5, 285])": function(path) {
|
773
|
+
var p = path()
|
774
|
+
.context(testContext)
|
775
|
+
.projection(_.geo.albers()
|
776
|
+
.scale(140)
|
777
|
+
.rotate([11.5, 285])
|
778
|
+
.precision(1));
|
779
|
+
p({type: "LineString", coordinates: [[170, 20], [170, 0]]});
|
780
|
+
assert.isTrue(testContext.buffer().filter(function(d) { return d.type === "lineTo"; }).length > 1);
|
781
|
+
},
|
782
|
+
"wavy projection": function(path) {
|
783
|
+
var p = path()
|
784
|
+
.context(testContext)
|
785
|
+
.projection(_.geo.projection(function(λ, φ) {
|
786
|
+
return [λ, Math.sin(λ * 4)];
|
787
|
+
})
|
788
|
+
.scale(140)
|
789
|
+
.precision(1));
|
790
|
+
p({type: "LineString", coordinates: [[-45, 0], [45, 0]]});
|
791
|
+
assert.isTrue(testContext.buffer().filter(function(d) { return d.type === "lineTo"; }).length > 1);
|
792
|
+
}
|
793
|
+
},
|
794
|
+
|
795
|
+
"with an Albers projection rotated by [11.5°, 285°] and adaptive resampling": {
|
796
|
+
topic: function(path) {
|
797
|
+
return path()
|
798
|
+
.context(testContext)
|
799
|
+
.projection(_.geo.albers()
|
800
|
+
.scale(140)
|
801
|
+
.rotate([11.5, 285])
|
802
|
+
.precision(1));
|
803
|
+
},
|
804
|
+
"correctly resamples near the poles": function(p) {
|
805
|
+
p({type: "LineString", coordinates: [[170, 20], [170, 0]]});
|
806
|
+
assert.isTrue(testContext.buffer().filter(function(d) { return d.type === "lineTo"; }).length > 1);
|
807
|
+
}
|
808
|
+
}
|
809
|
+
}
|
810
|
+
});
|
811
|
+
|
812
|
+
var testBuffer = [];
|
813
|
+
|
814
|
+
var testContext = {
|
815
|
+
arc: function(x, y, r, a0, a1) { testBuffer.push({type: "arc", x: Math.round(x), y: Math.round(y), r: r}); },
|
816
|
+
moveTo: function(x, y) { testBuffer.push({type: "moveTo", x: Math.round(x), y: Math.round(y)}); },
|
817
|
+
lineTo: function(x, y) { testBuffer.push({type: "lineTo", x: Math.round(x), y: Math.round(y)}); },
|
818
|
+
closePath: function() { testBuffer.push({type: "closePath"}); },
|
819
|
+
buffer: function() { var result = testBuffer; testBuffer = []; return result; }
|
820
|
+
};
|
821
|
+
|
822
|
+
function stripes(a, b) {
|
823
|
+
return {type: "Polygon", coordinates: [a, b].map(function(d, i) {
|
824
|
+
var stripe = _.range(-180, 180, 1).map(function(x) { return [x, d]; });
|
825
|
+
stripe.push(stripe[0]);
|
826
|
+
return i ? stripe.reverse() : stripe;
|
827
|
+
})};
|
828
|
+
}
|
829
|
+
|
830
|
+
var antarctica = {type: "Polygon", coordinates: [[[-58.61414,-64.15246],[-59.04507,-64.36800],[-59.78934,-64.21122],[-60.61192,-64.30920],[-61.29741,-64.54432],[-62.02210,-64.79909],[-62.51176,-65.09302],[-62.64885,-65.48494],[-62.59012,-65.85721],[-62.12007,-66.19032],[-62.80556,-66.42550],[-63.74569,-66.50384],[-64.29410,-66.83700],[-64.88169,-67.15047],[-65.50842,-67.58161],[-65.66508,-67.95388],[-65.31254,-68.36533],[-64.78371,-68.67890],[-63.96110,-68.91398],[-63.19729,-69.22755],[-62.78595,-69.61941],[-62.57051,-69.99174],[-62.27673,-70.38366],[-61.80666,-70.71676],[-61.51290,-71.08904],[-61.37580,-72.01007],[-61.08197,-72.38235],[-61.00366,-72.77426],[-60.69026,-73.16617],[-60.82736,-73.69524],[-61.37580,-74.10674],[-61.96336,-74.43984],[-63.29520,-74.57699],[-63.74569,-74.92974],[-64.35283,-75.26284],[-65.86098,-75.63512],[-67.19281,-75.79191],[-68.44628,-76.00745],[-69.79772,-76.22299],[-70.60072,-76.63449],[-72.20677,-76.67366],[-73.96953,-76.63449],[-75.55597,-76.71288],[-77.24037,-76.71288],[-76.92697,-77.10480],[-75.39929,-77.28106],[-74.28287,-77.55542],[-73.65611,-77.90811],[-74.77253,-78.22163],[-76.49610,-78.12365],[-77.92585,-78.37841],[-77.98466,-78.78991],[-78.02378,-79.18183],[-76.84863,-79.51493],[-76.63322,-79.88721],[-75.36009,-80.25954],[-73.24485,-80.41633],[-71.44294,-80.69062],[-70.01316,-81.00415],[-68.19164,-81.31767],[-65.70427,-81.47445],[-63.25603,-81.74875],[-61.55202,-82.04269],[-59.69141,-82.37585],[-58.71212,-82.84610],[-58.22248,-83.21843],[-57.00811,-82.86569],[-55.36289,-82.57175],[-53.61977,-82.25823],[-51.54364,-82.00352],[-49.76134,-81.72917],[-47.27393,-81.70958],[-44.82570,-81.84673],[-42.80836,-82.08191],[-42.16202,-81.65082],[-40.77143,-81.35689],[-38.24481,-81.33730],[-36.26666,-81.12171],[-34.38639,-80.90617],[-32.31029,-80.76902],[-30.09709,-80.59265],[-28.54980,-80.33793],[-29.25490,-79.98519],[-29.68580,-79.63250],[-29.68580,-79.26022],[-31.62480,-79.29939],[-33.68132,-79.45613],[-35.63991,-79.45613],[-35.91410,-79.08385],[-35.77700,-78.33924],[-35.32654,-78.12365],[-33.89676,-77.88852],[-32.21236,-77.65345],[-30.99805,-77.35951],[-29.78373,-77.06557],[-28.88277,-76.67366],[-27.51175,-76.49734],[-26.16033,-76.36014],[-25.47482,-76.28180],[-23.92755,-76.24258],[-22.45859,-76.10543],[-21.22469,-75.90947],[-20.01037,-75.67434],[-18.91354,-75.43921],[-17.52298,-75.12569],[-16.64158,-74.79253],[-15.70149,-74.49860],[-15.40771,-74.10674],[-16.46532,-73.87161],[-16.11278,-73.46011],[-15.44685,-73.14654],[-14.40880,-72.95058],[-13.31197,-72.71545],[-12.29350,-72.40193],[-11.51006,-72.01007],[-11.02043,-71.53976],[-10.29577,-71.26541],[-9.10101,-71.32422],[-8.61138,-71.65733],[-7.41662,-71.69650],[-7.37745,-71.32422],[-6.86823,-70.93231],[-5.79098,-71.03028],[-5.53637,-71.40261],[-4.34166,-71.46137],[-3.04898,-71.28505],[-1.79549,-71.16743],[-0.65948,-71.22624],[-0.22863,-71.63774],[0.86819,-71.30463],[1.88668,-71.12826],[3.02263,-70.99111],[4.13905,-70.85391],[5.15754,-70.61878],[6.27391,-70.46205],[7.13571,-70.24651],[7.74286,-69.89376],[8.48711,-70.14853],[9.52513,-70.01133],[10.24984,-70.48163],[10.81782,-70.83433],[11.95382,-70.63837],[12.40428,-70.24651],[13.42277,-69.97216],[14.73499,-70.03091],[15.12675,-70.40324],[15.94934,-70.03091],[17.02658,-69.91335],[18.20171,-69.87418],[19.25937,-69.89376],[20.37573,-70.01133],[21.45298,-70.07014],[21.92303,-70.40324],[22.56940,-70.69718],[23.66618,-70.52081],[24.84135,-70.48163],[25.97730,-70.48163],[27.09372,-70.46205],[28.09258,-70.32485],[29.15024,-70.20728],[30.03158,-69.93293],[30.97173,-69.75661],[31.99017,-69.65864],[32.75405,-69.38429],[33.30244,-68.83564],[33.87041,-68.50258],[34.90849,-68.65927],[35.30020,-69.01201],[36.16201,-69.24714],[37.20003,-69.16874],[37.90510,-69.52144],[38.64940,-69.77620],[39.66789,-69.54107],[40.02043,-69.10994],[40.92135,-68.93362],[41.95943,-68.60051],[42.93870,-68.46331],[44.11387,-68.26740],[44.89729,-68.05186],[45.71992,-67.81673],[46.50334,-67.60119],[47.44344,-67.71875],[48.34441,-67.36606],[48.99073,-67.09171],[49.93088,-67.11130],[50.75347,-66.87617],[50.94932,-66.52348],[51.79154,-66.24913],[52.61413,-66.05317],[53.61303,-65.89639],[54.53355,-65.81804],[55.41494,-65.87680],[56.35504,-65.97478],[57.15809,-66.24913],[57.25596,-66.68021],[58.13736,-67.01332],[58.74450,-67.28767],[59.93931,-67.40523],[60.60522,-67.67958],[61.42780,-67.95388],[62.38748,-68.01269],[63.19048,-67.81673],[64.05234,-67.40523],[64.99244,-67.62072],[65.97171,-67.73834],[66.91186,-67.85590],[67.89113,-67.93430],[68.89003,-67.93430],[69.71262,-68.97279],[69.67345,-69.22755],[69.55594,-69.67822],[68.59625,-69.93293],[67.81273,-70.30526],[67.94988,-70.69718],[69.06630,-70.67754],[68.92915,-71.06945],[68.41998,-71.44178],[67.94988,-71.85328],[68.71376,-72.16680],[69.86930,-72.26478],[71.02489,-72.08841],[71.57328,-71.69650],[71.90628,-71.32422],[72.45462,-71.01070],[73.08141,-70.71676],[73.33602,-70.36402],[73.86487,-69.87418],[74.49155,-69.77620],[75.62755,-69.73703],[76.62646,-69.61941],[77.64490,-69.46268],[78.13453,-69.07076],[78.42837,-68.69844],[79.11385,-68.32621],[80.09312,-68.07150],[80.93534,-67.87554],[81.48379,-67.54238],[82.05176,-67.36606],[82.77642,-67.20928],[83.77533,-67.30726],[84.67620,-67.20928],[85.65552,-67.09171],[86.75235,-67.15047],[87.47701,-66.87617],[87.98628,-66.20991],[88.35841,-66.48426],[88.82840,-66.95456],[89.67063,-67.15047],[90.63036,-67.22886],[91.59009,-67.11130],[92.60853,-67.18969],[93.54863,-67.20928],[94.17541,-67.11130],[95.01759,-67.17011],[95.78147,-67.38565],[96.68239,-67.24850],[97.75964,-67.24850],[98.68020,-67.11130],[99.71818,-67.24850],[100.38418,-66.91534],[100.89335,-66.58223],[101.57889,-66.30788],[102.83241,-65.56328],[103.47867,-65.70048],[104.24255,-65.97478],[104.90845,-66.32752],[106.18156,-66.93493],[107.16088,-66.95456],[108.08139,-66.95456],[109.15863,-66.83700],[110.23583,-66.69980],[111.05847,-66.42550],[111.74395,-66.13156],[112.86037,-66.09234],[113.60467,-65.87680],[114.38808,-66.07276],[114.89730,-66.38628],[115.60238,-66.69980],[116.69916,-66.66063],[117.38470,-66.91534],[118.57946,-67.17011],[119.83292,-67.26808],[120.87099,-67.18969],[121.65441,-66.87617],[122.32036,-66.56265],[123.22129,-66.48426],[124.12227,-66.62146],[125.16024,-66.71938],[126.10039,-66.56265],[127.00142,-66.56265],[127.88276,-66.66063],[128.80328,-66.75861],[129.70425,-66.58223],[130.78145,-66.42550],[131.79994,-66.38628],[132.93589,-66.38628],[133.85646,-66.28830],[134.75738,-66.20996],[135.03158,-65.72007],[135.07075,-65.30857],[135.69748,-65.58286],[135.87380,-66.03359],[136.20670,-66.44509],[136.61804,-66.77819],[137.46027,-66.95456],[138.59622,-66.89576],[139.90844,-66.87617],[140.80942,-66.81736],[142.12169,-66.81736],[143.06184,-66.79778],[144.37406,-66.83700],[145.49042,-66.91534],[146.19555,-67.22886],[145.99969,-67.60119],[146.64606,-67.89513],[147.72326,-68.13025],[148.83962,-68.38502],[150.13231,-68.56129],[151.48370,-68.71812],[152.50224,-68.87481],[153.63819,-68.89450],[154.28456,-68.56129],[155.16585,-68.83564],[155.92979,-69.14921],[156.81113,-69.38429],[158.02552,-69.48226],[159.18101,-69.59983],[159.67069,-69.99174],[160.80665,-70.22687],[161.57047,-70.57961],[162.68689,-70.73635],[163.84243,-70.71676],[164.91968,-70.77552],[166.11443,-70.75593],[167.30909,-70.83433],[168.42561,-70.97148],[169.46358,-71.20666],[170.50166,-71.40261],[171.20679,-71.69650],[171.08922,-72.08841],[170.56042,-72.44115],[170.10995,-72.89182],[169.75736,-73.24452],[169.28732,-73.65601],[167.97510,-73.81280],[167.38748,-74.16549],[166.09480,-74.38104],[165.64439,-74.77295],[164.95885,-75.14528],[164.23419,-75.45880],[163.82279,-75.87030],[163.56823,-76.24258],[163.47026,-76.69330],[163.48989,-77.06557],[164.05787,-77.45744],[164.27336,-77.82977],[164.74346,-78.18251],[166.60412,-78.31961],[166.99578,-78.75074],[165.19387,-78.90748],[163.66621,-79.12302],[161.76638,-79.16224],[160.92416,-79.73048],[160.74789,-80.20073],[160.31696,-80.57306],[159.78821,-80.94539],[161.12001,-81.27850],[161.62928,-81.69000],[162.49099,-82.06227],[163.70533,-82.39543],[165.09594,-82.70895],[166.60412,-83.02247],[168.89566,-83.33599],[169.40478,-83.82589],[172.28393,-84.04143],[172.47704,-84.11791],[173.22408,-84.41371],[175.98567,-84.15899],[178.27721,-84.47251],[180.00000,-84.71338],[180.00000,-90.0],[-180.0,-90.0],[-180.0,-84.71338],[-179.94249,-84.72144],[-179.05867,-84.13941],[-177.25677,-84.45293],[-177.14080,-84.41794],[-176.86199,-84.33381],[-176.52395,-84.23181],[-176.23030,-84.14320],[-176.08467,-84.09925],[-175.93410,-84.10159],[-175.82988,-84.11791],[-174.38250,-84.53432],[-173.11655,-84.11791],[-172.88910,-84.06101],[-169.95122,-83.88464],[-168.99998,-84.11791],[-168.53019,-84.23739],[-167.02209,-84.57049],[-164.18214,-84.82520],[-161.92977,-85.13873],[-158.07137,-85.37391],[-155.19225,-85.09955],[-150.94209,-85.29551],[-148.53307,-85.60903],[-145.88891,-85.31510],[-143.10771,-85.04075],[-142.89227,-84.57049],[-146.82906,-84.53127],[-150.06073,-84.29614],[-150.90292,-83.90423],[-153.58620,-83.68868],[-153.40990,-83.23801],[-153.03775,-82.82652],[-152.66563,-82.45419],[-152.86151,-82.04269],[-154.52629,-81.76839],[-155.29017,-81.41565],[-156.83744,-81.10212],[-154.40878,-81.16093],[-152.09766,-81.00415],[-150.64829,-81.33730],[-148.86599,-81.04337],[-147.22074,-80.67104],[-146.41774,-80.33793],[-146.77028,-79.92643],[-148.06294,-79.65208],[-149.53190,-79.35820],[-151.58841,-79.29939],[-153.39032,-79.16224],[-155.32937,-79.06426],[-155.97566,-78.69193],[-157.26830,-78.37841],[-158.05176,-78.02567],[-158.36513,-76.88920],[-157.87547,-76.98723],[-156.97457,-77.30075],[-155.32937,-77.20272],[-153.74283,-77.06557],[-152.92024,-77.49666],[-151.33378,-77.39873],[-150.00194,-77.18314],[-148.74848,-76.90884],[-147.61248,-76.57573],[-146.10440,-76.47775],[-146.14352,-76.10543],[-146.49609,-75.73315],[-146.20230,-75.38041],[-144.90962,-75.20403],[-144.32203,-75.53719],[-142.79435,-75.34123],[-141.63876,-75.08647],[-140.20900,-75.06688],[-138.85759,-74.96891],[-137.50619,-74.73378],[-136.42890,-74.51824],[-135.21458,-74.30269],[-134.43119,-74.36145],[-133.74565,-74.43984],[-132.25716,-74.30269],[-130.92531,-74.47901],[-129.55428,-74.45943],[-128.24203,-74.32228],[-126.89062,-74.42026],[-125.40208,-74.51824],[-124.01149,-74.47901],[-122.56215,-74.49860],[-121.07361,-74.51824],[-119.70255,-74.47901],[-118.68414,-74.18508],[-117.46980,-74.02834],[-116.21631,-74.24389],[-115.02155,-74.06751],[-113.94433,-73.71482],[-113.29798,-74.02834],[-112.94545,-74.38104],[-112.29908,-74.71419],[-111.26105,-74.42026],[-110.06632,-74.79253],[-108.71490,-74.91010],[-107.55934,-75.18445],[-106.14914,-75.12569],[-104.87607,-74.94932],[-103.36794,-74.98849],[-102.01650,-75.12569],[-100.64553,-75.30201],[-100.11669,-74.87093],[-100.76304,-74.53782],[-101.25270,-74.18508],[-102.54533,-74.10674],[-103.11331,-73.73441],[-103.32875,-73.36208],[-103.68128,-72.61753],[-102.91748,-72.75467],[-101.60523,-72.81343],[-100.31252,-72.75467],[-99.13737,-72.91141],[-98.11888,-73.20534],[-97.68803,-73.55804],[-96.33659,-73.61684],[-95.04396,-73.47969],[-93.67290,-73.28374],[-92.43900,-73.16617],[-91.42056,-73.40130],[-90.08873,-73.32291],[-89.22695,-72.55872],[-88.42395,-73.00939],[-87.26833,-73.18576],[-86.01482,-73.08778],[-85.19223,-73.47969],[-83.87999,-73.51887],[-82.66564,-73.63643],[-81.47091,-73.85197],[-80.68744,-73.47969],[-80.29579,-73.12695],[-79.29688,-73.51887],[-77.92585,-73.42089],[-76.90736,-73.63643],[-76.22187,-73.96954],[-74.89004,-73.87161],[-73.85202,-73.65601],[-72.83353,-73.40130],[-71.61921,-73.26415],[-70.20904,-73.14654],[-68.93591,-73.00939],[-67.95662,-72.79385],[-67.36906,-72.48032],[-67.13403,-72.04924],[-67.25154,-71.63774],[-67.56494,-71.24583],[-67.91747,-70.85391],[-68.23084,-70.46205],[-68.48545,-70.10931],[-68.54420,-69.71739],[-68.44628,-69.32553],[-67.97623,-68.95320],[-67.58449,-68.54170],[-67.42784,-68.14984],[-67.62367,-67.71875],[-67.74118,-67.32684],[-67.25154,-66.87617],[-66.70318,-66.58223],[-66.05681,-66.20996],[-65.37132,-65.89639],[-64.56827,-65.60250],[-64.17654,-65.17142],[-63.62815,-64.89707],[-63.00139,-64.64230],[-62.04168,-64.58355],[-61.41492,-64.27003],[-60.70985,-64.07407],[-59.88726,-63.95651],[-59.16258,-63.70174],[-58.59455,-63.38822],[-57.81114,-63.27066],[-57.22358,-63.52542],[-57.59572,-63.85853],[-58.61414,-64.15246]]]};
|
831
|
+
|
832
|
+
suite.export(module);
|