1 | <?php |
||
2 | |||
3 | /** |
||
4 | * webtrees-mod-maj-geodata-france: MyArtJaub Geographical data for webtrees - France |
||
5 | * |
||
6 | * @package MyArtJaub\Webtrees\Module\GeoData |
||
7 | * @subpackage France |
||
8 | * @author Jonathan Jaubart <[email protected]> |
||
9 | * @copyright Copyright (c) 2021-2023, Jonathan Jaubart |
||
10 | * @license https://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 |
||
11 | */ |
||
12 | |||
13 | declare(strict_types=1); |
||
14 | |||
15 | namespace MyArtJaub\Webtrees\Module\GeoData\France; |
||
16 | |||
17 | use Fisharebest\Webtrees\I18N; |
||
18 | use Fisharebest\Webtrees\Module\AbstractModule; |
||
19 | use League\Flysystem\Filesystem; |
||
20 | use League\Flysystem\Local\LocalFilesystemAdapter; |
||
21 | use MyArtJaub\Webtrees\Common\GeoDispersion\Maps\SimpleFilesystemMap; |
||
22 | use MyArtJaub\Webtrees\Contracts\GeoDispersion\ModuleMapDefinitionProviderInterface; |
||
23 | use MyArtJaub\Webtrees\Contracts\GeoDispersion\ModulePlaceMapperProviderInterface; |
||
24 | use MyArtJaub\Webtrees\Module\ModuleMyArtJaubInterface; |
||
25 | use MyArtJaub\Webtrees\Module\ModuleMyArtJaubTrait; |
||
26 | use MyArtJaub\Webtrees\Module\GeoData\France\Maps\FranceArrondMunicipaux; |
||
27 | use MyArtJaub\Webtrees\Module\GeoData\France\Maps\FranceCodePostauxLatest; |
||
28 | use MyArtJaub\Webtrees\Module\GeoData\France\Maps\FranceCommunes2011; |
||
29 | use MyArtJaub\Webtrees\Module\GeoData\France\Maps\FranceCommunesLatest; |
||
30 | use MyArtJaub\Webtrees\Module\GeoData\France\PlaceMappers\SimpleFrancePlaceMapper; |
||
31 | |||
32 | /** |
||
33 | * Geographical Data Module - France. |
||
34 | */ |
||
35 | class GeoDataFranceModule extends AbstractModule implements |
||
36 | ModuleMyArtJaubInterface, |
||
37 | ModuleMapDefinitionProviderInterface, |
||
38 | ModulePlaceMapperProviderInterface |
||
39 | { |
||
40 | use ModuleMyArtJaubTrait; |
||
41 | |||
42 | /** |
||
43 | * {@inheritDoc} |
||
44 | * @see \Fisharebest\Webtrees\Module\AbstractModule::title() |
||
45 | */ |
||
46 | public function title(): string |
||
47 | { |
||
48 | return I18N::translate('Geographical data - France'); |
||
49 | } |
||
50 | |||
51 | /** |
||
52 | * {@inheritDoc} |
||
53 | * @see \Fisharebest\Webtrees\Module\AbstractModule::description() |
||
54 | */ |
||
55 | public function description(): string |
||
56 | { |
||
57 | return I18N::translate('Data to be used in geographical data analysis - France'); |
||
58 | } |
||
59 | |||
60 | /** |
||
61 | * {@inheritDoc} |
||
62 | * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleVersion() |
||
63 | */ |
||
64 | public function customModuleVersion(): string |
||
65 | { |
||
66 | return '2.1.1-v.1'; |
||
67 | } |
||
68 | |||
69 | /** |
||
70 | * {@inheritDoc} |
||
71 | * @see \Fisharebest\Webtrees\Module\ModuleCustomInterface::customModuleSupportUrl() |
||
72 | */ |
||
73 | public function customModuleSupportUrl(): string |
||
74 | { |
||
75 | return 'https://github.com/jon48/webtrees-mod-maj-geodata-france'; |
||
76 | } |
||
77 | |||
78 | /** |
||
79 | * {@inheritDoc} |
||
80 | * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\ModuleMapDefinitionProviderInterface::listMapDefinition() |
||
81 | */ |
||
82 | public function listMapDefinition(): array |
||
83 | { |
||
84 | $filesystem = new Filesystem(new LocalFilesystemAdapter($this->resourcesFolder() . 'maps/')); |
||
85 | |||
86 | //phpcs:disable Generic.Files.LineLength.TooLong |
||
87 | return [ |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
88 | new SimpleFilesystemMap( |
||
89 | 'fr-metropole-regions-2016', |
||
90 | I18N::translate('Metropolitan France by region') . ' (2016-)', |
||
91 | $filesystem, |
||
92 | 'metropole-regions-2016.geojson' |
||
93 | ), |
||
94 | new SimpleFilesystemMap( |
||
95 | 'fr-metropole-regions-1970', |
||
96 | I18N::translate('Metropolitan France by region') . ' (1970-2015)', |
||
97 | $filesystem, |
||
98 | 'metropole-regions-1970.geojson' |
||
99 | ), |
||
100 | new SimpleFilesystemMap( |
||
101 | 'fr-metropole-departements', |
||
102 | I18N::translate('Metropolitan France by department'), |
||
103 | $filesystem, |
||
104 | 'metropole-departements.geojson' |
||
105 | ), |
||
106 | new SimpleFilesystemMap( |
||
107 | 'fr-area-aubrac-lot-margeride-planeze-communes', |
||
108 | I18N::translate('%s by municipality', 'Aubrac-Margeride-Planèze-Vallée du Lot') . ' - ' . I18N::translate('Latest'), |
||
109 | $filesystem, |
||
110 | 'areas/aubrac-lot-margeride-planeze/communes-latest.geojson' |
||
111 | ), |
||
112 | new SimpleFilesystemMap( |
||
113 | 'fr-area-aubrac-lot-margeride-planeze-communes-2011', |
||
114 | I18N::translate('%s by municipality', 'Aubrac-Margeride-Planèze-Vallée du Lot') . ' - 2011', |
||
115 | $filesystem, |
||
116 | 'areas/aubrac-lot-margeride-planeze/communes-2011.geojson' |
||
117 | ), |
||
118 | new SimpleFilesystemMap( |
||
119 | 'fr-area-aubrac-lot-margeride-planeze-codespostaux', |
||
120 | I18N::translate('%s by zip code', 'Aubrac-Margeride-Planèze-Vallée du Lot') . ' - ' . I18N::translate('Latest'), |
||
121 | $filesystem, |
||
122 | 'areas/aubrac-lot-margeride-planeze/codespostaux-latest.geojson' |
||
123 | ), |
||
124 | ...FranceCommunesLatest::listMapDefinition($filesystem), |
||
125 | ...FranceCommunes2011::listMapDefinition($filesystem), |
||
126 | ...FranceCodePostauxLatest::listMapDefinition($filesystem), |
||
127 | ...FranceArrondMunicipaux::listMapDefinition($filesystem) |
||
128 | ]; |
||
129 | //phpcs:enable |
||
130 | } |
||
131 | |||
132 | /** |
||
133 | * {@inheritDoc} |
||
134 | * @see \MyArtJaub\Webtrees\Contracts\GeoDispersion\ModulePlaceMapperProviderInterface::listPlaceMappers() |
||
135 | */ |
||
136 | public function listPlaceMappers(): array |
||
137 | { |
||
138 | return [ |
||
139 | SimpleFrancePlaceMapper::class |
||
140 | ]; |
||
141 | } |
||
142 | } |
||
143 |