Skip to content

Commit

Permalink
feat(olHelpers): add props to TileWMS and view
Browse files Browse the repository at this point in the history
These OL3 properties are optionally added when specified, so that they can be passed to OL3.
  • Loading branch information
dpappalardo-cirb committed Dec 7, 2015
1 parent 72d34b4 commit bb07b9d
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions src/services/olHelpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
attributions: createAttribution(source)
};

if (source.serverType) {
wmsConfiguration.serverType = source.serverType;
}

if (source.url) {
wmsConfiguration.url = source.url;
}
Expand Down Expand Up @@ -606,12 +610,23 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
createView: function(view) {
var projection = createProjection(view);

return new ol.View({
var viewConfig = {
projection: projection,
maxZoom: view.maxZoom,
minZoom: view.minZoom,
extent: view.extent
});
minZoom: view.minZoom
};

if (view.center) {
viewConfig.center = view.center;
}
if (view.extent) {
viewConfig.extent = view.extent;
}
if (view.zoom) {
viewConfig.zoom = view.zoom;
}

return new ol.View(viewConfig);
},

// Determine if a reference is defined and not null
Expand Down Expand Up @@ -777,7 +792,7 @@ angular.module('openlayers-directive').factory('olHelpers', function($q, $log, $
if ((type === 'Vector') && layer.clustering) {
oSource = new ol.source.Cluster({
source: oSource,
distance: layer.clusteringDistance,
distance: layer.clusteringDistance
});
}

Expand Down

0 comments on commit bb07b9d

Please sign in to comment.