Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/184 update crabpy dojo again #188

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions MapController.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,18 @@ define([
return this.geoJsonFormatter.writeGeometry(geom);
},

transformBoundingboxToMapExtent: function(boundingbox) {
var lowerleft = this.transformLatLonToPoint(boundingbox.lowerleft.lat, boundingbox.lowerleft.lon);
var upperright = this.transformLatLonToPoint(boundingbox.upperright.lat, boundingbox.upperright.lon);
return ([lowerleft.getCoordinates()[0], lowerleft.getCoordinates()[1],
upperright.getCoordinates()[0], upperright.getCoordinates()[1]]);
},

transformLatLonToPoint: function(lat, lon) {
var point = new ol.geom.Point([ lon, lat ]);
return (point.transform('EPSG:4326', 'EPSG:31370'));
},

_createLayers: function(map) {
/* base layers */
var baseLayers = [];
Expand Down
18 changes: 10 additions & 8 deletions ZoneMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,25 +269,27 @@ define([
var crabNode = domConstruct.create("div");
ZoomTab.addContent(crabNode);
var crabZoomer = crabpyWidget.createCrabZoomer(crabNode);
crabZoomer.startup();
var self = this;

var zoomButton = domConstruct.create("a", {
href: "#",
title: "Zoom naar adres",
'class': "button tiny expand",
innerHTML: "Zoom naar adres",
onclick: function (evt) {
onclick: lang.hitch(this, function (evt) {
evt.preventDefault();
var bbox = crabZoomer.getBbox();
if (bbox) {
self.mapController.zoomToExtent(bbox);
if (self.mapController.olMap.getView().getZoom() > 15) {
self.mapController.olMap.getView().setZoom(15);
var bboxobject = crabZoomer.getBbox();
if (bboxobject) {
var bbox = this.mapController.transformBoundingboxToMapExtent(bboxobject);
this.mapController.zoomToExtent(bbox);
if (this.mapController.olMap.getView().getZoom() > 15) {
this.mapController.olMap.getView().setZoom(15);
}
crabZoomer.reset();
sidebar.collapse();
}
}
})
});
ZoomTab.addContent(zoomButton);

Expand All @@ -313,7 +315,7 @@ define([
}

if (this.config.sidebar.draw) {
var drawTab = sidebar.createTab('Bepaal zone', 'fa-connectdevelop', 'Bepaal hier de zone.');
var drawTab = sidebar.createTab('Bepaal zone', 'fa-pencil', 'Bepaal hier de zone.');

/* ZONE */
var zonePane = domConstruct.create('div');
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"dojo": "~1.12.1",
"dijit": "~1.12.1",
"proj4": "~2.3.15",
"crabpy_dojo": "https://github.com/OnroerendErfgoed/crabpy_dojo.git#1.4.0",
"crabpy_dojo": "https://github.com/OnroerendErfgoed/crabpy_dojo.git#1.4.3",
"ol": "https://github.com/OnroerendErfgoed/ol3-amd.git#0.2.1",
"font-awesome": "~4.6.3",
"dgrid": "~1.1.0",
Expand Down