|
6296 | 6296 | })(); |
6297 | 6297 | } |
6298 | 6298 | function d3_geo_projectionMutator(projectAt) { |
6299 | | - var project, rotate, rotation, projectRotate, k = 150, x = 480, y = 250, λ = 0, φ = 0, δλ = 0, δφ = 0, δγ = 0, δx = x, δy = y, clip = d3_geo_cut, clipAngle = null; |
| 6299 | + var project, rotate, rotation, projectRotate, k = 150, x = 480, y = 250, λ = 0, φ = 0, δλ = 0, δφ = 0, δγ = 0, δx, δy, clip = d3_geo_cut, clipAngle = null; |
6300 | 6300 | function projection(coordinates) { |
6301 | 6301 | coordinates = projectRotate(coordinates[0] * d3_radians, coordinates[1] * d3_radians); |
6302 | 6302 | return [ coordinates[0] * k + δx, δy - coordinates[1] * k ]; |
|
6305 | 6305 | coordinates = projectRotate.invert((coordinates[0] - δx) / k, (δy - coordinates[1]) / k); |
6306 | 6306 | return [ coordinates[0] * d3_degrees, coordinates[1] * d3_degrees ]; |
6307 | 6307 | } |
6308 | | - var resample = d3_geo_type({ |
6309 | | - Point: function(o) { |
6310 | | - o.coordinates = resamplePoint(o.coordinates); |
6311 | | - }, |
6312 | | - MultiPoint: function(o) { |
6313 | | - o.coordinates = o.coordinates.map(resamplePoint); |
6314 | | - }, |
6315 | | - LineString: function(o) { |
6316 | | - o.coordinates = resampleLine(o.coordinates); |
6317 | | - }, |
6318 | | - MultiLineString: function(o) { |
6319 | | - o.coordinates = o.coordinates.map(resampleLine); |
6320 | | - }, |
6321 | | - Polygon: function(o) { |
6322 | | - o.coordinates = resamplePolygon(o.coordinates); |
6323 | | - }, |
6324 | | - MultiPolygon: function(o) { |
6325 | | - o.coordinates = o.coordinates.map(resamplePolygon); |
6326 | | - } |
6327 | | - }); |
6328 | 6308 | projection.object = function(object) { |
6329 | 6309 | object = clip(rotation(object)); |
6330 | 6310 | resample(object); |
|
6335 | 6315 | clip = _ == null ? (clipAngle = _, d3_geo_cut) : d3_geo_circleClip(clipAngle = +_); |
6336 | 6316 | return projection; |
6337 | 6317 | }; |
6338 | | - var rotation = d3_geo_type({ |
6339 | | - point: function(coordinates) { |
6340 | | - return rotate(coordinates[0] * d3_radians, coordinates[1] * d3_radians); |
6341 | | - }, |
6342 | | - Sphere: d3_identity |
6343 | | - }); |
6344 | | - function projectPoint(λ, φ) { |
6345 | | - var point = project(λ, φ); |
6346 | | - return [ point[0] * k + δx, δy - point[1] * k ]; |
6347 | | - } |
6348 | 6318 | projection.scale = function(_) { |
6349 | 6319 | if (!arguments.length) return k; |
6350 | 6320 | k = +_; |
|
6382 | 6352 | return projection; |
6383 | 6353 | } |
6384 | 6354 | var λ00, φ00, λ0, sinφ0, cosφ0, x0, y0, δ2 = .5, maxDepth = 16; |
| 6355 | + var resample = d3_geo_type({ |
| 6356 | + Point: function(o) { |
| 6357 | + o.coordinates = resamplePoint(o.coordinates); |
| 6358 | + }, |
| 6359 | + MultiPoint: function(o) { |
| 6360 | + o.coordinates = o.coordinates.map(resamplePoint); |
| 6361 | + }, |
| 6362 | + LineString: function(o) { |
| 6363 | + o.coordinates = resampleLine(o.coordinates); |
| 6364 | + }, |
| 6365 | + MultiLineString: function(o) { |
| 6366 | + o.coordinates = o.coordinates.map(resampleLine); |
| 6367 | + }, |
| 6368 | + Polygon: function(o) { |
| 6369 | + o.coordinates = resamplePolygon(o.coordinates); |
| 6370 | + }, |
| 6371 | + MultiPolygon: function(o) { |
| 6372 | + o.coordinates = o.coordinates.map(resamplePolygon); |
| 6373 | + } |
| 6374 | + }); |
| 6375 | + var rotation = d3_geo_type({ |
| 6376 | + point: function(coordinates) { |
| 6377 | + return rotate(coordinates[0] * d3_radians, coordinates[1] * d3_radians); |
| 6378 | + }, |
| 6379 | + Sphere: d3_identity |
| 6380 | + }); |
| 6381 | + function projectPoint(λ, φ) { |
| 6382 | + var point = project(λ, φ); |
| 6383 | + return [ point[0] * k + δx, δy - point[1] * k ]; |
| 6384 | + } |
6385 | 6385 | function resamplePoint(point) { |
6386 | 6386 | return projectPoint(point[0], point[1]); |
6387 | 6387 | } |
|
0 commit comments