Aimsun Next Scripting  22
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
GKColumn Class Reference

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
 
GKTypegetType () const
 
void setType (GKType *)
 
GKObjectgetOriginator () const
 
int getOriginatorId () const
 
const GKContentsgetContents () 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)
 
GKTypegetObjectType () const
 
GKTSDescriptiongetTSDescription () 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 *)
 
GKColumngetRealColumn () 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
 

Detailed Description

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).

Types

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:

GKModel *model;
GKObject *object;
...
object = model->getCatalog().find( objValue );
GKObject * find(uint) const
Finds an object by id. If no object is found a None will be returned.
This class contains all the objects in a model.
Definition: GKModel.sip:62
const GKCatalog & getCatalog() const
Returns the catalog.
Main class, almost all the objects derive from this class.
Definition: GKObject.sip:238

Is possible (in C++) to set a function to calculate the value of this column for a given object. See GKColumn::setCFunction.

Attribute Names

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).

Attribute Type

See GKType for information on Attribute Type.

Locale Conversion

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.

Extra Information

An attribute also hold the following information:

Deleting an attribute

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)

See also
GKType, GKObject

Member Enumeration Documentation

◆ GKColumnNameFormat

Enumerator
eLongFormat 
eMediumFormat 
eShortFormat 

◆ GKColumnType

There are four types of attributes:

  • internal (eInternal): exists in C++ and the user just make it accessible.
  • external (eExternal): does not exist in C++. Aimsun Next will provide storage in memory and in disk for it.
  • external temporary (eExternalTemporary): does not exist in C++. Aimsun Next will provide storage in memory (it will not be saved in disk).
  • python (ePython): a python function that returns the value of the attribute.
  • C (eC): a C function that returns the value of the attribute.

When using Python the function must be:

def eval_attr( object ):
# compute the value
return res

"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):

int eval_attr( GKObject * object )
{
int res = 0;
// compute the value
return res;
}

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 

◆ Type

Same as QVariant types plus the GKObject pointer, GKTimeSerie and GKEnum.

Enumerator
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 

Constructor & Destructor Documentation

◆ GKColumn()

GKColumn::GKColumn ( )

Member Function Documentation

◆ anyEnumString()

bool GKColumn::anyEnumString ( ) const

Returns true is enums strings have been associated in this column

◆ getColumnType()

const GKColumn::Type GKColumn::getColumnType ( ) const

◆ getColumnTypeName()

static QString GKColumn::getColumnTypeName ( const GKColumn::Type )
static

Returns a user readable name of the column data type.

◆ getContents()

const GKContents & GKColumn::getContents ( ) const

Returns all the contents of the column.

◆ getConversion()

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).

◆ getConversionName()

QString GKColumn::getConversionName ( const GK::UnitSystem units) const

Returns the name of the units

◆ getConversionNameTranslated()

QString GKColumn::getConversionNameTranslated ( const GK::UnitSystem units) const

Returns the name of the units, translated to the user language (if available)

◆ getDescription()

const QString & GKColumn::getDescription ( ) const

A free text describing this columns.

◆ getEnumString()

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.

◆ getExternalName()

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:

  • Long format: the external name as set by the user
  • Medium format: using GKColumn::getContentName the two first entries (variable type and vehicle name usualy)
  • Short format: using GKColumn::getContentName the first first entry (variable type usualy)

◆ getId()

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.

◆ getName()

const QString & GKColumn::getName ( ) const

The internal, unique name of this column.

◆ getObjectType()

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.

◆ getOriginator()

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.

◆ getOriginatorId()

int GKColumn::getOriginatorId ( ) const

Returns the id of the object that has created this column.

  • '0' stands for None.
  • eLastGenerated stands for the last generated simulation.

◆ getPythonCode()

const QString & GKColumn::getPythonCode ( ) const

Gets the python code for this attribute.

◆ getPythonFunction()

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).

◆ getRealColumn()

GKColumn * GKColumn::getRealColumn ( ) const

Returns (if any) the real column. See GKColumn::setRealColumn

◆ getStoreType()

const GKColumnType GKColumn::getStoreType ( ) const

◆ getStoreTypeName()

static QString GKColumn::getStoreTypeName ( const GKColumn::GKColumnType )
static

Returns a user readable name of the columnm storage type.

◆ getTSDescription()

GKTSDescription * GKColumn::getTSDescription ( ) const

If the column type is _GKTimeSerie, the description

◆ getType()

GKType * GKColumn::getType ( ) const

The type in where this column is.

◆ getUsableInStyle()

bool GKColumn::getUsableInStyle ( ) const

True if this column can be use in a view style

◆ getValueFromGui()

double GKColumn::getValueFromGui ( const GK::UnitSystem ,
double   
) const

Returns the value of a column in metric system from the selected units.

◆ getValueToGui()

double GKColumn::getValueToGui ( const GK::UnitSystem ,
double   
) const

Returns the value of a column in the selected units.

◆ hasNumericValues()

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.

◆ isDynamic()

bool GKColumn::isDynamic ( ) const

It's a dynamic column? See GKColumn::dynamic

◆ isEditable()

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.

◆ isOverridable()

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.

See also
GKNetworkAttributesOverride

◆ setColumnType()

void GKColumn::setColumnType ( const GKColumn::Type  )

◆ setConversion()

void GKColumn::setConversion ( const GK::Conversion  ,
QString  = QString(),
QString  = QString() 
)

See GKColumn description

◆ setDescription()

void GKColumn::setDescription ( const QString &  )

A free text describing this columns.

◆ setDynamic()

void GKColumn::setDynamic ( bool  )

Sets this column as dynamic (true) or static (false). See GKColumn::dynamic

◆ setEditable()

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.

◆ setEnumString()

void GKColumn::setEnumString ( int  ,
const QString &   
)

Set the name of a particular value.

◆ setExternalName()

void GKColumn::setExternalName ( const QString &  )

The name of this column as shown to the user. Can be edited and translated.

◆ setId()

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.

◆ setName()

void GKColumn::setName ( const QString &  )

The internal, unique name of this column.

◆ setObjectType()

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).

◆ setOverridable()

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

◆ setPythonCode()

void GKColumn::setPythonCode ( const QString &  )

Sets the python code for this attribute. Changes the attribute type to ePython.

◆ setRealColumn()

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.

◆ setStoreType()

void GKColumn::setStoreType ( const  GKColumnType)

◆ setTSDescription()

void GKColumn::setTSDescription ( GKTSDescription ts)

If the column type is _GKTimeSerie, the description

◆ setType()

void GKColumn::setType ( GKType )

The type in where this column is.

◆ setUsableInStyle()

void GKColumn::setUsableInStyle ( bool  value)

True if this column can be use in a view style

Member Data Documentation

◆ eLastGenerated

const int GKColumn::eLastGenerated
static

Identifies the last generated simulation.

© Aimsun SLU
Aimsun ®