<commit_before>/**
 * Copyright 2015, GeoSolutions Sas.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree.
 */
var React = require('react');
var assign = require('object-assign');

var {connect} = require('react-redux');
var {bindActionCreators} = require('redux');

var ConfigUtils = require('../../../utils/ConfigUtils');

var {loadLocale} = require('../../../actions/locale');

var {changeMapView, clickOnMap, changeMousePointer} = require('../../../actions/map');
var {getFeatureInfo, changeMapInfoState, purgeMapInfoResults} = require('../../../actions/mapInfo');

var {changeLayerProperties} = require('../../../actions/config');
var BackgroundSwitcherTool = require("../components/BackgroundSwitcherTool");

var VMap = require('../components/Map');
var LangSelector = require('../../../components/I18N/LangSelector');
var About = require('../components/About');
var GetFeatureInfo = require('../components/GetFeatureInfo');
var Localized = require('../../../components/I18N/Localized');

var Viewer = React.createClass({
    propTypes: {
        mapConfig: ConfigUtils.PropTypes.config,
        messages: React.PropTypes.object,
        locale: React.PropTypes.string,
        mapInfo: React.PropTypes.object,
        localeError: React.PropTypes.string,
        loadLocale: React.PropTypes.func,
        changeMapView: React.PropTypes.func,
        changeLayerProperties: React.PropTypes.func,
        getFeatureInfo: React.PropTypes.func,
        changeMapInfoState: React.PropTypes.func,
        purgeMapInfoResults: React.PropTypes.func,
        clickOnMap: React.PropTypes.func,
        changeMousePointer: React.PropTypes.func
    },
    getFirstWmsVisibleLayer() {
        for (let i = 0; i < this.props.mapConfig.layers.length; i++) {
            if (this.props.mapConfig.layers[i].type === 'wms' && this.props.mapConfig.layers[i].visibility) {
                return this.props.mapConfig.layers[i];
            }
        }
        return null;
    },
    renderPlugins(locale) {
        return [
            <LangSelector key="langSelector" currentLocale={locale} onLanguageChange={this.props.loadLocale}/>,
            <About key="about"/>,
                    <BackgroundSwitcherTool key="backgroundSwitcher" layers={this.props.mapConfig.layers} propertiesChangeHandler={this.props.changeLayerProperties}/>,
            <GetFeatureInfo
                key="getFeatureInfo"
                enabled={this.props.mapInfo.enabled}
                htmlResponses={this.props.mapInfo.responses}
                btnIcon="info-sign"
                mapConfig={this.props.mapConfig}
                actions={{
                    getFeatureInfo: this.props.getFeatureInfo,
                    changeMapInfoState: this.props.changeMapInfoState,
                    purgeMapInfoResults: this.props.purgeMapInfoResults,
                    changeMousePointer: this.props.changeMousePointer
                }}
                clickedMapPoint={this.props.mapInfo.clickPoint}
            />
        ];
    },
    render() {
        if (this.props.mapConfig) {
            let config = this.props.mapConfig;<commit_msg>add the map panel with layertree to the viewer<commit_after>/**
 * Copyright 2015, GeoSolutions Sas.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree.
 */
var React = require('react');
var assign = require('object-assign');

var {connect} = require('react-redux');
var {bindActionCreators} = require('redux');

var ConfigUtils = require('../../../utils/ConfigUtils');

var {loadLocale} = require('../../../actions/locale');

var {changeMapView, clickOnMap, changeMousePointer} = require('../../../actions/map');
var {getFeatureInfo, changeMapInfoState, purgeMapInfoResults} = require('../../../actions/mapInfo');

var {changeLayerProperties} = require('../../../actions/config');
var BackgroundSwitcherTool = require("../components/BackgroundSwitcherTool");
var MapPanel = require("../components/MapPanel");

var VMap = require('../components/Map');
var LangSelector = require('../../../components/I18N/LangSelector');
var About = require('../components/About');
var GetFeatureInfo = require('../components/GetFeatureInfo');
var Localized = require('../../../components/I18N/Localized');

var Viewer = React.createClass({
    propTypes: {
        mapConfig: ConfigUtils.PropTypes.config,
        messages: React.PropTypes.object,
        locale: React.PropTypes.string,
        mapInfo: React.PropTypes.object,
        localeError: React.PropTypes.string,
        loadLocale: React.PropTypes.func,
        changeMapView: React.PropTypes.func,
        changeLayerProperties: React.PropTypes.func,
        getFeatureInfo: React.PropTypes.func,
        changeMapInfoState: React.PropTypes.func,
        purgeMapInfoResults: React.PropTypes.func,
        clickOnMap: React.PropTypes.func,
        changeMousePointer: React.PropTypes.func
    },
    getFirstWmsVisibleLayer() {
        for (let i = 0; i < this.props.mapConfig.layers.length; i++) {
            if (this.props.mapConfig.layers[i].type === 'wms' && this.props.mapConfig.layers[i].visibility) {
                return this.props.mapConfig.layers[i];
            }
        }
        return null;
    },
    renderPlugins(locale) {
        return [
            <LangSelector key="langSelector" currentLocale={locale} onLanguageChange={this.props.loadLocale}/>,
            <About key="about"/>,
                    <BackgroundSwitcherTool key="backgroundSwitcher" layers={this.props.mapConfig.layers} propertiesChangeHandler={this.props.changeLayerProperties}/>,
                    <MapPanel layers={this.props.mapConfig.layers} propertiesChangeHandler={this.props.changeLayerProperties}/>,
            <GetFeatureInfo
                key="getFeatureInfo"
                enabled={this.props.mapInfo.enabled}
                htmlResponses={this.props.mapInfo.responses}
                btnIcon="info-sign"
                mapConfig={this.props.mapConfig}
                actions={{
                    getFeatureInfo: this.props.getFeatureInfo,
                    changeMapInfoState: this.props.changeMapInfoState,
                    purgeMapInfoResults: this.props.purgeMapInfoResults,
                    changeMousePointer: this.props.changeMousePointer
                }}
                clickedMapPoint={this.props.mapInfo.clickPoint}
            />
        ];
    },
    render() {
        if (this.props.mapConfig) {
            let config = this.props.mapConfig;
{'fraction_non_alphanumeric': 0.13426342634263427, 'fraction_numerical': 0.0027002700270027003, 'mean_word_length': 2.6312636165577343, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 12, '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': '3826628', 'n_tokens_mistral': 1814, 'n_tokens_neox': 1774, 'n_words': 331}