Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
manager.php
1
<?php
2
3
namespace
Bitrix\Location\Geometry\Converter
;
4
5
use
Bitrix\Location\Geometry\Type\BaseGeometry
;
6
use
Bitrix\Main\SystemException
;
7
8
class
Manager
9
{
10
public
const
FORMAT_GEOJSON
=
'geojson'
;
11
public
const
FORMAT_ARRAY
=
'array'
;
12
18
public
static
function
read
($input,
string
$format): ?
BaseGeometry
19
{
20
return
self::makeConverter
($format)->read($input);
21
}
22
28
public
static
function
write
(
BaseGeometry
$geometry,
string
$format)
29
{
30
return
self::makeConverter
($format)->write($geometry);
31
}
32
38
public
static
function
makeConverter
(
string
$format):
Converter
39
{
40
$map = [
41
self::FORMAT_GEOJSON => GeoJsonConverter::class,
42
self::FORMAT_ARRAY => ArrayConverter::class,
43
];
44
45
if
(!isset($map[$format]))
46
{
47
throw
new
SystemException
(
'Converter has not been found'
);
48
}
49
50
return
new
$map[$format];
51
}
52
}
Bitrix\Location\Geometry\Converter\Converter
Definition
converter.php:8
Bitrix\Location\Geometry\Converter\Manager
Definition
manager.php:9
Bitrix\Location\Geometry\Converter\Manager\write
static write(BaseGeometry $geometry, string $format)
Definition
manager.php:28
Bitrix\Location\Geometry\Converter\Manager\read
static read($input, string $format)
Definition
manager.php:18
Bitrix\Location\Geometry\Converter\Manager\FORMAT_GEOJSON
const FORMAT_GEOJSON
Definition
manager.php:10
Bitrix\Location\Geometry\Converter\Manager\makeConverter
static makeConverter(string $format)
Definition
manager.php:38
Bitrix\Location\Geometry\Converter\Manager\FORMAT_ARRAY
const FORMAT_ARRAY
Definition
manager.php:11
Bitrix\Location\Geometry\Type\BaseGeometry
Definition
basegeometry.php:6
Bitrix\Main\SystemException
Definition
exception.php:8
Bitrix\Location\Geometry\Converter
Definition
arrayconverter.php:3
modules
location
lib
geometry
converter
manager.php
Создано системой
1.10.0