From 67676c02f290d2cc414df2efed471b0798a8ed9d Mon Sep 17 00:00:00 2001 From: Jayson Ward Date: Mon, 25 Jun 2018 11:08:06 +1000 Subject: [PATCH 1/3] #77 Moved clearData and tile service assignment --- ExportView.qml | 13 ++++++++++--- MapViewPlus/MapView.qml | 10 +--------- MapViewPlus/MapViewPlus.qml | 2 +- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/ExportView.qml b/ExportView.qml index ab2da98..ce7af90 100644 --- a/ExportView.qml +++ b/ExportView.qml @@ -85,7 +85,9 @@ Item { mainView.appToolBar.backButtonVisible = true; mainView.appToolBar.historyButtonEnabled = true; mainView.appToolBar.settingsButtonEnabled = false; - mainView.appToolBar.toolBarTitleLabel = Singletons.Strings.createNewTilePackage + mainView.appToolBar.toolBarTitleLabel = Singletons.Strings.createNewTilePackage; + mapViewPlus.mapTileService = currentTileService.url; + mapViewPlus.mapTileServiceUsesToken = currentTileService.useTokenToAccess; } //-------------------------------------------------------------------------- @@ -161,8 +163,8 @@ Item { 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 +// mapTileService: currentTileService.url +// mapTileServiceUsesToken: currentTileService.useTokenToAccess Component.onCompleted: { zoomLevelIndicator.text = "%1".arg(parseFloat(mapViewPlus.map.zoomLevel).toFixed(1)); @@ -440,8 +442,13 @@ 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; + mapViewPlus.mapTileServiceUsesToken = exportView.currentTileService.useTokenToAccess; } onExportZoomLevelsChanged: { diff --git a/MapViewPlus/MapView.qml b/MapViewPlus/MapView.qml index c46e71b..88a0e75 100644 --- a/MapViewPlus/MapView.qml +++ b/MapViewPlus/MapView.qml @@ -82,12 +82,6 @@ Item { name: "ArcGIS.mapping.mapTypes.mapSources" value: internal.mapSources } - -// PluginParameter { -// id: pluginMaxZoomLevel -// name: "ArcGIS.mapping.maximumZoomLevel" -// value: exportDetails.maxLevels -// } } center: QtPositioning.coordinate(defaultCenter.lat,defaultCenter.long) @@ -103,14 +97,12 @@ Item { } gesture.onFlickStarted: { - console.log('flick started'); } + gesture.onPinchStarted: { - console.log('pinch started'); } Component.onCompleted: { - clearData(); } onZoomLevelChanged: { diff --git a/MapViewPlus/MapViewPlus.qml b/MapViewPlus/MapViewPlus.qml index 06cd8a2..8c9574f 100644 --- a/MapViewPlus/MapViewPlus.qml +++ b/MapViewPlus/MapViewPlus.qml @@ -1218,7 +1218,7 @@ Item { anchors.fill: parent defaultCenter: mapDefaultCenter defaultZoomLevel: mapDefaultZoomLevel - mapService: mapTileService + mapService: mapTileService !== null ? mapTileService : "" useToken: mapTileServiceUsesToken z: 50000 focus: !drawing From 35998480263a90395cb5ac0beebe1d0032c69165 Mon Sep 17 00:00:00 2001 From: Jayson Ward Date: Mon, 25 Jun 2018 11:19:48 +1000 Subject: [PATCH 2/3] #77 Moved clearData and basemap assignment to separate stackview statuses --- ExportView.qml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/ExportView.qml b/ExportView.qml index ce7af90..b7885a4 100644 --- a/ExportView.qml +++ b/ExportView.qml @@ -86,10 +86,17 @@ Item { mainView.appToolBar.historyButtonEnabled = true; mainView.appToolBar.settingsButtonEnabled = false; mainView.appToolBar.toolBarTitleLabel = Singletons.Strings.createNewTilePackage; + } + + StackView.onActivated: { mapViewPlus.mapTileService = currentTileService.url; mapViewPlus.mapTileServiceUsesToken = currentTileService.useTokenToAccess; } + StackView.onDeactivating: { + mapViewPlus.map.clearData(); + } + //-------------------------------------------------------------------------- onExportingChanged: { @@ -442,9 +449,9 @@ Item { tpkTitle: exportView.extractDefaultTPKTitle(exportView.currentTileService.title) onChangeTileService: { - if (mapViewPlus.map !== null) { - mapViewPlus.map.clearData(); - } +// if (mapViewPlus.map !== null) { +// mapViewPlus.map.clearData(); +// } exportView.currentTileIndex = index; exportView.currentTileService = availableServices.get(index); mapViewPlus.mapTileService = exportView.currentTileService.url; From 4cac78ea7718507be1d52396720256f6a7eb793a Mon Sep 17 00:00:00 2001 From: Jayson Ward Date: Tue, 26 Jun 2018 11:16:31 +1000 Subject: [PATCH 3/3] #77 Added better error handling when services fail to return tiles --- ExportView.qml | 29 ++++++++++++++++++++++------- HistoryView.qml | 37 ++++--------------------------------- MapViewPlus/MapViewPlus.qml | 8 ++++++++ 3 files changed, 34 insertions(+), 40 deletions(-) diff --git a/ExportView.qml b/ExportView.qml index b7885a4..c72df1c 100644 --- a/ExportView.qml +++ b/ExportView.qml @@ -94,7 +94,7 @@ Item { } StackView.onDeactivating: { - mapViewPlus.map.clearData(); + mapViewPlus.mapClearData(); } //-------------------------------------------------------------------------- @@ -149,7 +149,7 @@ Item { // MAP SECTION ///////////////////////////////////////////////// Rectangle { - color: "#fff" + color:"#fff" Layout.fillWidth: true Layout.fillHeight: true @@ -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)); @@ -199,6 +198,9 @@ Item { } onDrawingStarted: { + if (!map.mapReady){ + return; + } } onDrawingFinished: { @@ -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 //////////////////////////////////////// @@ -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; diff --git a/HistoryView.qml b/HistoryView.qml index 91e47c3..3c7da6d 100644 --- a/HistoryView.qml +++ b/HistoryView.qml @@ -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(); } //-------------------------------------------------------------------------- @@ -56,6 +49,10 @@ Item { mainView.appToolBar.backButtonVisible = true; mainView.appToolBar.toolBarTitleLabel = Singletons.Strings.exportAndUploadHistory; } + StackView.onActivated: { + getExportHistory(); + getUploadHistory(); + } // UI ////////////////////////////////////////////////////////////////////// @@ -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 diff --git a/MapViewPlus/MapViewPlus.qml b/MapViewPlus/MapViewPlus.qml index 8c9574f..d25d91e 100644 --- a/MapViewPlus/MapViewPlus.qml +++ b/MapViewPlus/MapViewPlus.qml @@ -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 ///////////////////////////////////////////////////////////////////// }