phpDocumentor

GBoxBo extends GBox
in package

Ajout de fonctionnalités à \gegeom\GBox

Par convention, on cherche à respecter: (-180 <= lon <= 180) && (-90 <= lat <= 90) sauf pour les boites à cheval sur l'antiméridien où: (-180 <= lonmin <= 180 < lonmax <= 180+360 ) et sauf pour les boites qui couvrent la totalité de la Terre en longitude. 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

J'ajoute à GBox la possibilité de création à partir du polygone GeoJSON dans wgs84extent

Je considère au final qu'un GBox standardisé respecte les 2 contraintes ci-dessus.

On essaie ici de réutiliser \gegeom\GBox et \gegeom\EBox en en créant des sous-classes GBox et EBox pour leur ajouter des fonctionalités. Pour cela les règles à respecter sont le suivantes:

  • ne pas redéfinir __construct() avec une signature incompatible avec celle du parent car certaines méthodes comme BBox::round() par exemple utilisent le __construct() de ses enfants.
    • la signature peut par contre être étendue à de nouvelles possibilités
  • redéfinir les méthodes comme EBox::geo() car j'ai besoin qu'elle renvoie un GBox

Table of Contents

Constants

ErrorDistanceOfEmptyGBox  = 'GBox::ErrorDistanceOfEmptyGBox'
ErrorDistOfEmptyGBox  = 'GBox::ErrorDistOfEmptyGBox'
ErrorIncorrectNbOfParams  = 'BBox::ErrorIncorrectNbOfParams'
ErrorIncorrectParams  = 'BBox::ErrorIncorrectParams'
ErrorIncorrectPosTypeInBound  = 'BBox::ErrorIncorrectPosTypeInBound'
ErrorIntersectsWithUndefBBox  = 'BBox::ErrorIntersectsWithUndefBBox'
ErrorParamInConstruct  = 'GBox::ErrorParamInConstruct'

Properties

$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
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
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
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
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
std()  : self
standardisation, cad respectant les conventions
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

Constants

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'

Properties

$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|TGJPolygon $param = [] ]) : mixed
Parameters
$param : string|TPos|TLPos|TLLPos|TGJPolygon = []

__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
string

asArray()

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>

bound()

retourne la BBox contenant à la fois $this et la position

public bound(TPos $pos) : static
Parameters
$pos : TPos
Return values
static

center()

retourne le centre de la BBox ou [] si elle est vide

public center() : TPos
Return values
TPos

constructTest()

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
float

distance()

distance entre 2 boites, nulle ssi les 2 boites sont identiques

public distance(GBox $b2) : float
Parameters
$b2 : GBox
Return values
float

distVerbose()

public distVerbose(GBox $b2) : float
Parameters
$b2 : GBox
Return values
float

dLat()

public dLat() : float|null
Return values
float|null

dLon()

public dLon() : float|null
Return values
float|null

east()

public east() : float|null
Return values
float|null

empty()

renvoit vrai ssi la bbox est vide

public empty() : bool
Return values
bool

fromGeoDMd()

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
self

includes()

teste si $small est strictement inclus dans $this

public includes(BBox $small[, bool $show = false ]) : bool
Parameters
$small : BBox
$show : bool = false
Return values
bool

includesTest()

public static includesTest() : void

inters()

version bouléenne de intersects()

public inters(BBox $b2) : bool
Parameters
$b2 : BBox
Return values
bool

intersects()

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
static

intersectsAntiMeridian()

Teste l'intersection avec l'AM

public intersectsAntiMeridian() : bool
Return values
bool

intersectsAntiMeridianTest()

public static intersectsAntiMeridianTest() : void

intersectsTest()

public static intersectsTest() : void

north()

public north() : float|null
Return values
float|null

polygon()

retourne un array d'array avec les 5 positions du polygone de la BBox ou [] si elle est vide

public polygon() : TLLPos
Return values
TLLPos

proj()

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
EBox

round()

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
static

size()

taille max en degrés de longueur constante (Zoom::Size0 / 360) ou rettourne 0 si la BBox est vide

public size() : float
Return values
float

south()

public south() : float|null
Return values
float|null

std()

standardisation, cad respectant les conventions

public std() : self
Return values
self

translate360East()

retourne le GBox translaté de 360° vers l'est

public translate360East() : static
Return values
static

translate360West()

retourne le GBox translaté de 360° vers l'ouest

public translate360West() : static
Return values
static

union()

Retourne l'union de 2 BBox

public union(BBox $b2) : static
Parameters
$b2 : BBox
Return values
static

west()

public west() : float|null
Return values
float|null

        
On this page

Search results