Open aubm opened 8 years ago
Sure, can you elaborate bit more on this?
+1
The goal is to use every parameters defined by OL3 without restriction. If we choose to use this type, we know we are at the bleeding edge of the directive :
This kind of code could be in the switch/case which define the oSource in the olHelper : https://github.com/davinkevin/angular-openlayers-directive/commit/ecc46804f601849ea074e0f456eabca257144cc0
Do you think there is other side effect by doing that ?
Interesting.
Do you think there is other side effect by doing that ?
No, not really. It's an edge case where the developer might want to go native with ol3 constructs, which I think is fine. In the general case you could still benefit from the simpler object configuration syntax the directive currently offers.
Could you submit a PR for that?
After investigation, it seems ol object are too complexe for the $scope.$watch function. When angular try to do a comparison between two OpenLayer Source object, the browser reach it's maximum call stack size (from here : https://github.com/tombatossals/angular-openlayers-directive/blob/master/src/directives/layer.js#L61 )
So, as an alternative, and only for native type of OpenLayer (ImageWMS, TileWMS, WMTS, OSM, BingMaps, MapQuest, TileJSON, TileVector, TileTMS, TileImage, KML, XYZ), we should find a way to let the developper give angular-openlayer-directive the parameter of the constructor.
For example :
if (source.rawParameters) {
return new ol.layer.[source.type](source.rawParameters);
}
switch(source.type):
case ...
...
If you have a better idea, I'll be glad to hear it :smile:
Hello, I noticed that although the olHelpers provides a simple interface for building sources with the createSource function, the list of parameters we can provide is limited to those supported by the function.
For now if I need to provide some parameters to OpenLayers which are not supported by the directive, I can create a PR and that's fine as it does not happen too often. But I wonder if we could find a way to provide arbitrary options for sources.
Maybe a specific "raw" case could do the trick by providing a object like :
What do you think ?