Skip to content

Commit

Permalink
#77 Added better error handling when services fail to return tiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Jayson Ward committed Jun 26, 2018
1 parent 3599848 commit 4cac78e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 40 deletions.
29 changes: 22 additions & 7 deletions ExportView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ Item {
}

StackView.onDeactivating: {
mapViewPlus.map.clearData();
mapViewPlus.mapClearData();
}

//--------------------------------------------------------------------------
Expand Down Expand Up @@ -149,7 +149,7 @@ Item {
// MAP SECTION /////////////////////////////////////////////////

Rectangle {
color: "#fff"
color:"#fff"
Layout.fillWidth: true
Layout.fillHeight: true

Expand All @@ -164,14 +164,13 @@ Item {
Layout.fillHeight: true
Layout.fillWidth: true
clip: true
enabled: map !== null && map.mapReady

mapViewPlusPortal: exportView.portal
mapDefaultLat: app.info.properties.mapDefaultLat
mapDefaultLong: app.info.properties.mapDefaultLong
mapDefaultZoomLevel: (calledFromAnotherApp && dlr.zoomLevel !== null) ? dlr.zoomLevel : app.info.properties.mapDefaultZoomLevel
mapDefaultCenter: (calledFromAnotherApp && dlr.center !== null) ? dlr.center : {"lat": app.info.properties.mapDefaultLat, "long": app.info.properties.mapDefaultLong }
// mapTileService: currentTileService.url
// mapTileServiceUsesToken: currentTileService.useTokenToAccess

Component.onCompleted: {
zoomLevelIndicator.text = "%1".arg(parseFloat(mapViewPlus.map.zoomLevel).toFixed(1));
Expand Down Expand Up @@ -199,6 +198,9 @@ Item {
}

onDrawingStarted: {
if (!map.mapReady){
return;
}
}

onDrawingFinished: {
Expand Down Expand Up @@ -239,6 +241,22 @@ Item {
}
}
}

Rectangle {
anchors.fill: parent
color: "#333"
visible: mapViewPlus.map === null || !mapViewPlus.map.mapReady
Text {
anchors.fill: parent
anchors.margins: sf(20)
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.Wrap
text: qsTr("Error Loading Map Service: %1".arg(currentTileService.url))
font.pointSize: 18
color: "#fff"
}
}
}

// MAP TOOL BAR ////////////////////////////////////////
Expand Down Expand Up @@ -449,9 +467,6 @@ Item {
tpkTitle: exportView.extractDefaultTPKTitle(exportView.currentTileService.title)

onChangeTileService: {
// if (mapViewPlus.map !== null) {
// mapViewPlus.map.clearData();
// }
exportView.currentTileIndex = index;
exportView.currentTileService = availableServices.get(index);
mapViewPlus.mapTileService = exportView.currentTileService.url;
Expand Down
37 changes: 4 additions & 33 deletions HistoryView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,9 @@ Item {
property bool exportHistoryExists: false
property bool uploadHistoryExists: false

// property var xHistory
// property var uHistory


// SIGNAL IMPLEMENTATIONS //////////////////////////////////////////////////

Component.onCompleted: {
// xHistory = appDatabase.read("SELECT * FROM 'exports' ORDER BY OBJECTID DESC");
getExportHistory();
getUploadHistory();
}

//--------------------------------------------------------------------------
Expand All @@ -56,6 +49,10 @@ Item {
mainView.appToolBar.backButtonVisible = true;
mainView.appToolBar.toolBarTitleLabel = Singletons.Strings.exportAndUploadHistory;
}
StackView.onActivated: {
getExportHistory();
getUploadHistory();
}

// UI //////////////////////////////////////////////////////////////////////

Expand Down Expand Up @@ -145,32 +142,6 @@ Item {
Layout.fillHeight: true
Layout.fillWidth: true

// ListView {
// id: exportListView
// width: parent.width
// height: parent.height
// clip: true
// flickableDirection: Flickable.VerticalFlick
// model: xHistory
// spacing: sf(5)
// delegate: Rectangle {
// width: parent.width
// height: childrenRect.height
// color: "gold"
// Column{
// anchors.fill: parent
// Text {
// width: parent.width
// text: title
// }
// Text {
// width: parent.width
// text: new Date(transaction_date).toLocaleDateString() + " " + new Date(transaction_date).toLocaleTimeString()
// }
// }
// }
// }

Flickable {
id: exportFlickable
anchors.fill: parent
Expand Down
8 changes: 8 additions & 0 deletions MapViewPlus/MapViewPlus.qml
Original file line number Diff line number Diff line change
Expand Up @@ -2117,5 +2117,13 @@ Item {
userBookmarks = appDatabase.read("SELECT * FROM 'bookmarks' WHERE user IS '%1'".arg(portal.user.email));
}

//--------------------------------------------------------------------------

function mapClearData(){
if (map.mapReady && map !== null) {
map.clearData();
}
}

// END /////////////////////////////////////////////////////////////////////
}

0 comments on commit 4cac78e

Please sign in to comment.