Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/location/lib/geometry/type/ |
Upload File : |
<?php namespace Bitrix\Location\Geometry\Type; use Bitrix\Main\SystemException; /** * Collection: Abstract class for compound geometries * * A geometry is a collection if it is made up of other * component geometries. Therefore, everything but a Point * is a Collection. For example a LineString is a collection * of Points. A Polygon is a collection of LineStrings etc. */ abstract class Collection extends BaseGeometry { /** @var BaseGeometry[] */ protected $components = []; /** * Constructor: Checks and sets component geometries * * @param array $components array of geometries */ public function __construct(array $components = []) { foreach ($components as $component) { if ($component instanceof BaseGeometry) { $this->components[] = $component; } else { throw new SystemException('Cannot create a collection with non-geometries'); } } } /** * @return BaseGeometry[] */ public function getComponents(): array { return $this->components; } /** * @return int */ public function getComponentsCount(): int { return count($this->components); } /** * @inheritDoc */ public function asArray(): array { $result = []; foreach ($this->components as $component) { $result[] = $component->asArray(); } return $result; } }