Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions Layer/HeatmapLayer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<?php

namespace PHPGoogleMaps\Layer;

use PHPGoogleMaps\Core\LatLng;
use PHPGoogleMaps\Core\MapObject;

/**
* Heatmap Layer
*
* @link https://developers.google.com/maps/documentation/javascript/heatmaplayer
*/
class HeatmapLayer extends MapObject
{

/**
* Constructor
*
* @param array $options Array of options
*/
public function __construct(array $options = null)
{
if ($options) {
unset($options['map']);
$this->options = $options;
}
}

/**
* Add a Coordinate
*
* @param LatLng $latLng
* @return void
*/
public function addLatLng(LatLng $latLng)
{
if (!isset($this->options['data'])) {
$this->options['data'] = array();
}
$this->options['data'][] = $latLng;
}

}
48 changes: 48 additions & 0 deletions Layer/HeatmapLayerDecorator.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

namespace PHPGoogleMaps\Layer;

/**
* Panoramio layer decorator
*
* Decorate a panoramio layer after it has been added to a map
*/


class HeatmapLayerDecorator extends \PHPGoogleMaps\Core\MapObjectDecorator {

/**
* Id of the HeatmapLayer layer in the map
*
* @var integer
*/
protected $_id;

/**
* Map id the HeatmapLayer is attached to
*
* @var string
*/
protected $_map;

/**
* Constructor
*
* @param HeatmapLayer $heatmapLayer
* @param int $id ID of the HeatmapLayer layer in the map
* @param string $map Map Id of the map the HeatmapLayer is attached to
*/
public function __construct( HeatmapLayer $heatmapLayer, $id, $map ) {
parent::__construct( $heatmapLayer, array( '_id' => $id, '_map' => $map ) );
}

/**
* Returns the javascript variable of the Heatmap layer
*
* @return string
*/
public function getJsVar() {
return sprintf( '%s.heatmap_layers[%s]', $this->_map, $this->_id );
}

}
Loading