1 | <?php |
||
18 | class OutlineMap { |
||
19 | |||
20 | /** |
||
21 | * Name of the file containing the description of the map. |
||
22 | * @var string $filename |
||
23 | */ |
||
24 | protected $filename; |
||
25 | |||
26 | /** |
||
27 | * Indicates whether the description has been loaded from the file. |
||
28 | * @var bool $is_loaded |
||
29 | */ |
||
30 | protected $is_loaded; |
||
31 | |||
32 | /** |
||
33 | * Description/title of the map. |
||
34 | * @var string $description |
||
35 | */ |
||
36 | protected $description; |
||
37 | |||
38 | /** |
||
39 | * Name(s) of the parent level(s) of the map. |
||
40 | * @var string $is_loaded |
||
41 | */ |
||
42 | protected $top_level_name; |
||
43 | |||
44 | /** |
||
45 | * Map canvas |
||
46 | * @var OutlineMapCanvas $canvas |
||
47 | */ |
||
48 | protected $canvas; |
||
49 | |||
50 | /** |
||
51 | * Map subdivisions |
||
52 | * @var array $subdivisions |
||
53 | */ |
||
54 | protected $subdivisions; |
||
55 | |||
56 | /** |
||
57 | * Places mappings |
||
58 | * @var array $subdivisions |
||
59 | */ |
||
60 | protected $mappings; |
||
61 | |||
62 | /** |
||
63 | * Constructor for GeoAnalysisMap. |
||
64 | * |
||
65 | * @param string $filename Outline map file name |
||
66 | * @param bool $load Should the map be loaded immediately |
||
67 | */ |
||
68 | public function __construct($filename, $load = false) { |
||
75 | |||
76 | /** |
||
77 | * Load the map settings contained within its XML representation |
||
78 | * |
||
79 | * XML structure : |
||
80 | * - displayName : Display name of the map |
||
81 | * - topLevel : Values of the top level subdivisions (separated by commas, if multiple) |
||
82 | * - canvas : all settings related to the map canvas. |
||
83 | * - width : canvas width, in px |
||
84 | * - height : canvas height, in px |
||
85 | * - maxcolor : color to identify places with ancestors, RGB hexadecimal |
||
86 | * - hovercolor : same as previous, color when mouse is hovering the place, RGB hexadecimal |
||
87 | * - bgcolor : map background color, RGB hexadecimal |
||
88 | * - bgstroke : map stroke color, RGB hexadecimal |
||
89 | * - defaultcolor : default color of places, RGB hexadecimal |
||
90 | * - defaultstroke : default stroke color, RGB hexadecimal |
||
91 | * - subdvisions : for each subdivision : |
||
92 | * - id : Subdivision id, must be compatible with PHP variable constraints, and unique |
||
93 | * - name: Display name for the place |
||
94 | * - parent: if any, describe to which parent level the place if belonging to |
||
95 | * - <em>Element value<em> : SVG description of the subdvision shape |
||
96 | * - mapping : for each subdivision : |
||
97 | * - name : Name of the place to map |
||
98 | * - mapto: Name of the place to map to |
||
99 | * |
||
100 | */ |
||
101 | protected function load() { |
||
139 | |||
140 | /** |
||
141 | * Get the status of the map loading from the XML file. |
||
142 | * |
||
143 | * @return bool |
||
144 | */ |
||
145 | public function isLoaded() { |
||
152 | |||
153 | /** |
||
154 | * Get the map file name. |
||
155 | * @return string |
||
156 | */ |
||
157 | public function getFileName() { |
||
160 | |||
161 | /** |
||
162 | * Get the map file name. |
||
163 | * @return string |
||
164 | */ |
||
165 | public function getDescription() { |
||
169 | |||
170 | /** |
||
171 | * Get the name of the map parent level. |
||
172 | * @return string |
||
173 | */ |
||
174 | public function getTopLevelName() { |
||
178 | |||
179 | /** |
||
180 | * Get the Outline Map canvas. |
||
181 | * @return \MyArtJaub\Webtrees\Module\GeoDispersion\Model\OutlineMapCanvas |
||
182 | */ |
||
183 | public function getCanvas() { |
||
187 | |||
188 | /** |
||
189 | * Get the subdivisions of the map. |
||
190 | * @return array |
||
191 | */ |
||
192 | public function getSubdivisions() { |
||
196 | |||
197 | /** |
||
198 | * Get the places mappings of the map. |
||
199 | * @return array |
||
200 | */ |
||
201 | public function getPlacesMappings() { |
||
205 | |||
206 | } |
||
207 |