|
4013 | 4013 | return stream; |
4014 | 4014 | } |
4015 | 4015 | function d3_geo_resample(project) { |
4016 | | - var δ2 = .5, cosMinDistance = Math.cos(30 * d3_radians), maxDepth = 16; |
| 4016 | + var δ2 = .5, cosMinDistance = Math.cos(30 * d3_radians); |
4017 | 4017 | function resample(stream) { |
4018 | | - return (maxDepth ? resampleRecursive : resampleNone)(stream); |
| 4018 | + return (δ2 > 0 ? resampleRecursive : resampleNone)(stream); |
4019 | 4019 | } |
4020 | 4020 | function resampleNone(stream) { |
4021 | 4021 | return d3_geo_transformPoint(stream, function(x, y) { |
|
4049 | 4049 | } |
4050 | 4050 | function linePoint(λ, φ) { |
4051 | 4051 | var c = d3_geo_cartesian([ λ, φ ]), p = project(λ, φ); |
4052 | | - resampleLineTo(x0, y0, λ0, a0, b0, c0, x0 = p[0], y0 = p[1], λ0 = λ, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream); |
| 4052 | + resampleLineTo(x0, y0, λ0, a0, b0, c0, x0 = p[0], y0 = p[1], λ0 = λ, a0 = c[0], b0 = c[1], c0 = c[2], d3_geo_resampleMaxDepth, stream); |
4053 | 4053 | stream.point(x0, y0); |
4054 | 4054 | } |
4055 | 4055 | function lineEnd() { |
|
4066 | 4066 | resample.point = linePoint; |
4067 | 4067 | } |
4068 | 4068 | function ringEnd() { |
4069 | | - resampleLineTo(x0, y0, λ0, a0, b0, c0, x00, y00, λ00, a00, b00, c00, maxDepth, stream); |
| 4069 | + resampleLineTo(x0, y0, λ0, a0, b0, c0, x00, y00, λ00, a00, b00, c00, d3_geo_resampleMaxDepth, stream); |
4070 | 4070 | resample.lineEnd = lineEnd; |
4071 | 4071 | lineEnd(); |
4072 | 4072 | } |
|
4085 | 4085 | } |
4086 | 4086 | resample.precision = function(_) { |
4087 | 4087 | if (!arguments.length) return Math.sqrt(δ2); |
4088 | | - maxDepth = (δ2 = _ * _) > 0 && 16; |
| 4088 | + δ2 = _ * _; |
4089 | 4089 | return resample; |
4090 | 4090 | }; |
4091 | 4091 | return resample; |
4092 | 4092 | } |
| 4093 | + var d3_geo_resampleMaxDepth = 16; |
4093 | 4094 | d3.geo.path = function() { |
4094 | 4095 | var pointRadius = 4.5, projection, context, projectStream, contextStream, cacheStream; |
4095 | 4096 | function path(object) { |
|
4258 | 4259 | δγ = _.length > 2 ? _[2] % 360 * d3_radians : 0; |
4259 | 4260 | return reset(); |
4260 | 4261 | }; |
4261 | | - d3.rebind(projection, projectResample, "precision"); |
| 4262 | + projection.precision = function(_) { |
| 4263 | + if (!arguments.length) return projectResample.precision(); |
| 4264 | + projectResample.precision(_); |
| 4265 | + return invalidate(); |
| 4266 | + }; |
4262 | 4267 | function reset() { |
4263 | 4268 | projectRotate = d3_geo_compose(rotate = d3_geo_rotation(δλ, δφ, δγ), project); |
4264 | 4269 | var center = project(λ, φ); |
|
0 commit comments