Skip to content

Commit

Permalink
Merge pull request #132 from DavidLevinsky/master
Browse files Browse the repository at this point in the history
Fixed geodata processing bug
  • Loading branch information
davidmtech authored Jan 14, 2019
2 parents 2d43629 + 4917da5 commit b32d21a
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vts-browser-js",
"version": "2.17.3",
"version": "2.17.4",
"description": "JavaScript WebGL 3D maps rendering engine",
"main": "src/browser/index.js",
"scripts": {
Expand Down
3 changes: 2 additions & 1 deletion src/core/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ var Core = function(element, config, coreInterface) {
mapMaxHiresLodLevels : 2,
mapDownloadThreads : 20,
mapMaxProcessingTime : 1000*20,
mapMaxGeodataProcessingTime : 10,
mapMobileMode : false,
mapMobileModeAutodect : true,
mapMobileDetailDegradation : 1,
Expand Down Expand Up @@ -542,7 +543,7 @@ string getCoreVersion()
*/

function getCoreVersion(full) {
return (full ? 'Core: ' : '') + '2.17.3';
return (full ? 'Core: ' : '') + '2.17.4';
}


Expand Down
9 changes: 7 additions & 2 deletions src/core/map/geodata-processor/worker-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ function optimizeGroupMessages() {

if (message2.signature == signature) {
message2.reduced = true;
globals.messagePackSize -= message2.job.byteLength;
count++;

//get message2 vertices length
Expand Down Expand Up @@ -226,8 +227,12 @@ function optimizeGroupMessages() {
var buffer = new Uint8Array(globals.messagePackSize), index = 0;

for (var i = 0, li = globals.messageBufferIndex; i < li; i++) {
buffer.set(new Uint8Array(globals.messageBuffer[i].job), index);
index += globals.messageBuffer[i].job.byteLength;
var message = globals.messageBuffer[i];

if (!message.reduced) {
buffer.set(new Uint8Array(message.job), index);
index += globals.messageBuffer[i].job.byteLength;
}
}

//console.log('send:' + buffer.length);
Expand Down
3 changes: 2 additions & 1 deletion src/core/map/geodata-view.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ MapGeodataView.prototype.killGeodataView = function(killedByCache) {
MapGeodataView.prototype.processPackedCommands = function(buffer, index) {

var maxIndex = buffer.byteLength;
var maxTime = this.map.config.mapMaxGeodataProcessingTime;
var t = performance.now(), length, str, data;
var view = new DataView(buffer.buffer);

Expand Down Expand Up @@ -118,7 +119,7 @@ MapGeodataView.prototype.processPackedCommands = function(buffer, index) {
break;
}

if ((performance.now() - t) > 10) {
if ((performance.now() - t) > maxTime) {
return index;
}

Expand Down
2 changes: 2 additions & 0 deletions src/core/map/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,7 @@ Map.prototype.setConfigParam = function(key, value) {
case 'mapTexelSizeFit': this.config.mapTexelSizeFit = utils.validateNumber(value, 0.0001, Number.MAXINTEGER, 1.1); break;
case 'mapDownloadThreads': this.config.mapDownloadThreads = utils.validateNumber(value, 1, Number.MAXINTEGER, 6); break;
case 'mapMaxProcessingTime': this.config.mapMaxProcessingTime = utils.validateNumber(value, 1, Number.MAXINTEGER, 1000/20); break;
case 'mapMaxGeodataProcessingTime': this.config.mapMaxGeodataProcessingTime = utils.validateNumber(value, 1, Number.MAXINTEGER, 10); break;
case 'mapMobileMode': this.config.mapMobileMode = utils.validateBool(value, false); this.setupMobileMode(); break;
case 'mapMobileModeAutodect': this.config.mapMobileModeAutodect = utils.validateBool(value, false); break;
case 'mapMobileDetailDegradation': this.config.mapMobileDetailDegradation = utils.validateNumber(value, 1, Number.MAXINTEGER, 2); break;
Expand Down Expand Up @@ -853,6 +854,7 @@ Map.prototype.getConfigParam = function(key) {
case 'mapTexelSizeFit': return this.config.mapTexelSizeFit;
case 'mapDownloadThreads': return this.config.mapDownloadThreads;
case 'mapMaxProcessingTime': return this.config.mapMaxProcessingTime;
case 'mapMaxGeodataProcessingTime': return this.config.mapMaxGeodataProcessingTime;
case 'mapMobileMode': return this.config.mapMobileMode;
case 'mapMobileModeAutodect': return this.config.mapMobileModeAutodect;
case 'mapMobileDetailDegradation': return this.config.mapMobileDetailDegradation;
Expand Down

0 comments on commit b32d21a

Please sign in to comment.