我正在 QML 中完成一項任務,在沒有 Internet 連接的地區作業的調查人員可以在他們的辦公室離線使用調查要素的地理資料庫,進行編輯并向現場的離線地理資料庫添加新要素,并同步回傳辦公室后更新在線功能服務。
在專案中,用戶可以平移和縮放以定位他想要離線的區域周圍的紅色矩形。單擊“生成地理資料庫”以使該區域脫機。完成后,地圖將更新為僅顯示離線區域。要編輯要素,請單擊以選擇一個要素,然后再次單擊地圖上的任何其他位置以將所選要素移動到單擊的位置。要將編輯與要素服務同步,請單擊“同步地理資料庫”按鈕。
對我來說,我成功地完成了這項作業,但在同步之前我無法驗證資料。我正在共享我進行資料驗證的代碼段。有什么幫助嗎?
// create the GeodatabaseSyncTask to generate the local geodatabase
GeodatabaseSyncTask {
id: geodatabaseSyncTask
url: featureServiceUrl
property var generateJob
property var syncJob
function executeGenerate() {
// execute the asynchronous task and obtain the job
generateJob = generateGeodatabase(generateParameters, outputGdb);
syncWindow.visible = true;
statusText = "Generate failed";
syncWindow.hideWindow(5000);
}
uj5u.com熱心網友回復:
您將使用如下條件陳述句來驗證您的資料。
GeodatabaseSyncTask {
id: geodatabaseSyncTask
url: featureServiceUrl
property var generateJob
property var syncJob
function executeGenerate() {
// execute the asynchronous task and obtain the job
generateJob = generateGeodatabase(generateParameters, outputGdb);
// check if the job is valid
if (generateJob) {
// show the sync window
syncWindow.visible = true;
// connect to the job's status changed signal to know once it is done
generateJob.jobStatusChanged.connect(updateGenerateJobStatus);
// start the job
generateJob.start();
} else {
// a valid job was not obtained, so show an error
syncWindow.visible = true;
statusText = "Generate failed";
syncWindow.hideWindow(5000);
}
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/337949.html
