@turf/ellipse 6.4.0 → 7.0.0-alpha.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/README.md CHANGED
@@ -6,19 +6,20 @@
6
6
 
7
7
  Takes a [Point][1] and calculates the ellipse polygon given two semi-axes expressed in variable units and steps for precision.
8
8
 
9
- **Parameters**
9
+ ### Parameters
10
10
 
11
- - `center` **[Coord][2]** center point
12
- - `xSemiAxis` **[number][3]** semi (major) axis of the ellipse along the x-axis
13
- - `ySemiAxis` **[number][3]** semi (minor) axis of the ellipse along the y-axis
14
- - `options` **[Object][4]** Optional parameters (optional, default `{}`)
15
- - `options.angle` **[number][3]** angle of rotation (along the vertical axis), from North in decimal degrees, negative clockwise (optional, default `0`)
16
- - `options.pivot` **[Coord][2]** point around which the rotation will be performed (optional, default `'origin'`)
17
- - `options.steps` **[number][3]** number of steps (optional, default `64`)
18
- - `options.units` **[string][5]** unit of measurement for axes (optional, default `'kilometers'`)
19
- - `options.properties` **[Object][4]** properties (optional, default `{}`)
11
+ * `center` **[Coord][2]** center point
12
+ * `xSemiAxis` **[number][3]** semi (major) axis of the ellipse along the x-axis
13
+ * `ySemiAxis` **[number][3]** semi (minor) axis of the ellipse along the y-axis
14
+ * `options` **[Object][4]** Optional parameters (optional, default `{}`)
20
15
 
21
- **Examples**
16
+ * `options.angle` **[number][3]** angle of rotation in decimal degrees, positive clockwise (optional, default `0`)
17
+ * `options.pivot` **[Coord][2]** point around which the rotation will be performed (optional, default `'origin'`)
18
+ * `options.steps` **[number][3]** number of steps (optional, default `64`)
19
+ * `options.units` **[string][5]** unit of measurement for axes (optional, default `'kilometers'`)
20
+ * `options.properties` **[Object][4]** properties (optional, default `{}`)
21
+
22
+ ### Examples
22
23
 
23
24
  ```javascript
24
25
  var center = [-75, 40];
@@ -30,7 +31,7 @@ var ellipse = turf.ellipse(center, xSemiAxis, ySemiAxis);
30
31
  var addToMap = [turf.point(center), ellipse]
31
32
  ```
32
33
 
33
- Returns **[Feature][6]<[Polygon][7]>** ellipse polygon
34
+ Returns **[Feature][6]<[Polygon][7]>** ellipse polygon
34
35
 
35
36
  [1]: https://tools.ietf.org/html/rfc7946#section-3.1.2
36
37
 
package/dist/es/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { degreesToRadians, polygon, isObject, isNumber } from '@turf/helpers';
1
+ import { isObject, isNumber, degreesToRadians, polygon } from '@turf/helpers';
2
2
  import rhumbDestination from '@turf/rhumb-destination';
3
3
  import transformRotate from '@turf/transform-rotate';
4
4
  import { getCoord } from '@turf/invariant';
package/dist/js/index.js CHANGED
@@ -1,12 +1,15 @@
1
1
  'use strict';
2
2
 
3
- function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
4
-
5
3
  var helpers = require('@turf/helpers');
6
- var rhumbDestination = _interopDefault(require('@turf/rhumb-destination'));
7
- var transformRotate = _interopDefault(require('@turf/transform-rotate'));
4
+ var rhumbDestination = require('@turf/rhumb-destination');
5
+ var transformRotate = require('@turf/transform-rotate');
8
6
  var invariant = require('@turf/invariant');
9
7
 
