-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #53 from 3dcitydb/kml-datasource
Add support for thematic data in KML documents
- Loading branch information
Showing
7 changed files
with
197 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
127 changes: 127 additions & 0 deletions
127
3dwebclient/utils/mashup-data-source-service/application/KMLDataSource.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,127 @@ | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = function (d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var KMLDataSource = /** @class */ (function (_super) { | ||
__extends(KMLDataSource, _super); | ||
function KMLDataSource(signInController, options) { | ||
return _super.call(this, signInController, options) || this; | ||
} | ||
KMLDataSource.prototype.responseToKvp = function (response) { | ||
if (this._thirdPartyHandler) { | ||
switch (this._thirdPartyHandler.type) { | ||
case ThirdPartyHandler.Cesium: { | ||
// the handler is Cesium.KMLDataSource | ||
return this.responseCesiumToKvp(response); | ||
break; | ||
} | ||
default: { | ||
// no valid handler found | ||
return this.responseOwnToKvp(response); | ||
break; | ||
} | ||
} | ||
} | ||
}; | ||
KMLDataSource.prototype.responseCesiumToKvp = function (response) { | ||
// response is already in JSON | ||
// only support Data https://cesium.com/docs/cesiumjs-ref-doc/KmlFeatureData.html | ||
var result = new Map(); | ||
/* <Data name=""> | ||
<displayName></displayName> | ||
<value></value> | ||
</Data | ||
*/ | ||
for (var key in response) { | ||
// if no displayName is available -> use attribute name instead | ||
if (response[key] && response[key].displayName) { | ||
result[response[key].displayName] = response[key].value; | ||
} | ||
else { | ||
result[key] = response[key].value; | ||
} | ||
} | ||
return result; | ||
}; | ||
KMLDataSource.prototype.responseOwnToKvp = function (response) { | ||
// TODO | ||
return null; | ||
}; | ||
KMLDataSource.prototype.countFromResult = function (res) { | ||
return res.getSize(); | ||
}; | ||
KMLDataSource.prototype.deleteDataRecordUsingId = function (id) { | ||
// TODO | ||
return null; | ||
}; | ||
KMLDataSource.prototype.fetchIdsFromResult = function (res) { | ||
// TODO | ||
return null; | ||
}; | ||
KMLDataSource.prototype.insertDataRecord = function (record) { | ||
// TODO | ||
return null; | ||
}; | ||
KMLDataSource.prototype.queryUsingIds = function (ids) { | ||
// TODO | ||
return null; | ||
}; | ||
KMLDataSource.prototype.queryUsingNames = function (names, limit) { | ||
// TODO | ||
return null; | ||
}; | ||
KMLDataSource.prototype.queryUsingId = function (id, callback, limit) { | ||
if (this._thirdPartyHandler) { | ||
// prioritize the implementation of the provided 3rd-party handler | ||
switch (this._thirdPartyHandler.type) { | ||
case ThirdPartyHandler.Cesium: { | ||
// the handler is Cesium.KMLDataSource | ||
var entities = this._thirdPartyHandler.handler.entities; | ||
var entity = entities.getById(id); | ||
// entity is Cesium.KMLFeatureData | ||
callback(entity.kml.extendedData); | ||
break; | ||
} | ||
default: { | ||
// no valid handler found | ||
callback(null); | ||
break; | ||
} | ||
} | ||
} | ||
else { | ||
// using own implementation | ||
// TODO | ||
} | ||
}; | ||
KMLDataSource.prototype.queryUsingSql = function (sql, callback, limit) { | ||
// TODO | ||
return; | ||
}; | ||
KMLDataSource.prototype.queryUsingTypes = function (types, limit) { | ||
// TODO | ||
return null; | ||
}; | ||
KMLDataSource.prototype.sumFromResultByColIndex = function (res, colIndex) { | ||
// TODO | ||
return null; | ||
}; | ||
KMLDataSource.prototype.sumFromResultByName = function (res, name) { | ||
// TODO | ||
return null; | ||
}; | ||
KMLDataSource.prototype.updateDataRecordUsingId = function (id, newRecord) { | ||
// TODO | ||
return null; | ||
}; | ||
return KMLDataSource; | ||
}(XMLDataSource)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 20 additions & 0 deletions
20
3dwebclient/utils/mashup-data-source-service/core/XMLDataSource.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
var __extends = (this && this.__extends) || (function () { | ||
var extendStatics = function (d, b) { | ||
extendStatics = Object.setPrototypeOf || | ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || | ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; | ||
return extendStatics(d, b); | ||
}; | ||
return function (d, b) { | ||
extendStatics(d, b); | ||
function __() { this.constructor = d; } | ||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | ||
}; | ||
})(); | ||
var XMLDataSource = /** @class */ (function (_super) { | ||
__extends(XMLDataSource, _super); | ||
function XMLDataSource(signInController, options) { | ||
return _super.call(this, signInController, options) || this; | ||
} | ||
return XMLDataSource; | ||
}(DataSource)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters