{"action":"created","comment":{"url":"https://api.github.com/repos/iTowns/itowns2/pulls/comments/116942497","pull_request_review_id":38601188,"id":116942497,"diff_hunk":"@@ -0,0 +1,185 @@\n+/**\n+ * Generated On: 2015-10-5\n+ * Class: Scene\n+ * Description: La Scene est l'instance principale du client. Elle est le chef orchestre de l'application.\n+ */\n+\n+/* global window, requestAnimationFrame */\n+\n+import Camera from '../Renderer/Camera';\n+import MainLoop from './MainLoop';\n+import c3DEngine from '../Renderer/c3DEngine';\n+import { STRATEGY_MIN_NETWORK_TRAFFIC } from './Layer/LayerUpdateStrategy';\n+import Scheduler from './Scheduler/Scheduler';\n+import WMTS_Provider from './Scheduler/Providers/WMTS_Provider';\n+import WMS_Provider from './Scheduler/Providers/WMS_Provider';\n+import TileProvider from './Scheduler/Providers/TileProvider';\n+import Debug from '../../utils/debug/Debug';\n+\n+/**\n+ * Constructs an Itowns Scene instance\n+ *\n+ * @param {string} crs - The default CRS of Three.js coordinates. Should be a cartesian CRS.\n+ * @param {Coordinates} positionCamera - The initial position of the camera\n+ * @param {DOMElement} viewerDiv - Where to instanciate the Three.js scene in the DOM\n+ * @param {boolean} debugMode - activate debug mode\n+ * @param {boolean} glDebug - debug gl code\n+ * @constructor\n+ */\n+ /* TODO:\n+ * - remove debug boolean, replace by if __DEBUG__ and checkboxes in debug UI\n+ * - Scene (and subobjects) should be instanciable several times.\n+ */\n+function View(crs, viewerDiv, mainLoop) {\n+    this.referenceCrs = crs;\n+\n+    this.mainLoop = mainLoop || new MainLoop(new Scheduler(), new c3DEngine(viewerDiv));\n+\n+    this.camera = new Camera(\n+        viewerDiv.clientWidth,\n+        viewerDiv.clientHeight);\n+\n+    this._layers = [];\n+\n+    if (__DEBUG__) {\n+        this._debug = new Debug(this, viewerDiv);\n+    }\n+\n+    this.viewerDiv = viewerDiv;\n+    window.addEventListener('resize', () => {\n+        this.mainLoop.gfxEngine.onWindowResize();\n+        this.camera.resize(this.viewerDiv.clientWidth, this.viewerDiv.clientHeight);\n+        this.camera.update();\n+        this.notifyChange(0, true);\n+    }, false);\n+\n+    this.onAfterRender = () => {};\n+}\n+\n+function _preprocessLayer(view, layer, provider) {\n+    if (!layer.updateStrategy) {\n+        layer.updateStrategy = {\n+            type: STRATEGY_MIN_NETWORK_TRAFFIC,\n+        };\n+    }\n+\n+    if (provider) {\n+        if (provider.tileInsideLimit) {\n+            layer.tileInsideLimit = provider.tileInsideLimit.bind(provider);\n+        }\n+\n+        if (provider.tileTextureCount) {\n+            layer.tileTextureCount = provider.tileTextureCount.bind(provider);\n+        }\n+\n+        if (provider.preprocessDataLayer) {\n+            provider.preprocessDataLayer(layer);\n+        }\n+    }\n+\n+    // probably not the best place to do this\n+    if (provider instanceof TileProvider || !provider) {\n+        // const threejsLayer = view.mainLoop.gfxEngine.getUniqueThreejsLayer();\n+        // layer.threejsLayer = threejsLayer;\n+        // enable by default\n+        // TODO camera.camera3D.layers.enable(threejsLayer);\n+    } else {\n+        layer.frozen = layer.frozen || false;\n+        layer.visible = layer.visible == undefined ? true : layer.visible;\n+        layer.opacity = layer.opacity == undefined ? 1.0 : layer.opacity;\n+        layer.sequence = 0;\n+    }\n+}\n+\n+View.prototype.addLayer = function addLayer(layer, parentLayer) {\n+    if (parentLayer) {\n+        parentLayer.attach(layer);\n+    } else {\n+        if (typeof (layer.update) !== 'function') {\n+            throw new Error('Cant add GeometryLayer: missing a update function');\n+        }\n+        if (typeof (layer.preUpdate) !== 'function') {\n+            throw new Error('Cant add GeometryLayer: missing a preUpdate function');\n+        }\n+\n+        this._layers.push(layer);\n+    }\n+    _preprocessLayer(this, layer, this.mainLoop.scheduler.getProtocolProvider(layer.protocol));\n+};\n+\n+View.prototype.initDefaultProviders = function initDefaultProviders(scheduler) {\n+    // Register all providers\n+    var wmtsProvider = new WMTS_Provider();\n+    scheduler.addProtocolProvider('wmts', wmtsProvider);\n+    scheduler.addProtocolProvider('wmtsc', wmtsProvider);\n+    scheduler.addProtocolProvider('tile', new TileProvider());\n+    scheduler.addProtocolProvider('wms', new WMS_Provider());\n+};\n+\n+\n+/**\n+ * @documentation: return current camera\n+ * @returns {Scene_L7.Scene.gfxEngine.camera}\n+ */\n+View.prototype.currentCamera = function currentCamera() {\n+    return this.camera;\n+};\n+\n+/**\n+ * Notifies the scene it needs to be updated due to changes exterior to the\n+ * scene itself (e.g. camera movement).\n+ * Using a non-0 delay allows to delay update - useful to reduce CPU load for\n+ * non-interactive events (e.g: texture loaded)\n+ * needsRedraw param indicates if notified change requires a full scene redraw.\n+ */\n+View.prototype.notifyChange = function notifyChange(delay, needsRedraw) {\n+    if (delay) {\n+        window.setTimeout(() => { this.mainLoop.scheduleViewUpdate(this, needsRedraw); }, delay);\n+    } else {\n+        this.mainLoop.scheduleViewUpdate(this, needsRedraw);\n+    }\n+};\n+\n+View.prototype.getLayers = function getLayers(filter) {","path":"src/Core/View.js","position":143,"original_position":143,"commit_id":"f0cc74b89688bba4d94f436645f398896f892c4c","original_commit_id":"f0cc74b89688bba4d94f436645f398896f892c4c","user":{"login":"gchoqueux","id":11291849,"avatar_url":"https://avatars0.githubusercontent.com/u/11291849?v=3","gravatar_id":"","url":"https://api.github.com/users/gchoqueux","html_url":"https://github.com/gchoqueux","followers_url":"https://api.github.com/users/gchoqueux/followers","following_url":"https://api.github.com/users/gchoqueux/following{/other_user}","gists_url":"https://api.github.com/users/gchoqueux/gists{/gist_id}","starred_url":"https://api.github.com/users/gchoqueux/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gchoqueux/subscriptions","organizations_url":"https://api.github.com/users/gchoqueux/orgs","repos_url":"https://api.github.com/users/gchoqueux/repos","events_url":"https://api.github.com/users/gchoqueux/events{/privacy}","received_events_url":"https://api.github.com/users/gchoqueux/received_events","type":"User","site_admin":false},"body":"comment filter use","created_at":"2017-05-17T08:42:26Z","updated_at":"2017-05-17T08:48:53Z","html_url":"https://github.com/iTowns/itowns2/pull/301#discussion_r116942497","pull_request_url":"https://api.github.com/repos/iTowns/itowns2/pulls/301","_links":{"self":{"href":"https://api.github.com/repos/iTowns/itowns2/pulls/comments/116942497"},"html":{"href":"https://github.com/iTowns/itowns2/pull/301#discussion_r116942497"},"pull_request":{"href":"https://api.github.com/repos/iTowns/itowns2/pulls/301"}}},"pull_request":{"url":"https://api.github.com/repos/iTowns/itowns2/pulls/301","id":120330628,"html_url":"https://github.com/iTowns/itowns2/pull/301","diff_url":"https://github.com/iTowns/itowns2/pull/301.diff","patch_url":"https://github.com/iTowns/itowns2/pull/301.patch","issue_url":"https://api.github.com/repos/iTowns/itowns2/issues/301","number":301,"state":"open","locked":false,"title":"Refacto layer","user":{"login":"peppsac","id":2198295,"avatar_url":"https://avatars0.githubusercontent.com/u/2198295?v=3","gravatar_id":"","url":"https://api.github.com/users/peppsac","html_url":"https://github.com/peppsac","followers_url":"https://api.github.com/users/peppsac/followers","following_url":"https://api.github.com/users/peppsac/following{/other_user}","gists_url":"https://api.github.com/users/peppsac/gists{/gist_id}","starred_url":"https://api.github.com/users/peppsac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peppsac/subscriptions","organizations_url":"https://api.github.com/users/peppsac/orgs","repos_url":"https://api.github.com/users/peppsac/repos","events_url":"https://api.github.com/users/peppsac/events{/privacy}","received_events_url":"https://api.github.com/users/peppsac/received_events","type":"User","site_admin":false},"body":"(Last) core refactoring of itowns.\r\n\r\nMost important commit is: c0cfb0b7a74fb6ebe6af9b7e0cde8704f2fdde95\r\n```\r\n    refactor: remove Scene and reorganize files\r\n    \r\n    Split Scene responsabilities between:\r\n      * View: container for datas\r\n      * MainLoop: itowns' main loop (update/render)\r\n    \r\n    GlobeView is a specialized View, ready for displaying a Globe.\r\n    c3DEngine also loses Globe-related code, which moves to GlobeView.\r\n    \r\n    Files/folders hierarchy has changed as well.\r\n```\r\n\r\nThis PR also adds 2 examples:\r\n* `planar.html`: itowns in planar mode (EPSG:3946)\r\n* `multiglobe.html`: shows 2 itowns globes on the same page (note: debug and controls are buggy in this example)","created_at":"2017-05-12T14:05:39Z","updated_at":"2017-05-17T08:48:53Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b878f693702e3d6b2f5f9881666ed01175c20cef","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/iTowns/itowns2/pulls/301/commits","review_comments_url":"https://api.github.com/repos/iTowns/itowns2/pulls/301/comments","review_comment_url":"https://api.github.com/repos/iTowns/itowns2/pulls/comments{/number}","comments_url":"https://api.github.com/repos/iTowns/itowns2/issues/301/comments","statuses_url":"https://api.github.com/repos/iTowns/itowns2/statuses/f0cc74b89688bba4d94f436645f398896f892c4c","head":{"label":"peppsac:refacto_layer","ref":"refacto_layer","sha":"f0cc74b89688bba4d94f436645f398896f892c4c","user":{"login":"peppsac","id":2198295,"avatar_url":"https://avatars0.githubusercontent.com/u/2198295?v=3","gravatar_id":"","url":"https://api.github.com/users/peppsac","html_url":"https://github.com/peppsac","followers_url":"https://api.github.com/users/peppsac/followers","following_url":"https://api.github.com/users/peppsac/following{/other_user}","gists_url":"https://api.github.com/users/peppsac/gists{/gist_id}","starred_url":"https://api.github.com/users/peppsac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peppsac/subscriptions","organizations_url":"https://api.github.com/users/peppsac/orgs","repos_url":"https://api.github.com/users/peppsac/repos","events_url":"https://api.github.com/users/peppsac/events{/privacy}","received_events_url":"https://api.github.com/users/peppsac/received_events","type":"User","site_admin":false},"repo":{"id":62058333,"name":"itowns2","full_name":"peppsac/itowns2","owner":{"login":"peppsac","id":2198295,"avatar_url":"https://avatars0.githubusercontent.com/u/2198295?v=3","gravatar_id":"","url":"https://api.github.com/users/peppsac","html_url":"https://github.com/peppsac","followers_url":"https://api.github.com/users/peppsac/followers","following_url":"https://api.github.com/users/peppsac/following{/other_user}","gists_url":"https://api.github.com/users/peppsac/gists{/gist_id}","starred_url":"https://api.github.com/users/peppsac/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peppsac/subscriptions","organizations_url":"https://api.github.com/users/peppsac/orgs","repos_url":"https://api.github.com/users/peppsac/repos","events_url":"https://api.github.com/users/peppsac/events{/privacy}","received_events_url":"https://api.github.com/users/peppsac/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/peppsac/itowns2","description":"iTowns 2 is the next generation of iTowns, a JS/WebGL framework for 3D geospatial data visualization","fork":true,"url":"https://api.github.com/repos/peppsac/itowns2","forks_url":"https://api.github.com/repos/peppsac/itowns2/forks","keys_url":"https://api.github.com/repos/peppsac/itowns2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/peppsac/itowns2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/peppsac/itowns2/teams","hooks_url":"https://api.github.com/repos/peppsac/itowns2/hooks","issue_events_url":"https://api.github.com/repos/peppsac/itowns2/issues/events{/number}","events_url":"https://api.github.com/repos/peppsac/itowns2/events","assignees_url":"https://api.github.com/repos/peppsac/itowns2/assignees{/user}","branches_url":"https://api.github.com/repos/peppsac/itowns2/branches{/branch}","tags_url":"https://api.github.com/repos/peppsac/itowns2/tags","blobs_url":"https://api.github.com/repos/peppsac/itowns2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/peppsac/itowns2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/peppsac/itowns2/git/refs{/sha}","trees_url":"https://api.github.com/repos/peppsac/itowns2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/peppsac/itowns2/statuses/{sha}","languages_url":"https://api.github.com/repos/peppsac/itowns2/languages","stargazers_url":"https://api.github.com/repos/peppsac/itowns2/stargazers","contributors_url":"https://api.github.com/repos/peppsac/itowns2/contributors","subscribers_url":"https://api.github.com/repos/peppsac/itowns2/subscribers","subscription_url":"https://api.github.com/repos/peppsac/itowns2/subscription","commits_url":"https://api.github.com/repos/peppsac/itowns2/commits{/sha}","git_commits_url":"https://api.github.com/repos/peppsac/itowns2/git/commits{/sha}","comments_url":"https://api.github.com/repos/peppsac/itowns2/comments{/number}","issue_comment_url":"https://api.github.com/repos/peppsac/itowns2/issues/comments{/number}","contents_url":"https://api.github.com/repos/peppsac/itowns2/contents/{+path}","compare_url":"https://api.github.com/repos/peppsac/itowns2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/peppsac/itowns2/merges","archive_url":"https://api.github.com/repos/peppsac/itowns2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/peppsac/itowns2/downloads","issues_url":"https://api.github.com/repos/peppsac/itowns2/issues{/number}","pulls_url":"https://api.github.com/repos/peppsac/itowns2/pulls{/number}","milestones_url":"https://api.github.com/repos/peppsac/itowns2/milestones{/number}","notifications_url":"https://api.github.com/repos/peppsac/itowns2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/peppsac/itowns2/labels{/name}","releases_url":"https://api.github.com/repos/peppsac/itowns2/releases{/id}","deployments_url":"https://api.github.com/repos/peppsac/itowns2/deployments","created_at":"2016-06-27T13:30:40Z","updated_at":"2017-03-17T14:47:42Z","pushed_at":"2017-05-16T20:12:45Z","git_url":"git://github.com/peppsac/itowns2.git","ssh_url":"git@github.com:peppsac/itowns2.git","clone_url":"https://github.com/peppsac/itowns2.git","svn_url":"https://github.com/peppsac/itowns2","homepage":"","size":61502,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":false,"has_projects":true,"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":2,"default_branch":"master"}},"base":{"label":"iTowns:master","ref":"master","sha":"90fbe0eeb18363269b310d20152cb0f190cc22ce","user":{"login":"iTowns","id":14266889,"avatar_url":"https://avatars1.githubusercontent.com/u/14266889?v=3","gravatar_id":"","url":"https://api.github.com/users/iTowns","html_url":"https://github.com/iTowns","followers_url":"https://api.github.com/users/iTowns/followers","following_url":"https://api.github.com/users/iTowns/following{/other_user}","gists_url":"https://api.github.com/users/iTowns/gists{/gist_id}","starred_url":"https://api.github.com/users/iTowns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iTowns/subscriptions","organizations_url":"https://api.github.com/users/iTowns/orgs","repos_url":"https://api.github.com/users/iTowns/repos","events_url":"https://api.github.com/users/iTowns/events{/privacy}","received_events_url":"https://api.github.com/users/iTowns/received_events","type":"Organization","site_admin":false},"repo":{"id":43068275,"name":"itowns2","full_name":"iTowns/itowns2","owner":{"login":"iTowns","id":14266889,"avatar_url":"https://avatars1.githubusercontent.com/u/14266889?v=3","gravatar_id":"","url":"https://api.github.com/users/iTowns","html_url":"https://github.com/iTowns","followers_url":"https://api.github.com/users/iTowns/followers","following_url":"https://api.github.com/users/iTowns/following{/other_user}","gists_url":"https://api.github.com/users/iTowns/gists{/gist_id}","starred_url":"https://api.github.com/users/iTowns/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/iTowns/subscriptions","organizations_url":"https://api.github.com/users/iTowns/orgs","repos_url":"https://api.github.com/users/iTowns/repos","events_url":"https://api.github.com/users/iTowns/events{/privacy}","received_events_url":"https://api.github.com/users/iTowns/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/iTowns/itowns2","description":"iTowns 2 is the next generation of iTowns, a JS/WebGL framework for 3D geospatial data visualization","fork":false,"url":"https://api.github.com/repos/iTowns/itowns2","forks_url":"https://api.github.com/repos/iTowns/itowns2/forks","keys_url":"https://api.github.com/repos/iTowns/itowns2/keys{/key_id}","collaborators_url":"https://api.github.com/repos/iTowns/itowns2/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/iTowns/itowns2/teams","hooks_url":"https://api.github.com/repos/iTowns/itowns2/hooks","issue_events_url":"https://api.github.com/repos/iTowns/itowns2/issues/events{/number}","events_url":"https://api.github.com/repos/iTowns/itowns2/events","assignees_url":"https://api.github.com/repos/iTowns/itowns2/assignees{/user}","branches_url":"https://api.github.com/repos/iTowns/itowns2/branches{/branch}","tags_url":"https://api.github.com/repos/iTowns/itowns2/tags","blobs_url":"https://api.github.com/repos/iTowns/itowns2/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/iTowns/itowns2/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/iTowns/itowns2/git/refs{/sha}","trees_url":"https://api.github.com/repos/iTowns/itowns2/git/trees{/sha}","statuses_url":"https://api.github.com/repos/iTowns/itowns2/statuses/{sha}","languages_url":"https://api.github.com/repos/iTowns/itowns2/languages","stargazers_url":"https://api.github.com/repos/iTowns/itowns2/stargazers","contributors_url":"https://api.github.com/repos/iTowns/itowns2/contributors","subscribers_url":"https://api.github.com/repos/iTowns/itowns2/subscribers","subscription_url":"https://api.github.com/repos/iTowns/itowns2/subscription","commits_url":"https://api.github.com/repos/iTowns/itowns2/commits{/sha}","git_commits_url":"https://api.github.com/repos/iTowns/itowns2/git/commits{/sha}","comments_url":"https://api.github.com/repos/iTowns/itowns2/comments{/number}","issue_comment_url":"https://api.github.com/repos/iTowns/itowns2/issues/comments{/number}","contents_url":"https://api.github.com/repos/iTowns/itowns2/contents/{+path}","compare_url":"https://api.github.com/repos/iTowns/itowns2/compare/{base}...{head}","merges_url":"https://api.github.com/repos/iTowns/itowns2/merges","archive_url":"https://api.github.com/repos/iTowns/itowns2/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/iTowns/itowns2/downloads","issues_url":"https://api.github.com/repos/iTowns/itowns2/issues{/number}","pulls_url":"https://api.github.com/repos/iTowns/itowns2/pulls{/number}","milestones_url":"https://api.github.com/repos/iTowns/itowns2/milestones{/number}","notifications_url":"https://api.github.com/repos/iTowns/itowns2/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/iTowns/itowns2/labels{/name}","releases_url":"https://api.github.com/repos/iTowns/itowns2/releases{/id}","deployments_url":"https://api.github.com/repos/iTowns/itowns2/deployments","created_at":"2015-09-24T13:24:26Z","updated_at":"2017-04-19T13:35:05Z","pushed_at":"2017-05-16T19:20:26Z","git_url":"git://github.com/iTowns/itowns2.git","ssh_url":"git@github.com:iTowns/itowns2.git","clone_url":"https://github.com/iTowns/itowns2.git","svn_url":"https://github.com/iTowns/itowns2","homepage":"","size":89816,"stargazers_count":34,"watchers_count":34,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":23,"mirror_url":null,"open_issues_count":67,"forks":23,"open_issues":67,"watchers":34,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/iTowns/itowns2/pulls/301"},"html":{"href":"https://github.com/iTowns/itowns2/pull/301"},"issue":{"href":"https://api.github.com/repos/iTowns/itowns2/issues/301"},"comments":{"href":"https://api.github.com/repos/iTowns/itowns2/issues/301/comments"},"review_comments":{"href":"https://api.github.com/repos/iTowns/itowns2/pulls/301/comments"},"review_comment":{"href":"https://api.github.com/repos/iTowns/itowns2/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/iTowns/itowns2/pulls/301/commits"},"statuses":{"href":"https://api.github.com/repos/iTowns/itowns2/statuses/f0cc74b89688bba4d94f436645f398896f892c4c"}}}}
{"actor":{"display_login":"gchoqueux"}}