├── .gitignore
├── src
├── Coordinates.php
├── GeometryType.php
├── Dimension.php
├── Extractor.php
└── Factory.php
├── psalm.xml
├── phpunit.xml.dist
├── tests
├── DimensionTest.php
├── CoordinatesTest.php
└── GeometryTypeTest.php
├── composer.json
├── LICENSE
├── .php-cs-fixer.dist.php
├── .github
└── workflows
│ ├── static.yml
│ └── ci.yml
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | /build
2 | /vendor
3 | .php-cs-fixer.php
4 | .php-cs-fixer.cache
5 | .phpunit.result.cache
6 | composer.lock
7 | phpunit.xml
8 |
--------------------------------------------------------------------------------
/src/Coordinates.php:
--------------------------------------------------------------------------------
1 |
2 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/phpunit.xml.dist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
9 |
10 |
11 | ./tests/
12 |
13 |
14 |
15 |
16 |
17 | ./src/
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/src/Dimension.php:
--------------------------------------------------------------------------------
1 | assertTrue(true);
19 | }
20 |
21 | public function provideDimensions(): iterable
22 | {
23 | yield ['2D'];
24 | yield ['3DZ'];
25 | yield ['3DM'];
26 | yield ['4D'];
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/tests/CoordinatesTest.php:
--------------------------------------------------------------------------------
1 | assertEquals(1, $coordinates->x);
21 | $this->assertEquals(2, $coordinates->y);
22 | $this->assertEquals(3, $coordinates->z);
23 | $this->assertEquals(4, $coordinates->m);
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/tests/GeometryTypeTest.php:
--------------------------------------------------------------------------------
1 | assertTrue(true);
19 | }
20 |
21 | public function provideGeometryTypes(): iterable
22 | {
23 | yield ['Point'];
24 | yield ['LineString'];
25 | yield ['Polygon'];
26 | yield ['MultiPoint'];
27 | yield ['MultiLineString'];
28 | yield ['MultiPolygon'];
29 | yield ['GeometryCollection'];
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "geo-io/interface",
3 | "description": "Geo I/O base interfaces.",
4 | "keywords": [
5 | "geo",
6 | "io",
7 | "geometry"
8 | ],
9 | "license": "MIT",
10 | "authors": [
11 | {
12 | "name": "Jan Sorgalla",
13 | "email": "jsorgalla@gmail.com"
14 | }
15 | ],
16 | "require": {
17 | "php": "^8.1"
18 | },
19 | "require-dev": {
20 | "friendsofphp/php-cs-fixer": "^3.1",
21 | "vimeo/psalm": "^4.10",
22 | "phpunit/phpunit": "^9.5"
23 | },
24 | "autoload": {
25 | "psr-4": {
26 | "GeoIO\\": "src/"
27 | }
28 | },
29 | "autoload-dev": {
30 | "psr-4": {
31 | "GeoIO\\": "tests/"
32 | }
33 | },
34 | "extra": {
35 | "branch-alias": {
36 | "dev-main": "2.x-dev"
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Copyright (c) 2014-2022 Jan Sorgalla
2 |
3 | Permission is hereby granted, free of charge, to any person obtaining a copy
4 | of this software and associated documentation files (the "Software"), to deal
5 | in the Software without restriction, including without limitation the rights
6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7 | copies of the Software, and to permit persons to whom the Software is furnished
8 | to do so, subject to the following conditions:
9 |
10 | The above copyright notice and this permission notice shall be included in all
11 | copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19 | THE SOFTWARE.
20 |
--------------------------------------------------------------------------------
/.php-cs-fixer.dist.php:
--------------------------------------------------------------------------------
1 | in(__DIR__);
5 |
6 | return (new PhpCsFixer\Config())
7 | ->setRiskyAllowed(true)
8 | ->setRules([
9 | '@Symfony' => true,
10 | '@Symfony:risky' => true,
11 | 'array_syntax' => [
12 | 'syntax' => 'short',
13 | ],
14 | 'concat_space' => [
15 | 'spacing' => 'one',
16 | ],
17 | 'declare_strict_types' => true,
18 | 'global_namespace_import' => [
19 | 'import_classes' => true,
20 | 'import_constants' => null,
21 | 'import_functions' => true,
22 | ],
23 | 'native_constant_invocation' => [
24 | 'fix_built_in' => false,
25 | ],
26 | 'ordered_imports' => [
27 | 'imports_order' => [
28 | 'class',
29 | 'function',
30 | 'const',
31 | ],
32 | ],
33 | 'single_line_throw' => false,
34 | 'trailing_comma_in_multiline' => [
35 | 'after_heredoc' => true,
36 | 'elements' => ['arrays', 'arguments', 'parameters'],
37 | ],
38 | ])
39 | ->setFinder($finder);
40 |
--------------------------------------------------------------------------------
/.github/workflows/static.yml:
--------------------------------------------------------------------------------
1 | name: Static analysis
2 |
3 | on:
4 | push:
5 | pull_request:
6 |
7 | jobs:
8 | php-cs-fixer:
9 | name: PHP-CS-Fixer
10 | runs-on: ubuntu-latest
11 |
12 | steps:
13 | - name: Checkout code
14 | uses: actions/checkout@v2
15 |
16 | - name: Setup PHP
17 | uses: shivammathur/setup-php@v2
18 | with:
19 | php-version: '8.1'
20 | coverage: none
21 | extensions: mbstring
22 | tools: 'cs2pr'
23 |
24 | - name: Install dependencies
25 | run: composer update --no-interaction --no-progress --prefer-dist
26 |
27 | - name: Run PHP CS Fixer
28 | run: vendor/bin/php-cs-fixer fix --dry-run --format=checkstyle | cs2pr
29 |
30 | psalm:
31 | name: Psalm
32 | runs-on: ubuntu-latest
33 |
34 | steps:
35 | - name: Checkout code
36 | uses: actions/checkout@v2
37 |
38 | - name: Setup PHP
39 | uses: shivammathur/setup-php@v2
40 | with:
41 | php-version: '8.1'
42 | coverage: none
43 | extensions: mbstring, intl
44 |
45 | - name: Install dependencies
46 | run: composer update --no-interaction --no-progress --prefer-dist
47 |
48 | - name: Run Psalm
49 | run: vendor/bin/psalm --no-progress --output-format=github
50 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 |
3 | on:
4 | push:
5 | pull_request:
6 |
7 | jobs:
8 | tests:
9 | name: Tests (PHP ${{ matrix.php }})
10 | runs-on: ubuntu-latest
11 | strategy:
12 | matrix:
13 | include:
14 | - php: '8.1'
15 | code-coverage: 'yes'
16 |
17 | steps:
18 | - name: Checkout code
19 | uses: actions/checkout@v2
20 |
21 | - name: Setup PHP
22 | uses: shivammathur/setup-php@v2
23 | with:
24 | php-version: ${{ matrix.php }}
25 | coverage: pcov
26 |
27 | - name: Install dependencies
28 | run: |
29 | composer update --no-interaction --no-progress --prefer-dist ${{ matrix.composer-flags }}
30 |
31 | - name: Run tests
32 | if: matrix.code-coverage != 'yes'
33 | run: vendor/bin/phpunit
34 |
35 | - name: Run tests with code coverage
36 | if: matrix.code-coverage == 'yes'
37 | run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml
38 |
39 | - name: Upload coverage results to Coveralls
40 | if: matrix.code-coverage == 'yes'
41 | env:
42 | COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43 | run: |
44 | composer global require php-coveralls/php-coveralls
45 | php-coveralls -v --coverage_clover=build/logs/clover.xml
46 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Geo I/O Interface
2 | ==
3 |
4 | [](https://github.com/geo-io/interface/actions/workflows/ci.yml)
5 | [](https://coveralls.io/github/geo-io/interface?branch=main)
6 |
7 | Geo I/O base interfaces, enums and value objects.
8 |
9 | * [Installation](#installation)
10 | * [Interfaces](#interfaces)
11 | * [Factory](#factory)
12 | * [Extractor](#extractor)
13 | * [Enums](#enums)
14 | * [Dimension](#dimension)
15 | * [GeometryType](#geometrytype)
16 | * [Value Objects](#value-objects)
17 | * [Coordinates](#Coordinates)
18 |
19 | Installation
20 | --
21 |
22 | Install [through composer](http://getcomposer.org). Check the
23 | [packagist page](https://packagist.org/packages/geo-io/interface) for all
24 | available versions.
25 |
26 | ```bash
27 | composer require geo-io/interface
28 | ```
29 |
30 | Interfaces
31 | --
32 |
33 | ### Factory
34 |
35 | This [interface](src/Factory.php) is used by the Geo I/O parser implementations
36 | to create the actual geometric objects from the parsed representations.
37 |
38 | #### Implementations
39 |
40 | * [Geo I/O Geometry](https://github.com/geo-io/geometry)
41 | * [Geo I/O GeoJSON](https://github.com/geo-io/geojson)
42 |
43 | ### Extractor
44 |
45 | This [interface](src/Extractor.php) is used by the Geo I/O generator
46 | implementations to extract data from geometric objects for the generated
47 | geometric representations.
48 |
49 | * [Geo I/O Geometry](https://github.com/geo-io/geometry)
50 | * [Geo I/O GeoJSON](https://github.com/geo-io/geojson)
51 |
52 | Enums
53 | --
54 |
55 | ### Dimension
56 |
57 | This [enum](src/Dimension.php) provides constants to define the dimension of
58 | geometric objects.
59 |
60 | ### GeometryType
61 |
62 | This [enum](src/GeometryType.php) provides constants to define the type of
63 | geometric objects.
64 |
65 | Value Objects
66 | --
67 |
68 | ### Coordinates
69 |
70 | This [class](src/Coordinates.php) represents coordinates with `x`, `y` and
71 | optional `z` and `m` properties.
72 |
73 | License
74 | --
75 |
76 | Copyright (c) 2014-2022 Jan Sorgalla. Released under the [MIT License](LICENSE).
77 |
--------------------------------------------------------------------------------
/src/Extractor.php:
--------------------------------------------------------------------------------
1 |