|
5397 | 5397 | while (++i < n) d3_geo_streamLine(coordinates[i], listener); |
5398 | 5398 | listener.polygonEnd(); |
5399 | 5399 | } |
5400 | | - var d3_geo_streamListener = d3.geo.streamListener = function() {}; |
5401 | | - d3_geo_streamListener.prototype = { |
5402 | | - sphere: d3_noop, |
5403 | | - point: d3_noop, |
5404 | | - lineStart: d3_noop, |
5405 | | - lineEnd: d3_noop, |
5406 | | - polygonStart: d3_noop, |
5407 | | - polygonEnd: d3_noop |
| 5400 | + function d3_geo_streamBuffer() { |
| 5401 | + this._buffer = []; |
| 5402 | + this._point = d3_geo_pathCircle(4.5); |
| 5403 | + } |
| 5404 | + var d3_geo_streamBufferPrototype = { |
| 5405 | + point: d3_geo_streamBufferPoint, |
| 5406 | + lineStart: function() { |
| 5407 | + this.point = d3_geo_streamBufferPointLineStart; |
| 5408 | + }, |
| 5409 | + lineEnd: d3_geo_streamBufferLineEnd, |
| 5410 | + polygonStart: function() { |
| 5411 | + this.lineEnd = d3_geo_streamBufferLineEndPolygon; |
| 5412 | + }, |
| 5413 | + polygonEnd: function() { |
| 5414 | + this.lineEnd = d3_geo_streamBufferLineEnd; |
| 5415 | + }, |
| 5416 | + toString: function() { |
| 5417 | + var s = this._buffer.join(""); |
| 5418 | + this._buffer = []; |
| 5419 | + return s; |
| 5420 | + } |
| 5421 | + }; |
| 5422 | + function d3_geo_streamBufferPoint(x, y) { |
| 5423 | + this._buffer.push("M", x, ",", y, this._point); |
| 5424 | + } |
| 5425 | + function d3_geo_streamBufferPointLineStart(x, y) { |
| 5426 | + this._buffer.push("M", x, ",", y); |
| 5427 | + this.point = d3_geo_streamBufferPointLine; |
| 5428 | + } |
| 5429 | + function d3_geo_streamBufferPointLine(x, y) { |
| 5430 | + this._buffer.push("L", x, ",", y); |
| 5431 | + } |
| 5432 | + function d3_geo_streamBufferLineEnd() { |
| 5433 | + this.point = d3_geo_streamBufferPoint; |
| 5434 | + } |
| 5435 | + function d3_geo_streamBufferLineEndPolygon() { |
| 5436 | + this._buffer.push("Z"); |
| 5437 | + } |
| 5438 | + function d3_geo_streamContext() { |
| 5439 | + this._pointRadius = 4.5; |
| 5440 | + } |
| 5441 | + var d3_geo_streamContextPrototype = { |
| 5442 | + point: d3_geo_streamContextPoint, |
| 5443 | + lineStart: function() { |
| 5444 | + this.point = d3_geo_streamContextPointLineStart; |
| 5445 | + }, |
| 5446 | + lineEnd: d3_geo_streamContextLineEnd, |
| 5447 | + polygonStart: function() { |
| 5448 | + this.lineEnd = d3_geo_streamContextLineEndPolygon; |
| 5449 | + }, |
| 5450 | + polygonEnd: function() { |
| 5451 | + this.lineEnd = d3_geo_streamContextLineEnd; |
| 5452 | + } |
5408 | 5453 | }; |
| 5454 | + function d3_geo_streamContextPoint(x, y) { |
| 5455 | + this._context.moveTo(x, y); |
| 5456 | + this._context.arc(x, y, this._pointRadius, 0, 2 * π); |
| 5457 | + } |
| 5458 | + function d3_geo_streamContextPointLineStart(x, y) { |
| 5459 | + this._context.moveTo(x, y); |
| 5460 | + this.point = d3_geo_streamContextPointLine; |
| 5461 | + } |
| 5462 | + function d3_geo_streamContextPointLine(x, y) { |
| 5463 | + this._context.lineTo(x, y); |
| 5464 | + } |
| 5465 | + function d3_geo_streamContextLineEnd() { |
| 5466 | + this.point = d3_geo_streamContextPoint; |
| 5467 | + } |
| 5468 | + function d3_geo_streamContextLineEndPolygon() { |
| 5469 | + this._context.closePath(); |
| 5470 | + } |
5409 | 5471 | function d3_geo_spherical(cartesian) { |
5410 | 5472 | return [ Math.atan2(cartesian[1], cartesian[0]), Math.asin(Math.max(-1, Math.min(1, cartesian[2]))) ]; |
5411 | 5473 | } |
|
0 commit comments