@turf/transform-rotate 7.0.0 → 7.1.0-alpha.7
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/dist/cjs/index.cjs +1 -5
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +0 -4
- package/dist/esm/index.js.map +1 -1
- package/package.json +11 -11
package/dist/cjs/index.cjs
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true})
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
|
-
// index.js
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// index.js
|
|
5
2
|
var _centroid = require('@turf/centroid');
|
|
6
3
|
var _rhumbbearing = require('@turf/rhumb-bearing');
|
|
7
4
|
var _rhumbdistance = require('@turf/rhumb-distance');
|
|
@@ -36,7 +33,6 @@ function transformRotate(geojson, angle, options) {
|
|
|
36
33
|
});
|
|
37
34
|
return geojson;
|
|
38
35
|
}
|
|
39
|
-
__name(transformRotate, "transformRotate");
|
|
40
36
|
var turf_transform_rotate_default = transformRotate;
|
|
41
37
|
|
|
42
38
|
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../index.js"],"names":[],"mappings":";AAAA,SAAS,gBAAgB;AACzB,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,SAAS,wBAAwB;AACjC,SAAS,aAAa;AACtB,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AAqBzB,SAAS,gBAAgB,SAAS,OAAO,SAAS;AAEhD,YAAU,WAAW,CAAC;AACtB,MAAI,CAAC,SAAS,OAAO;AAAG,UAAM,IAAI,MAAM,oBAAoB;AAC5D,MAAI,QAAQ,QAAQ;AACpB,MAAI,SAAS,QAAQ;AAGrB,MAAI,CAAC;AAAS,UAAM,IAAI,MAAM,qBAAqB;AACnD,MAAI,UAAU,UAAa,UAAU,QAAQ,MAAM,KAAK;AACtD,UAAM,IAAI,MAAM,mBAAmB;AAGrC,MAAI,UAAU;AAAG,WAAO;AAGxB,MAAI,CAAC;AAAO,YAAQ,SAAS,OAAO;AAGpC,MAAI,WAAW,SAAS,WAAW;AAAW,cAAU,MAAM,OAAO;AAGrE,YAAU,SAAS,SAAU,aAAa;AACxC,QAAI,eAAe,aAAa,OAAO,WAAW;AAClD,QAAI,aAAa,eAAe;AAChC,QAAI,WAAW,cAAc,OAAO,WAAW;AAC/C,QAAI,YAAY,UAAU,iBAAiB,OAAO,UAAU,UAAU,CAAC;AACvE,gBAAY,CAAC,IAAI,UAAU,CAAC;AAC5B,gBAAY,CAAC,IAAI,UAAU,CAAC;AAAA,EAC9B,CAAC;AACD,SAAO;AACT;AAGA,IAAO,gCAAQ","sourcesContent":["import { centroid } from \"@turf/centroid\";\nimport { rhumbBearing } from \"@turf/rhumb-bearing\";\nimport { rhumbDistance } from \"@turf/rhumb-distance\";\nimport { rhumbDestination } from \"@turf/rhumb-destination\";\nimport { clone } from \"@turf/clone\";\nimport { coordEach } from \"@turf/meta\";\nimport { getCoords } from \"@turf/invariant\";\nimport { isObject } from \"@turf/helpers\";\n\n/**\n * Rotates any geojson Feature or Geometry of a specified angle, around its `centroid` or a given `pivot` point.\n *\n * @name transformRotate\n * @param {GeoJSON} geojson object to be rotated\n * @param {number} angle of rotation in decimal degrees, positive clockwise\n * @param {Object} [options={}] Optional parameters\n * @param {Coord} [options.pivot='centroid'] point around which the rotation will be performed\n * @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true)\n * @returns {GeoJSON} the rotated GeoJSON feature\n * @example\n * var poly = turf.polygon([[[0,29],[3.5,29],[2.5,32],[0,29]]]);\n * var options = {pivot: [0, 25]};\n * var rotatedPoly = turf.transformRotate(poly, 10, options);\n *\n * //addToMap\n * var addToMap = [poly, rotatedPoly];\n * rotatedPoly.properties = {stroke: '#F00', 'stroke-width': 4};\n */\nfunction transformRotate(geojson, angle, options) {\n // Optional parameters\n options = options || {};\n if (!isObject(options)) throw new Error(\"options is invalid\");\n var pivot = options.pivot;\n var mutate = options.mutate;\n\n // Input validation\n if (!geojson) throw new Error(\"geojson is required\");\n if (angle === undefined || angle === null || isNaN(angle))\n throw new Error(\"angle is required\");\n\n // Shortcut no-rotation\n if (angle === 0) return geojson;\n\n // Use centroid of GeoJSON if pivot is not provided\n if (!pivot) pivot = centroid(geojson);\n\n // Clone geojson to avoid side effects\n if (mutate === false || mutate === undefined) geojson = clone(geojson);\n\n // Rotate each coordinate\n coordEach(geojson, function (pointCoords) {\n var initialAngle = rhumbBearing(pivot, pointCoords);\n var finalAngle = initialAngle + angle;\n var distance = rhumbDistance(pivot, pointCoords);\n var newCoords = getCoords(rhumbDestination(pivot, distance, finalAngle));\n pointCoords[0] = newCoords[0];\n pointCoords[1] = newCoords[1];\n });\n return geojson;\n}\n\nexport { transformRotate };\nexport default transformRotate;\n"]}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
var __defProp = Object.defineProperty;
|
|
2
|
-
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
|
-
|
|
4
1
|
// index.js
|
|
5
2
|
import { centroid } from "@turf/centroid";
|
|
6
3
|
import { rhumbBearing } from "@turf/rhumb-bearing";
|
|
@@ -36,7 +33,6 @@ function transformRotate(geojson, angle, options) {
|
|
|
36
33
|
});
|
|
37
34
|
return geojson;
|
|
38
35
|
}
|
|
39
|
-
__name(transformRotate, "transformRotate");
|
|
40
36
|
var turf_transform_rotate_default = transformRotate;
|
|
41
37
|
export {
|
|
42
38
|
turf_transform_rotate_default as default,
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.js"],"sourcesContent":["import { centroid } from \"@turf/centroid\";\nimport { rhumbBearing } from \"@turf/rhumb-bearing\";\nimport { rhumbDistance } from \"@turf/rhumb-distance\";\nimport { rhumbDestination } from \"@turf/rhumb-destination\";\nimport { clone } from \"@turf/clone\";\nimport { coordEach } from \"@turf/meta\";\nimport { getCoords } from \"@turf/invariant\";\nimport { isObject } from \"@turf/helpers\";\n\n/**\n * Rotates any geojson Feature or Geometry of a specified angle, around its `centroid` or a given `pivot` point.\n *\n * @name transformRotate\n * @param {GeoJSON} geojson object to be rotated\n * @param {number} angle of rotation in decimal degrees, positive clockwise\n * @param {Object} [options={}] Optional parameters\n * @param {Coord} [options.pivot='centroid'] point around which the rotation will be performed\n * @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true)\n * @returns {GeoJSON} the rotated GeoJSON feature\n * @example\n * var poly = turf.polygon([[[0,29],[3.5,29],[2.5,32],[0,29]]]);\n * var options = {pivot: [0, 25]};\n * var rotatedPoly = turf.transformRotate(poly, 10, options);\n *\n * //addToMap\n * var addToMap = [poly, rotatedPoly];\n * rotatedPoly.properties = {stroke: '#F00', 'stroke-width': 4};\n */\nfunction transformRotate(geojson, angle, options) {\n // Optional parameters\n options = options || {};\n if (!isObject(options)) throw new Error(\"options is invalid\");\n var pivot = options.pivot;\n var mutate = options.mutate;\n\n // Input validation\n if (!geojson) throw new Error(\"geojson is required\");\n if (angle === undefined || angle === null || isNaN(angle))\n throw new Error(\"angle is required\");\n\n // Shortcut no-rotation\n if (angle === 0) return geojson;\n\n // Use centroid of GeoJSON if pivot is not provided\n if (!pivot) pivot = centroid(geojson);\n\n // Clone geojson to avoid side effects\n if (mutate === false || mutate === undefined) geojson = clone(geojson);\n\n // Rotate each coordinate\n coordEach(geojson, function (pointCoords) {\n var initialAngle = rhumbBearing(pivot, pointCoords);\n var finalAngle = initialAngle + angle;\n var distance = rhumbDistance(pivot, pointCoords);\n var newCoords = getCoords(rhumbDestination(pivot, distance, finalAngle));\n pointCoords[0] = newCoords[0];\n pointCoords[1] = newCoords[1];\n });\n return geojson;\n}\n\nexport { transformRotate };\nexport default transformRotate;\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../index.js"],"sourcesContent":["import { centroid } from \"@turf/centroid\";\nimport { rhumbBearing } from \"@turf/rhumb-bearing\";\nimport { rhumbDistance } from \"@turf/rhumb-distance\";\nimport { rhumbDestination } from \"@turf/rhumb-destination\";\nimport { clone } from \"@turf/clone\";\nimport { coordEach } from \"@turf/meta\";\nimport { getCoords } from \"@turf/invariant\";\nimport { isObject } from \"@turf/helpers\";\n\n/**\n * Rotates any geojson Feature or Geometry of a specified angle, around its `centroid` or a given `pivot` point.\n *\n * @name transformRotate\n * @param {GeoJSON} geojson object to be rotated\n * @param {number} angle of rotation in decimal degrees, positive clockwise\n * @param {Object} [options={}] Optional parameters\n * @param {Coord} [options.pivot='centroid'] point around which the rotation will be performed\n * @param {boolean} [options.mutate=false] allows GeoJSON input to be mutated (significant performance increase if true)\n * @returns {GeoJSON} the rotated GeoJSON feature\n * @example\n * var poly = turf.polygon([[[0,29],[3.5,29],[2.5,32],[0,29]]]);\n * var options = {pivot: [0, 25]};\n * var rotatedPoly = turf.transformRotate(poly, 10, options);\n *\n * //addToMap\n * var addToMap = [poly, rotatedPoly];\n * rotatedPoly.properties = {stroke: '#F00', 'stroke-width': 4};\n */\nfunction transformRotate(geojson, angle, options) {\n // Optional parameters\n options = options || {};\n if (!isObject(options)) throw new Error(\"options is invalid\");\n var pivot = options.pivot;\n var mutate = options.mutate;\n\n // Input validation\n if (!geojson) throw new Error(\"geojson is required\");\n if (angle === undefined || angle === null || isNaN(angle))\n throw new Error(\"angle is required\");\n\n // Shortcut no-rotation\n if (angle === 0) return geojson;\n\n // Use centroid of GeoJSON if pivot is not provided\n if (!pivot) pivot = centroid(geojson);\n\n // Clone geojson to avoid side effects\n if (mutate === false || mutate === undefined) geojson = clone(geojson);\n\n // Rotate each coordinate\n coordEach(geojson, function (pointCoords) {\n var initialAngle = rhumbBearing(pivot, pointCoords);\n var finalAngle = initialAngle + angle;\n var distance = rhumbDistance(pivot, pointCoords);\n var newCoords = getCoords(rhumbDestination(pivot, distance, finalAngle));\n pointCoords[0] = newCoords[0];\n pointCoords[1] = newCoords[1];\n });\n return geojson;\n}\n\nexport { transformRotate };\nexport default transformRotate;\n"],"mappings":";AAAA,SAAS,gBAAgB;AACzB,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,SAAS,wBAAwB;AACjC,SAAS,aAAa;AACtB,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB;AAqBzB,SAAS,gBAAgB,SAAS,OAAO,SAAS;AAEhD,YAAU,WAAW,CAAC;AACtB,MAAI,CAAC,SAAS,OAAO;AAAG,UAAM,IAAI,MAAM,oBAAoB;AAC5D,MAAI,QAAQ,QAAQ;AACpB,MAAI,SAAS,QAAQ;AAGrB,MAAI,CAAC;AAAS,UAAM,IAAI,MAAM,qBAAqB;AACnD,MAAI,UAAU,UAAa,UAAU,QAAQ,MAAM,KAAK;AACtD,UAAM,IAAI,MAAM,mBAAmB;AAGrC,MAAI,UAAU;AAAG,WAAO;AAGxB,MAAI,CAAC;AAAO,YAAQ,SAAS,OAAO;AAGpC,MAAI,WAAW,SAAS,WAAW;AAAW,cAAU,MAAM,OAAO;AAGrE,YAAU,SAAS,SAAU,aAAa;AACxC,QAAI,eAAe,aAAa,OAAO,WAAW;AAClD,QAAI,aAAa,eAAe;AAChC,QAAI,WAAW,cAAc,OAAO,WAAW;AAC/C,QAAI,YAAY,UAAU,iBAAiB,OAAO,UAAU,UAAU,CAAC;AACvE,gBAAY,CAAC,IAAI,UAAU,CAAC;AAC5B,gBAAY,CAAC,IAAI,UAAU,CAAC;AAAA,EAC9B,CAAC;AACD,SAAO;AACT;AAGA,IAAO,gCAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/transform-rotate",
|
|
3
|
-
"version": "7.0.
|
|
3
|
+
"version": "7.1.0-alpha.7+0ce6ecca0",
|
|
4
4
|
"description": "turf transform-rotate module",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"contributors": [
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@turf/truncate": "^7.0.
|
|
59
|
+
"@turf/truncate": "^7.1.0-alpha.7+0ce6ecca0",
|
|
60
60
|
"@types/benchmark": "^2.1.5",
|
|
61
61
|
"@types/tape": "^4.2.32",
|
|
62
62
|
"benchmark": "^2.1.4",
|
|
@@ -68,14 +68,14 @@
|
|
|
68
68
|
"write-json-file": "^5.0.0"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@turf/centroid": "^7.0.
|
|
72
|
-
"@turf/clone": "^7.0.
|
|
73
|
-
"@turf/helpers": "^7.0.
|
|
74
|
-
"@turf/invariant": "^7.0.
|
|
75
|
-
"@turf/meta": "^7.0.
|
|
76
|
-
"@turf/rhumb-bearing": "^7.0.
|
|
77
|
-
"@turf/rhumb-destination": "^7.0.
|
|
78
|
-
"@turf/rhumb-distance": "^7.0.
|
|
71
|
+
"@turf/centroid": "^7.1.0-alpha.7+0ce6ecca0",
|
|
72
|
+
"@turf/clone": "^7.1.0-alpha.7+0ce6ecca0",
|
|
73
|
+
"@turf/helpers": "^7.1.0-alpha.7+0ce6ecca0",
|
|
74
|
+
"@turf/invariant": "^7.1.0-alpha.7+0ce6ecca0",
|
|
75
|
+
"@turf/meta": "^7.1.0-alpha.7+0ce6ecca0",
|
|
76
|
+
"@turf/rhumb-bearing": "^7.1.0-alpha.7+0ce6ecca0",
|
|
77
|
+
"@turf/rhumb-destination": "^7.1.0-alpha.7+0ce6ecca0",
|
|
78
|
+
"@turf/rhumb-distance": "^7.1.0-alpha.7+0ce6ecca0"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "0ce6ecca05829690270fec6d6bed2003495fe0ea"
|
|
81
81
|
}
|