Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Moving rotation to a separate branch

Taylor Gunnoedb3b17de48f3
diff --git a/web/js/image/wv.image.rubberband.js b/web/js/image/wv.image.rubberband.js
index 0c5824b15..db4324774 100644
--- a/web/js/image/wv.image.rubberband.js
+++ b/web/js/image/wv.image.rubberband.js
@@ -135,25 +135,6 @@ wv.image.rubberband = wv.image.rubberband || function(models, ui, config) {
});
return;
}
-
- //Don't toggle area select UI for downloading image if image rotated
- if(ui.map.selected.getView().getRotation() === 0.0)
- toggleOn();
- else
- wv.ui.ask({
- header: "Reset rotation?",
- message: "Image may not be downloaded when rotated. Would you like to reset rotation?",
- onOk: function() {
- ui.map.selected.beforeRender(ol.animation.rotate({
- duration: 400,
- rotation: ui.map.selected.getView().getRotation()
- }));
- ui.map.selected.getView().rotate(0);
- ui.map.updateRotation();
- //Let rotation finish before image download can occur
- setTimeout(toggle, 500);
- }
- });
}
else {
state = "off";
diff --git a/web/js/map/wv.map.model.js b/web/js/map/wv.map.model.js
index ab9a1dbc9..39b75266b 100644
--- a/web/js/map/wv.map.model.js
+++ b/web/js/map/wv.map.model.js
@@ -19,7 +19,6 @@ wv.map.model = wv.map.model || function(models, config) {
var self = {};
self.extent = null;
- self.rotation = 0; //initial rotation from url. This is shared amongst both polar rotations
self.events = wv.util.events();
self.update = function(extent) {
@@ -40,19 +39,11 @@ wv.map.model = wv.map.model || function(models, config) {
errors.push({message: "Extent outside of range"});
}
}
-
- //get rotation if it exists
- if(state.p === 'arctic' || state.p === 'antarctic')
- if (!isNaN(state.r)) //convert to radians here
- self.rotation = state.r * (Math.PI / 180.0);
-
};
//When models.link.toQueryString() is called, save extent and rotation
self.save = function(state) {
state.v = _.clone(self.extent);
- if(self.rotation !== 0.0 && self.rotation !== 0 && models.proj.selected.id !== 'geographic')
- state.r = (self.rotation * (180.0 / Math.PI)).toPrecision(6); //convert from radians to degrees
};
self.getLeadingExtent = function() {
diff --git a/web/js/map/wv.map.ui.js b/web/js/map/wv.map.ui.js
index fa08c236b..4289c7152 100644
--- a/web/js/map/wv.map.ui.js
+++ b/web/js/map/wv.map.ui.js
@@ -69,10 +69,6 @@ wv.map.ui = wv.map.ui || function(models, config) {
var map = self.selected;
reloadLayers();
- //Update the rotation buttons if polar projection to display correct value
- if(models.proj.selected.id !== "geographic")
- self.updateRotation();
-
// If the browser was resized, the inactive map was not notified of
// the event. Force the update no matter what and reposition the center
// using the previous value.
@@ -403,23 +399,6 @@ wv.map.ui = wv.map.ui || function(models, config) {
triggerExtent();
};
- //Called as event listener when map is rotated. Update url to reflect rotation reset
- self.updateRotation = function() {
- models.map.rotation = self.selected.getView().getRotation();
- window.history.replaceState("", "@OFFICIAL_NAME@","?" + models.link.toQueryString());
-
- //Set reset button content and proper CSS styling to position it correctly
- $(".wv-map-reset-rotation").button("option", "label", Number((models.map.rotation) * (180.0 / Math.PI)).toFixed() );
- if((models.map.rotation) * (180.0 / Math.PI) >= 100.0)
- $(".wv-map-reset-rotation").find("span").attr("style","padding-left: 9px");
- else if((models.map.rotation) * (180.0 / Math.PI) <= -100.0)
- $(".wv-map-reset-rotation").find("span").attr("style","padding-left: 6px");
- else if((models.map.rotation) * (180.0 / Math.PI) <= -10.0)
- $(".wv-map-reset-rotation").find("span").attr("style","padding-left: 10px");
- else
- $(".wv-map-reset-rotation").find("span").attr("style","padding-left: 14px");
- };
-
var createMap = function(proj) {
var id = "wv-map-" + proj.id;
var $map = $("<div></div>")
@@ -439,24 +418,15 @@ wv.map.ui = wv.map.ui || function(models, config) {
units: "imperial"
});
- //insert this to polar map views for desktop and mobile rotation
- var rotateInteraction = new ol.interaction.DragRotate({
- condition: ol.events.condition.altKeyOnly,
- duration: animationDuration
- }), mobileRotation = new ol.interaction.PinchRotate({
- duration: animationDuration
- });
-
var map = new ol.Map({
view: new ol.View({
maxResolution: proj.resolutions[0],
projection: ol.proj.get(proj.crs),
extent: proj.maxExtent,
center: proj.startCenter,
- rotation: proj.id === "geographic" ? 0.0 : models.map.rotation,
zoom: proj.startZoom,
maxZoom: proj.numZoomLevels,
- enableRotation: true
+ enableRotation: false
}),
target: id,
renderer: ["canvas", "dom"],
@@ -491,17 +461,9 @@ wv.map.ui = wv.map.ui || function(models, config) {
createZoomButtons(map, proj);
createMousePosSel(map, proj);
- //allow rotation by dragging for polar projections
- if(proj.id !== 'geographic') {
- createRotationWidget(map);
- map.addInteraction(rotateInteraction);
- map.addInteraction(mobileRotation);
- }
-
//Set event listeners for changes on the map view (when rotated, zoomed, panned)
map.getView().on("change:center", updateExtent);
map.getView().on("change:resolution", updateExtent);
- map.getView().on("change:rotation", self.updateRotation);
return map;
};
@@ -639,82 +601,6 @@ wv.map.ui = wv.map.ui || function(models, config) {
});
};
- //Create rotation buttons for polar views
- var createRotationWidget = function(map) {
- var $map = $("#" + map.getTarget());
-
- var $left = $("<button></button>")
- .addClass("wv-map-rotate-left wv-map-zoom")
- .attr("title","You may also rotate by holding Alt and dragging the mouse"),
- $lefticon = $("<i></i>")
- .addClass("fa fa-undo");
-
- var $right = $("<button></button>")
- .addClass("wv-map-rotate-right wv-map-zoom")
- .attr("title","You may also rotate by holding Alt and dragging the mouse"),
- $righticon = $("<i></i>")
- .addClass("fa fa-repeat");
-
- var $mid = $("<button></button>")
- .addClass("wv-map-reset-rotation wv-map-zoom")
- .attr("title", "Click to reset")
- .attr("style", "width: 43px");
-
- $left.append($lefticon); $right.append($righticon);
- $map.append($left).append($mid).append($right);
-
- var intervalId, dur = 500;
-
- //Set buttons to animate rotation by 18 degrees. use setInterval to repeat the rotation when mouse button is held
- $left.button({
- text: false
- }).mousedown(function() {
- rotate(10, dur);
- intervalId = setInterval(function() {
- rotate(10, dur);
- }, dur);
- }).mouseup(function() {
- clearInterval(intervalId);
- });
-
- $right.button({
- text: false
- }).mousedown(function() {
- rotate(-10, dur);
- intervalId = setInterval(function() {
- rotate(-10, dur);
- }, dur);
- }).mouseup(function() {
- clearInterval(intervalId);
- });
-
- $mid.button({
- label: Number(models.map.rotation * (180/Math.PI)).toFixed()
- }).mousedown(function() { //reset rotation
- clearInterval(intervalId); //stop repeating rotation on mobile
- map.beforeRender(ol.animation.rotate({
- duration: 500,
- rotation: map.getView().getRotation()
- }));
- map.getView().rotate(0);
- self.updateRotation();
-
- $mid.button("option", "label", "0");
- });
-
- //Function to rotate polar map tile when button is pressed. Amount divides a 180 degree rotation
- var rotate = function(amount, duration) {
- map.beforeRender(ol.animation.rotate({
- duration: duration,
- rotation: map.getView().getRotation()
- }));
-
- map.getView().rotate(map.getView().getRotation() - (Math.PI / amount));
- self.updateRotation();
- };
-
- };
-
var zoomAction = function(map, amount) {
return function() {
var zoom = map.getView().getZoom();