Note

The API documentation for this object moved: Factory object.
This page is deprecated, and will be removed.


The Factory object is a workaround solution for creating C++ objects from Javascript when using the QJSEngine (the V8 JS Engine). The Factory object is available in the global scope.

Example:

// old way (using the QScriptEngine as backend
// this is used in all Qt4.x versions of iLand
var map = new Map; // creates a map object
map.paint(0,200); // do something

// new way (using the QJSEngine backend)
// this is used in Qt5 based version of iLand
// the "Factory" object provides a a function to create a map
var qt5_map = Factory.newMap(); 
qt_5map.paint(0,200); // do something

Note that all other functions of the objects are preserved, e.g. the Map object is set to the "standard" stand-grid when initialized (constructor new-method). The same behavior is guaranteed when using the Factory.

Methods

newCSVFile(filename)
creates a new CSVFile object and returns it.

newClimateConverter()
creates new instance of ClimateConverter and returns it.

newMap()
creates new instance of Map and returns it.