Aimsun Next Scripting
22
|
Public Types | |
enum | Type { Invalid , Map , List , String , StringList , Font , Pixmap , Brush , Rect , Size , Color , Palette , ColorGroup , IconSet , Point , Image , Int , UInt , Bool , Double , CString , PointArray , Region , Bitmap , Cursor , SizePolicy , Date , Time , DateTime , ByteArray , _GKObject , _GKTimeSerie , _GKEnum } |
enum | GKColumnType { eExternalTemporary , eInternal , eExternal , ePython , eC } |
enum | GKColumnNameFormat { eLongFormat , eMediumFormat , eShortFormat } |
Public Member Functions | |
GKColumn () | |
void | setExternalName (const QString &) |
QString | getExternalName (GKColumnNameFormat format=eLongFormat) const |
void | setId (uint aid) |
uint | getId () const |
void | setName (const QString &) |
const QString & | getName () const |
GKType * | getType () const |
void | setType (GKType *) |
GKObject * | getOriginator () const |
int | getOriginatorId () const |
const GKContents & | getContents () const |
const GKColumn::Type | getColumnType () const |
void | setColumnType (const GKColumn::Type) |
bool | hasNumericValues () const |
const QString & | getDescription () const |
void | setDescription (const QString &) |
bool | isEditable () const |
void | setEditable (bool) |
bool | isOverridable () const |
void | setOverridable (bool value) |
const GKColumnType | getStoreType () const |
void | setStoreType (const GKColumnType) |
void | setObjectType (const QString &typeName) |
GKType * | getObjectType () const |
GKTSDescription * | getTSDescription () const |
void | setTSDescription (GKTSDescription *ts) |
void | setEnumString (int, const QString &) |
QString | getEnumString (double) const |
bool | anyEnumString () const |
void | setDynamic (bool) |
bool | isDynamic () const |
void | setRealColumn (GKColumn *) |
GKColumn * | getRealColumn () const |
void | setConversion (const GK::Conversion, QString=QString(), QString=QString()) |
const GK::Conversion | getConversion () const |
QString | getConversionName (const GK::UnitSystem &units) const |
QString | getConversionNameTranslated (const GK::UnitSystem &units) const |
double | getValueToGui (const GK::UnitSystem &, double) const |
double | getValueFromGui (const GK::UnitSystem &, double) const |
void | setPythonCode (const QString &) |
const QString & | getPythonCode () const |
void * | getPythonFunction () const |
bool | getUsableInStyle () const |
void | setUsableInStyle (bool value) |
Static Public Member Functions | |
static QString | getColumnTypeName (const GKColumn::Type &) |
static QString | getStoreTypeName (const GKColumn::GKColumnType &) |
Static Public Attributes | |
static const int | eLastGenerated |
The GKColumn hold information for one attribute of a type. It keeps the attribute type (integer, double, string,...) the name (both internal and external) and how to manage it when an instance of a class that uses this attribute is created (store type, see GKColumn::GKColumnType).
An attribute instance is, in fact, a QVariant or QVariant derivate, so it can hold the same value types as QVariant. Aimsun adds some extra types to manage the following information:
- _GKObject: An integer holding the unique identifier of an object. Use the catalog to get the object
pointer from its identifier:
Is possible (in C++) to set a function to calculate the value of this column for a given object. See GKColumn::setCFunction.
An attribute has two names, one internal accessible with GKColumn::getName and GKColumn::setName and one external accessible with GKColumn::getExternalName and GKColumn::setExternalName. Both names are set by the user when the attribute is created (using the GKType::addColumn method).
The internal name is a unique name among all the names for the attributes, is up to the user to guaranty that the name is unique (adding, as a prefix, the name of the class for this attribute is usually enough).
The external name is the name of the attribute that will be presented to the user. It do not need to be unique and can change during the lifetime of the attribute (and can be translated).
See GKType for information on Attribute Type.
A GKColumn can be marked as one of the following types via GKColumn:setConversion and GKColumn:getConversion:
This information is used by the generic editors to show the value of an attribute using the locale set by the user (since all the data in Aimsun is stored in metric units).
Note that only the generic editors and not the developer defined editors will automatically translate the data to (and from) the appropriate locale. The GKObject::setUserData only accepts metric units and the GKObject::getUserData returns only data in metric units regardless the information set via GKColumn:setConversion.
By default an attribute do not bellow to any of these types.
An attribute also hold the following information:
Use the GKModel::removeColumn to remove a column. This method will remove not only the column but the associated memory in each object that use it.
Only columns created by the user and thare are not internal can be deleted (see GKColumn::GKColumnType)
There are four types of attributes:
When using Python the function must be:
"object" is the object that will be evaluated. "res" is the returned value wich type must the one defined in GKColumn::setColumnType. The current implementation only support: String (QString), Int, UInt, Bool, Double, Date (QDate)
When using C the function must be (if a int is returned):
As in Python, "object" is the object that will be evaluated. "res" is the returned value wich type must the one defined in GKColumn::setColumnType. The current implementation only support: String (QString), Int (int), UInt (unsigned int), Bool (bool), Double (double), Date (QDate)
Enumerator | |
---|---|
eExternalTemporary | |
eInternal | |
eExternal | |
ePython | |
eC |
enum GKColumn::Type |
Same as QVariant types plus the GKObject pointer, GKTimeSerie and GKEnum.
GKColumn::GKColumn | ( | ) |
bool GKColumn::anyEnumString | ( | ) | const |
Returns true is enums strings have been associated in this column
const GKColumn::Type GKColumn::getColumnType | ( | ) | const |
See GKColumn::Type.
|
static |
Returns a user readable name of the column data type.
const GKContents & GKColumn::getContents | ( | ) | const |
Returns all the contents of the column.
const GK::Conversion GKColumn::getConversion | ( | ) | const |
See GKColumn description. To know if two columns have the same type use GKColumn::getConversionName instead as the comversion can be set to None and the user can set a name (veh/h for example for Flow).
QString GKColumn::getConversionName | ( | const GK::UnitSystem & | units | ) | const |
Returns the name of the units
QString GKColumn::getConversionNameTranslated | ( | const GK::UnitSystem & | units | ) | const |
Returns the name of the units, translated to the user language (if available)
const QString & GKColumn::getDescription | ( | ) | const |
A free text describing this columns.
QString GKColumn::getEnumString | ( | double | ) | const |
Returns the string associated with this value (if any) or the value itself as an string. Note that the value is a float to be used by enums and by time series.
QString GKColumn::getExternalName | ( | GKColumnNameFormat | format = eLongFormat | ) | const |
The name of this column as shown to the user. Can be edited and translated. If the column is a timeserie it can offer the name in either a long format, medium format and short format:
uint GKColumn::getId | ( | ) | const |
The ID of this column, valid during the life of system. This information is not store and will change every time a new system is created.
const QString & GKColumn::getName | ( | ) | const |
The internal, unique name of this column.
GKType * GKColumn::getObjectType | ( | ) | const |
Retruns the type of the objects that attributes of this column type can hold if the column type is _GKObject, or None for any type.
GKObject * GKColumn::getOriginator | ( | ) | const |
The object that has created this column (replication data after a simulation for example). Can be None as it is optional.
int GKColumn::getOriginatorId | ( | ) | const |
Returns the id of the object that has created this column.
const QString & GKColumn::getPythonCode | ( | ) | const |
Gets the python code for this attribute.
void * GKColumn::getPythonFunction | ( | ) | const |
Returns the compiled function. It returns a PyObject pointer but the declaration cannot be on this header as Python define the symbols that cannot be use in Qt (signal).
GKColumn * GKColumn::getRealColumn | ( | ) | const |
Returns (if any) the real column. See GKColumn::setRealColumn
const GKColumnType GKColumn::getStoreType | ( | ) | const |
|
static |
Returns a user readable name of the columnm storage type.
GKTSDescription * GKColumn::getTSDescription | ( | ) | const |
If the column type is _GKTimeSerie, the description
GKType * GKColumn::getType | ( | ) | const |
The type in where this column is.
bool GKColumn::getUsableInStyle | ( | ) | const |
True if this column can be use in a view style
double GKColumn::getValueFromGui | ( | const GK::UnitSystem & | , |
double | |||
) | const |
Returns the value of a column in metric system from the selected units.
double GKColumn::getValueToGui | ( | const GK::UnitSystem & | , |
double | |||
) | const |
Returns the value of a column in the selected units.
bool GKColumn::hasNumericValues | ( | ) | const |
Returns true if this column holds numeric values (Time Series and Segmented Attr. are numeric values too). Note that _GKObject are stored using the object id so they are numbers but this method will return false for _GKObject as they are "soft pointers" to objects rather that numeric values that can be manipulated using arithmetic operations.
bool GKColumn::isDynamic | ( | ) | const |
It's a dynamic column? See GKColumn::dynamic
bool GKColumn::isEditable | ( | ) | const |
If true the column values (in each object) can be edited by the user, if false only the application can set the values.
bool GKColumn::isOverridable | ( | ) | const |
If true, the column values (for each object) can be overrided in experiments through the network attribute overrides mechanism. By default, only those standard variables the simulator is using are overridable.
void GKColumn::setColumnType | ( | const GKColumn::Type | ) |
See GKColumn::Type.
void GKColumn::setConversion | ( | const GK::Conversion | , |
QString | = QString() , |
||
QString | = QString() |
||
) |
See GKColumn description
void GKColumn::setDescription | ( | const QString & | ) |
A free text describing this columns.
void GKColumn::setDynamic | ( | bool | ) |
Sets this column as dynamic (true) or static (false). See GKColumn::dynamic
void GKColumn::setEditable | ( | bool | ) |
If true the column values (in each object) can be edited by the user, if false only the application can set the values.
void GKColumn::setEnumString | ( | int | , |
const QString & | |||
) |
Set the name of a particular value.
void GKColumn::setExternalName | ( | const QString & | ) |
The name of this column as shown to the user. Can be edited and translated.
void GKColumn::setId | ( | uint | aid | ) |
The ID of this column, valid during the life of system. This information is not store and will change every time a new system is created.
void GKColumn::setName | ( | const QString & | ) |
The internal, unique name of this column.
void GKColumn::setObjectType | ( | const QString & | typeName | ) |
If the column type is _GKObject sets the type of the objects that can hold (or None for any type).
void GKColumn::setOverridable | ( | bool | value | ) |
If true the column values (for each object) can be overrided in experiments through the network attribute overrides mechanism. Caution: If you set a column to overridable, in general you should access its value through getModelConnection() in order to set the context that defines if an override is active or not. This is not needed for Aimsun cost functions, as they receive simulated objects (for example, simulated section instead of GKSection) which already evaluate correctly (as would the section.getModelConnection()).
\sa GKNetworkAttributesOverride
void GKColumn::setPythonCode | ( | const QString & | ) |
Sets the python code for this attribute. Changes the attribute type to ePython.
void GKColumn::setRealColumn | ( | GKColumn * | ) |
Set a column as real for this one. That means that, when reading or setting data using this column data will be read or set in the real column.
This column, thus, can be considered an alias of the real column.
void GKColumn::setStoreType | ( | const | GKColumnType | ) |
void GKColumn::setTSDescription | ( | GKTSDescription * | ts | ) |
If the column type is _GKTimeSerie, the description
void GKColumn::setType | ( | GKType * | ) |
The type in where this column is.
void GKColumn::setUsableInStyle | ( | bool | value | ) |
True if this column can be use in a view style
|
static |
Identifies the last generated simulation.