payload: {"action":"closed","issue":{"url":"https://api.github.com/repos/iTowns/itowns/issues/880","repository_url":"https://api.github.com/repos/iTowns/itowns","labels_url":"https://api.github.com/repos/iTowns/itowns/issues/880/labels{/name}","comments_url":"https://api.github.com/repos/iTowns/itowns/issues/880/comments","events_url":"https://api.github.com/repos/iTowns/itowns/issues/880/events","html_url":"https://github.com/iTowns/itowns/issues/880","id":371960946,"node_id":"MDU6SXNzdWUzNzE5NjA5NDY=","number":880,"title":"Proposition for locking a final design in itowns","user":{"login":"zarov","id":741255,"node_id":"MDQ6VXNlcjc0MTI1NQ==","avatar_url":"https://avatars2.githubusercontent.com/u/741255?v=4","gravatar_id":"","url":"https://api.github.com/users/zarov","html_url":"https://github.com/zarov","followers_url":"https://api.github.com/users/zarov/followers","following_url":"https://api.github.com/users/zarov/following{/other_user}","gists_url":"https://api.github.com/users/zarov/gists{/gist_id}","starred_url":"https://api.github.com/users/zarov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zarov/subscriptions","organizations_url":"https://api.github.com/users/zarov/orgs","repos_url":"https://api.github.com/users/zarov/repos","events_url":"https://api.github.com/users/zarov/events{/privacy}","received_events_url":"https://api.github.com/users/zarov/received_events","type":"User","site_admin":false},"labels":[{"id":351152926,"node_id":"MDU6TGFiZWwzNTExNTI5MjY=","url":"https://api.github.com/repos/iTowns/itowns/labels/design%20:straight_ruler:","name":"design :straight_ruler:","color":"6655aa","default":false},{"id":914672672,"node_id":"MDU6TGFiZWw5MTQ2NzI2NzI=","url":"https://api.github.com/repos/iTowns/itowns/labels/suggestion%20for%20enhancement","name":"suggestion for enhancement","color":"ee8897","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2018-10-19T13:36:23Z","updated_at":"2019-07-18T12:19:29Z","closed_at":"2019-07-18T12:19:29Z","author_association":"MEMBER","body":"We are currently (a lot offline) experiencing some disagreements on the design of iTowns and its modularity. So in order to share it with everyone, here's my shot at a proposition of where I see the design going, in hope to see it locked and stop refactoring it.\r\n\r\n### TL;DR\r\n\r\n- stop to rely on big configuration objects for initialization\r\n- define a specified scope for the available API\r\n- allow for a user to easily add a custom source, parser, etc...\r\n- specify an internal format for handling data (the famous Feature)\r\n\r\n### Final Example\r\n\r\nHere's a complete example (of a globe view with a simple ortho layer, and a wfs one) illustrating my proposition:\r\n\r\n```js\r\n// Specify the position, with a real coordinate\r\nvar position = new itowns.Coordinate('WGS84', 2.35, 48.8, 25e6);\r\n\r\nvar viewerDiv = document.getElementById('viewerDiv');\r\n\r\n// Create a view\r\nvar view = new itowns.GlobeView(viewerDiv, position);\r\n\r\n// Specify the ortho source\r\nvar orthoSource = new itowns.WMTSSource({\r\n    url: 'http://wxs.ign.fr/<key>/geoportail/wmts',\r\n    format: 'image/jpeg',\r\n    attribution : {\r\n        name: 'IGN',\r\n        url: 'http://www.ign.fr/'\r\n    },\r\n    name: 'ORTHOIMAGERY.ORTHOPHOTOS',\r\n    tileMatrixSet: 'PM',\r\n    tileMatrixSetLimits: {\r\n        '2': { minTileRow: 0, maxTileRow: 4, minTileCol: 0, maxTileCol: 4 },\r\n        '3': { minTileRow: 0, maxTileRow: 8, minTileCol: 0, maxTileCol: 8 },\r\n        '4': { minTileRow: 0, maxTileRow: 16, minTileCol: 0, maxTileCol: 16 },\r\n        '5': { minTileRow: 0, maxTileRow: 32, minTileCol: 0, maxTileCol: 32 },\r\n        '6': { minTileRow: 1, maxTileRow: 64, minTileCol: 0, maxTileCol: 64 },\r\n        '7': { minTileRow: 3, maxTileRow: 128, minTileCol: 0, maxTileCol: 128 },\r\n        '8': { minTileRow: 7, maxTileRow: 256, minTileCol: 0, maxTileCol: 256 },\r\n        '9': { minTileRow: 15, maxTileRow: 512, minTileCol: 0, maxTileCol: 512 },\r\n        '10': { minTileRow: 31, maxTileRow: 1024, minTileCol: 0, maxTileCol: 1024 },\r\n        '11': { minTileRow: 62, maxTileRow: 2048, minTileCol: 0, maxTileCol: 2048 },\r\n        '12': { minTileRow: 125, maxTileRow: 4096, minTileCol: 0, maxTileCol: 4096 },\r\n        '13': { minTileRow: 2739, maxTileRow: 4628, minTileCol: 41, maxTileCol: 7917 },\r\n        '14': { minTileRow: 5478, maxTileRow: 9256, minTileCol: 82, maxTileCol: 15835 },\r\n        '15': { minTileRow: 10956, maxTileRow: 18513, minTileCol: 165, maxTileCol: 31670 },\r\n        '16': { minTileRow: 21912, maxTileRow: 37026, minTileCol: 330, maxTileCol: 63341 },\r\n        '17': { minTileRow: 43825, maxTileRow: 74052, minTileCol: 660, maxTileCol: 126683 },\r\n        '18': { minTileRow: 87651, maxTileRow: 148105, minTileCol: 1320, maxTileCol: 253366 },\r\n        '19': { minTileRow: 175302, maxTileRow: 294060, minTileCol: 170159, maxTileCol: 343473 },\r\n        '20': { minTileRow: 376733, maxTileRow: 384679, minTileCol: 530773, maxTileCol: 540914 }\r\n    }\r\n});\r\n\r\n// Create an ortho layer associated to the source\r\nvar orthoLayer = new itowns.ColorLayer('Ortho', { source: orthoSource });\r\n\r\n// Specify a WFS source for the buildings in 3D\r\nvar buildingsSource = new itowns.WFSSource({\r\n    url: 'http://wxs.ign.fr/<key>/geoportail/wfs?',\r\n    version: '2.0.0',\r\n    typeName: 'BDTOPO_BDD_WLD_WGS84G:bati_remarquable,BDTOPO_BDD_WLD_WGS84G:bati_indifferencie,BDTOPO_BDD_WLD_WGS84G:bati_industriel',\r\n    projection: 'EPSG:4326',\r\n    ipr: 'IGN',\r\n    format: 'application/json',\r\n    zoom: { min: 5, max: 5 },\r\n    extent: {\r\n        west: 4.568,\r\n        east: 5.18,\r\n        south: 45.437,\r\n        north: 46.03,\r\n    },\r\n});\r\n\r\n// Create a geometry layer associated to the source\r\nvar buildingsLayer = new itowns.GeometryLayer('Buildings', {\r\n    source: buildingsSource,\r\n    parser: itowns.GeojsonParser,\r\n});\r\n\r\n// Add layers to the view\r\nview.addLayer(orthoLayer);\r\nview.addLayer(buildingsLayer);\r\n```\r\n\r\n\r\n### API\r\nThe API is currently kind of messy, I did a quick refactorization here: https://github.com/zarov/itowns/blob/f826b54ba61f8c5cbd6cf9d1354b5427e7959a39/src/Main.js\r\nI removed some unused things, having no need to be made available (I may be wrong), but I also (and this is more important) added more things available in the API, allowing the user to do more things with iTowns, as described below.\r\n\r\n### Configuration\r\nOne of the biggest unuseful part of iTowns that we could get rid of is all the checks we do on configuration strings. One way to remove this is by asking the configuration differently to the user of iTowns, especially in term of `layer` and `source`.\r\n\r\n#### Layer\r\nInstead of specifying the `type` of the layer, the user should instantiate the layer itself using `var layer = new <TYPE>Layer(...)`, and then add the layer as it is already the case, using `view.addLayer(layer)`. This way, not only iTowns doesn't have to support the fact to create a Layer if only the configuration is specified, but this also allows the user to use its own custom layer if it wants to.\r\n\r\n#### Source\r\nIn the same idea, the `protocol` of a source, determining the type of source to use, should not be specified. Instead, the user uses `var source = new <PROTOCOL>Source(...)`, and then uses this source as an option when creating a layer. This way, we gain on the same points as for the layer above.\r\n\r\n#### Parser\r\nStill in the same vein, a parser should be able to be specified, to let the user more freedom and remove the map we are maintaining between formats and parsers.\r\n\r\n#### Converter\r\nThis one should be specifiable as well, with default one being specified by the layer.\r\n\r\n#### Fetcher\r\nThe last one thing I'm not really sure how to do it is the Fetcher, but I think we could go back to the initial idea of @mbredif and let the Fetcher be always set by the Parser used, or by default the Layer. This same way, we don't have to maintain a map between formats and fetchers.\r\n\r\n### Customization\r\nIf we do as suggested above, we could allow more customization by a user. We could also easily add the support for advanced customization, like colorization of data like geojson or vector tile, by specifying stylizers or something like that.\r\n\r\n### Feature specification\r\nTo ease the development for outside developers, the `Feature` specification needs to find a final stop and decision, as we have already discuss on it a lot of times. The last discussion I have in mind is in #763.\r\n\r\n_______\r\nThis is the end of the proposition, I'm happy to discuss it before going further on this, even if we can already go in some directions without changing too much of iTowns."}}
other: {"actor":{"display_login":"zarov"}}