Aimsun Next Scripting: GKPreferencesAttribute Class Reference
Aimsun Next Scripting  22
Public Types | Public Member Functions | List of all members
GKPreferencesAttribute Class Reference

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
 

Detailed Description

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:

attr.setName( "GKSection::DefaultSpeed" )
attr.setExternalName( "Default Speed" )
attr.setConversion( GK::eSpeed )
attr.setDefault( "50" )
group.addAttribute( attr )
A value for an attribute in the preferences.
Definition: GKPreferencesAttribute.sip:71
void setDefault(const QString &avalue)
void setConversion(const GK::Conversion type)
@ eDouble
Definition: GKPreferencesAttribute.sip:110
void setName(const QString &aname)
void setExternalName(const QString &aname)
void setType(const GKPreferencesAttributeType type)
A road section definition.
Definition: GKSection.sip:29
Definition: GK.sip:19

And another example, this type a enum:

attr.setName( "GKModel::Language" )
attr.setExternalName( "Language" )
attr.setEnumString( 0, "Spanish" )
attr.setEnumString( 1, "English" )
attr.setEnumString( 2, "German" )
attr.setEnumString( 3, "French" )
attr.setDefault( "1" )
group.addAttribute( attr )
This class contains all the objects in a model.
Definition: GKModel.sip:62
void setEnumString(int value, const QString &string)
@ eEnum
Definition: GKPreferencesAttribute.sip:110
See also
GKPreferences, GKPreferencesValues, GKPreferencesGroup, GKPreferencesEditor

Member Enumeration Documentation

◆ GKPreferencesAttributeType

Enumerator
eBool 
eInt 
eUInt 
eString 
eDouble 
eEnum 
eFileIn 
eFileOut 
eColor 
eFolder 
eObject 

Constructor & Destructor Documentation

◆ GKPreferencesAttribute()

GKPreferencesAttribute::GKPreferencesAttribute ( )

◆ ~GKPreferencesAttribute()

GKPreferencesAttribute::~GKPreferencesAttribute ( )

Member Function Documentation

◆ getConversion()

const GK::Conversion GKPreferencesAttribute::getConversion ( ) const

Get the possible conversion needed by this type.

◆ getDefault()

const QString & GKPreferencesAttribute::getDefault ( ) const

Returns the default value of this attribute.

◆ getEnumString()

const QString & GKPreferencesAttribute::getEnumString ( uint  value) const

Get the string associated with an integer value when the data type is enum.

◆ getEnumStrings()

const QVector< QString > & GKPreferencesAttribute::getEnumStrings ( ) const

Get the all the strings associated with an integer values when the data type is enum.

◆ getExternalName()

const QString & GKPreferencesAttribute::getExternalName ( ) const

Get the external name of this object.

◆ getFileFilter()

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.

◆ getLimits()

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

◆ getName()

const QString & GKPreferencesAttribute::getName ( ) const

Get the name of this object.

◆ getObjectType()

QString GKPreferencesAttribute::getObjectType ( ) const

When the attribute is an object, the object type

◆ getTooltip()

const QString & GKPreferencesAttribute::getTooltip ( ) const

Gets the tooltip for the object.

◆ getType()

const GKPreferencesAttributeType GKPreferencesAttribute::getType ( ) const

Gte the data type that this attribute holds.

◆ isEditable()

bool GKPreferencesAttribute::isEditable ( ) const

Returns true if the attribute can be edited in the preferences dialog, if not it will not appear on it.

◆ setConversion()

void GKPreferencesAttribute::setConversion ( const GK::Conversion  type)

Set the possible conversion needed by this type specifiying which kind of data holds.

◆ setDefault()

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.

◆ setEditable()

void GKPreferencesAttribute::setEditable ( bool  value)

Set this object as editable or not. See GKPreferencesAttribute::isEditable

◆ setEnumString()

void GKPreferencesAttribute::setEnumString ( int  value,
const QString &  string 
)

Set a string associated with an integer value when the data type is enum.

◆ setExternalName()

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.

◆ setFileFilter()

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.

◆ setLimits()

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

◆ setName()

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.

◆ setObjectType()

void GKPreferencesAttribute::setObjectType ( QString  objectType)

When the attribute is an object, the object type

◆ setToolTip()

void GKPreferencesAttribute::setToolTip ( const QString &  atooltip)

Sets the tooltip for the object.

◆ setType()

void GKPreferencesAttribute::setType ( const GKPreferencesAttributeType  type)

Set the data type that this attribute holds. It also sets a default value based on the type:

  • numeric: 0
  • string: empty string

© Aimsun SLU
Aimsun ®