Пример #1
0
 public function testInitialState()
 {
     $southWest = $this->getMock('Ivory\\GoogleMap\\Base\\Coordinate');
     $northEast = $this->getMock('Ivory\\GoogleMap\\Base\\Coordinate');
     $extends = array($this->getMock('Ivory\\GoogleMap\\Overlays\\ExtendableInterface'));
     $this->bound = new Bound($southWest, $northEast, $extends);
     $this->assertTrue($this->bound->hasCoordinates());
     $this->assertSame($southWest, $this->bound->getSouthWest());
     $this->assertSame($northEast, $this->bound->getNorthEast());
     $this->assertTrue($this->bound->hasExtends());
     $this->assertSame($extends, $this->bound->getExtends());
 }
Пример #2
0
 /**
  * Renders the bound.
  *
  * @param \Ivory\GoogleMap\Base\Bound $bound The bound.
  *
  * @return string The JS output.
  */
 public function render(Bound $bound)
 {
     if ($bound->hasExtends() || !$bound->hasCoordinates()) {
         return sprintf('%s = new google.maps.LatLngBounds();' . PHP_EOL, $bound->getJavascriptVariable());
     }
     return sprintf('%s = new google.maps.LatLngBounds(%s, %s);' . PHP_EOL, $bound->getJavascriptVariable(), $bound->getSouthWest()->getJavascriptVariable(), $bound->getNorthEast()->getJavascriptVariable());
 }