Ripping out old culling system
This commit is contained in:
1 parent
67aef402e3
commit
9c3ac204ed
1 file changed
+17
-36
@@ -20,14 +20,16 @@ const signSize = {
|
|||||||
min: 0.05,
|
min: 0.05,
|
||||||
max: 2.4
|
max: 2.4
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const scaleCullBaseDistance = 500;
|
||||||
const scaleCullThresholds = [
|
const scaleCullThresholds = [
|
||||||
{scale:1, distance:500},
|
{scale:1},
|
||||||
{scale:1.25, distance:200},
|
{scale:2},
|
||||||
{scale:1.5, distance:130},
|
{scale:3},
|
||||||
{scale:2.5, distance:80},
|
{scale:6},
|
||||||
{scale:5, distance:40},
|
{scale:12},
|
||||||
{scale:20, distance:20},
|
{scale:24},
|
||||||
{scale:60, distance:10},
|
{scale:60},
|
||||||
];
|
];
|
||||||
|
|
||||||
// CODE
|
// CODE
|
||||||
@@ -272,40 +274,25 @@ function sortTracks(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Hide extraneous signage, reducing clutter. */
|
/** Assign signage to cull at certain zoom levels, reducing clutter and lag. */
|
||||||
function cleanMarkers(){
|
function cleanMarkers(){
|
||||||
let roughDist = 0;
|
let roughDist = 0;
|
||||||
for(let i=0; i<markers.length; i++){
|
for(let i=0; i<markers.length; i++){
|
||||||
markers[i].crowdingScore = 0;
|
markers[i].nearestDistance = Infinity;
|
||||||
markers[i].nearestDist = 100000;
|
|
||||||
for(let j=0; j<markers.length; j++){
|
for(let j=0; j<markers.length; j++){
|
||||||
if(i != j && markers[i].type == markers[j].type){
|
if(i != j && markers[i].type == markers[j].type){
|
||||||
roughDist = Vector.roughDistance(markers[i].position, markers[j].position);
|
roughDist = Vector.roughDistance(markers[i].position, markers[j].position);
|
||||||
markers[i].crowdingScore += 1/roughDist;
|
if(markers[i].nearestDistance > roughDist){
|
||||||
if(roughDist < markers[i].nearestDist){
|
markers[i].nearestDistance = roughDist;
|
||||||
markers[i].nearestDist = roughDist;
|
markers[i].nearestMarker = markers[j];
|
||||||
markers[i].nearest = markers[j];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//let randomZoomThreshold = Utils.randomRange(1, 5);
|
markers[i].cullLevel = 3;
|
||||||
//if(randomZoomThreshold < 4) markers[i].skip = true;
|
for(let cullIndex=0; cullIndex<scaleCullThresholds.length; cullIndex++){
|
||||||
/*
|
|
||||||
for(let j=0; j<markers.length; j++){
|
|
||||||
if(i != j && !markers[j].skip && markers[i].type == markers[j].type){
|
|
||||||
|
|
||||||
if(Vector.isWithinAARange(markers[i].position, markers[j].position, 120)){
|
|
||||||
if(markers[i].type == 'grade'){
|
|
||||||
if(Math.abs(markers[j].value) > Math.abs(markers[i].value)) markers[i].skip = true;
|
|
||||||
else markers[j].skip = true;
|
|
||||||
}else if(markers[i].type == 'speed'){
|
|
||||||
if(markers[j].value > markers[i].value) markers[j].skip = true;
|
|
||||||
else markers[i].skip = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Create the signage */
|
/** Create the signage */
|
||||||
@@ -345,12 +332,6 @@ function drawMarkers(){
|
|||||||
speedSigns.appendChild(marker);
|
speedSigns.appendChild(marker);
|
||||||
}
|
}
|
||||||
|
|
||||||
for(let i=scaleCullThresholds.length-1; i>= 0; i--){
|
if(markerData.cullLevel) marker.classList.add(`cullThreshold_${markerData.cullLevel}`);
|
||||||
if(markerData.nearestDist < scaleCullThresholds[i].distance || i==0){
|
|
||||||
title.innerHTML += `\n${markerData.nearestDist}`;
|
|
||||||
marker.classList.add(`cullThreshold_${i}`);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user