fix: hide dwelling layer control
This commit is contained in:
@@ -520,7 +520,9 @@ async function loadLayers() {
|
|||||||
try {
|
try {
|
||||||
const capabilities = await loadCapabilities();
|
const capabilities = await loadCapabilities();
|
||||||
availableLayers = extractLayers(capabilities);
|
availableLayers = extractLayers(capabilities);
|
||||||
selectedLayers = availableLayers.map((layer) => layer.name);
|
selectedLayers = availableLayers
|
||||||
|
.filter((layer) => !isInternalLayer(layer.name))
|
||||||
|
.map((layer) => layer.name);
|
||||||
|
|
||||||
renderLayerList();
|
renderLayerList();
|
||||||
syncSelectedLayers();
|
syncSelectedLayers();
|
||||||
@@ -579,9 +581,10 @@ function extractLayers(xmlText) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function renderLayerList() {
|
function renderLayerList() {
|
||||||
els.layerCount.textContent = String(availableLayers.length);
|
const userVisibleLayers = availableLayers.filter((layer) => !isInternalLayer(layer.name));
|
||||||
|
els.layerCount.textContent = String(userVisibleLayers.length);
|
||||||
|
|
||||||
if (!availableLayers.length) {
|
if (!userVisibleLayers.length) {
|
||||||
els.layerList.className = "layer-list empty";
|
els.layerList.className = "layer-list empty";
|
||||||
els.layerList.textContent = "No published layers were returned by the service.";
|
els.layerList.textContent = "No published layers were returned by the service.";
|
||||||
return;
|
return;
|
||||||
@@ -590,7 +593,7 @@ function renderLayerList() {
|
|||||||
els.layerList.className = "layer-list";
|
els.layerList.className = "layer-list";
|
||||||
els.layerList.replaceChildren();
|
els.layerList.replaceChildren();
|
||||||
|
|
||||||
availableLayers.forEach((layer) => {
|
userVisibleLayers.forEach((layer) => {
|
||||||
const label = document.createElement("label");
|
const label = document.createElement("label");
|
||||||
label.className = "layer-item";
|
label.className = "layer-item";
|
||||||
|
|
||||||
@@ -631,6 +634,10 @@ function syncSelectedLayers() {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isInternalLayer(name) {
|
||||||
|
return unqualifiedLayerName(name) === unqualifiedLayerName(DWELLING_PARCEL_LAYER_NAME);
|
||||||
|
}
|
||||||
|
|
||||||
async function loadDwellingParcels() {
|
async function loadDwellingParcels() {
|
||||||
const publishedDwellingLayer = availableLayers.find(
|
const publishedDwellingLayer = availableLayers.find(
|
||||||
(layer) => unqualifiedLayerName(layer.name) === unqualifiedLayerName(DWELLING_PARCEL_LAYER_NAME),
|
(layer) => unqualifiedLayerName(layer.name) === unqualifiedLayerName(DWELLING_PARCEL_LAYER_NAME),
|
||||||
|
|||||||
Reference in New Issue
Block a user