Skip to content

Commit

Permalink
fixed search path, more robust height coding
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmtech committed Mar 26, 2020
1 parent 4182a1f commit fea303b
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 67 deletions.
3 changes: 2 additions & 1 deletion src/browser/ui/control/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ var UIControlSearch = function(ui, visible, visibleLock) {

//old template '//cdn.melown.com/vtsapi/geocode?q={value}&format=json&lang=en-US&addressdetails=1&limit=20';
//this.urlTemplate = '//cdn.melown.com/vtsapi/geocode/v3.0/{lat}/{long}/{value}';
this.urlTemplate = '//node.windy.com/search/v3.0/{lat}/{long}/{value}';
//this.urlTemplate = '//node.windy.com/search/v3.0/{lat}/{long}/{value}';
this.urlTemplate = '//cdn.melown.com/vtsapi/geocode/v3.0/{lat}/{long}/{value}';
this.urlTemplate2 = this.urlTemplate;
this.data = [];
this.lastSearch = '';
Expand Down
2 changes: 1 addition & 1 deletion src/core/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ string getCoreVersion()
*/

function getCoreVersion(full) {
return (full ? 'Core: ' : '') + '2.22.6';
return (full ? 'Core: ' : '') + '2.22.7';
}


Expand Down
133 changes: 68 additions & 65 deletions src/core/map/geodata-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -1446,95 +1446,98 @@ MapGeodataBuilder.prototype.processHeights = function(heightsSource, precision,
//var item = this.heightsProcessBuffer, lastItem;
var p, res, nodeOnly, heightsLod, nodeOnly, coords, noSource;

switch (heightsSource) {
case "node-by-precision":
nodeOnly = true;
case "heightmap-by-precision":
if (item) {

coords = item.coords;
switch (heightsSource) {
case "node-by-precision":
nodeOnly = true;
case "heightmap-by-precision":

if (coords[3].srs) {
p = this.navSrs.convertCoordsFrom(coords, coords[3].srs);
} else {
p = coords;
}
coords = item.coords;

heightsLod = this.map.measure.getOptimalHeightLodBySampleSize(p, precision);
break;
if (coords[3].srs) {
p = this.navSrs.convertCoordsFrom(coords, coords[3].srs);
} else {
p = coords;
}

case "node-by-lod":
nodeOnly = true;
precision -= 8;
case "heightmap-by-lod":
heightsLod = precision;
break;
case "none":
noSource = true;
break;
}
heightsLod = this.map.measure.getOptimalHeightLodBySampleSize(p, precision);
break;

case "node-by-lod":
nodeOnly = true;
precision -= 8;
case "heightmap-by-lod":
heightsLod = precision;
break;
case "none":
noSource = true;
break;
}

do {
coords = item.coords;
do {
coords = item.coords;

if (!noSource && coords[4] == null) {
if (coords[3].srs) {
p = this.navSrs.convertCoordsFrom(coords, coords[3].srs);
} else {
p = coords;
}
if (!noSource && coords[4] == null) {
if (coords[3].srs) {
p = this.navSrs.convertCoordsFrom(coords, coords[3].srs);
} else {
p = coords;
}

res = this.map.measure.getSpatialDivisionNode(p);
res = this.map.measure.getSpatialDivisionNode(p);

coords[4] = res[0];
coords[5] = res[1];
coords[4] = res[0];
coords[5] = res[1];

//coords[4] = p;
}
//coords[4] = p;
}


if (noSource) {
res = [0,true,true];
} else {
res = this.map.measure.getSurfaceHeight(coords, heightsLod, null, coords[4], coords[5], null, nodeOnly);
}
if (noSource) {
res = [0,true,true];
} else {
res = this.map.measure.getSurfaceHeight(coords, heightsLod, null, coords[4], coords[5], null, nodeOnly);
}

//res = this.map.measure.getSurfaceHeight(coords[4], heightsLod, null, null, null, null, nodeOnly);
//res = this.map.measure.getSurfaceHeight(coords[4], heightsLod, null, null, null, null, nodeOnly);

//console.log(JSON.stringify(res));
//console.log(JSON.stringify(res));

//if (res[1] || res[2]) { //precisin reached or not aviable
//res = this.map.measure.getSurfaceHeight(coords[4], heightsLod, null, null, null, null, nodeOnly);
//res = this.map.measure.getSurfaceHeight(coords, heightsLod, null, coords[4], coords[5], null, nodeOnly);
//}
//if (res[1] || res[2]) { //precisin reached or not aviable
//res = this.map.measure.getSurfaceHeight(coords[4], heightsLod, null, null, null, null, nodeOnly);
//res = this.map.measure.getSurfaceHeight(coords, heightsLod, null, coords[4], coords[5], null, nodeOnly);
//}

if (res[1] || res[2]) { //precision reached or not aviable
if (res[1] || res[2]) { //precision reached or not aviable

//console.log(JSON.stringify(res));
//console.log(JSON.stringify(res));

coords[2] += res[0]; //convet float height to fixed
this.removeFromHeightsBuffer(item, lastItem);
coords[3].heightsToProcess--;
this.heightsToProcess--;
coords[2] += res[0]; //convet float height to fixed
this.removeFromHeightsBuffer(item, lastItem);
coords[3].heightsToProcess--;
this.heightsToProcess--;

if (coords[3].heightsToProcess <= 0) { //this prevents multiple conversions
coords[3].floatHeights = false;
}
if (coords[3].heightsToProcess <= 0) { //this prevents multiple conversions
coords[3].floatHeights = false;
}

p = [coords[0], coords[1], coords[2]];
p = [coords[0], coords[1], coords[2]];

//console.log(JSON.stringify(p) + " srs " + coords[3].srs);
//console.log(JSON.stringify(p) + " srs " + coords[3].srs);

p = this.physSrs.convertCoordsFrom(p, coords[3].srs);
p = this.physSrs.convertCoordsFrom(p, coords[3].srs);

coords[0] = p[0];
coords[1] = p[1];
coords[2] = p[2];
}
coords[0] = p[0];
coords[1] = p[1];
coords[2] = p[2];
}

lastItem = item;
item = item.next;
lastItem = item;
item = item.next;

} while(item);
} while(item);
}

if (this.heightsToProcess <= 0) {
if (this.updateCallback) {
Expand Down

0 comments on commit fea303b

Please sign in to comment.