src/Webtrees/Module/GeoDispersion/Model/OutlineMap.php
protected function load() {
        if(file_exists(WT_ROOT.WT_MODULES_DIR.Constants::MODULE_MAJ_GEODISP_NAME.'/maps/'.$this->filename)){
            $xml = simplexml_load_file(WT_ROOT.WT_MODULES_DIR.Constants::MODULE_MAJ_GEODISP_NAME.'/maps/'.$this->filename);
            if($xml){
                $this->description = trim($xml->displayName);
                $this->top_level_name = trim($xml->topLevel);
                $this->canvas = new OutlineMapCanvas(
                    trim($xml->canvas->width),
                    trim($xml->canvas->height), 
                    trim($xml->canvas->maxcolor), 
                    trim($xml->canvas->hovercolor), 
                    trim($xml->canvas->bgcolor),
                    trim($xml->canvas->bgstroke),
                    trim($xml->canvas->defaultcolor), 
                    trim($xml->canvas->defaultstroke)
                );
                foreach($xml->subdivisions->children() as $subdivision){
                    $attributes = $subdivision->attributes();
                    $key = I18N::strtolower(trim($attributes['name']));
                    if(isset($attributes['parent'])) $key .= '@'. I18N::strtolower(trim($attributes['parent']));
                    $this->subdivisions[$key] = array(
                        'id' => trim($attributes['id']),
                        'displayname' => trim($attributes['name']),
                        'coord' => trim($subdivision[0])
                    );
                }
                if(isset($xml->mappings)) {
                    foreach($xml->mappings->children() as $mappings){
                        $attributes = $mappings->attributes();
                        $this->mappings[I18N::strtolower(trim($attributes['name']))] = I18N::strtolower(trim($attributes['mapto']));
                    }
                }
                $this->is_loaded = true;
                return;
            }
        }
        throw new \Exception('The Outline Map could not be loaded from XML.');
    }
protected function load() {
        if(file_exists(WT_ROOT.WT_MODULES_DIR.Constants::MODULE_MAJ_GEODISP_NAME.'/maps/'.$this->filename)){
            $xml = simplexml_load_file(WT_ROOT.WT_MODULES_DIR.Constants::MODULE_MAJ_GEODISP_NAME.'/maps/'.$this->filename);
            if($xml){
                $this->description = trim($xml->displayName);
                $this->top_level_name = trim($xml->topLevel);
                $this->canvas = new OutlineMapCanvas(
                    trim($xml->canvas->width),
                    trim($xml->canvas->height), 
                    trim($xml->canvas->maxcolor), 
                    trim($xml->canvas->hovercolor), 
                    trim($xml->canvas->bgcolor),
                    trim($xml->canvas->bgstroke),
                    trim($xml->canvas->defaultcolor), 
                    trim($xml->canvas->defaultstroke)
                );
                foreach($xml->subdivisions->children() as $subdivision){
                    $attributes = $subdivision->attributes();
                    $key = I18N::strtolower(trim($attributes['name']));
                    if(isset($attributes['parent'])) $key .= '@'. I18N::strtolower(trim($attributes['parent']));
                    $this->subdivisions[$key] = array(
                        'id' => trim($attributes['id']),
                        'displayname' => trim($attributes['name']),
                        'coord' => trim($subdivision[0])
                    );
                }
                if(isset($xml->mappings)) {
                    foreach($xml->mappings->children() as $mappings){
                        $attributes = $mappings->attributes();
                        $this->mappings[I18N::strtolower(trim($attributes['name']))] = I18N::strtolower(trim($attributes['mapto']));
                    }
                }
                $this->is_loaded = true;
                return;
            }
        }
        throw new \Exception('The Outline Map could not be loaded from XML.');
    }
protected function load ( ) { if ( file_exists ( WT_ROOT . WT_MODULES_DIR . Constants :: MODULE_MAJ_GEODISP_NAME . '/maps/' . $ this -> filename ) ) { $ xml = simplexml_load_file ( WT_ROOT . WT_MODULES_DIR . Constants :: MODULE_MAJ_GEODISP_NAME . '/maps/' . $ this -> filename ) ; if ( $ xml ) { $ this -> description = trim ( $ xml -> displayName ) ; $ this -> top_level_name = trim ( $ xml -> topLevel ) ; $ this -> canvas = new OutlineMapCanvas ( trim ( $ xml -> canvas -> width ) , trim ( $ xml -> canvas -> height ) , trim ( $ xml -> canvas -> maxcolor ) , trim ( $ xml -> canvas -> hovercolor ) , trim ( $ xml -> canvas -> bgcolor ) , trim ( $ xml -> canvas -> bgstroke ) , trim ( $ xml -> canvas -> defaultcolor ) , trim ( $ xml -> canvas -> defaultstroke ) ) ; foreach ( $ xml -> subdivisions -> children ( ) as $ subdivision ) { $ attributes = $ subdivision -> attributes ( ) ; $ key = I18N :: strtolower ( trim ( $ attributes [ 'name' ] ) ) ; if ( isset ( $ attributes [ 'parent' ] ) ) $ key .= '@' . I18N :: strtolower ( trim ( $ attributes [ 'parent' ] ) ) ; $ this -> subdivisions [ $ key ] = array ( 'id' => trim ( $ attributes [ 'id' ] ) , 'displayname' => trim ( $ attributes [ 'name' ] ) , 'coord' => trim ( $ subdivision [ 0 ] ) ) ; } if ( isset ( $ xml -> mappings ) ) { foreach ( $ xml -> mappings -> children ( ) as $ mappings ) { $ attributes = $ mappings -> attributes ( ) ; $ this -> mappings [ I18N :: strtolower ( trim ( $ attributes [ 'name' ] ) ) ] = I18N :: strtolower ( trim ( $ attributes [ 'mapto' ] ) ) ; } } $ this -> is_loaded = true ; return ; } } throw new \ Exception ( 'The Outline Map could not be loaded from XML.' ) ; }
Load the map settings contained within its XML representation

XML structure :
- displayName : Display name of the map
- topLevel : Values of the top level subdivisions (separated by commas, if multiple)
- canvas : all settings related to the map canvas.
- width : canvas width, in px
- height : canvas height, in px
- maxcolor : color to identify places with ancestors, RGB hexadecimal
- hovercolor : same as previous, color when mouse is hovering the place, RGB hexadecimal
- bgcolor : map background color, RGB hexadecimal
- bgstroke : map stroke color, RGB hexadecimal
- defaultcolor : default color of places, RGB hexadecimal
- defaultstroke : default stroke color, RGB hexadecimal
- subdvisions : for each subdivision :
- id : Subdivision id, must be compatible with PHP variable constraints, and unique
- name: Display name for the place
- parent: if any, describe to which parent level the place if belonging to
- <em>Element value<em> : SVG description of the subdvision shape
- mapping : for each subdivision :
- name : Name of the place to map
- mapto: Name of the place to map to
Load the map settings contained within its XML representation