SceneIndex
in package
Geo scene class
This class provides an index of available scene template files.
Table of Contents
Properties
- $directory : string
- The directory where templates are stored
- $global_templates : array<string|int, mixed>
- Global location templates array
- $instance : array<string|int, mixed>
- The current index instance array
- $local_templates : array<string|int, mixed>
- Local location templates 2D array
- $updated : int
- Time of the last updated file in the scenes directory
Methods
- __construct() : mixed
- Initializes a new SceneIndex instance
- get_cached_information() : mixed
- Gets index from cache
- get_global_template() : string
- Gets global template file from index
- get_local_template() : string
- Gets local template file from index
- is_up_to_date() : bool
- Determines if the information is still up to date
- load() : index
- Gets the index instance, initializing it if needed
- refresh_information() : mixed
- Reads scene templates and indexes information
- set_cached_information() : mixed
- Caches index data
- get_template_location() : array<string|int, mixed>
- Gets template location
Properties
$directory
The directory where templates are stored
public
string
$directory
$global_templates
Global location templates array
public
array<string|int, mixed>
$global_templates
Keys are global location codes. Values the relevant template file.
$instance
The current index instance array
public
static array<string|int, mixed>
$instance
= []
Keys are scene directories (string) Items are SceneIndex instances
$local_templates
Local location templates 2D array
public
array<string|int, mixed>
$local_templates
Keys are global and local location codes. Values the srelevant template file.
e.g. $local_templates['B00017001']['(10, 50, 8)'] => 'B00017_port.tpl'
$updated
Time of the last updated file in the scenes directory
public
int
$updated
Methods
__construct()
Initializes a new SceneIndex instance
public
__construct(string $directory) : mixed
Parameters
- $directory : string
-
the scene templates directory
get_cached_information()
Gets index from cache
public
get_cached_information() : mixed
get_global_template()
Gets global template file from index
public
get_global_template(string $location_global) : string
Parameters
- $location_global : string
-
the global location
Return values
string —the relevant template scene file, or NULL if not existing
get_local_template()
Gets local template file from index
public
get_local_template(string $location_global, mixed $location_local) : string
Parameters
- $location_global : string
-
the local location
- $location_local : mixed
Return values
string —the relevant template scene file, or NULL if not existing
is_up_to_date()
Determines if the information is still up to date
public
is_up_to_date() : bool
Return values
bool —true if the information is up to date ; otherwise, false.
load()
Gets the index instance, initializing it if needed
public
static load(mixed $directory) : index
Parameters
- $directory : mixed
Return values
index —the index instance
refresh_information()
Reads scene templates and indexes information
public
refresh_information() : mixed
set_cached_information()
Caches index data
public
set_cached_information() : mixed
get_template_location()
Gets template location
private
static get_template_location(mixed $template) : array<string|int, mixed>
Parameters
- $template : mixed
Return values
array<string|int, mixed> —an string array of the location (two items; global, local) At key 0, a string with global location, or NULL if not specified At key 1, a string with local location, or NULL if not specified