Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\PostGIS;

use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\BaseFunction;

/**
* Implementation of PostGIS ST_3DDistance() function.
*
* Returns the 3D distance between two geometries.
* For geometry type, the units are in the units of the spatial reference system.
*
* @see https://postgis.net/docs/ST_3DDistance.html
* @since 3.5
*
* @author Martin Georgiev <martin.georgiev@gmail.com>
*
* @example Using it in DQL: "SELECT ST_3DDISTANCE(g1.geometry, g2.geometry) FROM Entity g1, Entity g2"
* Returns numeric 3D distance value.
*/
class ST_3DDistance extends BaseFunction
{
protected function customizeFunction(): void
{
$this->setFunctionPrototype('ST_3DDistance(%s, %s)');
$this->addNodeMapping('StringPrimary');
$this->addNodeMapping('StringPrimary');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

declare(strict_types=1);

namespace MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\PostGIS;

use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\BaseFunction;

/**
* Implementation of PostGIS ST_3DLength() function.
*
* Returns the 3D length of the geometry if it is a LineString or MultiLineString.
* For areal geometries, the 3D perimeter is returned.
*
* @see https://postgis.net/docs/ST_3DLength.html
* @since 3.5
*
* @author Martin Georgiev <martin.georgiev@gmail.com>
*
* @example Using it in DQL: "SELECT ST_3DLENGTH(g.geometry) FROM Entity g"
* Returns numeric 3D length value.
*/
class ST_3DLength extends BaseFunction
{
protected function customizeFunction(): void
{
$this->setFunctionPrototype('ST_3DLength(%s)');
$this->addNodeMapping('StringPrimary');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

declare(strict_types=1);

namespace MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\PostGIS;

use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\BaseFunction;

/**
* Implementation of PostGIS ST_3DPerimeter() function.
*
* Returns the 3D perimeter of the geometry if it is a polygon or multi-polygon.
* For non-areal geometries, 0 is returned.
*
* @see https://postgis.net/docs/ST_3DPerimeter.html
* @since 3.5
*
* @author Martin Georgiev <martin.georgiev@gmail.com>
*
* @example Using it in DQL: "SELECT ST_3DPERIMETER(g.geometry) FROM Entity g"
* Returns numeric 3D perimeter value.
*/
class ST_3DPerimeter extends BaseFunction
{
protected function customizeFunction(): void
{
$this->setFunctionPrototype('ST_3DPerimeter(%s)');
$this->addNodeMapping('StringPrimary');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

declare(strict_types=1);

namespace MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\PostGIS;

use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\BaseFunction;

/**
* Implementation of PostGIS ST_Area() function.
*
* Returns the area of the geometry if it is a polygon or multi-polygon.
* For non-areal geometries, 0 is returned.
*
* @see https://postgis.net/docs/ST_Area.html
* @since 3.5
*
* @author Martin Georgiev <martin.georgiev@gmail.com>
*
* @example Using it in DQL: "SELECT ST_AREA(g.geometry) FROM Entity g"
* Returns numeric area value.
*/
class ST_Area extends BaseFunction
{
protected function customizeFunction(): void
{
$this->setFunctionPrototype('ST_Area(%s)');
$this->addNodeMapping('StringPrimary');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\PostGIS;

use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\BaseFunction;

/**
* Implementation of PostGIS ST_Azimuth() function.
*
* Returns the azimuth between two points.
* Azimuth is the angle in radians from north (0) clockwise.
*
* @see https://postgis.net/docs/ST_Azimuth.html
* @since 3.5
*
* @author Martin Georgiev <martin.georgiev@gmail.com>
*
* @example Using it in DQL: "SELECT ST_AZIMUTH(g.geometry1, g.geometry2) FROM Entity g"
* Returns azimuth angle in radians.
*/
class ST_Azimuth extends BaseFunction
{
protected function customizeFunction(): void
{
$this->setFunctionPrototype('ST_Azimuth(%s, %s)');
$this->addNodeMapping('StringPrimary');
$this->addNodeMapping('StringPrimary');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

namespace MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\PostGIS;

use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\BaseFunction;

/**
* Implementation of PostGIS ST_Boundary() function.
*
* Returns the boundary of a geometry.
* For point geometries, the boundary is empty.
* For line geometries, the boundary consists of the endpoints.
* For polygon geometries, the boundary is the outer ring.
*
* @see https://postgis.net/docs/ST_Boundary.html
* @since 3.5
*
* @author Martin Georgiev <martin.georgiev@gmail.com>
*
* @example Using it in DQL: "SELECT ST_BOUNDARY(g.geometry) FROM Entity g"
* Returns geometry representing the boundary.
*/
class ST_Boundary extends BaseFunction
{
protected function customizeFunction(): void
{
$this->setFunctionPrototype('ST_Boundary(%s)');
$this->addNodeMapping('StringPrimary');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\PostGIS;

use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\BaseFunction;

/**
* Implementation of PostGIS ST_Buffer() function.
*
* Returns a geometry that represents all points whose distance from the input geometry
* is less than or equal to the distance parameter.
*
* @see https://postgis.net/docs/ST_Buffer.html
* @since 3.5
*
* @author Martin Georgiev <martin.georgiev@gmail.com>
*
* @example Using it in DQL: "SELECT ST_BUFFER(g.geometry, 10) FROM Entity g"
* Returns buffered geometry.
*/
class ST_Buffer extends BaseFunction
{
protected function customizeFunction(): void
{
$this->setFunctionPrototype('ST_Buffer(%s, %s)');
$this->addNodeMapping('StringPrimary');
$this->addNodeMapping('Literal');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php

declare(strict_types=1);

namespace MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\PostGIS;

use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\BaseFunction;

/**
* Implementation of PostGIS ST_Centroid() function.
*
* Returns the geometric center of a geometry.
* For point geometries, the centroid is the point itself.
* For line geometries, the centroid is the midpoint.
* For polygon geometries, the centroid is the center of mass.
*
* @see https://postgis.net/docs/ST_Centroid.html
* @since 3.5
*
* @author Martin Georgiev <martin.georgiev@gmail.com>
*
* @example Using it in DQL: "SELECT ST_CENTROID(g.geometry) FROM Entity g"
* Returns point geometry representing the centroid.
*/
class ST_Centroid extends BaseFunction
{
protected function customizeFunction(): void
{
$this->setFunctionPrototype('ST_Centroid(%s)');
$this->addNodeMapping('StringPrimary');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\PostGIS;

use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\BaseFunction;

/**
* Implementation of PostGIS ST_ClipByBox2D() function.
*
* Clips a geometry by a 2D box.
* Returns the portion of the input geometry that falls within the specified box.
*
* @see https://postgis.net/docs/ST_ClipByBox2D.html
* @since 3.5
*
* @author Martin Georgiev <martin.georgiev@gmail.com>
*
* @example Using it in DQL: "SELECT ST_CLIPBYBOX2D(g.geometry, ST_Envelope(g.geometry)) FROM Entity g"
* Returns clipped geometry.
*/
class ST_ClipByBox2D extends BaseFunction
{
protected function customizeFunction(): void
{
$this->setFunctionPrototype('ST_ClipByBox2D(%s, %s)');
$this->addNodeMapping('StringPrimary');
$this->addNodeMapping('StringPrimary');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\PostGIS;

use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\BaseFunction;

/**
* Implementation of PostGIS ST_Collect() function.
*
* Collects geometries into a geometry collection.
* Useful for grouping multiple geometries together.
*
* @see https://postgis.net/docs/ST_Collect.html
* @since 3.5
*
* @author Martin Georgiev <martin.georgiev@gmail.com>
*
* @example Using it in DQL: "SELECT ST_COLLECT(g.geometry1, g.geometry2) FROM Entity g"
* Returns geometry collection.
*/
class ST_Collect extends BaseFunction
{
protected function customizeFunction(): void
{
$this->setFunctionPrototype('ST_Collect(%s, %s)');
$this->addNodeMapping('StringPrimary');
$this->addNodeMapping('StringPrimary');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

declare(strict_types=1);

namespace MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\PostGIS;

use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\BaseFunction;

/**
* Implementation of PostGIS ST_CollectionExtract() function.
*
* Extracts a specific type from a geometry collection.
* Returns a collection containing only geometries of the specified type.
*
* @see https://postgis.net/docs/ST_CollectionExtract.html
* @since 3.5
*
* @author Martin Georgiev <martin.georgiev@gmail.com>
*
* @example Using it in DQL: "SELECT ST_COLLECTIONEXTRACT(g.geometry, 1) FROM Entity g"
* Returns collection with extracted geometry type.
*/
class ST_CollectionExtract extends BaseFunction
{
protected function customizeFunction(): void
{
$this->setFunctionPrototype('ST_CollectionExtract(%s, %s)');
$this->addNodeMapping('StringPrimary');
$this->addNodeMapping('Literal');
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?php

declare(strict_types=1);

namespace MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\PostGIS;

use MartinGeorgiev\Doctrine\ORM\Query\AST\Functions\BaseFunction;

/**
* Implementation of PostGIS ST_CollectionHomogenize() function.
*
* Homogenizes a geometry collection.
* Returns the simplest representation of the collection.
*
* @see https://postgis.net/docs/ST_CollectionHomogenize.html
* @since 3.5
*
* @author Martin Georgiev <martin.georgiev@gmail.com>
*
* @example Using it in DQL: "SELECT ST_COLLECTIONHOMOGENIZE(g.geometry) FROM Entity g"
* Returns homogenized geometry.
*/
class ST_CollectionHomogenize extends BaseFunction
{
protected function customizeFunction(): void
{
$this->setFunctionPrototype('ST_CollectionHomogenize(%s)');
$this->addNodeMapping('StringPrimary');
}
}
Loading
Loading