{"action":"created","comment":{"url":"https://api.github.com/repos/openlayers/ol3/pulls/comments/23146057","id":23146057,"diff_hunk":"@@ -0,0 +1,400 @@\n+goog.provide('ol.format.WMTSCapabilities');\n+\n+goog.require('goog.asserts');\n+goog.require('goog.dom.NodeType');\n+goog.require('goog.object');\n+goog.require('goog.string');\n+goog.require('ol.extent');\n+goog.require('ol.format.OWS');\n+goog.require('ol.format.XLink');\n+goog.require('ol.format.XML');\n+goog.require('ol.format.XSD');\n+goog.require('ol.xml');\n+\n+\n+\n+/**\n+ * @classdesc\n+ * Format for reading WMTS capabilities data\n+ *\n+ * @constructor\n+ * @extends {ol.format.XML}\n+ * @api\n+ */\n+ol.format.WMTSCapabilities = function() {\n+  goog.base(this);\n+\n+  /**\n+   * @type {string|undefined}\n+   */\n+  this.version = undefined;\n+  this.owsParser = new ol.format.OWS();\n+};\n+goog.inherits(ol.format.WMTSCapabilities, ol.format.XML);\n+\n+\n+/**\n+ * Read a WMTS capabilities document.\n+ *\n+ * @function\n+ * @param {Document|Node|string} source The XML source.\n+ * @return {Object} An object representing the WMTS capabilities.\n+ * @api\n+ */\n+ol.format.WMTSCapabilities.prototype.read;\n+\n+\n+/**\n+ * @param {Document} doc Document.\n+ * @return {Object} WMTS Capability object.\n+ */\n+ol.format.WMTSCapabilities.prototype.readFromDocument = function(doc) {\n+  goog.asserts.assert(doc.nodeType == goog.dom.NodeType.DOCUMENT);\n+  for (var n = doc.firstChild; !goog.isNull(n); n = n.nextSibling) {\n+    if (n.nodeType == goog.dom.NodeType.ELEMENT) {\n+      return this.readFromNode(n);\n+    }\n+  }\n+  return null;\n+};\n+\n+\n+/**\n+ * @param {Node} node Node.\n+ * @return {Object} WMTS Capability object.\n+ */\n+ol.format.WMTSCapabilities.prototype.readFromNode = function(node) {\n+  goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);\n+  goog.asserts.assert(node.localName == 'Capabilities');\n+  this.version = goog.string.trim(node.getAttribute('version'));\n+  goog.asserts.assertString(this.version);\n+  var WMTSCapabilityObject = this.owsParser.readFromNode(node);\n+  if (!goog.isDef(WMTSCapabilityObject)) {\n+    return null;\n+  }\n+  goog.object.set(WMTSCapabilityObject, 'version', this.version);\n+  WMTSCapabilityObject = ol.xml.pushParseAndPop(WMTSCapabilityObject,\n+      ol.format.WMTSCapabilities.PARSERS_, node, []);\n+  return goog.isDef(WMTSCapabilityObject) ? WMTSCapabilityObject : null;\n+};\n+\n+\n+/**\n+ * @private\n+ * @param {Node} node Node.\n+ * @param {Array.<*>} objectStack Object stack.\n+ * @return {Object|undefined} Attribution object.\n+ */\n+ol.format.WMTSCapabilities.readContents_ = function(node, objectStack) {\n+  goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);\n+  goog.asserts.assert(node.localName == 'Contents');\n+\n+  return ol.xml.pushParseAndPop({},\n+      ol.format.WMTSCapabilities.CONTENTS_PARSERS_, node, objectStack);\n+};\n+\n+\n+/**\n+ * @private\n+ * @param {Node} node Node.\n+ * @param {Array.<*>} objectStack Object stack.\n+ * @return {Object|undefined} Layers object.\n+ */\n+ol.format.WMTSCapabilities.readLayer_ = function(node, objectStack) {\n+  goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);\n+  goog.asserts.assert(node.localName == 'Layer');\n+  return ol.xml.pushParseAndPop({},\n+      ol.format.WMTSCapabilities.LAYER_PARSERS_, node, objectStack);\n+};\n+\n+\n+/**\n+ * @private\n+ * @param {Node} node Node.\n+ * @param {Array.<*>} objectStack Object stack.\n+ * @return {Object|undefined} Tile Matrix Set object.\n+ */\n+ol.format.WMTSCapabilities.readTileMatrixSet_ = function(node, objectStack) {\n+  return ol.xml.pushParseAndPop({},\n+      ol.format.WMTSCapabilities.TMS_PARSERS_, node, objectStack);\n+};\n+\n+\n+/**\n+ * @private\n+ * @param {Node} node Node.\n+ * @param {Array.<*>} objectStack Object stack.\n+ * @return {Object|undefined} Style object.\n+ */\n+ol.format.WMTSCapabilities.readStyle_ = function(node, objectStack) {\n+  var style = ol.xml.pushParseAndPop({},\n+      ol.format.WMTSCapabilities.STYLE_PARSERS_, node, objectStack);\n+  if (!goog.isDef(style)) {\n+    return undefined;\n+  }\n+  var isDefault = node.getAttribute('isDefault') === 'true';\n+  goog.object.set(style, 'isDefault', isDefault);","path":"src/ol/format/wmtscapabilitiesformat.js","position":136,"original_position":136,"commit_id":"4f991f25efbb5f24207a056cf766186fea4e2c2d","original_commit_id":"4f991f25efbb5f24207a056cf766186fea4e2c2d","user":{"login":"elemoine","id":76594,"avatar_url":"https://avatars.githubusercontent.com/u/76594?v=3","gravatar_id":"","url":"https://api.github.com/users/elemoine","html_url":"https://github.com/elemoine","followers_url":"https://api.github.com/users/elemoine/followers","following_url":"https://api.github.com/users/elemoine/following{/other_user}","gists_url":"https://api.github.com/users/elemoine/gists{/gist_id}","starred_url":"https://api.github.com/users/elemoine/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elemoine/subscriptions","organizations_url":"https://api.github.com/users/elemoine/orgs","repos_url":"https://api.github.com/users/elemoine/repos","events_url":"https://api.github.com/users/elemoine/events{/privacy}","received_events_url":"https://api.github.com/users/elemoine/received_events","type":"User","site_admin":false},"body":"Use bracket notation instead.","created_at":"2015-01-19T07:47:45Z","updated_at":"2015-01-19T07:47:45Z","html_url":"https://github.com/openlayers/ol3/pull/3026#discussion_r23146057","pull_request_url":"https://api.github.com/repos/openlayers/ol3/pulls/3026","_links":{"self":{"href":"https://api.github.com/repos/openlayers/ol3/pulls/comments/23146057"},"html":{"href":"https://github.com/openlayers/ol3/pull/3026#discussion_r23146057"},"pull_request":{"href":"https://api.github.com/repos/openlayers/ol3/pulls/3026"}}},"pull_request":{"url":"https://api.github.com/repos/openlayers/ol3/pulls/3026","id":25696474,"html_url":"https://github.com/openlayers/ol3/pull/3026","diff_url":"https://github.com/openlayers/ol3/pull/3026.diff","patch_url":"https://github.com/openlayers/ol3/pull/3026.patch","issue_url":"https://api.github.com/repos/openlayers/ol3/issues/3026","number":3026,"state":"open","locked":false,"title":"Add support of reading WMTS Get Cap document","user":{"login":"htulipe","id":1255457,"avatar_url":"https://avatars.githubusercontent.com/u/1255457?v=3","gravatar_id":"","url":"https://api.github.com/users/htulipe","html_url":"https://github.com/htulipe","followers_url":"https://api.github.com/users/htulipe/followers","following_url":"https://api.github.com/users/htulipe/following{/other_user}","gists_url":"https://api.github.com/users/htulipe/gists{/gist_id}","starred_url":"https://api.github.com/users/htulipe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/htulipe/subscriptions","organizations_url":"https://api.github.com/users/htulipe/orgs","repos_url":"https://api.github.com/users/htulipe/repos","events_url":"https://api.github.com/users/htulipe/events{/privacy}","received_events_url":"https://api.github.com/users/htulipe/received_events","type":"User","site_admin":false},"body":"This commit fixe #2721. It still lacks the possibility to create layer from the GetCap document. It also lacks the reading of TMS limits.","created_at":"2014-12-08T20:58:48Z","updated_at":"2015-01-19T07:47:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"643af100cb342d4a43dfba2b643e4b51b9cf91c6","assignee":null,"milestone":{"url":"https://api.github.com/repos/openlayers/ol3/milestones/11","labels_url":"https://api.github.com/repos/openlayers/ol3/milestones/11/labels","id":912519,"number":11,"title":"v3.2.0","description":"","creator":{"login":"tschaub","id":41094,"avatar_url":"https://avatars.githubusercontent.com/u/41094?v=3","gravatar_id":"","url":"https://api.github.com/users/tschaub","html_url":"https://github.com/tschaub","followers_url":"https://api.github.com/users/tschaub/followers","following_url":"https://api.github.com/users/tschaub/following{/other_user}","gists_url":"https://api.github.com/users/tschaub/gists{/gist_id}","starred_url":"https://api.github.com/users/tschaub/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tschaub/subscriptions","organizations_url":"https://api.github.com/users/tschaub/orgs","repos_url":"https://api.github.com/users/tschaub/repos","events_url":"https://api.github.com/users/tschaub/events{/privacy}","received_events_url":"https://api.github.com/users/tschaub/received_events","type":"User","site_admin":false},"open_issues":44,"closed_issues":8,"state":"open","created_at":"2014-12-22T18:10:23Z","updated_at":"2015-01-18T11:35:00Z","due_on":"2015-02-01T05:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/openlayers/ol3/pulls/3026/commits","review_comments_url":"https://api.github.com/repos/openlayers/ol3/pulls/3026/comments","review_comment_url":"https://api.github.com/repos/openlayers/ol3/pulls/comments/{number}","comments_url":"https://api.github.com/repos/openlayers/ol3/issues/3026/comments","statuses_url":"https://api.github.com/repos/openlayers/ol3/statuses/4f991f25efbb5f24207a056cf766186fea4e2c2d","head":{"label":"htulipe:wmts-getcap","ref":"wmts-getcap","sha":"4f991f25efbb5f24207a056cf766186fea4e2c2d","user":{"login":"htulipe","id":1255457,"avatar_url":"https://avatars.githubusercontent.com/u/1255457?v=3","gravatar_id":"","url":"https://api.github.com/users/htulipe","html_url":"https://github.com/htulipe","followers_url":"https://api.github.com/users/htulipe/followers","following_url":"https://api.github.com/users/htulipe/following{/other_user}","gists_url":"https://api.github.com/users/htulipe/gists{/gist_id}","starred_url":"https://api.github.com/users/htulipe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/htulipe/subscriptions","organizations_url":"https://api.github.com/users/htulipe/orgs","repos_url":"https://api.github.com/users/htulipe/repos","events_url":"https://api.github.com/users/htulipe/events{/privacy}","received_events_url":"https://api.github.com/users/htulipe/received_events","type":"User","site_admin":false},"repo":{"id":17647221,"name":"ol3","full_name":"htulipe/ol3","owner":{"login":"htulipe","id":1255457,"avatar_url":"https://avatars.githubusercontent.com/u/1255457?v=3","gravatar_id":"","url":"https://api.github.com/users/htulipe","html_url":"https://github.com/htulipe","followers_url":"https://api.github.com/users/htulipe/followers","following_url":"https://api.github.com/users/htulipe/following{/other_user}","gists_url":"https://api.github.com/users/htulipe/gists{/gist_id}","starred_url":"https://api.github.com/users/htulipe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/htulipe/subscriptions","organizations_url":"https://api.github.com/users/htulipe/orgs","repos_url":"https://api.github.com/users/htulipe/repos","events_url":"https://api.github.com/users/htulipe/events{/privacy}","received_events_url":"https://api.github.com/users/htulipe/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/htulipe/ol3","description":"OpenLayers 3","fork":true,"url":"https://api.github.com/repos/htulipe/ol3","forks_url":"https://api.github.com/repos/htulipe/ol3/forks","keys_url":"https://api.github.com/repos/htulipe/ol3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/htulipe/ol3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/htulipe/ol3/teams","hooks_url":"https://api.github.com/repos/htulipe/ol3/hooks","issue_events_url":"https://api.github.com/repos/htulipe/ol3/issues/events{/number}","events_url":"https://api.github.com/repos/htulipe/ol3/events","assignees_url":"https://api.github.com/repos/htulipe/ol3/assignees{/user}","branches_url":"https://api.github.com/repos/htulipe/ol3/branches{/branch}","tags_url":"https://api.github.com/repos/htulipe/ol3/tags","blobs_url":"https://api.github.com/repos/htulipe/ol3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/htulipe/ol3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/htulipe/ol3/git/refs{/sha}","trees_url":"https://api.github.com/repos/htulipe/ol3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/htulipe/ol3/statuses/{sha}","languages_url":"https://api.github.com/repos/htulipe/ol3/languages","stargazers_url":"https://api.github.com/repos/htulipe/ol3/stargazers","contributors_url":"https://api.github.com/repos/htulipe/ol3/contributors","subscribers_url":"https://api.github.com/repos/htulipe/ol3/subscribers","subscription_url":"https://api.github.com/repos/htulipe/ol3/subscription","commits_url":"https://api.github.com/repos/htulipe/ol3/commits{/sha}","git_commits_url":"https://api.github.com/repos/htulipe/ol3/git/commits{/sha}","comments_url":"https://api.github.com/repos/htulipe/ol3/comments{/number}","issue_comment_url":"https://api.github.com/repos/htulipe/ol3/issues/comments/{number}","contents_url":"https://api.github.com/repos/htulipe/ol3/contents/{+path}","compare_url":"https://api.github.com/repos/htulipe/ol3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/htulipe/ol3/merges","archive_url":"https://api.github.com/repos/htulipe/ol3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/htulipe/ol3/downloads","issues_url":"https://api.github.com/repos/htulipe/ol3/issues{/number}","pulls_url":"https://api.github.com/repos/htulipe/ol3/pulls{/number}","milestones_url":"https://api.github.com/repos/htulipe/ol3/milestones{/number}","notifications_url":"https://api.github.com/repos/htulipe/ol3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/htulipe/ol3/labels{/name}","releases_url":"https://api.github.com/repos/htulipe/ol3/releases{/id}","created_at":"2014-03-11T22:10:33Z","updated_at":"2014-12-08T20:56:21Z","pushed_at":"2014-12-13T15:42:28Z","git_url":"git://github.com/htulipe/ol3.git","ssh_url":"git@github.com:htulipe/ol3.git","clone_url":"https://github.com/htulipe/ol3.git","svn_url":"https://github.com/htulipe/ol3","homepage":"http://ol3js.org/","size":26214,"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":"openlayers:master","ref":"master","sha":"7fd017879f3fd755a0ad9ed3821fc45a47ff52a8","user":{"login":"openlayers","id":240579,"avatar_url":"https://avatars.githubusercontent.com/u/240579?v=3","gravatar_id":"","url":"https://api.github.com/users/openlayers","html_url":"https://github.com/openlayers","followers_url":"https://api.github.com/users/openlayers/followers","following_url":"https://api.github.com/users/openlayers/following{/other_user}","gists_url":"https://api.github.com/users/openlayers/gists{/gist_id}","starred_url":"https://api.github.com/users/openlayers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openlayers/subscriptions","organizations_url":"https://api.github.com/users/openlayers/orgs","repos_url":"https://api.github.com/users/openlayers/repos","events_url":"https://api.github.com/users/openlayers/events{/privacy}","received_events_url":"https://api.github.com/users/openlayers/received_events","type":"Organization","site_admin":false},"repo":{"id":4723248,"name":"ol3","full_name":"openlayers/ol3","owner":{"login":"openlayers","id":240579,"avatar_url":"https://avatars.githubusercontent.com/u/240579?v=3","gravatar_id":"","url":"https://api.github.com/users/openlayers","html_url":"https://github.com/openlayers","followers_url":"https://api.github.com/users/openlayers/followers","following_url":"https://api.github.com/users/openlayers/following{/other_user}","gists_url":"https://api.github.com/users/openlayers/gists{/gist_id}","starred_url":"https://api.github.com/users/openlayers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/openlayers/subscriptions","organizations_url":"https://api.github.com/users/openlayers/orgs","repos_url":"https://api.github.com/users/openlayers/repos","events_url":"https://api.github.com/users/openlayers/events{/privacy}","received_events_url":"https://api.github.com/users/openlayers/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/openlayers/ol3","description":"OpenLayers 3","fork":false,"url":"https://api.github.com/repos/openlayers/ol3","forks_url":"https://api.github.com/repos/openlayers/ol3/forks","keys_url":"https://api.github.com/repos/openlayers/ol3/keys{/key_id}","collaborators_url":"https://api.github.com/repos/openlayers/ol3/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/openlayers/ol3/teams","hooks_url":"https://api.github.com/repos/openlayers/ol3/hooks","issue_events_url":"https://api.github.com/repos/openlayers/ol3/issues/events{/number}","events_url":"https://api.github.com/repos/openlayers/ol3/events","assignees_url":"https://api.github.com/repos/openlayers/ol3/assignees{/user}","branches_url":"https://api.github.com/repos/openlayers/ol3/branches{/branch}","tags_url":"https://api.github.com/repos/openlayers/ol3/tags","blobs_url":"https://api.github.com/repos/openlayers/ol3/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/openlayers/ol3/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/openlayers/ol3/git/refs{/sha}","trees_url":"https://api.github.com/repos/openlayers/ol3/git/trees{/sha}","statuses_url":"https://api.github.com/repos/openlayers/ol3/statuses/{sha}","languages_url":"https://api.github.com/repos/openlayers/ol3/languages","stargazers_url":"https://api.github.com/repos/openlayers/ol3/stargazers","contributors_url":"https://api.github.com/repos/openlayers/ol3/contributors","subscribers_url":"https://api.github.com/repos/openlayers/ol3/subscribers","subscription_url":"https://api.github.com/repos/openlayers/ol3/subscription","commits_url":"https://api.github.com/repos/openlayers/ol3/commits{/sha}","git_commits_url":"https://api.github.com/repos/openlayers/ol3/git/commits{/sha}","comments_url":"https://api.github.com/repos/openlayers/ol3/comments{/number}","issue_comment_url":"https://api.github.com/repos/openlayers/ol3/issues/comments/{number}","contents_url":"https://api.github.com/repos/openlayers/ol3/contents/{+path}","compare_url":"https://api.github.com/repos/openlayers/ol3/compare/{base}...{head}","merges_url":"https://api.github.com/repos/openlayers/ol3/merges","archive_url":"https://api.github.com/repos/openlayers/ol3/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/openlayers/ol3/downloads","issues_url":"https://api.github.com/repos/openlayers/ol3/issues{/number}","pulls_url":"https://api.github.com/repos/openlayers/ol3/pulls{/number}","milestones_url":"https://api.github.com/repos/openlayers/ol3/milestones{/number}","notifications_url":"https://api.github.com/repos/openlayers/ol3/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/openlayers/ol3/labels{/name}","releases_url":"https://api.github.com/repos/openlayers/ol3/releases{/id}","created_at":"2012-06-20T06:53:59Z","updated_at":"2015-01-19T06:18:44Z","pushed_at":"2015-01-16T16:40:14Z","git_url":"git://github.com/openlayers/ol3.git","ssh_url":"git@github.com:openlayers/ol3.git","clone_url":"https://github.com/openlayers/ol3.git","svn_url":"https://github.com/openlayers/ol3","homepage":"http://openlayers.org","size":64749,"stargazers_count":905,"watchers_count":905,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":532,"mirror_url":null,"open_issues_count":266,"forks":532,"open_issues":266,"watchers":905,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/openlayers/ol3/pulls/3026"},"html":{"href":"https://github.com/openlayers/ol3/pull/3026"},"issue":{"href":"https://api.github.com/repos/openlayers/ol3/issues/3026"},"comments":{"href":"https://api.github.com/repos/openlayers/ol3/issues/3026/comments"},"review_comments":{"href":"https://api.github.com/repos/openlayers/ol3/pulls/3026/comments"},"review_comment":{"href":"https://api.github.com/repos/openlayers/ol3/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/openlayers/ol3/pulls/3026/commits"},"statuses":{"href":"https://api.github.com/repos/openlayers/ol3/statuses/4f991f25efbb5f24207a056cf766186fea4e2c2d"}}}}