geoadmin/mf-geoadmin3 — pull request #95 by elemoine (2013-07-08 15:44:35+00:00)
Title: Add a map service

This PR suggests adding a map service.

The goal of this service is to provide map-related properties and functions to directives, and other services.

The map service is currently an object literal with two properties: "map", a reference to the map object, and "resolutions", an array of view resolutions. Later, we can add other properties to the service, a "getLayer" function that takes a layer name and returns an ol layer for example.

At this point the only users of the map service are the map and background layer selctor directives. Later, if this patch makes sense to others, all the directives that use the map will need to be modified. (I did not want to modify too much code and break others' branches.)

So with the map service we no longer store the map on some global scope. And the application is no longer responsible for creating the map object.

On that point, note that that doesn't mean the application cannot have control over the creation of the map. The map service provider can indeed provide configuration functions (as exemplified by the setInitialCenter and setInitialZoom functions). And options can still be passed to the map directive through the "options" scope-level object.

Please review.