@mui/x-charts-vendor 9.0.0 → 9.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/d3-geo.d.ts +4 -0
- package/d3-geo.js +5 -0
- package/d3-geo.mjs +5 -0
- package/lib-vendor/d3-geo/LICENSE +34 -0
- package/lib-vendor/d3-geo/dist/d3-geo.js +2873 -0
- package/lib-vendor/d3-geo/dist/d3-geo.min.js +1957 -0
- package/lib-vendor/d3-geo/src/area.js +77 -0
- package/lib-vendor/d3-geo/src/bounds.js +169 -0
- package/lib-vendor/d3-geo/src/cartesian.js +42 -0
- package/lib-vendor/d3-geo/src/centroid.js +134 -0
- package/lib-vendor/d3-geo/src/circle.js +77 -0
- package/lib-vendor/d3-geo/src/clip/antimeridian.js +89 -0
- package/lib-vendor/d3-geo/src/clip/buffer.js +30 -0
- package/lib-vendor/d3-geo/src/clip/circle.js +173 -0
- package/lib-vendor/d3-geo/src/clip/extent.js +25 -0
- package/lib-vendor/d3-geo/src/clip/index.js +124 -0
- package/lib-vendor/d3-geo/src/clip/line.js +60 -0
- package/lib-vendor/d3-geo/src/clip/rectangle.js +159 -0
- package/lib-vendor/d3-geo/src/clip/rejoin.js +103 -0
- package/lib-vendor/d3-geo/src/compose.js +15 -0
- package/lib-vendor/d3-geo/src/constant.js +11 -0
- package/lib-vendor/d3-geo/src/contains.js +95 -0
- package/lib-vendor/d3-geo/src/distance.js +18 -0
- package/lib-vendor/d3-geo/src/graticule.js +118 -0
- package/lib-vendor/d3-geo/src/identity.js +8 -0
- package/lib-vendor/d3-geo/src/index.js +335 -0
- package/lib-vendor/d3-geo/src/interpolate.js +35 -0
- package/lib-vendor/d3-geo/src/length.js +50 -0
- package/lib-vendor/d3-geo/src/math.js +44 -0
- package/lib-vendor/d3-geo/src/noop.js +7 -0
- package/lib-vendor/d3-geo/src/path/area.js +50 -0
- package/lib-vendor/d3-geo/src/path/bounds.js +31 -0
- package/lib-vendor/d3-geo/src/path/centroid.js +89 -0
- package/lib-vendor/d3-geo/src/path/context.js +53 -0
- package/lib-vendor/d3-geo/src/path/index.js +71 -0
- package/lib-vendor/d3-geo/src/path/measure.js +47 -0
- package/lib-vendor/d3-geo/src/path/string.js +93 -0
- package/lib-vendor/d3-geo/src/pointEqual.js +10 -0
- package/lib-vendor/d3-geo/src/polygonContains.js +72 -0
- package/lib-vendor/d3-geo/src/projection/albers.js +11 -0
- package/lib-vendor/d3-geo/src/projection/albersUsa.js +118 -0
- package/lib-vendor/d3-geo/src/projection/azimuthal.js +26 -0
- package/lib-vendor/d3-geo/src/projection/azimuthalEqualArea.js +20 -0
- package/lib-vendor/d3-geo/src/projection/azimuthalEquidistant.js +20 -0
- package/lib-vendor/d3-geo/src/projection/conic.js +18 -0
- package/lib-vendor/d3-geo/src/projection/conicConformal.js +39 -0
- package/lib-vendor/d3-geo/src/projection/conicEqualArea.js +33 -0
- package/lib-vendor/d3-geo/src/projection/conicEquidistant.js +31 -0
- package/lib-vendor/d3-geo/src/projection/cylindricalEqualArea.js +17 -0
- package/lib-vendor/d3-geo/src/projection/equalEarth.js +37 -0
- package/lib-vendor/d3-geo/src/projection/equirectangular.js +16 -0
- package/lib-vendor/d3-geo/src/projection/fit.js +52 -0
- package/lib-vendor/d3-geo/src/projection/gnomonic.js +20 -0
- package/lib-vendor/d3-geo/src/projection/identity.js +103 -0
- package/lib-vendor/d3-geo/src/projection/index.js +181 -0
- package/lib-vendor/d3-geo/src/projection/mercator.js +51 -0
- package/lib-vendor/d3-geo/src/projection/naturalEarth1.js +29 -0
- package/lib-vendor/d3-geo/src/projection/orthographic.js +18 -0
- package/lib-vendor/d3-geo/src/projection/resample.js +106 -0
- package/lib-vendor/d3-geo/src/projection/stereographic.js +22 -0
- package/lib-vendor/d3-geo/src/projection/transverseMercator.js +27 -0
- package/lib-vendor/d3-geo/src/rotation.js +65 -0
- package/lib-vendor/d3-geo/src/stream.js +83 -0
- package/lib-vendor/d3-geo/src/transform.js +42 -0
- package/package.json +18 -2
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _index = require("../../../d3-array/src/index.js");
|
|
9
|
+
var _math = require("../math.js");
|
|
10
|
+
var _noop = _interopRequireDefault(require("../noop.js"));
|
|
11
|
+
var areaSum = new _index.Adder(),
|
|
12
|
+
areaRingSum = new _index.Adder(),
|
|
13
|
+
x00,
|
|
14
|
+
y00,
|
|
15
|
+
x0,
|
|
16
|
+
y0;
|
|
17
|
+
var areaStream = {
|
|
18
|
+
point: _noop.default,
|
|
19
|
+
lineStart: _noop.default,
|
|
20
|
+
lineEnd: _noop.default,
|
|
21
|
+
polygonStart: function () {
|
|
22
|
+
areaStream.lineStart = areaRingStart;
|
|
23
|
+
areaStream.lineEnd = areaRingEnd;
|
|
24
|
+
},
|
|
25
|
+
polygonEnd: function () {
|
|
26
|
+
areaStream.lineStart = areaStream.lineEnd = areaStream.point = _noop.default;
|
|
27
|
+
areaSum.add((0, _math.abs)(areaRingSum));
|
|
28
|
+
areaRingSum = new _index.Adder();
|
|
29
|
+
},
|
|
30
|
+
result: function () {
|
|
31
|
+
var area = areaSum / 2;
|
|
32
|
+
areaSum = new _index.Adder();
|
|
33
|
+
return area;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
function areaRingStart() {
|
|
37
|
+
areaStream.point = areaPointFirst;
|
|
38
|
+
}
|
|
39
|
+
function areaPointFirst(x, y) {
|
|
40
|
+
areaStream.point = areaPoint;
|
|
41
|
+
x00 = x0 = x, y00 = y0 = y;
|
|
42
|
+
}
|
|
43
|
+
function areaPoint(x, y) {
|
|
44
|
+
areaRingSum.add(y0 * x - x0 * y);
|
|
45
|
+
x0 = x, y0 = y;
|
|
46
|
+
}
|
|
47
|
+
function areaRingEnd() {
|
|
48
|
+
areaPoint(x00, y00);
|
|
49
|
+
}
|
|
50
|
+
var _default = exports.default = areaStream;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _noop = _interopRequireDefault(require("../noop.js"));
|
|
9
|
+
var x0 = Infinity,
|
|
10
|
+
y0 = x0,
|
|
11
|
+
x1 = -x0,
|
|
12
|
+
y1 = x1;
|
|
13
|
+
var boundsStream = {
|
|
14
|
+
point: boundsPoint,
|
|
15
|
+
lineStart: _noop.default,
|
|
16
|
+
lineEnd: _noop.default,
|
|
17
|
+
polygonStart: _noop.default,
|
|
18
|
+
polygonEnd: _noop.default,
|
|
19
|
+
result: function () {
|
|
20
|
+
var bounds = [[x0, y0], [x1, y1]];
|
|
21
|
+
x1 = y1 = -(y0 = x0 = Infinity);
|
|
22
|
+
return bounds;
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
function boundsPoint(x, y) {
|
|
26
|
+
if (x < x0) x0 = x;
|
|
27
|
+
if (x > x1) x1 = x;
|
|
28
|
+
if (y < y0) y0 = y;
|
|
29
|
+
if (y > y1) y1 = y;
|
|
30
|
+
}
|
|
31
|
+
var _default = exports.default = boundsStream;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _math = require("../math.js");
|
|
8
|
+
// TODO Enforce positive area for exterior, negative area for interior?
|
|
9
|
+
|
|
10
|
+
var X0 = 0,
|
|
11
|
+
Y0 = 0,
|
|
12
|
+
Z0 = 0,
|
|
13
|
+
X1 = 0,
|
|
14
|
+
Y1 = 0,
|
|
15
|
+
Z1 = 0,
|
|
16
|
+
X2 = 0,
|
|
17
|
+
Y2 = 0,
|
|
18
|
+
Z2 = 0,
|
|
19
|
+
x00,
|
|
20
|
+
y00,
|
|
21
|
+
x0,
|
|
22
|
+
y0;
|
|
23
|
+
var centroidStream = {
|
|
24
|
+
point: centroidPoint,
|
|
25
|
+
lineStart: centroidLineStart,
|
|
26
|
+
lineEnd: centroidLineEnd,
|
|
27
|
+
polygonStart: function () {
|
|
28
|
+
centroidStream.lineStart = centroidRingStart;
|
|
29
|
+
centroidStream.lineEnd = centroidRingEnd;
|
|
30
|
+
},
|
|
31
|
+
polygonEnd: function () {
|
|
32
|
+
centroidStream.point = centroidPoint;
|
|
33
|
+
centroidStream.lineStart = centroidLineStart;
|
|
34
|
+
centroidStream.lineEnd = centroidLineEnd;
|
|
35
|
+
},
|
|
36
|
+
result: function () {
|
|
37
|
+
var centroid = Z2 ? [X2 / Z2, Y2 / Z2] : Z1 ? [X1 / Z1, Y1 / Z1] : Z0 ? [X0 / Z0, Y0 / Z0] : [NaN, NaN];
|
|
38
|
+
X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0;
|
|
39
|
+
return centroid;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
function centroidPoint(x, y) {
|
|
43
|
+
X0 += x;
|
|
44
|
+
Y0 += y;
|
|
45
|
+
++Z0;
|
|
46
|
+
}
|
|
47
|
+
function centroidLineStart() {
|
|
48
|
+
centroidStream.point = centroidPointFirstLine;
|
|
49
|
+
}
|
|
50
|
+
function centroidPointFirstLine(x, y) {
|
|
51
|
+
centroidStream.point = centroidPointLine;
|
|
52
|
+
centroidPoint(x0 = x, y0 = y);
|
|
53
|
+
}
|
|
54
|
+
function centroidPointLine(x, y) {
|
|
55
|
+
var dx = x - x0,
|
|
56
|
+
dy = y - y0,
|
|
57
|
+
z = (0, _math.sqrt)(dx * dx + dy * dy);
|
|
58
|
+
X1 += z * (x0 + x) / 2;
|
|
59
|
+
Y1 += z * (y0 + y) / 2;
|
|
60
|
+
Z1 += z;
|
|
61
|
+
centroidPoint(x0 = x, y0 = y);
|
|
62
|
+
}
|
|
63
|
+
function centroidLineEnd() {
|
|
64
|
+
centroidStream.point = centroidPoint;
|
|
65
|
+
}
|
|
66
|
+
function centroidRingStart() {
|
|
67
|
+
centroidStream.point = centroidPointFirstRing;
|
|
68
|
+
}
|
|
69
|
+
function centroidRingEnd() {
|
|
70
|
+
centroidPointRing(x00, y00);
|
|
71
|
+
}
|
|
72
|
+
function centroidPointFirstRing(x, y) {
|
|
73
|
+
centroidStream.point = centroidPointRing;
|
|
74
|
+
centroidPoint(x00 = x0 = x, y00 = y0 = y);
|
|
75
|
+
}
|
|
76
|
+
function centroidPointRing(x, y) {
|
|
77
|
+
var dx = x - x0,
|
|
78
|
+
dy = y - y0,
|
|
79
|
+
z = (0, _math.sqrt)(dx * dx + dy * dy);
|
|
80
|
+
X1 += z * (x0 + x) / 2;
|
|
81
|
+
Y1 += z * (y0 + y) / 2;
|
|
82
|
+
Z1 += z;
|
|
83
|
+
z = y0 * x - x0 * y;
|
|
84
|
+
X2 += z * (x0 + x);
|
|
85
|
+
Y2 += z * (y0 + y);
|
|
86
|
+
Z2 += z * 3;
|
|
87
|
+
centroidPoint(x0 = x, y0 = y);
|
|
88
|
+
}
|
|
89
|
+
var _default = exports.default = centroidStream;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = PathContext;
|
|
8
|
+
var _math = require("../math.js");
|
|
9
|
+
var _noop = _interopRequireDefault(require("../noop.js"));
|
|
10
|
+
function PathContext(context) {
|
|
11
|
+
this._context = context;
|
|
12
|
+
}
|
|
13
|
+
PathContext.prototype = {
|
|
14
|
+
_radius: 4.5,
|
|
15
|
+
pointRadius: function (_) {
|
|
16
|
+
return this._radius = _, this;
|
|
17
|
+
},
|
|
18
|
+
polygonStart: function () {
|
|
19
|
+
this._line = 0;
|
|
20
|
+
},
|
|
21
|
+
polygonEnd: function () {
|
|
22
|
+
this._line = NaN;
|
|
23
|
+
},
|
|
24
|
+
lineStart: function () {
|
|
25
|
+
this._point = 0;
|
|
26
|
+
},
|
|
27
|
+
lineEnd: function () {
|
|
28
|
+
if (this._line === 0) this._context.closePath();
|
|
29
|
+
this._point = NaN;
|
|
30
|
+
},
|
|
31
|
+
point: function (x, y) {
|
|
32
|
+
switch (this._point) {
|
|
33
|
+
case 0:
|
|
34
|
+
{
|
|
35
|
+
this._context.moveTo(x, y);
|
|
36
|
+
this._point = 1;
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
case 1:
|
|
40
|
+
{
|
|
41
|
+
this._context.lineTo(x, y);
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
default:
|
|
45
|
+
{
|
|
46
|
+
this._context.moveTo(x + this._radius, y);
|
|
47
|
+
this._context.arc(x, y, this._radius, 0, _math.tau);
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
result: _noop.default
|
|
53
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = _default;
|
|
8
|
+
var _identity = _interopRequireDefault(require("../identity.js"));
|
|
9
|
+
var _stream = _interopRequireDefault(require("../stream.js"));
|
|
10
|
+
var _area = _interopRequireDefault(require("./area.js"));
|
|
11
|
+
var _bounds = _interopRequireDefault(require("./bounds.js"));
|
|
12
|
+
var _centroid = _interopRequireDefault(require("./centroid.js"));
|
|
13
|
+
var _context = _interopRequireDefault(require("./context.js"));
|
|
14
|
+
var _measure = _interopRequireDefault(require("./measure.js"));
|
|
15
|
+
var _string = _interopRequireDefault(require("./string.js"));
|
|
16
|
+
function _default(projection, context) {
|
|
17
|
+
let digits = 3,
|
|
18
|
+
pointRadius = 4.5,
|
|
19
|
+
projectionStream,
|
|
20
|
+
contextStream;
|
|
21
|
+
function path(object) {
|
|
22
|
+
if (object) {
|
|
23
|
+
if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments));
|
|
24
|
+
(0, _stream.default)(object, projectionStream(contextStream));
|
|
25
|
+
}
|
|
26
|
+
return contextStream.result();
|
|
27
|
+
}
|
|
28
|
+
path.area = function (object) {
|
|
29
|
+
(0, _stream.default)(object, projectionStream(_area.default));
|
|
30
|
+
return _area.default.result();
|
|
31
|
+
};
|
|
32
|
+
path.measure = function (object) {
|
|
33
|
+
(0, _stream.default)(object, projectionStream(_measure.default));
|
|
34
|
+
return _measure.default.result();
|
|
35
|
+
};
|
|
36
|
+
path.bounds = function (object) {
|
|
37
|
+
(0, _stream.default)(object, projectionStream(_bounds.default));
|
|
38
|
+
return _bounds.default.result();
|
|
39
|
+
};
|
|
40
|
+
path.centroid = function (object) {
|
|
41
|
+
(0, _stream.default)(object, projectionStream(_centroid.default));
|
|
42
|
+
return _centroid.default.result();
|
|
43
|
+
};
|
|
44
|
+
path.projection = function (_) {
|
|
45
|
+
if (!arguments.length) return projection;
|
|
46
|
+
projectionStream = _ == null ? (projection = null, _identity.default) : (projection = _).stream;
|
|
47
|
+
return path;
|
|
48
|
+
};
|
|
49
|
+
path.context = function (_) {
|
|
50
|
+
if (!arguments.length) return context;
|
|
51
|
+
contextStream = _ == null ? (context = null, new _string.default(digits)) : new _context.default(context = _);
|
|
52
|
+
if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius);
|
|
53
|
+
return path;
|
|
54
|
+
};
|
|
55
|
+
path.pointRadius = function (_) {
|
|
56
|
+
if (!arguments.length) return pointRadius;
|
|
57
|
+
pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_);
|
|
58
|
+
return path;
|
|
59
|
+
};
|
|
60
|
+
path.digits = function (_) {
|
|
61
|
+
if (!arguments.length) return digits;
|
|
62
|
+
if (_ == null) digits = null;else {
|
|
63
|
+
const d = Math.floor(_);
|
|
64
|
+
if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`);
|
|
65
|
+
digits = d;
|
|
66
|
+
}
|
|
67
|
+
if (context === null) contextStream = new _string.default(digits);
|
|
68
|
+
return path;
|
|
69
|
+
};
|
|
70
|
+
return path.projection(projection).digits(digits).context(context);
|
|
71
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _index = require("../../../d3-array/src/index.js");
|
|
9
|
+
var _math = require("../math.js");
|
|
10
|
+
var _noop = _interopRequireDefault(require("../noop.js"));
|
|
11
|
+
var lengthSum = new _index.Adder(),
|
|
12
|
+
lengthRing,
|
|
13
|
+
x00,
|
|
14
|
+
y00,
|
|
15
|
+
x0,
|
|
16
|
+
y0;
|
|
17
|
+
var lengthStream = {
|
|
18
|
+
point: _noop.default,
|
|
19
|
+
lineStart: function () {
|
|
20
|
+
lengthStream.point = lengthPointFirst;
|
|
21
|
+
},
|
|
22
|
+
lineEnd: function () {
|
|
23
|
+
if (lengthRing) lengthPoint(x00, y00);
|
|
24
|
+
lengthStream.point = _noop.default;
|
|
25
|
+
},
|
|
26
|
+
polygonStart: function () {
|
|
27
|
+
lengthRing = true;
|
|
28
|
+
},
|
|
29
|
+
polygonEnd: function () {
|
|
30
|
+
lengthRing = null;
|
|
31
|
+
},
|
|
32
|
+
result: function () {
|
|
33
|
+
var length = +lengthSum;
|
|
34
|
+
lengthSum = new _index.Adder();
|
|
35
|
+
return length;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
function lengthPointFirst(x, y) {
|
|
39
|
+
lengthStream.point = lengthPoint;
|
|
40
|
+
x00 = x0 = x, y00 = y0 = y;
|
|
41
|
+
}
|
|
42
|
+
function lengthPoint(x, y) {
|
|
43
|
+
x0 -= x, y0 -= y;
|
|
44
|
+
lengthSum.add((0, _math.sqrt)(x0 * x0 + y0 * y0));
|
|
45
|
+
x0 = x, y0 = y;
|
|
46
|
+
}
|
|
47
|
+
var _default = exports.default = lengthStream;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
// Simple caching for constant-radius points.
|
|
8
|
+
let cacheDigits, cacheAppend, cacheRadius, cacheCircle;
|
|
9
|
+
class PathString {
|
|
10
|
+
constructor(digits) {
|
|
11
|
+
this._append = digits == null ? append : appendRound(digits);
|
|
12
|
+
this._radius = 4.5;
|
|
13
|
+
this._ = "";
|
|
14
|
+
}
|
|
15
|
+
pointRadius(_) {
|
|
16
|
+
this._radius = +_;
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
polygonStart() {
|
|
20
|
+
this._line = 0;
|
|
21
|
+
}
|
|
22
|
+
polygonEnd() {
|
|
23
|
+
this._line = NaN;
|
|
24
|
+
}
|
|
25
|
+
lineStart() {
|
|
26
|
+
this._point = 0;
|
|
27
|
+
}
|
|
28
|
+
lineEnd() {
|
|
29
|
+
if (this._line === 0) this._ += "Z";
|
|
30
|
+
this._point = NaN;
|
|
31
|
+
}
|
|
32
|
+
point(x, y) {
|
|
33
|
+
switch (this._point) {
|
|
34
|
+
case 0:
|
|
35
|
+
{
|
|
36
|
+
this._append`M${x},${y}`;
|
|
37
|
+
this._point = 1;
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
case 1:
|
|
41
|
+
{
|
|
42
|
+
this._append`L${x},${y}`;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
default:
|
|
46
|
+
{
|
|
47
|
+
this._append`M${x},${y}`;
|
|
48
|
+
if (this._radius !== cacheRadius || this._append !== cacheAppend) {
|
|
49
|
+
const r = this._radius;
|
|
50
|
+
const s = this._;
|
|
51
|
+
this._ = ""; // stash the old string so we can cache the circle path fragment
|
|
52
|
+
this._append`m0,${r}a${r},${r} 0 1,1 0,${-2 * r}a${r},${r} 0 1,1 0,${2 * r}z`;
|
|
53
|
+
cacheRadius = r;
|
|
54
|
+
cacheAppend = this._append;
|
|
55
|
+
cacheCircle = this._;
|
|
56
|
+
this._ = s;
|
|
57
|
+
}
|
|
58
|
+
this._ += cacheCircle;
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
result() {
|
|
64
|
+
const result = this._;
|
|
65
|
+
this._ = "";
|
|
66
|
+
return result.length ? result : null;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
exports.default = PathString;
|
|
70
|
+
function append(strings) {
|
|
71
|
+
let i = 1;
|
|
72
|
+
this._ += strings[0];
|
|
73
|
+
for (const j = strings.length; i < j; ++i) {
|
|
74
|
+
this._ += arguments[i] + strings[i];
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function appendRound(digits) {
|
|
78
|
+
const d = Math.floor(digits);
|
|
79
|
+
if (!(d >= 0)) throw new RangeError(`invalid digits: ${digits}`);
|
|
80
|
+
if (d > 15) return append;
|
|
81
|
+
if (d !== cacheDigits) {
|
|
82
|
+
const k = 10 ** d;
|
|
83
|
+
cacheDigits = d;
|
|
84
|
+
cacheAppend = function append(strings) {
|
|
85
|
+
let i = 1;
|
|
86
|
+
this._ += strings[0];
|
|
87
|
+
for (const j = strings.length; i < j; ++i) {
|
|
88
|
+
this._ += Math.round(arguments[i] * k) / k + strings[i];
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return cacheAppend;
|
|
93
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = _default;
|
|
7
|
+
var _math = require("./math.js");
|
|
8
|
+
function _default(a, b) {
|
|
9
|
+
return (0, _math.abs)(a[0] - b[0]) < _math.epsilon && (0, _math.abs)(a[1] - b[1]) < _math.epsilon;
|
|
10
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = _default;
|
|
7
|
+
var _index = require("../../d3-array/src/index.js");
|
|
8
|
+
var _cartesian = require("./cartesian.js");
|
|
9
|
+
var _math = require("./math.js");
|
|
10
|
+
function longitude(point) {
|
|
11
|
+
return (0, _math.abs)(point[0]) <= _math.pi ? point[0] : (0, _math.sign)(point[0]) * (((0, _math.abs)(point[0]) + _math.pi) % _math.tau - _math.pi);
|
|
12
|
+
}
|
|
13
|
+
function _default(polygon, point) {
|
|
14
|
+
var lambda = longitude(point),
|
|
15
|
+
phi = point[1],
|
|
16
|
+
sinPhi = (0, _math.sin)(phi),
|
|
17
|
+
normal = [(0, _math.sin)(lambda), -(0, _math.cos)(lambda), 0],
|
|
18
|
+
angle = 0,
|
|
19
|
+
winding = 0;
|
|
20
|
+
var sum = new _index.Adder();
|
|
21
|
+
if (sinPhi === 1) phi = _math.halfPi + _math.epsilon;else if (sinPhi === -1) phi = -_math.halfPi - _math.epsilon;
|
|
22
|
+
for (var i = 0, n = polygon.length; i < n; ++i) {
|
|
23
|
+
if (!(m = (ring = polygon[i]).length)) continue;
|
|
24
|
+
var ring,
|
|
25
|
+
m,
|
|
26
|
+
point0 = ring[m - 1],
|
|
27
|
+
lambda0 = longitude(point0),
|
|
28
|
+
phi0 = point0[1] / 2 + _math.quarterPi,
|
|
29
|
+
sinPhi0 = (0, _math.sin)(phi0),
|
|
30
|
+
cosPhi0 = (0, _math.cos)(phi0);
|
|
31
|
+
for (var j = 0; j < m; ++j, lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1) {
|
|
32
|
+
var point1 = ring[j],
|
|
33
|
+
lambda1 = longitude(point1),
|
|
34
|
+
phi1 = point1[1] / 2 + _math.quarterPi,
|
|
35
|
+
sinPhi1 = (0, _math.sin)(phi1),
|
|
36
|
+
cosPhi1 = (0, _math.cos)(phi1),
|
|
37
|
+
delta = lambda1 - lambda0,
|
|
38
|
+
sign = delta >= 0 ? 1 : -1,
|
|
39
|
+
absDelta = sign * delta,
|
|
40
|
+
antimeridian = absDelta > _math.pi,
|
|
41
|
+
k = sinPhi0 * sinPhi1;
|
|
42
|
+
sum.add((0, _math.atan2)(k * sign * (0, _math.sin)(absDelta), cosPhi0 * cosPhi1 + k * (0, _math.cos)(absDelta)));
|
|
43
|
+
angle += antimeridian ? delta + sign * _math.tau : delta;
|
|
44
|
+
|
|
45
|
+
// Are the longitudes either side of the point’s meridian (lambda),
|
|
46
|
+
// and are the latitudes smaller than the parallel (phi)?
|
|
47
|
+
if (antimeridian ^ lambda0 >= lambda ^ lambda1 >= lambda) {
|
|
48
|
+
var arc = (0, _cartesian.cartesianCross)((0, _cartesian.cartesian)(point0), (0, _cartesian.cartesian)(point1));
|
|
49
|
+
(0, _cartesian.cartesianNormalizeInPlace)(arc);
|
|
50
|
+
var intersection = (0, _cartesian.cartesianCross)(normal, arc);
|
|
51
|
+
(0, _cartesian.cartesianNormalizeInPlace)(intersection);
|
|
52
|
+
var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * (0, _math.asin)(intersection[2]);
|
|
53
|
+
if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) {
|
|
54
|
+
winding += antimeridian ^ delta >= 0 ? 1 : -1;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// First, determine whether the South pole is inside or outside:
|
|
61
|
+
//
|
|
62
|
+
// It is inside if:
|
|
63
|
+
// * the polygon winds around it in a clockwise direction.
|
|
64
|
+
// * the polygon does not (cumulatively) wind around it, but has a negative
|
|
65
|
+
// (counter-clockwise) area.
|
|
66
|
+
//
|
|
67
|
+
// Second, count the (signed) number of times a segment crosses a lambda
|
|
68
|
+
// from the point to the South pole. If it is zero, then the point is the
|
|
69
|
+
// same side as the South pole.
|
|
70
|
+
|
|
71
|
+
return (angle < -_math.epsilon || angle < _math.epsilon && sum < -_math.epsilon2) ^ winding & 1;
|
|
72
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = _default;
|
|
8
|
+
var _conicEqualArea = _interopRequireDefault(require("./conicEqualArea.js"));
|
|
9
|
+
function _default() {
|
|
10
|
+
return (0, _conicEqualArea.default)().parallels([29.5, 45.5]).scale(1070).translate([480, 250]).rotate([96, 0]).center([-0.6, 38.7]);
|
|
11
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = _default;
|
|
8
|
+
var _math = require("../math.js");
|
|
9
|
+
var _albers = _interopRequireDefault(require("./albers.js"));
|
|
10
|
+
var _conicEqualArea = _interopRequireDefault(require("./conicEqualArea.js"));
|
|
11
|
+
var _fit = require("./fit.js");
|
|
12
|
+
// The projections must have mutually exclusive clip regions on the sphere,
|
|
13
|
+
// as this will avoid emitting interleaving lines and polygons.
|
|
14
|
+
function multiplex(streams) {
|
|
15
|
+
var n = streams.length;
|
|
16
|
+
return {
|
|
17
|
+
point: function (x, y) {
|
|
18
|
+
var i = -1;
|
|
19
|
+
while (++i < n) streams[i].point(x, y);
|
|
20
|
+
},
|
|
21
|
+
sphere: function () {
|
|
22
|
+
var i = -1;
|
|
23
|
+
while (++i < n) streams[i].sphere();
|
|
24
|
+
},
|
|
25
|
+
lineStart: function () {
|
|
26
|
+
var i = -1;
|
|
27
|
+
while (++i < n) streams[i].lineStart();
|
|
28
|
+
},
|
|
29
|
+
lineEnd: function () {
|
|
30
|
+
var i = -1;
|
|
31
|
+
while (++i < n) streams[i].lineEnd();
|
|
32
|
+
},
|
|
33
|
+
polygonStart: function () {
|
|
34
|
+
var i = -1;
|
|
35
|
+
while (++i < n) streams[i].polygonStart();
|
|
36
|
+
},
|
|
37
|
+
polygonEnd: function () {
|
|
38
|
+
var i = -1;
|
|
39
|
+
while (++i < n) streams[i].polygonEnd();
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// A composite projection for the United States, configured by default for
|
|
45
|
+
// 960×500. The projection also works quite well at 960×600 if you change the
|
|
46
|
+
// scale to 1285 and adjust the translate accordingly. The set of standard
|
|
47
|
+
// parallels for each region comes from USGS, which is published here:
|
|
48
|
+
// http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers
|
|
49
|
+
function _default() {
|
|
50
|
+
var cache,
|
|
51
|
+
cacheStream,
|
|
52
|
+
lower48 = (0, _albers.default)(),
|
|
53
|
+
lower48Point,
|
|
54
|
+
alaska = (0, _conicEqualArea.default)().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]),
|
|
55
|
+
alaskaPoint,
|
|
56
|
+
// EPSG:3338
|
|
57
|
+
hawaii = (0, _conicEqualArea.default)().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]),
|
|
58
|
+
hawaiiPoint,
|
|
59
|
+
// ESRI:102007
|
|
60
|
+
point,
|
|
61
|
+
pointStream = {
|
|
62
|
+
point: function (x, y) {
|
|
63
|
+
point = [x, y];
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
function albersUsa(coordinates) {
|
|
67
|
+
var x = coordinates[0],
|
|
68
|
+
y = coordinates[1];
|
|
69
|
+
return point = null, (lower48Point.point(x, y), point) || (alaskaPoint.point(x, y), point) || (hawaiiPoint.point(x, y), point);
|
|
70
|
+
}
|
|
71
|
+
albersUsa.invert = function (coordinates) {
|
|
72
|
+
var k = lower48.scale(),
|
|
73
|
+
t = lower48.translate(),
|
|
74
|
+
x = (coordinates[0] - t[0]) / k,
|
|
75
|
+
y = (coordinates[1] - t[1]) / k;
|
|
76
|
+
return (y >= 0.120 && y < 0.234 && x >= -0.425 && x < -0.214 ? alaska : y >= 0.166 && y < 0.234 && x >= -0.214 && x < -0.115 ? hawaii : lower48).invert(coordinates);
|
|
77
|
+
};
|
|
78
|
+
albersUsa.stream = function (stream) {
|
|
79
|
+
return cache && cacheStream === stream ? cache : cache = multiplex([lower48.stream(cacheStream = stream), alaska.stream(stream), hawaii.stream(stream)]);
|
|
80
|
+
};
|
|
81
|
+
albersUsa.precision = function (_) {
|
|
82
|
+
if (!arguments.length) return lower48.precision();
|
|
83
|
+
lower48.precision(_), alaska.precision(_), hawaii.precision(_);
|
|
84
|
+
return reset();
|
|
85
|
+
};
|
|
86
|
+
albersUsa.scale = function (_) {
|
|
87
|
+
if (!arguments.length) return lower48.scale();
|
|
88
|
+
lower48.scale(_), alaska.scale(_ * 0.35), hawaii.scale(_);
|
|
89
|
+
return albersUsa.translate(lower48.translate());
|
|
90
|
+
};
|
|
91
|
+
albersUsa.translate = function (_) {
|
|
92
|
+
if (!arguments.length) return lower48.translate();
|
|
93
|
+
var k = lower48.scale(),
|
|
94
|
+
x = +_[0],
|
|
95
|
+
y = +_[1];
|
|
96
|
+
lower48Point = lower48.translate(_).clipExtent([[x - 0.455 * k, y - 0.238 * k], [x + 0.455 * k, y + 0.238 * k]]).stream(pointStream);
|
|
97
|
+
alaskaPoint = alaska.translate([x - 0.307 * k, y + 0.201 * k]).clipExtent([[x - 0.425 * k + _math.epsilon, y + 0.120 * k + _math.epsilon], [x - 0.214 * k - _math.epsilon, y + 0.234 * k - _math.epsilon]]).stream(pointStream);
|
|
98
|
+
hawaiiPoint = hawaii.translate([x - 0.205 * k, y + 0.212 * k]).clipExtent([[x - 0.214 * k + _math.epsilon, y + 0.166 * k + _math.epsilon], [x - 0.115 * k - _math.epsilon, y + 0.234 * k - _math.epsilon]]).stream(pointStream);
|
|
99
|
+
return reset();
|
|
100
|
+
};
|
|
101
|
+
albersUsa.fitExtent = function (extent, object) {
|
|
102
|
+
return (0, _fit.fitExtent)(albersUsa, extent, object);
|
|
103
|
+
};
|
|
104
|
+
albersUsa.fitSize = function (size, object) {
|
|
105
|
+
return (0, _fit.fitSize)(albersUsa, size, object);
|
|
106
|
+
};
|
|
107
|
+
albersUsa.fitWidth = function (width, object) {
|
|
108
|
+
return (0, _fit.fitWidth)(albersUsa, width, object);
|
|
109
|
+
};
|
|
110
|
+
albersUsa.fitHeight = function (height, object) {
|
|
111
|
+
return (0, _fit.fitHeight)(albersUsa, height, object);
|
|
112
|
+
};
|
|
113
|
+
function reset() {
|
|
114
|
+
cache = cacheStream = null;
|
|
115
|
+
return albersUsa;
|
|
116
|
+
}
|
|
117
|
+
return albersUsa.scale(1070);
|
|
118
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.azimuthalInvert = azimuthalInvert;
|
|
7
|
+
exports.azimuthalRaw = azimuthalRaw;
|
|
8
|
+
var _math = require("../math.js");
|
|
9
|
+
function azimuthalRaw(scale) {
|
|
10
|
+
return function (x, y) {
|
|
11
|
+
var cx = (0, _math.cos)(x),
|
|
12
|
+
cy = (0, _math.cos)(y),
|
|
13
|
+
k = scale(cx * cy);
|
|
14
|
+
if (k === Infinity) return [2, 0];
|
|
15
|
+
return [k * cy * (0, _math.sin)(x), k * (0, _math.sin)(y)];
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
function azimuthalInvert(angle) {
|
|
19
|
+
return function (x, y) {
|
|
20
|
+
var z = (0, _math.sqrt)(x * x + y * y),
|
|
21
|
+
c = angle(z),
|
|
22
|
+
sc = (0, _math.sin)(c),
|
|
23
|
+
cc = (0, _math.cos)(c);
|
|
24
|
+
return [(0, _math.atan2)(x * sc, z * cc), (0, _math.asin)(z && y * sc / z)];
|
|
25
|
+
};
|
|
26
|
+
}
|