1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
sourcestaticmapservice.php
См. документацию.
1<?php
2
3namespace Bitrix\Location\Source\Osm;
4
5use Bitrix\Location\Geometry\Type\Point;
6use Bitrix\Location\StaticMap\StaticMapResult;
7use Bitrix\Main\Error;
8use Bitrix\Location\StaticMap;
9
11{
12 private Api\Api $api;
13
14 public function __construct(OsmSource $source)
15 {
16 parent::__construct($source);
17
18 $this->api = new Api\Api($source);
19 }
20
21 public function getStaticMap(Point $point, int $zoom, int $width, int $height): StaticMapResult
22 {
24
25 $staticMapResult = $this->api->getStaticMap(
26 $point->getLat(),
27 $point->getLng(),
28 $zoom,
29 $width,
30 $height
31 );
32
33 if ($staticMapResult['status'] !== 'success')
34 {
35 $result->addError(new Error('Service request error'));
36
37 return $result;
38 }
39
40 return $result
41 ->setContent($staticMapResult['data'])
42 ->setMimeType('image/png')
43 ;
44 }
45}
getStaticMap(Point $point, int $zoom, int $width, int $height)
Определения sourcestaticmapservice.php:21
Определения error.php:15
$result
Определения get_property_values.php:14
$width
Определения html.php:68