{"analyzedAt":"2022-07-07T06:56:11.451Z","collected":{"metadata":{"name":"ol-rotate-feature","scope":"unscoped","version":"3.0.1","description":"Rotate vector features interaction for OpenLayers","keywords":["ol","openlayers","ol-rotate-feature","rotate feature","transform feature","map","mapping"],"date":"2020-06-28T17:11:48.891Z","author":{"name":"Vladimir Vershinin","email":"ghettovoice@gmail.com","username":"ghettovoice"},"publisher":{"username":"ghettovoice","email":"ghettovoice@gmail.com"},"maintainers":[{"username":"ghettovoice","email":"ghettovoice@gmail.com"}],"repository":{"type":"git","url":"git+https://github.com/ghettovoice/ol-rotate-feature.git"},"links":{"npm":"https://www.npmjs.com/package/ol-rotate-feature","homepage":"https://ghettovoice.github.io/ol-rotate-feature/","repository":"https://github.com/ghettovoice/ol-rotate-feature","bugs":"https://github.com/ghettovoice/ol-rotate-feature/issues"},"license":"MIT","dependencies":{"@babel/runtime":"^7.10.3"},"devDependencies":{"@babel/core":"^7.10.3","@babel/plugin-proposal-function-bind":"^7.10.1","@babel/plugin-proposal-optional-chaining":"^7.10.3","@babel/plugin-transform-runtime":"^7.10.3","@babel/preset-env":"^7.10.3","@rollup/plugin-babel":"^5.0.4","@rollup/plugin-commonjs":"^13.0.0","@rollup/plugin-node-resolve":"^8.1.0","@rollup/plugin-replace":"^2.3.3","babel-loader":"^8.1.0","babel-plugin-istanbul":"^6.0.0","chai":"^4.2.0","coveralls":"^3.1.0","cross-env":"^7.0.2","css-loader":"^3.6.0","html-webpack-plugin":"^4.3.0","karma":"^5.1.0","karma-chai":"^0.1.0","karma-coverage":"^2.0.2","karma-es6-shim":"^1.0.0","karma-mocha":"^2.0.1","karma-phantomjs-launcher":"^1.0.4","karma-sinon":"^1.0.5","karma-sinon-chai":"^2.0.2","karma-sourcemap-loader":"^0.3.7","karma-spec-reporter":"0.0.32","karma-webpack":"^4.0.2","lodash":"^4.17.15","mocha":"^8.0.1","mocha-phantomjs":"^4.1.0","ol":"^6.3","phantomjs-prebuilt":"^2.1.16","rollup":"^2.18.1","rollup-plugin-terser":"^6.1.0","sinon":"^9.0.2","sinon-chai":"^3.5.0","style-loader":"^1.2.1","webpack":"^4.43.0","webpack-cli":"^3.3.12","webpack-dev-server":"^3.11.0","webpack-merge":"^4.2.2"},"peerDependencies":{"ol":"^6.0.0"},"releases":[{"from":"2022-06-07T00:00:00.000Z","to":"2022-07-07T00:00:00.000Z","count":1},{"from":"2022-04-08T00:00:00.000Z","to":"2022-07-07T00:00:00.000Z","count":1},{"from":"2022-01-08T00:00:00.000Z","to":"2022-07-07T00:00:00.000Z","count":1},{"from":"2021-07-07T00:00:00.000Z","to":"2022-07-07T00:00:00.000Z","count":1},{"from":"2020-07-07T00:00:00.000Z","to":"2022-07-07T00:00:00.000Z","count":1}],"hasTestScript":true,"hasSelectiveFiles":true,"readme":"[![Build Status](https://travis-ci.org/ghettovoice/ol-rotate-feature.svg?branch=master)](https://travis-ci.org/ghettovoice/ol-rotate-feature)\n[![Coverage Status](https://coveralls.io/repos/github/ghettovoice/ol-rotate-feature/badge.svg?branch=master)](https://coveralls.io/github/ghettovoice/ol-rotate-feature?branch=master)\n[![GitHub tag](https://img.shields.io/github/tag/ghettovoice/ol-rotate-feature.svg)](https://github.com/ghettovoice/ol-rotate-feature/releases)\n[![view on npm](http://img.shields.io/npm/v/ol-rotate-feature.svg)](https://www.npmjs.org/package/ol-rotate-feature)\n[![License](https://img.shields.io/github/license/ghettovoice/ol-rotate-feature.svg)](https://github.com/ghettovoice/ol-rotate-feature/blob/master/LICENSE)\n\n# Rotate feature interaction for OpenLayers\n\nPlugin adds interaction that allows rotating vector features around some anchor.\n\n### [Demo](https://ghettovoice.github.io/ol-rotate-feature/demo.html)\n\n## Installation\n\nInstall it with NPM (**recommended**):\n\n```shell\n# ES6 version for bundling with Webpack, Rollup or etc.\nnpm install ol ol-rotate-feature\n```\n\nOr add from CDN:\n\n```html\n<script src=\"https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v6.0.0/build/ol.js\"></script>\n<script src=\"https://unpkg.com/ol-rotate-feature@latest/dist/ol-rotate-feature.umd.js\"></script>\n<script>\n  // plugin exports global variable RotateFeatureInteraction\n  // in addition it also exported to `ol.interaction.RotateFeature` field (for backward compatibility).\n</script>\n```\n\n### Options\n\n| Option    | Type                                                                                               | Description                                                                                                                                                                                 |\n| :-------- | :------------------------------------------------------------------------------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| features  | _ol.Collection<ol.Feature>_                                                                        | The features the interaction works on. **Required**.                                                                                                                                        |\n| style     | _ol.style.Style &#124; Array&lt;ol.style.Style&gt; &#124; ol.style.StyleFunction &#124; undefined_ | Style of the overlay with interaction helper features.                                                                                                                                      |\n| angle     | _number &#124; undefined_                                                                          | Initial angle in radians (positive is counter-clockwise), applied for features already added to collection. Default is `0`.                                                                 |\n| anchor    | _number[] &#124; ol.Coordinate &#124; undefined_                                                   | Initial anchor coordinate. Default is center of features extent.                                                                                                                            |\n| condition | _module:ol/events/condition~Condition_                                                             | A function that takes an `module:ol/MapBrowserEvent~MapBrowserEvent` and returns a boolean to indicate whether that event should be handled. Default is `module:ol/events/condition~always` |\n\n### Methods\n\n```js\n// Set current angle of interaction features.\nRotateFeatureInteraction.prototype.setAngle(angle : number)\n```\n\n```js\n// Returns current angle of interaction features.\nRotateFeatureInteraction.prototype.getAngle() : number\n```\n\n```js\n// Set current anchor position.\nRotateFeatureInteraction.prototype.setAnchor(anchor? : number[] | ol.Coordinate)\n```\n\n```js\n// Returns current anchor position.\nRotateFeatureInteraction.prototype.getAnchor() : number[] | ol.Coordinate | undefined \n```\n\n### Events\n\nAll events triggered by the interaction are instances of `RotateFeatureEvent`.\n\n##### Members\n\n- **features**    _ol.Collection_     The features being rotated.\n- **angle**       _number_            Current angle in radians.\n- **anchor**      _ol.Coordinate_     Current anchor position.\n\n| Event       | Arguments            | Description                          |\n| :---------- | :------------------- | :----------------------------------- |\n| rotatestart | _RotateFeatureEvent_ | Triggered upon feature rotate start. |\n| rotating    | _RotateFeatureEvent_ | Triggered upon feature rotating.     |\n| rotateend   | _RotateFeatureEvent_ | Triggered upon feature rotation end. |\n\n### Example usage:\n\n```js\nimport { Map, View, Feature } from 'ol'\nimport { Tile as TileLayer, Vector as VectorLayer } from 'ol/layer'\nimport { OSM as OSMSource, Vector as VectorSource } from 'ol/source'\nimport { Point, LineString, Polygon } from 'ol/geom'\nimport { Select as SelectInteraction } from 'ol/interaction'\nimport RotateFeatureInteraction from 'ol-rotate-feature'\n\nconst point = new Feature({\n  name: 'point',\n  geometry: new Point([ 2384267.0573564973, 7557371.884852641 ])\n})\nconst line = new Feature({\n  name: 'line',\n  geometry: new LineString([ [ -603697.2100018249, -239432.60826165066 ], [ 4190433.20404443, 2930563.8287811787 ] ])\n})\nconst polygon = new Feature({\n  name: 'polygon',\n  geometry: new Polygon([ [\n    [ -14482348.171434438, 6661491.741627443 ],\n    [ -9541458.663080638, 6221214.458704827 ],\n    [ -11473786.738129886, 3300708.4819848104 ],\n    [ -14482348.171434438, 6661491.741627443 ]\n  ] ])\n})\n\nconst map = new Map({\n  view: new View({\n    center: [ 0, 0 ],\n    zoom: 2\n  }),\n  layers: [\n    new TileLayer({\n      source: new OSMSource()\n    }),\n    new VectorLayer({\n      source: new VectorSource({\n        projection: 'EPSG:33857',\n        features: [ point, line, polygon ]\n      })\n    })\n  ],\n  target: 'map',\n  projection: 'EPSG:3857'\n})\n\nconst select = new SelectInteraction()\nselect.getFeatures().extend([ point, line, polygon ])\n\nconst rotate = new RotateFeatureInteraction({\n  features: select.getFeatures(),\n  anchor: [ 0, 0 ],\n  angle: -90 * Math.PI / 180\n})\n\nrotate.on('rotatestart', evt => console.log('rotate start', evt))\nrotate.on('rotating', evt => console.log('rotating', evt))\nrotate.on('rotateend', evt => console.log('rotate end', evt))\n\nmap.addInteraction(select)\nmap.addInteraction(rotate)\n```\n\nExample of usage in Browser environment in [test/umd.html](https://github.com/ghettovoice/ol-rotate-feature/tree/master/test/umd.html).\n\nGetting total angle or last anchor coordinates after rotation:\n\n```js\nrotate.on('rotateend', evt => {\n    // get total angle in degrees\n    console.log(evt.angle + ' is '+ (-1 * evt.angle * 180 / Math.PI ) + '°')\n    // get last anchor coordinates\n    console.log(evt.anchor)\n})\n```\n\n## License\n\nMIT (c) 2016-2020, Vladimir Vershinin"},"npm":{"downloads":[{"from":"2022-07-06T00:00:00.000Z","to":"2022-07-07T00:00:00.000Z","count":224},{"from":"2022-06-30T00:00:00.000Z","to":"2022-07-07T00:00:00.000Z","count":1415},{"from":"2022-06-07T00:00:00.000Z","to":"2022-07-07T00:00:00.000Z","count":5907},{"from":"2022-04-08T00:00:00.000Z","to":"2022-07-07T00:00:00.000Z","count":16244},{"from":"2022-01-08T00:00:00.000Z","to":"2022-07-07T00:00:00.000Z","count":33049},{"from":"2021-07-07T00:00:00.000Z","to":"2022-07-07T00:00:00.000Z","count":70956}],"starsCount":1},"github":{"homepage":"https://ghettovoice.github.io/ol-rotate-feature/","starsCount":24,"forksCount":8,"subscribersCount":1,"issues":{"count":21,"openCount":0,"distribution":{"3600":2,"10800":1,"32400":1,"97200":5,"291600":5,"874800":0,"2624400":4,"7873200":2,"23619600":1,"70858800":0,"212576400":0},"isDisabled":false},"contributors":[{"username":"rpFilipe","commitsCount":2},{"username":"ghettovoice","commitsCount":58},{"username":"dependabot[bot]","commitsCount":9}],"commits":[{"from":"2022-06-30T00:00:00.000Z","to":"2022-07-07T00:00:00.000Z","count":0},{"from":"2022-06-07T00:00:00.000Z","to":"2022-07-07T00:00:00.000Z","count":0},{"from":"2022-04-08T00:00:00.000Z","to":"2022-07-07T00:00:00.000Z","count":0},{"from":"2022-01-08T00:00:00.000Z","to":"2022-07-07T00:00:00.000Z","count":0},{"from":"2021-07-07T00:00:00.000Z","to":"2022-07-07T00:00:00.000Z","count":0}],"statuses":[{"context":"coverage/coveralls","state":"success"},{"context":"continuous-integration/travis-ci/push","state":"success"}]},"source":{"files":{"readmeSize":7099,"testsSize":26846},"badges":[{"urls":{"original":"https://travis-ci.org/ghettovoice/ol-rotate-feature.svg?branch=master","service":"https://api.travis-ci.org/ghettovoice/ol-rotate-feature.svg?branch=master","shields":"https://img.shields.io/travis/ghettovoice/ol-rotate-feature/master.svg","content":"https://img.shields.io/travis/ghettovoice/ol-rotate-feature/master.json"},"info":{"service":"travis","type":"build","modifiers":{"branch":"master"}}},{"urls":{"original":"https://coveralls.io/repos/github/ghettovoice/ol-rotate-feature/badge.svg?branch=master","service":"https://coveralls.io/repos/github/ghettovoice/ol-rotate-feature/badge.svg?branch=master","shields":"https://img.shields.io/coveralls/ghettovoice/ol-rotate-feature/master.svg","content":"https://img.shields.io/coveralls/ghettovoice/ol-rotate-feature/master.json"},"info":{"service":"coveralls","type":"coverage","modifiers":{"branch":"master"}}},{"urls":{"original":"http://img.shields.io/npm/v/ol-rotate-feature.svg","shields":"https://img.shields.io/npm/v/ol-rotate-feature.svg","content":"https://img.shields.io/npm/v/ol-rotate-feature.json"},"info":{"service":"npm","type":"version","modifiers":{"type":"v"}}}],"linters":["editorconfig"],"coverage":0.84}},"evaluation":{"quality":{"carefulness":0.9199999999999999,"tests":0.976,"health":1,"branding":0.85},"popularity":{"communityInterest":37,"downloadsCount":5414.666666666667,"downloadsAcceleration":-2.073611111111113,"dependentsCount":0},"maintenance":{"releasesFrequency":0.9,"commitsFrequency":0.9,"openIssues":1,"issuesDistribution":0.9803590851113173}},"score":{"final":0.6760349222346459,"detail":{"quality":0.9869217247418807,"popularity":0.08565126104724403,"maintenance":0.9999441812729895}}}