<commit_before>/**
 * Created by andreas on 02.05.14.
 */
avnav.provide('avnav.gui.Aispage');
var navobjects=require('../nav/navobjects');
var AisHandler=require('../nav/aisdata');
var Store=require('../util/store');
var ItemUpdater=require('../components/ItemUpdater.jsx');
var ItemList=require('../components/ItemList.jsx');
var ReactDOM=require('react-dom');
var React=require('react');

var keys={
    aisTargets: 'ais'
};

var selections={
    selected: 'avn_selectedItem',
    nearest:  'avn_nearestItem',
    warning:  'avn_warningItem'
};



/**
 *
 * @constructor
 */
avnav.gui.Aispage=function(){
    avnav.gui.Page.call(this,'aispage');
    /**
     * @private
     * @type {AisHandler}
     */
    this.aishandler=null;
    /**
     * @privvate
     * @type {undefined}
     */
    this.aisFormatter=undefined;

    this.store=new Store();
    var self=this;
    $(document).on(navobjects.NavEvent.EVENT_TYPE, function(ev,evdata){
        self.navEvent(evdata);
    });
};
avnav.inherits(avnav.gui.Aispage,avnav.gui.Page);

var aisInfos=[
    [
        {name:'distance',label:'Dst'},
        {name:'cpa',label:'Cpa'},
        {name:'tcpa',label:'Tcpa'}
    ],
    [
        {name:'course',label:'Cog'},
        {name:'speed',label:'Sog'},
        {name:'heading',label:'Hdg'}
    ],
    [
        {name:'shiptype',label:'Type'},
        {name:'callsign',label:'Call'},
        {name:'destination',label:'Dest'}
    ]
];
avnav.gui.Aispage.prototype.localInit=function(){
    this.aishandler=this.navobject.getAisHandler();
    this.aisFormatter=this.aishandler.getAisFormatter();
    var self=this;

    var AisItem=function(props){
        var fmt=self.aisFormatter;
        var fb=fmt.passFront.format(props);
        var style={
            color:props.color
        };
        return ( <div className={"avn_aisListItem "+props.addClass} onClick={props.onClick}>
                <div className="avn_aisItemFB" style={style}>
                    <span className="avn_fb1">{fb.substr(0,1)}</span>{fb.substr(1)}
                </div>
                <div className="avn_aisData">
                    <div className="avn_aisData1">
                        {fmt.mmsi.format(props)}&nbsp;
                        {fmt.shipname.format(props)}
                    </div>
                    { aisInfos.map(function(info1){
                        return <div className="avn_infoLine">
                                {
                                    info1.map(function(info) {
                                        return (
                                            <span className="avn_aisInfoElement">
                                                <span className="avn_aisLabel">{info.label}: </span>
                                                <span className="avn_aisData">{fmt[info.name].format(props)}</span>
                                            </span>
                                        );
                                    })
                                }
                        </div>
                    })}
<commit_msg>add units in AIS list<commit_after>/**
 * Created by andreas on 02.05.14.
 */
avnav.provide('avnav.gui.Aispage');
var navobjects=require('../nav/navobjects');
var AisHandler=require('../nav/aisdata');
var Store=require('../util/store');
var ItemUpdater=require('../components/ItemUpdater.jsx');
var ItemList=require('../components/ItemList.jsx');
var ReactDOM=require('react-dom');
var React=require('react');

var keys={
    aisTargets: 'ais'
};

var selections={
    selected: 'avn_selectedItem',
    nearest:  'avn_nearestItem',
    warning:  'avn_warningItem'
};



/**
 *
 * @constructor
 */
avnav.gui.Aispage=function(){
    avnav.gui.Page.call(this,'aispage');
    /**
     * @private
     * @type {AisHandler}
     */
    this.aishandler=null;
    /**
     * @privvate
     * @type {undefined}
     */
    this.aisFormatter=undefined;

    this.store=new Store();
    var self=this;
    $(document).on(navobjects.NavEvent.EVENT_TYPE, function(ev,evdata){
        self.navEvent(evdata);
    });
};
avnav.inherits(avnav.gui.Aispage,avnav.gui.Page);

var aisInfos=[
    [
        {name:'distance',label:'Dst',unit:'nm'},
        {name:'cpa',label:'Cpa',unit:'nm'},
        {name:'tcpa',label:'Tcpa',unit:'h'}
    ],
    [
        {name:'course',label:'Cog',unit:'°'},
        {name:'speed',label:'Sog',unit:'kn'},
        {name:'heading',label:'Hdg',unit:'°'}
    ],
    [
        {name:'shiptype',label:'Type'},
        {name:'callsign',label:'Call'},
        {name:'destination',label:'Dest'}
    ]
];
avnav.gui.Aispage.prototype.localInit=function(){
    this.aishandler=this.navobject.getAisHandler();
    this.aisFormatter=this.aishandler.getAisFormatter();
    var self=this;

    var AisItem=function(props){
        var fmt=self.aisFormatter;
        var fb=fmt.passFront.format(props);
        var style={
            color:props.color
        };
        return ( <div className={"avn_aisListItem "+props.addClass} onClick={props.onClick}>
                <div className="avn_aisItemFB" style={style}>
                    <span className="avn_fb1">{fb.substr(0,1)}</span>{fb.substr(1)}
                </div>
                <div className="avn_aisData">
                    <div className="avn_aisData1">
                        {fmt.mmsi.format(props)}&nbsp;
                        {fmt.shipname.format(props)}
                    </div>
                    { aisInfos.map(function(info1){
                        return <div className="avn_infoLine">
                                {
                                    info1.map(function(info) {
                                        return (
                                            <span className="avn_aisInfoElement">
                                                <span className="avn_aisLabel">{info.label}: </span>
                                                <span className="avn_aisData">{fmt[info.name].format(props)}{info.unit !== undefined && info.unit}</span>
                                            </span>
                                        );
                                    })
                                }
                        </div>
                    })}

{'fraction_non_alphanumeric': 0.15703537698095085, 'fraction_numerical': 0.004161997758924283, 'mean_word_length': 1.7129830655666523, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 35, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 24, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6682238', 'n_tokens_mistral': 1867, 'n_tokens_neox': 1808, 'n_words': 226}