1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
point.php
См. документацию.
1<?php
2
3namespace Bitrix\Location\Geometry\Type;
4
5use InvalidArgumentException;
6
7class Point extends BaseGeometry
8{
10 protected $lat;
11
13 protected $lng;
14
21 public function __construct(float $lat, float $lng)
22 {
23 if (!$this->isValidLatitude($lat))
24 {
25 throw new InvalidArgumentException('Latitude value must be numeric -90.0 .. +90.0 (given: ' . $lat . ')');
26 }
27
28 if (!$this->isValidLongitude($lng))
29 {
30 throw new InvalidArgumentException(
31 'Longitude value must be numeric -180.0 .. +180.0 (given: ' . $lng . ')'
32 );
33 }
34
35 $this->lat = $lat;
36 $this->lng = $lng;
37 }
38
42 public function getLat(): float
43 {
44 return $this->lat;
45 }
46
50 public function getLng(): float
51 {
52 return $this->lng;
53 }
54
58 public function asArray(): array
59 {
60 return [
63 ];
64 }
65
70 protected function isValidLatitude(float $latitude): bool
71 {
72 return $this->isNumericInBounds($latitude, -90.0, 90.0);
73 }
74
79 protected function isValidLongitude(float $longitude): bool
80 {
81 return $this->isNumericInBounds($longitude, -180.0, 180.0);
82 }
83
88 protected function isNumericInBounds(float $value, float $lower, float $upper): bool
89 {
90 return !($value < $lower || $value > $upper);
91 }
92}
isValidLongitude(float $longitude)
Определения point.php:79
__construct(float $lat, float $lng)
Определения point.php:21
isNumericInBounds(float $value, float $lower, float $upper)
Определения point.php:88
isValidLatitude(float $latitude)
Определения point.php:70
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804