Hi Francisco,
here below the answer from Juned, one of our high expert Engineers, he has given two possibilities: one with extending the solution, so using Spectrum Spatial Extensibility, the other one is changing the css file. Juned has also explained the pros and contros of those choices.
Juned: "
Currently, we give the extensible developer the option to hide the vector legend as a whole through the 'doNotCreateLegend' option which extensible developer can set while creating a vector layer.
With this option, the whole legend of the vector layer gets hidden but here the requirement is hiding only a section of the vector legend for which there is no such option currently available.
However, we have some workarounds one through the extensibility and the other through branding to achieve it and are explained below :
Workaround with extensiblity :
this.store.select(fromRoot.legendGroups).subscribe(legendGroups => {
setTimeout(() => {
let vectorLegendStyleElem$;
if (document.querySelector('pb-vector-legend pb-tabs')) {
// To hide style section of vector legend
vectorLegendStyleElem$ = document.querySelector('pb-vector-legend pb-tabs');
} else if (document.querySelector('pb-vector-legend pb-cluster-style-form')) {
// To hide style section of cluster legend
vectorLegendStyleElem$ = document.querySelector('pb-vector-legend pb-cluster-style-form');
} else if (document.querySelector('pb-vector-legend pb-heat-style-form')) {
// To hide style section of heat map legend
vectorLegendStyleElem$ = document.querySelector('pb-vector-legend pb-heat-style-form');
}
if (vectorLegendStyleElem$) {
vectorLegendStyleElem$.style.display = 'none';
}
}, 500);
});
Note: The above code needs to be added in the extensible component after dispatching the AddVectorLayerAction
Workaround with branding:
Please add the below lines of css code in brand.css.
pb-vector-legend pb-tabs, pb-vector-legend pb-cluster-style-form, pb-vector-legend pb-heat-style-form {
display: none;
}
Comparison of the 2 workarounds :
The advantage of workaround with branding is that it is much simpler to use as just some css lines of code is required as compared to through the extensibility where quiet a few JavaScript code of lines and subscription etc. are required.
However, the advantage of workaround with extensibility is that it will only impact the vector layers created via extensibility and not on the internal vector layers created from 'Add files to map temporarily' feature of SSA whereas workaround with branding will impact vector legend created from both 'Extensibility' and internally from 'Add files to map temporarily' feature of SSA.
Note: Either of the workaround can be chosen with the pros and cons explained above in the comparison section"
Feel free to reach out directly to me or our support if you would get issues or have doubts.
kind regards,
Monica
------------------------------
Monica Di Martino
Precisely
Senior Sales Engineer, EMEA
monica.dimartino@precisely.com------------------------------
Original Message:
Sent: 08-11-2022 02:26
From: Francisco Rosas
Subject: Hide customization options from LegendContainer Layer created with openLayers
Hi, I`d like to hide the customization options from my layer created with openlayers
This is some of the code:
const vectorLayerData = {
name: 'heatMapLayer',
friendlyName: 'heatMap',
source: vectorSource,
style: {
polyStrokeWidth: 2.5,
polyStrokeColor: '#0C0C37',
fillPattern: 20
},
doNotCreateLegend: false,
};
this.store.dispatch(new AddVectorLayerAction(vectorLayerData));
Is there a value I have to set for doing this? I want to remove the elements in the picture.
Any help will be greatly appreciated
Thanks in advance!
------------------------------
Francisco Rosas
Knowledge Community Shared Account
------------------------------