Aimsun Next Scripting
22
|
Public Types | |
enum | GKPreferencesAttributeType { eBool , eInt , eUInt , eString , eDouble , eEnum , eFileIn , eFileOut , eColor , eFolder , eObject } |
Public Member Functions | |
GKPreferencesAttribute () | |
~GKPreferencesAttribute () | |
void | setName (const QString &aname) |
const QString & | getName () const |
void | setExternalName (const QString &aname) |
const QString & | getExternalName () const |
void | setToolTip (const QString &atooltip) |
const QString & | getTooltip () const |
const QString & | getDefault () const |
void | setDefault (const QString &avalue) |
bool | isEditable () const |
void | setEditable (bool value) |
void | setType (const GKPreferencesAttributeType type) |
const GKPreferencesAttributeType | getType () const |
void | setObjectType (QString objectType) |
QString | getObjectType () const |
void | setEnumString (int value, const QString &string) |
const QString & | getEnumString (uint value) const |
const QVector< QString > & | getEnumStrings () const |
void | setFileFilter (const QString &afilter) |
QString | getFileFilter () const |
void | setLimits (double minValue, double maxValue) |
const QPair< double, double > & | getLimits () const |
void | setConversion (const GK::Conversion type) |
const GK::Conversion | getConversion () const |
This class contains information of an attribute used in the preferences like type of the data that contains (integer, boolean, string, double, enum) and information about any possible data conversion (Aimsun stores all the data in the metric system thus is possible that a conversion is needed to show the data in the current unit system set by the user. In order to make an automatic translation between unit systems an attribute need to know which kind of data holds: speed, acceleration, distance or weight).
An attribute has a name that must be unique (is up to the developer to ensure this) and an external name. The name identifies the attribute among all the other attributes in the system. The external name is used to present the attribute to the user in the GKPreferencesEditor.
Attributes of type Object (GKPreferencesAttribute::eObject) are only editable at model level and requires the spefification of the type of these objects (GKPreferencesAttribute::setObjectType).
An attribute can be editable (the default) and will appear in the preferences dialog or not (it will no appear in the preefernces dialog). A non editable attribute can be seem as an internal preference.
In the following example an attribute is created that holds a speed as a double:
And another example, this type a enum:
GKPreferencesAttribute::GKPreferencesAttribute | ( | ) |
GKPreferencesAttribute::~GKPreferencesAttribute | ( | ) |
const GK::Conversion GKPreferencesAttribute::getConversion | ( | ) | const |
Get the possible conversion needed by this type.
const QString & GKPreferencesAttribute::getDefault | ( | ) | const |
Returns the default value of this attribute.
const QString & GKPreferencesAttribute::getEnumString | ( | uint | value | ) | const |
Get the string associated with an integer value when the data type is enum.
const QVector< QString > & GKPreferencesAttribute::getEnumStrings | ( | ) | const |
Get the all the strings associated with an integer values when the data type is enum.
const QString & GKPreferencesAttribute::getExternalName | ( | ) | const |
Get the external name of this object.
QString GKPreferencesAttribute::getFileFilter | ( | ) | const |
If the attribute is a file returns the file filter for the browser file dialog. No other check is done using this filter.
const QPair< double, double > & GKPreferencesAttribute::getLimits | ( | ) | const |
Gets, for numerical values, the minimum and the maximum (included) allowed values. If no limit exists then both values will be 0.0
const QString & GKPreferencesAttribute::getName | ( | ) | const |
Get the name of this object.
QString GKPreferencesAttribute::getObjectType | ( | ) | const |
When the attribute is an object, the object type
const QString & GKPreferencesAttribute::getTooltip | ( | ) | const |
Gets the tooltip for the object.
const GKPreferencesAttributeType GKPreferencesAttribute::getType | ( | ) | const |
Gte the data type that this attribute holds.
bool GKPreferencesAttribute::isEditable | ( | ) | const |
Returns true if the attribute can be edited in the preferences dialog, if not it will not appear on it.
void GKPreferencesAttribute::setConversion | ( | const GK::Conversion | type | ) |
Set the possible conversion needed by this type specifiying which kind of data holds.
void GKPreferencesAttribute::setDefault | ( | const QString & | avalue | ) |
Set the default value for this attribute. Call this method after calling GKPreferencesAttribute::setType since setType method sets default values.
void GKPreferencesAttribute::setEditable | ( | bool | value | ) |
Set this object as editable or not. See GKPreferencesAttribute::isEditable
void GKPreferencesAttribute::setEnumString | ( | int | value, |
const QString & | string | ||
) |
Set a string associated with an integer value when the data type is enum.
void GKPreferencesAttribute::setExternalName | ( | const QString & | aname | ) |
Set the external name of this object. This name will be used to label this attribute when it is presented to the user.
void GKPreferencesAttribute::setFileFilter | ( | const QString & | afilter | ) |
If the attribute is a file sets the file filter for the browser file dialog. No other check is done using this filter.
void GKPreferencesAttribute::setLimits | ( | double | minValue, |
double | maxValue | ||
) |
For numerical values the minimum and the maximum (included) allowed values. If no limit exists then set both values to 0.0
void GKPreferencesAttribute::setName | ( | const QString & | aname | ) |
Set the name for this object. Must be unique. Is it resposibility of the developer to ensure that it is unique.
void GKPreferencesAttribute::setObjectType | ( | QString | objectType | ) |
When the attribute is an object, the object type
void GKPreferencesAttribute::setToolTip | ( | const QString & | atooltip | ) |
Sets the tooltip for the object.
void GKPreferencesAttribute::setType | ( | const GKPreferencesAttributeType | type | ) |
Set the data type that this attribute holds. It also sets a default value based on the type: