src/layer/heatmap/HeatMapLayer.js
function (displayName, measuredLocations, numLevels) {
        this.tileWidth = 256;
        this.tileHeight = 256;

        TiledImageLayer.call(this, new Sector(-90, 90, -180, 180), new Location(45, 45), numLevels || 18, 'image/png', 'HeatMap' + WWUtil.guid(), this.tileWidth, this.tileHeight);

        this.displayName = displayName;

        var data = {};
        for (var lat = -90; lat <= 90; lat++) {
            data[lat] = {};
            for (var lon = -180; lon <= 180; lon++) {
                data[lat][lon] = [];
            }
        }

        var latitude, longitude;
        var max = Number.MIN_VALUE;
        measuredLocations.forEach(function (measured) {
            latitude = Math.floor(measured.latitude);
            longitude = Math.floor(measured.longitude);
            data[latitude][longitude].push(measured);
            if(measured.measure > max) {
                max = measured.measure;
            }
        });

        this._data = data;
        this._measuredLocations = measuredLocations;

        this._intervalType = HeatMapIntervalType.CONTINUOUS;
        this._scale = ['blue', 'cyan', 'lime', 'yellow', 'red'];
        this._radius = 12.5;
        this._incrementPerIntensity = 1 / max;

        this.setGradient(measuredLocations);
    }
function (displayName, measuredLocations, numLevels) {
        this.tileWidth = 256;
        this.tileHeight = 256;

        TiledImageLayer.call(this, new Sector(-90, 90, -180, 180), new Location(45, 45), numLevels || 18, 'image/png', 'HeatMap' + WWUtil.guid(), this.tileWidth, this.tileHeight);

        this.displayName = displayName;

        var data = {};
        for (var lat = -90; lat <= 90; lat++) {
            data[lat] = {};
            for (var lon = -180; lon <= 180; lon++) {
                data[lat][lon] = [];
            }
        }

        var latitude, longitude;
        var max = Number.MIN_VALUE;
        measuredLocations.forEach(function (measured) {
            latitude = Math.floor(measured.latitude);
            longitude = Math.floor(measured.longitude);
            data[latitude][longitude].push(measured);
            if(measured.measure > max) {
                max = measured.measure;
            }
        });

        this._data = data;
        this._measuredLocations = measuredLocations;

        this._intervalType = HeatMapIntervalType.CONTINUOUS;
        this._scale = ['blue', 'cyan', 'lime', 'yellow', 'red'];
        this._radius = 12.5;
        this._incrementPerIntensity = 1 / max;

        this.setGradient(measuredLocations);
    }
function ( displayName , measuredLocations , numLevels ) { this . tileWidth = 256 ; this . tileHeight = 256 ; TiledImageLayer . call ( this , new Sector ( - 90 , 90 , - 180 , 180 ) , new Location ( 45 , 45 ) , numLevels || 18 , 'image/png' , 'HeatMap' + WWUtil . guid ( ) , this . tileWidth , this . tileHeight ) ; this . displayName = displayName ; var data = { } ; for ( var lat = - 90 ; lat <= 90 ; lat ++ ) { data [ lat ] = { } ; for ( var lon = - 180 ; lon <= 180 ; lon ++ ) { data [ lat ] [ lon ] = [ ] ; } } var latitude , longitude ; var max = Number . MIN_VALUE ; measuredLocations . forEach ( function ( measured ) { latitude = Math . floor ( measured . latitude ) ; longitude = Math . floor ( measured . longitude ) ; data [ latitude ] [ longitude ] . push ( measured ) ; if ( measured . measure > max ) { max = measured . measure ; } } ) ; this . _data = data ; this . _measuredLocations = measuredLocations ; this . _intervalType = HeatMapIntervalType . CONTINUOUS ; this . _scale = [ 'blue' , 'cyan' , 'lime' , 'yellow' , 'red' ] ; this . _radius = 12.5 ; this . _incrementPerIntensity = 1 / max ; this . setGradient ( measuredLocations ) ; }
Constructs a HeatMap Layer.

The default implementation uses gradient circles to display measured locations. The measure of the locations
define the colors of the gradient.

@alias HeatMapLayer
@constructor
@augments TiledImageLayer
@classdesc A HeatMap layer for visualising an array of measured locations.
@param {String} displayName This layer's display name.
@param {MeasuredLocation[]} measuredLocations An array of locations with measures to visualise.
@param {Number} numLevels Optional. If provided it specifies the amount of levels that will be generated for
this layer.
Constructs a HeatMap Layer .