{"action":"created","comment":{"url":"https://api.github.com/repos/camptocamp/ngeo/pulls/comments/48827446","id":48827446,"diff_hunk":"@@ -0,0 +1,316 @@\n+goog.provide('ngeo.LayerHelper');\n+\n+goog.require('ngeo');\n+goog.require('ol.Collection');\n+goog.require('ol.format.WMTSCapabilities');\n+goog.require('ol.layer.Group');\n+goog.require('ol.layer.Image');\n+goog.require('ol.layer.Tile');\n+goog.require('ol.source.ImageWMS');\n+goog.require('ol.source.WMTS');\n+\n+\n+\n+/**\n+ * Provides helpers fonctions that helps you to create and manage layers.\n+ *\n+ * @param {angular.$q} $q Angular promises/deferred service.\n+ * @param {angular.$http} $http Angular http service.\n+ * @constructor\n+ * @ngdoc service\n+ * @ngname ngeoLayerHelper\n+ * @ngInject\n+ */\n+ngeo.LayerHelper = function($q, $http) {\n+\n+  /**\n+   * @type {boolean}\n+   * @private\n+   */\n+  this.initialized_ = false;\n+\n+  /**\n+   * @type {ol.Map}\n+   * @private\n+   */\n+  this.map_ = null;\n+\n+  /**\n+   * @type {angular.$q}\n+   * @private\n+   */\n+  this.$q_ = $q;\n+\n+  /**\n+   * @type {angular.$http}\n+   * @private\n+   */\n+  this.$http_ = $http;\n+\n+  /**\n+   * @type {string}\n+   * @export\n+   */\n+  this.helperID = 'helperID';\n+};\n+\n+\n+/**\n+ * Init the service.\n+ * @param {!ol.Map} map\n+ * @export\n+ */\n+ngeo.LayerHelper.prototype.init = function(map) {","path":"src/services/layerHelper.js","position":63,"original_position":63,"commit_id":"a7f73506421f5f1249af0f7cb2aab2fd9f80cc18","original_commit_id":"a7f73506421f5f1249af0f7cb2aab2fd9f80cc18","user":{"login":"fgravin","id":1491924,"avatar_url":"https://avatars.githubusercontent.com/u/1491924?v=3","gravatar_id":"","url":"https://api.github.com/users/fgravin","html_url":"https://github.com/fgravin","followers_url":"https://api.github.com/users/fgravin/followers","following_url":"https://api.github.com/users/fgravin/following{/other_user}","gists_url":"https://api.github.com/users/fgravin/gists{/gist_id}","starred_url":"https://api.github.com/users/fgravin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fgravin/subscriptions","organizations_url":"https://api.github.com/users/fgravin/orgs","repos_url":"https://api.github.com/users/fgravin/repos","events_url":"https://api.github.com/users/fgravin/events{/privacy}","received_events_url":"https://api.github.com/users/fgravin/received_events","type":"User","site_admin":false},"body":"This makes the service bound to only one map.\r\nAs services are Singleton, we can use just one service for one map. \r\nIf you look at https://github.com/camptocamp/ngeo/blob/master/src/services/backgroundlayermgr.js#L117 for example, one service can manage multiple maps.\r\n\r\nBut, we can leave this like that for now, it may not be necessary...","created_at":"2016-01-05T09:43:23Z","updated_at":"2016-01-05T09:43:23Z","html_url":"https://github.com/camptocamp/ngeo/pull/483#discussion_r48827446","pull_request_url":"https://api.github.com/repos/camptocamp/ngeo/pulls/483","_links":{"self":{"href":"https://api.github.com/repos/camptocamp/ngeo/pulls/comments/48827446"},"html":{"href":"https://github.com/camptocamp/ngeo/pull/483#discussion_r48827446"},"pull_request":{"href":"https://api.github.com/repos/camptocamp/ngeo/pulls/483"}}},"pull_request":{"url":"https://api.github.com/repos/camptocamp/ngeo/pulls/483","id":55066831,"html_url":"https://github.com/camptocamp/ngeo/pull/483","diff_url":"https://github.com/camptocamp/ngeo/pull/483.diff","patch_url":"https://github.com/camptocamp/ngeo/pull/483.patch","issue_url":"https://api.github.com/repos/camptocamp/ngeo/issues/483","number":483,"state":"open","locked":false,"title":"Add layerHelper service","user":{"login":"ger-benjamin","id":1792111,"avatar_url":"https://avatars.githubusercontent.com/u/1792111?v=3","gravatar_id":"","url":"https://api.github.com/users/ger-benjamin","html_url":"https://github.com/ger-benjamin","followers_url":"https://api.github.com/users/ger-benjamin/followers","following_url":"https://api.github.com/users/ger-benjamin/following{/other_user}","gists_url":"https://api.github.com/users/ger-benjamin/gists{/gist_id}","starred_url":"https://api.github.com/users/ger-benjamin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ger-benjamin/subscriptions","organizations_url":"https://api.github.com/users/ger-benjamin/orgs","repos_url":"https://api.github.com/users/ger-benjamin/repos","events_url":"https://api.github.com/users/ger-benjamin/events{/privacy}","received_events_url":"https://api.github.com/users/ger-benjamin/received_events","type":"User","site_admin":false},"body":"Will be used by the layertree and the backgroundmanager","created_at":"2016-01-05T08:47:37Z","updated_at":"2016-01-05T09:43:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b98e370f752029583d2d980493ef779dc0dac510","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/camptocamp/ngeo/pulls/483/commits","review_comments_url":"https://api.github.com/repos/camptocamp/ngeo/pulls/483/comments","review_comment_url":"https://api.github.com/repos/camptocamp/ngeo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/camptocamp/ngeo/issues/483/comments","statuses_url":"https://api.github.com/repos/camptocamp/ngeo/statuses/a7f73506421f5f1249af0f7cb2aab2fd9f80cc18","head":{"label":"ger-benjamin:layerHelper","ref":"layerHelper","sha":"a7f73506421f5f1249af0f7cb2aab2fd9f80cc18","user":{"login":"ger-benjamin","id":1792111,"avatar_url":"https://avatars.githubusercontent.com/u/1792111?v=3","gravatar_id":"","url":"https://api.github.com/users/ger-benjamin","html_url":"https://github.com/ger-benjamin","followers_url":"https://api.github.com/users/ger-benjamin/followers","following_url":"https://api.github.com/users/ger-benjamin/following{/other_user}","gists_url":"https://api.github.com/users/ger-benjamin/gists{/gist_id}","starred_url":"https://api.github.com/users/ger-benjamin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ger-benjamin/subscriptions","organizations_url":"https://api.github.com/users/ger-benjamin/orgs","repos_url":"https://api.github.com/users/ger-benjamin/repos","events_url":"https://api.github.com/users/ger-benjamin/events{/privacy}","received_events_url":"https://api.github.com/users/ger-benjamin/received_events","type":"User","site_admin":false},"repo":{"id":45966295,"name":"ngeo","full_name":"ger-benjamin/ngeo","owner":{"login":"ger-benjamin","id":1792111,"avatar_url":"https://avatars.githubusercontent.com/u/1792111?v=3","gravatar_id":"","url":"https://api.github.com/users/ger-benjamin","html_url":"https://github.com/ger-benjamin","followers_url":"https://api.github.com/users/ger-benjamin/followers","following_url":"https://api.github.com/users/ger-benjamin/following{/other_user}","gists_url":"https://api.github.com/users/ger-benjamin/gists{/gist_id}","starred_url":"https://api.github.com/users/ger-benjamin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ger-benjamin/subscriptions","organizations_url":"https://api.github.com/users/ger-benjamin/orgs","repos_url":"https://api.github.com/users/ger-benjamin/repos","events_url":"https://api.github.com/users/ger-benjamin/events{/privacy}","received_events_url":"https://api.github.com/users/ger-benjamin/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ger-benjamin/ngeo","description":"Library combining OpenLayers 3 and AngularJS","fork":true,"url":"https://api.github.com/repos/ger-benjamin/ngeo","forks_url":"https://api.github.com/repos/ger-benjamin/ngeo/forks","keys_url":"https://api.github.com/repos/ger-benjamin/ngeo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ger-benjamin/ngeo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ger-benjamin/ngeo/teams","hooks_url":"https://api.github.com/repos/ger-benjamin/ngeo/hooks","issue_events_url":"https://api.github.com/repos/ger-benjamin/ngeo/issues/events{/number}","events_url":"https://api.github.com/repos/ger-benjamin/ngeo/events","assignees_url":"https://api.github.com/repos/ger-benjamin/ngeo/assignees{/user}","branches_url":"https://api.github.com/repos/ger-benjamin/ngeo/branches{/branch}","tags_url":"https://api.github.com/repos/ger-benjamin/ngeo/tags","blobs_url":"https://api.github.com/repos/ger-benjamin/ngeo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ger-benjamin/ngeo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ger-benjamin/ngeo/git/refs{/sha}","trees_url":"https://api.github.com/repos/ger-benjamin/ngeo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ger-benjamin/ngeo/statuses/{sha}","languages_url":"https://api.github.com/repos/ger-benjamin/ngeo/languages","stargazers_url":"https://api.github.com/repos/ger-benjamin/ngeo/stargazers","contributors_url":"https://api.github.com/repos/ger-benjamin/ngeo/contributors","subscribers_url":"https://api.github.com/repos/ger-benjamin/ngeo/subscribers","subscription_url":"https://api.github.com/repos/ger-benjamin/ngeo/subscription","commits_url":"https://api.github.com/repos/ger-benjamin/ngeo/commits{/sha}","git_commits_url":"https://api.github.com/repos/ger-benjamin/ngeo/git/commits{/sha}","comments_url":"https://api.github.com/repos/ger-benjamin/ngeo/comments{/number}","issue_comment_url":"https://api.github.com/repos/ger-benjamin/ngeo/issues/comments{/number}","contents_url":"https://api.github.com/repos/ger-benjamin/ngeo/contents/{+path}","compare_url":"https://api.github.com/repos/ger-benjamin/ngeo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ger-benjamin/ngeo/merges","archive_url":"https://api.github.com/repos/ger-benjamin/ngeo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ger-benjamin/ngeo/downloads","issues_url":"https://api.github.com/repos/ger-benjamin/ngeo/issues{/number}","pulls_url":"https://api.github.com/repos/ger-benjamin/ngeo/pulls{/number}","milestones_url":"https://api.github.com/repos/ger-benjamin/ngeo/milestones{/number}","notifications_url":"https://api.github.com/repos/ger-benjamin/ngeo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ger-benjamin/ngeo/labels{/name}","releases_url":"https://api.github.com/repos/ger-benjamin/ngeo/releases{/id}","created_at":"2015-11-11T07:25:12Z","updated_at":"2015-11-11T07:25:15Z","pushed_at":"2016-01-05T09:09:54Z","git_url":"git://github.com/ger-benjamin/ngeo.git","ssh_url":"git@github.com:ger-benjamin/ngeo.git","clone_url":"https://github.com/ger-benjamin/ngeo.git","svn_url":"https://github.com/ger-benjamin/ngeo","homepage":null,"size":13946,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"camptocamp:master","ref":"master","sha":"dabc3ca80d762a82a36ddeed5d4076a4c94a91ef","user":{"login":"camptocamp","id":28109,"avatar_url":"https://avatars.githubusercontent.com/u/28109?v=3","gravatar_id":"","url":"https://api.github.com/users/camptocamp","html_url":"https://github.com/camptocamp","followers_url":"https://api.github.com/users/camptocamp/followers","following_url":"https://api.github.com/users/camptocamp/following{/other_user}","gists_url":"https://api.github.com/users/camptocamp/gists{/gist_id}","starred_url":"https://api.github.com/users/camptocamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/camptocamp/subscriptions","organizations_url":"https://api.github.com/users/camptocamp/orgs","repos_url":"https://api.github.com/users/camptocamp/repos","events_url":"https://api.github.com/users/camptocamp/events{/privacy}","received_events_url":"https://api.github.com/users/camptocamp/received_events","type":"Organization","site_admin":false},"repo":{"id":20212761,"name":"ngeo","full_name":"camptocamp/ngeo","owner":{"login":"camptocamp","id":28109,"avatar_url":"https://avatars.githubusercontent.com/u/28109?v=3","gravatar_id":"","url":"https://api.github.com/users/camptocamp","html_url":"https://github.com/camptocamp","followers_url":"https://api.github.com/users/camptocamp/followers","following_url":"https://api.github.com/users/camptocamp/following{/other_user}","gists_url":"https://api.github.com/users/camptocamp/gists{/gist_id}","starred_url":"https://api.github.com/users/camptocamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/camptocamp/subscriptions","organizations_url":"https://api.github.com/users/camptocamp/orgs","repos_url":"https://api.github.com/users/camptocamp/repos","events_url":"https://api.github.com/users/camptocamp/events{/privacy}","received_events_url":"https://api.github.com/users/camptocamp/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/camptocamp/ngeo","description":"Library combining OpenLayers 3 and AngularJS","fork":false,"url":"https://api.github.com/repos/camptocamp/ngeo","forks_url":"https://api.github.com/repos/camptocamp/ngeo/forks","keys_url":"https://api.github.com/repos/camptocamp/ngeo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/camptocamp/ngeo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/camptocamp/ngeo/teams","hooks_url":"https://api.github.com/repos/camptocamp/ngeo/hooks","issue_events_url":"https://api.github.com/repos/camptocamp/ngeo/issues/events{/number}","events_url":"https://api.github.com/repos/camptocamp/ngeo/events","assignees_url":"https://api.github.com/repos/camptocamp/ngeo/assignees{/user}","branches_url":"https://api.github.com/repos/camptocamp/ngeo/branches{/branch}","tags_url":"https://api.github.com/repos/camptocamp/ngeo/tags","blobs_url":"https://api.github.com/repos/camptocamp/ngeo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/camptocamp/ngeo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/camptocamp/ngeo/git/refs{/sha}","trees_url":"https://api.github.com/repos/camptocamp/ngeo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/camptocamp/ngeo/statuses/{sha}","languages_url":"https://api.github.com/repos/camptocamp/ngeo/languages","stargazers_url":"https://api.github.com/repos/camptocamp/ngeo/stargazers","contributors_url":"https://api.github.com/repos/camptocamp/ngeo/contributors","subscribers_url":"https://api.github.com/repos/camptocamp/ngeo/subscribers","subscription_url":"https://api.github.com/repos/camptocamp/ngeo/subscription","commits_url":"https://api.github.com/repos/camptocamp/ngeo/commits{/sha}","git_commits_url":"https://api.github.com/repos/camptocamp/ngeo/git/commits{/sha}","comments_url":"https://api.github.com/repos/camptocamp/ngeo/comments{/number}","issue_comment_url":"https://api.github.com/repos/camptocamp/ngeo/issues/comments{/number}","contents_url":"https://api.github.com/repos/camptocamp/ngeo/contents/{+path}","compare_url":"https://api.github.com/repos/camptocamp/ngeo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/camptocamp/ngeo/merges","archive_url":"https://api.github.com/repos/camptocamp/ngeo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/camptocamp/ngeo/downloads","issues_url":"https://api.github.com/repos/camptocamp/ngeo/issues{/number}","pulls_url":"https://api.github.com/repos/camptocamp/ngeo/pulls{/number}","milestones_url":"https://api.github.com/repos/camptocamp/ngeo/milestones{/number}","notifications_url":"https://api.github.com/repos/camptocamp/ngeo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/camptocamp/ngeo/labels{/name}","releases_url":"https://api.github.com/repos/camptocamp/ngeo/releases{/id}","created_at":"2014-05-27T08:34:54Z","updated_at":"2015-12-23T05:21:15Z","pushed_at":"2016-01-05T09:17:49Z","git_url":"git://github.com/camptocamp/ngeo.git","ssh_url":"git@github.com:camptocamp/ngeo.git","clone_url":"https://github.com/camptocamp/ngeo.git","svn_url":"https://github.com/camptocamp/ngeo","homepage":null,"size":19918,"stargazers_count":53,"watchers_count":53,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":31,"mirror_url":null,"open_issues_count":36,"forks":31,"open_issues":36,"watchers":53,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/camptocamp/ngeo/pulls/483"},"html":{"href":"https://github.com/camptocamp/ngeo/pull/483"},"issue":{"href":"https://api.github.com/repos/camptocamp/ngeo/issues/483"},"comments":{"href":"https://api.github.com/repos/camptocamp/ngeo/issues/483/comments"},"review_comments":{"href":"https://api.github.com/repos/camptocamp/ngeo/pulls/483/comments"},"review_comment":{"href":"https://api.github.com/repos/camptocamp/ngeo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/camptocamp/ngeo/pulls/483/commits"},"statuses":{"href":"https://api.github.com/repos/camptocamp/ngeo/statuses/a7f73506421f5f1249af0f7cb2aab2fd9f80cc18"}}}}