<commit_before>import React from 'react';
import PropTypes from 'prop-types';
import {Map, ZoomControl} from 'react-leaflet';
import {connect} from "react-redux";
import 'proj4leaflet';
import {Layers} from '../components/Layers';
import FeatureCollectionDisplay from '../components/FeatureCollectionDisplay';
import GazetteerHitDisplay from '../components/GazetteerHitDisplay';
import {crs25832, proj4crs25832def} from '../constants/gis';
import proj4 from 'proj4';
import {bindActionCreators} from 'redux';
import FullscreenControl from '../components/FullscreenControl';
import NewWindowControl from '../components/NewWindowControl';
import queryString from 'query-string';

import Control from 'react-leaflet-control';
import {
  Form,
  FormGroup,
  InputGroup,
  Button,
  OverlayTrigger,
  Tooltip
} from 'react-bootstrap';
import {Typeahead} from 'react-bootstrap-typeahead';

import {routerActions} from 'react-router-redux'
import {modifyQueryPart} from '../utils/routingHelper'
import {actions as mappingActions, constants as mappingConstants } from '../redux/modules/mapping';
import objectAssign from 'object-assign';
import {Icon} from 'react-fa'
import {actions as uiStateActions} from '../redux/modules/uiState';
import {actions as gazetteerTopicsActions} from '../redux/modules/gazetteerTopics';
import 'url-search-params-polyfill';
import * as turfHelpers from '@turf/helpers';
import bbox from '@turf/bbox';
import {WUNDAAPI} from '../constants/services';
import * as gisHelpers from '../utils/gisHelper';

// need to have this import 
// eslint-disable-next-line
import markerClusterGroup from 'leaflet.markercluster';

import ProjSingleGeoJson from '../components/ProjSingleGeoJson';

import LocateControl from '../components/LocateControl';

const fallbackposition = {
  lat: 51.272399,
  lng: 7.199712
};

function mapStateToProps(state) {
  return {
     uiState: state.uiState,
     mapping: state.mapping,
     attributionControl: false,
     routing: state.routing,
     gazetteerTopics: state.gazetteerTopics
   };
}

function mapDispatchToProps(dispatch) {
  return {
    mappingActions: bindActionCreators(mappingActions, dispatch),
    uiStateActions: bindActionCreators(uiStateActions, dispatch),
    routingActions: bindActionCreators(routerActions, dispatch),
    gazetteerTopicsActions: bindActionCreators(gazetteerTopicsActions, dispatch)
  };
}

export function createLeafletElement() {}

export class Cismap_ extends React.Component {
  constructor(props) {
    super(props);
    this.internalGazeteerHitTrigger = this.internalGazeteerHitTrigger.bind(this);
    this.internalSearchButtonTrigger = this.internalSearchButtonTrigger.bind(this);
    this.internalClearButtonTrigger = this.internalClearButtonTrigger.bind(this);
    this.featureClick = this.featureClick.bind(this);
    this.handleSearch = this.handleSearch.bind(this);
    this.gotoHomeBB = this.gotoHomeBB.bind(this);
    this.loadTheGazettteerTopics= this.loadTheGazettteerTopics.bind(this);
    this.showModalApplicationMenu = this.showModalApplicationMenu.bind(this);
    this.gazData=[];
  }

  componentWillUnmount() {
    // console.log("Cismap.componentWillUnMount()")
    // console.trace();
  }

  componentWillMount() {
    // console.log("Cismap.componentWillMount()")
    this.loadTheGazettteerTopics();
  }

