Class: Factory
NOTE: The Factory is no longer necessary, and its use is deprecated!
To create an object in Javascript, you can use the standard Javascript operator new:
Examples
// Create a instance of a Map object
var map = new Map;
// now you are good to use the objects properties and methods
console.log(map.name); // print the name of the stand grid fileThe Factory is a helper object for the creation of other iLand script objects such as a Map.
Technically, the Factorycan instantiate objects of other C++ (QObject-based) types. This factory approach is used because the V8 (QJSEngine) had limitations with regard to the new operator of Javascript. Now (with version Qt6, and likely also some versions before) the proper use of new is possible again.
Methods Overview
| Method | Return Type | Description |
|---|---|---|
newCSVFile(file_name) |
object |
Create an instance of a CSVFile, a convenience class for reading and processing |
newClimateConverter() |
object |
Create an instance of a ClimateConverter (see https://iland-model.org/Object+ClimateConverter). |
newGrid() |
object |
Create an instance of a Grid. Initially, the grid is empty. |
newMap() |
object |
Create an instance of a Map, a wrapper for a GIS raster file. |
Methods Details
newCSVFile(file_name)
Returns: object
Create an instance of a CSVFile, a convenience class for reading and processing
tabular data.Parameters:
file_name(string): The file to load with @return {object} A Javascript CSVFile object
Return Value Description: A Javascript CSVFile object
newClimateConverter()
Returns: object
Create an instance of a ClimateConverter (see https://iland-model.org/Object+ClimateConverter).
Return Value Description: A Javascript ClimateConverter object
newGrid()
Returns: object
Create an instance of a Grid. Initially, the grid is empty.
Return Value Description: A Javascript Grid object
newMap()
Returns: object
Create an instance of a Map, a wrapper for a GIS raster file.
Return Value Description: A Javascript Map object