TNOCS / csWeb

csWeb, short for common sense Web, is a userfriendly web application for showing (GIS) data on a map. It allows you to apply multiple filters to filter your data, and to style it, so you can immediately see what's important.
http://tnocs.github.io/csWeb/
MIT License
29 stars 18 forks source link

Loading project data #167

Open c-martinez opened 9 years ago

c-martinez commented 9 years ago

Again, more a question than an actual issue:

Solution files are loaded by the "openProject" method of LayerService class. But surely LayerService already does enough with handling all layer data.

Suggestion:

Hidden agenda: the new simulation functionality, also needs to load data from project file. To me it seems like a better option if SimulationService does no need to communicate with LayerService (at least not to access project related data).

If there is a good reason why LayerService is loading project data and I have missed something, I would greatly appreciate clarification. Otherwise, if the suggested changes sounds like a good idea and people agree, I'll implement ProjectService and make changes as required.

erikvullings commented 9 years ago

I agree, loading project files (project.json) would be better in a separate service, which can be injected in the LayerService. As a standalone service, it will also be easier to test. The main reason that the openProject method is still in the LayerService is simplicity, and nu real need to separate them.

So please go ahead and refactor it as suggested.

Btw a similar argument is applicable to the solution file (projects.json), although two separate services may be a bit too much. Loading solutions and project should be combined in one service. As a side note, it would be nice if the solution file would be renamed to solutions.json, preferably with a fallback mechanism to projects.json.

It probably does require an event or message on the bus informing others when it has finished loading.

Please note that there may be multiple project files in one solution (see the project... directive in the index.html of the scale project).

You were also mentioning a SimulationService. It would be interesting to discuss that further, as I'm also working on implementing it. In the API-development branch, Arnoud is extending the capabilities of the API manager, who is responsible for synchronizing the REST (which uses swagger), the socket.io, and the mqtt interfaces. So updates/changes on one channel will be pushed to all channels.

That same functionality that the ApiManager offers can also be used by a SimulationService, so it can CRUD layers, layer features, and keys-value pairs.

In another project, I've also used Almende's hypertimer (https://github.com/enmasseio/hypertimer), which should be a good basis for time management.

Happy to discuss this further tomorrow...

-----Original Message----- From: "c-martinez" notifications@github.com Sent: ‎25/‎08/‎2015 16:28 To: "TNOCS/csWeb" csWeb@noreply.github.com Subject: [csWeb] Loading project data (#167)

Again, more a question than an actual issue: Solution files are loaded by the "openProject" method of LayerService class. But surely LayerService already does enough with handling all layer data. Suggestion: Load project data on a ProjectService Have LayerService communicate with ProjectService when project data is required. Hidden agenda: the new simulation functionality, also needs to load data from project file. To me it seems like a better option if SimulationService does no need to communicate with LayerService (at least not to access project related data). If there is a good reason why LayerService is loading project data and I have missed something, I would greatly appreciate clarification. Otherwise, if the suggested changes sounds like a good idea and people agree, I'll implement ProjectService and make changes as required. — Reply to this email directly or view it on GitHub.

damylen commented 9 years ago

I think it is a good idea to discuss this a little bit further tomorrow, as a lot of the functions in the layer service are actually project related. It also handles initialization of layersources, map rendering (leaflet, cesium), groups, dashboards, filters, features, etc. A lot of directives inject the layerService or have anguluar bindings. If we agree that we really need to refactor this, I would advice to do this together.