Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
getOptionsFromMap = () => {
const {
map,
resolutionsFilter
} = this.props;
if (!_isEmpty(this.state.scales)) {
Logger.debug('Array with scales found. Returning');
return [];
}
if (!map) {
Logger.warn('Map component not found. Could not initialize options array.');
return [];
}
let scales = [];
let view = map.getView();
// use existing resolutions array if exists
let resolutions = view.getResolutions();
if (_isEmpty(resolutions)) {
for (let currentZoomLevel = view.getMaxZoom(); currentZoomLevel >= view.getMinZoom(); currentZoomLevel--) {
let resolution = view.getResolutionForZoom(currentZoomLevel);
if (resolutionsFilter(resolution)) {
this.pushScale(scales, resolution, view);
static getInteractionsByName(map, name) {
let interactionCandidates = [];
if (!(map instanceof OlMap)) {
Logger.debug('Input parameter map must be from type `ol.Map`.');
return interactionCandidates;
}
let interactions = map.getInteractions();
interactions.forEach(function(interaction) {
if (interaction.get('name') === name) {
interactionCandidates.push(interaction);
}
});
return interactionCandidates;
}
static getInteractionsByClass(map, clazz) {
let interactionCandidates = [];
if (!(map instanceof OlMap)) {
Logger.debug('Input parameter map must be from type `ol.Map`.');
return interactionCandidates;
}
let interactions = map.getInteractions();
interactions.forEach(function(interaction) {
if (interaction instanceof clazz) {
interactionCandidates.push(interaction);
}
});
return interactionCandidates;
}