  loadTheGazettteerTopics(){
    ///console.log("loadTheGazettteerTopics()")
    //Über uiStateActions anzeigen dass die Combobox nocht nicht funktionsfähig ist

    this.props.uiStateActions.setGazetteerBoxEnabled(false);
    this.props.uiStateActions.setGazetteerBoxInfoText("Ortsinformationen werden geladen ...");

    this.props.gazetteerTopicsActions.loadTopicsData(this.props.gazTopics).then(() => {

      if (this.props.gazetteerTopics.adressen === undefined) {
        console.log("this.props.gazetteerTopics.adressen === undefined")
      }

      let sorter=0;
      this.gazData = [];
      if (this.props.gazTopics.indexOf("pois")!==-1) {
        let pois = JSON.parse(this.props.gazetteerTopics.pois);
        for (let i = 0; i < pois.length; ++i) {
          let topicItem = pois[i];
          let g = {
            sorter: sorter++,
            string: topicItem.s,
            glyph: topicItem.g,
            x: topicItem.x,
            y: topicItem.y,
            more: topicItem.m
          };
          this.gazData.push(g);
        }
      }
      if (this.props.gazTopics.indexOf("quartiere")!==-1) {
        let quartiere = JSON.parse(this.props.gazetteerTopics.quartiere);
        for (let i = 0; i < quartiere.length; ++i) {
          let topicItem = quartiere[i];
          let g = {
            sorter: sorter++,
            string: topicItem.s,
            glyph: topicItem.g,
            x: topicItem.x,
            y: topicItem.y,
            more: topicItem.m
          };
          this.gazData.push(g);
        }
      }

      if (this.props.gazTopics.indexOf("bezirke")!==-1) {
        let bezirke = JSON.parse(this.props.gazetteerTopics.bezirke);
        for (let i = 0; i < bezirke.length; ++i) {
          let topicItem = bezirke[i];
          let g = {
            sorter: sorter++,
            string: topicItem.s,
            glyph: topicItem.g,
            x: topicItem.x,
            y: topicItem.y,
            more: topicItem.m
          };
          this.gazData.push(g);
        }
      }

      if (this.props.gazTopics.indexOf("adressen")!==-1) {
        let adressen = JSON.parse(this.props.gazetteerTopics.adressen);
        for (let i = 0; i < adressen.length; ++i) {
          let topicItem = adressen[i];
          let string=topicItem.s;
          if (topicItem.nr!=="" && topicItem.nr!==0) {
            string=string +" "+topicItem.nr;
          }
          if (topicItem.z!=="") {
            string=string +" "+topicItem.z;
          }
          let g = {
            sorter: sorter++,
            string: string,
            glyph: topicItem.g,
            x: topicItem.x,
            y: topicItem.y,
            more: topicItem.m<commit_msg>:sparkles: working on #28: add ability to map to show the kindergarden topic<commit_after>import React from 'react';
import PropTypes from 'prop-types';
import {Map, ZoomControl} from 'react-leaflet';
import {connect} from "react-redux";
import 'proj4leaflet';
import {Layers} from '../components/Layers';
import FeatureCollectionDisplay from '../components/FeatureCollectionDisplay';
import GazetteerHitDisplay from '../components/GazetteerHitDisplay';
import {crs25832, proj4crs25832def} from '../constants/gis';
import proj4 from 'proj4';
import {bindActionCreators} from 'redux';
import FullscreenControl from '../components/FullscreenControl';
import NewWindowControl from '../components/NewWindowControl';
import queryString from 'query-string';

import Control from 'react-leaflet-control';
import {
  Form,
  FormGroup,
  InputGroup,
  Button,
  OverlayTrigger,
  Tooltip
} from 'react-bootstrap';
import {Typeahead} from 'react-bootstrap-typeahead';

import {routerActions} from 'react-router-redux'
import {modifyQueryPart} from '../utils/routingHelper'
import {actions as mappingActions, constants as mappingConstants } from '../redux/modules/mapping';
import objectAssign from 'object-assign';
import {Icon} from 'react-fa'
import {actions as uiStateActions} from '../redux/modules/uiState';
import {actions as gazetteerTopicsActions} from '../redux/modules/gazetteerTopics';
import 'url-search-params-polyfill';
import * as turfHelpers from '@turf/helpers';
import bbox from '@turf/bbox';
import {WUNDAAPI} from '../constants/services';
import * as gisHelpers from '../utils/gisHelper';

// need to have this import 
// eslint-disable-next-line
import markerClusterGroup from 'leaflet.markercluster';

import ProjSingleGeoJson from '../components/ProjSingleGeoJson';

import LocateControl from '../components/LocateControl';

const fallbackposition = {
  lat: 51.272399,
  lng: 7.199712
};

function mapStateToProps(state) {
  return {
     uiState: state.uiState,
     mapping: state.mapping,
     attributionControl: false,
     routing: state.routing,
     gazetteerTopics: state.gazetteerTopics
   };
}

function mapDispatchToProps(dispatch) {
  return {
    mappingActions: bindActionCreators(mappingActions, dispatch),
    uiStateActions: bindActionCreators(uiStateActions, dispatch),
    routingActions: bindActionCreators(routerActions, dispatch),
    gazetteerTopicsActions: bindActionCreators(gazetteerTopicsActions, dispatch)
  };
}

export function createLeafletElement() {}

export class Cismap_ extends React.Component {
  constructor(props) {
    super(props);
    this.internalGazeteerHitTrigger = this.internalGazeteerHitTrigger.bind(this);
    this.internalSearchButtonTrigger = this.internalSearchButtonTrigger.bind(this);
    this.internalClearButtonTrigger = this.internalClearButtonTrigger.bind(this);
    this.featureClick = this.featureClick.bind(this);
    this.handleSearch = this.handleSearch.bind(this);
    this.gotoHomeBB = this.gotoHomeBB.bind(this);
    this.loadTheGazettteerTopics= this.loadTheGazettteerTopics.bind(this);
    this.showModalApplicationMenu = this.showModalApplicationMenu.bind(this);
    this.gazData=[];
  }

  componentWillUnmount() {
    // console.log("Cismap.componentWillUnMount()")
    // console.trace();
  }

  componentWillMount() {
    // console.log("Cismap.componentWillMount()")
    this.loadTheGazettteerTopics();
  }

  loadTheGazettteerTopics(){
    ///console.log("loadTheGazettteerTopics()")
    //Über uiStateActions anzeigen dass die Combobox nocht nicht funktionsfähig ist

    this.props.uiStateActions.setGazetteerBoxEnabled(false);
    this.props.uiStateActions.setGazetteerBoxInfoText("Ortsinformationen werden geladen ...");

    this.props.gazetteerTopicsActions.loadTopicsData(this.props.gazTopics).then(() => {

      if (this.props.gazetteerTopics.adressen === undefined) {
        console.log("this.props.gazetteerTopics.adressen === undefined")
      }

      let sorter=0;
      this.gazData = [];
      if (this.props.gazTopics.indexOf("pois")!==-1) {
        let pois = JSON.parse(this.props.gazetteerTopics.pois);
        for (let i = 0; i < pois.length; ++i) {
          let topicItem = pois[i];
          let g = {
            sorter: sorter++,
            string: topicItem.s,
            glyph: topicItem.g,
            x: topicItem.x,
            y: topicItem.y,
            more: topicItem.m
          };
          this.gazData.push(g);
        }
      }
      if (this.props.gazTopics.indexOf("quartiere")!==-1) {
        let quartiere = JSON.parse(this.props.gazetteerTopics.quartiere);
        for (let i = 0; i < quartiere.length; ++i) {
          let topicItem = quartiere[i];
          let g = {
            sorter: sorter++,
            string: topicItem.s,
            glyph: topicItem.g,
            x: topicItem.x,
            y: topicItem.y,
            more: topicItem.m
          };
          this.gazData.push(g);
        }
      }

      if (this.props.gazTopics.indexOf("bezirke")!==-1) {
        let bezirke = JSON.parse(this.props.gazetteerTopics.bezirke);
        for (let i = 0; i < bezirke.length; ++i) {
          let topicItem = bezirke[i];
          let g = {
            sorter: sorter++,
            string: topicItem.s,
            glyph: topicItem.g,
            x: topicItem.x,
            y: topicItem.y,
            more: topicItem.m
          };
          this.gazData.push(g);
        }
      }
      if (this.props.gazTopics.indexOf("kitas")!==-1) {
        let kitas = JSON.parse(this.props.gazetteerTopics.kitas);
        for (let i = 0; i < kitas.length; ++i) {
          let topicItem = kitas[i];
          let g = {
            sorter: sorter++,
            string: topicItem.s,
            glyph: topicItem.g,
            x: topicItem.x,
            y: topicItem.y,
            more: topicItem.m
          };
          this.gazData.push(g);
        }
      }
      
      if (this.props.gazTopics.indexOf("adressen")!==-1) {
        let adressen = JSON.parse(this.props.gazetteerTopics.adressen);
        for (let i = 0; i < adressen.length; ++i) {
          let topicItem = adressen[i];
          let string=topicItem.s;
          if (topicItem.nr!=="" && topicItem.nr!==0) {
            string=string +" "+topicItem.nr;
          }
          if (topicItem.z!=="") {
            string=string +" "+topicItem.z;
          }
          let g = {
            sorter: sorter++,
            string: string,
            glyph: topicItem.g,
            x: topicItem.x,
            y: topicItem.y,
            more: topicItem.m
{'fraction_non_alphanumeric': 0.12539707750952986, 'fraction_numerical': 0.006512071156289708, 'mean_word_length': 2.8416717510677243, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4634649', 'n_tokens_mistral': 4043, 'n_tokens_neox': 3966, 'n_words': 781}