This retains a compact reference copy of each polygon in the decoded GeoJSON. More...
Public Member Functions | |
| casesForLargest (int $count, float $distanceKm=5.0) | |
| This generates boundary and interior tests for the largest polygons. | |
| largest (int $count) | |
| This selects the most detailed polygons, using exterior-ring point counts. | |
| observe (array $feature) | |
| This records the polygons from one decoded GeoJSON Feature. | |
| validateStorage (PDO $connection) | |
| This compares every stored polygon with its decoded source record. | |
| zonesAt (float $lng, float $lat) | |
| This finds all acceptable time zone names at a point, using the source geometry. | |
Static Public Member Functions | |
| static | contains (array $shape, float $lng, float $lat) |
| This checks a point against a complete source polygon, including its holes. | |
| static | ringContains (string $ring, float $lng, float $lat) |
| This checks a point against one reference ring, using horizontal ray casting. | |
Public Attributes | |
| int | $polygonBytes |
| This is the total expected size, in bytes, of the stored exterior-ring polygon data. | |
| array | $shapes |
| These are the source polygon records, keyed by their expected database row IDs. | |
| int | $vertices |
| This is the total number of exterior-ring points, including repeated closing points. | |
A shape corresponds to one Polygon, or one member of a MultiPolygon. Rings are packed as native doubles, in longitude/latitude order, rounded to six decimal places. The first ring is the exterior; remaining rings are holes. Storage validation checks the package's documented exterior-ring encoding. Lookup expectations also account for the holes, using horizontal ray casting instead of the package's vertical winding-number test.
Definition at line 45 of file SystemTests.php.
| DemoSourceGeometry::casesForLargest | ( | int | $count, |
| float | $distanceKm = 5.0 ) |
Boundary samples are spread around each exterior ring, with additional samples next to decoding-block transitions and the closing edge. For each usable edge, we offset a point to each side by approximately the requested distance. The local conversion adjusts longitude distance for latitude. Degenerate edges, edges crossing the date line, and offsets too close to a pole are skipped.
We also select up to three interior points from a small grid over the domain rect. All expected names come from zonesAt(), using the complete source collection. A narrow or winding boundary may put both offset points in the same zone; the report counts actual crossings separately.
| $count | The positive number of largest polygons to test. |
| $distanceKm | Approximate distance from each boundary, in kilometers. |
Definition at line 280 of file SystemTests.php.
References $cases, $vertices, largest(), and zonesAt().
|
static |
The source domain rect rejects obvious misses. A remaining point must be inside the exterior ring and outside every hole. This preserves the GeoJSON reference even when a package implementation does not store holes.
| $shape | A source shape record, including bounds and rings. |
| $lng | The point's longitude, in degrees. |
| $lat | The point's latitude, in degrees. |
Definition at line 177 of file SystemTests.php.
| DemoSourceGeometry::largest | ( | int | $count | ) |
"Largest" means the most points to decode, rather than the greatest geographic area. Equal counts are ordered by row ID, so the selection is repeatable for a given boundary release.
| $count | The positive number of polygons to select. |
Definition at line 124 of file SystemTests.php.
References $shapes.
Referenced by casesForLargest().
| DemoSourceGeometry::observe | ( | array | $feature | ) |
MultiPolygons are separated into individual records, in the same source order used by the package loader. We retain holes for the independent geographic reference, and compute exterior-ring hashes for storage checks.
| RuntimeException | if the geometry type, coordinate dimensions, or polygon contents are unsupported. |
| $feature | The decoded Feature, with properties.tzid and geometry.coordinates. |
Definition at line 71 of file SystemTests.php.
|
static |
We decode points in bounded blocks and carry the previous point across blocks. The last point is joined to the first, so a closing point need not be duplicated. Ring orientation does not change the result. Generated boundary probes are placed away from the boundary, where an exact edge/vertex result could be ambiguous.
| $ring | Packed longitude/latitude pairs, using native doubles. |
| $lng | The point's longitude, in degrees. |
| $lat | The point's latitude, in degrees. |
Definition at line 141 of file SystemTests.php.
| DemoSourceGeometry::validateStorage | ( | PDO | $connection | ) |
We check row counts, names, exterior-ring byte lengths and SHA-256 hashes. Domain rect coordinates allow a small tolerance for the schema's single-precision storage. Hashes are calculated by the database server, avoiding the memory cost of fetching all stored polygon blobs into PHP again.
| PDOException | if the validation query fails. |
| $connection | A PDO connection to this run's temporary database. |
Definition at line 237 of file SystemTests.php.
References $connection, $failures, and $rows.
| DemoSourceGeometry::zonesAt | ( | float | $lng, |
| float | $lat ) |
Named zones take precedence over Etc/ ocean zones. More than one named zone may contain a point where source polygons overlap; any of those names is a valid generated expectation. No package lookup is performed.
| $lng | The point's longitude, in degrees. |
| $lat | The point's latitude, in degrees. |
Definition at line 202 of file SystemTests.php.
Referenced by casesForLargest().
| int DemoSourceGeometry::$polygonBytes |
Definition at line 60 of file SystemTests.php.
| array DemoSourceGeometry::$shapes |
Each record contains id, tzname, rings, bounds, vertices, bytes, and sha256. The bounds come from the source's exterior ring. vertices, bytes, and sha256 describe the exterior ring that the package stores in its polygon column. Records follow source traversal order, matching a newly initialized table's auto-increment IDs.
Definition at line 54 of file SystemTests.php.
Referenced by largest().
| int DemoSourceGeometry::$vertices |
Definition at line 57 of file SystemTests.php.
Referenced by casesForLargest().