allow hiding unclassified, tracks
This commit is contained in:
+18
-3
@@ -123,10 +123,13 @@ function countyStyle(feature) {
|
|||||||
// Filter function for OSM features
|
// Filter function for OSM features
|
||||||
function shouldShowOsmFeature(feature) {
|
function shouldShowOsmFeature(feature) {
|
||||||
const props = feature.properties || {};
|
const props = feature.properties || {};
|
||||||
const isService = props.highway === 'service';
|
const isService = props.highway === 'service' || props.highway === 'track';
|
||||||
|
const isUnclassified = props.highway === 'unclassified';
|
||||||
const hideService = document.getElementById('hideService').checked;
|
const hideService = document.getElementById('hideService').checked;
|
||||||
|
const hideUnclassified = document.getElementById('hideUnclassified').checked;
|
||||||
|
|
||||||
if (isService && hideService) return false;
|
if (isService && hideService) return false;
|
||||||
|
if (isUnclassified && hideUnclassified) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -172,11 +175,13 @@ function createOsmLayer() {
|
|||||||
function shouldShowFeature(feature) {
|
function shouldShowFeature(feature) {
|
||||||
const props = feature.properties || {};
|
const props = feature.properties || {};
|
||||||
const isRemoved = props.removed === true || props.removed === 'True';
|
const isRemoved = props.removed === true || props.removed === 'True';
|
||||||
const isService = props.highway === 'service';
|
const isService = props.highway === 'service' || props.highway === 'track';
|
||||||
|
const isUnclassified = props.highway === 'unclassified';
|
||||||
|
|
||||||
const showAdded = document.getElementById('showAdded').checked;
|
const showAdded = document.getElementById('showAdded').checked;
|
||||||
const showRemoved = document.getElementById('showRemoved').checked;
|
const showRemoved = document.getElementById('showRemoved').checked;
|
||||||
const hideService = document.getElementById('hideService').checked;
|
const hideService = document.getElementById('hideService').checked;
|
||||||
|
const hideUnclassified = document.getElementById('hideUnclassified').checked;
|
||||||
|
|
||||||
// Check removed/added filter
|
// Check removed/added filter
|
||||||
if (isRemoved && !showRemoved) return false;
|
if (isRemoved && !showRemoved) return false;
|
||||||
@@ -184,6 +189,7 @@ function shouldShowFeature(feature) {
|
|||||||
|
|
||||||
// Check service filter
|
// Check service filter
|
||||||
if (isService && hideService) return false;
|
if (isService && hideService) return false;
|
||||||
|
if (isUnclassified && hideUnclassified) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -229,10 +235,13 @@ function createDiffLayer() {
|
|||||||
// Filter function for county features
|
// Filter function for county features
|
||||||
function shouldShowCountyFeature(feature) {
|
function shouldShowCountyFeature(feature) {
|
||||||
const props = feature.properties || {};
|
const props = feature.properties || {};
|
||||||
const isService = props.highway === 'service';
|
const isService = props.highway === 'service' || props.highway === 'track';
|
||||||
|
const isUnclassified = props.highway === 'unclassified';
|
||||||
const hideService = document.getElementById('hideService').checked;
|
const hideService = document.getElementById('hideService').checked;
|
||||||
|
const hideUnclassified = document.getElementById('hideUnclassified').checked;
|
||||||
|
|
||||||
if (isService && hideService) return false;
|
if (isService && hideService) return false;
|
||||||
|
if (isUnclassified && hideUnclassified) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -617,6 +626,12 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
createCountyLayer();
|
createCountyLayer();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document.getElementById('hideUnclassified').addEventListener('change', function() {
|
||||||
|
createDiffLayer();
|
||||||
|
createOsmLayer();
|
||||||
|
createCountyLayer();
|
||||||
|
});
|
||||||
|
|
||||||
// Load button
|
// Load button
|
||||||
document.getElementById('loadButton').addEventListener('click', loadFiles);
|
document.getElementById('loadButton').addEventListener('click', loadFiles);
|
||||||
|
|
||||||
|
|||||||
+5
-1
@@ -178,7 +178,11 @@
|
|||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" id="hideService">
|
<input type="checkbox" id="hideService">
|
||||||
Hide highway=service
|
Hide highway=service/track
|
||||||
|
</label>
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" id="hideUnclassified">
|
||||||
|
Hide highway=unclassified
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
<h3 style="margin-top: 15px;">Load Files</h3>
|
<h3 style="margin-top: 15px;">Load Files</h3>
|
||||||
|
|||||||
Reference in New Issue
Block a user