Skip to content

Commit

Permalink
v1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
www committed Dec 7, 2015
2 parents bb64f31 + 82642b5 commit 666f0d3
Show file tree
Hide file tree
Showing 7 changed files with 142 additions and 20 deletions.
25 changes: 20 additions & 5 deletions dist/angular-openlayers-directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -1389,6 +1389,10 @@ angular.module('openlayers-directive').factory('olHelpers', ["$q", "$log", "$htt
attributions: createAttribution(source)
};

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

if (source.url) {
wmsConfiguration.url = source.url;
}
Expand Down Expand Up @@ -1760,12 +1764,23 @@ angular.module('openlayers-directive').factory('olHelpers', ["$q", "$log", "$htt
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 @@ -1931,7 +1946,7 @@ angular.module('openlayers-directive').factory('olHelpers', ["$q", "$log", "$htt
if ((type === 'Vector') && layer.clustering) {
oSource = new ol.source.Cluster({
source: oSource,
distance: layer.clusteringDistance,
distance: layer.clusteringDistance
});
}

Expand Down
5 changes: 3 additions & 2 deletions dist/angular-openlayers-directive.min.js

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions dist/angular-openlayers-directive.min.no-header.js

Large diffs are not rendered by default.

25 changes: 20 additions & 5 deletions dist/angular-openlayers-directive.pre.js
Original file line number Diff line number Diff line change
Expand Up @@ -1389,6 +1389,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 @@ -1760,12 +1764,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 @@ -1931,7 +1946,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
75 changes: 75 additions & 0 deletions examples/120-custom-layer-and-projection-example.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<!DOCTYPE html>
<html ng-app="demoapp">
<head>
<script src="../bower_components/openlayers3/build/ol-debug.js"></script>
<script src="../bower_components/angular/angular.min.js"></script>
<script src="../bower_components/angular-sanitize/angular-sanitize.min.js"></script>
<script src="../dist/angular-openlayers-directive.js"></script>
<link rel="stylesheet" href="../bower_components/openlayers3/build/ol.css"/>
<script>
var app = angular.module("demoapp", ["openlayers-directive"]);
app.controller('DemoController', ['$scope', function ($scope) {

var projection = new ol.proj.Projection({
code: 'EPSG:31370',
extent: [141192.712, 161464.403, 158005.472, 178169.335],
units: 'm'
});
console.info('projection', projection);

angular.extend($scope, {
brussels: {
lat: 149592.58,
lon: 170161.24,
zoom: 1
},
customLayer: {
source: {
type: 'TileWMS',
url: 'http://geoserver.gis.irisnet.be/geoserver/wms',
params: {LAYERS: 'urbisFR'},
serverType: 'geoserver'
}
},
defaults: {
// Setting up the
center: {
projection: projection
},
interactions: {
mouseWheelZoom: true
},
view: {
center: [149592.58, 170161.24],
extent: projection.extent,
zoom: 1,
projection: projection
}
},
view: {
center: [149592.58, 170161.24],
extent: projection.extent,
zoom: 1,
projection: projection
}
});
}]);
</script>
</head>
<body ng-controller="DemoController">
<openlayers
custom-layers="true"
ng-style="mapStyle"
ol-center="brussels"
ol-defaults="defaults"
ol-view="view">
<ol-layer ol-layer-properties="customLayer"></ol-layer>
</openlayers>

<h1>Custom layer source with custom projection and extent</h1>

<p>An example that demonstrates how to adequately setup a custom layer source with a custom projection and extent</p>
</div>

</body>
</html>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,5 @@
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
"main": "dist/angular-openlayers-directive",
"version": "1.4.2"
"version": "1.5.0"
}
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 666f0d3

Please sign in to comment.