{"action":"created","comment":{"url":"https://api.github.com/repos/MapStory/story-tools/pulls/comments/30210066","id":30210066,"diff_hunk":"@@ -0,0 +1,460 @@\n+(function() {\n+    'use strict';\n+\n+    var module = angular.module('storytools.edit.ogc', [\n+    ]);\n+\n+    function StoryMap(data) {\n+      ol.Object.call(this, data);\n+      this.map_ = new ol.Map({target: data.target});\n+      this.storyLayers_ = new ol.Collection();\n+      this.animationDuration_ = data.animationDuration || 500;\n+    }\n+\n+    StoryMap.prototype = Object.create(ol.Object.prototype);\n+    StoryMap.prototype.constructor = StoryMap;\n+\n+    StoryMap.prototype.getState = function() {\n+      var config = {};\n+      config.map = {\n+        center: this.map_.getView().getCenter(),\n+        projection: this.map_.getView().getProjection().getCode(),\n+        zoom: this.map_.getView().getZoom(),\n+        layers: []\n+      };\n+      var mapId = this.get('id');\n+      if (mapId >= 0) {\n+        config.id = mapId;\n+      }\n+      var baseLayer = this.get('baselayer');\n+      if (baseLayer) {\n+        var baseLayerState = this.get('baselayer').get('state');\n+        baseLayerState.group = 'background';\n+        baseLayerState.visibility = true;\n+        config.map.layers.push(baseLayerState);\n+      }\n+      this.storyLayers_.forEach(function(storyLayer) {\n+        config.map.layers.push(storyLayer.getState());\n+      });\n+      return config;\n+    };\n+\n+    StoryMap.prototype.setBaseLayer = function(baseLayer) {\n+      this.set('baselayer', baseLayer);\n+      this.map_.getLayers().forEach(function(lyr) {\n+        if (lyr.get('group') === 'background') {\n+          this.map_.removeLayer(lyr);\n+        }\n+      }, this);\n+      this.map_.getLayers().insertAt(0, this.get('baselayer'));\n+    };\n+\n+    StoryMap.prototype.addStoryLayer = function(storyLayer) {\n+      this.storyLayers_.push(storyLayer);\n+      this.map_.addLayer(storyLayer.getLayer());\n+    };\n+\n+    StoryMap.prototype.removeStoryLayer = function(storyLayer) {\n+      this.storyLayers_.remove(storyLayer);\n+      this.map_.removeLayer(storyLayer.getLayer());\n+    };\n+\n+    StoryMap.prototype.getStoryLayers = function() {\n+      return this.storyLayers_;\n+    };\n+\n+    StoryMap.prototype.getMap = function() {\n+      return this.map_;\n+    };\n+\n+    StoryMap.prototype.clear = function() {\n+      this.map_.getLayers().clear();\n+      this.storyLayers_.clear();\n+    };\n+\n+    StoryMap.prototype.animateCenterAndZoom = function(center, zoom) {\n+      var view = this.map_.getView();\n+      this.map_.beforeRender(ol.animation.pan({\n+        duration: this.animationDuration_,\n+        source: view.getCenter()\n+      }));\n+      view.setCenter(center);\n+      this.map_.beforeRender(ol.animation.zoom({\n+        resolution: view.getResolution(),\n+        duration: this.animationDuration_\n+      }));\n+      view.setZoom(zoom);\n+    };\n+\n+    StoryMap.prototype.setAllowPan = function(allowPan) {\n+      this.map_.getInteractions().forEach(function(i) {\n+        if (i instanceof ol.interaction.KeyboardPan ||\n+          i instanceof ol.interaction.DragPan) {\n+            i.setActive(allowPan);\n+        }\n+      });\n+    };\n+\n+    StoryMap.prototype.setAllowZoom = function(allowZoom) {\n+      var zoomCtrl;\n+      this.map_.getControls().forEach(function(c) {\n+        if (c instanceof ol.control.Zoom) {\n+          zoomCtrl = c;\n+        }\n+      });\n+      if (!allowZoom) {\n+        this.map_.removeControl(zoomCtrl);\n+      } else {\n+        this.map_.addControl(new ol.control.Zoom());\n+      }\n+      this.map_.getInteractions().forEach(function(i) {\n+        if (i instanceof ol.interaction.DoubleClickZoom ||\n+          i instanceof ol.interaction.PinchZoom ||\n+          i instanceof ol.interaction.DragZoom ||\n+          i instanceof ol.interaction.MouseWheelZoom) {\n+            i.setActive(allowZoom);\n+        }\n+      });\n+    };\n+\n+    module.constant('StoryMap', StoryMap);\n+\n+    function StoryLayer(data) {\n+      if (data.times && storytools.core.time.utils.isRangeLike(data.times)) {\n+        data.times = new storytools.core.time.utils.Interval(data.times);\n+      }\n+      ol.Object.call(this, data);\n+      var layer;\n+      if (this.get('type') === 'VECTOR') {\n+        layer = new ol.layer.Vector();\n+      } else if (this.get('type') === 'WMS') {\n+        var config = {\n+          useOldAsInterimTiles: true\n+        };\n+        if (this.get('singleTile') === true) {\n+          layer = new ol.layer.Image(config);\n+        } else {\n+          layer = new ol.layer.Tile(config);\n+        }\n+      }\n+      this.layer_ = layer;\n+    }\n+\n+    StoryLayer.prototype = Object.create(ol.Object.prototype);\n+    StoryLayer.prototype.constructor = StoryLayer;\n+\n+    StoryLayer.prototype.getState = function() {\n+      return this.getProperties();\n+    };\n+\n+    StoryLayer.prototype.getLayer = function() {\n+      return this.layer_;\n+    };\n+\n+    StoryLayer.prototype.setLayer = function(layer) {\n+      this.layer_ = layer;\n+    };\n+\n+    function EditableStoryLayer(data) {\n+      StoryLayer.call(this, data);\n+    }\n+\n+    EditableStoryLayer.prototype = Object.create(StoryLayer.prototype);\n+    EditableStoryLayer.prototype.constructor = EditableStoryLayer;\n+\n+    module.constant('StoryLayer', StoryLayer);\n+    module.constant('EditableStoryLayer', EditableStoryLayer);\n+\n+    module.service('stAnnotateLayer', function($http, $q) {\n+      return {\n+        setWMSSource: function(EditableStoryLayer) {","path":"lib/ng/edit/ogc/module.js","position":null,"original_position":170,"commit_id":"f5357595ea47926a4fd38bf13bb99da102d20898","original_commit_id":"5e69a708df812810e26c84ad16236309c3b326c1","user":{"login":"bartvde","id":319678,"avatar_url":"https://avatars.githubusercontent.com/u/319678?v=3","gravatar_id":"","url":"https://api.github.com/users/bartvde","html_url":"https://github.com/bartvde","followers_url":"https://api.github.com/users/bartvde/followers","following_url":"https://api.github.com/users/bartvde/following{/other_user}","gists_url":"https://api.github.com/users/bartvde/gists{/gist_id}","starred_url":"https://api.github.com/users/bartvde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bartvde/subscriptions","organizations_url":"https://api.github.com/users/bartvde/orgs","repos_url":"https://api.github.com/users/bartvde/repos","events_url":"https://api.github.com/users/bartvde/events{/privacy}","received_events_url":"https://api.github.com/users/bartvde/received_events","type":"User","site_admin":false},"body":"See: https://github.com/bartvde/story-tools/commit/f5357595ea47926a4fd38bf13bb99da102d20898","created_at":"2015-05-13T08:14:45Z","updated_at":"2015-05-13T08:14:45Z","html_url":"https://github.com/MapStory/story-tools/pull/211#discussion_r30210066","pull_request_url":"https://api.github.com/repos/MapStory/story-tools/pulls/211","_links":{"self":{"href":"https://api.github.com/repos/MapStory/story-tools/pulls/comments/30210066"},"html":{"href":"https://github.com/MapStory/story-tools/pull/211#discussion_r30210066"},"pull_request":{"href":"https://api.github.com/repos/MapStory/story-tools/pulls/211"}}},"pull_request":{"url":"https://api.github.com/repos/MapStory/story-tools/pulls/211","id":34390459,"html_url":"https://github.com/MapStory/story-tools/pull/211","diff_url":"https://github.com/MapStory/story-tools/pull/211.diff","patch_url":"https://github.com/MapStory/story-tools/pull/211.patch","issue_url":"https://api.github.com/repos/MapStory/story-tools/issues/211","number":211,"state":"open","locked":false,"title":"Introduce Immutable and Mutable Layer Wrappers","user":{"login":"bartvde","id":319678,"avatar_url":"https://avatars.githubusercontent.com/u/319678?v=3","gravatar_id":"","url":"https://api.github.com/users/bartvde","html_url":"https://github.com/bartvde","followers_url":"https://api.github.com/users/bartvde/followers","following_url":"https://api.github.com/users/bartvde/following{/other_user}","gists_url":"https://api.github.com/users/bartvde/gists{/gist_id}","starred_url":"https://api.github.com/users/bartvde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bartvde/subscriptions","organizations_url":"https://api.github.com/users/bartvde/orgs","repos_url":"https://api.github.com/users/bartvde/repos","events_url":"https://api.github.com/users/bartvde/events{/privacy}","received_events_url":"https://api.github.com/users/bartvde/received_events","type":"User","site_admin":false},"body":"Work In Progress","created_at":"2015-04-29T18:15:13Z","updated_at":"2015-05-13T08:14:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"daf07be9ef8b422ba5f069def73586c0d0504628","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/MapStory/story-tools/pulls/211/commits","review_comments_url":"https://api.github.com/repos/MapStory/story-tools/pulls/211/comments","review_comment_url":"https://api.github.com/repos/MapStory/story-tools/pulls/comments{/number}","comments_url":"https://api.github.com/repos/MapStory/story-tools/issues/211/comments","statuses_url":"https://api.github.com/repos/MapStory/story-tools/statuses/f5357595ea47926a4fd38bf13bb99da102d20898","head":{"label":"bartvde:refactor","ref":"refactor","sha":"f5357595ea47926a4fd38bf13bb99da102d20898","user":{"login":"bartvde","id":319678,"avatar_url":"https://avatars.githubusercontent.com/u/319678?v=3","gravatar_id":"","url":"https://api.github.com/users/bartvde","html_url":"https://github.com/bartvde","followers_url":"https://api.github.com/users/bartvde/followers","following_url":"https://api.github.com/users/bartvde/following{/other_user}","gists_url":"https://api.github.com/users/bartvde/gists{/gist_id}","starred_url":"https://api.github.com/users/bartvde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bartvde/subscriptions","organizations_url":"https://api.github.com/users/bartvde/orgs","repos_url":"https://api.github.com/users/bartvde/repos","events_url":"https://api.github.com/users/bartvde/events{/privacy}","received_events_url":"https://api.github.com/users/bartvde/received_events","type":"User","site_admin":false},"repo":{"id":26578731,"name":"story-tools","full_name":"bartvde/story-tools","owner":{"login":"bartvde","id":319678,"avatar_url":"https://avatars.githubusercontent.com/u/319678?v=3","gravatar_id":"","url":"https://api.github.com/users/bartvde","html_url":"https://github.com/bartvde","followers_url":"https://api.github.com/users/bartvde/followers","following_url":"https://api.github.com/users/bartvde/following{/other_user}","gists_url":"https://api.github.com/users/bartvde/gists{/gist_id}","starred_url":"https://api.github.com/users/bartvde/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bartvde/subscriptions","organizations_url":"https://api.github.com/users/bartvde/orgs","repos_url":"https://api.github.com/users/bartvde/repos","events_url":"https://api.github.com/users/bartvde/events{/privacy}","received_events_url":"https://api.github.com/users/bartvde/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/bartvde/story-tools","description":"","fork":true,"url":"https://api.github.com/repos/bartvde/story-tools","forks_url":"https://api.github.com/repos/bartvde/story-tools/forks","keys_url":"https://api.github.com/repos/bartvde/story-tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/bartvde/story-tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/bartvde/story-tools/teams","hooks_url":"https://api.github.com/repos/bartvde/story-tools/hooks","issue_events_url":"https://api.github.com/repos/bartvde/story-tools/issues/events{/number}","events_url":"https://api.github.com/repos/bartvde/story-tools/events","assignees_url":"https://api.github.com/repos/bartvde/story-tools/assignees{/user}","branches_url":"https://api.github.com/repos/bartvde/story-tools/branches{/branch}","tags_url":"https://api.github.com/repos/bartvde/story-tools/tags","blobs_url":"https://api.github.com/repos/bartvde/story-tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/bartvde/story-tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/bartvde/story-tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/bartvde/story-tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/bartvde/story-tools/statuses/{sha}","languages_url":"https://api.github.com/repos/bartvde/story-tools/languages","stargazers_url":"https://api.github.com/repos/bartvde/story-tools/stargazers","contributors_url":"https://api.github.com/repos/bartvde/story-tools/contributors","subscribers_url":"https://api.github.com/repos/bartvde/story-tools/subscribers","subscription_url":"https://api.github.com/repos/bartvde/story-tools/subscription","commits_url":"https://api.github.com/repos/bartvde/story-tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/bartvde/story-tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/bartvde/story-tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/bartvde/story-tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/bartvde/story-tools/contents/{+path}","compare_url":"https://api.github.com/repos/bartvde/story-tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/bartvde/story-tools/merges","archive_url":"https://api.github.com/repos/bartvde/story-tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/bartvde/story-tools/downloads","issues_url":"https://api.github.com/repos/bartvde/story-tools/issues{/number}","pulls_url":"https://api.github.com/repos/bartvde/story-tools/pulls{/number}","milestones_url":"https://api.github.com/repos/bartvde/story-tools/milestones{/number}","notifications_url":"https://api.github.com/repos/bartvde/story-tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/bartvde/story-tools/labels{/name}","releases_url":"https://api.github.com/repos/bartvde/story-tools/releases{/id}","created_at":"2014-11-13T08:41:54Z","updated_at":"2015-03-23T09:48:46Z","pushed_at":"2015-05-13T08:14:32Z","git_url":"git://github.com/bartvde/story-tools.git","ssh_url":"git@github.com:bartvde/story-tools.git","clone_url":"https://github.com/bartvde/story-tools.git","svn_url":"https://github.com/bartvde/story-tools","homepage":null,"size":5863,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"MapStory:master","ref":"master","sha":"ccf9237c8fdd20b5a0de2e03fc98efb0deb54c1d","user":{"login":"MapStory","id":3664103,"avatar_url":"https://avatars.githubusercontent.com/u/3664103?v=3","gravatar_id":"","url":"https://api.github.com/users/MapStory","html_url":"https://github.com/MapStory","followers_url":"https://api.github.com/users/MapStory/followers","following_url":"https://api.github.com/users/MapStory/following{/other_user}","gists_url":"https://api.github.com/users/MapStory/gists{/gist_id}","starred_url":"https://api.github.com/users/MapStory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MapStory/subscriptions","organizations_url":"https://api.github.com/users/MapStory/orgs","repos_url":"https://api.github.com/users/MapStory/repos","events_url":"https://api.github.com/users/MapStory/events{/privacy}","received_events_url":"https://api.github.com/users/MapStory/received_events","type":"Organization","site_admin":false},"repo":{"id":26136677,"name":"story-tools","full_name":"MapStory/story-tools","owner":{"login":"MapStory","id":3664103,"avatar_url":"https://avatars.githubusercontent.com/u/3664103?v=3","gravatar_id":"","url":"https://api.github.com/users/MapStory","html_url":"https://github.com/MapStory","followers_url":"https://api.github.com/users/MapStory/followers","following_url":"https://api.github.com/users/MapStory/following{/other_user}","gists_url":"https://api.github.com/users/MapStory/gists{/gist_id}","starred_url":"https://api.github.com/users/MapStory/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MapStory/subscriptions","organizations_url":"https://api.github.com/users/MapStory/orgs","repos_url":"https://api.github.com/users/MapStory/repos","events_url":"https://api.github.com/users/MapStory/events{/privacy}","received_events_url":"https://api.github.com/users/MapStory/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/MapStory/story-tools","description":"","fork":false,"url":"https://api.github.com/repos/MapStory/story-tools","forks_url":"https://api.github.com/repos/MapStory/story-tools/forks","keys_url":"https://api.github.com/repos/MapStory/story-tools/keys{/key_id}","collaborators_url":"https://api.github.com/repos/MapStory/story-tools/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/MapStory/story-tools/teams","hooks_url":"https://api.github.com/repos/MapStory/story-tools/hooks","issue_events_url":"https://api.github.com/repos/MapStory/story-tools/issues/events{/number}","events_url":"https://api.github.com/repos/MapStory/story-tools/events","assignees_url":"https://api.github.com/repos/MapStory/story-tools/assignees{/user}","branches_url":"https://api.github.com/repos/MapStory/story-tools/branches{/branch}","tags_url":"https://api.github.com/repos/MapStory/story-tools/tags","blobs_url":"https://api.github.com/repos/MapStory/story-tools/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/MapStory/story-tools/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/MapStory/story-tools/git/refs{/sha}","trees_url":"https://api.github.com/repos/MapStory/story-tools/git/trees{/sha}","statuses_url":"https://api.github.com/repos/MapStory/story-tools/statuses/{sha}","languages_url":"https://api.github.com/repos/MapStory/story-tools/languages","stargazers_url":"https://api.github.com/repos/MapStory/story-tools/stargazers","contributors_url":"https://api.github.com/repos/MapStory/story-tools/contributors","subscribers_url":"https://api.github.com/repos/MapStory/story-tools/subscribers","subscription_url":"https://api.github.com/repos/MapStory/story-tools/subscription","commits_url":"https://api.github.com/repos/MapStory/story-tools/commits{/sha}","git_commits_url":"https://api.github.com/repos/MapStory/story-tools/git/commits{/sha}","comments_url":"https://api.github.com/repos/MapStory/story-tools/comments{/number}","issue_comment_url":"https://api.github.com/repos/MapStory/story-tools/issues/comments{/number}","contents_url":"https://api.github.com/repos/MapStory/story-tools/contents/{+path}","compare_url":"https://api.github.com/repos/MapStory/story-tools/compare/{base}...{head}","merges_url":"https://api.github.com/repos/MapStory/story-tools/merges","archive_url":"https://api.github.com/repos/MapStory/story-tools/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/MapStory/story-tools/downloads","issues_url":"https://api.github.com/repos/MapStory/story-tools/issues{/number}","pulls_url":"https://api.github.com/repos/MapStory/story-tools/pulls{/number}","milestones_url":"https://api.github.com/repos/MapStory/story-tools/milestones{/number}","notifications_url":"https://api.github.com/repos/MapStory/story-tools/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/MapStory/story-tools/labels{/name}","releases_url":"https://api.github.com/repos/MapStory/story-tools/releases{/id}","created_at":"2014-11-03T20:14:56Z","updated_at":"2015-05-06T08:04:21Z","pushed_at":"2015-05-13T08:14:32Z","git_url":"git://github.com/MapStory/story-tools.git","ssh_url":"git@github.com:MapStory/story-tools.git","clone_url":"https://github.com/MapStory/story-tools.git","svn_url":"https://github.com/MapStory/story-tools","homepage":null,"size":6795,"stargazers_count":3,"watchers_count":3,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":3,"mirror_url":null,"open_issues_count":30,"forks":3,"open_issues":30,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/MapStory/story-tools/pulls/211"},"html":{"href":"https://github.com/MapStory/story-tools/pull/211"},"issue":{"href":"https://api.github.com/repos/MapStory/story-tools/issues/211"},"comments":{"href":"https://api.github.com/repos/MapStory/story-tools/issues/211/comments"},"review_comments":{"href":"https://api.github.com/repos/MapStory/story-tools/pulls/211/comments"},"review_comment":{"href":"https://api.github.com/repos/MapStory/story-tools/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/MapStory/story-tools/pulls/211/commits"},"statuses":{"href":"https://api.github.com/repos/MapStory/story-tools/statuses/f5357595ea47926a4fd38bf13bb99da102d20898"}}}}