Skip to content

Commit

Permalink
Fix querying data sources from multiple layers
Browse files Browse the repository at this point in the history
  • Loading branch information
Son-HNguyen authored and Son-HNguyen committed Dec 17, 2019
1 parent cd8d8e1 commit 69fce7b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 6 deletions.
12 changes: 6 additions & 6 deletions 3dwebclient/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ function zoomToObjectById(gmlId, callBackFunc, errorCallbackFunc) {
} else {
// TODO
var thematicDataUrl = webMap.activeLayer.thematicDataUrl;
dataSourceController.fetchData(gmlId, function (result) {
webmap._activeLayer.dataSourceController.fetchData(gmlId, function (result) {
if (!result) {
if (Cesium.defined(errorCallbackFunc)) {
errorCallbackFunc.call(this);
Expand Down Expand Up @@ -1170,7 +1170,7 @@ function createInfoTable(gmlid, cesiumEntity, citydbLayer) {
var thematicDataUrl = citydbLayer.thematicDataUrl;
cesiumEntity.description = "Loading feature information...";

dataSourceController.fetchData(gmlid, function (kvp) {
citydbLayer.dataSourceController.fetchData(gmlid, function (kvp) {
if (!kvp) {
cesiumEntity.description = 'No feature information found';
} else {
Expand Down Expand Up @@ -1347,11 +1347,11 @@ function thematicDataSourceAndTableTypeDropdownOnchange() {
// apiKey: addLayerViewModel.googleSheetsApiKey,
// clientId: addLayerViewModel.googleSheetsClientId
};
dataSourceController = new DataSourceController(selectedThematicDataSource, options);
// Mashup Data Source Service
if (webMap && webMap._activeLayer) {
webMap._activeLayer.dataSourceController = new DataSourceController(selectedThematicDataSource, options);
}
}

// Mobile layouts and functionalities
var mobileController = new MobileController();

// Mashup Data Source Service
var dataSourceController;
13 changes: 13 additions & 0 deletions js/Cesium3DTilesDataLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@
this._cameraPosition = {};
this._thematicDataUrl = Cesium.defaultValue(options.thematicDataUrl, "");
this._thematicDataSource = Cesium.defaultValue(options.thematicDataSource, "");
var dataSourceControllerOptions = {};
dataSourceControllerOptions.uri = this._thematicDataUrl;
dataSourceControllerOptions.tableType = this._tableType;
this._dataSourceController = new DataSourceController(this._thematicDataSource, dataSourceControllerOptions);
this._tableType = Cesium.defaultValue(options.tableType, "");
this._cityobjectsJsonUrl = options.cityobjectsJsonUrl;
this._thematicDataProvider = Cesium.defaultValue(options.thematicDataProvider, "");
Expand Down Expand Up @@ -190,6 +194,15 @@
}
},

dataSourceController: {
get: function () {
return this._dataSourceController;
},
set: function (value) {
this._dataSourceController = value;
}
},

tableType: {
get: function () {
return this._tableType;
Expand Down
13 changes: 13 additions & 0 deletions js/CitydbKmlLayer.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,10 @@
this._thematicDataUrl = Cesium.defaultValue(options.thematicDataUrl, "");
this._thematicDataSource = Cesium.defaultValue(options.thematicDataSource, "");
this._tableType = Cesium.defaultValue(options.tableType, "");
var dataSourceControllerOptions = {};
dataSourceControllerOptions.uri = this._thematicDataUrl;
dataSourceControllerOptions.tableType = this._tableType;
this._dataSourceController = new DataSourceController(this._thematicDataSource, dataSourceControllerOptions);
this._thematicDataProvider = Cesium.defaultValue(options.thematicDataProvider, "");
this._cityobjectsJsonUrl = options.cityobjectsJsonUrl;
this._cityobjectsJsonData = new Object();
Expand Down Expand Up @@ -186,6 +190,15 @@
}
},

dataSourceController: {
get: function () {
return this._dataSourceController;
},
set: function (value) {
this._dataSourceController = value;
}
},

tableType: {
get: function () {
return this._tableType;
Expand Down

0 comments on commit 69fce7b

Please sign in to comment.