8
+ function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
9
+
10
+ var rhumbDestination__default = /*#__PURE__*/_interopDefaultLegacy(rhumbDestination);
11
+ var transformRotate__default = /*#__PURE__*/_interopDefaultLegacy(transformRotate);
12
+
10
13
  /**
11
14
  * Takes a {@link Point} and calculates the ellipse polygon given two semi-axes expressed in variable units and steps for precision.
12
15
  *
@@ -50,8 +53,8 @@ function ellipse(center, xSemiAxis, ySemiAxis, options) {
50
53
  if (units === "degrees") {
51
54
  var angleRad = helpers.degreesToRadians(angle);
52
55
  } else {
53
- xSemiAxis = rhumbDestination(center, xSemiAxis, 90, { units: units });
54
- ySemiAxis = rhumbDestination(center, ySemiAxis, 0, { units: units });
56
+ xSemiAxis = rhumbDestination__default['default'](center, xSemiAxis, 90, { units: units });
57
+ ySemiAxis = rhumbDestination__default['default'](center, ySemiAxis, 0, { units: units });
55
58
  xSemiAxis = invariant.getCoord(xSemiAxis)[0] - centerCoords[0];
56
59
  ySemiAxis = invariant.getCoord(ySemiAxis)[1] - centerCoords[1];
57
60
  }
@@ -87,7 +90,7 @@ function ellipse(center, xSemiAxis, ySemiAxis, options) {
87
90
  if (units === "degrees") {
88
91
  return helpers.polygon([coordinates], properties);
89
92
  } else {
90
- return transformRotate(helpers.polygon([coordinates], properties), angle, {
93
+ return transformRotate__default['default'](helpers.polygon([coordinates], properties), angle, {
91
94
  pivot: pivot,
92
95
  });
93
96
  }
@@ -106,3 +109,4 @@ function getTanDeg(deg) {
106
109
  }
107
110
 
108
111
  module.exports = ellipse;
112
+ module.exports.default = ellipse;
package/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import { Feature, Coord, Polygon, Units, Properties } from "@turf/helpers";
1
+ import { Feature, Polygon, GeoJsonProperties } from "geojson";
2
+ import { Coord, Units } from "@turf/helpers";
2
3
 
3
4
  /**
4
5
  * http://turfjs.org/docs/#ellipse
@@ -8,8 +9,21 @@ export default function (
8
9
  xSemiAxis: number,
9
10
  ySemiAxis: number,
10
11
  options?: {
12
+ /** default 64 */
11
13
  steps?: number;
14
+ /** default kilometers */
12
15
  units?: Units;
13
- properties?: Properties;
16
+ properties?: GeoJsonProperties;
17
+ /**
18
+ * Angle of rotation in decimal degrees, positive clockwise
19
+ * default 0
20
+ */
21
+ angle?: number;
22
+
23
+ /**
24
+ * point around which the rotation will be performed
25
+ * default is the point specified by center
26
+ */
27
+ pivot?: Coord;
14
28
  }
15
29
  ): Feature<Polygon>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@turf/ellipse",
3
- "version": "6.4.0",
3
+ "version": "7.0.0-alpha.0",
4
4
  "description": "turf ellipse module",
5
5
  "author": "Turf Authors",
6
6
  "contributors": [
@@ -15,6 +15,7 @@
15
15
  "type": "git",
16
16
  "url": "git://github.com/Turfjs/turf.git"
17
17
  },
18
+ "funding": "https://opencollective.com/turf",
18
19
  "publishConfig": {
19
20
  "access": "public"
20
21
  },
@@ -46,10 +47,10 @@
46
47
  },
47
48
  "devDependencies": {
48
49
  "@mapbox/geojsonhint": "*",
49
- "@turf/bbox-polygon": "^6.4.0",
50
- "@turf/circle": "^6.4.0",
51
- "@turf/destination": "^6.4.0",
52
- "@turf/truncate": "^6.4.0",
50
+ "@turf/bbox-polygon": "^7.0.0-alpha.0",
51
+ "@turf/circle": "^7.0.0-alpha.0",
52
+ "@turf/destination": "^7.0.0-alpha.0",
53
+ "@turf/truncate": "^7.0.0-alpha.0",
53
54
  "benchmark": "*",
54
55
  "glob": "*",
55
56
  "load-json-file": "*",
@@ -59,10 +60,10 @@
59
60
  "write-json-file": "*"
60
61
  },
61
62
  "dependencies": {
62
- "@turf/helpers": "^6.4.0",
63
- "@turf/invariant": "^6.4.0",
64
- "@turf/rhumb-destination": "^6.4.0",
65
- "@turf/transform-rotate": "^6.4.0"
63
+ "@turf/helpers": "^7.0.0-alpha.0",
64
+ "@turf/invariant": "^7.0.0-alpha.0",
65
+ "@turf/rhumb-destination": "^7.0.0-alpha.0",
66
+ "@turf/transform-rotate": "^7.0.0-alpha.0"
66
67
  },
67
- "gitHead": "1e62773cfc88c627cca8effcb5c14cfb65a905ac"
68
+ "gitHead": "0edc4c491b999e5ace770a61e1cf549f7c004189"
68
69
  }