How to use the @terrestris/base-util/dist/Logger.warn function in @terrestris/base-util

To help you get started, we’ve selected a few @terrestris/base-util examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github terrestris / react-geo / src / Field / ScaleCombo / ScaleCombo.tsx View on Github external
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);
        }
      }
    } else {
      let reversedResolutions = _reverse(_clone(resolutions));
github terrestris / react-geo / src / Container / AddWmsPanel / AddWmsPanel.tsx View on Github external
onLayerAddToMap,
      wmsLayers,
      map
    } = this.props;

    if (onLayerAddToMap) {
      onLayerAddToMap(wmsLayers);
    } else if (map) {
      wmsLayers.forEach(layer => {
        // Add layer to map if it is not added yet
        if (!map.getLayers().getArray().includes(layer) ) {
          map.addLayer(layer);
        }
      });
    } else {
      Logger.warn('Neither map nor onLayerAddToMap given in props. Will do nothing.');
    }
  }
github terrestris / ol-util / src / MapUtil / MapUtil.js View on Github external
source.getUrls() ? source.getUrls()[0] : ''
        : source.getUrl();
      const params = {
        LAYER: source.getParams().LAYERS,
        VERSION: '1.3.0',
        SERVICE: 'WMS',
        REQUEST: 'getLegendGraphic',
        FORMAT: 'image/png'
      };

      const queryString = UrlUtil.objectToRequestString(
        Object.assign(params, extraParams));

      return /\?/.test(url) ? `${url}&${queryString}` : `${url}?${queryString}`;
    } else {
      Logger.warn(`Source of "${layer.get('name')}" is currently not supported `
        + `by MapUtil.getLegendGraphicUrl.`);
      return;
    }
  }
github terrestris / react-geo / src / LayerSwitcher / LayerSwitcher.tsx View on Github external
setMapLayers = () => {
    const {
      layers
    } = this.props;
    if (layers.length < 2) {
      Logger.warn(`LayerSwitcher requires two or more layers.`);
    }
    this._map.getLayers().clear();
    this._layerClones = layers.map((layer, index) => {
      const layerClone = this.cloneLayer(layer);
      if (layerClone.getVisible()) {
        this._visibleLayerIndex = index;
      }
      this._map.addLayer(layerClone);
      return layerClone;
    });
  }
github terrestris / react-geo / src / LayerTree / LayerTree.tsx View on Github external
treeNodeFromLayer(layer: OlLayerBase) {
    let childNodes;
    let treeNode;

    if (layer instanceof OlLayerGroup) {
      if (!layer.getVisible()) {
        Logger.warn('Your map configuration contains layerGroups that are' +
          'invisible. This might lead to buggy behaviour.');
      }
      let childLayers = layer.getLayers().getArray()
        .filter(this.props.filterFunction);
      childNodes = childLayers.map((childLayer) => {
        return this.treeNodeFromLayer(childLayer);
      });
      childNodes.reverse();
    } else {
      if (!this.hasListener(layer, 'change:visible', this.onLayerChangeVisible)) {
        const eventKey = layer.on('change:visible', this.onLayerChangeVisible);
        this.olListenerKeys.push(eventKey);
      }
    }

    treeNode =
github terrestris / react-geo / src / Button / DigitizeButton / DigitizeButton.tsx View on Github external
constructor(props: DigitizeButtonProps) {
    super(props);

    if (!props.drawType && !props.editType) {
      Logger.warn('Neither "drawType" nor "editType" was provided. Digitize ' +
      'button won\'t work properly!');
    }

    this.state = {
      digitizeLayer: null,
      interactions: [],
      showLabelPrompt: false,
      textLabel: ''
    };
  }
github terrestris / react-geo / src / Legend / Legend.tsx View on Github external
onError() {
    Logger.warn(`Image error for legend of "${this.props.layer.get('name')}".`);
  }
github terrestris / react-geo / src / Window / Window.tsx View on Github external
constructor(props: WindowProps) {
    super(props);
    const id = props.id || _uniqueId('window-');

    const { parentId } = this.props;
    this._parent = document.getElementById(parentId);

    if (!this._parent) {
      Logger.warn('No parent element was found! Please ensure that parentId ' +
      'parameter was set correctly (default value is `app`)');
    }

    const div = document.createElement('div');
    div.id = id;
    this._elementDiv = div;

    this.state = {
      id: id,
      resizing: false
    };
  }
github terrestris / react-geo / src / HigherOrderComponent / MappifiedComponent / MappifiedComponent.tsx View on Github external
render() {
      const {
        map
      } = this.context;

      if (!map) {
        Logger.warn('You\'re trying to mappify a component without any map ' +
          'in the context. Did you implement the MapProvider?');
      }

      return (
        
      );

    }
  };