@turf/transform-rotate 7.2.0 → 7.3.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/dist/cjs/index.cjs +2 -2
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/package.json +17 -17
package/dist/cjs/index.cjs
CHANGED
|
@@ -30,9 +30,9 @@ function transformRotate(geojson, angle, options) {
|
|
|
30
30
|
});
|
|
31
31
|
return geojson;
|
|
32
32
|
}
|
|
33
|
-
var
|
|
33
|
+
var index_default = transformRotate;
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
exports.default =
|
|
37
|
+
exports.default = index_default; exports.transformRotate = transformRotate;
|
|
38
38
|
//# sourceMappingURL=index.cjs.map
|
package/dist/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/turf/turf/packages/turf-transform-rotate/dist/cjs/index.cjs","../../index.ts"],"names":[],"mappings":"AAAA;ACCA,0CAAyB;AACzB,mDAA6B;AAC7B,qDAA8B;AAC9B,2DAAiC;AACjC,oCAAsB;AACtB,kCAA0B;AAC1B,4CAA0B;AAC1B,wCAAgC;AAqBhC,SAAS,eAAA,CACP,OAAA,EACA,KAAA,EACA,OAAA,EAIG;AAEH,EAAA,QAAA,EAAU,QAAA,GAAW,CAAC,CAAA;AACtB,EAAA,GAAA,CAAI,CAAC,+BAAA,OAAgB,CAAA,EAAG,MAAM,IAAI,KAAA,CAAM,oBAAoB,CAAA;AAC5D,EAAA,MAAM,MAAA,EAAQ,OAAA,CAAQ,KAAA;AACtB,EAAA,MAAM,OAAA,EAAS,OAAA,CAAQ,MAAA;AAGvB,EAAA,GAAA,CAAI,CAAC,OAAA,EAAS,MAAM,IAAI,KAAA,CAAM,qBAAqB,CAAA;AACnD,EAAA,GAAA,CAAI,MAAA,IAAU,KAAA,EAAA,GAAa,MA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Cf;AACE;AACA;AACF,2EAAC","file":"/home/runner/work/turf/turf/packages/turf-transform-rotate/dist/cjs/index.cjs","sourcesContent":[null,"import { GeoJSON, GeometryCollection } from \"geojson\";\nimport { 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, Coord } 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 * @function\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 * const poly = turf.polygon([[[0,29],[3.5,29],[2.5,32],[0,29]]]);\n * const options = {pivot: [0, 25]};\n * const rotatedPoly = turf.transformRotate(poly, 10, options);\n *\n * //addToMap\n * const addToMap = [poly, rotatedPoly];\n * rotatedPoly.properties = {stroke: '#F00', 'stroke-width': 4};\n */\nfunction transformRotate<T extends GeoJSON | GeometryCollection>(\n geojson: T,\n angle: number,\n options?: {\n pivot?: Coord;\n mutate?: boolean;\n }\n): T {\n // Optional parameters\n options = options || {};\n if (!isObject(options)) throw new Error(\"options is invalid\");\n const pivot = options.pivot;\n const 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 const pivotCoord = 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 const initialAngle = rhumbBearing(pivotCoord, pointCoords);\n const finalAngle = initialAngle + angle;\n const distance = rhumbDistance(pivotCoord, pointCoords);\n const newCoords = getCoords(\n rhumbDestination(pivotCoord, distance, finalAngle)\n );\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
|
@@ -30,9 +30,9 @@ function transformRotate(geojson, angle, options) {
|
|
|
30
30
|
});
|
|
31
31
|
return geojson;
|
|
32
32
|
}
|
|
33
|
-
var
|
|
33
|
+
var index_default = transformRotate;
|
|
34
34
|
export {
|
|
35
|
-
|
|
35
|
+
index_default as default,
|
|
36
36
|
transformRotate
|
|
37
37
|
};
|
|
38
38
|
//# sourceMappingURL=index.js.map
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import { GeoJSON, GeometryCollection } from \"geojson\";\nimport { 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, Coord } 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 * @function\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 * const poly = turf.polygon([[[0,29],[3.5,29],[2.5,32],[0,29]]]);\n * const options = {pivot: [0, 25]};\n * const rotatedPoly = turf.transformRotate(poly, 10, options);\n *\n * //addToMap\n * const addToMap = [poly, rotatedPoly];\n * rotatedPoly.properties = {stroke: '#F00', 'stroke-width': 4};\n */\nfunction transformRotate<T extends GeoJSON | GeometryCollection>(\n geojson: T,\n angle: number,\n options?: {\n pivot?: Coord;\n mutate?: boolean;\n }\n): T {\n // Optional parameters\n options = options || {};\n if (!isObject(options)) throw new Error(\"options is invalid\");\n const pivot = options.pivot;\n const 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 const pivotCoord = 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 const initialAngle = rhumbBearing(pivotCoord, pointCoords);\n const finalAngle = initialAngle + angle;\n const distance = rhumbDistance(pivotCoord, pointCoords);\n const newCoords = getCoords(\n rhumbDestination(pivotCoord, distance, finalAngle)\n );\n pointCoords[0] = newCoords[0];\n pointCoords[1] = newCoords[1];\n });\n return geojson;\n}\n\nexport { transformRotate };\nexport default transformRotate;\n"],"mappings":";AACA,SAAS,gBAAgB;AACzB,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,SAAS,wBAAwB;AACjC,SAAS,aAAa;AACtB,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,gBAAuB;AAqBhC,SAAS,gBACP,SACA,OACA,SAIG;AAEH,YAAU,WAAW,CAAC;AACtB,MAAI,CAAC,SAAS,OAAO,EAAG,OAAM,IAAI,MAAM,oBAAoB;AAC5D,QAAM,QAAQ,QAAQ;AACtB,QAAM,SAAS,QAAQ;AAGvB,MAAI,CAAC,QAAS,OAAM,IAAI,MAAM,qBAAqB;AACnD,MAAI,UAAU,UAAa,UAAU,QAAQ,MAAM,KAAK;AACtD,UAAM,IAAI,MAAM,mBAAmB;AAGrC,MAAI,UAAU,EAAG,QAAO;AAGxB,QAAM,aAAa,wBAAS,SAAS,OAAO;AAG5C,MAAI,WAAW,SAAS,WAAW,OAAW,WAAU,MAAM,OAAO;AAGrE,YAAU,SAAS,SAAU,aAAa;AACxC,UAAM,eAAe,aAAa,YAAY,WAAW;AACzD,UAAM,aAAa,eAAe;AAClC,UAAM,WAAW,cAAc,YAAY,WAAW;AACtD,UAAM,YAAY;AAAA,MAChB,iBAAiB,YAAY,UAAU,UAAU;AAAA,IACnD;AACA,gBAAY,CAAC,IAAI,UAAU,CAAC;AAC5B,gBAAY,CAAC,IAAI,UAAU,CAAC;AAAA,EAC9B,CAAC;AACD,SAAO;AACT;AAGA,IAAO,
|
|
1
|
+
{"version":3,"sources":["../../index.ts"],"sourcesContent":["import { GeoJSON, GeometryCollection } from \"geojson\";\nimport { 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, Coord } 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 * @function\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 * const poly = turf.polygon([[[0,29],[3.5,29],[2.5,32],[0,29]]]);\n * const options = {pivot: [0, 25]};\n * const rotatedPoly = turf.transformRotate(poly, 10, options);\n *\n * //addToMap\n * const addToMap = [poly, rotatedPoly];\n * rotatedPoly.properties = {stroke: '#F00', 'stroke-width': 4};\n */\nfunction transformRotate<T extends GeoJSON | GeometryCollection>(\n geojson: T,\n angle: number,\n options?: {\n pivot?: Coord;\n mutate?: boolean;\n }\n): T {\n // Optional parameters\n options = options || {};\n if (!isObject(options)) throw new Error(\"options is invalid\");\n const pivot = options.pivot;\n const 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 const pivotCoord = 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 const initialAngle = rhumbBearing(pivotCoord, pointCoords);\n const finalAngle = initialAngle + angle;\n const distance = rhumbDistance(pivotCoord, pointCoords);\n const newCoords = getCoords(\n rhumbDestination(pivotCoord, distance, finalAngle)\n );\n pointCoords[0] = newCoords[0];\n pointCoords[1] = newCoords[1];\n });\n return geojson;\n}\n\nexport { transformRotate };\nexport default transformRotate;\n"],"mappings":";AACA,SAAS,gBAAgB;AACzB,SAAS,oBAAoB;AAC7B,SAAS,qBAAqB;AAC9B,SAAS,wBAAwB;AACjC,SAAS,aAAa;AACtB,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,gBAAuB;AAqBhC,SAAS,gBACP,SACA,OACA,SAIG;AAEH,YAAU,WAAW,CAAC;AACtB,MAAI,CAAC,SAAS,OAAO,EAAG,OAAM,IAAI,MAAM,oBAAoB;AAC5D,QAAM,QAAQ,QAAQ;AACtB,QAAM,SAAS,QAAQ;AAGvB,MAAI,CAAC,QAAS,OAAM,IAAI,MAAM,qBAAqB;AACnD,MAAI,UAAU,UAAa,UAAU,QAAQ,MAAM,KAAK;AACtD,UAAM,IAAI,MAAM,mBAAmB;AAGrC,MAAI,UAAU,EAAG,QAAO;AAGxB,QAAM,aAAa,wBAAS,SAAS,OAAO;AAG5C,MAAI,WAAW,SAAS,WAAW,OAAW,WAAU,MAAM,OAAO;AAGrE,YAAU,SAAS,SAAU,aAAa;AACxC,UAAM,eAAe,aAAa,YAAY,WAAW;AACzD,UAAM,aAAa,eAAe;AAClC,UAAM,WAAW,cAAc,YAAY,WAAW;AACtD,UAAM,YAAY;AAAA,MAChB,iBAAiB,YAAY,UAAU,UAAU;AAAA,IACnD;AACA,gBAAY,CAAC,IAAI,UAAU,CAAC;AAC5B,gBAAY,CAAC,IAAI,UAAU,CAAC;AAAA,EAC9B,CAAC;AACD,SAAO;AACT;AAGA,IAAO,gBAAQ;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@turf/transform-rotate",
|
|
3
|
-
"version": "7.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "7.3.0",
|
|
4
|
+
"description": "Rotates a geometry around its center or a given point.",
|
|
5
5
|
"author": "Turf Authors",
|
|
6
6
|
"contributors": [
|
|
7
7
|
"Stefano Borghi <@stebogit>",
|
|
@@ -56,29 +56,29 @@
|
|
|
56
56
|
"test:types": "tsc --esModuleInterop --module node16 --moduleResolution node16 --noEmit --strict types.ts"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@turf/truncate": "
|
|
59
|
+
"@turf/truncate": "7.3.0",
|
|
60
60
|
"@types/benchmark": "^2.1.5",
|
|
61
|
-
"@types/tape": "^
|
|
61
|
+
"@types/tape": "^5.8.1",
|
|
62
62
|
"benchmark": "^2.1.4",
|
|
63
63
|
"load-json-file": "^7.0.1",
|
|
64
64
|
"npm-run-all": "^4.1.5",
|
|
65
65
|
"tape": "^5.9.0",
|
|
66
|
-
"tsup": "^8.
|
|
67
|
-
"tsx": "^4.19.
|
|
68
|
-
"typescript": "^5.
|
|
69
|
-
"write-json-file": "^
|
|
66
|
+
"tsup": "^8.4.0",
|
|
67
|
+
"tsx": "^4.19.4",
|
|
68
|
+
"typescript": "^5.8.3",
|
|
69
|
+
"write-json-file": "^6.0.0"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@turf/centroid": "
|
|
73
|
-
"@turf/clone": "
|
|
74
|
-
"@turf/helpers": "
|
|
75
|
-
"@turf/invariant": "
|
|
76
|
-
"@turf/meta": "
|
|
77
|
-
"@turf/rhumb-bearing": "
|
|
78
|
-
"@turf/rhumb-destination": "
|
|
79
|
-
"@turf/rhumb-distance": "
|
|
72
|
+
"@turf/centroid": "7.3.0",
|
|
73
|
+
"@turf/clone": "7.3.0",
|
|
74
|
+
"@turf/helpers": "7.3.0",
|
|
75
|
+
"@turf/invariant": "7.3.0",
|
|
76
|
+
"@turf/meta": "7.3.0",
|
|
77
|
+
"@turf/rhumb-bearing": "7.3.0",
|
|
78
|
+
"@turf/rhumb-destination": "7.3.0",
|
|
79
|
+
"@turf/rhumb-distance": "7.3.0",
|
|
80
80
|
"@types/geojson": "^7946.0.10",
|
|
81
81
|
"tslib": "^2.8.1"
|
|
82
82
|
},
|
|
83
|
-
"gitHead": "
|
|
83
|
+
"gitHead": "9f58a103e8f9a587ab640307ed03ba5233913ddd"
|
|
84
84
|
}
|