forked from Wavyzz/dolibarr
NEW add geometrics extrafield (#28239)
* add extrafield point * wip * wip * wip * input * input * output values * update values * update values * update values * update values * update values * wip * add geomapeditor * add geomapeditor * add linestring and polygon * add linestring and polygon * add linestring and polygon * add linestring and polygon * wip * wip * can store and retrieve linestring * can store and retrieve linestring * coordinates are inverted * coordinates are inverted * add multipoints * use text instead binary * auto center map * wip wip * doc * fix * wip * wip * translation dynamic --------- Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* GeometryCollection: A heterogenous collection of geometries
|
||||
*/
|
||||
class GeometryCollection extends Collection
|
||||
{
|
||||
protected $geom_type = 'GeometryCollection';
|
||||
|
||||
// We need to override asArray. Because geometryCollections are heterogeneous
|
||||
// we need to specify which type of geometries they contain. We need to do this
|
||||
// because, for example, there would be no way to tell the difference between a
|
||||
// MultiPoint or a LineString, since they share the same structure (collection
|
||||
// of points). So we need to call out the type explicitly.
|
||||
public function asArray()
|
||||
{
|
||||
$array = array();
|
||||
foreach ($this->components as $component) {
|
||||
$array[] = array(
|
||||
'type' => $component->geometryType(),
|
||||
'components' => $component->asArray(),
|
||||
);
|
||||
}
|
||||
return $array;
|
||||
}
|
||||
|
||||
// Not valid for this geomettry
|
||||
public function boundary()
|
||||
{
|
||||
return null; }
|
||||
public function isSimple()
|
||||
{
|
||||
return null; }
|
||||
}
|
||||
Reference in New Issue
Block a user