Spatial
extends GBox
in package
BBox en coord. géo., chaque position codée comme [lon, lat]
Par convention, on cherche à respecter: (-180 <= lon <= 180) && (-90 <= lat <= 90) sauf pour les boites à cheval sur l'anti-méridien où: (-180 <= lonmin <= 180 < lonmax <= 180+360 ) Cette convention est différente de celle utilisée par GeoJSON. Toutefois, uGeoJSON génère des bbox avec des coord. qqc, y compris lonmin < -180
Table of Contents
Constants
- CONSTRAINTS = ["les latitudes sont comprises entre -90° et 90°", "la latitude North est supérieure à la latitude South", "les longitudes West et East sont comprises entre -180° et 180° sauf dans l'exception circumnavigateTheEarth", "la longitude East est supérieure à la longitude West sauf dans l'exception astrideTheAntimeridian"]
- Liste des contraintes
- ErrorDistanceOfEmptyGBox = 'GBox::ErrorDistanceOfEmptyGBox'
- ErrorDistOfEmptyGBox = 'GBox::ErrorDistOfEmptyGBox'
- ErrorIncorrectNbOfParams = 'BBox::ErrorIncorrectNbOfParams'
- ErrorIncorrectParams = 'BBox::ErrorIncorrectParams'
- ErrorIncorrectPosTypeInBound = 'BBox::ErrorIncorrectPosTypeInBound'
- ErrorIntersectsWithUndefBBox = 'BBox::ErrorIntersectsWithUndefBBox'
- ErrorParamInConstruct = 'GBox::ErrorParamInConstruct'
- EXCEPTIONS = ['astrideTheAntimeridian' => ["l'exception astrideTheAntimeridian correspond à une boite à cheval sur l'anti-méridien", "sauf dans l'exception circumnavigateTheEarth", "elle est indiquée par la valeur 'astrideTheAntimeridian' dans le champ exception", "dans ce cas East < West mais Spatial::__construct() augmente East de 360° pour que East > West"], 'circumnavigateTheEarth' => ["l'exception circumnavigateTheEarth correspond à une boite couvrant la totalité de la Terre en longitude", "elle est indiquée par la valeur 'circumnavigateTheEarth' dans le champ exception", "dans ce cas (East - West) >= 360 et -180° <= West < 180° < East < 540° (360+180)"]]
- Liste des exceptions
Properties
- $exception : string|null
- $max : TPos
- $min : TPos
- $precision : int
Methods
- __construct() : mixed
- ajoute au mécanisme de création de BBox la possibilité de créer une GBox à partir d'un array respectant le format Spatial défini dans MapCat et shomgt.yaml
- __toString() : string
- affiche la BBox en utilisant le format GeoJSON d'un Bbox avec des coord. arrondies en fonction de la $precision définie dans la classe appelée
- area() : float
- asArray() : array<string, TPos>
- asGeoJsonBbox() : array<int, float>
- renvoie un array de 4 coord [west, south, east, north] avec east < 180 conforme à la structuration dans GeoJSON
- badLats() : string|null
- si les latitudes ne sont pas correctes alors renvoie la raison, sinon renvoie null
- badLons() : string|null
- si les longitudes ne sont pas correctes alors renvoie la raison, sinon renvoie null
- bound() : static
- retourne la BBox contenant à la fois $this et la position
- center() : TPos
- retourne le centre de la BBox ou [] si elle est vide
- constructTest() : void
- dist() : float
- distance la plus courte entre les position des 2 GBox, génère une exception si une des 2 BBox est vide
- distance() : float
- distance entre 2 boites, nulle ssi les 2 boites sont identiques
- distTest() : void
- distVerbose() : float
- dLat() : float|null
- dLon() : float|null
- east() : float|null
- empty() : bool
- renvoit vrai ssi la bbox est vide
- exceptionLons() : string|null
- si $this correspond à une exception alors renvoie son libellé, sinon null
- fromGeoDMd() : self
- maintien de la méthode fromGeoDMd() pour conserver la compatibilité avec le code existant
- includes() : bool
- teste si $small est strictement inclus dans $this
- includesTest() : void
- inters() : bool
- version bouléenne de intersects()
- intersects() : static
- intersection de 2 bbox, si $this intersecte $b2 alors retourne le GBox/EBox d'intersection, sinon retourne null.
- intersectsAntiMeridian() : bool
- Teste l'intersection avec l'AM
- intersectsAntiMeridianTest() : void
- intersectsTest() : void
- intersectsVerbose() : BBox|null
- isBad() : string|null
- si $this n'est pas correct alors renvoie la raison, sinon null
- lgeoJSON() : string
- retourne le code JS génèrant l'objet L.geoJSON
- ne() : TPos
- north() : float|null
- polygon() : TLLPos
- retourne un array d'array avec les 5 positions du polygone de la BBox ou [] si elle est vide
- proj() : EBox
- calcule la projection d'un GBox en utilisant $proj qui doit être défini comme projection dans coordsys
- round() : static
- si $this est indéfini alors le renvoit sinon crée un nouvel objet de la classe appelée avec des coord. arrondies en fonction de la $precision définie dans la classe appelée
- size() : float
- taille max en degrés de longueur constante (Zoom::Size0 / 360) ou rettourne 0 si la BBox est vide
- south() : float|null
- sw() : TPos
- test() : void
- translate360East() : static
- retourne le GBox translaté de 360° vers l'est
- translate360West() : static
- retourne le GBox translaté de 360° vers l'ouest
- union() : static
- Retourne l'union de 2 BBox
- unionVerbose() : BBox
- west() : float|null
- layer() : TGeoJsonFeatureCollection
- génère une FeatureCollection GeoJson contenant le multiPolygone
- multiPolygon() : TGJMultiPolygon
- Retourne la boite comme MultiPolygon GeoJSON avec décomposition en 2 polygones.
- nw() : TPos
- ring() : TLPos
- se() : TPos
Constants
CONSTRAINTS
Liste des contraintes
public
mixed
CONSTRAINTS
= ["les latitudes sont comprises entre -90° et 90°", "la latitude North est supérieure à la latitude South", "les longitudes West et East sont comprises entre -180° et 180° sauf dans l'exception circumnavigateTheEarth", "la longitude East est supérieure à la longitude West sauf dans l'exception astrideTheAntimeridian"]
ErrorDistanceOfEmptyGBox
public
mixed
ErrorDistanceOfEmptyGBox
= 'GBox::ErrorDistanceOfEmptyGBox'
ErrorDistOfEmptyGBox
public
mixed
ErrorDistOfEmptyGBox
= 'GBox::ErrorDistOfEmptyGBox'
ErrorIncorrectNbOfParams
public
mixed
ErrorIncorrectNbOfParams
= 'BBox::ErrorIncorrectNbOfParams'
ErrorIncorrectParams
public
mixed
ErrorIncorrectParams
= 'BBox::ErrorIncorrectParams'
ErrorIncorrectPosTypeInBound
public
mixed
ErrorIncorrectPosTypeInBound
= 'BBox::ErrorIncorrectPosTypeInBound'
ErrorIntersectsWithUndefBBox
public
mixed
ErrorIntersectsWithUndefBBox
= 'BBox::ErrorIntersectsWithUndefBBox'
ErrorParamInConstruct
public
mixed
ErrorParamInConstruct
= 'GBox::ErrorParamInConstruct'
EXCEPTIONS
Liste des exceptions
public
mixed
EXCEPTIONS
= ['astrideTheAntimeridian' => ["l'exception astrideTheAntimeridian correspond à une boite à cheval sur l'anti-méridien", "sauf dans l'exception circumnavigateTheEarth", "elle est indiquée par la valeur 'astrideTheAntimeridian' dans le champ exception", "dans ce cas East < West mais Spatial::__construct() augmente East de 360° pour que East > West"], 'circumnavigateTheEarth' => ["l'exception circumnavigateTheEarth correspond à une boite couvrant la totalité de la Terre en longitude", "elle est indiquée par la valeur 'circumnavigateTheEarth' dans le champ exception", "dans ce cas (East - West) >= 360 et -180° <= West < 180° < East < 540° (360+180)"]]
Properties
$exception read-only
public
string|null
$exception
$max read-only
public
TPos
$max
[number, number] ou [], [] ssi $min == []
$min read-only
public
TPos
$min
[number, number] ou []
$precision
public
static int
$precision
= 6
Methods
__construct()
ajoute au mécanisme de création de BBox la possibilité de créer une GBox à partir d'un array respectant le format Spatial défini dans MapCat et shomgt.yaml
public
__construct([string|TPos|TLPos|TLLPos|array{SW: string, NE: string, exception?: string} $param = [] ]) : mixed
Parameters
- $param : string|TPos|TLPos|TLLPos|array{SW: string, NE: string, exception?: string} = []
__toString()
affiche la BBox en utilisant le format GeoJSON d'un Bbox avec des coord. arrondies en fonction de la $precision définie dans la classe appelée
public
__toString() : string
Return values
stringarea()
public
area() : float
Return values
floatasArray()
public
asArray() : array<string, TPos>
Return values
array<string, TPos>asGeoJsonBbox()
renvoie un array de 4 coord [west, south, east, north] avec east < 180 conforme à la structuration dans GeoJSON
public
asGeoJsonBbox() : array<int, float>
Return values
array<int, float>badLats()
si les latitudes ne sont pas correctes alors renvoie la raison, sinon renvoie null
public
badLats() : string|null
Return values
string|nullbadLons()
si les longitudes ne sont pas correctes alors renvoie la raison, sinon renvoie null
public
badLons() : string|null
Return values
string|nullbound()
retourne la BBox contenant à la fois $this et la position
public
bound(TPos $pos) : static
Parameters
- $pos : TPos
Return values
staticcenter()
retourne le centre de la BBox ou [] si elle est vide
public
center() : TPos
Return values
TPosconstructTest()
public
static constructTest() : void
dist()
distance la plus courte entre les position des 2 GBox, génère une exception si une des 2 BBox est vide
public
dist(GBox $b2) : float
N'est pas une réelle distance entre GBox
Parameters
- $b2 : GBox
Return values
floatdistance()
distance entre 2 boites, nulle ssi les 2 boites sont identiques
public
distance(GBox $b2) : float
Parameters
- $b2 : GBox
Return values
floatdistTest()
public
static distTest() : void
distVerbose()
public
distVerbose(GBox $b2) : float
Parameters
- $b2 : GBox
Return values
floatdLat()
public
dLat() : float|null
Return values
float|nulldLon()
public
dLon() : float|null
Return values
float|nulleast()
public
east() : float|null
Return values
float|nullempty()
renvoit vrai ssi la bbox est vide
public
empty() : bool
Return values
boolexceptionLons()
si $this correspond à une exception alors renvoie son libellé, sinon null
public
exceptionLons() : string|null
Return values
string|nullfromGeoDMd()
maintien de la méthode fromGeoDMd() pour conserver la compatibilité avec le code existant
public
static fromGeoDMd(TMapCatSpatial $spatial) : self
Parameters
- $spatial : TMapCatSpatial
Return values
selfincludes()
teste si $small est strictement inclus dans $this
public
includes(BBox $small[, bool $show = false ]) : bool
Parameters
- $small : BBox
- $show : bool = false
Return values
boolincludesTest()
public
static includesTest() : void
inters()
version bouléenne de intersects()
public
inters(BBox $b2) : bool
Parameters
- $b2 : BBox
Return values
boolintersects()
intersection de 2 bbox, si $this intersecte $b2 alors retourne le GBox/EBox d'intersection, sinon retourne null.
public
intersects(BBox $b2) : static
Parameters
- $b2 : BBox
Return values
staticintersectsAntiMeridian()
Teste l'intersection avec l'AM
public
intersectsAntiMeridian() : bool
Return values
boolintersectsAntiMeridianTest()
public
static intersectsAntiMeridianTest() : void
intersectsTest()
public
static intersectsTest() : void
intersectsVerbose()
public
intersectsVerbose(BBox $b2) : BBox|null
Parameters
- $b2 : BBox
Return values
BBox|nullisBad()
si $this n'est pas correct alors renvoie la raison, sinon null
public
isBad() : string|null
Return values
string|nulllgeoJSON()
retourne le code JS génèrant l'objet L.geoJSON
public
lgeoJSON(array<string, string|int|float> $style, string $popupContent) : string
Parameters
- $style : array<string, string|int|float>
- $popupContent : string
Return values
stringne()
public
ne() : TPos
Return values
TPosnorth()
public
north() : float|null
Return values
float|nullpolygon()
retourne un array d'array avec les 5 positions du polygone de la BBox ou [] si elle est vide
public
polygon() : TLLPos
Return values
TLLPosproj()
calcule la projection d'un GBox en utilisant $proj qui doit être défini comme projection dans coordsys
public
proj(string $proj) : EBox
Parameters
- $proj : string
Return values
EBoxround()
si $this est indéfini alors le renvoit sinon crée un nouvel objet de la classe appelée avec des coord. arrondies en fonction de la $precision définie dans la classe appelée
public
round() : static
Return values
staticsize()
taille max en degrés de longueur constante (Zoom::Size0 / 360) ou rettourne 0 si la BBox est vide
public
size() : float
Return values
floatsouth()
public
south() : float|null
Return values
float|nullsw()
public
sw() : TPos
Return values
TPostest()
public
static test(string $cas) : void
Parameters
- $cas : string
translate360East()
retourne le GBox translaté de 360° vers l'est
public
translate360East() : static
Return values
statictranslate360West()
retourne le GBox translaté de 360° vers l'ouest
public
translate360West() : static
Return values
staticunion()
Retourne l'union de 2 BBox
public
union(BBox $b2) : static
Parameters
- $b2 : BBox
Return values
staticunionVerbose()
public
unionVerbose(BBox $b2) : BBox
Parameters
- $b2 : BBox
Return values
BBoxwest()
public
west() : float|null
Return values
float|nulllayer()
génère une FeatureCollection GeoJson contenant le multiPolygone
private
layer(string $popupContent) : TGeoJsonFeatureCollection
Parameters
- $popupContent : string
Return values
TGeoJsonFeatureCollectionmultiPolygon()
Retourne la boite comme MultiPolygon GeoJSON avec décomposition en 2 polygones.
private
multiPolygon() : TGJMultiPolygon
A linear ring MUST follow the right-hand rule with respect to the area it bounds, i.e., exterior rings are clockwise, and holes are counterclockwise.
Return values
TGJMultiPolygonnw()
private
nw() : TPos
Return values
TPosring()
private
ring() : TLPos
Return values
TLPosse()
private
se() : TPos