angular-osm
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -83,4 +83,2 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
*/ | ||
var osmAPIModule = angular.module('osm.api', [_x2js2.default.name]).provider('osmAPI', function osmAPIProvider() { | ||
@@ -118,3 +116,2 @@ this.options = { | ||
*/ | ||
var OSMAPI = function () { | ||
@@ -127,3 +124,2 @@ /** | ||
*/ | ||
function OSMAPI($http, $q, osmx2js, options) { | ||
@@ -263,2 +259,3 @@ _classCallCheck(this, OSMAPI); | ||
/** | ||
@@ -271,3 +268,3 @@ * @param {string} comment the comment assiociated to the changeset | ||
key: 'createChangeset', | ||
value: function createChangeset(comment) { | ||
value: function createChangeset(comment, author) { | ||
var self = this; | ||
@@ -277,3 +274,3 @@ var deferred = this.$q.defer(); | ||
changeset: { | ||
tag: [{ _k: 'created_by', _v: 'Angular-OSM' }, { _k: 'comment', _v: comment }] | ||
tag: [{ _k: 'created_by', _v: author || 'Angular-OSM' }, { _k: 'comment', _v: comment }] | ||
} | ||
@@ -491,2 +488,3 @@ } }; | ||
/** | ||
@@ -576,2 +574,3 @@ * @param {Object/string} way | ||
/** | ||
@@ -578,0 +577,0 @@ * @param {Object/string} relation |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.name=t():(e["angular-osm"]=e["angular-osm"]||{},e["angular-osm"].name=t())}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var u=n[r]={exports:{},id:r,loaded:!1};return e[r].call(u.exports,u,u.exports,t),u.loaded=!0,u.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var u=n(2),o=r(u),i=n(3),a=r(i),s=angular.module("osm.api",[a["default"].name]).provider("osmAPI",function(){this.options={url:"http://api.openstreetmap.org/api"},this.$get=function(e,t,n){return new o["default"](e,t,n,this.options)},this.$get.$inject=["$http","$q","osmx2js"]});t["default"]=s},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(){function e(t,r,u,o){n(this,e),this.url=o.url,this.$http=t,this.$q=r,this.osmx2js=u,this._oauth=null}return r(e,[{key:"setAuthAdapter",value:function(e){this._oauth=e}},{key:"getAuthAdapter",value:function(){return this._oauth}},{key:"xhr",value:function(e){this.$q.defer();return this._oauth.xhr(e)}},{key:"getAuthenticated",value:function(e,t){var n=angular.copy(t);return n||(n={}),n.method="GET",n.path=e,this.xhr(n)}},{key:"get",value:function(e,t){var n=this.$q.defer(),r=this,u=this.url+e;return this.$http.get(u,t).then(function(e){n.resolve(r.osmx2js.xml2js(e.data))},function(e){n.reject(e)}),n.promise}},{key:"put",value:function(e,t,n){n||(n={});var r=angular.copy(n);return r.method="PUT",r.path=e,r.data=this.osmx2js.js2xml(t),this.xhr(r)}},{key:"delete",value:function(e,t){t||(t={});var n=angular.copy(t);return n.method="DELETE",n.path=e,this.xhr(n)}},{key:"createChangeset",value:function(e){var t=this.$q.defer(),n={osm:{changeset:{tag:[{_k:"created_by",_v:"Angular-OSM"},{_k:"comment",_v:e}]}}};return this.put("/0.6/changeset/create",n).then(function(e){t.resolve(e)}),t.promise}},{key:"getLastOpenedChangesetId",value:function(){var e=this.$q.defer(),t={params:{user:this._oauth.getUserID(),open:!0}};return this.get("/0.6/changesets",t).then(function(t){var n=t.osm.changeset;n.length>0?e.resolve(n[0].id):n._id?e.resolve(n._id):e.resolve()}),e.promise}},{key:"closeChangeset",value:function(e){return this.put("/0.6/changeset/"+e+"/close").then(function(e){return e})}},{key:"getUserById",value:function(e){return this.getAuthenticated("/0.6/user/"+e)}},{key:"getUserDetails",value:function(){return this.getAuthenticated("/0.6/user/details")}},{key:"getUserPreferences",value:function(){return this.getAuthenticated("/0.6/user/preferences")}},{key:"putUserPreferences",value:function(e,t){return this.put("/0.6/user/preferences/"+e,t)}},{key:"getMap",value:function(e){return this.get("/0.6/map?bbox="+e)}},{key:"getNotes",value:function(e){var t="/0.6/notes?bbox="+e;return this.get(t)}},{key:"createNode",value:function(e){return this.put("/0.6/node/create",e)}},{key:"getNode",value:function(e){return this.get("/0.6/node/"+e)}},{key:"getNodeRelations",value:function(e){return this.get("/0.6/node/"+e+"/relations")}},{key:"getNodeWays",value:function(e){return this.get("/0.6/node/"+e+"/ways")}},{key:"getNodes",value:function(e){return this.get("/0.6/nodes?nodes="+e.join(","))}},{key:"deleteNode",value:function(e){return this["delete"]("/0.6/node/"+e)}},{key:"createWay",value:function(e){return this.put("/0.6/way/create",e)}},{key:"getWay",value:function(e){return this.get("/0.6/way/"+e)}},{key:"getWayRelations",value:function(e){return this.get("/0.6/way/"+e+"/relations")}},{key:"getWayFull",value:function(e){return this.get("/0.6/way/"+e+"/full")}},{key:"getWays",value:function(e){return this.get("/0.6/ways?ways="+e.join(","))}},{key:"deleteWay",value:function(e){return this["delete"]("/0.6/way/"+e)}},{key:"createRelation",value:function(e){return this.put("/0.6/relation/create",e)}},{key:"getRelation",value:function(e){return this.get("/0.6/relation/"+e)}},{key:"getRelationRelations",value:function(e){return this.get("/0.6/relation/"+e+"/relations")}},{key:"getRelationFull",value:function(e){return this.get("/0.6/relation/"+e+"/full")}},{key:"getRelations",value:function(e){return this.get("/0.6/relations?relations="+e.join(","))}},{key:"deleteRelation",value:function(e){return this["delete"]("/0.6/relation/"+e)}}]),e}();u.$inject=["$http","$q","osmx2js"],t["default"]=u},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=angular.module("osm.x2js",[]).provider("osmx2js",function(){this.options={},this.$get=function(){return new X2JS(this.options)}});t["default"]=n}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.name=t():(e["angular-osm"]=e["angular-osm"]||{},e["angular-osm"].name=t())}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var u=n[r]={exports:{},id:r,loaded:!1};return e[r].call(u.exports,u,u.exports,t),u.loaded=!0,u.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(1)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var u=n(2),o=r(u),i=n(3),a=r(i),s=angular.module("osm.api",[a.default.name]).provider("osmAPI",function(){this.options={url:"http://api.openstreetmap.org/api"},this.$get=function(e,t,n){return new o.default(e,t,n,this.options)},this.$get.$inject=["$http","$q","osmx2js"]});t.default=s},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(){function e(t,r,u,o){n(this,e),this.url=o.url,this.$http=t,this.$q=r,this.osmx2js=u,this._oauth=null}return r(e,[{key:"setAuthAdapter",value:function(e){this._oauth=e}},{key:"getAuthAdapter",value:function(){return this._oauth}},{key:"xhr",value:function(e){this.$q.defer();return this._oauth.xhr(e)}},{key:"getAuthenticated",value:function(e,t){var n=angular.copy(t);return n||(n={}),n.method="GET",n.path=e,this.xhr(n)}},{key:"get",value:function(e,t){var n=this.$q.defer(),r=this,u=this.url+e;return this.$http.get(u,t).then(function(e){n.resolve(r.osmx2js.xml2js(e.data))},function(e){n.reject(e)}),n.promise}},{key:"put",value:function(e,t,n){n||(n={});var r=angular.copy(n);return r.method="PUT",r.path=e,r.data=this.osmx2js.js2xml(t),this.xhr(r)}},{key:"delete",value:function(e,t){t||(t={});var n=angular.copy(t);return n.method="DELETE",n.path=e,this.xhr(n)}},{key:"createChangeset",value:function(e,t){var n=this.$q.defer(),r={osm:{changeset:{tag:[{_k:"created_by",_v:t||"Angular-OSM"},{_k:"comment",_v:e}]}}};return this.put("/0.6/changeset/create",r).then(function(e){n.resolve(e)}),n.promise}},{key:"getLastOpenedChangesetId",value:function(){var e=this.$q.defer(),t={params:{user:this._oauth.getUserID(),open:!0}};return this.get("/0.6/changesets",t).then(function(t){var n=t.osm.changeset;n.length>0?e.resolve(n[0].id):n._id?e.resolve(n._id):e.resolve()}),e.promise}},{key:"closeChangeset",value:function(e){return this.put("/0.6/changeset/"+e+"/close").then(function(e){return e})}},{key:"getUserById",value:function(e){return this.getAuthenticated("/0.6/user/"+e)}},{key:"getUserDetails",value:function(){return this.getAuthenticated("/0.6/user/details")}},{key:"getUserPreferences",value:function(){return this.getAuthenticated("/0.6/user/preferences")}},{key:"putUserPreferences",value:function(e,t){return this.put("/0.6/user/preferences/"+e,t)}},{key:"getMap",value:function(e){return this.get("/0.6/map?bbox="+e)}},{key:"getNotes",value:function(e){var t="/0.6/notes?bbox="+e;return this.get(t)}},{key:"createNode",value:function(e){return this.put("/0.6/node/create",e)}},{key:"getNode",value:function(e){return this.get("/0.6/node/"+e)}},{key:"getNodeRelations",value:function(e){return this.get("/0.6/node/"+e+"/relations")}},{key:"getNodeWays",value:function(e){return this.get("/0.6/node/"+e+"/ways")}},{key:"getNodes",value:function(e){return this.get("/0.6/nodes?nodes="+e.join(","))}},{key:"deleteNode",value:function(e){return this.delete("/0.6/node/"+e)}},{key:"createWay",value:function(e){return this.put("/0.6/way/create",e)}},{key:"getWay",value:function(e){return this.get("/0.6/way/"+e)}},{key:"getWayRelations",value:function(e){return this.get("/0.6/way/"+e+"/relations")}},{key:"getWayFull",value:function(e){return this.get("/0.6/way/"+e+"/full")}},{key:"getWays",value:function(e){return this.get("/0.6/ways?ways="+e.join(","))}},{key:"deleteWay",value:function(e){return this.delete("/0.6/way/"+e)}},{key:"createRelation",value:function(e){return this.put("/0.6/relation/create",e)}},{key:"getRelation",value:function(e){return this.get("/0.6/relation/"+e)}},{key:"getRelationRelations",value:function(e){return this.get("/0.6/relation/"+e+"/relations")}},{key:"getRelationFull",value:function(e){return this.get("/0.6/relation/"+e+"/full")}},{key:"getRelations",value:function(e){return this.get("/0.6/relations?relations="+e.join(","))}},{key:"deleteRelation",value:function(e){return this.delete("/0.6/relation/"+e)}}]),e}();u.$inject=["$http","$q","osmx2js"],t.default=u},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=angular.module("osm.x2js",[]).provider("osmx2js",function(){this.options={},this.$get=function(){return new X2JS(this.options)}});t.default=n}])}); |
@@ -83,4 +83,2 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
*/ | ||
var osmAPIModule = angular.module('osm.api', [_x2js2.default.name]).provider('osmAPI', function osmAPIProvider() { | ||
@@ -118,3 +116,2 @@ this.options = { | ||
*/ | ||
var OSMAPI = function () { | ||
@@ -127,3 +124,2 @@ /** | ||
*/ | ||
function OSMAPI($http, $q, osmx2js, options) { | ||
@@ -263,2 +259,3 @@ _classCallCheck(this, OSMAPI); | ||
/** | ||
@@ -271,3 +268,3 @@ * @param {string} comment the comment assiociated to the changeset | ||
key: 'createChangeset', | ||
value: function createChangeset(comment) { | ||
value: function createChangeset(comment, author) { | ||
var self = this; | ||
@@ -277,3 +274,3 @@ var deferred = this.$q.defer(); | ||
changeset: { | ||
tag: [{ _k: 'created_by', _v: 'Angular-OSM' }, { _k: 'comment', _v: comment }] | ||
tag: [{ _k: 'created_by', _v: author || 'Angular-OSM' }, { _k: 'comment', _v: comment }] | ||
} | ||
@@ -491,2 +488,3 @@ } }; | ||
/** | ||
@@ -576,2 +574,3 @@ * @param {Object/string} way | ||
/** | ||
@@ -721,4 +720,2 @@ * @param {Object/string} relation | ||
*/ | ||
exports.default = osmBase64Module; | ||
@@ -745,3 +742,2 @@ | ||
*/ | ||
var Base64Adapter = function () { | ||
@@ -755,3 +751,2 @@ /** | ||
*/ | ||
function Base64Adapter($base64, $http, osmx2js) { | ||
@@ -758,0 +753,0 @@ _classCallCheck(this, Base64Adapter); |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.name=t():(e["angular-osm"]=e["angular-osm"]||{},e["angular-osm"].name=t())}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var u=n[r]={exports:{},id:r,loaded:!1};return e[r].call(u.exports,u,u.exports,t),u.loaded=!0,u.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(4)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var u=n(2),i=r(u),o=n(3),a=r(o),s=angular.module("osm.api",[a["default"].name]).provider("osmAPI",function(){this.options={url:"http://api.openstreetmap.org/api"},this.$get=function(e,t,n){return new i["default"](e,t,n,this.options)},this.$get.$inject=["$http","$q","osmx2js"]});t["default"]=s},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(){function e(t,r,u,i){n(this,e),this.url=i.url,this.$http=t,this.$q=r,this.osmx2js=u,this._oauth=null}return r(e,[{key:"setAuthAdapter",value:function(e){this._oauth=e}},{key:"getAuthAdapter",value:function(){return this._oauth}},{key:"xhr",value:function(e){this.$q.defer();return this._oauth.xhr(e)}},{key:"getAuthenticated",value:function(e,t){var n=angular.copy(t);return n||(n={}),n.method="GET",n.path=e,this.xhr(n)}},{key:"get",value:function(e,t){var n=this.$q.defer(),r=this,u=this.url+e;return this.$http.get(u,t).then(function(e){n.resolve(r.osmx2js.xml2js(e.data))},function(e){n.reject(e)}),n.promise}},{key:"put",value:function(e,t,n){n||(n={});var r=angular.copy(n);return r.method="PUT",r.path=e,r.data=this.osmx2js.js2xml(t),this.xhr(r)}},{key:"delete",value:function(e,t){t||(t={});var n=angular.copy(t);return n.method="DELETE",n.path=e,this.xhr(n)}},{key:"createChangeset",value:function(e){var t=this.$q.defer(),n={osm:{changeset:{tag:[{_k:"created_by",_v:"Angular-OSM"},{_k:"comment",_v:e}]}}};return this.put("/0.6/changeset/create",n).then(function(e){t.resolve(e)}),t.promise}},{key:"getLastOpenedChangesetId",value:function(){var e=this.$q.defer(),t={params:{user:this._oauth.getUserID(),open:!0}};return this.get("/0.6/changesets",t).then(function(t){var n=t.osm.changeset;n.length>0?e.resolve(n[0].id):n._id?e.resolve(n._id):e.resolve()}),e.promise}},{key:"closeChangeset",value:function(e){return this.put("/0.6/changeset/"+e+"/close").then(function(e){return e})}},{key:"getUserById",value:function(e){return this.getAuthenticated("/0.6/user/"+e)}},{key:"getUserDetails",value:function(){return this.getAuthenticated("/0.6/user/details")}},{key:"getUserPreferences",value:function(){return this.getAuthenticated("/0.6/user/preferences")}},{key:"putUserPreferences",value:function(e,t){return this.put("/0.6/user/preferences/"+e,t)}},{key:"getMap",value:function(e){return this.get("/0.6/map?bbox="+e)}},{key:"getNotes",value:function(e){var t="/0.6/notes?bbox="+e;return this.get(t)}},{key:"createNode",value:function(e){return this.put("/0.6/node/create",e)}},{key:"getNode",value:function(e){return this.get("/0.6/node/"+e)}},{key:"getNodeRelations",value:function(e){return this.get("/0.6/node/"+e+"/relations")}},{key:"getNodeWays",value:function(e){return this.get("/0.6/node/"+e+"/ways")}},{key:"getNodes",value:function(e){return this.get("/0.6/nodes?nodes="+e.join(","))}},{key:"deleteNode",value:function(e){return this["delete"]("/0.6/node/"+e)}},{key:"createWay",value:function(e){return this.put("/0.6/way/create",e)}},{key:"getWay",value:function(e){return this.get("/0.6/way/"+e)}},{key:"getWayRelations",value:function(e){return this.get("/0.6/way/"+e+"/relations")}},{key:"getWayFull",value:function(e){return this.get("/0.6/way/"+e+"/full")}},{key:"getWays",value:function(e){return this.get("/0.6/ways?ways="+e.join(","))}},{key:"deleteWay",value:function(e){return this["delete"]("/0.6/way/"+e)}},{key:"createRelation",value:function(e){return this.put("/0.6/relation/create",e)}},{key:"getRelation",value:function(e){return this.get("/0.6/relation/"+e)}},{key:"getRelationRelations",value:function(e){return this.get("/0.6/relation/"+e+"/relations")}},{key:"getRelationFull",value:function(e){return this.get("/0.6/relation/"+e+"/full")}},{key:"getRelations",value:function(e){return this.get("/0.6/relations?relations="+e.join(","))}},{key:"deleteRelation",value:function(e){return this["delete"]("/0.6/relation/"+e)}}]),e}();u.$inject=["$http","$q","osmx2js"],t["default"]=u},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=angular.module("osm.x2js",[]).provider("osmx2js",function(){this.options={},this.$get=function(){return new X2JS(this.options)}});t["default"]=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var u=n(5),i=r(u),o=n(1),a=r(o),s=n(3),l=r(s),c=angular.module("osm.base64",[l["default"].name,a["default"].name,"base64"]).provider("osmBase64",function(){this.options={url:"http://api.openstreetmap.org/api"},this.$get=function(e,t,n,r){return new i["default"](e,t,n,r,this.options)},this.$get.$inject=["$base64","$http","osmx2js"]});t["default"]=c},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(){function e(t,r,u){n(this,e),this.$base64=t,this.storage={},this.$http=r,this.url="http://api.openstreetmap.org/api",this.osmx2js=u}return r(e,[{key:"xhr",value:function(e){var t=this;return e.url=this.url+e.path,e.headers={Authorization:this.getAuthorization()},this.$http(e).then(function(e){var n=e.data;if(n)return n.substr&&"<?xml"===n.substr(0,5)?t.osmx2js.xml2js(n):n})}},{key:"setCredentials",value:function(e,t){this.storage.username=e;var n=this.$base64.encode(e+":"+t);return this.storage.credentials=n,n}},{key:"getCredentials",value:function(){return this.storage.credentials}},{key:"getAuthorization",value:function(){return"Basic "+this.storage.credentials}},{key:"clearCredentials",value:function(){this.storage.removeItem?this.storage.removeItem("credentials"):delete this.storage.credentials}}]),e}();u.$inject=["$base64","$http","osmx2js"],t["default"]=u}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.name=t():(e["angular-osm"]=e["angular-osm"]||{},e["angular-osm"].name=t())}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var u=n[r]={exports:{},id:r,loaded:!1};return e[r].call(u.exports,u,u.exports,t),u.loaded=!0,u.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(4)},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var u=n(2),i=r(u),o=n(3),a=r(o),s=angular.module("osm.api",[a.default.name]).provider("osmAPI",function(){this.options={url:"http://api.openstreetmap.org/api"},this.$get=function(e,t,n){return new i.default(e,t,n,this.options)},this.$get.$inject=["$http","$q","osmx2js"]});t.default=s},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(){function e(t,r,u,i){n(this,e),this.url=i.url,this.$http=t,this.$q=r,this.osmx2js=u,this._oauth=null}return r(e,[{key:"setAuthAdapter",value:function(e){this._oauth=e}},{key:"getAuthAdapter",value:function(){return this._oauth}},{key:"xhr",value:function(e){this.$q.defer();return this._oauth.xhr(e)}},{key:"getAuthenticated",value:function(e,t){var n=angular.copy(t);return n||(n={}),n.method="GET",n.path=e,this.xhr(n)}},{key:"get",value:function(e,t){var n=this.$q.defer(),r=this,u=this.url+e;return this.$http.get(u,t).then(function(e){n.resolve(r.osmx2js.xml2js(e.data))},function(e){n.reject(e)}),n.promise}},{key:"put",value:function(e,t,n){n||(n={});var r=angular.copy(n);return r.method="PUT",r.path=e,r.data=this.osmx2js.js2xml(t),this.xhr(r)}},{key:"delete",value:function(e,t){t||(t={});var n=angular.copy(t);return n.method="DELETE",n.path=e,this.xhr(n)}},{key:"createChangeset",value:function(e,t){var n=this.$q.defer(),r={osm:{changeset:{tag:[{_k:"created_by",_v:t||"Angular-OSM"},{_k:"comment",_v:e}]}}};return this.put("/0.6/changeset/create",r).then(function(e){n.resolve(e)}),n.promise}},{key:"getLastOpenedChangesetId",value:function(){var e=this.$q.defer(),t={params:{user:this._oauth.getUserID(),open:!0}};return this.get("/0.6/changesets",t).then(function(t){var n=t.osm.changeset;n.length>0?e.resolve(n[0].id):n._id?e.resolve(n._id):e.resolve()}),e.promise}},{key:"closeChangeset",value:function(e){return this.put("/0.6/changeset/"+e+"/close").then(function(e){return e})}},{key:"getUserById",value:function(e){return this.getAuthenticated("/0.6/user/"+e)}},{key:"getUserDetails",value:function(){return this.getAuthenticated("/0.6/user/details")}},{key:"getUserPreferences",value:function(){return this.getAuthenticated("/0.6/user/preferences")}},{key:"putUserPreferences",value:function(e,t){return this.put("/0.6/user/preferences/"+e,t)}},{key:"getMap",value:function(e){return this.get("/0.6/map?bbox="+e)}},{key:"getNotes",value:function(e){var t="/0.6/notes?bbox="+e;return this.get(t)}},{key:"createNode",value:function(e){return this.put("/0.6/node/create",e)}},{key:"getNode",value:function(e){return this.get("/0.6/node/"+e)}},{key:"getNodeRelations",value:function(e){return this.get("/0.6/node/"+e+"/relations")}},{key:"getNodeWays",value:function(e){return this.get("/0.6/node/"+e+"/ways")}},{key:"getNodes",value:function(e){return this.get("/0.6/nodes?nodes="+e.join(","))}},{key:"deleteNode",value:function(e){return this.delete("/0.6/node/"+e)}},{key:"createWay",value:function(e){return this.put("/0.6/way/create",e)}},{key:"getWay",value:function(e){return this.get("/0.6/way/"+e)}},{key:"getWayRelations",value:function(e){return this.get("/0.6/way/"+e+"/relations")}},{key:"getWayFull",value:function(e){return this.get("/0.6/way/"+e+"/full")}},{key:"getWays",value:function(e){return this.get("/0.6/ways?ways="+e.join(","))}},{key:"deleteWay",value:function(e){return this.delete("/0.6/way/"+e)}},{key:"createRelation",value:function(e){return this.put("/0.6/relation/create",e)}},{key:"getRelation",value:function(e){return this.get("/0.6/relation/"+e)}},{key:"getRelationRelations",value:function(e){return this.get("/0.6/relation/"+e+"/relations")}},{key:"getRelationFull",value:function(e){return this.get("/0.6/relation/"+e+"/full")}},{key:"getRelations",value:function(e){return this.get("/0.6/relations?relations="+e.join(","))}},{key:"deleteRelation",value:function(e){return this.delete("/0.6/relation/"+e)}}]),e}();u.$inject=["$http","$q","osmx2js"],t.default=u},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=angular.module("osm.x2js",[]).provider("osmx2js",function(){this.options={},this.$get=function(){return new X2JS(this.options)}});t.default=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var u=n(5),i=r(u),o=n(1),a=r(o),s=n(3),l=r(s),c=angular.module("osm.base64",[l.default.name,a.default.name,"base64"]).provider("osmBase64",function(){this.options={url:"http://api.openstreetmap.org/api"},this.$get=function(e,t,n,r){return new i.default(e,t,n,r,this.options)},this.$get.$inject=["$base64","$http","osmx2js"]});t.default=c},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),u=function(){function e(t,r,u){n(this,e),this.$base64=t,this.storage={},this.$http=r,this.url="http://api.openstreetmap.org/api",this.osmx2js=u}return r(e,[{key:"xhr",value:function(e){var t=this;return e.url=this.url+e.path,e.headers={Authorization:this.getAuthorization()},this.$http(e).then(function(e){var n=e.data;if(n)return n.substr&&"<?xml"===n.substr(0,5)?t.osmx2js.xml2js(n):n})}},{key:"setCredentials",value:function(e,t){this.storage.username=e;var n=this.$base64.encode(e+":"+t);return this.storage.credentials=n,n}},{key:"getCredentials",value:function(){return this.storage.credentials}},{key:"getAuthorization",value:function(){return"Basic "+this.storage.credentials}},{key:"clearCredentials",value:function(){this.storage.removeItem?this.storage.removeItem("credentials"):delete this.storage.credentials}}]),e}();u.$inject=["$base64","$http","osmx2js"],t.default=u}])}); |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.name=t():(e["angular-osm"]=e["angular-osm"]||{},e["angular-osm"].name=t())}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={exports:{},id:r,loaded:!1};return e[r].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(6),o=r(a),i=n(4),u=r(i),s=n(1),l=r(s),c=n(8),f=r(c),h=n(10),p=r(h),d=n(12),g=r(d),y=n(14),v=r(y),m=n(17),k=r(m);angular.module("osm",[l["default"].name,u["default"].name,o["default"].name,f["default"].name,p["default"].name,g["default"].name,v["default"].name,k["default"].name]),t["default"]=angular.module("osm")},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=r(a),i=n(3),u=r(i),s=angular.module("osm.api",[u["default"].name]).provider("osmAPI",function(){this.options={url:"http://api.openstreetmap.org/api"},this.$get=function(e,t,n){return new o["default"](e,t,n,this.options)},this.$get.$inject=["$http","$q","osmx2js"]});t["default"]=s},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(){function e(t,r,a,o){n(this,e),this.url=o.url,this.$http=t,this.$q=r,this.osmx2js=a,this._oauth=null}return r(e,[{key:"setAuthAdapter",value:function(e){this._oauth=e}},{key:"getAuthAdapter",value:function(){return this._oauth}},{key:"xhr",value:function(e){this.$q.defer();return this._oauth.xhr(e)}},{key:"getAuthenticated",value:function(e,t){var n=angular.copy(t);return n||(n={}),n.method="GET",n.path=e,this.xhr(n)}},{key:"get",value:function(e,t){var n=this.$q.defer(),r=this,a=this.url+e;return this.$http.get(a,t).then(function(e){n.resolve(r.osmx2js.xml2js(e.data))},function(e){n.reject(e)}),n.promise}},{key:"put",value:function(e,t,n){n||(n={});var r=angular.copy(n);return r.method="PUT",r.path=e,r.data=this.osmx2js.js2xml(t),this.xhr(r)}},{key:"delete",value:function(e,t){t||(t={});var n=angular.copy(t);return n.method="DELETE",n.path=e,this.xhr(n)}},{key:"createChangeset",value:function(e){var t=this.$q.defer(),n={osm:{changeset:{tag:[{_k:"created_by",_v:"Angular-OSM"},{_k:"comment",_v:e}]}}};return this.put("/0.6/changeset/create",n).then(function(e){t.resolve(e)}),t.promise}},{key:"getLastOpenedChangesetId",value:function(){var e=this.$q.defer(),t={params:{user:this._oauth.getUserID(),open:!0}};return this.get("/0.6/changesets",t).then(function(t){var n=t.osm.changeset;n.length>0?e.resolve(n[0].id):n._id?e.resolve(n._id):e.resolve()}),e.promise}},{key:"closeChangeset",value:function(e){return this.put("/0.6/changeset/"+e+"/close").then(function(e){return e})}},{key:"getUserById",value:function(e){return this.getAuthenticated("/0.6/user/"+e)}},{key:"getUserDetails",value:function(){return this.getAuthenticated("/0.6/user/details")}},{key:"getUserPreferences",value:function(){return this.getAuthenticated("/0.6/user/preferences")}},{key:"putUserPreferences",value:function(e,t){return this.put("/0.6/user/preferences/"+e,t)}},{key:"getMap",value:function(e){return this.get("/0.6/map?bbox="+e)}},{key:"getNotes",value:function(e){var t="/0.6/notes?bbox="+e;return this.get(t)}},{key:"createNode",value:function(e){return this.put("/0.6/node/create",e)}},{key:"getNode",value:function(e){return this.get("/0.6/node/"+e)}},{key:"getNodeRelations",value:function(e){return this.get("/0.6/node/"+e+"/relations")}},{key:"getNodeWays",value:function(e){return this.get("/0.6/node/"+e+"/ways")}},{key:"getNodes",value:function(e){return this.get("/0.6/nodes?nodes="+e.join(","))}},{key:"deleteNode",value:function(e){return this["delete"]("/0.6/node/"+e)}},{key:"createWay",value:function(e){return this.put("/0.6/way/create",e)}},{key:"getWay",value:function(e){return this.get("/0.6/way/"+e)}},{key:"getWayRelations",value:function(e){return this.get("/0.6/way/"+e+"/relations")}},{key:"getWayFull",value:function(e){return this.get("/0.6/way/"+e+"/full")}},{key:"getWays",value:function(e){return this.get("/0.6/ways?ways="+e.join(","))}},{key:"deleteWay",value:function(e){return this["delete"]("/0.6/way/"+e)}},{key:"createRelation",value:function(e){return this.put("/0.6/relation/create",e)}},{key:"getRelation",value:function(e){return this.get("/0.6/relation/"+e)}},{key:"getRelationRelations",value:function(e){return this.get("/0.6/relation/"+e+"/relations")}},{key:"getRelationFull",value:function(e){return this.get("/0.6/relation/"+e+"/full")}},{key:"getRelations",value:function(e){return this.get("/0.6/relations?relations="+e.join(","))}},{key:"deleteRelation",value:function(e){return this["delete"]("/0.6/relation/"+e)}}]),e}();a.$inject=["$http","$q","osmx2js"],t["default"]=a},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=angular.module("osm.x2js",[]).provider("osmx2js",function(){this.options={},this.$get=function(){return new X2JS(this.options)}});t["default"]=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(5),o=r(a),i=n(1),u=r(i),s=n(3),l=r(s),c=angular.module("osm.base64",[l["default"].name,u["default"].name,"base64"]).provider("osmBase64",function(){this.options={url:"http://api.openstreetmap.org/api"},this.$get=function(e,t,n,r){return new o["default"](e,t,n,r,this.options)},this.$get.$inject=["$base64","$http","osmx2js"]});t["default"]=c},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(){function e(t,r,a){n(this,e),this.$base64=t,this.storage={},this.$http=r,this.url="http://api.openstreetmap.org/api",this.osmx2js=a}return r(e,[{key:"xhr",value:function(e){var t=this;return e.url=this.url+e.path,e.headers={Authorization:this.getAuthorization()},this.$http(e).then(function(e){var n=e.data;if(n)return n.substr&&"<?xml"===n.substr(0,5)?t.osmx2js.xml2js(n):n})}},{key:"setCredentials",value:function(e,t){this.storage.username=e;var n=this.$base64.encode(e+":"+t);return this.storage.credentials=n,n}},{key:"getCredentials",value:function(){return this.storage.credentials}},{key:"getAuthorization",value:function(){return"Basic "+this.storage.credentials}},{key:"clearCredentials",value:function(){this.storage.removeItem?this.storage.removeItem("credentials"):delete this.storage.credentials}}]),e}();a.$inject=["$base64","$http","osmx2js"],t["default"]=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(7),o=r(a),i=n(1),u=r(i),s=n(3),l=r(s),c=angular.module("osm.oauth",[u["default"].name,l["default"].name]).provider("osmAuthService",function(){this.options={},this.$get=function(e,t){return new o["default"](e,t,this.options)},this.$get.$inject=["$q","osmx2js"]});t["default"]=c},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(){function e(t,r,a){n(this,e),a&&a.oauth_secret&&a.oauth_consumer_key&&(this.auth=osmAuth(a)),this.osmx2js=r,this.$q=t,this._options=a}return r(e,[{key:"logout",value:function(){this.auth.logout()}},{key:"authenticated",value:function(){return this.auth.authenticated()}},{key:"authenticate",value:function(){var e=this.$q.defer();return this.auth.authenticate(function(){e.resolve(!0)}),e.promise}},{key:"xhr",value:function(e){var t=this,n=this.$q.defer();return e.path="/api"+e.path,e.data&&(e.body=e.data,e.data=void 0),this.auth.xhr(e,function(e,r){e?n.reject(e):r instanceof XMLDocument?n.resolve(t.osmx2js.dom2js(r)):n.resolve(r)}),n.promise}},{key:"options",value:function(e){this.auth?this.auth.options(e):this.auth=osmAuth(e)}}]),e}();a.$inject=["$q","osmx2js"],t["default"]=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(9),o=r(a),i=angular.module("osm.overpass",[]).provider("osmOverpassAPI",function(){this.options={url:"http://overpass-api.de/api/interpreter"},this.$get=function(e,t){return new o["default"](e,t,this.options)},this.$get.$inject=["$http","$q"]});t["default"]=i},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(){function e(t,r,a){n(this,e),this.url=a.url,this.$http=t,this.$q=r}return r(e,[{key:"overpass",value:function(e){var t=this.url,n=this.$q.defer(),r={"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"};return this.$http.post(t,"data="+encodeURIComponent(e),{headers:r}).then(function(e){n.resolve(e.data)},function(e){n.reject(e)}),n.promise}},{key:"getAreaId",value:function(e,t){var n;return n="string"==typeof t?parseInt(t,10):t,"r"===e||"relation"===e?36e8+n:"w"===e||"way"===e?24e8+n:void 0}},{key:"overpassToGeoJSON",value:function(e,t){var n=this.$q.defer(),r=[],a=[],o={type:"FeatureCollection",features:r,relations:a};return void 0===t&&(t=function(){}),this.overpass(e).then(function(e){function a(t){if(!l.loaded)for(var n,r=0;r<e.elements.length;r++)n=e.elements[r],l[n.id]=n;return l[t]}for(var i,u,s,l={loaded:!1},c=0;c<e.elements.length;c++)if(i=e.elements[c],"node"===i.type)u={type:"Feature",properties:i.tags,id:i.id,geometry:{type:"Point",coordinates:[i.lon,i.lat]}},t(u)||r.push(u);else if("way"===i.type){s=[],u={type:"Feature",properties:i.tags,id:i.id,geometry:{type:"LineString",coordinates:s}};for(var f=0;f<i.nodes.length;f++)s.push([a(i.nodes[f]).lon,a(i.nodes[f]).lat]);t(u)||r.push(u)}else"relation"===i.type&&o.relations.push({ref:i.id,tags:i.tags,type:"relation",members:i.members});n.resolve(o)},function(e){n.reject(e)}),n.promise}}]),e}();t["default"]=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(11),o=r(a),i=angular.module("osm.taginfo",[]).provider("osmTagInfoAPI",function(){this.options={url:"https://taginfo.openstreetmap.org/api/4"},this.$get=function(e,t){return new o["default"](e,t,this.options)},this.$get.$inject=["$http","$q"]});t["default"]=i},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(){function e(t,r,a){n(this,e),this.$http=t,this.$q=r,this.url=a.url,this.cache=!0,a.cache===!1&&(this.cache=!1)}return r(e,[{key:"get",value:function(e,t){var n=this.$q.defer();return t||(t={}),void 0===t.cache&&(t.cache=this.cache),this.$http.get(this.url+e,t).then(function(e){n.resolve(e.data)},function(e){n.reject(e)}),n.promise}},{key:"getKeyCombinations",value:function(e){return this.get("/key/combinations",{params:e})}},{key:"getKeyDistributionNodes",value:function(e){return this.get("/key/distribution/nodes",{params:e})}},{key:"getKeyDistributionWays",value:function(e){return this.get("/key/distribution/ways",{params:e})}},{key:"getKeyStats",value:function(e){return this.get("/key/stats",{params:e})}},{key:"getKeyValues",value:function(e){return this.get("/key/values",{params:e})}},{key:"getKeyWikiPages",value:function(e){return this.get("/key/wiki_pages",{params:e})}},{key:"getKeysAll",value:function(e){return this.get("/keys/all",{params:e})}},{key:"getKeysWikiPages",value:function(e){return this.get("/keys/wiki_pages",{params:e})}},{key:"getKeysWithoutWikiPage",value:function(e){return this.get("/keys/without_wiki_page",{params:e})}},{key:"getRelationRoles",value:function(e){return this.get("/relation/roles",{params:e})}},{key:"getRelationStats",value:function(e){return this.get("/relation/stats",{params:e})}},{key:"getRelationWikiPages",value:function(e){return this.get("/relation/wiki_pages",{params:e})}},{key:"getRelationsAll",value:function(e){return this.get("/relations/all",{params:e})}},{key:"getSearchByKeyAndValue",value:function(e){return this.get("/search/by_key_and_value",{params:e})}},{key:"getSearchByKeyword",value:function(e){return this.get("/search/by_keyword",{params:e})}},{key:"getSearchByRole",value:function(e){return this.get("/search/by_role",{params:e})}},{key:"getSearchByValue",value:function(e){return this.get("/search/by_value",{params:e})}},{key:"getSiteInfo",value:function(e){return this.get("/site/info",{params:e})}},{key:"getSiteSources",value:function(e){return this.get("/site/sources",{params:e})}},{key:"getTagCombinations",value:function(e){return this.get("/tag/combinations",{params:e})}},{key:"getTagDistributionNodes",value:function(e){return this.get("/tag/distribution/nodes",{params:e})}},{key:"getTagDistributionWays",value:function(e){return this.get("/tag/distribution/ways",{params:e})}},{key:"getTagStats",value:function(e){return this.get("/tag/stats",{params:e})}},{key:"getTagWikiPages",value:function(e){return this.get("/tag/wiki_pages",{params:e})}},{key:"getTagsPopular",value:function(e){return this.get("/tags/popular",{params:e})}},{key:"getWikiLanguages",value:function(e){return this.get("/wiki/languages",{params:e})}}]),e}();a.$inject=["$http","$q"],t["default"]=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(13),o=r(a),i=angular.module("osm.nominatim",[]).provider("osmNominatim",function(){this.options={url:"https://nominatim.openstreetmap.org"},this.$get=function(e){return new o["default"](e,this.options)},this.$get.$inject=["$http"]});t["default"]=i},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(){function e(t,r){n(this,e),this.url=r.url,this.$http=t,this.cache=!0,r.cache===!1&&(this.cache=!1)}return r(e,[{key:"search",value:function(e){var t;"string"!=typeof e&&e?(t=angular.copy(e),t.format="json"):t={format:"json",q:e};var n={params:t,cache:this.cache},r=this.url+"/search";return this.$http.get(r,n)}},{key:"reverse",value:function(e){var t;"string"==typeof e?t={format:"json",q:e}:(t=angular.copy(e),t.format="json");var n={params:t,cache:this.cache},r=this.url+"/reverse";return this.$http.get(r,n)}},{key:"lookup",value:function(e){var t;"string"==typeof e?t={format:"json",q:e}:(t=angular.copy(e),t.format="json");var n={params:t,cache:this.cache},r=this.url+"/lookup";return this.$http.get(r,n)}}]),e}();a.$inject=["$http"],t["default"]=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(15),o=r(a),i=angular.module("osm.togeojson",[]).provider("osmtogeojson",o["default"]);t["default"]=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}function a(){this.options={areaTags:["area","building","leisure","tourism","ruins","historic","landuse","military","natural","sport"],uninterestingTags:["source","source_ref","source:ref","history","attribution","created_by","tiger:county","tiger:tlid","tiger:upload_uuid"],styles:{}},this.$get=function(){return(0,i["default"])(this.options)}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(16),i=r(o);t["default"]=a},function(e,t){"use strict";function n(e){function t(e){var t=[];e instanceof Array||(e=s(e));for(var n=0;n<e.length;n++){var r=e[n],a={type:"Feature",geometry:{},properties:{id:r.id,tags:r.tags}};if("changeset"===r.type){a.geometry.type="Polygon";var o=r.latLngBounds;a.geometry.coordinates=[[[parseFloat(o._min_lon),parseFloat(o._min_lat)],[parseFloat(o._min_lon),parseFloat(o._max_lat)],[parseFloat(o._max_lon),parseFloat(o._max_lat)],[parseFloat(o._max_lon),parseFloat(o._min_lat)],[parseFloat(o._min_lon),parseFloat(o._min_lat)]]]}else if("node"===r.type)a.geometry.type="Point",a.geometry.coordinates=[r.latLng[1],r.latLng[0]];else{for(var i=new Array(r.nodes.length),u=0;u<r.nodes.length;u++){var c=r.nodes[u].latLng;i[u]=[c[1],c[0]]}l(r)?(a.geometry.type="Polygon",a.geometry.coordinates=[i]):(a.geometry.type="LineString",a.geometry.coordinates=i)}t.push(a)}return t}function n(e){return Array.isArray(e)?e:"object"===("undefined"==typeof e?"undefined":r(e))?[e]:[]}function a(e){var t=n(e.tag),r={};return t.forEach(function(e){r[e._k]=e._v}),r}function o(e){var t=n(e.osm.node),r={};return t.forEach(function(e){r[e._id]={id:e._id,type:"node",latLng:[parseFloat(e._lat),parseFloat(e._lon)],tags:a(e)}}),r}function i(e,t){var r=[],o=n(e.osm.way);return o.forEach(function(e){for(var n=e.nd,o={id:e._id,type:"way",nodes:new Array(n.length),tags:a(e)},i=0;i<n.length;i++)o.nodes[i]=t[n[i]._ref];r.push(o)}),r}function u(e,t,r){for(var o=[],i=n(e.osm.relation),u=0;u<i.length;u++){for(var s=i[u],l=n(s.member),c={id:s._id,type:"relation",members:new Array(l.length),tags:a(s)},f=0;f<l.length;f++)"node"===l[f]._type?c.members[f]=t[l[f]._ref]:c.members[f]=null;o.push(c)}return o}function s(e){var t=[],n=o(e),r=i(e,n),a=u(e,n,r);for(var s in n){var l=n[s];c(l,r,a)&&t.push(l)}for(var f=0;f<r.length;f++){var h=r[f];t.push(h)}return t}function l(t){if(t.nodes[0]!=t.nodes[t.nodes.length-1])return!1;for(var n in t.tags)if(e.areaTags.indexOf(n))return!0;return!1}function c(e,t,n){for(var r=!1,a=0;a<t.length;a++)if(t[a].nodes.indexOf(e)>=0){r=!0;break}if(!r)return!0;for(var o=0;o<n.length;o++)if(n[o].members.indexOf(e)>=0)return!0;return!1}function f(e,n){var r={type:"FeatureCollection",features:[]};return e&&(r.features=t(e)),r}var h={options:e,getAsArray:n,getFeatures:t,getNodes:o,getWays:i,getRelations:u,getTags:a,buildFeatures:s,isWayArea:l,interestingNode:c,togeojson:f};return h}Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};t["default"]=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(18),o=r(a),i=angular.module("osm.osrm",[]).provider("osrmAPI",function(){this.options={url:"http://router.project-osrm.org"},this.$get=function(e,t){return new o["default"](e,t,this.options)},this.$get.$inject=["$http","$q"]});t["default"]=i},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(){function e(t,r,a){n(this,e),this.url=a.url,this.$http=t,this.$q=r,this.cache=!0,a.cache===!1&&(this.cache=!1)}return r(e,[{key:"get",value:function(e,t,n,r,a){var o=r;Array.isArray(r)&&(o=r.join(";"));var i=this.url+"/"+e+"/"+t+"/"+n+"/"+o;return this.$http.get(i,{params:a,cache:this.cache})}},{key:"nearest",value:function(e,t,n){var r;return n&&(r={number:n}),this.get("nearest","v1",e,t,r)}},{key:"route",value:function(e,t,n){return this.get("route","v1",e,t,n)}},{key:"table",value:function(e,t,n){return this.get("table","v1",e,t,n)}},{key:"match",value:function(e,t,n){return this.get("match","v1",e,t,n)}},{key:"trip",value:function(e,t,n){return this.get("trip","v1",e,t,n)}}]),e}();a.$inject=["$http","$q"],t["default"]=a}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.name=t():(e["angular-osm"]=e["angular-osm"]||{},e["angular-osm"].name=t())}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var a=n[r]={exports:{},id:r,loaded:!1};return e[r].call(a.exports,a,a.exports,t),a.loaded=!0,a.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(6),o=r(a),i=n(4),u=r(i),s=n(1),l=r(s),c=n(8),f=r(c),h=n(10),p=r(h),d=n(12),g=r(d),y=n(14),v=r(y),m=n(17),k=r(m);angular.module("osm",[l.default.name,u.default.name,o.default.name,f.default.name,p.default.name,g.default.name,v.default.name,k.default.name]),t.default=angular.module("osm")},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(2),o=r(a),i=n(3),u=r(i),s=angular.module("osm.api",[u.default.name]).provider("osmAPI",function(){this.options={url:"http://api.openstreetmap.org/api"},this.$get=function(e,t,n){return new o.default(e,t,n,this.options)},this.$get.$inject=["$http","$q","osmx2js"]});t.default=s},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(){function e(t,r,a,o){n(this,e),this.url=o.url,this.$http=t,this.$q=r,this.osmx2js=a,this._oauth=null}return r(e,[{key:"setAuthAdapter",value:function(e){this._oauth=e}},{key:"getAuthAdapter",value:function(){return this._oauth}},{key:"xhr",value:function(e){this.$q.defer();return this._oauth.xhr(e)}},{key:"getAuthenticated",value:function(e,t){var n=angular.copy(t);return n||(n={}),n.method="GET",n.path=e,this.xhr(n)}},{key:"get",value:function(e,t){var n=this.$q.defer(),r=this,a=this.url+e;return this.$http.get(a,t).then(function(e){n.resolve(r.osmx2js.xml2js(e.data))},function(e){n.reject(e)}),n.promise}},{key:"put",value:function(e,t,n){n||(n={});var r=angular.copy(n);return r.method="PUT",r.path=e,r.data=this.osmx2js.js2xml(t),this.xhr(r)}},{key:"delete",value:function(e,t){t||(t={});var n=angular.copy(t);return n.method="DELETE",n.path=e,this.xhr(n)}},{key:"createChangeset",value:function(e,t){var n=this.$q.defer(),r={osm:{changeset:{tag:[{_k:"created_by",_v:t||"Angular-OSM"},{_k:"comment",_v:e}]}}};return this.put("/0.6/changeset/create",r).then(function(e){n.resolve(e)}),n.promise}},{key:"getLastOpenedChangesetId",value:function(){var e=this.$q.defer(),t={params:{user:this._oauth.getUserID(),open:!0}};return this.get("/0.6/changesets",t).then(function(t){var n=t.osm.changeset;n.length>0?e.resolve(n[0].id):n._id?e.resolve(n._id):e.resolve()}),e.promise}},{key:"closeChangeset",value:function(e){return this.put("/0.6/changeset/"+e+"/close").then(function(e){return e})}},{key:"getUserById",value:function(e){return this.getAuthenticated("/0.6/user/"+e)}},{key:"getUserDetails",value:function(){return this.getAuthenticated("/0.6/user/details")}},{key:"getUserPreferences",value:function(){return this.getAuthenticated("/0.6/user/preferences")}},{key:"putUserPreferences",value:function(e,t){return this.put("/0.6/user/preferences/"+e,t)}},{key:"getMap",value:function(e){return this.get("/0.6/map?bbox="+e)}},{key:"getNotes",value:function(e){var t="/0.6/notes?bbox="+e;return this.get(t)}},{key:"createNode",value:function(e){return this.put("/0.6/node/create",e)}},{key:"getNode",value:function(e){return this.get("/0.6/node/"+e)}},{key:"getNodeRelations",value:function(e){return this.get("/0.6/node/"+e+"/relations")}},{key:"getNodeWays",value:function(e){return this.get("/0.6/node/"+e+"/ways")}},{key:"getNodes",value:function(e){return this.get("/0.6/nodes?nodes="+e.join(","))}},{key:"deleteNode",value:function(e){return this.delete("/0.6/node/"+e)}},{key:"createWay",value:function(e){return this.put("/0.6/way/create",e)}},{key:"getWay",value:function(e){return this.get("/0.6/way/"+e)}},{key:"getWayRelations",value:function(e){return this.get("/0.6/way/"+e+"/relations")}},{key:"getWayFull",value:function(e){return this.get("/0.6/way/"+e+"/full")}},{key:"getWays",value:function(e){return this.get("/0.6/ways?ways="+e.join(","))}},{key:"deleteWay",value:function(e){return this.delete("/0.6/way/"+e)}},{key:"createRelation",value:function(e){return this.put("/0.6/relation/create",e)}},{key:"getRelation",value:function(e){return this.get("/0.6/relation/"+e)}},{key:"getRelationRelations",value:function(e){return this.get("/0.6/relation/"+e+"/relations")}},{key:"getRelationFull",value:function(e){return this.get("/0.6/relation/"+e+"/full")}},{key:"getRelations",value:function(e){return this.get("/0.6/relations?relations="+e.join(","))}},{key:"deleteRelation",value:function(e){return this.delete("/0.6/relation/"+e)}}]),e}();a.$inject=["$http","$q","osmx2js"],t.default=a},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=angular.module("osm.x2js",[]).provider("osmx2js",function(){this.options={},this.$get=function(){return new X2JS(this.options)}});t.default=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(5),o=r(a),i=n(1),u=r(i),s=n(3),l=r(s),c=angular.module("osm.base64",[l.default.name,u.default.name,"base64"]).provider("osmBase64",function(){this.options={url:"http://api.openstreetmap.org/api"},this.$get=function(e,t,n,r){return new o.default(e,t,n,r,this.options)},this.$get.$inject=["$base64","$http","osmx2js"]});t.default=c},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(){function e(t,r,a){n(this,e),this.$base64=t,this.storage={},this.$http=r,this.url="http://api.openstreetmap.org/api",this.osmx2js=a}return r(e,[{key:"xhr",value:function(e){var t=this;return e.url=this.url+e.path,e.headers={Authorization:this.getAuthorization()},this.$http(e).then(function(e){var n=e.data;if(n)return n.substr&&"<?xml"===n.substr(0,5)?t.osmx2js.xml2js(n):n})}},{key:"setCredentials",value:function(e,t){this.storage.username=e;var n=this.$base64.encode(e+":"+t);return this.storage.credentials=n,n}},{key:"getCredentials",value:function(){return this.storage.credentials}},{key:"getAuthorization",value:function(){return"Basic "+this.storage.credentials}},{key:"clearCredentials",value:function(){this.storage.removeItem?this.storage.removeItem("credentials"):delete this.storage.credentials}}]),e}();a.$inject=["$base64","$http","osmx2js"],t.default=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(7),o=r(a),i=n(1),u=r(i),s=n(3),l=r(s),c=angular.module("osm.oauth",[u.default.name,l.default.name]).provider("osmAuthService",function(){this.options={},this.$get=function(e,t){return new o.default(e,t,this.options)},this.$get.$inject=["$q","osmx2js"]});t.default=c},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(){function e(t,r,a){n(this,e),a&&a.oauth_secret&&a.oauth_consumer_key&&(this.auth=osmAuth(a)),this.osmx2js=r,this.$q=t,this._options=a}return r(e,[{key:"logout",value:function(){this.auth.logout()}},{key:"authenticated",value:function(){return this.auth.authenticated()}},{key:"authenticate",value:function(){var e=this.$q.defer();return this.auth.authenticate(function(){e.resolve(!0)}),e.promise}},{key:"xhr",value:function(e){var t=this,n=this.$q.defer();return e.path="/api"+e.path,e.data&&(e.body=e.data,e.data=void 0),this.auth.xhr(e,function(e,r){e?n.reject(e):r instanceof XMLDocument?n.resolve(t.osmx2js.dom2js(r)):n.resolve(r)}),n.promise}},{key:"options",value:function(e){this.auth?this.auth.options(e):this.auth=osmAuth(e)}}]),e}();a.$inject=["$q","osmx2js"],t.default=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(9),o=r(a),i=angular.module("osm.overpass",[]).provider("osmOverpassAPI",function(){this.options={url:"http://overpass-api.de/api/interpreter"},this.$get=function(e,t){return new o.default(e,t,this.options)},this.$get.$inject=["$http","$q"]});t.default=i},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(){function e(t,r,a){n(this,e),this.url=a.url,this.$http=t,this.$q=r}return r(e,[{key:"overpass",value:function(e){var t=this.url,n=this.$q.defer(),r={"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"};return this.$http.post(t,"data="+encodeURIComponent(e),{headers:r}).then(function(e){n.resolve(e.data)},function(e){n.reject(e)}),n.promise}},{key:"getAreaId",value:function(e,t){var n;return n="string"==typeof t?parseInt(t,10):t,"r"===e||"relation"===e?36e8+n:"w"===e||"way"===e?24e8+n:void 0}},{key:"overpassToGeoJSON",value:function(e,t){var n=this.$q.defer(),r=[],a=[],o={type:"FeatureCollection",features:r,relations:a};return void 0===t&&(t=function(){}),this.overpass(e).then(function(e){function a(t){if(!l.loaded)for(var n,r=0;r<e.elements.length;r++)n=e.elements[r],l[n.id]=n;return l[t]}for(var i,u,s,l={loaded:!1},c=0;c<e.elements.length;c++)if(i=e.elements[c],"node"===i.type)u={type:"Feature",properties:i.tags,id:i.id,geometry:{type:"Point",coordinates:[i.lon,i.lat]}},t(u)||r.push(u);else if("way"===i.type){s=[],u={type:"Feature",properties:i.tags,id:i.id,geometry:{type:"LineString",coordinates:s}};for(var f=0;f<i.nodes.length;f++)s.push([a(i.nodes[f]).lon,a(i.nodes[f]).lat]);t(u)||r.push(u)}else"relation"===i.type&&o.relations.push({ref:i.id,tags:i.tags,type:"relation",members:i.members});n.resolve(o)},function(e){n.reject(e)}),n.promise}}]),e}();t.default=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(11),o=r(a),i=angular.module("osm.taginfo",[]).provider("osmTagInfoAPI",function(){this.options={url:"https://taginfo.openstreetmap.org/api/4"},this.$get=function(e,t){return new o.default(e,t,this.options)},this.$get.$inject=["$http","$q"]});t.default=i},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(){function e(t,r,a){n(this,e),this.$http=t,this.$q=r,this.url=a.url,this.cache=!0,a.cache===!1&&(this.cache=!1)}return r(e,[{key:"get",value:function(e,t){var n=this.$q.defer();return t||(t={}),void 0===t.cache&&(t.cache=this.cache),this.$http.get(this.url+e,t).then(function(e){n.resolve(e.data)},function(e){n.reject(e)}),n.promise}},{key:"getKeyCombinations",value:function(e){return this.get("/key/combinations",{params:e})}},{key:"getKeyDistributionNodes",value:function(e){return this.get("/key/distribution/nodes",{params:e})}},{key:"getKeyDistributionWays",value:function(e){return this.get("/key/distribution/ways",{params:e})}},{key:"getKeyStats",value:function(e){return this.get("/key/stats",{params:e})}},{key:"getKeyValues",value:function(e){return this.get("/key/values",{params:e})}},{key:"getKeyWikiPages",value:function(e){return this.get("/key/wiki_pages",{params:e})}},{key:"getKeysAll",value:function(e){return this.get("/keys/all",{params:e})}},{key:"getKeysWikiPages",value:function(e){return this.get("/keys/wiki_pages",{params:e})}},{key:"getKeysWithoutWikiPage",value:function(e){return this.get("/keys/without_wiki_page",{params:e})}},{key:"getRelationRoles",value:function(e){return this.get("/relation/roles",{params:e})}},{key:"getRelationStats",value:function(e){return this.get("/relation/stats",{params:e})}},{key:"getRelationWikiPages",value:function(e){return this.get("/relation/wiki_pages",{params:e})}},{key:"getRelationsAll",value:function(e){return this.get("/relations/all",{params:e})}},{key:"getSearchByKeyAndValue",value:function(e){return this.get("/search/by_key_and_value",{params:e})}},{key:"getSearchByKeyword",value:function(e){return this.get("/search/by_keyword",{params:e})}},{key:"getSearchByRole",value:function(e){return this.get("/search/by_role",{params:e})}},{key:"getSearchByValue",value:function(e){return this.get("/search/by_value",{params:e})}},{key:"getSiteInfo",value:function(e){return this.get("/site/info",{params:e})}},{key:"getSiteSources",value:function(e){return this.get("/site/sources",{params:e})}},{key:"getTagCombinations",value:function(e){return this.get("/tag/combinations",{params:e})}},{key:"getTagDistributionNodes",value:function(e){return this.get("/tag/distribution/nodes",{params:e})}},{key:"getTagDistributionWays",value:function(e){return this.get("/tag/distribution/ways",{params:e})}},{key:"getTagStats",value:function(e){return this.get("/tag/stats",{params:e})}},{key:"getTagWikiPages",value:function(e){return this.get("/tag/wiki_pages",{params:e})}},{key:"getTagsPopular",value:function(e){return this.get("/tags/popular",{params:e})}},{key:"getWikiLanguages",value:function(e){return this.get("/wiki/languages",{params:e})}}]),e}();a.$inject=["$http","$q"],t.default=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(13),o=r(a),i=angular.module("osm.nominatim",[]).provider("osmNominatim",function(){this.options={url:"https://nominatim.openstreetmap.org"},this.$get=function(e){return new o.default(e,this.options)},this.$get.$inject=["$http"]});t.default=i},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(){function e(t,r){n(this,e),this.url=r.url,this.$http=t,this.cache=!0,r.cache===!1&&(this.cache=!1)}return r(e,[{key:"search",value:function(e){var t;"string"!=typeof e&&e?(t=angular.copy(e),t.format="json"):t={format:"json",q:e};var n={params:t,cache:this.cache},r=this.url+"/search";return this.$http.get(r,n)}},{key:"reverse",value:function(e){var t;"string"==typeof e?t={format:"json",q:e}:(t=angular.copy(e),t.format="json");var n={params:t,cache:this.cache},r=this.url+"/reverse";return this.$http.get(r,n)}},{key:"lookup",value:function(e){var t;"string"==typeof e?t={format:"json",q:e}:(t=angular.copy(e),t.format="json");var n={params:t,cache:this.cache},r=this.url+"/lookup";return this.$http.get(r,n)}}]),e}();a.$inject=["$http"],t.default=a},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(15),o=r(a),i=angular.module("osm.togeojson",[]).provider("osmtogeojson",o.default);t.default=i},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function a(){this.options={areaTags:["area","building","leisure","tourism","ruins","historic","landuse","military","natural","sport"],uninterestingTags:["source","source_ref","source:ref","history","attribution","created_by","tiger:county","tiger:tlid","tiger:upload_uuid"],styles:{}},this.$get=function(){return(0,i.default)(this.options)}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(16),i=r(o);t.default=a},function(e,t){"use strict";function n(e){function t(e){var t=[];e instanceof Array||(e=s(e));for(var n=0;n<e.length;n++){var r=e[n],a={type:"Feature",geometry:{},properties:{id:r.id,tags:r.tags}};if("changeset"===r.type){a.geometry.type="Polygon";var o=r.latLngBounds;a.geometry.coordinates=[[[parseFloat(o._min_lon),parseFloat(o._min_lat)],[parseFloat(o._min_lon),parseFloat(o._max_lat)],[parseFloat(o._max_lon),parseFloat(o._max_lat)],[parseFloat(o._max_lon),parseFloat(o._min_lat)],[parseFloat(o._min_lon),parseFloat(o._min_lat)]]]}else if("node"===r.type)a.geometry.type="Point",a.geometry.coordinates=[r.latLng[1],r.latLng[0]];else{for(var i=new Array(r.nodes.length),u=0;u<r.nodes.length;u++){var c=r.nodes[u].latLng;i[u]=[c[1],c[0]]}l(r)?(a.geometry.type="Polygon",a.geometry.coordinates=[i]):(a.geometry.type="LineString",a.geometry.coordinates=i)}t.push(a)}return t}function n(e){return Array.isArray(e)?e:"object"===("undefined"==typeof e?"undefined":r(e))?[e]:[]}function a(e){var t=n(e.tag),r={};return t.forEach(function(e){r[e._k]=e._v}),r}function o(e){var t=n(e.osm.node),r={};return t.forEach(function(e){r[e._id]={id:e._id,type:"node",latLng:[parseFloat(e._lat),parseFloat(e._lon)],tags:a(e)}}),r}function i(e,t){var r=[],o=n(e.osm.way);return o.forEach(function(e){for(var n=e.nd,o={id:e._id,type:"way",nodes:new Array(n.length),tags:a(e)},i=0;i<n.length;i++)o.nodes[i]=t[n[i]._ref];r.push(o)}),r}function u(e,t,r){for(var o=[],i=n(e.osm.relation),u=0;u<i.length;u++){for(var s=i[u],l=n(s.member),c={id:s._id,type:"relation",members:new Array(l.length),tags:a(s)},f=0;f<l.length;f++)"node"===l[f]._type?c.members[f]=t[l[f]._ref]:c.members[f]=null;o.push(c)}return o}function s(e){var t=[],n=o(e),r=i(e,n),a=u(e,n,r);for(var s in n){var l=n[s];c(l,r,a)&&t.push(l)}for(var f=0;f<r.length;f++){var h=r[f];t.push(h)}return t}function l(t){if(t.nodes[0]!=t.nodes[t.nodes.length-1])return!1;for(var n in t.tags)if(e.areaTags.indexOf(n))return!0;return!1}function c(e,t,n){for(var r=!1,a=0;a<t.length;a++)if(t[a].nodes.indexOf(e)>=0){r=!0;break}if(!r)return!0;for(var o=0;o<n.length;o++)if(n[o].members.indexOf(e)>=0)return!0;return!1}function f(e,n){var r={type:"FeatureCollection",features:[]};return e&&(r.features=t(e)),r}var h={options:e,getAsArray:n,getFeatures:t,getNodes:o,getWays:i,getRelations:u,getTags:a,buildFeatures:s,isWayArea:l,interestingNode:c,togeojson:f};return h}Object.defineProperty(t,"__esModule",{value:!0});var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=n},function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var a=n(18),o=r(a),i=angular.module("osm.osrm",[]).provider("osrmAPI",function(){this.options={url:"http://router.project-osrm.org"},this.$get=function(e,t){return new o.default(e,t,this.options)},this.$get.$inject=["$http","$q"]});t.default=i},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),a=function(){function e(t,r,a){n(this,e),this.url=a.url,this.$http=t,this.$q=r,this.cache=!0,a.cache===!1&&(this.cache=!1)}return r(e,[{key:"get",value:function(e,t,n,r,a){var o=r;Array.isArray(r)&&(o=r.join(";"));var i=this.url+"/"+e+"/"+t+"/"+n+"/"+o;return this.$http.get(i,{params:a,cache:this.cache})}},{key:"nearest",value:function(e,t,n){var r;return n&&(r={number:n}),this.get("nearest","v1",e,t,r)}},{key:"route",value:function(e,t,n){return this.get("route","v1",e,t,n)}},{key:"table",value:function(e,t,n){return this.get("table","v1",e,t,n)}},{key:"match",value:function(e,t,n){return this.get("match","v1",e,t,n)}},{key:"trip",value:function(e,t,n){return this.get("trip","v1",e,t,n)}}]),e}();a.$inject=["$http","$q"],t.default=a}])}); |
@@ -89,4 +89,2 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
*/ | ||
exports.default = osmNominatimModule; | ||
@@ -114,3 +112,2 @@ | ||
*/ | ||
var NominatimAPI = function () { | ||
@@ -121,3 +118,2 @@ /** | ||
*/ | ||
function NominatimAPI($http, options) { | ||
@@ -124,0 +120,0 @@ _classCallCheck(this, NominatimAPI); |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.name=e():(t["angular-osm"]=t["angular-osm"]||{},t["angular-osm"].name=e())}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}({0:function(t,e,n){t.exports=n(12)},12:function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var o=n(13),a=r(o),i=angular.module("osm.nominatim",[]).provider("osmNominatim",function(){this.options={url:"https://nominatim.openstreetmap.org"},this.$get=function(t){return new a["default"](t,this.options)},this.$get.$inject=["$http"]});e["default"]=i},13:function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=function(){function t(e,r){n(this,t),this.url=r.url,this.$http=e,this.cache=!0,r.cache===!1&&(this.cache=!1)}return r(t,[{key:"search",value:function(t){var e;"string"!=typeof t&&t?(e=angular.copy(t),e.format="json"):e={format:"json",q:t};var n={params:e,cache:this.cache},r=this.url+"/search";return this.$http.get(r,n)}},{key:"reverse",value:function(t){var e;"string"==typeof t?e={format:"json",q:t}:(e=angular.copy(t),e.format="json");var n={params:e,cache:this.cache},r=this.url+"/reverse";return this.$http.get(r,n)}},{key:"lookup",value:function(t){var e;"string"==typeof t?e={format:"json",q:t}:(e=angular.copy(t),e.format="json");var n={params:e,cache:this.cache},r=this.url+"/lookup";return this.$http.get(r,n)}}]),t}();o.$inject=["$http"],e["default"]=o}})}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.name=e():(t["angular-osm"]=t["angular-osm"]||{},t["angular-osm"].name=e())}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return t[r].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}({0:function(t,e,n){t.exports=n(12)},12:function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=n(13),a=r(o),i=angular.module("osm.nominatim",[]).provider("osmNominatim",function(){this.options={url:"https://nominatim.openstreetmap.org"},this.$get=function(t){return new a.default(t,this.options)},this.$get.$inject=["$http"]});e.default=i},13:function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=function(){function t(e,r){n(this,t),this.url=r.url,this.$http=e,this.cache=!0,r.cache===!1&&(this.cache=!1)}return r(t,[{key:"search",value:function(t){var e;"string"!=typeof t&&t?(e=angular.copy(t),e.format="json"):e={format:"json",q:t};var n={params:e,cache:this.cache},r=this.url+"/search";return this.$http.get(r,n)}},{key:"reverse",value:function(t){var e;"string"==typeof t?e={format:"json",q:t}:(e=angular.copy(t),e.format="json");var n={params:e,cache:this.cache},r=this.url+"/reverse";return this.$http.get(r,n)}},{key:"lookup",value:function(t){var e;"string"==typeof t?e={format:"json",q:t}:(e=angular.copy(t),e.format="json");var n={params:e,cache:this.cache},r=this.url+"/lookup";return this.$http.get(r,n)}}]),t}();o.$inject=["$http"],e.default=o}})}); |
@@ -83,4 +83,2 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
*/ | ||
var osmAPIModule = angular.module('osm.api', [_x2js2.default.name]).provider('osmAPI', function osmAPIProvider() { | ||
@@ -118,3 +116,2 @@ this.options = { | ||
*/ | ||
var OSMAPI = function () { | ||
@@ -127,3 +124,2 @@ /** | ||
*/ | ||
function OSMAPI($http, $q, osmx2js, options) { | ||
@@ -263,2 +259,3 @@ _classCallCheck(this, OSMAPI); | ||
/** | ||
@@ -271,3 +268,3 @@ * @param {string} comment the comment assiociated to the changeset | ||
key: 'createChangeset', | ||
value: function createChangeset(comment) { | ||
value: function createChangeset(comment, author) { | ||
var self = this; | ||
@@ -277,3 +274,3 @@ var deferred = this.$q.defer(); | ||
changeset: { | ||
tag: [{ _k: 'created_by', _v: 'Angular-OSM' }, { _k: 'comment', _v: comment }] | ||
tag: [{ _k: 'created_by', _v: author || 'Angular-OSM' }, { _k: 'comment', _v: comment }] | ||
} | ||
@@ -491,2 +488,3 @@ } }; | ||
/** | ||
@@ -576,2 +574,3 @@ * @param {Object/string} way | ||
/** | ||
@@ -722,4 +721,2 @@ * @param {Object/string} relation | ||
*/ | ||
exports.default = osmOAuthModule; | ||
@@ -745,3 +742,2 @@ | ||
*/ | ||
var OAuthAdapter = function () { | ||
@@ -753,3 +749,2 @@ /** | ||
*/ | ||
function OAuthAdapter($q, osmx2js, options) { | ||
@@ -756,0 +751,0 @@ _classCallCheck(this, OAuthAdapter); |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.name=t():(e["angular-osm"]=e["angular-osm"]||{},e["angular-osm"].name=t())}(this,function(){return function(e){function t(u){if(n[u])return n[u].exports;var r=n[u]={exports:{},id:u,loaded:!1};return e[u].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(6)},function(e,t,n){"use strict";function u(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=u(r),i=n(3),a=u(i),s=angular.module("osm.api",[a["default"].name]).provider("osmAPI",function(){this.options={url:"http://api.openstreetmap.org/api"},this.$get=function(e,t,n){return new o["default"](e,t,n,this.options)},this.$get.$inject=["$http","$q","osmx2js"]});t["default"]=s},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var u=t[n];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(e,u.key,u)}}return function(t,n,u){return n&&e(t.prototype,n),u&&e(t,u),t}}(),r=function(){function e(t,u,r,o){n(this,e),this.url=o.url,this.$http=t,this.$q=u,this.osmx2js=r,this._oauth=null}return u(e,[{key:"setAuthAdapter",value:function(e){this._oauth=e}},{key:"getAuthAdapter",value:function(){return this._oauth}},{key:"xhr",value:function(e){this.$q.defer();return this._oauth.xhr(e)}},{key:"getAuthenticated",value:function(e,t){var n=angular.copy(t);return n||(n={}),n.method="GET",n.path=e,this.xhr(n)}},{key:"get",value:function(e,t){var n=this.$q.defer(),u=this,r=this.url+e;return this.$http.get(r,t).then(function(e){n.resolve(u.osmx2js.xml2js(e.data))},function(e){n.reject(e)}),n.promise}},{key:"put",value:function(e,t,n){n||(n={});var u=angular.copy(n);return u.method="PUT",u.path=e,u.data=this.osmx2js.js2xml(t),this.xhr(u)}},{key:"delete",value:function(e,t){t||(t={});var n=angular.copy(t);return n.method="DELETE",n.path=e,this.xhr(n)}},{key:"createChangeset",value:function(e){var t=this.$q.defer(),n={osm:{changeset:{tag:[{_k:"created_by",_v:"Angular-OSM"},{_k:"comment",_v:e}]}}};return this.put("/0.6/changeset/create",n).then(function(e){t.resolve(e)}),t.promise}},{key:"getLastOpenedChangesetId",value:function(){var e=this.$q.defer(),t={params:{user:this._oauth.getUserID(),open:!0}};return this.get("/0.6/changesets",t).then(function(t){var n=t.osm.changeset;n.length>0?e.resolve(n[0].id):n._id?e.resolve(n._id):e.resolve()}),e.promise}},{key:"closeChangeset",value:function(e){return this.put("/0.6/changeset/"+e+"/close").then(function(e){return e})}},{key:"getUserById",value:function(e){return this.getAuthenticated("/0.6/user/"+e)}},{key:"getUserDetails",value:function(){return this.getAuthenticated("/0.6/user/details")}},{key:"getUserPreferences",value:function(){return this.getAuthenticated("/0.6/user/preferences")}},{key:"putUserPreferences",value:function(e,t){return this.put("/0.6/user/preferences/"+e,t)}},{key:"getMap",value:function(e){return this.get("/0.6/map?bbox="+e)}},{key:"getNotes",value:function(e){var t="/0.6/notes?bbox="+e;return this.get(t)}},{key:"createNode",value:function(e){return this.put("/0.6/node/create",e)}},{key:"getNode",value:function(e){return this.get("/0.6/node/"+e)}},{key:"getNodeRelations",value:function(e){return this.get("/0.6/node/"+e+"/relations")}},{key:"getNodeWays",value:function(e){return this.get("/0.6/node/"+e+"/ways")}},{key:"getNodes",value:function(e){return this.get("/0.6/nodes?nodes="+e.join(","))}},{key:"deleteNode",value:function(e){return this["delete"]("/0.6/node/"+e)}},{key:"createWay",value:function(e){return this.put("/0.6/way/create",e)}},{key:"getWay",value:function(e){return this.get("/0.6/way/"+e)}},{key:"getWayRelations",value:function(e){return this.get("/0.6/way/"+e+"/relations")}},{key:"getWayFull",value:function(e){return this.get("/0.6/way/"+e+"/full")}},{key:"getWays",value:function(e){return this.get("/0.6/ways?ways="+e.join(","))}},{key:"deleteWay",value:function(e){return this["delete"]("/0.6/way/"+e)}},{key:"createRelation",value:function(e){return this.put("/0.6/relation/create",e)}},{key:"getRelation",value:function(e){return this.get("/0.6/relation/"+e)}},{key:"getRelationRelations",value:function(e){return this.get("/0.6/relation/"+e+"/relations")}},{key:"getRelationFull",value:function(e){return this.get("/0.6/relation/"+e+"/full")}},{key:"getRelations",value:function(e){return this.get("/0.6/relations?relations="+e.join(","))}},{key:"deleteRelation",value:function(e){return this["delete"]("/0.6/relation/"+e)}}]),e}();r.$inject=["$http","$q","osmx2js"],t["default"]=r},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=angular.module("osm.x2js",[]).provider("osmx2js",function(){this.options={},this.$get=function(){return new X2JS(this.options)}});t["default"]=n},,,function(e,t,n){"use strict";function u(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(7),o=u(r),i=n(1),a=u(i),s=n(3),l=u(s),c=angular.module("osm.oauth",[a["default"].name,l["default"].name]).provider("osmAuthService",function(){this.options={},this.$get=function(e,t){return new o["default"](e,t,this.options)},this.$get.$inject=["$q","osmx2js"]});t["default"]=c},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var u=t[n];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(e,u.key,u)}}return function(t,n,u){return n&&e(t.prototype,n),u&&e(t,u),t}}(),r=function(){function e(t,u,r){n(this,e),r&&r.oauth_secret&&r.oauth_consumer_key&&(this.auth=osmAuth(r)),this.osmx2js=u,this.$q=t,this._options=r}return u(e,[{key:"logout",value:function(){this.auth.logout()}},{key:"authenticated",value:function(){return this.auth.authenticated()}},{key:"authenticate",value:function(){var e=this.$q.defer();return this.auth.authenticate(function(){e.resolve(!0)}),e.promise}},{key:"xhr",value:function(e){var t=this,n=this.$q.defer();return e.path="/api"+e.path,e.data&&(e.body=e.data,e.data=void 0),this.auth.xhr(e,function(e,u){e?n.reject(e):u instanceof XMLDocument?n.resolve(t.osmx2js.dom2js(u)):n.resolve(u)}),n.promise}},{key:"options",value:function(e){this.auth?this.auth.options(e):this.auth=osmAuth(e)}}]),e}();r.$inject=["$q","osmx2js"],t["default"]=r}])}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.name=t():(e["angular-osm"]=e["angular-osm"]||{},e["angular-osm"].name=t())}(this,function(){return function(e){function t(u){if(n[u])return n[u].exports;var r=n[u]={exports:{},id:u,loaded:!1};return e[u].call(r.exports,r,r.exports,t),r.loaded=!0,r.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}([function(e,t,n){e.exports=n(6)},function(e,t,n){"use strict";function u(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=u(r),i=n(3),a=u(i),s=angular.module("osm.api",[a.default.name]).provider("osmAPI",function(){this.options={url:"http://api.openstreetmap.org/api"},this.$get=function(e,t,n){return new o.default(e,t,n,this.options)},this.$get.$inject=["$http","$q","osmx2js"]});t.default=s},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var u=t[n];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(e,u.key,u)}}return function(t,n,u){return n&&e(t.prototype,n),u&&e(t,u),t}}(),r=function(){function e(t,u,r,o){n(this,e),this.url=o.url,this.$http=t,this.$q=u,this.osmx2js=r,this._oauth=null}return u(e,[{key:"setAuthAdapter",value:function(e){this._oauth=e}},{key:"getAuthAdapter",value:function(){return this._oauth}},{key:"xhr",value:function(e){this.$q.defer();return this._oauth.xhr(e)}},{key:"getAuthenticated",value:function(e,t){var n=angular.copy(t);return n||(n={}),n.method="GET",n.path=e,this.xhr(n)}},{key:"get",value:function(e,t){var n=this.$q.defer(),u=this,r=this.url+e;return this.$http.get(r,t).then(function(e){n.resolve(u.osmx2js.xml2js(e.data))},function(e){n.reject(e)}),n.promise}},{key:"put",value:function(e,t,n){n||(n={});var u=angular.copy(n);return u.method="PUT",u.path=e,u.data=this.osmx2js.js2xml(t),this.xhr(u)}},{key:"delete",value:function(e,t){t||(t={});var n=angular.copy(t);return n.method="DELETE",n.path=e,this.xhr(n)}},{key:"createChangeset",value:function(e,t){var n=this.$q.defer(),u={osm:{changeset:{tag:[{_k:"created_by",_v:t||"Angular-OSM"},{_k:"comment",_v:e}]}}};return this.put("/0.6/changeset/create",u).then(function(e){n.resolve(e)}),n.promise}},{key:"getLastOpenedChangesetId",value:function(){var e=this.$q.defer(),t={params:{user:this._oauth.getUserID(),open:!0}};return this.get("/0.6/changesets",t).then(function(t){var n=t.osm.changeset;n.length>0?e.resolve(n[0].id):n._id?e.resolve(n._id):e.resolve()}),e.promise}},{key:"closeChangeset",value:function(e){return this.put("/0.6/changeset/"+e+"/close").then(function(e){return e})}},{key:"getUserById",value:function(e){return this.getAuthenticated("/0.6/user/"+e)}},{key:"getUserDetails",value:function(){return this.getAuthenticated("/0.6/user/details")}},{key:"getUserPreferences",value:function(){return this.getAuthenticated("/0.6/user/preferences")}},{key:"putUserPreferences",value:function(e,t){return this.put("/0.6/user/preferences/"+e,t)}},{key:"getMap",value:function(e){return this.get("/0.6/map?bbox="+e)}},{key:"getNotes",value:function(e){var t="/0.6/notes?bbox="+e;return this.get(t)}},{key:"createNode",value:function(e){return this.put("/0.6/node/create",e)}},{key:"getNode",value:function(e){return this.get("/0.6/node/"+e)}},{key:"getNodeRelations",value:function(e){return this.get("/0.6/node/"+e+"/relations")}},{key:"getNodeWays",value:function(e){return this.get("/0.6/node/"+e+"/ways")}},{key:"getNodes",value:function(e){return this.get("/0.6/nodes?nodes="+e.join(","))}},{key:"deleteNode",value:function(e){return this.delete("/0.6/node/"+e)}},{key:"createWay",value:function(e){return this.put("/0.6/way/create",e)}},{key:"getWay",value:function(e){return this.get("/0.6/way/"+e)}},{key:"getWayRelations",value:function(e){return this.get("/0.6/way/"+e+"/relations")}},{key:"getWayFull",value:function(e){return this.get("/0.6/way/"+e+"/full")}},{key:"getWays",value:function(e){return this.get("/0.6/ways?ways="+e.join(","))}},{key:"deleteWay",value:function(e){return this.delete("/0.6/way/"+e)}},{key:"createRelation",value:function(e){return this.put("/0.6/relation/create",e)}},{key:"getRelation",value:function(e){return this.get("/0.6/relation/"+e)}},{key:"getRelationRelations",value:function(e){return this.get("/0.6/relation/"+e+"/relations")}},{key:"getRelationFull",value:function(e){return this.get("/0.6/relation/"+e+"/full")}},{key:"getRelations",value:function(e){return this.get("/0.6/relations?relations="+e.join(","))}},{key:"deleteRelation",value:function(e){return this.delete("/0.6/relation/"+e)}}]),e}();r.$inject=["$http","$q","osmx2js"],t.default=r},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=angular.module("osm.x2js",[]).provider("osmx2js",function(){this.options={},this.$get=function(){return new X2JS(this.options)}});t.default=n},,,function(e,t,n){"use strict";function u(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(7),o=u(r),i=n(1),a=u(i),s=n(3),l=u(s),c=angular.module("osm.oauth",[a.default.name,l.default.name]).provider("osmAuthService",function(){this.options={},this.$get=function(e,t){return new o.default(e,t,this.options)},this.$get.$inject=["$q","osmx2js"]});t.default=c},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var n=0;n<t.length;n++){var u=t[n];u.enumerable=u.enumerable||!1,u.configurable=!0,"value"in u&&(u.writable=!0),Object.defineProperty(e,u.key,u)}}return function(t,n,u){return n&&e(t.prototype,n),u&&e(t,u),t}}(),r=function(){function e(t,u,r){n(this,e),r&&r.oauth_secret&&r.oauth_consumer_key&&(this.auth=osmAuth(r)),this.osmx2js=u,this.$q=t,this._options=r}return u(e,[{key:"logout",value:function(){this.auth.logout()}},{key:"authenticated",value:function(){return this.auth.authenticated()}},{key:"authenticate",value:function(){var e=this.$q.defer();return this.auth.authenticate(function(){e.resolve(!0)}),e.promise}},{key:"xhr",value:function(e){var t=this,n=this.$q.defer();return e.path="/api"+e.path,e.data&&(e.body=e.data,e.data=void 0),this.auth.xhr(e,function(e,u){e?n.reject(e):u instanceof XMLDocument?n.resolve(t.osmx2js.dom2js(u)):n.resolve(u)}),n.promise}},{key:"options",value:function(e){this.auth?this.auth.options(e):this.auth=osmAuth(e)}}]),e}();r.$inject=["$q","osmx2js"],t.default=r}])}); |
@@ -89,4 +89,2 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
*/ | ||
exports.default = osrmModule; | ||
@@ -113,3 +111,2 @@ | ||
*/ | ||
var OSRMAPI = function () { | ||
@@ -121,3 +118,2 @@ /** | ||
*/ | ||
function OSRMAPI($http, $q, options) { | ||
@@ -124,0 +120,0 @@ _classCallCheck(this, OSRMAPI); |
@@ -1,1 +0,1 @@ | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.name=e():(t["angular-osm"]=t["angular-osm"]||{},t["angular-osm"].name=e())}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}({0:function(t,e,r){t.exports=r(17)},17:function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(18),u=n(o),i=angular.module("osm.osrm",[]).provider("osrmAPI",function(){this.options={url:"http://router.project-osrm.org"},this.$get=function(t,e){return new u["default"](t,e,this.options)},this.$get.$inject=["$http","$q"]});e["default"]=i},18:function(t,e){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),o=function(){function t(e,n,o){r(this,t),this.url=o.url,this.$http=e,this.$q=n,this.cache=!0,o.cache===!1&&(this.cache=!1)}return n(t,[{key:"get",value:function(t,e,r,n,o){var u=n;Array.isArray(n)&&(u=n.join(";"));var i=this.url+"/"+t+"/"+e+"/"+r+"/"+u;return this.$http.get(i,{params:o,cache:this.cache})}},{key:"nearest",value:function(t,e,r){var n;return r&&(n={number:r}),this.get("nearest","v1",t,e,n)}},{key:"route",value:function(t,e,r){return this.get("route","v1",t,e,r)}},{key:"table",value:function(t,e,r){return this.get("table","v1",t,e,r)}},{key:"match",value:function(t,e,r){return this.get("match","v1",t,e,r)}},{key:"trip",value:function(t,e,r){return this.get("trip","v1",t,e,r)}}]),t}();o.$inject=["$http","$q"],e["default"]=o}})}); | ||
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.name=e():(t["angular-osm"]=t["angular-osm"]||{},t["angular-osm"].name=e())}(this,function(){return function(t){function e(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return t[n].call(o.exports,o,o.exports,e),o.loaded=!0,o.exports}var r={};return e.m=t,e.c=r,e.p="",e(0)}({0:function(t,e,r){t.exports=r(17)},17:function(t,e,r){"use strict";function n(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var o=r(18),u=n(o),i=angular.module("osm.osrm",[]).provider("osrmAPI",function(){this.options={url:"http://router.project-osrm.org"},this.$get=function(t,e){return new u.default(t,e,this.options)},this.$get.$inject=["$http","$q"]});e.default=i},18:function(t,e){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function t(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}return function(e,r,n){return r&&t(e.prototype,r),n&&t(e,n),e}}(),o=function(){function t(e,n,o){r(this,t),this.url=o.url,this.$http=e,this.$q=n,this.cache=!0,o.cache===!1&&(this.cache=!1)}return n(t,[{key:"get",value:function(t,e,r,n,o){var u=n;Array.isArray(n)&&(u=n.join(";"));var i=this.url+"/"+t+"/"+e+"/"+r+"/"+u;return this.$http.get(i,{params:o,cache:this.cache})}},{key:"nearest",value:function(t,e,r){var n;return r&&(n={number:r}),this.get("nearest","v1",t,e,n)}},{key:"route",value:function(t,e,r){return this.get("route","v1",t,e,r)}},{key:"table",value:function(t,e,r){return this.get("table","v1",t,e,r)}},{key:"match",value:function(t,e,r){return this.get("match","v1",t,e,r)}},{key:"trip",value:function(t,e,r){return this.get("trip","v1",t,e,r)}}]),t}();o.$inject=["$http","$q"],e.default=o}})}); |
@@ -89,4 +89,2 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
*/ | ||
exports.default = osmOverpassModule; | ||
@@ -113,3 +111,2 @@ | ||
*/ | ||
var OverpassAPI = function () { | ||
@@ -121,3 +118,2 @@ /** | ||
*/ | ||
function OverpassAPI($http, $q, options) { | ||
@@ -124,0 +120,0 @@ _classCallCheck(this, OverpassAPI); |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.name=t():(e["angular-osm"]=e["angular-osm"]||{},e["angular-osm"].name=t())}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}({0:function(e,t,n){e.exports=n(8)},8:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(9),i=r(o),s=angular.module("osm.overpass",[]).provider("osmOverpassAPI",function(){this.options={url:"http://overpass-api.de/api/interpreter"},this.$get=function(e,t){return new i["default"](e,t,this.options)},this.$get.$inject=["$http","$q"]});t["default"]=s},9:function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){function e(t,r,o){n(this,e),this.url=o.url,this.$http=t,this.$q=r}return r(e,[{key:"overpass",value:function(e){var t=this.url,n=this.$q.defer(),r={"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"};return this.$http.post(t,"data="+encodeURIComponent(e),{headers:r}).then(function(e){n.resolve(e.data)},function(e){n.reject(e)}),n.promise}},{key:"getAreaId",value:function(e,t){var n;return n="string"==typeof t?parseInt(t,10):t,"r"===e||"relation"===e?36e8+n:"w"===e||"way"===e?24e8+n:void 0}},{key:"overpassToGeoJSON",value:function(e,t){var n=this.$q.defer(),r=[],o=[],i={type:"FeatureCollection",features:r,relations:o};return void 0===t&&(t=function(){}),this.overpass(e).then(function(e){function o(t){if(!p.loaded)for(var n,r=0;r<e.elements.length;r++)n=e.elements[r],p[n.id]=n;return p[t]}for(var s,a,u,p={loaded:!1},l=0;l<e.elements.length;l++)if(s=e.elements[l],"node"===s.type)a={type:"Feature",properties:s.tags,id:s.id,geometry:{type:"Point",coordinates:[s.lon,s.lat]}},t(a)||r.push(a);else if("way"===s.type){u=[],a={type:"Feature",properties:s.tags,id:s.id,geometry:{type:"LineString",coordinates:u}};for(var f=0;f<s.nodes.length;f++)u.push([o(s.nodes[f]).lon,o(s.nodes[f]).lat]);t(a)||r.push(a)}else"relation"===s.type&&i.relations.push({ref:s.id,tags:s.tags,type:"relation",members:s.members});n.resolve(i)},function(e){n.reject(e)}),n.promise}}]),e}();t["default"]=o}})}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.name=t():(e["angular-osm"]=e["angular-osm"]||{},e["angular-osm"].name=t())}(this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var o=n[r]={exports:{},id:r,loaded:!1};return e[r].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var n={};return t.m=e,t.c=n,t.p="",t(0)}({0:function(e,t,n){e.exports=n(8)},8:function(e,t,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var o=n(9),i=r(o),s=angular.module("osm.overpass",[]).provider("osmOverpassAPI",function(){this.options={url:"http://overpass-api.de/api/interpreter"},this.$get=function(e,t){return new i.default(e,t,this.options)},this.$get.$inject=["$http","$q"]});t.default=s},9:function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}return function(t,n,r){return n&&e(t.prototype,n),r&&e(t,r),t}}(),o=function(){function e(t,r,o){n(this,e),this.url=o.url,this.$http=t,this.$q=r}return r(e,[{key:"overpass",value:function(e){var t=this.url,n=this.$q.defer(),r={"Content-Type":"application/x-www-form-urlencoded; charset=UTF-8"};return this.$http.post(t,"data="+encodeURIComponent(e),{headers:r}).then(function(e){n.resolve(e.data)},function(e){n.reject(e)}),n.promise}},{key:"getAreaId",value:function(e,t){var n;return n="string"==typeof t?parseInt(t,10):t,"r"===e||"relation"===e?36e8+n:"w"===e||"way"===e?24e8+n:void 0}},{key:"overpassToGeoJSON",value:function(e,t){var n=this.$q.defer(),r=[],o=[],i={type:"FeatureCollection",features:r,relations:o};return void 0===t&&(t=function(){}),this.overpass(e).then(function(e){function o(t){if(!p.loaded)for(var n,r=0;r<e.elements.length;r++)n=e.elements[r],p[n.id]=n;return p[t]}for(var s,a,u,p={loaded:!1},l=0;l<e.elements.length;l++)if(s=e.elements[l],"node"===s.type)a={type:"Feature",properties:s.tags,id:s.id,geometry:{type:"Point",coordinates:[s.lon,s.lat]}},t(a)||r.push(a);else if("way"===s.type){u=[],a={type:"Feature",properties:s.tags,id:s.id,geometry:{type:"LineString",coordinates:u}};for(var f=0;f<s.nodes.length;f++)u.push([o(s.nodes[f]).lon,o(s.nodes[f]).lat]);t(a)||r.push(a)}else"relation"===s.type&&i.relations.push({ref:s.id,tags:s.tags,type:"relation",members:s.members});n.resolve(i)},function(e){n.reject(e)}),n.promise}}]),e}();t.default=o}})}); |
@@ -89,4 +89,2 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
*/ | ||
exports.default = osmTagInfoModule; | ||
@@ -114,3 +112,2 @@ | ||
*/ | ||
var TagInfoAPI = function () { | ||
@@ -121,3 +118,2 @@ /** | ||
*/ | ||
function TagInfoAPI($http, $q, options) { | ||
@@ -124,0 +120,0 @@ _classCallCheck(this, TagInfoAPI); |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.name=t():(e["angular-osm"]=e["angular-osm"]||{},e["angular-osm"].name=t())}(this,function(){return function(e){function t(n){if(a[n])return a[n].exports;var i=a[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var a={};return t.m=e,t.c=a,t.p="",t(0)}({0:function(e,t,a){e.exports=a(10)},10:function(e,t,a){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var i=a(11),r=n(i),s=angular.module("osm.taginfo",[]).provider("osmTagInfoAPI",function(){this.options={url:"https://taginfo.openstreetmap.org/api/4"},this.$get=function(e,t){return new r["default"](e,t,this.options)},this.$get.$inject=["$http","$q"]});t["default"]=s},11:function(e,t){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}(),i=function(){function e(t,n,i){a(this,e),this.$http=t,this.$q=n,this.url=i.url,this.cache=!0,i.cache===!1&&(this.cache=!1)}return n(e,[{key:"get",value:function(e,t){var a=this.$q.defer();return t||(t={}),void 0===t.cache&&(t.cache=this.cache),this.$http.get(this.url+e,t).then(function(e){a.resolve(e.data)},function(e){a.reject(e)}),a.promise}},{key:"getKeyCombinations",value:function(e){return this.get("/key/combinations",{params:e})}},{key:"getKeyDistributionNodes",value:function(e){return this.get("/key/distribution/nodes",{params:e})}},{key:"getKeyDistributionWays",value:function(e){return this.get("/key/distribution/ways",{params:e})}},{key:"getKeyStats",value:function(e){return this.get("/key/stats",{params:e})}},{key:"getKeyValues",value:function(e){return this.get("/key/values",{params:e})}},{key:"getKeyWikiPages",value:function(e){return this.get("/key/wiki_pages",{params:e})}},{key:"getKeysAll",value:function(e){return this.get("/keys/all",{params:e})}},{key:"getKeysWikiPages",value:function(e){return this.get("/keys/wiki_pages",{params:e})}},{key:"getKeysWithoutWikiPage",value:function(e){return this.get("/keys/without_wiki_page",{params:e})}},{key:"getRelationRoles",value:function(e){return this.get("/relation/roles",{params:e})}},{key:"getRelationStats",value:function(e){return this.get("/relation/stats",{params:e})}},{key:"getRelationWikiPages",value:function(e){return this.get("/relation/wiki_pages",{params:e})}},{key:"getRelationsAll",value:function(e){return this.get("/relations/all",{params:e})}},{key:"getSearchByKeyAndValue",value:function(e){return this.get("/search/by_key_and_value",{params:e})}},{key:"getSearchByKeyword",value:function(e){return this.get("/search/by_keyword",{params:e})}},{key:"getSearchByRole",value:function(e){return this.get("/search/by_role",{params:e})}},{key:"getSearchByValue",value:function(e){return this.get("/search/by_value",{params:e})}},{key:"getSiteInfo",value:function(e){return this.get("/site/info",{params:e})}},{key:"getSiteSources",value:function(e){return this.get("/site/sources",{params:e})}},{key:"getTagCombinations",value:function(e){return this.get("/tag/combinations",{params:e})}},{key:"getTagDistributionNodes",value:function(e){return this.get("/tag/distribution/nodes",{params:e})}},{key:"getTagDistributionWays",value:function(e){return this.get("/tag/distribution/ways",{params:e})}},{key:"getTagStats",value:function(e){return this.get("/tag/stats",{params:e})}},{key:"getTagWikiPages",value:function(e){return this.get("/tag/wiki_pages",{params:e})}},{key:"getTagsPopular",value:function(e){return this.get("/tags/popular",{params:e})}},{key:"getWikiLanguages",value:function(e){return this.get("/wiki/languages",{params:e})}}]),e}();i.$inject=["$http","$q"],t["default"]=i}})}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.name=t():(e["angular-osm"]=e["angular-osm"]||{},e["angular-osm"].name=t())}(this,function(){return function(e){function t(n){if(a[n])return a[n].exports;var i=a[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var a={};return t.m=e,t.c=a,t.p="",t(0)}({0:function(e,t,a){e.exports=a(10)},10:function(e,t,a){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=a(11),r=n(i),s=angular.module("osm.taginfo",[]).provider("osmTagInfoAPI",function(){this.options={url:"https://taginfo.openstreetmap.org/api/4"},this.$get=function(e,t){return new r.default(e,t,this.options)},this.$get.$inject=["$http","$q"]});t.default=s},11:function(e,t){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(e,t){for(var a=0;a<t.length;a++){var n=t[a];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,a,n){return a&&e(t.prototype,a),n&&e(t,n),t}}(),i=function(){function e(t,n,i){a(this,e),this.$http=t,this.$q=n,this.url=i.url,this.cache=!0,i.cache===!1&&(this.cache=!1)}return n(e,[{key:"get",value:function(e,t){var a=this.$q.defer();return t||(t={}),void 0===t.cache&&(t.cache=this.cache),this.$http.get(this.url+e,t).then(function(e){a.resolve(e.data)},function(e){a.reject(e)}),a.promise}},{key:"getKeyCombinations",value:function(e){return this.get("/key/combinations",{params:e})}},{key:"getKeyDistributionNodes",value:function(e){return this.get("/key/distribution/nodes",{params:e})}},{key:"getKeyDistributionWays",value:function(e){return this.get("/key/distribution/ways",{params:e})}},{key:"getKeyStats",value:function(e){return this.get("/key/stats",{params:e})}},{key:"getKeyValues",value:function(e){return this.get("/key/values",{params:e})}},{key:"getKeyWikiPages",value:function(e){return this.get("/key/wiki_pages",{params:e})}},{key:"getKeysAll",value:function(e){return this.get("/keys/all",{params:e})}},{key:"getKeysWikiPages",value:function(e){return this.get("/keys/wiki_pages",{params:e})}},{key:"getKeysWithoutWikiPage",value:function(e){return this.get("/keys/without_wiki_page",{params:e})}},{key:"getRelationRoles",value:function(e){return this.get("/relation/roles",{params:e})}},{key:"getRelationStats",value:function(e){return this.get("/relation/stats",{params:e})}},{key:"getRelationWikiPages",value:function(e){return this.get("/relation/wiki_pages",{params:e})}},{key:"getRelationsAll",value:function(e){return this.get("/relations/all",{params:e})}},{key:"getSearchByKeyAndValue",value:function(e){return this.get("/search/by_key_and_value",{params:e})}},{key:"getSearchByKeyword",value:function(e){return this.get("/search/by_keyword",{params:e})}},{key:"getSearchByRole",value:function(e){return this.get("/search/by_role",{params:e})}},{key:"getSearchByValue",value:function(e){return this.get("/search/by_value",{params:e})}},{key:"getSiteInfo",value:function(e){return this.get("/site/info",{params:e})}},{key:"getSiteSources",value:function(e){return this.get("/site/sources",{params:e})}},{key:"getTagCombinations",value:function(e){return this.get("/tag/combinations",{params:e})}},{key:"getTagDistributionNodes",value:function(e){return this.get("/tag/distribution/nodes",{params:e})}},{key:"getTagDistributionWays",value:function(e){return this.get("/tag/distribution/ways",{params:e})}},{key:"getTagStats",value:function(e){return this.get("/tag/stats",{params:e})}},{key:"getTagWikiPages",value:function(e){return this.get("/tag/wiki_pages",{params:e})}},{key:"getTagsPopular",value:function(e){return this.get("/tags/popular",{params:e})}},{key:"getWikiLanguages",value:function(e){return this.get("/wiki/languages",{params:e})}}]),e}();i.$inject=["$http","$q"],t.default=i}})}); |
@@ -124,3 +124,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
@@ -127,0 +127,0 @@ /** |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.name=t():(e["angular-osm"]=e["angular-osm"]||{},e["angular-osm"].name=t())}(this,function(){return function(e){function t(n){if(r[n])return r[n].exports;var o=r[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}({0:function(e,t,r){e.exports=r(14)},14:function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}Object.defineProperty(t,"__esModule",{value:!0});var o=r(15),a=n(o),i=angular.module("osm.togeojson",[]).provider("osmtogeojson",a["default"]);t["default"]=i},15:function(e,t,r){"use strict";function n(e){return e&&e.__esModule?e:{"default":e}}function o(){this.options={areaTags:["area","building","leisure","tourism","ruins","historic","landuse","military","natural","sport"],uninterestingTags:["source","source_ref","source:ref","history","attribution","created_by","tiger:county","tiger:tlid","tiger:upload_uuid"],styles:{}},this.$get=function(){return(0,i["default"])(this.options)}}Object.defineProperty(t,"__esModule",{value:!0});var a=r(16),i=n(a);t["default"]=o},16:function(e,t){"use strict";function r(e){function t(e){var t=[];e instanceof Array||(e=u(e));for(var r=0;r<e.length;r++){var n=e[r],o={type:"Feature",geometry:{},properties:{id:n.id,tags:n.tags}};if("changeset"===n.type){o.geometry.type="Polygon";var a=n.latLngBounds;o.geometry.coordinates=[[[parseFloat(a._min_lon),parseFloat(a._min_lat)],[parseFloat(a._min_lon),parseFloat(a._max_lat)],[parseFloat(a._max_lon),parseFloat(a._max_lat)],[parseFloat(a._max_lon),parseFloat(a._min_lat)],[parseFloat(a._min_lon),parseFloat(a._min_lat)]]]}else if("node"===n.type)o.geometry.type="Point",o.geometry.coordinates=[n.latLng[1],n.latLng[0]];else{for(var i=new Array(n.nodes.length),s=0;s<n.nodes.length;s++){var f=n.nodes[s].latLng;i[s]=[f[1],f[0]]}l(n)?(o.geometry.type="Polygon",o.geometry.coordinates=[i]):(o.geometry.type="LineString",o.geometry.coordinates=i)}t.push(o)}return t}function r(e){return Array.isArray(e)?e:"object"===("undefined"==typeof e?"undefined":n(e))?[e]:[]}function o(e){var t=r(e.tag),n={};return t.forEach(function(e){n[e._k]=e._v}),n}function a(e){var t=r(e.osm.node),n={};return t.forEach(function(e){n[e._id]={id:e._id,type:"node",latLng:[parseFloat(e._lat),parseFloat(e._lon)],tags:o(e)}}),n}function i(e,t){var n=[],a=r(e.osm.way);return a.forEach(function(e){for(var r=e.nd,a={id:e._id,type:"way",nodes:new Array(r.length),tags:o(e)},i=0;i<r.length;i++)a.nodes[i]=t[r[i]._ref];n.push(a)}),n}function s(e,t,n){for(var a=[],i=r(e.osm.relation),s=0;s<i.length;s++){for(var u=i[s],l=r(u.member),f={id:u._id,type:"relation",members:new Array(l.length),tags:o(u)},d=0;d<l.length;d++)"node"===l[d]._type?f.members[d]=t[l[d]._ref]:f.members[d]=null;a.push(f)}return a}function u(e){var t=[],r=a(e),n=i(e,r),o=s(e,r,n);for(var u in r){var l=r[u];f(l,n,o)&&t.push(l)}for(var d=0;d<n.length;d++){var c=n[d];t.push(c)}return t}function l(t){if(t.nodes[0]!=t.nodes[t.nodes.length-1])return!1;for(var r in t.tags)if(e.areaTags.indexOf(r))return!0;return!1}function f(e,t,r){for(var n=!1,o=0;o<t.length;o++)if(t[o].nodes.indexOf(e)>=0){n=!0;break}if(!n)return!0;for(var a=0;a<r.length;a++)if(r[a].members.indexOf(e)>=0)return!0;return!1}function d(e,r){var n={type:"FeatureCollection",features:[]};return e&&(n.features=t(e)),n}var c={options:e,getAsArray:r,getFeatures:t,getNodes:a,getWays:i,getRelations:s,getTags:o,buildFeatures:u,isWayArea:l,interestingNode:f,togeojson:d};return c}Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e};t["default"]=r}})}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.name=t():(e["angular-osm"]=e["angular-osm"]||{},e["angular-osm"].name=t())}(this,function(){return function(e){function t(o){if(r[o])return r[o].exports;var n=r[o]={exports:{},id:o,loaded:!1};return e[o].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}({0:function(e,t,r){e.exports=r(14)},14:function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var n=r(15),a=o(n),i=angular.module("osm.togeojson",[]).provider("osmtogeojson",a.default);t.default=i},15:function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}function n(){this.options={areaTags:["area","building","leisure","tourism","ruins","historic","landuse","military","natural","sport"],uninterestingTags:["source","source_ref","source:ref","history","attribution","created_by","tiger:county","tiger:tlid","tiger:upload_uuid"],styles:{}},this.$get=function(){return(0,i.default)(this.options)}}Object.defineProperty(t,"__esModule",{value:!0});var a=r(16),i=o(a);t.default=n},16:function(e,t){"use strict";function r(e){function t(e){var t=[];e instanceof Array||(e=u(e));for(var r=0;r<e.length;r++){var o=e[r],n={type:"Feature",geometry:{},properties:{id:o.id,tags:o.tags}};if("changeset"===o.type){n.geometry.type="Polygon";var a=o.latLngBounds;n.geometry.coordinates=[[[parseFloat(a._min_lon),parseFloat(a._min_lat)],[parseFloat(a._min_lon),parseFloat(a._max_lat)],[parseFloat(a._max_lon),parseFloat(a._max_lat)],[parseFloat(a._max_lon),parseFloat(a._min_lat)],[parseFloat(a._min_lon),parseFloat(a._min_lat)]]]}else if("node"===o.type)n.geometry.type="Point",n.geometry.coordinates=[o.latLng[1],o.latLng[0]];else{for(var i=new Array(o.nodes.length),s=0;s<o.nodes.length;s++){var f=o.nodes[s].latLng;i[s]=[f[1],f[0]]}l(o)?(n.geometry.type="Polygon",n.geometry.coordinates=[i]):(n.geometry.type="LineString",n.geometry.coordinates=i)}t.push(n)}return t}function r(e){return Array.isArray(e)?e:"object"===("undefined"==typeof e?"undefined":o(e))?[e]:[]}function n(e){var t=r(e.tag),o={};return t.forEach(function(e){o[e._k]=e._v}),o}function a(e){var t=r(e.osm.node),o={};return t.forEach(function(e){o[e._id]={id:e._id,type:"node",latLng:[parseFloat(e._lat),parseFloat(e._lon)],tags:n(e)}}),o}function i(e,t){var o=[],a=r(e.osm.way);return a.forEach(function(e){for(var r=e.nd,a={id:e._id,type:"way",nodes:new Array(r.length),tags:n(e)},i=0;i<r.length;i++)a.nodes[i]=t[r[i]._ref];o.push(a)}),o}function s(e,t,o){for(var a=[],i=r(e.osm.relation),s=0;s<i.length;s++){for(var u=i[s],l=r(u.member),f={id:u._id,type:"relation",members:new Array(l.length),tags:n(u)},d=0;d<l.length;d++)"node"===l[d]._type?f.members[d]=t[l[d]._ref]:f.members[d]=null;a.push(f)}return a}function u(e){var t=[],r=a(e),o=i(e,r),n=s(e,r,o);for(var u in r){var l=r[u];f(l,o,n)&&t.push(l)}for(var d=0;d<o.length;d++){var p=o[d];t.push(p)}return t}function l(t){if(t.nodes[0]!=t.nodes[t.nodes.length-1])return!1;for(var r in t.tags)if(e.areaTags.indexOf(r))return!0;return!1}function f(e,t,r){for(var o=!1,n=0;n<t.length;n++)if(t[n].nodes.indexOf(e)>=0){o=!0;break}if(!o)return!0;for(var a=0;a<r.length;a++)if(r[a].members.indexOf(e)>=0)return!0;return!1}function d(e,r){var o={type:"FeatureCollection",features:[]};return e&&(o.features=t(e)),o}var p={options:e,getAsArray:r,getFeatures:t,getNodes:a,getWays:i,getRelations:s,getTags:n,buildFeatures:u,isWayArea:l,interestingNode:f,togeojson:d};return p}Object.defineProperty(t,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};t.default=r}})}); |
@@ -28,2 +28,3 @@ { | ||
"coveralls": "^2.11.9", | ||
"cz-conventional-changelog": "^1.1.6", | ||
"ink-docstrap": "^1.2.0", | ||
@@ -50,3 +51,8 @@ "jasmine-core": "^2.4.1", | ||
}, | ||
"version": "1.1.1" | ||
"config": { | ||
"commitizen": { | ||
"path": "./node_modules/cz-conventional-changelog" | ||
} | ||
}, | ||
"version": "1.2.0" | ||
} |
@@ -9,2 +9,3 @@ Angular OSM | ||
[![semantic-release][semantic-image] ][semantic-url] | ||
[![Commitizen friendly][commitizen-image] ][commitizen-url] | ||
@@ -34,3 +35,6 @@ [![Quality][quality-badge] ][quality-url] | ||
[semantic-url]: https://github.com/semantic-release/semantic-release | ||
[commitizen-image]: https://img.shields.io/badge/commitizen-friendly-brightgreen.svg | ||
[commitizen-url]: http://commitizen.github.io/cz-cli/ | ||
[quality-badge]: http://npm.packagequality.com/shield/angular-osm.svg | ||
@@ -133,3 +137,3 @@ [quality-url]: http://packagequality.com/#?package=angular-osm | ||
If you want, most of provided service can be configured using correspondint providers | ||
If you want, most of provided service can be configured using corresponding providers | ||
@@ -136,0 +140,0 @@ angular.module('example', ['osm.api']) |
@@ -131,3 +131,3 @@ /** | ||
*/ | ||
createChangeset(comment) { | ||
createChangeset(comment, author) { | ||
var self = this; | ||
@@ -138,3 +138,3 @@ var deferred = this.$q.defer(); | ||
tag: [ | ||
{_k:'created_by', _v: 'Angular-OSM'}, | ||
{_k:'created_by', _v: author || 'Angular-OSM'}, | ||
{_k:'comment', _v: comment}, | ||
@@ -141,0 +141,0 @@ ] |
@@ -34,2 +34,3 @@ 'use strict'; | ||
}; | ||
it('should have URL configured', function() { | ||
@@ -39,2 +40,3 @@ var url = 'http://api.openstreetmap.org/api'; | ||
}); | ||
it('should access to oauth dependency if set', function() { | ||
@@ -117,2 +119,3 @@ var oauthDep = {}; | ||
}); | ||
it('should put works (case of create node) to return id', function() { | ||
@@ -145,2 +148,3 @@ setHTTPAdapter(deps); | ||
}); | ||
it('should delete works', function() { | ||
@@ -160,2 +164,3 @@ setHTTPAdapter(deps); | ||
}); | ||
it('should createChangeset works', function() { | ||
@@ -181,2 +186,23 @@ setHTTPAdapter(deps); | ||
it('should createChangeset via specific author name works', function() { | ||
setHTTPAdapter(deps); | ||
var method = '/0.6/changeset/create'; | ||
var comment = 'my changeset'; | ||
var author = "foobar"; | ||
var url = deps.osmAPI.url + method; | ||
var response = '3147'; //The ID of the newly created changeset | ||
var xml = '<osm>'; | ||
xml += '<changeset><tag k="created_by" v="foobar" />'; | ||
xml += '<tag k="comment" v="my changeset" />'; | ||
xml += '</changeset></osm>'; | ||
deps.$httpBackend.expectPUT(url, xml).respond(200, response); | ||
deps.osmAPI.createChangeset(comment, author) | ||
.then(function (data) { | ||
expect(typeof data).toBe('string'); | ||
expect(data).toBe(response); | ||
}); | ||
deps.$rootScope.$digest(); | ||
deps.$httpBackend.flush(); | ||
}); | ||
it('should getLastOpenedChangesetId works', function() { | ||
@@ -199,2 +225,3 @@ setHTTPAdapter(deps); | ||
}); | ||
it('should closeChangeset works', function() { | ||
@@ -216,2 +243,2 @@ setHTTPAdapter(deps); | ||
}); | ||
}); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
8237
157
615899
21