Skip to content

Commit

Permalink
Merge pull request #125 from DavidLevinsky/master
Browse files Browse the repository at this point in the history
Fixed vswitch
  • Loading branch information
davidmtech authored Dec 17, 2018
2 parents 723e361 + 3b149e6 commit 7acef85
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 4 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.16.7",
"version": "2.16.8",
"description": "JavaScript WebGL 3D maps rendering engine",
"main": "src/browser/index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/core/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ string getCoreVersion()
*/

function getCoreVersion(full) {
return (full ? 'Core: ' : '') + '2.16.7';
return (full ? 'Core: ' : '') + '2.16.8';
}


Expand Down
6 changes: 4 additions & 2 deletions src/core/map/geodata-processor/worker-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,10 @@ function processLayerFeature(type, feature, lod, layer, featureIndex, skipPack)

var vswitch = layer['visibility-switch'];
for (var i = 0, li = vswitch.length; i <li; i++) {
var slayer = getLayer(vswitch[i][1], type, featureIndex);
processLayerFeature(type, feature, lod, slayer, featureIndex);
if (vswitch[i][1]) {
var slayer = getLayer(vswitch[i][1], type, featureIndex);
processLayerFeature(type, feature, lod, slayer, featureIndex);
}
postGroupMessage({'command':'addRenderJob', 'type':'vswitch-store', 'viewExtent': vswitch[i][0]});
}

Expand Down
45 changes: 45 additions & 0 deletions src/core/map/geodata-processor/worker-style.js
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,16 @@ var validateValue = function(layerId, key, value, type, arrayLength, min, max) {

logError('wrong-property-value[]', layerId, key, value, i);
return getDefaultLayerPropertyValue(key);
} else {
//fast constant
if (typeof valueItem[1] == 'string' && valueItem[1].charAt(0) == '@') {
if (typeof globals.stylesheetConstants[valueItem[1]] == 'undefined') {
logError('wrong-property-value[]', layerId, key, value, i);
return getDefaultLayerPropertyValue(key);
} else {
valueItem[1] = globals.stylesheetConstants[valueItem[1]];
}
}
}
}

Expand Down Expand Up @@ -1278,6 +1288,41 @@ var processLayer = function(layerId, layerData, stylesheetLayersData) {
}
}
}

//copy constats to vswitch
if (key == 'visibility-switch') {
if (Array.isArray(value) && value.length > 0) {
for (var i = 0, li = value.length; i < li; i++) {
var valueItem = value[i];
var wrong = false;

if (!(typeof valueItem == 'object' && Array.isArray(valueItem) && valueItem.length == 2)) {
wrong = true;
} else {
if (typeof valueItem[0] == 'string' && valueItem[0].charAt(0) == '@') {
if (typeof globals.stylesheetConstants[valueItem[0]] == 'undefined') {
wrong = true;
} else {
valueItem[0] = globals.stylesheetConstants[valueItem[0]];
}
}

if (!(typeof valueItem[0] == 'number' && (typeof valueItem[1] == 'string' || valueItem[1] === null))) {
wrong = true;
}
}

if (wrong) {
logError('wrong-property-value[]', layerId, key, value, i);
}
}

} else {
logError('wrong-property-value', layerId, key, value);
return getDefaultLayerPropertyValue(key);
}
}

}

return layer;
Expand Down

0 comments on commit 7acef85

Please sign in to comment.