Skip to content
Snippets Groups Projects
Commit c28f19a3 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Added Font Download

parent cab84557
No related branches found
No related tags found
No related merge requests found
......@@ -12,14 +12,14 @@ function OfflineModule(interactiveMap) {
this.androidConnector = new OfflineModuleAndroidConnector();
}
OfflineModule.prototype.addListeners = function(offlineModule) {
OfflineModule.prototype.addListeners = function (offlineModule) {
$("#offline-addon .exit").off();
$("#offline-addon .exit").click(function() {
$("#offline-addon .exit").click(function () {
offlineModule.interactiveMap.switchModule("search");
});
$("#offline-addon .add-area").off();
$("#offline-addon .add-area").click(function() {
$("#offline-addon .add-area").click(function () {
offlineModule.startAreaSelection(offlineModule);
});
};
......@@ -30,9 +30,9 @@ function androidHasFunction(functionName) {
);
}
OfflineModule.prototype.loadExtractList = function(offlineModule) {
OfflineModule.prototype.loadExtractList = function (offlineModule) {
$("#offline-addon .exit").off();
$("#offline-addon .exit").click(function() {
$("#offline-addon .exit").click(function () {
offlineModule.interactiveMap.switchModule("search");
});
$("#offline-addon .add-area").show("slow");
......@@ -55,7 +55,7 @@ OfflineModule.prototype.loadExtractList = function(offlineModule) {
$("#offline-addon .no-areas").hide();
}
extracts.forEach(function(extract) {
extracts.forEach(function (extract) {
var sizeString = filesizeToString(extract.fileSize);
var lastModifiedString = dateToString(new Date(extract.lastModified));
......@@ -66,7 +66,7 @@ OfflineModule.prototype.loadExtractList = function(offlineModule) {
lastModifiedString
);
extractDomElement.click(function() {
extractDomElement.click(function () {
offlineModule.focusExtract(
offlineModule,
extract.boundingBox,
......@@ -74,11 +74,11 @@ OfflineModule.prototype.loadExtractList = function(offlineModule) {
);
});
extractDomElement.find(".rename").click(function() {
extractDomElement.find(".rename").click(function () {
offlineModule.renameExtract(offlineModule, extract.name);
});
extractDomElement.find(".remove").click(function() {
extractDomElement.find(".remove").click(function () {
offlineModule.removeExtract(offlineModule, extract.name);
});
......@@ -86,7 +86,7 @@ OfflineModule.prototype.loadExtractList = function(offlineModule) {
}, offlineModule);
};
OfflineModule.prototype.renameExtract = function(offlineModule, oldName) {
OfflineModule.prototype.renameExtract = function (offlineModule, oldName) {
var newName = prompt("Geben Sie einen neuen Namen für dieses Gebiet ein:");
if (newName != null) {
if (!offlineModule.androidConnector.renameExtract(oldName, newName)) {
......@@ -99,7 +99,7 @@ OfflineModule.prototype.renameExtract = function(offlineModule, oldName) {
}
};
OfflineModule.prototype.removeExtract = function(offlineModule, name) {
OfflineModule.prototype.removeExtract = function (offlineModule, name) {
if (confirm("Soll das ausgewählte Gebiet wirklich gelöscht werden?")) {
if (!offlineModule.androidConnector.removeExtract(name)) {
// TODO
......@@ -108,7 +108,7 @@ OfflineModule.prototype.removeExtract = function(offlineModule, name) {
offlineModule.clearBoundingBoxes(offlineModule);
$("#offline-addon .exit").off();
$("#offline-addon .exit").click(function() {
$("#offline-addon .exit").click(function () {
offlineModule.interactiveMap.switchModule("search");
});
$("#offline-addon .add-area").show("slow");
......@@ -117,7 +117,7 @@ OfflineModule.prototype.removeExtract = function(offlineModule, name) {
}
};
OfflineModule.prototype.drawBoundingBox = function(
OfflineModule.prototype.drawBoundingBox = function (
offlineModule,
boundingBox,
color
......@@ -150,7 +150,7 @@ OfflineModule.prototype.drawBoundingBox = function(
});
};
OfflineModule.prototype.clearBoundingBoxes = function(offlineModule) {
OfflineModule.prototype.clearBoundingBoxes = function (offlineModule) {
offlineModule.interactiveMap.map.removeLayer("extractBox"); // TODO adjust for multiple boxes with different ids
offlineModule.interactiveMap.map.removeSource("extractBox"); // TODO adjust for multiple boxes with different ids
};
......@@ -182,7 +182,7 @@ function dateToString(date) {
return lastModified;
}
OfflineModule.prototype.createExtractDomElement = function(
OfflineModule.prototype.createExtractDomElement = function (
offlineModule,
name,
sizeString,
......@@ -204,7 +204,7 @@ OfflineModule.prototype.createExtractDomElement = function(
return extractDomElement;
};
OfflineModule.prototype.focusExtract = function(
OfflineModule.prototype.focusExtract = function (
offlineModule,
boundingBox,
extractDomElement
......@@ -222,7 +222,7 @@ OfflineModule.prototype.focusExtract = function(
hideAllExtractsExcept(name);
$("#offline-addon .exit").off();
$("#offline-addon .exit").click(function() {
$("#offline-addon .exit").click(function () {
offlineModule.unfocusExtract(offlineModule, extractDomElement, boundingBox);
});
......@@ -234,7 +234,7 @@ OfflineModule.prototype.focusExtract = function(
};
function hideAllExtractsExcept(shownAreaName) {
$(".downloaded-areas > .area").each(function(index, extractDomElement) {
$(".downloaded-areas > .area").each(function (index, extractDomElement) {
// Has to be turned into a jquery object, because each delivers vanilla js dom objects
extractDomElement = $(extractDomElement);
......@@ -246,7 +246,7 @@ function hideAllExtractsExcept(shownAreaName) {
});
}
OfflineModule.prototype.unfocusExtract = function(
OfflineModule.prototype.unfocusExtract = function (
offlineModule,
extractDomElement,
extractBoundingBox
......@@ -260,7 +260,7 @@ OfflineModule.prototype.unfocusExtract = function(
$("#offline-addon .auto-updates").show();
$("#offline-addon .exit").off();
$("#offline-addon .exit").click(function() {
$("#offline-addon .exit").click(function () {
offlineModule.interactiveMap.switchModule("search");
});
......@@ -268,7 +268,7 @@ OfflineModule.prototype.unfocusExtract = function(
offlineModule.loadExtractList(offlineModule);
extractDomElement.click(function() {
extractDomElement.click(function () {
offlineModule.focusExtract(
offlineModule,
extractBoundingBox,
......@@ -277,7 +277,7 @@ OfflineModule.prototype.unfocusExtract = function(
});
};
OfflineModule.prototype.fitToBoundingBox = function(
OfflineModule.prototype.fitToBoundingBox = function (
offlineModule,
boundingBox
) {
......@@ -293,28 +293,32 @@ OfflineModule.prototype.fitToBoundingBox = function(
);
};
OfflineModule.prototype.startAreaSelection = function(offlineModule) {
OfflineModule.prototype.startAreaSelection = function (offlineModule) {
if (!offlineModule.androidConnector.downloadFonts()) {
return;
}
$("#offline-addon .downloaded-areas").hide("slow");
$("#offline-addon .area-selection").show("slow");
$("#start-download").show();
offlineModule.interactiveMap.map.on("touchend", function() {
offlineModule.interactiveMap.map.on("touchend", function () {
offlineModule.selectedAreaChanged(offlineModule);
});
offlineModule.interactiveMap.map.on("mouseup", function() {
offlineModule.interactiveMap.map.on("mouseup", function () {
offlineModule.selectedAreaChanged(offlineModule);
});
$("#offline-addon .exit").off();
$("#offline-addon .exit").click(function() {
$("#offline-addon .exit").click(function () {
$(offlineModule.interactiveMap.map).off("touchend");
$(offlineModule.interactiveMap.map).off("mouseup");
offlineModule.stopAreaSelection(offlineModule);
});
$("#start-download").off();
$("#start-download").click(function() {
$("#start-download").click(function () {
$(offlineModule.interactiveMap.map).off("touchend");
$(offlineModule.interactiveMap.map).off("mouseup");
offlineModule.startDownload(offlineModule);
......@@ -323,7 +327,7 @@ OfflineModule.prototype.startAreaSelection = function(offlineModule) {
offlineModule.selectedAreaChanged(offlineModule);
};
OfflineModule.prototype.stopAreaSelection = function(offlineModule) {
OfflineModule.prototype.stopAreaSelection = function (offlineModule) {
$("#offline-addon .downloaded-areas").show("slow");
$("#offline-addon .area-selection").hide("slow");
offlineModule.loadExtractList(offlineModule);
......@@ -333,11 +337,11 @@ OfflineModule.prototype.stopAreaSelection = function(offlineModule) {
$(offlineModule.interactiveMap.map).off("mouseup");
};
OfflineModule.prototype.selectedAreaChanged = function(offlineModule) {
OfflineModule.prototype.selectedAreaChanged = function (offlineModule) {
offlineModule.updateDownloadSizeExpectation(offlineModule);
};
OfflineModule.prototype.updateDownloadSizeExpectation = function(
OfflineModule.prototype.updateDownloadSizeExpectation = function (
offlineModule
) {
boundingBox = offlineModule.getBoundingBoxFromMap(offlineModule);
......@@ -352,7 +356,7 @@ OfflineModule.prototype.updateDownloadSizeExpectation = function(
}
};
OfflineModule.prototype.startDownload = function(offlineModule, selectedArea) {
OfflineModule.prototype.startDownload = function (offlineModule, selectedArea) {
if (!offlineModule.androidConnector.isInternetAvailable) {
alert("Sie haben zurzeit kein Internet.");
return;
......@@ -384,7 +388,7 @@ OfflineModule.prototype.startDownload = function(offlineModule, selectedArea) {
if (downloadStarted) {
$("#offline-addon .download-progress .abort").off();
$("#offline-addon .download-progress .abort").click(function() {
$("#offline-addon .download-progress .abort").click(function () {
$("#offline-addon .download-progress .abort").off();
offlineModule.cancelDownload(offlineModule);
});
......@@ -395,12 +399,12 @@ OfflineModule.prototype.startDownload = function(offlineModule, selectedArea) {
}
};
OfflineModule.prototype.askForExtractName = function(offlineModule) {
OfflineModule.prototype.askForExtractName = function (offlineModule) {
var extractName = prompt("Bitte Namen für Kartenausschnitt eingeben.");
return extractName;
};
OfflineModule.prototype.reassureDownloadIfNoWireless = function(offlineModule) {
OfflineModule.prototype.reassureDownloadIfNoWireless = function (offlineModule) {
if (offlineModule.androidConnector.isWireless()) {
return true;
} else {
......@@ -413,7 +417,7 @@ OfflineModule.prototype.reassureDownloadIfNoWireless = function(offlineModule) {
}
};
OfflineModule.prototype.getBoundingBoxFromMap = function(offlineModule) {
OfflineModule.prototype.getBoundingBoxFromMap = function (offlineModule) {
var bbox_raw = offlineModule.interactiveMap.map.getBounds();
var bbox = {
minLon: bbox_raw.getWest(),
......@@ -424,7 +428,7 @@ OfflineModule.prototype.getBoundingBoxFromMap = function(offlineModule) {
return bbox;
};
OfflineModule.prototype.updateDownloadStatus = function(offlineModule) {
OfflineModule.prototype.updateDownloadStatus = function (offlineModule) {
var error;
if ((error = offlineModule.androidConnector.getError()) != "") {
$("#offline-addon .download-progress").before(
......@@ -432,7 +436,7 @@ OfflineModule.prototype.updateDownloadStatus = function(offlineModule) {
<div class="download-failed alert alert-danger">' + error + "</div>")
);
window.setTimeout(function() {
window.setTimeout(function () {
$("#offline-addon .download-failed").remove();
offlineModule.cancelDownload(offlineModule);
}, 5000);
......@@ -460,25 +464,25 @@ OfflineModule.prototype.updateDownloadStatus = function(offlineModule) {
(downloadedPercentage * 100).toFixed(1) + " %"
);
window.setTimeout(function() {
window.setTimeout(function () {
offlineModule.updateDownloadStatus(offlineModule);
}, 100);
}
};
OfflineModule.prototype.cancelDownload = function(offlineModule) {
OfflineModule.prototype.cancelDownload = function (offlineModule) {
offlineModule.androidConnector.cancelDownload();
offlineModule.exitDownload(offlineModule);
};
OfflineModule.prototype.exitDownload = function(offlineModule) {
OfflineModule.prototype.exitDownload = function (offlineModule) {
$(".exit").show("fast");
$(".area-selection").show();
$(".area-downloading").hide();
$(".download-progress").hide();
};
OfflineModule.prototype.initializeInterface = function(offlineModule) {
OfflineModule.prototype.initializeInterface = function (offlineModule) {
// Hide everything from Map that is not needed:
$(".ol-zoom, .ol-zoomslider").hide("slow");
$("#offline-addon .no-areas").hide();
......@@ -486,7 +490,7 @@ OfflineModule.prototype.initializeInterface = function(offlineModule) {
offlineModule.interactiveMap.reversePositionManager.setActive(false);
$("#offline-addon").show(
"slow",
$.proxy(function() {
$.proxy(function () {
offlineModule.loadExtractList(offlineModule);
}, offlineModule)
);
......@@ -494,7 +498,7 @@ OfflineModule.prototype.initializeInterface = function(offlineModule) {
// this.interactiveMap.map.addLayer(this.layer); // TODO
};
OfflineModule.prototype.exit = function() {
OfflineModule.prototype.exit = function () {
$("#offline-addon .placeholder.area-selection-info").hide();
$("#offline-addon").hide("slow");
......@@ -509,6 +513,6 @@ OfflineModule.prototype.exit = function() {
this.interactiveMap.reversePositionManager.setActive(true);
};
OfflineModule.prototype.enableGps = function(offlineModule) {};
OfflineModule.prototype.enableGps = function (offlineModule) { };
OfflineModule.prototype.disableGps = function(offlineModule) {};
OfflineModule.prototype.disableGps = function (offlineModule) { };
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment