/** * @dataProvider instanceProvider * @param Rectangle $rectangle * @param array $arguments */ public function testSetCorners(Rectangle $rectangle, array $arguments) { $coordinates = array(new LatLongValue(42, 42), new LatLongValue(0, 0)); foreach ($coordinates as $coordinate) { $rectangle->setRectangleNorthEast($coordinate); $this->assertTrue($rectangle->getRectangleNorthEast()->equals($coordinate)); $rectangle->setRectangleSouthWest($coordinate); $this->assertTrue($rectangle->getRectangleSouthWest()->equals($coordinate)); } }
/** * Constructor. * * @since 3.0 * * @param LatLongValue $boundsNorthEast * @param LatLongValue $boundsSouthWest * @param string $image * * @throws InvalidArgumentException */ public function __construct(LatLongValue $boundsNorthEast, LatLongValue $boundsSouthWest, $image) { if (!is_string($image)) { throw new InvalidArgumentException('$image must be a string'); } parent::__construct($boundsNorthEast, $boundsSouthWest); $this->image = $image; }
/** * @see StringValueParser::stringParse * * @since 3.0 * * @param string $value * * @return Rectangle */ public function stringParse($value) { $metaData = explode($this->metaDataSeparator, $value); $rectangleData = explode(':', array_shift($metaData)); $rectangle = new Rectangle($this->stringToLatLongValue($rectangleData[0]), $this->stringToLatLongValue($rectangleData[1])); if ($metaData !== array()) { $rectangle->setTitle(array_shift($metaData)); } if ($metaData !== array()) { $rectangle->setText(array_shift($metaData)); } if ($metaData !== array()) { $rectangle->setStrokeColor(array_shift($metaData)); } if ($metaData !== array()) { $rectangle->setStrokeOpacity(array_shift($metaData)); } if ($metaData !== array()) { $rectangle->setStrokeWeight(array_shift($metaData)); } return $rectangle; }
/** * @since 3.0 * * @param string $defText * @param string $defTitle * * @return array */ public function getJSONObject($defText = '', $defTitle = '') { $data = parent::getJSONObject($defText, $defTitle); $data['image'] = $this->imageUrl; return $data; }